Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleTransfer.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Tab.XtupleTransfer = new Roo.XComponent({
6     part     :  ["Xtuple","Transfer"],
7     order    : '700-Pman.Tab.XtupleTransfer',
8     region   : 'center',
9     parent   : 'Pman.Tab.XtupleSales',
10     name     : "unnamed module",
11     disabled : false, 
12     permname : '', 
13     _tree : function()
14     {
15         var _this = this;
16         var MODULE = this;
17         return {
18             xtype: 'GridPanel',
19             xns: Roo,
20             listeners : {
21                 activate : function() {
22                     _this.panel = this;
23                     if (_this.grid) {
24                         _this.grid.footer.onClick('first');
25                     }
26                 }
27             },
28             background : true,
29             fitContainer : true,
30             fitToframe : true,
31             region : 'center',
32             tableName : 'invhist_transfer',
33             title : "Transfers",
34             grid : {
35                 xtype: 'Grid',
36                 xns: Roo.grid,
37                 listeners : {
38                     render : function() 
39                     {
40                         _this.grid = this; 
41                         _this.dialog =Pman.Dialog.XtupleTransfer;
42                         if (_this.panel.active) {
43                            this.footer.onClick('first');
44                         }
45                     },
46                     rowdblclick : function (_self, rowIndex, e)
47                     {
48                          var sel = _this.postedCombo.getValue();
49                          
50                          var tdb = baseURL.split('/').pop().split('.').shift();
51                          
52                          
53                          if (sel.match(/^office-/)) {
54                               tdb = sel.split('-').pop();
55                              
56                          }
57                         
58                         
59                         if (!_this.dialog) return;
60                         
61                         var data = this.getDataSource().getAt(rowIndex).data;
62                         
63                         
64                         _this.dialog.show( {
65                              invhist_transfer_id : data.invhist_transfer_id,
66                              _roo_office : tdb
67                              }, function() {
68                             _this.grid.footer.onClick('first');
69                         }); 
70                     },
71                     rowclass : function (gridview, rowcfg)
72                     {
73                         if(rowcfg.record.data.invhist_transfer_void){
74                             rowcfg.rowClass = 'strikethrough';
75                         }
76                     }
77                 },
78                 autoExpandColumn : 'invhist_transfer_descrip',
79                 loadMask : true,
80                 dataSource : {
81                     xtype: 'Store',
82                     xns: Roo.data,
83                     listeners : {
84                         beforeload : function (_self, o)
85                         {
86                             var tdb = baseURL.split('/').pop().split('.').shift();     
87                             o.params._roo_office = tdb;
88                             o.params['query[location_id]'] = _this.locCombo.getValue();
89                             o.params['query[invhist_transfer_number]'] = _this.searchBox.getValue();
90                             var sel = _this.postedCombo.getValue();
91                             switch (sel) {
92                                 case 'VOIDED': 
93                                     o.params.invhist_transfer_void = 1; 
94                                     break;
95                                 case 'POSTED': 
96                                     o.params.invhist_transfer_posted = 1; 
97                                     break;
98                                 case 'UNPOSTED': 
99                                     o.params.invhist_transfer_posted = 0; 
100                                     o.params.invhist_transfer_void = 0; 
101                                     break;        
102                                 case 'ALL': 
103                                     break;
104                                 default: 
105                                     if (!sel.match(/^office-/)) {
106                                         break;
107                                     }
108                                     delete o.params['query[location_id]'];
109                                     
110                                     o.params._roo_office=  sel.replace(/^office-/,'');
111                                     o.params.cust_to_internalcompany = tdb;
112                                     break;
113                             }
114                             var dt = _this.dateSel.getValue();
115                            
116                             o.params['query[dateSel]'] = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');
117                             
118                         
119                             
120                             
121                         }
122                     },
123                     remoteSort : true,
124                     sortInfo : { field : 'invhist_transfer_transdate', direction: 'DESC' },
125                     proxy : {
126                         xtype: 'HttpProxy',
127                         xns: Roo.data,
128                         method : 'GET',
129                         url : baseURL + '/Xtuple/Roo/invhist_transfer.php'
130                     },
131                     reader : {
132                         xtype: 'JsonReader',
133                         xns: Roo.data,
134                         totalProperty : 'total',
135                         root : 'data',
136                         id : 'id',
137                         fields : [
138                             {
139                                 'name': 'invhist_transfer_id',
140                                 'type': 'int'
141                             },
142                             {
143                                 'name': 'invhist_transfer_transdate',
144                                 'type': 'date',
145                                 'dateFormat': 'Y-m-d'
146                             },
147                             {
148                                 'name': 'invhist_transfer_number',
149                                 'type': 'string'
150                             },
151                             {
152                                 'name': 'invhist_transfer_from',
153                                 'type': 'int'
154                             },
155                             {
156                                 'name': 'invhist_transfer_to',
157                                 'type': 'int'
158                             },
159                             {
160                                 'name': 'invhist_transfer_descrip',
161                                 'type': 'string'
162                             }
163                         ]
164                     }
165                 },
166                 footer : {
167                     xtype: 'PagingToolbar',
168                     xns: Roo,
169                     pageSize : 25,
170                     displayInfo : true,
171                     displayMsg : "Displaying invhist_transfer{0} - {1} of {2}",
172                     emptyMsg : "No invhist_transfer found",
173                     items : [
174                         {
175                             xtype: 'Button',
176                             xns: Roo.Toolbar,
177                             listeners : {
178                                 click : function (_self, e)
179                                 {
180                                     new Pman.Download({
181                                         grid : _this.grid
182                                     });
183                                     Roo.MessageBox.alert("Downloading", "Report is downloading");
184                                 }
185                             },
186                             text : "Download"
187                         }
188                     ]
189                 },
190                 toolbar : {
191                     xtype: 'Toolbar',
192                     xns: Roo,
193                     items : [
194                         {
195                             xtype: 'TextField',
196                             xns: Roo.form,
197                             listeners : {
198                                 render : function (_self)
199                                 {
200                                   _this.searchBox = _self;
201                                 },
202                                 specialkey : function (_self, e)
203                                 {
204                                     _this.grid.footer.onClick('first');
205                                 }
206                             }
207                         },
208                         {
209                             xtype: 'ComboBox',
210                             xns: Roo.form,
211                             listeners : {
212                                 select : function (combo, record, index)
213                                 {
214                                  _this.grid.footer.onClick('first');
215                                 },
216                                 render : function (_self)
217                                 {
218                                     _this.locCombo = _self;
219                                 }
220                             },
221                             allowBlank : true,
222                             displayField : 'location_name',
223                             editable : true,
224                             emptyText : "Select location",
225                             fieldLabel : 'location',
226                             forceSelection : true,
227                             hiddenName : 'location_id',
228                             listWidth : 400,
229                             loadingText : "Searching...",
230                             minChars : 2,
231                             name : 'location_id',
232                             pageSize : 200,
233                             qtip : "Select location",
234                             queryParam : 'query[location_name]',
235                             selectOnFocus : true,
236                             tpl : '<div class="x-grid-cell-text x-btn button"><b>{location_name}</b>  - <b style="color:red">{location_cust_id_char_internalcompany} </b> {location_descrip} </div>',
237                             triggerAction : 'all',
238                             typeAhead : true,
239                             valueField : 'location_id',
240                             width : 250,
241                             store : {
242                                 xtype: 'Store',
243                                 xns: Roo.data,
244                                 listeners : {
245                                     beforeload : function (_self, o){
246                                         o.params = o.params || {};
247                                         // set more here
248                                         o.params.location_restrict = 0;
249                                       
250                                     }
251                                 },
252                                 remoteSort : true,
253                                 sortInfo : { direction : 'ASC', field: 'location_name' },
254                                 proxy : {
255                                     xtype: 'HttpProxy',
256                                     xns: Roo.data,
257                                     method : 'GET',
258                                     url : baseURL + '/Roo/location.php'
259                                 },
260                                 reader : {
261                                     xtype: 'JsonReader',
262                                     xns: Roo.data,
263                                     id : 'id',
264                                     root : 'data',
265                                     totalProperty : 'total',
266                                     fields : [{"name":"id","type":"int"},{"name":"location_name","type":"string"}]
267                                 }
268                             }
269                         },
270                         {
271                             xtype: 'ComboBox',
272                             xns: Roo.form,
273                             listeners : {
274                                 select : function (combo, record, index)
275                                 {
276                                   _this.grid.footer.onClick('first');
277                                 },
278                                 render : function (_self)
279                                 {
280                                   _this.postedCombo = _self;
281                                 }
282                             },
283                             allowBlank : false,
284                             displayField : 'title',
285                             editable : false,
286                             emptyText : "Select Action",
287                             forceSelection : true,
288                             listWidth : 300,
289                             loadingText : "Searching...",
290                             minChars : 2,
291                             name : 'action',
292                             pageSize : 20,
293                             qtip : "Select Action",
294                             selectOnFocus : true,
295                             tpl : '<div class="x-grid-cell-text x-btn button"><b>{title}</b> </div>',
296                             triggerAction : 'all',
297                             typeAhead : true,
298                             value : "ALL",
299                             valueField : 'code',
300                             width : 150,
301                             store : {
302                                 xtype: 'SimpleStore',
303                                 xns: Roo.data,
304                                 isLocal : true,
305                                 data : (function() { 
306                                     var ret = [
307                                         [ 'ALL', 'All Transactions' ],
308                                         [ 'UNPOSTED', 'Unposted' ],
309                                         [ 'POSTED', 'Posted' ],
310                                         [ 'VOIDED', 'Voided' ],
311                                         [ '--', '-----------------' ]    
312                                     ];
313                                     var c = baseURL.split('/').pop().split('.').shift();     
314                                     Roo.each(uiConfig.xtuple_offices, function(o) {
315                                         if (o == c) {
316                                             return;
317                                         }
318                                         ret.push( [ 'office-' + o,    "Transfers from " +   Pman.Xtuple.offices[o] ] );
319                                 
320                                     });
321                                     
322                                     return ret;
323                                     
324                                     
325                                 })(),
326                                 fields : [ 'code', 'title' ]
327                             }
328                         },
329                         {
330                             xtype: 'DateField',
331                             xns: Roo.form,
332                             listeners : {
333                                 render : function (_self)
334                                 {
335                                     _this.dateSel = _self;
336                                 },
337                                 select : function (combo, date)
338                                 {
339                                     _this.grid.footer.onClick('first');
340                                 }
341                             },
342                             allowBlank : true,
343                             fieldLabel : 'Date',
344                             format : 'Y-m-d',
345                             width : 150
346                         },
347                         {
348                             xtype: 'Button',
349                             xns: Roo.Toolbar,
350                             listeners : {
351                                 click : function (_self, e)
352                                 {
353                                 _this.grid.footer.onClick('first');
354                                 }
355                             },
356                             cls : 'x-btn-icon',
357                             icon : rootURL + '/Pman/templates/images/search.gif'
358                         },
359                         {
360                             xtype: 'Button',
361                             xns: Roo.Toolbar,
362                             listeners : {
363                                 click : function (_self, e)
364                                 {
365                                     _this.searchBox.setValue('');
366                                     
367                                     _this.locCombo.setValue(''); 
368                                 
369                                     
370                                     _this.grid.footer.onClick('first');
371                                 }
372                             },
373                             cls : 'x-btn-icon',
374                             icon : rootURL + '/Pman/templates/images/edit-clear.gif'
375                         },
376                         {
377                             xtype: 'Fill',
378                             xns: Roo.Toolbar
379                         },
380                         {
381                             xtype: 'Button',
382                             xns: Roo.Toolbar,
383                             listeners : {
384                                 click : function()
385                                 {
386                                     
387                                      var sel = _this.postedCombo.getValue();
388                                      if (sel.match(/^office-/)) {
389                                         Roo.Msg.alert('Error', "You can create transfers for another office");
390                                         return;
391                                      }
392                                     
393                                     var s = _this.grid.selModel.getSelected();
394                                     if (!s) {
395                                         Roo.MessageBox.alert("Error", "Select a row to copy");
396                                         return;
397                                     }
398                                     
399                                     new Pman.Request({
400                                         url : baseURL + '/Roo/invhist_transfer',
401                                         method : 'POST',
402                                         mask: 'Processing',
403                                         timeout : 1200000, //20 minutes...! - big xfer should be 10mins.
404                                         params : {
405                                             invhist_transfer_id : s.data.invhist_transfer_id,
406                                             _copy : 1
407                                         },
408                                         success : function () 
409                                         {
410                                             _this.grid.footer.onClick('refresh');
411                                         }
412                                     });
413                                     
414                                 }
415                             },
416                             cls : 'x-btn-text-icon',
417                             text : "Copy Transfer",
418                             icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
419                         },
420                         {
421                             xtype: 'Separator',
422                             xns: Roo.Toolbar
423                         },
424                         {
425                             xtype: 'Button',
426                             xns: Roo.Toolbar,
427                             listeners : {
428                                 click : function()
429                                 {
430                                     
431                                      var sel = _this.postedCombo.getValue();
432                                      if (sel.match(/^office-/)) {
433                                         Roo.Msg.alert('Error', "You can create transfers for another office");
434                                         return;
435                                      }
436                                     
437                                     if (!_this.dialog) return;
438                                     _this.dialog.show( { id : 0, _roo_office : baseURL.split('/').pop().split('.').shift() } , function() {
439                                         _this.grid.footer.onClick('first');
440                                    }); 
441                                 }
442                             },
443                             cls : 'x-btn-text-icon',
444                             text : "Add",
445                             icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
446                         },
447                         {
448                             xtype: 'Separator',
449                             xns: Roo.Toolbar
450                         },
451                         {
452                             xtype: 'Button',
453                             xns: Roo.Toolbar,
454                             listeners : {
455                                 click : function()
456                                 {
457                                     
458                                      var sel = _this.postedCombo.getValue();
459                                      if (sel.match(/^office-/)) {
460                                         Roo.Msg.alert('Error', 'You can not create reversals of transfer from another office');
461                                         return;
462                                      }
463                                      
464                                     
465                                     var s = _this.grid.getSelectionModel().getSelected();
466                                     if(!s){
467                                         Roo.Msg.alert('Error', 'Please select a row!');
468                                         return;
469                                     }
470                                     Roo.log(s);
471                                     if(s.data.cust_to_internalcompany.length > 0){
472                                         Roo.Msg.confirm("Comfirm", "Are you sure? <br/>" + 
473                                             "This will create a transfer in the other company dragon, you will need to log to that company and post for it to happen.<br/>" +
474                                             "Otherwise, it just creates a transfer, and then opens the dialog to edit it.", 
475                                             function(r) {
476                                                 if (r != 'yes') {
477                                                     return;
478                                                 }
479                                                
480                                                Roo.Msg.alert('Warnning', 'Sorry, it is comming soon !!');
481                                             }
482                                         );
483                                         
484                                         return;
485                                     }
486                                     
487                                     
488                                     Roo.Msg.confirm("Comfirm", "Are you sure? <br/>" + 
489                                         "You can void a transfer, however if you need to reverse a transfer at a different date press 'yes', and a new transfer will be created.", 
490                                         function(r) {
491                                             if (r != 'yes') {
492                                                 return;
493                                             }
494                                             var data = {
495                                                 invhist_transfer_transdate : new Date(),
496                                                 invhist_transfer_arrivaldate : new Date(),
497                                                 invhist_transfer_to : s.data.invhist_transfer_from_location_id,
498                                                 invhist_transfer_to_location_descrip : s.data.invhist_transfer_from_location_descrip,
499                                                 invhist_transfer_from : s.data.invhist_transfer_to_location_id,
500                                                 invhist_transfer_from_location_descrip : s.data.invhist_transfer_to_location_descrip,
501                                                 invhist_transfer_price : s.data.invhist_transfer_price,
502                                                 invhist_transfer_descrip : s.data.invhist_transfer_descrip,
503                                                 _createReverse : s.data.invhist_transfer_id
504                                                 
505                                             };
506                                            _this.dialog.show( data, function() {
507                                                 _this.grid.footer.onClick('first');
508                                             }); 
509                                            
510                                         }
511                                     );
512                                     return;
513                                    
514                                 }
515                             },
516                             cls : 'x-btn-text-icon',
517                             text : "Create Reverse Transfer",
518                             icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
519                         },
520                         {
521                             xtype: 'Separator',
522                             xns: Roo.Toolbar
523                         },
524                         {
525                             xtype: 'Button',
526                             xns: Roo.Toolbar,
527                             listeners : {
528                                 click : function()
529                                 {
530                                       var sel = _this.postedCombo.getValue();
531                                       if (sel.match(/^office-/)) {
532                                         Roo.Msg.alert('Error', "You can not Post transfer from another office");
533                                         return;
534                                      }
535                                      var s = _this.grid.selModel.getSelected();
536                                     if (!s) {
537                                         Roo.MessageBox.alert("Error", "Select a row to post");
538                                         return;
539                                     }
540                                     
541                                     if(s.data.invhist_transfer_void){
542                                         Roo.MessageBox.alert("Error", "You can not post a voided transfer");
543                                         return;
544                                     }
545                                     
546                                     var msg = "Posting";
547                                     
548                                     if (s.data.cust_from_internalcompany.length || s.data.cust_to_internalcompany.length) {
549                                         msg += " Cross company transfer - large orders may take some time, so do not cancel or reload";
550                                     }
551                                     
552                                     
553                                     new Pman.Request({
554                                         url : baseURL + '/Roo/invhist_transfer',
555                                         method : 'POST',
556                                         mask: msg,
557                                         timeout : 1200000, //20 minutes...! - big xfer should be 10mins.
558                                         params : {
559                                             invhist_transfer_id : s.data.invhist_transfer_id,
560                                             _post : 1
561                                         },
562                                         success : function () 
563                                         {
564                                             _this.grid.footer.onClick('refresh');
565                                         }
566                                     });
567                                     
568                                 }
569                             },
570                             cls : 'x-btn-text-icon',
571                             text : "Post",
572                             icon : rootURL + '/Pman/templates/images/mail-close.gif'
573                         },
574                         {
575                             xtype: 'Separator',
576                             xns: Roo.Toolbar
577                         },
578                         {
579                             xtype: 'Button',
580                             xns: Roo.Toolbar,
581                             listeners : {
582                                 click : function()
583                                 {
584                                        var sel = _this.postedCombo.getValue();
585                                        if (sel.match(/^office-/)) {
586                                         Roo.Msg.alert('Error', "You can not Post transfer from coid office");
587                                         return;
588                                      }
589                                     
590                                     var s = _this.grid.selModel.getSelected();
591                                     if (!s) {
592                                         Roo.MessageBox.alert("Error", "Select a row to void");
593                                         return;
594                                     }
595                                     
596                                     var voidposted = function(){
597                                         new Pman.Request({
598                                             url : baseURL + '/Roo/invhist_transfer',
599                                             method : 'POST',
600                                             mask : "Voiding",
601                                             timeout : 90000,
602                                             params : {
603                                                 invhist_transfer_id : s.data.invhist_transfer_id,
604                                                 _void : 1
605                                             },
606                                             success : function () 
607                                             {
608                                                 _this.grid.footer.onClick('refresh');
609                                             }
610                                         });
611                                     }
612                                     
613                                     var voidunposted = function(){
614                                         new Pman.Request({
615                                             url : baseURL + '/Roo/invhist_transfer',
616                                             method : 'POST',
617                                             mask : "Voiding",
618                                             params : {
619                                                 invhist_transfer_id : s.data.invhist_transfer_id,
620                                                 invhist_transfer_void : 1
621                                             },
622                                             success : function () 
623                                             {
624                                                 _this.grid.footer.onClick('refresh');
625                                             }
626                                         });
627                                     }
628                                     
629                                     
630                                     var posted = s.data.invhist_transfer_posted;
631                                     
632                                     Roo.MessageBox.confirm("Confirm", "Are you sure you want to void that", 
633                                         function(r) {
634                                             if (r != 'yes') {
635                                                 return;
636                                             }
637                                             if(posted){
638                                                 voidposted();
639                                                 return;
640                                             }       
641                                             voidunposted();
642                                         }
643                                     )
644                                     
645                                 }
646                             },
647                             cls : 'x-btn-text-icon',
648                             text : "Void",
649                             icon : rootURL + '/Pman/templates/images/trash.gif'
650                         }
651                     ]
652                 },
653                 colModel : [
654                     {
655                         xtype: 'ColumnModel',
656                         xns: Roo.grid,
657                         dataIndex : 'invhist_transfer_posted',
658                         header : 'Posted',
659                         width : 75,
660                         renderer : function(v) {  
661                             var state = v * 1 > 0 ?  '-checked' : '';
662                         
663                             return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
664                                         
665                          }
666                     },
667                     {
668                         xtype: 'ColumnModel',
669                         xns: Roo.grid,
670                         dataIndex : 'invhist_transfer_transdate',
671                         header : 'Date',
672                         sortable : true,
673                         width : 75,
674                         renderer : function(v) { 
675                         
676                             return String.format('{0}', v ? Date.parseDate(v.split(' ').shift(),'Y-m-d').format('d/M/Y') : '');
677                          }
678                     },
679                     {
680                         xtype: 'ColumnModel',
681                         xns: Roo.grid,
682                         dataIndex : 'invhist_transfer_arrivaldate',
683                         header : 'Arrival',
684                         sortable : true,
685                         width : 75,
686                         renderer : function(v) { 
687                         
688                             return String.format('{0}', v ? Date.parseDate(v.split(' ').shift(),'Y-m-d').format('d/M/Y') : '');
689                          }
690                     },
691                     {
692                         xtype: 'ColumnModel',
693                         xns: Roo.grid,
694                         dataIndex : 'invhist_transfer_number',
695                         header : 'reference#',
696                         sortable : true,
697                         width : 100,
698                         renderer : function(v,x,r) { 
699                         
700                              var sel = _this.postedCombo.getValue();
701                               var p = baseURL.split('/').pop().split('.').shift().toUpperCase();;
702                             if (sel.match(/^office-/)) {
703                                p = sel.split('-').pop().toUpperCase();
704                              }
705                             
706                             return String.format(r.data.invhist_transfer_void ? '<s>{0}</s>' : '{0}', p+':'+v); 
707                             
708                         }
709                     },
710                     {
711                         xtype: 'ColumnModel',
712                         xns: Roo.grid,
713                         dataIndex : 'invhist_transfer_from_location_name',
714                         header : 'From',
715                         sortable : true,
716                         width : 150,
717                         renderer : function(v,x,r) { 
718                         
719                             var lv = _this.locCombo.getValue();
720                              var fmt = lv == r.data.invhist_transfer_from   ? '<B>{0}</B>' : '{0}';
721                              if (r.data.cust_from_internalcompany.length) {
722                                 fmt = '<span style="color:red">[Intercompany {1}] ' + fmt + '</span>';
723                              }
724                              
725                             return String.format(fmt, v,r.data.cust_from_internalcompany );  
726                         }
727                     },
728                     {
729                         xtype: 'ColumnModel',
730                         xns: Roo.grid,
731                         dataIndex : 'invhist_transfer_to_location_name',
732                         header : 'To',
733                         sortable : true,
734                         width : 150,
735                         renderer : function(v,x,r) { 
736                         
737                             var lv = _this.locCombo.getValue();
738                             var fmt = lv == r.data.invhist_transfer_to   ? '<B>{0}</B>' : '{0}';
739                             if (r.data.cust_to_internalcompany.length) {
740                                 fmt = '<span style="color:red">[Intercompany {1}] ' + fmt + '</span>';
741                             }
742                             
743                             return String.format(fmt, v, r.data.cust_to_internalcompany); 
744                         }
745                     },
746                     {
747                         xtype: 'ColumnModel',
748                         xns: Roo.grid,
749                         dataIndex : 'qty',
750                         header : 'Quantity Moved',
751                         width : 100,
752                         renderer : function(v,x,r) 
753                         {
754                             if(
755                                 r.data.cust_to_internalcompany.length 
756                                 || 
757                                 (r.data.invhist_transfer_void && r.data.moved_qty == 0)
758                                 ||
759                                 (!r.data.invhist_transfer_void && !r.data.invhist_transfer_posted)
760                                 ){
761                                 return String.format('{0}', v); 
762                             }
763                             
764                             var diff = v * 1 - r.data.moved_qty * 1;
765                             var flag =   ''
766                             
767                             if(diff != 0){
768                                 flag =  '<span style="color:red"> ({1}) </span>'
769                             }
770                         
771                             return String.format('{0}' + flag, v, r.data.moved_qty);         
772                         
773                             
774                         }
775                     },
776                     {
777                         xtype: 'ColumnModel',
778                         xns: Roo.grid,
779                         dataIndex : 'invhist_transfer_salesrep_id_salesrep_name',
780                         header : 'Sales Rep',
781                         width : 100,
782                         renderer : function(v) { return String.format('{0}', v); }
783                     },
784                     {
785                         xtype: 'ColumnModel',
786                         xns: Roo.grid,
787                         dataIndex : 'invhist_transfer_descrip',
788                         header : 'Notes',
789                         width : 200,
790                         renderer : function(v) { return String.format('{0}', v); }
791                     }
792                 ]
793             }
794         };
795     }
796 });