Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleAdjustment.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.XtupleAdjustment = new Roo.XComponent({
6     part     :  ["Xtuple","Adjustment"],
7     order    : '100-Pman.Tab.XtupleAdjustment',
8     region   : 'center',
9     parent   : 'Pman.Tab.XtupleAdjustmentTab',
10     name     : "Pman.Tab.XtupleAdjustment",
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 : 'invadj',
33             title : "Inventory Adjustments",
34             grid : {
35                 xtype: 'EditorGrid',
36                 xns: Roo.grid,
37                 listeners : {
38                     render : function() 
39                     {
40                         _this.grid = this; 
41                         //_this.dialog = Pman.Dialog.FILL_IN
42                         if (_this.panel.active) {
43                            this.footer.onClick('first');
44                         }
45                     },
46                     afteredit : function (e)
47                     {
48                        if (e.record.data.invadj_posted) {
49                          return;
50                        }
51                        var req = [ 'invadj_transdate', 'invadj_location_id', 'invadj_itemsite_id',  
52                             'invadj_qty_by', 'invadj_comments' ];
53                        var valid = true;
54                         Roo.each(req, function(c) {
55                             var val = '' + e.record.get(c);
56                             if (!val.length) {
57                                 valid = false;
58                             }
59                         });
60                         if (!valid) {
61                             return;
62                         }
63                         e.record.commit();
64                             
65                        
66                        
67                     },
68                     validateedit : function (e)
69                     {
70                         switch(e.field) {
71                             case 'invadj_transdate':
72                                // e.record.setValue('invadj_transdate', Date.parseDate(e.value, 'Y-m-d'));
73                                 e.value = Date.parseDate(e.value, 'Y-m-d');
74                                 break;
75                         }
76                     },
77                     beforeedit : function (e)
78                     {
79                         Roo.log(e.record);
80                         if (e.record.data.invadj_posted) {
81                      
82                             e.cancel = true;
83                             return false;
84                         }
85                     },
86                     cellclick : function (_self, rowIndex, columnIndex, e)
87                     {
88                         var c = _this.grid.colModel.config[columnIndex];
89                         var di = c.dataIndex;
90                         if (di != 'invadj_posted') {
91                             return;
92                         }
93                         
94                         var r = _this.grid.ds.getAt(rowIndex);
95                         if (r.data.invadj_posted || !r.data.invadj_id) {
96                             return;
97                         }
98                         // attempting to post..
99                         // validation - done at other end..
100                         new Pman.Request({
101                             url : baseURL + '/Roo/Invadj',
102                             method  : 'POST',
103                             mask : 'Posting',
104                             params : {
105                                 invadj_id : r.data.invadj_id,
106                                 _post : 1
107                             },
108                             success : function(res) {
109                                 r.set('invadj_posted', true);
110                                 if (r.data.invadj_voids_id > 0) {
111                                     _this.grid.ds.each(function(rr) {
112                                         if (rr.data.invadj_id == r.data.invadj_voids_id) {
113                                             rr.set('invadj_voided_by_id', r.data.invadj_id);
114                                             rr.set('invadj_comments', rr.data.invadj_comments);
115                                         }
116                                     });
117                                 
118                                 
119                                 }
120                                 
121                                 
122                                 
123                             },
124                             failure : function (res) {
125                                 Roo.log(res);
126                                 Roo.MessageBox.alert("Error",res.errorMsg);
127                                 if (res.errors.trandate) {
128                                     r.set('invadj_transdate', Date.parseDate(res.errors.trandate,'Y-m-d'));
129                                     r.commit();
130                                 }
131                             
132                             }
133                         });
134                         
135                         
136                         
137                         
138                     }
139                 },
140                 autoExpandColumn : 'invadj_comments',
141                 clicksToEdit : 1,
142                 loadMask : true,
143                 sm : {
144                     xtype: 'CellSelectionModel',
145                     xns: Roo.grid,
146                     listeners : {
147                         tabend : function (eventdata)
148                         {
149                             _this.addBtn.fireEvent('click', this); 
150                         
151                         }
152                     }
153                 },
154                 dataSource : {
155                     xtype: 'Store',
156                     xns: Roo.data,
157                     listeners : {
158                         beforeload : function (_self, options)
159                         {
160                             options.params.invadj_location_id = _this.locationCombo.getValue();
161                             options.params.invadj_itemsite_id = _this.itemCombo.getValue();   
162                             switch(_this.status.getValue()) {
163                                 case 'ALL':
164                                 
165                                     break;
166                                case 'ALL-WITHVOID':
167                                    options.params._show_void = 2;        
168                                     break; 
169                                          
170                                case 'VOID':
171                                    options.params._show_void = 1;
172                                 
173                                     break;
174                                     
175                                 case 'POSTED':
176                         
177                                     options.params.invadj_posted = 1;
178                                     break;
179                                     
180                                 case 'UNPOSTED':
181                                     options.params.invadj_posted = 0;
182                                     options.params._show_void = 2;                            
183                                     break;    
184                         
185                                 case 'ALL-NOGROUP':
186                                    options.params._hide_group = 1;        
187                                     break;
188                         
189                                case 'ALL-NOGROUP-WITHVOID':
190                                    options.params._show_void = 2;        
191                                  options.params._hide_group = 1;                
192                                     break; 
193                                     
194                                case 'VOID-NOGROUP':
195                                    options.params._show_void = 1;       
196                                     options.params._hide_group = 1;                     
197                                     break;
198                                     
199                                 case 'POSTED-NOGROUP':
200                                     options.params.invadj_posted = 1;
201                                     options.params._hide_group = 1;                     
202                                     break;
203                                     
204                                 case 'UNPOSTED-NOGROUP':
205                                     options.params._hide_group = 1;                     
206                                     options.params.invadj_posted = 0;
207                                     options.params._show_void = 2;                
208                                     break;    
209                                     
210                                     
211                             }
212                             options.params['query[comment]'] = _this.search.getValue();
213                         },
214                         update : function (_self, record, operation)
215                         {
216                             
217                             Roo.log(operation);
218                             if (operation != 'commit' || _this.incom) {
219                                 return;
220                             }
221                         
222                             
223                             var    p = Roo.apply({}, record.data);
224                             
225                             if (p.invadj_posted) {
226                                 return;
227                             }
228                             p.invadj_transdate = record.data.invadj_transdate.format('Y-m-d');
229                              p.invadj_posted = 0; 
230                         
231                             _this.incom = true;    
232                             new Pman.Request( {
233                                 url : baseURL + '/Roo/Invadj',
234                                 mask : 'Saving',
235                                 method : 'POST',
236                                 params : p,
237                                 success : function(res) {
238                                     record.set('invadj_id', res.data.invadj_id);
239                                     _this.incom = false;
240                                 },
241                                 failure : function()
242                                 {
243                                     Roo.MessageBox.alert("Error", "Saving failed");
244                                     _this.incom = false;            
245                                 }
246                             
247                             });
248                             
249                             
250                             
251                         }
252                     },
253                     remoteSort : true,
254                     sortInfo : { field : 'invadj_id', direction: 'DESC' },
255                     proxy : {
256                         xtype: 'HttpProxy',
257                         xns: Roo.data,
258                         method : 'GET',
259                         url : baseURL + '/Roo/invadj.php'
260                     },
261                     reader : {
262                         xtype: 'JsonReader',
263                         xns: Roo.data,
264                         totalProperty : 'total',
265                         root : 'data',
266                         id : 'id',
267                         fields : [
268                             {
269                                 'name': 'invadj_id',
270                                 'type': 'int'
271                             },
272                             {
273                                 'name': 'invadj_transdate',
274                                 'type': 'date',
275                                 'dateFormat': 'Y-m-d'
276                             },
277                             {
278                                 'name': 'invadj_location_id',
279                                 'type': 'int'
280                             },
281                             {
282                                 'name': 'invadj_itemsite_id',
283                                 'type': 'int'
284                             },
285                             {
286                                 'name': 'invadj_qty_by',
287                                 'type': 'int'
288                             },
289                             {
290                                 'name': 'invadj_posted',
291                                 'type': 'int'
292                             }
293                         ]
294                     }
295                 },
296                 footer : {
297                     xtype: 'PagingToolbar',
298                     xns: Roo,
299                     pageSize : 25,
300                     displayInfo : true,
301                     displayMsg : "Displaying invadj{0} - {1} of {2}",
302                     emptyMsg : "No invadj found"
303                 },
304                 toolbar : {
305                     xtype: 'Toolbar',
306                     xns: Roo,
307                     items : [
308                         {
309                             xtype: 'ComboBox',
310                             xns: Roo.form,
311                             listeners : {
312                                 render : function (_self)
313                                 {
314                                     _this.locationCombo = _self;
315                                 },
316                                 select : function (combo, record, index)
317                                 {
318                                     Roo.log('select');
319                                     _this.grid.footer.onClick('first');
320                                 }
321                             },
322                             allowBlank : true,
323                             displayField : 'location_name',
324                             editable : true,
325                             emptyText : "Select location",
326                             fieldLabel : 'location',
327                             forceSelection : true,
328                             hiddenName : 'invadj_location_id',
329                             listWidth : 400,
330                             loadingText : "Searching...",
331                             minChars : 2,
332                             name : 'invadj_location_id_location_name',
333                             pageSize : 100,
334                             qtip : "Select location",
335                             queryParam : 'query[location_name]',
336                             selectOnFocus : true,
337                             tpl : '<div class="x-grid-cell-text x-btn button"><b>{location_name}</b> </div>',
338                             triggerAction : 'all',
339                             typeAhead : false,
340                             valueField : 'location_id',
341                             width : 150,
342                             store : {
343                                 xtype: 'Store',
344                                 xns: Roo.data,
345                                 listeners : {
346                                     beforeload : function (_self, o){
347                                         o.params = o.params || {};
348                                         // set more here
349                                     }
350                                 },
351                                 remoteSort : true,
352                                 sortInfo : { direction : 'ASC', field: 'location_name' },
353                                 proxy : {
354                                     xtype: 'HttpProxy',
355                                     xns: Roo.data,
356                                     method : 'GET',
357                                     url : baseURL + '/Roo/location.php'
358                                 },
359                                 reader : {
360                                     xtype: 'JsonReader',
361                                     xns: Roo.data,
362                                     id : 'id',
363                                     root : 'data',
364                                     totalProperty : 'total',
365                                     fields : [{"name":"id","type":"int"},{"name":"location_name","type":"string"}]
366                                 }
367                             }
368                         },
369                         {
370                             xtype: 'ComboBox',
371                             xns: Roo.form,
372                             listeners : {
373                                 render : function (_self)
374                                 {
375                                     _this.itemCombo = _self;
376                                 },
377                                 select : function (combo, record, index)
378                                 {
379                                     Roo.log('select');
380                                     _this.grid.footer.onClick('first');
381                                 }
382                             },
383                             allowBlank : true,
384                             displayField : 'itemsite_item_id_item_number',
385                             editable : true,
386                             emptyText : "Select itemsite",
387                             fieldLabel : 'itemsite',
388                             forceSelection : true,
389                             hiddenName : 'invadj_itemsite_id',
390                             listWidth : 400,
391                             loadingText : "Searching...",
392                             minChars : 2,
393                             name : 'invadj_itemsite_id_item_number',
394                             pageSize : 20,
395                             qtip : "Select itemsite",
396                             queryParam : 'query[number]',
397                             selectOnFocus : true,
398                             tpl : '<div class="x-grid-cell-text x-btn button"><b>{itemsite_item_id_item_number}</b> </div>',
399                             triggerAction : 'all',
400                             typeAhead : false,
401                             valueField : 'itemsite_id',
402                             width : 150,
403                             store : {
404                                 xtype: 'Store',
405                                 xns: Roo.data,
406                                 listeners : {
407                                     beforeload : function (_self, o){
408                                         o.params = o.params || {};
409                                         // set more here
410                                     }
411                                 },
412                                 remoteSort : true,
413                                 sortInfo : { direction : 'ASC', field: 'itemsite_item_id_item_number' },
414                                 proxy : {
415                                     xtype: 'HttpProxy',
416                                     xns: Roo.data,
417                                     method : 'GET',
418                                     url : baseURL + '/Roo/itemsite.php'
419                                 },
420                                 reader : {
421                                     xtype: 'JsonReader',
422                                     xns: Roo.data,
423                                     id : 'id',
424                                     root : 'data',
425                                     totalProperty : 'total',
426                                     fields : [{"name":"id","type":"int"},{"name":"itemsite_abcclass","type":"string"}]
427                                 }
428                             }
429                         },
430                         {
431                             xtype: 'ComboBox',
432                             xns: Roo.form,
433                             listeners : {
434                                 render : function (_self)
435                                 {
436                                   _this.status = _self;
437                                 },
438                                 select : function (combo, record, index)
439                                 {
440                                     Roo.log('select');
441                                     _this.grid.footer.onClick('first');
442                                 }
443                             },
444                             allowBlank : false,
445                             displayField : 'fname',
446                             editable : false,
447                             fieldLabel : 'Status',
448                             hiddenName : 'cm_status',
449                             listWidth : 200,
450                             mode : 'local',
451                             name : 'cm_status_name',
452                             triggerAction : 'all',
453                             value : "ALL-NOGROUP",
454                             valueField : 'ftype',
455                             width : 150,
456                             store : {
457                                 xtype: 'SimpleStore',
458                                 xns: Roo.data,
459                                 data : [ 
460                                     [ 'ALL-NOGROUP', "All (not in Group)"],
461                                     [ 'ALL-NOGROUP WITHVOID', "All (not in Group) (with Void)"],     
462                                     [ 'UNPOSTED-NOGROUP', "Unposted only (not in Group)"] ,
463                                     [ 'POSTED-NOGROUP', "Posted only (not in Group)"] ,
464                                     [ 'VOID-NOGROUP' ,"Void (not in Group)"],
465                                     [ 'ALL', "All"],
466                                     [ 'ALL-WITHVOID', "All (with Void)"],    
467                                     [ 'UNPOSTED', "Unposted only"] ,
468                                     [ 'POSTED', "Posted only"] ,
469                                     [ 'VOID', "Void only"]  
470                                     
471                                 ],
472                                 fields : [  'ftype', 'fname']
473                             }
474                         },
475                         {
476                             xtype: 'TextField',
477                             xns: Roo.form,
478                             listeners : {
479                                 specialkey : function (_self, e)
480                                 {
481                                     _this.grid.footer.onClick('first');
482                                 },
483                                 render : function (_self)
484                                 {
485                                     _this.search = _self;
486                                 }
487                             },
488                             width : 100
489                         },
490                         {
491                             xtype: 'Button',
492                             xns: Roo.Toolbar,
493                             listeners : {
494                                 click : function (_self, e)
495                                 {
496                                 _this.grid.footer.onClick('first');
497                                 }
498                             },
499                             cls : 'x-btn-icon',
500                             icon : rootURL + '/Pman/templates/images/search.gif'
501                         },
502                         {
503                             xtype: 'Button',
504                             xns: Roo.Toolbar,
505                             listeners : {
506                                 click : function (_self, e)
507                                 {
508                                     _this.locationCombo.reset();
509                                     _this.itemCombo.reset();
510                                     
511                                     _this.grid.footer.onClick('first');
512                                 }
513                             },
514                             cls : 'x-btn-icon',
515                             icon : rootURL + '/Pman/templates/images/edit-clear.gif'
516                         },
517                         {
518                             xtype: 'Fill',
519                             xns: Roo.Toolbar
520                         },
521                         {
522                             xtype: 'Button',
523                             xns: Roo.Toolbar,
524                             listeners : {
525                                 click : function ()
526                                 {   
527                                     new Pman.Download({
528                                         grid : _this.grid
529                                     });
530                                    
531                                 }
532                             },
533                             cls : 'x-btn-text-icon',
534                             text : "Download Excel",
535                             icon : rootURL + '/Pman/templates/images/spreadsheet.gif'
536                         },
537                         {
538                             xtype: 'Button',
539                             xns: Roo.Toolbar,
540                             listeners : {
541                                 click : function()
542                                 {
543                                    
544                                     Roo.log("add presed");
545                                      
546                                     // work out last 
547                                     var grid = _this.grid;
548                                      
549                                     // uses form defaults or last row value.
550                                     var nr = _this.grid.ds.reader.newRow({
551                                         invadj_id : 0,
552                                         invadj_transdate : (new Date()),
553                                         invadj_location_id :  0,
554                                         invadj_location_id_location_name : '',        
555                                         invadj_itemsite_id : 0,                
556                                         invadj_itemsite_id_item_number : '',        
557                                         invadj_qty_by : '',  
558                                         invadj_comments: '',      
559                                         invadj_posted: false
560                                                 
561                                     });
562                                     grid.stopEditing();
563                                     grid.ds.insert(0, nr); 
564                                     grid.startEditing(0, 1); // type..
565                                 
566                                 },
567                                 render : function (_self)
568                                 {
569                                     _this.addBtn = _self;
570                                 }
571                             },
572                             cls : 'x-btn-text-icon',
573                             text : "Add",
574                             icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
575                         },
576                         {
577                             xtype: 'Button',
578                             xns: Roo.Toolbar,
579                             listeners : {
580                                 click : function()
581                                 {
582                                    
583                                     Roo.log("add presed");
584                                     
585                                     var grid = _this.grid;
586                                     var r = grid.selModel.getSelectedCell();
587                                     
588                                     
589                                     if (!r) {
590                                         Roo.MessageBox.alert("Error", "Select an adjustment");
591                                         return;
592                                     }    
593                                     var rec = grid.ds.getAt(r[0]);
594                                     
595                                     var nrec = Roo.apply({}, rec.data);
596                                     nrec.invadj_qty_by *= -1;
597                                     nrec.invadj_comments = (rec.data.invadj_voids_id * 1 > 1) ? 'Restore of Adjustment #' + rec.data.invadj_voids_id : 'Void of Adjustment #' + rec.data.invadj_id;
598                                     nrec.invadj_posted = 0;
599                                     nrec.invadj_id = 0;    
600                                     nrec.invadj_invdetail_id  = '';
601                                     nrec.invadj_voids_id   =  rec.data.invadj_id;
602                                     //nrec.invadj_transdate = rec.data.invadj_transdate.format('Y-m-d');
603                                     
604                                     var nr = _this.grid.ds.reader.newRow(nrec);
605                                     grid.stopEditing();
606                                     grid.ds.insert(r[0], nr); 
607                                     (function() { 
608                                         grid.ds.getAt(r[0]).commit();
609                                     }).defer(100);
610                                     
611                                 }
612                             },
613                             cls : 'x-btn-text-icon',
614                             text : "Void",
615                             icon : rootURL + '/Pman/templates/images/trash.gif'
616                         },
617                         {
618                             xtype: 'Button',
619                             xns: Roo.Toolbar,
620                             listeners : {
621                                 click : function()
622                                 {
623                                    
624                                    var g = _this.grid;
625                                    var s = g.selModel.getSelectedCell();
626                                    if (!s) {
627                                         Roo.MessageBox.alert("Error", "Select Adjustment");
628                                         return;
629                                     }
630                                     var r = g.ds.getAt(s[0]);
631                                     if (r.data.invadj_posted) {
632                                         Roo.MessageBox.alert("Error", "You can not delete posted adjustments - try voiding them");
633                                         return;
634                                     }
635                                     new Pman.Request({
636                                         url : baseURL + '/Roo/Invadj',
637                                         method : 'POST',
638                                         params  : { _delete : r.data.invadj_id },
639                                         mask : 'Deleteing',
640                                         success : function(res) {
641                                             g.ds.remove(r);
642                                         }
643                                     
644                                     });
645                                    
646                                    
647                                 }
648                             },
649                             cls : 'x-btn-text-icon',
650                             text : "Delete",
651                             icon : rootURL + '/Pman/templates/images/trash.gif'
652                         }
653                     ]
654                 },
655                 colModel : [
656                     {
657                         xtype: 'ColumnModel',
658                         xns: Roo.grid,
659                         dataIndex : 'invadj_id',
660                         header : 'Ref#',
661                         sortable : true,
662                         width : 50,
663                         renderer : function(v) { return String.format('{0}', v); }
664                     },
665                     {
666                         xtype: 'ColumnModel',
667                         xns: Roo.grid,
668                         dataIndex : 'invadj_transdate',
669                         header : 'Date',
670                         sortable : true,
671                         width : 75,
672                         renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); },
673                         editor : {
674                             xtype: 'GridEditor',
675                             xns: Roo.grid,
676                             field : {
677                                 xtype: 'DateField',
678                                 xns: Roo.form,
679                                 format : 'Y-m-d',
680                                 useIso : true
681                             }
682                         }
683                     },
684                     {
685                         xtype: 'ColumnModel',
686                         xns: Roo.grid,
687                         dataIndex : 'invadj_location_id',
688                         header : 'Location',
689                         width : 150,
690                         renderer : function(v,x,r) { 
691                         
692                             return String.format('{0}', 
693                                 r.data.invadj_location_id_location_name
694                              ); 
695                          },
696                         editor : {
697                             xtype: 'GridEditor',
698                             xns: Roo.grid,
699                             field : {
700                                 xtype: 'ComboBox',
701                                 xns: Roo.form,
702                                 allowBlank : false,
703                                 displayField : 'location_name',
704                                 editable : true,
705                                 emptyText : "Select location",
706                                 fieldLabel : 'location',
707                                 forceSelection : true,
708                                 hiddenName : 'invadj_location_id',
709                                 listWidth : 400,
710                                 loadingText : "Searching...",
711                                 minChars : 2,
712                                 name : 'invadj_location_id_location_name',
713                                 pageSize : 200,
714                                 qtip : "Select location",
715                                 queryParam : 'query[location_name]',
716                                 selectOnFocus : true,
717                                 tpl : '<div class="x-grid-cell-text x-btn button"><b>{location_name}</b> </div>',
718                                 triggerAction : 'all',
719                                 typeAhead : false,
720                                 valueField : 'location_id',
721                                 width : 300,
722                                 store : {
723                                     xtype: 'Store',
724                                     xns: Roo.data,
725                                     listeners : {
726                                         beforeload : function (_self, o){
727                                             o.params = o.params || {};
728                                             // set more here
729                                         }
730                                     },
731                                     remoteSort : true,
732                                     sortInfo : { direction : 'ASC', field: 'location_name' },
733                                     proxy : {
734                                         xtype: 'HttpProxy',
735                                         xns: Roo.data,
736                                         method : 'GET',
737                                         url : baseURL + '/Roo/location.php'
738                                     },
739                                     reader : {
740                                         xtype: 'JsonReader',
741                                         xns: Roo.data,
742                                         id : 'id',
743                                         root : 'data',
744                                         totalProperty : 'total',
745                                         fields : [{"name":"id","type":"int"},{"name":"location_name","type":"string"}]
746                                     }
747                                 }
748                             }
749                         }
750                     },
751                     {
752                         xtype: 'ColumnModel',
753                         xns: Roo.grid,
754                         dataIndex : 'invadj_itemsite_id_item_number',
755                         header : 'Item Number',
756                         hidden : true,
757                         sortable : true,
758                         width : 50,
759                         renderer : function(v) { return String.format('{0}', v); }
760                     },
761                     {
762                         xtype: 'ColumnModel',
763                         xns: Roo.grid,
764                         dataIndex : 'invadj_itemsite_id',
765                         header : 'Item',
766                         width : 100,
767                         renderer : function(v,x,r) { return String.format('{0}', r.data.invadj_itemsite_id_item_number); },
768                         editor : {
769                             xtype: 'GridEditor',
770                             xns: Roo.grid,
771                             field : {
772                                 xtype: 'ComboBox',
773                                 xns: Roo.form,
774                                 allowBlank : false,
775                                 displayField : 'itemsite_item_id_item_number',
776                                 editable : true,
777                                 emptyText : "Select itemsite",
778                                 fieldLabel : 'itemsite',
779                                 forceSelection : true,
780                                 hiddenName : 'invadj_itemsite_id',
781                                 listWidth : 400,
782                                 loadingText : "Searching...",
783                                 minChars : 2,
784                                 name : 'invadj_itemsite_id_item_number',
785                                 pageSize : 20,
786                                 qtip : "Select itemsite",
787                                 queryParam : 'query[number]',
788                                 selectOnFocus : true,
789                                 tpl : '<div class="x-grid-cell-text x-btn button"><b>{itemsite_item_id_item_number}</b> </div>',
790                                 triggerAction : 'all',
791                                 typeAhead : false,
792                                 valueField : 'itemsite_id',
793                                 width : 300,
794                                 store : {
795                                     xtype: 'Store',
796                                     xns: Roo.data,
797                                     listeners : {
798                                         beforeload : function (_self, o){
799                                             o.params = o.params || {};
800                                             // set more here
801                                         }
802                                     },
803                                     remoteSort : true,
804                                     sortInfo : { direction : 'ASC', field: 'itemsite_item_id_item_number' },
805                                     proxy : {
806                                         xtype: 'HttpProxy',
807                                         xns: Roo.data,
808                                         method : 'GET',
809                                         url : baseURL + '/Roo/itemsite.php'
810                                     },
811                                     reader : {
812                                         xtype: 'JsonReader',
813                                         xns: Roo.data,
814                                         id : 'id',
815                                         root : 'data',
816                                         totalProperty : 'total',
817                                         fields : [{"name":"id","type":"int"},{"name":"itemsite_abcclass","type":"string"}]
818                                     }
819                                 }
820                             }
821                         }
822                     },
823                     {
824                         xtype: 'ColumnModel',
825                         xns: Roo.grid,
826                         align : 'right',
827                         dataIndex : 'invadj_qty_by',
828                         header : 'Adjust By #',
829                         width : 75,
830                         renderer : function(v) { return String.format('{0}', v); },
831                         editor : {
832                             xtype: 'GridEditor',
833                             xns: Roo.grid,
834                             field : {
835                                 xtype: 'NumberField',
836                                 xns: Roo.form,
837                                 allowDecimals : false,
838                                 cls : 'align-right'
839                             }
840                         }
841                     },
842                     {
843                         xtype: 'ColumnModel',
844                         xns: Roo.grid,
845                         dataIndex : 'invadj_comments',
846                         header : 'Comments',
847                         width : 75,
848                         renderer : function(v,x,r) {
849                            return String.format(r.data.invfifo_void * 1 > 0 ? '<s style="color:#ccc">{0}</s>' : '{0}', v); 
850                          },
851                         editor : {
852                             xtype: 'GridEditor',
853                             xns: Roo.grid,
854                             field : {
855                                 xtype: 'TextField',
856                                 xns: Roo.form
857                             }
858                         }
859                     },
860                     {
861                         xtype: 'ColumnModel',
862                         xns: Roo.grid,
863                         dataIndex : 'invadj_posted',
864                         header : 'Posted',
865                         width : 75,
866                         renderer : function(v) {  
867                             var state = v * 1 > 0 ?  '-checked' : '';
868                         
869                             return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
870                                         
871                          }
872                     }
873                 ]
874             }
875         };
876     }
877 });