Pman.Dialog.XtupleSalesOrder.bjs
[Pman.Xtuple] / Pman.Tab.XtupleItem.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Pman.Tab');
6
7 Pman.Tab.XtupleItem = new Roo.XComponent({
8
9  _strings : {
10   'be53a0541a6d36f6ecb879fa2c584b08' :"Image",
11   '41e902bb1b2db625736ede3bacc41fe0' :"is Sold?",
12   'ce4ee01637f4279d02d0f232459dc9a4' :"Purchased",
13   '1be6f9eb563f3bf85c78b4219bf09de9' :"Brand",
14   'aa554e9e2270df2127bfe9096f1bd9ce' :"Displaying item{0} - {1} of {2}",
15   'ce5bf551379459c1c61d2a204061c455' :"Location",
16   '44ca8ce0e02dee5d520525ac21bcbee9' :"Sync Product from HK (Based on Search)",
17   '068f80c7519d0528fb08e82137a72131' :"Products",
18   '68f43fdcf074903d65da764642a4b968' :"is Active?",
19   '759d259249621c817551c5fe726d5c57' :"itemloc",
20   '89217b1527e14cced20e78111a8f5027' :"Item prodcat",
21   'e924991fc4c883bc237e69efe884d674' :"Download Sales Report",
22   'ee3585dbcb1e8f8826f3403c1e9d898c' :"Rename SKU",
23   '20b4f77bd00b4f63a49ec8e08f3bf6a6' :"Cost",
24   'fe78f3efbfa84d8485d589031596c5b8' :"Pallet",
25   'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
26   '19029645d5286771ac708d1bcd118bf4' :"Displaying itemloc{0} - {1} of {2}",
27   '1243daf593fa297e07ab03bf06d925af' :"Searching...",
28   '99a808d8d16122d70e44bd7f709d30fb' :"Balance",
29   '9a8faafb674c03474827bcb6fcde43a3' :"Search Product",
30   'f1c3ca6cadc4a9f57a08d5f7482a3f83' :"No item found",
31   'd6ea9efa48916e9563d76ddc233ebe2a' :"Sync Product from HK (New Products Only)",
32   '2cfd827c6e37453fe1ddde82a5bd9474' :"No itemloc found",
33   'd8ab3576a67fe0cc175ee77d57d0fd85' :"Pickface",
34   '5bc3fd20294c17c9803942958fd7f26d' :"Show Inactive",
35   '70cd7e06502a63356290711ec3b11223' :"Upload new products and costs",
36   'c6ca371871d835c79c8654b5cd788cc7' :"Product Group",
37   '695dbdb13fad32669a68d8fec8541c7f' :"Download Standard costs",
38   '156567f65fc207d39cadbf045687c521' :"Itemloc qty",
39   'c2f1d503b95bf9f3aa4d775a216c5c73' :"Sync Product Data from HK",
40   '36c454c4130e4444e8410f11d6d998f0' :"Tools - Upload/Download",
41   'b5a7adde1af5c87d7fd797b6245c2a39' :"Description",
42   '7fee866379427143414dd7a72e56414b' :"Report start :",
43   'a9e35d03ee7f31f5bb199379a6d3547a' :"Select Brand",
44   '35be52be39d3efcd0cd2b3721fc3c298' :"Cost (base)",
45   '750587d31c68779e7f615c190a9dc23f' :"Last purchase price",
46   'b2ee912b91d69b435159c7c3f6df7f5f' :"Number",
47   '173cf046739c17fd7c97ec3540d58807' :"(function() { return (new Date()).format('Y') + '-01-01'; })()",
48   'c20ad4d76fe97759aa27a0c99bff6710' :"12"
49  },
50
51   part     :  ["Xtuple", "Item" ],
52   order    : '001-Pman.Tab.XtupleItem',
53   region   : 'center',
54   parent   : 'Pman.Tab.XtupleManage',
55   name     : "Pman.Tab.XtupleItem",
56   disabled : false, 
57   permname : '', 
58   _tree : function()
59   {
60    var _this = this;
61    var MODULE = this;
62    return {
63    layout : {
64     center : {
65      '|xns' : 'Roo',
66      xns : Roo,
67      xtype : 'LayoutRegion'
68     },
69     east : {
70      '|xns' : 'Roo',
71      split : true,
72      width : 200,
73      xns : Roo,
74      xtype : 'LayoutRegion'
75     },
76     '|xns' : 'Roo',
77     xns : Roo,
78     xtype : 'BorderLayout',
79     items : [
80      {
81       grid : {
82        dataSource : {
83         proxy : {
84          '|xns' : 'Roo.data',
85          method : 'GET',
86          url : baseURL + '/Roo/item.php',
87          xns : Roo.data,
88          xtype : 'HttpProxy'
89         },
90         reader : {
91          '|xns' : 'Roo.data',
92          fields : [
93              {
94                  'name': 'item_id',
95                  'type': 'int'
96              },
97              {
98                  'name': 'item_number',
99                  'type': 'string'
100              },
101              {
102                  'name': 'item_descrip1',
103                  'type': 'string'
104              },
105              {
106                  'name': 'item_descrip2',
107                  'type': 'string'
108              },
109              {
110                  'name': 'item_classcode_id',
111                  'type': 'int'
112              },
113              {
114                  'name': 'item_picklist',
115                  'type': 'int'
116              },
117              {
118                  'name': 'item_comments',
119                  'type': 'string'
120              },
121              {
122                  'name': 'item_sold',
123                  'type': 'int'
124              },
125              {
126                  'name': 'item_fractional',
127                  'type': 'int'
128              },
129              {
130                  'name': 'item_active',
131                  'type': 'int'
132              },
133              {
134                  'name': 'item_type',
135                  'type': 'string'
136              },
137              {
138                  'name': 'item_prodweight',
139                  'type': 'float'
140              },
141              {
142                  'name': 'item_packweight',
143                  'type': 'float'
144              },
145              {
146                  'name': 'item_prodcat_id',
147                  'type': 'int'
148              },
149              {
150                  'name': 'item_exclusive',
151                  'type': 'int'
152              },
153              {
154                  'name': 'item_listprice',
155                  'type': 'float'
156              },
157              {
158                  'name': 'item_config',
159                  'type': 'int'
160              },
161              {
162                  'name': 'item_extdescrip',
163                  'type': 'string'
164              },
165              {
166                  'name': 'item_upccode',
167                  'type': 'string'
168              },
169              {
170                  'name': 'item_maxcost',
171                  'type': 'float'
172              },
173              {
174                  'name': 'item_inv_uom_id',
175                  'type': 'int'
176              },
177              {
178                  'name': 'item_price_uom_id',
179                  'type': 'int'
180              },
181              {
182                  'name': 'item_warrdays',
183                  'type': 'int'
184              },
185              {
186                  'name': 'item_freightclass_id',
187                  'type': 'int'
188              },
189              {
190                  'name': 'item_tax_recoverable',
191                  'type': 'int'
192              },
193              {
194                  'name': 'item_price_uom_id_uom_id',
195                  'type': 'int'
196              },
197              {
198                  'name': 'item_price_uom_id_uom_name',
199                  'type': 'string'
200              },
201              {
202                  'name': 'item_price_uom_id_uom_descrip',
203                  'type': 'string'
204              },
205              {
206                  'name': 'item_price_uom_id_uom_item_weight',
207                  'type': 'int'
208              },
209              {
210                  'name': 'item_inv_uom_id_uom_id',
211                  'type': 'int'
212              },
213              {
214                  'name': 'item_inv_uom_id_uom_name',
215                  'type': 'string'
216              },
217              {
218                  'name': 'item_inv_uom_id_uom_descrip',
219                  'type': 'string'
220              },
221              {
222                  'name': 'item_inv_uom_id_uom_item_weight',
223                  'type': 'int'
224              },
225              {
226                  'name': 'item_freightclass_id_freightclass_id',
227                  'type': 'int'
228              },
229              {
230                  'name': 'item_freightclass_id_freightclass_code',
231                  'type': 'string'
232              },
233              {
234                  'name': 'item_freightclass_id_freightclass_descrip',
235                  'type': 'string'
236              },
237              {
238                  'name': 'item_classcode_id_classcode_id',
239                  'type': 'int'
240              },
241              {
242                  'name': 'item_classcode_id_classcode_code',
243                  'type': 'string'
244              },
245              {
246                  'name': 'item_classcode_id_classcode_descrip',
247                  'type': 'string'
248              },
249              {
250                  'name': 'item_classcode_id_classcode_mfg',
251                  'type': 'int'
252              },
253              {
254                  'name': 'item_classcode_id_classcode_creator',
255                  'type': 'string'
256              },
257              {
258                  'name': 'item_classcode_id_classcode_created',
259                  'type': 'date'
260              },
261              {
262                  'name': 'item_classcode_id_classcode_modifier',
263                  'type': 'string'
264              },
265              {
266                  'name': 'item_classcode_id_classcode_modified',
267                  'type': 'date'
268              },
269              {
270                  'name': 'item_classcode_id_classcode_type',
271                  'type': 'string'
272              }
273          ],
274          id : 'id',
275          root : 'data',
276          totalProperty : 'total',
277          xns : Roo.data,
278          xtype : 'JsonReader'
279         },
280         '|xns' : 'Roo.data',
281         remoteSort : true,
282         sortInfo : { field : 'item_number', direction: 'ASC' },
283         xns : Roo.data,
284         xtype : 'Store',
285         listeners : {
286          beforeload : function (_self, o)
287           {
288             o.params._with_prodcat = 1;
289             o.params._with_char = 1;
290             o.params._with_itemsrc_active = 1;
291             o.params._with_last_purchase_price = 1;
292             o.params._with_image = 1;
293             var s = _this.search.getValue();
294             if (s.length) {
295               o.params['query[number_or_name]'] = s;
296             }
297             if (!_this.active.pressed) {
298               o.params.item_active = 1;
299             }
300             if (_this.brandSel.getValue().length) {
301               o.params._with_brand = _this.brandSel.getValue()
302             }
303             
304             o.params._with_stock_balance = 1;
305           },
306          load : function (_self, records, options)
307           {
308           
309               var cm = _this.grid.getColumnModel();
310               if(records.length){
311                   cm.setColumnHeader(cm.getIndexByDataIndex('item_stock_balance'),records[0].data.default_location_name);
312               }
313           },
314          update : function (_self, record, operation)
315           {
316               if(operation != 'commit'){
317                   return;
318               }
319               
320               var nv  = record.data.itemsrc_active ? 0 : 1;
321               new Pman.Request({
322                   mask : 'Saving',
323                   url : baseURL + '/Roo/Itemsrc',
324                   params : {
325                       _update_by_item : 1,
326                       item_id : record.data.item_id,
327                       itemsrc_active : nv
328                   },
329                   success : function(res) {
330                       record.set('itemsrc_active', nv);
331                   }
332               });
333           }
334         },
335         items : [
336
337         ]
338
339        },
340        toolbar : {
341         '|xns' : 'Roo',
342         xns : Roo,
343         xtype : 'Toolbar',
344         items : [
345          {
346           store : {
347            proxy : {
348             '|xns' : 'Roo.data',
349             method : 'GET',
350             url : baseURL + '/Roo/Charass.php',
351             xns : Roo.data,
352             xtype : 'HttpProxy'
353            },
354            reader : {
355             '|xns' : 'Roo.data',
356             fields : [
357                 {
358                     'name': 'id',
359                     'type': 'int'
360                 },
361                 {
362                     'name': 'person_name',
363                     'type': 'string'
364                 },
365                 {
366                     'name': 'event_when',
367                     'type': 'date',
368                     'dateFormat': 'Y-m-d'
369                 },
370                 {
371                     'name': 'action',
372                     'type': 'string'
373                 },
374                 {
375                     'name': 'ipaddr',
376                     'type': 'string'
377                 },
378                 {
379                     'name': 'on_id',
380                     'type': 'int'
381                 },
382                 {
383                     'name': 'on_table',
384                     'type': 'string'
385                 },
386                 {
387                     'name': 'person_id',
388                     'type': 'int'
389                 },
390                 {
391                     'name': 'remarks',
392                     'type': 'string'
393                 },
394                 {
395                     'name': 'person_id_id',
396                     'type': 'int'
397                 },
398                 {
399                     'name': 'person_id_office_id',
400                     'type': 'int'
401                 },
402                 {
403                     'name': 'person_id_name',
404                     'type': 'string'
405                 },
406                 {
407                     'name': 'person_id_phone',
408                     'type': 'string'
409                 },
410                 {
411                     'name': 'person_id_fax',
412                     'type': 'string'
413                 },
414                 {
415                     'name': 'person_id_email',
416                     'type': 'string'
417                 },
418                 {
419                     'name': 'person_id_company_id',
420                     'type': 'int'
421                 },
422                 {
423                     'name': 'person_id_role',
424                     'type': 'string'
425                 },
426                 {
427                     'name': 'person_id_active',
428                     'type': 'int'
429                 },
430                 {
431                     'name': 'person_id_remarks',
432                     'type': 'string'
433                 },
434                 {
435                     'name': 'person_id_passwd',
436                     'type': 'string'
437                 },
438                 {
439                     'name': 'person_id_owner_id',
440                     'type': 'int'
441                 },
442                 {
443                     'name': 'person_id_lang',
444                     'type': 'string'
445                 },
446                 {
447                     'name': 'person_id_no_reset_sent',
448                     'type': 'int'
449                 },
450                 {
451                     'name': 'person_id_action_type',
452                     'type': 'string'
453                 },
454                 {
455                     'name': 'person_id_project_id',
456                     'type': 'int'
457                 },
458                 {
459                     'name': 'person_id_deleted_by',
460                     'type': 'int'
461                 },
462                 {
463                     'name': 'person_id_deleted_dt',
464                     'type': 'date'
465                 }
466             ],
467             id : 'id',
468             root : 'data',
469             totalProperty : 'total',
470             xns : Roo.data,
471             xtype : 'JsonReader'
472            },
473            '|xns' : 'Roo.data',
474            remoteSort : true,
475            sortInfo : { field : 'charass_value' , direction : 'ASC' },
476            xns : Roo.data,
477            xtype : 'Store',
478            listeners : {
479             beforeload : function (_self, o)
480              {
481                  o.params = o.params || {};
482                  // staff can see all logs, other companies can only see their own.
483                  // look for all of the charass 's with the same type= eg. brand.
484                  
485                  o.params.charass_char_id_char_name = 'BRAND';
486                  o.params.charass_target_type ='I';
487                  o.params._distinct = 'charass_value';
488                      o.params._columns = 'charass_value';
489              
490              }
491            },
492            items : [
493
494            ]
495
496           },
497           '|xns' : 'Roo.form',
498           allowBlank : true,
499           alwaysQuery : true,
500           displayField : 'charass_value',
501           editable : true,
502           emptyText : _this._strings['a9e35d03ee7f31f5bb199379a6d3547a'],
503           forceSelection : true,
504           listWidth : 300,
505           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
506           minChars : 2,
507           pageSize : 20,
508           qtip : _this._strings['a9e35d03ee7f31f5bb199379a6d3547a'],
509           queryParam : 'query[charass_value]',
510           selectOnFocus : true,
511           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>',
512           triggerAction : 'all',
513           width : 150,
514           xns : Roo.form,
515           xtype : 'ComboBox',
516           listeners : {
517            render : function (_self)
518             {
519               _this.brandSel = _self;
520             },
521            select : function (combo, record, index)
522             {
523                 _this.grid.footer.onClick('first');
524             }
525           },
526           items : [
527
528           ]
529
530          },
531          {
532           '|xns' : 'Roo.form',
533           emptyText : _this._strings['9a8faafb674c03474827bcb6fcde43a3'],
534           xns : Roo.form,
535           xtype : 'TextField',
536           listeners : {
537            render : function (_self)
538             {
539               _this.search = _self;
540             },
541            specialkey : function (_self, e)
542             {
543                 _this.grid.footer.onClick('first');
544             }
545           }
546          },
547          {
548           '|xns' : 'Roo.Toolbar',
549           cls : 'x-btn-icon',
550           icon : rootURL + '/Pman/templates/images/search.gif',
551           xns : Roo.Toolbar,
552           xtype : 'Button',
553           listeners : {
554            click : function (_self, e)
555             {
556             _this.grid.footer.onClick('first');
557             }
558           }
559          },
560          {
561           '|xns' : 'Roo.Toolbar',
562           cls : 'x-btn-icon',
563           icon : rootURL + '/Pman/templates/images/edit-clear.gif',
564           xns : Roo.Toolbar,
565           xtype : 'Button',
566           listeners : {
567            click : function (_self, e)
568             {
569                 _this.search.setValue('');
570                 
571             
572                 
573                 _this.grid.footer.onClick('first');
574             }
575           }
576          },
577          {
578           '|xns' : 'Roo.Toolbar',
579           xns : Roo.Toolbar,
580           xtype : 'Separator'
581          },
582          {
583           '|xns' : 'Roo.Toolbar',
584           enableToggle : true,
585           text : _this._strings['5bc3fd20294c17c9803942958fd7f26d'],
586           xns : Roo.Toolbar,
587           xtype : 'Button',
588           listeners : {
589            render : function (_self)
590             {
591                 _this.active = _self;
592             },
593            toggle : function (_self, pressed)
594             {
595             
596                 this.setText(pressed ? "Hide Inactive" : "Show Inactive");
597                 (function() { _this.grid.footer.onClick('first'); }).defer(100);
598             }
599           }
600          },
601          {
602           '|xns' : 'Roo.Toolbar',
603           xns : Roo.Toolbar,
604           xtype : 'Fill'
605          },
606          {
607           '|xns' : 'Roo.Toolbar',
608           cls : 'x-btn-text-icon',
609           icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
610           text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'],
611           xns : Roo.Toolbar,
612           xtype : 'Button',
613           listeners : {
614            click : function()
615             {
616             
617                Pman.Dialog.XtupleItem.show( { item_id : 0 } , function() {
618                     _this.grid.footer.onClick('first');
619                }); 
620             }
621           }
622          },
623          {
624           '|xns' : 'Roo.Toolbar',
625           text : _this._strings['ee3585dbcb1e8f8826f3403c1e9d898c'],
626           xns : Roo.Toolbar,
627           xtype : 'Button',
628           listeners : {
629            click : function()
630             {
631                 var s = _this.grid.selModel.getSelectedCell();
632                 if (!s) {
633                     Roo.MessageBox.alert("Error", "Select a product");
634                     return;
635                 } 
636                 var rec = _this.grid.ds.getAt(s[0]);
637                 
638                 var params = [];
639                 
640                 Roo.MessageBox.prompt(
641                     "Rename SKU", 
642                     "Warning changing SKU names affects historical data, and should only be done if you are sure that this is ok",
643                     function(r,v) {
644                         if (r != 'ok') {
645                             return;
646                             
647                         }
648                         params = {
649                             _rename_sku : v,
650                             item_id : rec.data.item_id,
651                             _check : 1
652                         }
653             
654                         change(params);
655                         
656                         return;
657                             
658                         
659             
660                     }
661                 );
662                 
663                 var change = function(params){
664                     new Pman.Request({
665                         url : baseURL + '/Roo/Item',
666                         mask : "Renaming",
667                         method : 'POST',
668                         params : params,
669                         success : function(res) {
670                             Roo.log(res);
671                             _this.grid.footer.onClick('refresh');
672                             if(typeof(res.data) == 'string'){
673                                 Roo.MessageBox.alert("Notice", 'SKU has been renamed');
674                                 return
675                             }
676                             var offices = [];
677                             Roo.each(res.data, function(o){
678                                 offices.push(Pman.Xtuple.offices[o]);
679                             })
680                             Roo.MessageBox.alert("Notice", 'SKU has been renamed in ' + offices.join(", "));
681                             
682                         },
683                         failure : function(res) {
684                             Roo.log(res);
685                             try {
686                                 if (res.errors.confirm.length) {
687                                     var offices = [];
688                                     Roo.each(res.errors.confirm, function(o){
689                                         offices.push(Pman.Xtuple.offices[o]);
690                                     })
691                                     Roo.MessageBox.confirm(
692                                         "Confirm", 
693                                         " Do you want to change the name in " + offices.join(", ") + "?",
694                                         function(x) {
695                                             if (x != 'yes') {
696                                                 Roo.MessageBox.alert("Notice", 'SKU was not changed');
697                                                 return;
698                                             }
699                                             delete params['_check'];
700                                             params._can_change_sku = 1;
701                                             change(params);
702                                         }
703                                     );
704                                     return;
705                                 }
706                             } catch(e) { }
707                             Roo.MessageBox.alert("Error", res.errorMsg);
708                             
709                         }
710                     });
711                 }
712                
713             }
714           }
715          },
716          {
717           '|xns' : 'Roo.Toolbar',
718           xns : Roo.Toolbar,
719           xtype : 'Separator'
720          },
721          {
722           '|xns' : 'Roo.Toolbar',
723           text : _this._strings['7fee866379427143414dd7a72e56414b'],
724           xns : Roo.Toolbar,
725           xtype : 'TextItem'
726          },
727          {
728           '|xns' : 'Roo.form',
729           format : 'd/M/Y',
730           useIso : true,
731           value : (function() { return (new Date()).format('Y') + '-01-01'; })(),
732           xns : Roo.form,
733           xtype : 'DateField',
734           listeners : {
735            render : function (_self)
736             {
737                 _this.dateFrom = _self;
738             }
739           }
740          },
741          {
742           store : {
743            '|xns' : 'Roo.data',
744            data : [ 
745                [ '1', "Single Month Sales"],
746                [ '3', "Quarter Sales"],
747                [ '6', "Half year Sales"] ,
748                [ '12', "Full Year Sales"] 
749            ],
750            fields : [  'ftype', 'fname'],
751            xns : Roo.data,
752            xtype : 'SimpleStore'
753           },
754           '|xns' : 'Roo.form',
755           allowBlank : false,
756           displayField : 'fname',
757           editable : false,
758           fieldLabel : 'Status',
759           hiddenName : 'cm_status',
760           listWidth : 200,
761           mode : 'local',
762           name : 'cm_status_name',
763           triggerAction : 'all',
764           value : 12,
765           valueField : 'ftype',
766           width : 150,
767           xns : Roo.form,
768           xtype : 'ComboBox',
769           listeners : {
770            render : function (_self)
771             {
772               _this.datespan  = _self;
773             }
774           },
775           items : [
776
777           ]
778
779          },
780          {
781           '|xns' : 'Roo.Toolbar',
782           text : _this._strings['e924991fc4c883bc237e69efe884d674'],
783           xns : Roo.Toolbar,
784           xtype : 'Button',
785           listeners : {
786            click : function (_self, e)
787             {
788                 if (!_this.brandSel.getValue().length) {
789                     Roo.MessageBox.alert("Error", "Select a brand to download");
790                     return;
791                 }
792             
793                 new Pman.Download({
794                     url : baseURL + '/Xtuple/Reports/SalesByCountryItemYear',
795                     params: { 
796                         date_from : _this.dateFrom.getValue(),
797                         brand : _this.brandSel.getValue(),
798                         span : _this.datespan.getValue()
799                     }
800                 });
801                     
802             
803             }
804           }
805          }
806         ]
807
808        },
809        footer : {
810         '|xns' : 'Roo',
811         displayInfo : true,
812         displayMsg : _this._strings['aa554e9e2270df2127bfe9096f1bd9ce'],
813         emptyMsg : _this._strings['f1c3ca6cadc4a9f57a08d5f7482a3f83'],
814         pageSize : 25,
815         xns : Roo,
816         xtype : 'PagingToolbar',
817         items : [
818          {
819           menu : {
820            '|xns' : 'Roo.menu',
821            xns : Roo.menu,
822            xtype : 'Menu',
823            items : [
824             {
825              '|xns' : 'Roo.menu',
826              text : _this._strings['695dbdb13fad32669a68d8fec8541c7f'],
827              xns : Roo.menu,
828              xtype : 'Item',
829              listeners : {
830               click : function (_self, e)
831                {
832                   new Pman.Download({
833                        method: 'GET',
834                        url : baseURL + '/Roo/item',
835                        params : {
836                            _costgrid : 1
837                        }
838                   });
839                }
840              }
841             },
842             {
843              '|xns' : 'Roo.menu',
844              text : _this._strings['70cd7e06502a63356290711ec3b11223'],
845              xns : Roo.menu,
846              xtype : 'Item',
847              listeners : {
848               click : function (_self, e)
849                {
850                //   Roo.MessageBox.alert("Disabled", "Can you please send Alan the test file for this - there is a problem and we need to fix it before you use this again");
851                 //  return;
852                   
853                   Pman.Dialog.Image.show(
854                       {
855                            _url : baseURL+'/Xtuple/Import/Products',
856                            timeout : 60000
857                        
858                       },
859                       function (data) {
860                            var msg = [];
861                           
862                            if (data.updated) {
863                                msg.push("Updated " + data.updated + " Products(s)");
864                            }            
865                            if (data.inserted) {
866                                msg.push("Added " + data.inserted + " Products(s)");
867                            }
868                            if (data.skipped) {
869                                msg.push("Skipped " + data.skipped);
870                            }
871                            
872                            if (!msg.length) {
873                                msg.push("No data changed");
874                            }
875                            Roo.MessageBox.alert("Notice", msg.join("\n"));
876                
877                       }
878                   );
879                }
880              }
881             },
882             {
883              '|xns' : 'Roo.menu',
884              xns : Roo.menu,
885              xtype : 'Separator'
886             },
887             {
888              '|xns' : 'Roo.menu',
889              hidden : (function() {
890              
891                  return baseURL.match(/hk\.php$/) ? true : false;
892              })(),
893              text : _this._strings['c2f1d503b95bf9f3aa4d775a216c5c73'],
894              xns : Roo.menu,
895              xtype : 'Item',
896              listeners : {
897               click : function (_self, e)
898                {
899                  Roo.MessageBox.progress ("Syncing Stock", "Sending");
900                  
901                  var offset = 0;
902                  
903                   function runSync() {
904                       
905                       new Pman.Request( {
906                            url : baseURL+'/Roo/Item',
907                            method : 'GET',
908                            timeout: 60000,
909                            params : {
910                                _syncFromHK : 1,
911                                offset : offset
912                            },
913                            success : function(res) {
914                                Roo.log(res);
915                                if (!res.data.total) {
916                                    Roo.MessageBox.hide();
917                                    return;
918                                }
919                                offset += res.data.limit;
920                                Roo.MessageBox.updateProgress ( offset  / res.data.total, "Done " + offset + '/' + res.data.total);
921                                runSync();
922                            }
923                            
924                        
925                       });
926                   }
927                   runSync();
928                }
929              }
930             },
931             {
932              '|xns' : 'Roo.menu',
933              hidden : (function() {
934              
935                  return baseURL.match(/hk\.php$/) ? true : false;
936              })(),
937              text : _this._strings['d6ea9efa48916e9563d76ddc233ebe2a'],
938              xns : Roo.menu,
939              xtype : 'Item',
940              listeners : {
941               click : function (_self, e)
942                {
943                  Roo.MessageBox.progress ("Syncing Stock", "Sending");
944                  
945                  var offset = 0;
946                  
947                   
948                       
949                   new Pman.Request( {
950                        url : baseURL+'/Roo/Item',
951                        method : 'GET',
952                        params : {
953                            _syncFromHK : 1,
954                            _new_only : 1
955                        },
956                        success : function(res) {
957                            Roo.log(res);
958                            
959                                Roo.MessageBox.hide();
960                             _this.grid.footer.onClick('refresh');
961                            
962                             
963                        }
964                        
965                    
966                   });
967                    
968                }
969              }
970             },
971             {
972              '|xns' : 'Roo.menu',
973              hidden : (function() {
974              
975                  return baseURL.match(/hk\.php$/) ? true : false;
976              })(),
977              text : _this._strings['44ca8ce0e02dee5d520525ac21bcbee9'],
978              xns : Roo.menu,
979              xtype : 'Item',
980              listeners : {
981               click : function (_self, e)
982                {
983                  Roo.MessageBox.progress ("Syncing Stock", "Sending");
984                  
985                  var offset = 0;
986                  
987                   
988                       
989                   new Pman.Request( {
990                        url : baseURL+'/Roo/Item',
991                        method : 'GET',
992                        params : {
993                            _syncFromHK : 1,
994                            item_number : _this.search.getValue()
995                        },
996                        success : function(res) {
997                            Roo.log(res);
998                            
999                                Roo.MessageBox.hide();
1000                             _this.grid.footer.onClick('refresh');
1001                            
1002                             
1003                        }
1004                        
1005                    
1006                   });
1007                    
1008                }
1009              }
1010             }
1011            ]
1012
1013           },
1014           '|xns' : 'Roo.Toolbar',
1015           text : _this._strings['36c454c4130e4444e8410f11d6d998f0'],
1016           xns : Roo.Toolbar,
1017           xtype : 'Button',
1018           items : [
1019
1020           ]
1021
1022          }
1023         ]
1024
1025        },
1026        '|xns' : 'Roo.grid',
1027        autoExpandColumn : 'item_descrip1',
1028        clicksToEdit : 1,
1029        loadMask : true,
1030        xns : Roo.grid,
1031        xtype : 'EditorGrid',
1032        colModel : [
1033          {
1034           '|xns' : 'Roo.grid',
1035           dataIndex : 'item_image_id',
1036           header : _this._strings['be53a0541a6d36f6ecb879fa2c584b08'],
1037           renderer : function(v,x,r) { return String.format('<img src="{0}/Images/Thumb/50/{1}/{2}" height="50">', baseURL, v, r.data.item_image_filename); },
1038           sortable : false,
1039           width : 150,
1040           xns : Roo.grid,
1041           xtype : 'ColumnModel'
1042          },
1043 {
1044           editor : {
1045            field : {
1046             store : {
1047              proxy : {
1048               '|xns' : 'Roo.data',
1049               method : 'GET',
1050               url : baseURL + '/Roo/Charass.php',
1051               xns : Roo.data,
1052               xtype : 'HttpProxy'
1053              },
1054              reader : {
1055               '|xns' : 'Roo.data',
1056               fields : [
1057                   {
1058                       'name': 'id',
1059                       'type': 'int'
1060                   },
1061                   {
1062                       'name': 'person_name',
1063                       'type': 'string'
1064                   },
1065                   {
1066                       'name': 'event_when',
1067                       'type': 'date',
1068                       'dateFormat': 'Y-m-d'
1069                   },
1070                   {
1071                       'name': 'action',
1072                       'type': 'string'
1073                   },
1074                   {
1075                       'name': 'ipaddr',
1076                       'type': 'string'
1077                   },
1078                   {
1079                       'name': 'on_id',
1080                       'type': 'int'
1081                   },
1082                   {
1083                       'name': 'on_table',
1084                       'type': 'string'
1085                   },
1086                   {
1087                       'name': 'person_id',
1088                       'type': 'int'
1089                   },
1090                   {
1091                       'name': 'remarks',
1092                       'type': 'string'
1093                   },
1094                   {
1095                       'name': 'person_id_id',
1096                       'type': 'int'
1097                   },
1098                   {
1099                       'name': 'person_id_office_id',
1100                       'type': 'int'
1101                   },
1102                   {
1103                       'name': 'person_id_name',
1104                       'type': 'string'
1105                   },
1106                   {
1107                       'name': 'person_id_phone',
1108                       'type': 'string'
1109                   },
1110                   {
1111                       'name': 'person_id_fax',
1112                       'type': 'string'
1113                   },
1114                   {
1115                       'name': 'person_id_email',
1116                       'type': 'string'
1117                   },
1118                   {
1119                       'name': 'person_id_company_id',
1120                       'type': 'int'
1121                   },
1122                   {
1123                       'name': 'person_id_role',
1124                       'type': 'string'
1125                   },
1126                   {
1127                       'name': 'person_id_active',
1128                       'type': 'int'
1129                   },
1130                   {
1131                       'name': 'person_id_remarks',
1132                       'type': 'string'
1133                   },
1134                   {
1135                       'name': 'person_id_passwd',
1136                       'type': 'string'
1137                   },
1138                   {
1139                       'name': 'person_id_owner_id',
1140                       'type': 'int'
1141                   },
1142                   {
1143                       'name': 'person_id_lang',
1144                       'type': 'string'
1145                   },
1146                   {
1147                       'name': 'person_id_no_reset_sent',
1148                       'type': 'int'
1149                   },
1150                   {
1151                       'name': 'person_id_action_type',
1152                       'type': 'string'
1153                   },
1154                   {
1155                       'name': 'person_id_project_id',
1156                       'type': 'int'
1157                   },
1158                   {
1159                       'name': 'person_id_deleted_by',
1160                       'type': 'int'
1161                   },
1162                   {
1163                       'name': 'person_id_deleted_dt',
1164                       'type': 'date'
1165                   }
1166               ],
1167               id : 'id',
1168               root : 'data',
1169               totalProperty : 'total',
1170               xns : Roo.data,
1171               xtype : 'JsonReader'
1172              },
1173              '|xns' : 'Roo.data',
1174              remoteSort : true,
1175              sortInfo : { field : 'charass_value' , direction : 'ASC' },
1176              xns : Roo.data,
1177              xtype : 'Store',
1178              listeners : {
1179               beforeload : function (_self, o)
1180                {
1181                    o.params = o.params || {};
1182                    // staff can see all logs, other companies can only see their own.
1183                    // look for all of the charass 's with the same type= eg. brand.
1184                    
1185                    o.params.charass_char_id_char_name = 'BRAND';
1186                    o.params.charass_target_type ='I';
1187                    o.params._distinct = 'charass_value';
1188                        o.params._columns = 'charass_value';
1189                
1190                }
1191              },
1192              items : [
1193
1194              ]
1195
1196             },
1197             '|xns' : 'Roo.form',
1198             allowBlank : true,
1199             alwaysQuery : true,
1200             displayField : 'charass_value',
1201             editable : true,
1202             forceSelection : false,
1203             listWidth : 300,
1204             loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
1205             minChars : 2,
1206             pageSize : 20,
1207             qtip : _this._strings['a9e35d03ee7f31f5bb199379a6d3547a'],
1208             queryParam : 'query[charass_value]',
1209             selectOnFocus : true,
1210             tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>',
1211             triggerAction : 'all',
1212             width : 150,
1213             xns : Roo.form,
1214             xtype : 'ComboBox',
1215             items : [
1216
1217             ]
1218
1219            },
1220            '|xns' : 'Roo.grid',
1221            xns : Roo.grid,
1222            xtype : 'GridEditor',
1223            items : [
1224
1225            ]
1226
1227           },
1228           '|xns' : 'Roo.grid',
1229           dataIndex : 'item_char_brand',
1230           header : _this._strings['1be6f9eb563f3bf85c78b4219bf09de9'],
1231           renderer : function(v) { return String.format('{0}', v); },
1232           sortable : true,
1233           width : 100,
1234           xns : Roo.grid,
1235           xtype : 'ColumnModel',
1236           items : [
1237
1238           ]
1239
1240          },
1241 {
1242           editor : {
1243            field : {
1244             store : {
1245              proxy : {
1246               '|xns' : 'Roo.data',
1247               method : 'GET',
1248               url : baseURL + '/Roo/Charass.php',
1249               xns : Roo.data,
1250               xtype : 'HttpProxy'
1251              },
1252              reader : {
1253               '|xns' : 'Roo.data',
1254               fields : [
1255                   {
1256                       'name': 'id',
1257                       'type': 'int'
1258                   },
1259                   {
1260                       'name': 'person_name',
1261                       'type': 'string'
1262                   },
1263                   {
1264                       'name': 'event_when',
1265                       'type': 'date',
1266                       'dateFormat': 'Y-m-d'
1267                   },
1268                   {
1269                       'name': 'action',
1270                       'type': 'string'
1271                   },
1272                   {
1273                       'name': 'ipaddr',
1274                       'type': 'string'
1275                   },
1276                   {
1277                       'name': 'on_id',
1278                       'type': 'int'
1279                   },
1280                   {
1281                       'name': 'on_table',
1282                       'type': 'string'
1283                   },
1284                   {
1285                       'name': 'person_id',
1286                       'type': 'int'
1287                   },
1288                   {
1289                       'name': 'remarks',
1290                       'type': 'string'
1291                   },
1292                   {
1293                       'name': 'person_id_id',
1294                       'type': 'int'
1295                   },
1296                   {
1297                       'name': 'person_id_office_id',
1298                       'type': 'int'
1299                   },
1300                   {
1301                       'name': 'person_id_name',
1302                       'type': 'string'
1303                   },
1304                   {
1305                       'name': 'person_id_phone',
1306                       'type': 'string'
1307                   },
1308                   {
1309                       'name': 'person_id_fax',
1310                       'type': 'string'
1311                   },
1312                   {
1313                       'name': 'person_id_email',
1314                       'type': 'string'
1315                   },
1316                   {
1317                       'name': 'person_id_company_id',
1318                       'type': 'int'
1319                   },
1320                   {
1321                       'name': 'person_id_role',
1322                       'type': 'string'
1323                   },
1324                   {
1325                       'name': 'person_id_active',
1326                       'type': 'int'
1327                   },
1328                   {
1329                       'name': 'person_id_remarks',
1330                       'type': 'string'
1331                   },
1332                   {
1333                       'name': 'person_id_passwd',
1334                       'type': 'string'
1335                   },
1336                   {
1337                       'name': 'person_id_owner_id',
1338                       'type': 'int'
1339                   },
1340                   {
1341                       'name': 'person_id_lang',
1342                       'type': 'string'
1343                   },
1344                   {
1345                       'name': 'person_id_no_reset_sent',
1346                       'type': 'int'
1347                   },
1348                   {
1349                       'name': 'person_id_action_type',
1350                       'type': 'string'
1351                   },
1352                   {
1353                       'name': 'person_id_project_id',
1354                       'type': 'int'
1355                   },
1356                   {
1357                       'name': 'person_id_deleted_by',
1358                       'type': 'int'
1359                   },
1360                   {
1361                       'name': 'person_id_deleted_dt',
1362                       'type': 'date'
1363                   }
1364               ],
1365               id : 'id',
1366               root : 'data',
1367               totalProperty : 'total',
1368               xns : Roo.data,
1369               xtype : 'JsonReader'
1370              },
1371              '|xns' : 'Roo.data',
1372              remoteSort : true,
1373              sortInfo : { field : 'charass_value' , direction : 'ASC' },
1374              xns : Roo.data,
1375              xtype : 'Store',
1376              listeners : {
1377               beforeload : function (_self, o)
1378                {
1379                    o.params = o.params || {};
1380                    // staff can see all logs, other companies can only see their own.
1381                    // look for all of the charass 's with the same type= eg. brand.
1382                    
1383                    o.params.charass_char_id_char_name = 'PRODUCTGROUP';
1384                    o.params.charass_target_type ='I';
1385                    o.params._distinct = 'charass_value';
1386                        o.params._columns = 'charass_value';    
1387                }
1388              },
1389              items : [
1390
1391              ]
1392
1393             },
1394             '|xns' : 'Roo.form',
1395             allowBlank : true,
1396             alwaysQuery : true,
1397             displayField : 'charass_value',
1398             editable : true,
1399             forceSelection : false,
1400             listWidth : 300,
1401             loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
1402             minChars : 2,
1403             pageSize : 20,
1404             qtip : _this._strings['a9e35d03ee7f31f5bb199379a6d3547a'],
1405             queryParam : 'query[charass_value]',
1406             selectOnFocus : true,
1407             tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>',
1408             triggerAction : 'all',
1409             width : 150,
1410             xns : Roo.form,
1411             xtype : 'ComboBox',
1412             items : [
1413
1414             ]
1415
1416            },
1417            '|xns' : 'Roo.grid',
1418            xns : Roo.grid,
1419            xtype : 'GridEditor',
1420            items : [
1421
1422            ]
1423
1424           },
1425           '|xns' : 'Roo.grid',
1426           dataIndex : 'item_char_productgroup',
1427           header : _this._strings['c6ca371871d835c79c8654b5cd788cc7'],
1428           renderer : function(v) { return String.format('{0}', v); },
1429           sortable : true,
1430           width : 100,
1431           xns : Roo.grid,
1432           xtype : 'ColumnModel',
1433           items : [
1434
1435           ]
1436
1437          },
1438 {
1439           '|xns' : 'Roo.grid',
1440           dataIndex : 'item_number',
1441           header : _this._strings['b2ee912b91d69b435159c7c3f6df7f5f'],
1442           renderer : function(v) { return String.format('<B>{0}</B>', v); },
1443           sortable : true,
1444           width : 100,
1445           xns : Roo.grid,
1446           xtype : 'ColumnModel'
1447          },
1448 {
1449           editor : {
1450            field : {
1451             '|xns' : 'Roo.form',
1452             xns : Roo.form,
1453             xtype : 'TextField'
1454            },
1455            '|xns' : 'Roo.grid',
1456            xns : Roo.grid,
1457            xtype : 'GridEditor',
1458            items : [
1459
1460            ]
1461
1462           },
1463           '|xns' : 'Roo.grid',
1464           dataIndex : 'item_char_pickface_location',
1465           header : _this._strings['d8ab3576a67fe0cc175ee77d57d0fd85'],
1466           renderer : function(v) { return String.format('{0}', v); },
1467           sortable : true,
1468           width : 100,
1469           xns : Roo.grid,
1470           xtype : 'ColumnModel',
1471           items : [
1472
1473           ]
1474
1475          },
1476 {
1477           editor : {
1478            field : {
1479             '|xns' : 'Roo.form',
1480             xns : Roo.form,
1481             xtype : 'TextField'
1482            },
1483            '|xns' : 'Roo.grid',
1484            xns : Roo.grid,
1485            xtype : 'GridEditor',
1486            items : [
1487
1488            ]
1489
1490           },
1491           '|xns' : 'Roo.grid',
1492           dataIndex : 'item_char_pallet_location',
1493           header : _this._strings['fe78f3efbfa84d8485d589031596c5b8'],
1494           renderer : function(v) { return String.format('{0}', v); },
1495           sortable : true,
1496           width : 100,
1497           xns : Roo.grid,
1498           xtype : 'ColumnModel',
1499           items : [
1500
1501           ]
1502
1503          },
1504 {
1505           '|xns' : 'Roo.grid',
1506           dataIndex : 'item_descrip1',
1507           header : _this._strings['b5a7adde1af5c87d7fd797b6245c2a39'],
1508           renderer : function(v) { return String.format('{0}', v); },
1509           sortable : true,
1510           width : 200,
1511           xns : Roo.grid,
1512           xtype : 'ColumnModel'
1513          },
1514 {
1515           '|xns' : 'Roo.grid',
1516           dataIndex : 'itemsrc_active',
1517           header : _this._strings['ce4ee01637f4279d02d0f232459dc9a4'],
1518           renderer : function(v) {  
1519               var state = v * 1 > 0 ?  '-checked' : '';
1520           
1521               return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
1522                           
1523            },
1524           sortable : true,
1525           width : 55,
1526           xns : Roo.grid,
1527           xtype : 'ColumnModel'
1528          },
1529 {
1530           '|xns' : 'Roo.grid',
1531           dataIndex : 'item_sold',
1532           header : _this._strings['41e902bb1b2db625736ede3bacc41fe0'],
1533           renderer : function(v) {  
1534               var state = v * 1 > 0 ?  '-checked' : '';
1535           
1536               return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
1537                           
1538            },
1539           sortable : true,
1540           width : 50,
1541           xns : Roo.grid,
1542           xtype : 'ColumnModel'
1543          },
1544 {
1545           '|xns' : 'Roo.grid',
1546           dataIndex : 'item_active',
1547           header : _this._strings['68f43fdcf074903d65da764642a4b968'],
1548           renderer : function(v) {  
1549               var state = v * 1 > 0 ?  '-checked' : '';
1550           
1551               return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
1552                           
1553            },
1554           sortable : true,
1555           width : 50,
1556           xns : Roo.grid,
1557           xtype : 'ColumnModel'
1558          },
1559 {
1560           '|xns' : 'Roo.grid',
1561           align : 'right',
1562           dataIndex : 'last_purchase_price',
1563           header : _this._strings['750587d31c68779e7f615c190a9dc23f'],
1564           renderer : function(v,x,r) {
1565           
1566                return String.format('{0}{1}', r.data.last_purchase_price_curr_name, Roo.util.Format.number(v,2)) ; 
1567                
1568            },
1569           width : 120,
1570           xns : Roo.grid,
1571           xtype : 'ColumnModel'
1572          },
1573 {
1574           '|xns' : 'Roo.grid',
1575           dataIndex : 'item_prodcat_id_prodcat_code',
1576           header : _this._strings['89217b1527e14cced20e78111a8f5027'],
1577           renderer : function(v,x,r) { 
1578               return String.format('{0}/{1}', r.data.item_type, v); 
1579               },
1580           width : 100,
1581           xns : Roo.grid,
1582           xtype : 'ColumnModel'
1583          },
1584 {
1585           '|xns' : 'Roo.grid',
1586           align : 'right',
1587           dataIndex : 'item_actcost',
1588           header : _this._strings['20b4f77bd00b4f63a49ec8e08f3bf6a6'],
1589           renderer : function(v,x,r) {
1590           
1591                return String.format('{0}{1}', r.data.item_curr_name, Roo.util.Format.number(v,2)) ; 
1592                
1593            },
1594           width : 75,
1595           xns : Roo.grid,
1596           xtype : 'ColumnModel'
1597          },
1598 {
1599           '|xns' : 'Roo.grid',
1600           align : 'right',
1601           dataIndex : 'item_base_cost',
1602           header : _this._strings['35be52be39d3efcd0cd2b3721fc3c298'],
1603           renderer : function(v,x,r) {
1604           
1605                return String.format('{0}{1}', r.data.item_base_curr, Roo.util.Format.number(v,2)) ; 
1606                
1607            },
1608           width : 75,
1609           xns : Roo.grid,
1610           xtype : 'ColumnModel'
1611          },
1612 {
1613           '|xns' : 'Roo.grid',
1614           align : 'right',
1615           dataIndex : 'item_stock_balance',
1616           header : _this._strings['99a808d8d16122d70e44bd7f709d30fb'],
1617           renderer : function(v) { return String.format('{0}', v ? parseInt( v) : ''); },
1618           width : 100,
1619           xns : Roo.grid,
1620           xtype : 'ColumnModel'
1621          }
1622        ],
1623        listeners : {
1624         afteredit : function (e)
1625          {
1626              
1627              
1628              Roo.log(e);
1629              new Pman.Request({
1630                  url : baseURL +'/Roo/Charass',
1631                  params : {
1632                       charass_char_id_char_name : e.field.replace(/^item_char_/,'').toUpperCase(),
1633                       charass_value : e.value,
1634                       charass_target_type : 'I',
1635                       charass_default : 1,
1636                       charass_target_id : e.record.data.item_id
1637                   },
1638                   method : 'POST'
1639               });
1640              
1641              
1642              e.record.commit();
1643              
1644              
1645              
1646          },
1647         cellclick : function (_self, row, col, e)
1648          {
1649               var di = _this.grid.colModel.getDataIndex(col);
1650               
1651               var rec = _this.grid.ds.getAt(row);
1652               
1653               
1654               if (di == 'item_active') {
1655               
1656                  var nv = rec.data.item_active ? 0 : 1;
1657                  new Pman.Request({
1658                      mask : 'Saving',
1659                      url : baseURL + '/Roo/Item',
1660                      params : {
1661                          item_id : rec.data.item_id,
1662                          item_active : nv
1663                      },
1664                      success : function() {
1665                          rec.set('item_active', nv);
1666                      }
1667                  });
1668                  return;
1669                  
1670               
1671               }
1672               
1673               if(di == 'itemsrc_active'){
1674               
1675               
1676               
1677          
1678                  if(rec.data.itemsrc_active * 1){
1679                      Roo.MessageBox.confirm("Confirm", "Are you sure this product is no longer purchased",
1680                          function (res) {
1681                              if(res!='yes') {
1682                                  return;
1683                              }
1684                              rec.set('itemsrc_active', 0);
1685                              rec.commit();
1686                      });
1687                      return;
1688                  }
1689                  
1690                  Pman.Dialog.XtupleItem.show( { item_id : rec.data.item_id } , function() {
1691                      _this.grid.footer.onClick('first');
1692                 }); 
1693                 return;
1694                  
1695              }
1696               
1697               _this.locgrid.footer.onClick('first');
1698               
1699               
1700               
1701               
1702          },
1703         celldblclick : function (_self, rowIndex, columnIndex, e)
1704          {
1705              var s = _this.grid.ds.getAt(rowIndex);
1706              
1707              Pman.Dialog.XtupleItem.show( { item_id : s.data.item_id } , function() {
1708                  _this.grid.footer.onClick('first');
1709             }); 
1710          },
1711         render : function() 
1712          {
1713              _this.grid = this; 
1714              //_this.dialog = Pman.Dialog.FILL_IN
1715              if (_this.panel.active) {
1716                 this.footer.onClick('first');
1717              }
1718          }
1719        },
1720        items : [
1721
1722        ]
1723
1724       },
1725       '|xns' : 'Roo',
1726       background : false,
1727       fitContainer : true,
1728       fitToframe : true,
1729       region : 'center',
1730       tableName : 'item',
1731       title : _this._strings['068f80c7519d0528fb08e82137a72131'],
1732       xns : Roo,
1733       xtype : 'GridPanel',
1734       listeners : {
1735        activate : function() {
1736             _this.panel = this;
1737             if (_this.grid) {
1738                 _this.grid.footer.onClick('first');
1739             }
1740         }
1741       },
1742       items : [
1743
1744       ]
1745
1746      },
1747      {
1748       grid : {
1749        dataSource : {
1750         proxy : {
1751          '|xns' : 'Roo.data',
1752          method : 'GET',
1753          url : baseURL + '/Roo/location.php',
1754          xns : Roo.data,
1755          xtype : 'HttpProxy'
1756         },
1757         reader : {
1758          '|xns' : 'Roo.data',
1759          fields : [
1760              {
1761                  'name': 'itemloc_id',
1762                  'type': 'int'
1763              },
1764              {
1765                  'name': 'itemloc_itemsite_id',
1766                  'type': 'int'
1767              },
1768              {
1769                  'name': 'itemloc_location_id',
1770                  'type': 'int'
1771              },
1772              {
1773                  'name': 'itemloc_qty',
1774                  'type': 'float'
1775              },
1776              {
1777                  'name': 'itemloc_expiration',
1778                  'type': 'date',
1779                  'dateFormat': 'Y-m-d'
1780              },
1781              {
1782                  'name': 'itemloc_consolflag',
1783                  'type': 'int'
1784              },
1785              {
1786                  'name': 'itemloc_ls_id',
1787                  'type': 'int'
1788              },
1789              {
1790                  'name': 'itemloc_warrpurc',
1791                  'type': 'date',
1792                  'dateFormat': 'Y-m-d'
1793              }
1794          ],
1795          id : 'id',
1796          root : 'data',
1797          totalProperty : 'total',
1798          xns : Roo.data,
1799          xtype : 'JsonReader'
1800         },
1801         '|xns' : 'Roo.data',
1802         remoteSort : true,
1803         sortInfo : { field : 'location_name', direction: 'ASC' },
1804         xns : Roo.data,
1805         xtype : 'Store',
1806         listeners : {
1807          beforeload : function (_self, o)
1808           {
1809               var sel = _this.grid.selModel.getSelectedCell();
1810               if (!sel) {
1811                   this.removeAll();
1812                   return false;
1813               }
1814               var rec = _this.grid.ds.getAt(sel[0]);
1815               o.params._stock_for_item_id = rec.data.item_id;
1816               //o.params['!itemloc_qty'] = 0;
1817               
1818               
1819           }
1820         },
1821         items : [
1822
1823         ]
1824
1825        },
1826        footer : {
1827         '|xns' : 'Roo',
1828         displayInfo : true,
1829         displayMsg : _this._strings['19029645d5286771ac708d1bcd118bf4'],
1830         emptyMsg : _this._strings['2cfd827c6e37453fe1ddde82a5bd9474'],
1831         pageSize : 25,
1832         xns : Roo,
1833         xtype : 'PagingToolbar'
1834        },
1835        '|xns' : 'Roo.grid',
1836        autoExpandColumn : 'location_name',
1837        loadMask : true,
1838        xns : Roo.grid,
1839        xtype : 'Grid',
1840        colModel : [
1841          {
1842           '|xns' : 'Roo.grid',
1843           dataIndex : 'location_name',
1844           header : _this._strings['ce5bf551379459c1c61d2a204061c455'],
1845           renderer : function(v) { return String.format('{0}', v); },
1846           width : 75,
1847           xns : Roo.grid,
1848           xtype : 'ColumnModel'
1849          },
1850 {
1851           '|xns' : 'Roo.grid',
1852           dataIndex : 'itemloc_realqty',
1853           header : _this._strings['156567f65fc207d39cadbf045687c521'],
1854           renderer : function(v) { return String.format('{0}', v*1 ? (v*1).toFixed(0) : ''); },
1855           width : 75,
1856           xns : Roo.grid,
1857           xtype : 'ColumnModel'
1858          }
1859        ],
1860        listeners : {
1861         render : function() 
1862          {
1863              _this.locgrid = this; 
1864              //_this.dialog = Pman.Dialog.FILL_IN
1865              
1866          },
1867         rowdblclick : function (_self, rowIndex, e)
1868          {
1869              if (!_this.dialog) return;
1870              _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
1871                  _this.grid.footer.onClick('first');
1872              }); 
1873          }
1874        },
1875        items : [
1876
1877        ]
1878
1879       },
1880       '|xns' : 'Roo',
1881       background : true,
1882       fitContainer : true,
1883       fitToframe : true,
1884       region : 'east',
1885       tableName : 'itemloc',
1886       title : _this._strings['759d259249621c817551c5fe726d5c57'],
1887       xns : Roo,
1888       xtype : 'GridPanel',
1889       listeners : {
1890        activate : function() {
1891             _this.locpanel = this;
1892          
1893         }
1894       },
1895       items : [
1896
1897       ]
1898
1899      }
1900     ]
1901
1902    },
1903    '|xns' : 'Roo',
1904    background : false,
1905    region : 'center',
1906    title : _this._strings['068f80c7519d0528fb08e82137a72131'],
1907    xns : Roo,
1908    xtype : 'NestedLayoutPanel',
1909    items : [
1910
1911    ]
1912
1913   };  }
1914 });