Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.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.Dialog');
6
7 Pman.Dialog.XtupleItem = {
8
9  _strings : {
10   '346577d22bb510368e3eddab5df2ca13' :"Reference Files",
11   'be53a0541a6d36f6ecb879fa2c584b08' :"Image",
12   '92b17d3d0f13232ec1d46844c836d4db' :"Invoice UOM",
13   '390fc24b0feebfff8c3fb8625418c2e9' :"Perishable",
14   'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
15   '956e816fa19ca04485c7101adbe07762' :"Displaying records {0} - {1} of {2}",
16   '69395719de41dd8a31905b1e94c91816' :"Select classcode",
17   '82a43f89af6d331d80d441624c5c71fa' :"Default Location",
18   '538a3c9d82a4ea4250b987a357d41184' :"Item Parts",
19   '03ab340b3f99e03cff9e84314ead38c0' :"Qty",
20   '5b8c99dad1893a85076709b2d3c2d2d0' :"IP Address",
21   'fce71ab09b7795157c6e23370b4afb26' :"Stocked",
22   '045a1ac263ac3a9b7420208bdc2df423' :"Select costcat",
23   '0c81971f67c0bd4b33799c5365ec2bf5' :"No Images found",
24   'a1fa27779242b4902f7ae3bdd5c6d508' :"Type",
25   '151ccf95db9b81c11bb20fbc302af4b6' :"Select terms",
26   '786410e93beb0193d89f8608c54feb4b' :"Select item",
27   '0ac9012a8c03a76ee76f04321b3b7fda' :"Lead time",
28   '675c9bd3bbae30af03fe74346dcae9a7' :"Edit / Create item",
29   'dd24f967299e81b9603cb071693d5c32' :"Select vendinfo",
30   '023a5dfa857c4aa0156e6685231a1dbd' :"Select Type",
31   'e8586011952b0d098b0e568f20ca2b1f' :"Select Currency",
32   '9bd81329febf6efe22788e03ddeaf0af' :"Class",
33   '8413c683b4b27cc3f4dbd4c90329d8ba' :"Comments",
34   '820dbd2b8f606aff866c0bbfb6b737c1' :"Changed",
35   'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
36   '0eceeb45861f9585dd7a97a3e36f85c6' :"Created",
37   '386c339d37e737a436499d423a77df0c' :"Currency",
38   '9076cbba1d9ef79280b4f39e2aa0d115' :"Nothing found",
39   '1243daf593fa297e07ab03bf06d925af' :"Searching...",
40   '6df5afb79e960381ed66568c2a644ec6' :"Description (2)",
41   '7be1fa478799242847d4ef861ff6f8e1' :"Min Qty",
42   '6665e3761028c84e1d228de3432229ed' :"SKU",
43   'e54f1b41d200adbd96eb53634388d780' :"Sales Account",
44   '76729937a5eb6b0fd88c42581161facd' :"Select Category",
45   'eccd13e2f1acfd6b8412a2caafa37a80' :"Stock Safety Level",
46   '43b2683180fe5e67a91696c834df0a32' :"Reorder Level",
47   'e1a8f447925ed2867c591aa0865d170e' :"Multi Location",
48   '7d74f3b92b19da5e606d737d339a9679' :"Item",
49   '2ea154449c00001e87af8df7c0728678' :"Control Method",
50   '19df363d15888baa395364fbcd230c05' :"No itemsrc found",
51   '0d122b17933ab4173e9d75d55fc5e764' :"Standard Cost",
52   'df2ad52a14d681b1cd8495f8650fdb56' :"Select prodcat",
53   '49ee3087348e8d44e1feda1917443987' :"Name",
54   'e5353fc67b122d1b42181073b46cd060' :"Vendor Ref#",
55   'c19ea8f7a11074ac743c58d34830b233' :"Select plancode",
56   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
57   'c056b1456660ea65aad6dfc664002b84' :"Item active",
58   '9d98e31f261471f426e906282544c15d' :"Item comments",
59   '20f39d1311ccbd3b7e61cdd4978719f9' :"Itemsite Settings",
60   '1656a671ba692e15836cd85df374556c' :"Price List",
61   'bb8913cd17d59f182acc7be1020007b7' :"UOM",
62   'f9c68217f6ef9a9afe7575e766bd7b9f' :"Planner Code",
63   '76d5bf9597c882d6513f71759df298d5' :"Displaying parts {0} - {1} of {2}",
64   '3601146c4e948c32b6424d2c0a7f0118' :"Price",
65   '1814d65a76028fdfbadab64a5a8076df' :"Suppliers",
66   '90e4ac2e5a22e53df63b6b186d8727ba' :"No Events found",
67   '4ee972120bcda675f75222c87cb9d356' :"Who",
68   '16d2b386b2034b9488996466aaae0b57' :"History",
69   '14fc4f0a5008e1d8d5645071755c596b' :"Price UOM",
70   '089ba2b5edc96565fc22c584ecfbb1a6' :"Displaying events{0} - {1} of {2}",
71   'b5a7adde1af5c87d7fd797b6245c2a39' :"Description",
72   '148cb4c3e6469c6a92d24951485b65ff' :"Item listprice",
73   'c96bc98500430b5eb8e9cfc5959e09b5' :"Item sold",
74   '7f841b4d2f7280eb82318988c6d649d1' :"Displaying itemsrc{0} - {1} of {2}",
75   'a254c25adc7d10d7e9c4889484f875a5' :"Detail",
76   '5aa275a71868f3afcacfd6de452b07eb' :"Costcat",
77   'c0ed345ec857c06b31f7e88745c9bc40' :"Displaying Images  {0} - {1} of {2}",
78   'c9cc8cce247e49bae79f15173ce97354' :"Save",
79   '6abc7326bcd435c1eb22ad3714db48c4' :"Lead time (Days)",
80   'ec9ceefe0c19f4c029008c23e3c947b7' :"Vendor",
81   '4d3d769b812b6faa6b76e1a8abaece2d' :"Active",
82   '004bf6c9a40003140292e97330236c53' :"Action",
83   '689202409e48743b914713f96d93947c' :"Value",
84   'f4c6f851b00d5518bf888815de279aba' :"Notes",
85   '10991ea03e3591bebc4c0827fc369540' :"Product Category",
86   'f9838de820f2a2e16241033270c68e29' :"Select uom",
87   '8c489d0946f66d17d73f26366a4bf620' :"Weight",
88   'd85a8a381c36f6dde21d81542830e2b1' :"Sold",
89   '1063e38cb53d94d386f21227fcd84717' :"Remove",
90   '7996af9149ed376ce252e35c4da7146b' :"Select Vendor"
91  },
92
93  dialog : false,
94  callback:  false,
95
96  show : function(data, cb)
97  {
98   if (!this.dialog) {
99    this.create();
100   }
101
102   this.callback = cb;
103   this.data = data;
104   this.dialog.show(this.data._el);
105   if (this.form) {
106    this.form.reset();
107    this.form.setValues(data);
108    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
109   }
110
111  },
112
113  create : function()
114  {
115    var _this = this;
116    this.dialog = Roo.factory({
117     closable : false,
118     collapsible : false,
119     height : 550,
120     modal : true,
121     resizable : false,
122     title : _this._strings['675c9bd3bbae30af03fe74346dcae9a7'] /* Edit / Create item */,
123     width : 800,
124     xns : Roo,
125     '|xns' : 'Roo',
126     xtype : 'LayoutDialog',
127     listeners : {
128      show : function (_self)
129       {
130            _this.dialog.layout.getRegion('center').showPanel(0);
131       }
132     },
133     center : {
134      alwaysShowTabs : true,
135      tabPosition : 'top',
136      xns : Roo,
137      '|xns' : 'Roo',
138      xtype : 'LayoutRegion'
139     },
140     buttons : [
141      {
142       text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
143       xns : Roo,
144       '|xns' : 'Roo',
145       xtype : 'Button',
146       listeners : {
147        click : function (_self, e)
148         {
149             _this.dialog.hide();
150         }
151       }
152      },
153      {
154       text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
155       xns : Roo,
156       '|xns' : 'Roo',
157       xtype : 'Button',
158       listeners : {
159        click : function (_self, e)
160         {
161             // do some checks?
162              
163             
164           //  _this.dialog.el.mask("Saving");
165             _this.form.doAction("submit");
166         
167         },
168        render : function (_self)
169         {
170             _this.saveBtn = this;
171         }
172       }
173      }
174     ],
175     items  : [
176      {
177       region : 'center',
178       title : _this._strings['a254c25adc7d10d7e9c4889484f875a5'] /* Detail */,
179       xns : Roo,
180       '|xns' : 'Roo',
181       xtype : 'ContentPanel',
182       items  : [
183        {
184         labelWidth : 120,
185         method : 'POST',
186         style : 'margin:10px;',
187         url : baseURL + '/Roo/item.php',
188         xns : Roo.form,
189         '|xns' : 'Roo.form',
190         xtype : 'Form',
191         listeners : {
192          actioncomplete : function(_self,action)
193           {
194               if (action.type == 'setdata') {
195                  _this.form.findField('item_number').el.dom.readOnly = true;
196                  _this.form.findField('item_type').disabled = true; 
197                  
198                  if(_this.data.item_id * 1 > 0){
199                       
200                       this.load({ 
201                           method: 'GET', 
202                           params: {
203                                '_id' : _this.data.item_id,
204                                '_with_itemsite' : 1,
205                                '_with_itemcost' : 1,
206                                '_with_prodcat' : 1 ,
207                                '_with_salesaccnt' : 1 
208                           }
209                       });
210                       return;
211                  }
212                  // if it's new..
213                  _this.form.findField('item_number').el.dom.readOnly = false;
214                  _this.form.findField('item_type').disabled = false; 
215                  _this.form.findField('item_salesaccnt').setValue('');
216                  
217                  _this.form.findField('item_type').showHide();
218                  
219                  return;
220               }
221               if (action.type == 'load') {
222                  _this.form.findField('item_type').showHide();
223                   return;
224               }
225               if (action.type =='submit') {
226               
227                   var id = _this.form.findField('item_id').getValue() * 1;
228                   if (id < 1) {
229                   
230                       this.load({ 
231                           method: 'GET', 
232                           params: {
233                                '_id' : action.result.data.item_id,
234                                '_with_itemsite' : 1,
235                                '_with_itemcost' : 1,
236                                '_with_prodcat' : 1 ,
237                                '_with_salesaccnt' : 1 
238                           }
239                       });
240                       return;
241                   }
242                   _this.dialog.hide();
243               
244                    if (_this.callback) {
245                       _this.callback.call(_this, _this.form.getValues());
246                    }
247                    _this.form.reset();
248                    return;
249               }
250           },
251          rendered : function (form)
252           {
253               _this.form= form;
254           }
255         },
256         items  : [
257          {
258           allowBlank : false,
259           fieldLabel : _this._strings['6665e3761028c84e1d228de3432229ed'] /* SKU */,
260           name : 'item_number',
261           width : 200,
262           xns : Roo.form,
263           '|xns' : 'Roo.form',
264           xtype : 'TextField'
265          },
266          {
267           fieldLabel : _this._strings['b5a7adde1af5c87d7fd797b6245c2a39'] /* Description */,
268           name : 'item_descrip1',
269           width : 400,
270           xns : Roo.form,
271           '|xns' : 'Roo.form',
272           xtype : 'TextField'
273          },
274          {
275           fieldLabel : _this._strings['6df5afb79e960381ed66568c2a644ec6'] /* Description (2) */,
276           name : 'item_descrip2',
277           width : 400,
278           xns : Roo.form,
279           '|xns' : 'Roo.form',
280           xtype : 'TextField'
281          },
282          {
283           labelWidth : 120,
284           xns : Roo.form,
285           '|xns' : 'Roo.form',
286           xtype : 'Column',
287           items  : [
288            {
289             allowBlank : false,
290             displayField : 'fname',
291             editable : false,
292             emptyText : _this._strings['023a5dfa857c4aa0156e6685231a1dbd'] /* Select Type */,
293             fieldLabel : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'] /* Type */,
294             hiddenName : 'item_type',
295             listWidth : 200,
296             mode : 'local',
297             name : 'item_type_name',
298             showHide : function() {
299             
300                 var it = this.getValue();
301                 
302                 var options = [ 
303                     'item_itemcost_id_itemcost_curr_id',
304                     'item_itemcost_id_itemcost_actcost',
305                     'item_itemsite_id_itemsite_reorderlevel',
306                     'item_itemsite_id_itemsite_leadtime',
307                     'item_itemsite_id_itemsite_location_id',
308                     'item_itemsite_id_itemsite_loccntrl',
309                     'item_itemsite_id_itemsite_stocked',
310                     'item_itemsite_id_itemsite_perishable',
311                     
312                     'item_itemsite_id_itemsite_safetystock',
313                     'item_itemsite_id_itemsite_controlmethod',
314                     'item_itemsite_id_itemsite_plancode_id',
315                     'item_itemsite_id_itemsite_costcat_id',
316                     'item_itemsite_id_itemsite_active',
317                     'item_itemsite_id_itemsite_sold'
318                     
319                 ];
320                 
321                 var r_req = [ 
322                     'item_listprice'
323                 ];
324                 
325                 var state = true;
326                 
327                 _this.standardCostFieldSet.show();
328                 _this.itemsiteFieldSet.show();
329             
330                 
331                 switch(it) {
332                     case 'K':
333                         state = false;
334             
335                         _this.form.findField('item_listprice').allowBlank = false;
336                         _this.form.findField('item_listprice').actionMode = 'fieldEl';
337                         _this.form.findField('item_listprice').hideMode = 'display';
338                         _this.form.findField('item_listprice').show();
339                                     
340                         break;
341                         
342                     case 'R': // refrence
343                         options = options.concat(r_req);
344                         state = false;
345                         _this.standardCostFieldSet.hide();
346                         break;
347                         
348                     case 'P': // purchased..
349                         options = options.concat(r_req);
350                         // must have
351                         break;
352                 }
353                 
354                 Roo.each(options, function(n) {
355                     var ff = _this.form.findField(n);
356                     ff.allowBlank = !state;
357                     ff.actionMode = 'fieldEl';
358                     ff.hideMode = 'display';
359                     state ? ff.show() : ff.hide(); 
360                     
361                 });
362                 
363                 
364                 if(!state){
365                     _this.standardCostFieldSet.hide();
366                     _this.itemsiteFieldSet.hide();
367             
368                 }
369                 
370               
371                        
372             },
373             tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{fname}</b> </div>',
374             triggerAction : 'all',
375             valueField : 'ftype',
376             width : 200,
377             xns : Roo.form,
378             '|xns' : 'Roo.form',
379             xtype : 'ComboBox',
380             listeners : {
381              beforeselect : function (combo, record, index)
382               {
383                   (function() { combo.showHide(); }).defer(100);
384               }
385             },
386             store : {
387              data : [ 
388                  [ 'P', "Purchased (eg. a standard product)"],
389                  [ 'R' , "Reference (Non-Product)"],
390                  [ 'K', "Kit (made up of products)"]  
391              ],
392              fields : [  'ftype', 'fname'],
393              xns : Roo.data,
394              '|xns' : 'Roo.data',
395              xtype : 'SimpleStore'
396             }
397            },
398            {
399             allowBlank : false,
400             displayField : 'classcode_code',
401             editable : false,
402             emptyText : _this._strings['69395719de41dd8a31905b1e94c91816'] /* Select classcode */,
403             fieldLabel : _this._strings['9bd81329febf6efe22788e03ddeaf0af'] /* Class */,
404             forceSelection : true,
405             hiddenName : 'item_classcode_id',
406             listWidth : 400,
407             loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
408             minChars : 2,
409             name : 'item_classcode_id_classcode_code',
410             pageSize : 20,
411             qtip : _this._strings['69395719de41dd8a31905b1e94c91816'] /* Select classcode */,
412             queryParam : '',
413             selectOnFocus : true,
414             tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{classcode_code}</b> </div>',
415             triggerAction : 'all',
416             typeAhead : true,
417             valueField : 'classcode_id',
418             width : 200,
419             xns : Roo.form,
420             '|xns' : 'Roo.form',
421             xtype : 'ComboBox',
422             store : {
423              remoteSort : true,
424              sortInfo : { direction : 'ASC', field: 'id' },
425              xns : Roo.data,
426              '|xns' : 'Roo.data',
427              xtype : 'Store',
428              listeners : {
429               beforeload : function (_self, o){
430                    o.params = o.params || {};
431                    // set more here
432                }
433              },
434              proxy : {
435               method : 'GET',
436               url : baseURL + '/Roo/classcode.php',
437               xns : Roo.data,
438               '|xns' : 'Roo.data',
439               xtype : 'HttpProxy'
440              },
441              reader : {
442               fields : [{"name":"id","type":"int"},{"name":"classcode_code","type":"string"}],
443               id : 'id',
444               root : 'data',
445               totalProperty : 'total',
446               xns : Roo.data,
447               '|xns' : 'Roo.data',
448               xtype : 'JsonReader'
449              }
450             }
451            },
452            {
453             allowBlank : false,
454             displayField : 'uom_descrip',
455             editable : false,
456             emptyText : _this._strings['f9838de820f2a2e16241033270c68e29'] /* Select uom */,
457             fieldLabel : _this._strings['92b17d3d0f13232ec1d46844c836d4db'] /* Invoice UOM */,
458             forceSelection : true,
459             hiddenName : 'item_inv_uom_id',
460             listWidth : 400,
461             loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
462             minChars : 2,
463             name : 'item_inv_uom_id_uom_descrip',
464             pageSize : 20,
465             qtip : _this._strings['69395719de41dd8a31905b1e94c91816'] /* Select classcode */,
466             queryParam : '',
467             selectOnFocus : true,
468             tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{uom_descrip}</b> </div>',
469             triggerAction : 'all',
470             typeAhead : true,
471             valueField : 'uom_id',
472             width : 200,
473             xns : Roo.form,
474             '|xns' : 'Roo.form',
475             xtype : 'ComboBox',
476             store : {
477              remoteSort : true,
478              sortInfo : { direction : 'ASC', field: 'uom_name' },
479              xns : Roo.data,
480              '|xns' : 'Roo.data',
481              xtype : 'Store',
482              listeners : {
483               beforeload : function (_self, o){
484                    o.params = o.params || {};
485                    // set more here
486                }
487              },
488              proxy : {
489               method : 'GET',
490               url : baseURL + '/Roo/uom.php',
491               xns : Roo.data,
492               '|xns' : 'Roo.data',
493               xtype : 'HttpProxy'
494              },
495              reader : {
496               fields : [
497                   {"name":"id","type":"int"},
498                   {"name":"uom_name","type":"string"},
499                   {"name":"uom_descrip","type":"string"},
500               ],
501               id : 'id',
502               root : 'data',
503               totalProperty : 'total',
504               xns : Roo.data,
505               '|xns' : 'Roo.data',
506               xtype : 'JsonReader'
507              }
508             }
509            },
510            {
511             allowBlank : false,
512             displayField : 'uom_descrip',
513             editable : false,
514             emptyText : _this._strings['f9838de820f2a2e16241033270c68e29'] /* Select uom */,
515             fieldLabel : _this._strings['14fc4f0a5008e1d8d5645071755c596b'] /* Price UOM */,
516             forceSelection : true,
517             hiddenName : 'item_price_uom_id',
518             listWidth : 400,
519             loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
520             minChars : 2,
521             name : 'item_price_uom_id_uom_descrip',
522             pageSize : 20,
523             qtip : _this._strings['69395719de41dd8a31905b1e94c91816'] /* Select classcode */,
524             queryParam : '',
525             selectOnFocus : true,
526             tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{uom_descrip}</b> </div>',
527             triggerAction : 'all',
528             typeAhead : true,
529             valueField : 'uom_id',
530             width : 200,
531             xns : Roo.form,
532             '|xns' : 'Roo.form',
533             xtype : 'ComboBox',
534             store : {
535              remoteSort : true,
536              sortInfo : { direction : 'ASC', field: 'uom_name' },
537              xns : Roo.data,
538              '|xns' : 'Roo.data',
539              xtype : 'Store',
540              listeners : {
541               beforeload : function (_self, o){
542                    o.params = o.params || {};
543                    // set more here
544                }
545              },
546              proxy : {
547               method : 'GET',
548               url : baseURL + '/Roo/uom.php',
549               xns : Roo.data,
550               '|xns' : 'Roo.data',
551               xtype : 'HttpProxy'
552              },
553              reader : {
554               fields : [
555                   {"name":"id","type":"int"},
556                   {"name":"uom_name","type":"string"},
557                   {"name":"uom_descrip","type":"string"},
558               ],
559               id : 'id',
560               root : 'data',
561               totalProperty : 'total',
562               xns : Roo.data,
563               '|xns' : 'Roo.data',
564               xtype : 'JsonReader'
565              }
566             }
567            },
568            {
569             allowBlank : false,
570             allowDecimals : true,
571             decimalPrecision : 2,
572             fieldLabel : _this._strings['8c489d0946f66d17d73f26366a4bf620'] /* Weight */,
573             name : 'item_prodweight',
574             width : 200,
575             xns : Roo.form,
576             '|xns' : 'Roo.form',
577             xtype : 'NumberField'
578            },
579            {
580             fieldLabel : _this._strings['9d98e31f261471f426e906282544c15d'] /* Item comments */,
581             height : 100,
582             name : 'item_comments',
583             width : 200,
584             xns : Roo.form,
585             '|xns' : 'Roo.form',
586             xtype : 'TextArea'
587            },
588            {
589             fieldLabel : _this._strings['c96bc98500430b5eb8e9cfc5959e09b5'] /* Item sold */,
590             inputValue : true,
591             name : 'item_sold',
592             valueOff : 0,
593             width : 75,
594             xns : Roo.form,
595             '|xns' : 'Roo.form',
596             xtype : 'Checkbox'
597            },
598            {
599             fieldLabel : _this._strings['c056b1456660ea65aad6dfc664002b84'] /* Item active */,
600             inputValue : true,
601             name : 'item_active',
602             valueOff : 0,
603             width : 75,
604             xns : Roo.form,
605             '|xns' : 'Roo.form',
606             xtype : 'Checkbox'
607            },
608            {
609             allowBlank : false,
610             alwaysQuery : true,
611             displayField : 'prodcat_code',
612             editable : false,
613             emptyText : _this._strings['76729937a5eb6b0fd88c42581161facd'] /* Select Category */,
614             fieldLabel : _this._strings['10991ea03e3591bebc4c0827fc369540'] /* Product Category */,
615             forceSelection : true,
616             hiddenName : 'item_prodcat_id',
617             listWidth : 400,
618             loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
619             minChars : 2,
620             name : 'item_prodcat_id_prodcat_code',
621             pageSize : 20,
622             qtip : _this._strings['df2ad52a14d681b1cd8495f8650fdb56'] /* Select prodcat */,
623             queryParam : '',
624             selectOnFocus : true,
625             tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{prodcat_code}</b> </div>',
626             triggerAction : 'all',
627             typeAhead : true,
628             valueField : 'prodcat_id',
629             width : 200,
630             xns : Roo.form,
631             '|xns' : 'Roo.form',
632             xtype : 'ComboBox',
633             listeners : {
634              add : function (combo)
635               {
636                   Pman.Dialog.XtupleProdcat.show({prodcat_id : 0});
637               },
638              edit : function (combo, record)
639               {
640                   var s = _this.form.findField('item_prodcat_id').getValue() * 1;
641                   if(s < 1){
642                       Roo.MessageBox.alert('Error','Please select a account assignment');
643                       return;
644                   }
645                   Pman.Dialog.XtupleProdcat.show({prodcat_id : s});
646               }
647             },
648             store : {
649              remoteSort : true,
650              sortInfo : { direction : 'ASC', field: 'id' },
651              xns : Roo.data,
652              '|xns' : 'Roo.data',
653              xtype : 'Store',
654              listeners : {
655               beforeload : function (_self, o){
656                    o.params = o.params || {};
657                    // set more here
658                }
659              },
660              proxy : {
661               method : 'GET',
662               url : baseURL + '/Roo/prodcat.php',
663               xns : Roo.data,
664               '|xns' : 'Roo.data',
665               xtype : 'HttpProxy'
666              },
667              reader : {
668               fields : [{"name":"id","type":"int"},{"name":"prodcat_code","type":"string"}],
669               id : 'id',
670               root : 'data',
671               totalProperty : 'total',
672               xns : Roo.data,
673               '|xns' : 'Roo.data',
674               xtype : 'JsonReader'
675              }
676             }
677            },
678            {
679             fieldLabel : _this._strings['e54f1b41d200adbd96eb53634388d780'] /* Sales Account */,
680             name : 'item_salesaccnt',
681             xns : Roo.form,
682             '|xns' : 'Roo.form',
683             xtype : 'DisplayField'
684            },
685            {
686             fieldLabel : _this._strings['148cb4c3e6469c6a92d24951485b65ff'] /* Item listprice */,
687             name : 'item_listprice',
688             width : 200,
689             xns : Roo.form,
690             '|xns' : 'Roo.form',
691             xtype : 'NumberField'
692            },
693            {
694             legend : _this._strings['0d122b17933ab4173e9d75d55fc5e764'] /* Standard Cost */,
695             style : 'width:320px',
696             xns : Roo.form,
697             '|xns' : 'Roo.form',
698             xtype : 'FieldSet',
699             listeners : {
700              render : function (_self)
701               {
702                   _this.standardCostFieldSet = _self;
703               }
704             },
705             items  : [
706              {
707               allowBlank : false,
708               displayField : 'curr_name',
709               editable : false,
710               emptyText : _this._strings['e8586011952b0d098b0e568f20ca2b1f'] /* Select Currency */,
711               fieldLabel : _this._strings['386c339d37e737a436499d423a77df0c'] /* Currency */,
712               forceSelection : true,
713               hiddenName : 'item_itemcost_id_itemcost_curr_id',
714               listWidth : 400,
715               loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
716               minChars : 2,
717               name : 'curr_name',
718               pageSize : 20,
719               qtip : _this._strings['e8586011952b0d098b0e568f20ca2b1f'] /* Select Currency */,
720               queryParam : 'query[curr_name]',
721               selectOnFocus : true,
722               tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{curr_name}</b> </div>',
723               triggerAction : 'all',
724               typeAhead : true,
725               valueField : 'curr_id',
726               width : 200,
727               xns : Roo.form,
728               '|xns' : 'Roo.form',
729               xtype : 'ComboBox',
730               store : {
731                remoteSort : true,
732                sortInfo : { direction : 'ASC', field: 'curr_symbol' },
733                xns : Roo.data,
734                '|xns' : 'Roo.data',
735                xtype : 'Store',
736                listeners : {
737                 beforeload : function (_self, o){
738                      o.params = o.params || {};
739                      // set more here
740                     
741                  }
742                },
743                proxy : {
744                 method : 'GET',
745                 url : baseURL + '/Roo/curr_symbol.php',
746                 xns : Roo.data,
747                 '|xns' : 'Roo.data',
748                 xtype : 'HttpProxy'
749                },
750                reader : {
751                 fields : [{"name":"curr_id","type":"int"},"curr_symbol"],
752                 id : 'curr_id',
753                 root : 'data',
754                 totalProperty : 'total',
755                 xns : Roo.data,
756                 '|xns' : 'Roo.data',
757                 xtype : 'JsonReader'
758                }
759               }
760              },
761              {
762               allowBlank : false,
763               fieldLabel : _this._strings['689202409e48743b914713f96d93947c'] /* Value */,
764               name : 'item_itemcost_id_itemcost_actcost',
765               width : 200,
766               xns : Roo.form,
767               '|xns' : 'Roo.form',
768               xtype : 'NumberField'
769              }
770             ]
771            }
772           ]
773          },
774          {
775           xns : Roo.form,
776           '|xns' : 'Roo.form',
777           xtype : 'Column',
778           items  : [
779            {
780             labelWidth : 120,
781             legend : _this._strings['20f39d1311ccbd3b7e61cdd4978719f9'] /* Itemsite Settings */,
782             style : 'width:335px;',
783             xns : Roo.form,
784             '|xns' : 'Roo.form',
785             xtype : 'FieldSet',
786             listeners : {
787              render : function (_self)
788               {
789                   _this.itemsiteFieldSet = _self;
790               }
791             },
792             items  : [
793              {
794               allowBlank : false,
795               fieldLabel : _this._strings['43b2683180fe5e67a91696c834df0a32'] /* Reorder Level */,
796               name : 'item_itemsite_id_itemsite_reorderlevel',
797               width : 200,
798               xns : Roo.form,
799               '|xns' : 'Roo.form',
800               xtype : 'NumberField'
801              },
802              {
803               allowBlank : false,
804               fieldLabel : _this._strings['eccd13e2f1acfd6b8412a2caafa37a80'] /* Stock Safety Level */,
805               name : 'item_itemsite_id_itemsite_safetystock',
806               width : 200,
807               xns : Roo.form,
808               '|xns' : 'Roo.form',
809               xtype : 'NumberField'
810              },
811              {
812               allowBlank : false,
813               fieldLabel : _this._strings['6abc7326bcd435c1eb22ad3714db48c4'] /* Lead time (Days) */,
814               name : 'item_itemsite_id_itemsite_leadtime',
815               width : 200,
816               xns : Roo.form,
817               '|xns' : 'Roo.form',
818               xtype : 'NumberField'
819              },
820              {
821               allowBlank : false,
822               displayField : 'fname',
823               editable : false,
824               fieldLabel : _this._strings['2ea154449c00001e87af8df7c0728678'] /* Control Method */,
825               hiddenName : 'item_itemsite_id_itemsite_controlmethod',
826               listWidth : 200,
827               mode : 'local',
828               name : 'item_itemsite_id_itemsite_controlmethod_name',
829               tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{fname}</b> </div>',
830               triggerAction : 'all',
831               valueField : 'ftype',
832               width : 200,
833               xns : Roo.form,
834               '|xns' : 'Roo.form',
835               xtype : 'ComboBox',
836               store : {
837                data : [ 
838                    [ 'N', "None"],
839                    [ 'R' , "Regular"]
840                ],
841                fields : [  'ftype', 'fname'],
842                xns : Roo.data,
843                '|xns' : 'Roo.data',
844                xtype : 'SimpleStore'
845               }
846              },
847              {
848               allowBlank : false,
849               displayField : 'plancode_name',
850               editable : false,
851               emptyText : _this._strings['c19ea8f7a11074ac743c58d34830b233'] /* Select plancode */,
852               fieldLabel : _this._strings['f9c68217f6ef9a9afe7575e766bd7b9f'] /* Planner Code */,
853               forceSelection : true,
854               hiddenName : 'item_itemsite_id_itemsite_plancode_id',
855               listWidth : 400,
856               loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
857               minChars : 2,
858               name : 'plancode_name',
859               pageSize : 20,
860               qtip : _this._strings['c19ea8f7a11074ac743c58d34830b233'] /* Select plancode */,
861               queryParam : '',
862               selectOnFocus : true,
863               tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{plancode_name}</b> </div>',
864               triggerAction : 'all',
865               typeAhead : true,
866               valueField : 'plancode_id',
867               width : 200,
868               xns : Roo.form,
869               '|xns' : 'Roo.form',
870               xtype : 'ComboBox',
871               store : {
872                remoteSort : true,
873                sortInfo : { direction : 'ASC', field: 'id' },
874                xns : Roo.data,
875                '|xns' : 'Roo.data',
876                xtype : 'Store',
877                listeners : {
878                 beforeload : function (_self, o){
879                      o.params = o.params || {};
880                      // set more here
881                  }
882                },
883                proxy : {
884                 method : 'GET',
885                 url : baseURL + '/Roo/plancode.php',
886                 xns : Roo.data,
887                 '|xns' : 'Roo.data',
888                 xtype : 'HttpProxy'
889                },
890                reader : {
891                 fields : [{"name":"id","type":"int"},{"name":"plancode_code","type":"string"}],
892                 id : 'id',
893                 root : 'data',
894                 totalProperty : 'total',
895                 xns : Roo.data,
896                 '|xns' : 'Roo.data',
897                 xtype : 'JsonReader'
898                }
899               }
900              },
901              {
902               allowBlank : false,
903               displayField : 'costcat_code',
904               editable : false,
905               emptyText : _this._strings['045a1ac263ac3a9b7420208bdc2df423'] /* Select costcat */,
906               fieldLabel : _this._strings['5aa275a71868f3afcacfd6de452b07eb'] /* Costcat */,
907               forceSelection : true,
908               hiddenName : 'item_itemsite_id_itemsite_costcat_id',
909               listWidth : 400,
910               loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
911               minChars : 2,
912               name : 'costcat_code',
913               pageSize : 20,
914               qtip : _this._strings['045a1ac263ac3a9b7420208bdc2df423'] /* Select costcat */,
915               queryParam : '',
916               selectOnFocus : true,
917               tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{costcat_code}</b> </div>',
918               triggerAction : 'all',
919               typeAhead : true,
920               valueField : 'costcat_id',
921               width : 200,
922               xns : Roo.form,
923               '|xns' : 'Roo.form',
924               xtype : 'ComboBox',
925               store : {
926                remoteSort : true,
927                sortInfo : { direction : 'ASC', field: 'id' },
928                xns : Roo.data,
929                '|xns' : 'Roo.data',
930                xtype : 'Store',
931                listeners : {
932                 beforeload : function (_self, o){
933                      o.params = o.params || {};
934                      // set more here
935                  }
936                },
937                proxy : {
938                 method : 'GET',
939                 url : baseURL + '/Roo/costcat.php',
940                 xns : Roo.data,
941                 '|xns' : 'Roo.data',
942                 xtype : 'HttpProxy'
943                },
944                reader : {
945                 fields : [{"name":"id","type":"int"},{"name":"costcat_code","type":"string"}],
946                 id : 'id',
947                 root : 'data',
948                 totalProperty : 'total',
949                 xns : Roo.data,
950                 '|xns' : 'Roo.data',
951                 xtype : 'JsonReader'
952                }
953               }
954              },
955              {
956               fieldLabel : _this._strings['4d3d769b812b6faa6b76e1a8abaece2d'] /* Active */,
957               inputValue : true,
958               name : 'item_itemsite_id_itemsite_active',
959               valueOff : 0,
960               width : 75,
961               xns : Roo.form,
962               '|xns' : 'Roo.form',
963               xtype : 'Checkbox'
964              },
965              {
966               fieldLabel : _this._strings['d85a8a381c36f6dde21d81542830e2b1'] /* Sold */,
967               inputValue : true,
968               name : 'item_itemsite_id_itemsite_sold',
969               valueOff : 0,
970               width : 75,
971               xns : Roo.form,
972               '|xns' : 'Roo.form',
973               xtype : 'Checkbox'
974              },
975              {
976               fieldLabel : _this._strings['fce71ab09b7795157c6e23370b4afb26'] /* Stocked */,
977               inputValue : true,
978               name : 'item_itemsite_id_itemsite_stocked',
979               valueOff : 0,
980               width : 75,
981               xns : Roo.form,
982               '|xns' : 'Roo.form',
983               xtype : 'Checkbox'
984              },
985              {
986               fieldLabel : _this._strings['390fc24b0feebfff8c3fb8625418c2e9'] /* Perishable */,
987               inputValue : true,
988               name : 'item_itemsite_id_itemsite_perishable',
989               valueOff : 0,
990               width : 75,
991               xns : Roo.form,
992               '|xns' : 'Roo.form',
993               xtype : 'Checkbox'
994              },
995              {
996               fieldLabel : _this._strings['e1a8f447925ed2867c591aa0865d170e'] /* Multi Location */,
997               inputValue : true,
998               name : 'item_itemsite_id_itemsite_loccntrl',
999               valueOff : 0,
1000               width : 100,
1001               xns : Roo.form,
1002               '|xns' : 'Roo.form',
1003               xtype : 'Checkbox'
1004              },
1005              {
1006               allowBlank : false,
1007               displayField : 'location_name',
1008               editable : true,
1009               emptyText : _this._strings['82a43f89af6d331d80d441624c5c71fa'] /* Default Location */,
1010               fieldLabel : _this._strings['82a43f89af6d331d80d441624c5c71fa'] /* Default Location */,
1011               forceSelection : true,
1012               hiddenName : 'item_itemsite_id_itemsite_location_id',
1013               listWidth : 400,
1014               loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1015               minChars : 2,
1016               name : 'location_name',
1017               pageSize : 200,
1018               qtip : _this._strings['151ccf95db9b81c11bb20fbc302af4b6'] /* Select terms */,
1019               queryParam : 'query[location_name]',
1020               selectOnFocus : true,
1021               tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{location_name}</b> </div>',
1022               triggerAction : 'all',
1023               typeAhead : false,
1024               valueField : 'location_id',
1025               width : 200,
1026               xns : Roo.form,
1027               '|xns' : 'Roo.form',
1028               xtype : 'ComboBox',
1029               store : {
1030                remoteSort : true,
1031                sortInfo : { direction : 'ASC', field: 'location_name' },
1032                xns : Roo.data,
1033                '|xns' : 'Roo.data',
1034                xtype : 'Store',
1035                listeners : {
1036                 beforeload : function (_self, o){
1037                      o.params = o.params || {};
1038                      // set more here
1039                       o.params.location_netable = 1;
1040                       o.params._notinternalcompany = 1;
1041                       o.params.location_restrict = 0;
1042                  }
1043                },
1044                proxy : {
1045                 method : 'GET',
1046                 url : baseURL + '/Roo/location.php',
1047                 xns : Roo.data,
1048                 '|xns' : 'Roo.data',
1049                 xtype : 'HttpProxy'
1050                },
1051                reader : {
1052                 fields : [{"name":"location_id","type":"int"},"location_name"],
1053                 id : 'location_id',
1054                 root : 'data',
1055                 totalProperty : 'total',
1056                 xns : Roo.data,
1057                 '|xns' : 'Roo.data',
1058                 xtype : 'JsonReader'
1059                }
1060               }
1061              }
1062             ]
1063            }
1064           ]
1065          },
1066          {
1067           name : 'item_id',
1068           width : 75,
1069           xns : Roo.form,
1070           '|xns' : 'Roo.form',
1071           xtype : 'Hidden'
1072          }
1073         ]
1074        }
1075       ]
1076      },
1077      {
1078       background : true,
1079       fitContainer : true,
1080       fitToframe : true,
1081       region : 'center',
1082       tableName : 'bomitem',
1083       title : _this._strings['538a3c9d82a4ea4250b987a357d41184'] /* Item Parts */,
1084       xns : Roo,
1085       '|xns' : 'Roo',
1086       xtype : 'GridPanel',
1087       listeners : {
1088        activate : function() {
1089             _this.partspanel = this;
1090             
1091             try { if (MODULE.isBuilder) {
1092                 return;
1093             } } catch(e) { }
1094             
1095             var id = _this.form.findField('item_id').getValue() * 1;
1096             if (id < 1) {
1097                 Roo.MessageBox.alert("Save First", "Save the item first, before adding parts");
1098                 _this.dialog.layout.getRegion('center').showPanel(0);
1099                 return;
1100             }
1101             
1102             var type = _this.form.findField('item_type').getValue();
1103             
1104             if(!type.length || type != 'K'){
1105                 Roo.MessageBox.alert("Error", "Can't add parts to non-kit item");
1106                 _this.dialog.layout.getRegion('center').showPanel(0);
1107                 return;
1108             }
1109             
1110             if (_this.partsgrid) {
1111                 _this.partsgrid.footer.onClick('first');
1112             
1113              }
1114         }
1115       },
1116       grid : {
1117        autoExpandColumn : 'bomitem_item_id_item_descrip1',
1118        clicksToEdit : 1,
1119        loadMask : true,
1120        xns : Roo.grid,
1121        '|xns' : 'Roo.grid',
1122        xtype : 'EditorGrid',
1123        listeners : {
1124         afteredit : function (e)
1125          {
1126              if(e.originalValue == e.value){
1127                  return false;
1128              }
1129              
1130              
1131              new Pman.Request({
1132                  method : 'POST',
1133                  url : baseURL + '/Roo/bomitem.php',
1134                  mask : 'Saving',
1135                  params : {
1136                      bomitem_id : e.record.data.bomitem_id,
1137                      bomitem_qtyper : e.value
1138                  },
1139                  success : function() {
1140                      e.record.set('bomitem_qtyper', e.value);
1141                  }
1142              
1143              });
1144                  
1145                   
1146                  
1147                  
1148          },
1149         beforeedit : function (e)
1150          {
1151              if(e.field != 'bomitem_qtyper'){
1152                  return false;
1153              }
1154              
1155          },
1156         render : function() 
1157          {
1158              _this.partsgrid = this; 
1159              //_this.dialog = Pman.Dialog.FILL_IN
1160              if (_this.partspanel.active) {
1161                 this.footer.onClick('first');
1162              }
1163          }
1164        },
1165        footer : {
1166         displayInfo : true,
1167         displayMsg : _this._strings['76d5bf9597c882d6513f71759df298d5'] /* Displaying parts {0} - {1} of {2} */,
1168         emptyMsg : _this._strings['9076cbba1d9ef79280b4f39e2aa0d115'] /* Nothing found */,
1169         pageSize : 50,
1170         xns : Roo,
1171         '|xns' : 'Roo',
1172         xtype : 'PagingToolbar'
1173        },
1174        toolbar : {
1175         xns : Roo,
1176         '|xns' : 'Roo',
1177         xtype : 'Toolbar',
1178         items  : [
1179          {
1180           allowBlank : true,
1181           alwaysQuery : true,
1182           displayField : 'item_number',
1183           editable : true,
1184           emptyText : _this._strings['786410e93beb0193d89f8608c54feb4b'] /* Select item */,
1185           fieldLabel : _this._strings['7d74f3b92b19da5e606d737d339a9679'] /* Item */,
1186           forceSelection : true,
1187           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1188           minChars : 2,
1189           pageSize : 20,
1190           qtip : _this._strings['786410e93beb0193d89f8608c54feb4b'] /* Select item */,
1191           queryParam : 'query[number_or_name]',
1192           selectOnFocus : true,
1193           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{item_number}</b> </div>',
1194           triggerAction : 'all',
1195           typeAhead : true,
1196           valueField : 'id',
1197           width : 200,
1198           xns : Roo.bootstrap,
1199           '|xns' : 'Roo.bootstrap',
1200           xtype : 'ComboBox',
1201           listeners : {
1202            render : function (_self)
1203             {
1204                 _this.partsBox = _self;
1205             },
1206            select : function (combo, record, index)
1207             {
1208                 var item_id = _this.form.findField('item_id').getValue() * 1;
1209                 
1210                 if(typeof(record) == 'undefined' || !record || record.data.id * 1 < 1 || item_id < 1){
1211                     return;
1212                 }
1213                 
1214                 var err = false;
1215             
1216                 _this.partsgrid.ds.each(function(d){
1217                     if(record.data.item_id == d.data.bomitem_item_id){
1218                         err = true;
1219                     }
1220                 });
1221             
1222                 if(err){
1223                     Roo.MessageBox.alert('Error', record.data.item_number + ' already exists!');
1224                     _this.partsBox.reset();
1225                     return;
1226                 }
1227                 
1228                 new Pman.Request({
1229                     url : baseURL + '/Roo/bomitem.php',
1230                     method : 'POST',
1231                     params : {
1232                         bomitem_parent_item_id : item_id,
1233                         bomitem_item_id : record.data.item_id,
1234                         bomitem_qtyper : 1
1235                     }, 
1236                     success : function(res) {
1237                         _this.partsBox.reset();
1238                         _this.partsgrid.footer.onClick('first');
1239                     }
1240                 }); 
1241             }
1242           },
1243           store : {
1244            remoteSort : true,
1245            sortInfo : { direction : 'ASC', field: 'item_number' },
1246            xns : Roo.data,
1247            '|xns' : 'Roo.data',
1248            xtype : 'Store',
1249            listeners : {
1250             beforeload : function (_self, o){
1251                  o.params = o.params || {};
1252                  
1253                  o.params.item_active = 1;
1254                  o.params['!item_type'] = 'K';
1255              }
1256            },
1257            proxy : {
1258             method : 'GET',
1259             url : baseURL + '/Roo/item.php',
1260             xns : Roo.data,
1261             '|xns' : 'Roo.data',
1262             xtype : 'HttpProxy'
1263            },
1264            reader : {
1265             fields : [
1266                 {"name":"id","type":"int"},
1267                 {"name":"item_number","type":"string"}
1268             ],
1269             id : 'id',
1270             root : 'data',
1271             totalProperty : 'total',
1272             xns : Roo.data,
1273             '|xns' : 'Roo.data',
1274             xtype : 'JsonReader'
1275            }
1276           }
1277          },
1278          {
1279           xns : Roo.Toolbar,
1280           '|xns' : 'Roo.Toolbar',
1281           xtype : 'Fill'
1282          },
1283          {
1284           cls : 'x-btn-text-icon',
1285           icon : rootURL + '/Pman/templates/images/trash.gif',
1286           text : _this._strings['1063e38cb53d94d386f21227fcd84717'] /* Remove */,
1287           xns : Roo,
1288           '|xns' : 'Roo',
1289           xtype : 'Button',
1290           listeners : {
1291            click : function ()
1292             {
1293                 var sel = _this.partsgrid.getSelectionModel().getSelectedCell();
1294                 
1295                 if(!sel || !sel.length){
1296                     Roo.MessageBox.alert("Error", "Please select a item from below list");
1297                     return;
1298                 }
1299                 
1300                 var d = _this.partsgrid.ds.getAt(sel[0]);      
1301               
1302                 if(d.data.bomitem_id * 1 < 1){
1303                     Roo.MessageBox.alert("Error", "Invaild selection");
1304                     return;
1305                 }
1306                 
1307                 new Pman.Request({
1308                     url : baseURL + '/Roo/bomitem.php',
1309                     method : 'POST',
1310                     params : {
1311                         _delete : d.data.bomitem_id
1312                     }, 
1313                     success : function(res) {
1314                         _this.partsgrid.footer.onClick('first');
1315                     }
1316                 }); 
1317                
1318             }
1319           }
1320          }
1321         ]
1322        },
1323        dataSource : {
1324         remoteSort : true,
1325         sortInfo : { field : 'bomitem_item_id_item_name', direction: 'ASC' },
1326         xns : Roo.data,
1327         '|xns' : 'Roo.data',
1328         xtype : 'Store',
1329         listeners : {
1330          beforeload : function (_self, o)
1331           {
1332              o.params = o.params || {};
1333              
1334              var id  = _this.form.findField('item_id').getValue() * 1;
1335              if(id < 1){
1336                   return false;
1337              }
1338              
1339              o.params.bom_parent_item_id = id;
1340           }
1341         },
1342         proxy : {
1343          method : 'GET',
1344          url : baseURL + '/Roo/bomitem.php',
1345          xns : Roo.data,
1346          '|xns' : 'Roo.data',
1347          xtype : 'HttpProxy'
1348         },
1349         reader : {
1350          fields : [
1351              {
1352                  'name': 'bomitem_id',
1353                  'type': 'int'
1354              }
1355          ],
1356          id : 'bom_id',
1357          root : 'data',
1358          totalProperty : 'total',
1359          xns : Roo.data,
1360          '|xns' : 'Roo.data',
1361          xtype : 'JsonReader'
1362         }
1363        },
1364        colModel : [
1365         {
1366          dataIndex : 'bomitem_item_id_item_number',
1367          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
1368          renderer : function(v) { return String.format('{0}', v); },
1369          width : 150,
1370          xns : Roo.grid,
1371          '|xns' : 'Roo.grid',
1372          xtype : 'ColumnModel'
1373         },
1374         {
1375          dataIndex : 'bomitem_item_id_item_descrip1',
1376          header : _this._strings['b5a7adde1af5c87d7fd797b6245c2a39'] /* Description */,
1377          renderer : function(v) { return String.format('{0}', v); },
1378          width : 150,
1379          xns : Roo.grid,
1380          '|xns' : 'Roo.grid',
1381          xtype : 'ColumnModel'
1382         },
1383         {
1384          align : 'right',
1385          dataIndex : 'bomitem_qtyper',
1386          header : _this._strings['03ab340b3f99e03cff9e84314ead38c0'] /* Qty */,
1387          renderer : function(v) { return String.format('{0}', v); },
1388          width : 100,
1389          xns : Roo.grid,
1390          '|xns' : 'Roo.grid',
1391          xtype : 'ColumnModel',
1392          editor : {
1393           xns : Roo.grid,
1394           '|xns' : 'Roo.grid',
1395           xtype : 'GridEditor',
1396           field : {
1397            allowBlank : false,
1398            cls : 'align-right',
1399            decimalPrecision : 0,
1400            minValue : 0,
1401            xns : Roo.form,
1402            '|xns' : 'Roo.form',
1403            xtype : 'NumberField'
1404           }
1405          }
1406         }
1407        ]
1408       }
1409      },
1410      {
1411       background : true,
1412       fitContainer : true,
1413       fitToframe : true,
1414       region : 'center',
1415       tableName : 'Images',
1416       title : _this._strings['346577d22bb510368e3eddab5df2ca13'] /* Reference Files */,
1417       xns : Roo,
1418       '|xns' : 'Roo',
1419       xtype : 'GridPanel',
1420       listeners : {
1421        activate : function() {
1422             _this.panel = this;
1423             
1424             try { if (MODULE.isBuilder) {
1425                 return;
1426             } } catch(e) { }
1427             
1428             var id = _this.form.findField('item_id').getValue() * 1;
1429             if (id < 1) {
1430                 Roo.MessageBox.alert("Save First", "Save the item first, before adding image");
1431                 _this.dialog.layout.getRegion('center').showPanel(0);
1432                 return;
1433             }
1434             
1435             if (_this.grid) {
1436                 _this.grid.footer.onClick('first');
1437             
1438              }
1439         }
1440       },
1441       grid : {
1442        autoExpandColumn : 'id',
1443        loadMask : true,
1444        xns : Roo.grid,
1445        '|xns' : 'Roo.grid',
1446        xtype : 'Grid',
1447        listeners : {
1448         render : function() { 
1449              _this.grid = this; 
1450          
1451              if (_this.panel.active) {
1452                 this.footer.onClick('first');
1453              }
1454          },
1455         rowdblclick : function (_self, rowIndex, e)
1456          {
1457            
1458             var s =  _self.getDataSource().getAt(rowIndex);
1459             new Pman.Download({
1460                  url : baseURL + '/Images/Download/' + s.data.id
1461              });
1462             
1463          }
1464        },
1465        footer : {
1466         displayInfo : true,
1467         displayMsg : _this._strings['c0ed345ec857c06b31f7e88745c9bc40'] /* Displaying Images  {0} - {1} of {2} */,
1468         emptyMsg : _this._strings['0c81971f67c0bd4b33799c5365ec2bf5'] /* No Images found */,
1469         pageSize : 25,
1470         xns : Roo,
1471         '|xns' : 'Roo',
1472         xtype : 'PagingToolbar'
1473        },
1474        toolbar : {
1475         xns : Roo,
1476         '|xns' : 'Roo',
1477         xtype : 'Toolbar',
1478         items  : [
1479          {
1480           cls : 'x-btn-text-icon',
1481           icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1482           text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
1483           xns : Roo.Toolbar,
1484           '|xns' : 'Roo.Toolbar',
1485           xtype : 'Button',
1486           listeners : {
1487            click : function()
1488             {
1489                 Pman.Dialog.Image.show({
1490                     id : 0, 
1491                     ontable: 'item',
1492                     onid: _this.form.findField('item_id').getValue() * 1,
1493                     imgtype : ''
1494                 }, function(data){
1495                     if (!data) { return; } 
1496                     _this.grid.footer.onClick('first');
1497                 }); 
1498             
1499             }
1500           }
1501          },
1502          {
1503           cls : 'x-btn-text-icon',
1504           icon : rootURL + '/Pman/templates/images/trash.gif',
1505           text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
1506           xns : Roo.Toolbar,
1507           '|xns' : 'Roo.Toolbar',
1508           xtype : 'Button',
1509           listeners : {
1510            click : function()
1511             {
1512                 Pman.genericDelete(_this, 'Images'); 
1513             }
1514           }
1515          }
1516         ]
1517        },
1518        dataSource : {
1519         remoteSort : true,
1520         sortInfo : { field: 'created' , direction: 'DESC' },
1521         xns : Roo.data,
1522         '|xns' : 'Roo.data',
1523         xtype : 'Store',
1524         listeners : {
1525          beforeload : function (_self, o)
1526           {
1527               o.params = o.params || {};
1528               
1529               var id = _this.form.findField('item_id').getValue();
1530               
1531               if(id * 1 < 1){
1532                   return false;
1533               }
1534               
1535               o.params.onid = id;
1536               o.params.ontable = 'item';
1537               
1538           }
1539         },
1540         proxy : {
1541          method : 'GET',
1542          url : baseURL + '/Roo/Images.php',
1543          xns : Roo.data,
1544          '|xns' : 'Roo.data',
1545          xtype : 'HttpProxy'
1546         },
1547         reader : {
1548          fields : [
1549              {
1550                  'name': 'id',
1551                  'type': 'int'
1552              },
1553              {
1554                  'name': 'filename',
1555                  'type': 'string'
1556              },
1557              {
1558                  'name': 'ontable',
1559                  'type': 'string'
1560              },
1561              {
1562                  'name': 'onid',
1563                  'type': 'int'
1564              },
1565              {
1566                  'name': 'mimetype',
1567                  'type': 'string'
1568              },
1569              {
1570                  'name': 'width',
1571                  'type': 'int'
1572              },
1573              {
1574                  'name': 'height',
1575                  'type': 'int'
1576              },
1577              {
1578                  'name': 'filesize',
1579                  'type': 'int'
1580              },
1581              {
1582                  'name': 'displayorder',
1583                  'type': 'int'
1584              },
1585              {
1586                  'name': 'language',
1587                  'type': 'string'
1588              },
1589              {
1590                  'name': 'parent_image_id',
1591                  'type': 'int'
1592              },
1593              {
1594                  'name': 'created',
1595                  'type': 'date',
1596                  'dateFormat' : 'Y-m-d H:i:s'
1597              },
1598              {
1599                  'name': 'imgtype',
1600                  'type': 'string'
1601              },
1602              {
1603                  'name': 'linkurl',
1604                  'type': 'string'
1605              },
1606              {
1607                  'name': 'descript',
1608                  'type': 'string'
1609              },
1610              {
1611                  'name': 'title',
1612                  'type': 'string'
1613              }
1614          ],
1615          id : 'id',
1616          root : 'data',
1617          totalProperty : 'total',
1618          xns : Roo.data,
1619          '|xns' : 'Roo.data',
1620          xtype : 'JsonReader'
1621         }
1622        },
1623        colModel : [
1624         {
1625          dataIndex : 'created',
1626          header : _this._strings['0eceeb45861f9585dd7a97a3e36f85c6'] /* Created */,
1627          renderer : function(v,x,r) {
1628                 return String.format('{0}<br/><i>{1}</i><br/>{2}<br/><i>{3}x{4}</i>',
1629                      v.format('d/M/Y'), r.data.mimetype, r.data.filename,
1630              r.data.width, r.data.height
1631              ); 
1632          },
1633          sortable : true,
1634          width : 200,
1635          xns : Roo.grid,
1636          '|xns' : 'Roo.grid',
1637          xtype : 'ColumnModel'
1638         },
1639         {
1640          dataIndex : 'id',
1641          header : _this._strings['be53a0541a6d36f6ecb879fa2c584b08'] /* Image */,
1642          renderer : function(v,x,r) { return String.format('<img src="{0}/Images/Thumb/100/{1}/{2}" height="100">', baseURL, v, r.data.filename); },
1643          width : 100,
1644          xns : Roo.grid,
1645          '|xns' : 'Roo.grid',
1646          xtype : 'ColumnModel'
1647         }
1648        ]
1649       }
1650      },
1651      {
1652       background : true,
1653       fitContainer : true,
1654       fitToframe : true,
1655       region : 'center',
1656       tableName : 'ipshead',
1657       title : _this._strings['1656a671ba692e15836cd85df374556c'] /* Price List */,
1658       xns : Roo,
1659       '|xns' : 'Roo',
1660       xtype : 'GridPanel',
1661       listeners : {
1662        activate : function() {
1663             _this.lpanel = this;
1664             
1665             try { if (MODULE.isBuilder) {
1666                 return;
1667             } } catch(e) { }
1668             
1669             var id = _this.form.findField('item_id').getValue() * 1;
1670             if (id < 1) {
1671                 Roo.MessageBox.alert("Save First", "Save the item first, before adding image");
1672                 _this.dialog.layout.getRegion('center').showPanel(0);
1673                 return;
1674             }
1675             
1676             if (_this.lgrid) {
1677                 _this.lgrid.footer.onClick('first');
1678             
1679              }
1680         }
1681       },
1682       grid : {
1683        autoExpandColumn : 'ipshead_descrip',
1684        clicksToEdit : 1,
1685        loadMask : true,
1686        xns : Roo.grid,
1687        '|xns' : 'Roo.grid',
1688        xtype : 'EditorGrid',
1689        listeners : {
1690         afteredit : function (e)
1691          {
1692              if(e.originalValue == e.value){
1693                  return false;
1694              }
1695              
1696              var id = _this.form.findField('item_id').getValue() * 1;
1697              if(id < 1){
1698                  return false;
1699              }
1700              
1701              new Pman.Request({
1702                  method : 'POST',
1703                  url : baseURL + '/Roo/ipsiteminfo',
1704                  mask : 'Saving',
1705                  params : {
1706                      ipsitem_ipshead_id : e.record.data.ipshead_id,
1707                      ipsitem_item_id : id,
1708                      ipsitem_price : e.record.data.ipshead_ipsitem_price,
1709                      ipsitem_id : e.record.data.ipshead_ipsitem_id
1710                  }
1711              
1712              });
1713                  
1714                   
1715                  
1716                  
1717          },
1718         beforeedit : function (e)
1719          {
1720              if(e.field != 'ipshead_ipsitem_price'){
1721                  return false;
1722              }
1723              
1724          },
1725         render : function() 
1726          {
1727              _this.lgrid = this; 
1728              //_this.dialog = Pman.Dialog.FILL_IN
1729              if (_this.lpanel.active) {
1730                 this.footer.onClick('first');
1731              }
1732          }
1733        },
1734        footer : {
1735         displayInfo : true,
1736         displayMsg : _this._strings['956e816fa19ca04485c7101adbe07762'] /* Displaying records {0} - {1} of {2} */,
1737         emptyMsg : _this._strings['9076cbba1d9ef79280b4f39e2aa0d115'] /* Nothing found */,
1738         pageSize : 50,
1739         xns : Roo,
1740         '|xns' : 'Roo',
1741         xtype : 'PagingToolbar'
1742        },
1743        dataSource : {
1744         remoteSort : true,
1745         sortInfo : { field : 'ipshead_id', direction: 'ASC' },
1746         xns : Roo.data,
1747         '|xns' : 'Roo.data',
1748         xtype : 'Store',
1749         listeners : {
1750          beforeload : function (_self, o)
1751           {
1752              o.params = o.params || {};
1753              
1754              var id  = _this.form.findField('item_id').getValue() * 1;
1755              if(id < 1){
1756                   return false;
1757              }
1758              
1759              o.params._with_item = id;
1760           }
1761         },
1762         proxy : {
1763          method : 'GET',
1764          url : baseURL + '/Roo/ipshead.php',
1765          xns : Roo.data,
1766          '|xns' : 'Roo.data',
1767          xtype : 'HttpProxy'
1768         },
1769         reader : {
1770          fields : [
1771              {
1772                  'name': 'ipshead_id',
1773                  'type': 'int'
1774              },
1775              {
1776                  'name': 'ipshead_name',
1777                  'type': 'string'
1778              }
1779          ],
1780          id : 'ipshead_id',
1781          root : 'data',
1782          totalProperty : 'total',
1783          xns : Roo.data,
1784          '|xns' : 'Roo.data',
1785          xtype : 'JsonReader'
1786         }
1787        },
1788        colModel : [
1789         {
1790          dataIndex : 'ipshead_name',
1791          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
1792          renderer : function(v) { return String.format('{0}', v); },
1793          width : 150,
1794          xns : Roo.grid,
1795          '|xns' : 'Roo.grid',
1796          xtype : 'ColumnModel'
1797         },
1798         {
1799          dataIndex : 'ipshead_descrip',
1800          header : _this._strings['b5a7adde1af5c87d7fd797b6245c2a39'] /* Description */,
1801          renderer : function(v) { return String.format('{0}', v); },
1802          width : 150,
1803          xns : Roo.grid,
1804          '|xns' : 'Roo.grid',
1805          xtype : 'ColumnModel'
1806         },
1807         {
1808          dataIndex : 'ipshead_curr_id_curr_name',
1809          header : _this._strings['386c339d37e737a436499d423a77df0c'] /* Currency */,
1810          renderer : function(v) { return String.format('{0}', v); },
1811          width : 100,
1812          xns : Roo.grid,
1813          '|xns' : 'Roo.grid',
1814          xtype : 'ColumnModel'
1815         },
1816         {
1817          align : 'right',
1818          dataIndex : 'ipshead_ipsitem_price',
1819          header : _this._strings['3601146c4e948c32b6424d2c0a7f0118'] /* Price */,
1820          renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); },
1821          width : 120,
1822          xns : Roo.grid,
1823          '|xns' : 'Roo.grid',
1824          xtype : 'ColumnModel',
1825          editor : {
1826           xns : Roo.grid,
1827           '|xns' : 'Roo.grid',
1828           xtype : 'GridEditor',
1829           field : {
1830            cls : 'align-right',
1831            decimalPrecision : 2,
1832            xns : Roo.form,
1833            '|xns' : 'Roo.form',
1834            xtype : 'NumberField'
1835           }
1836          }
1837         }
1838        ]
1839       }
1840      },
1841      {
1842       background : true,
1843       fitContainer : true,
1844       fitToframe : true,
1845       region : 'center',
1846       tableName : 'itemsrc',
1847       title : _this._strings['1814d65a76028fdfbadab64a5a8076df'] /* Suppliers */,
1848       xns : Roo,
1849       '|xns' : 'Roo',
1850       xtype : 'GridPanel',
1851       listeners : {
1852        activate : function() {
1853             _this.itemsrcpanel = this;
1854             
1855             try { if (MODULE.isBuilder) {
1856                 return;
1857             } } catch(e) { }
1858             
1859             var id = _this.form.findField('item_id').getValue() * 1;
1860             if (id < 1) {
1861                 Roo.MessageBox.alert("Save First", "Save the item first, before adding suppliers");
1862                 _this.dialog.layout.getRegion('center').showPanel(0);
1863                 return false;
1864             }
1865             
1866             var type = _this.form.findField('item_type').getValue();
1867             
1868             if(type == 'K'){
1869                 Roo.MessageBox.alert("Error", "Can't add suppliers to kit item");
1870                 _this.dialog.layout.getRegion('center').showPanel(0);
1871                 return false;
1872             }
1873             
1874             if (_this.itemsrcgrid) {
1875                 _this.itemsrcgrid.footer.onClick('first');
1876             }
1877         }
1878       },
1879       grid : {
1880        autoExpandColumn : 'itemsrc_comments',
1881        clicksToEdit : 1,
1882        loadMask : true,
1883        xns : Roo.grid,
1884        '|xns' : 'Roo.grid',
1885        xtype : 'EditorGrid',
1886        listeners : {
1887         afteredit : function (e)
1888          {
1889              e.record.commit();
1890          },
1891         render : function() 
1892          {
1893              _this.itemsrcgrid = this; 
1894              
1895              if (_this.itemsrcpanel.active) {
1896                 this.footer.onClick('first');
1897              }
1898          },
1899         rowdblclick : function (_self, rowIndex, e)
1900          {
1901              if (!_this.dialog) return;
1902              _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
1903                  _this.grid.footer.onClick('first');
1904              }); 
1905          }
1906        },
1907        footer : {
1908         displayInfo : true,
1909         displayMsg : _this._strings['7f841b4d2f7280eb82318988c6d649d1'] /* Displaying itemsrc{0} - {1} of {2} */,
1910         emptyMsg : _this._strings['19df363d15888baa395364fbcd230c05'] /* No itemsrc found */,
1911         pageSize : 25,
1912         xns : Roo,
1913         '|xns' : 'Roo',
1914         xtype : 'PagingToolbar'
1915        },
1916        toolbar : {
1917         xns : Roo,
1918         '|xns' : 'Roo',
1919         xtype : 'Toolbar',
1920         items  : [
1921          {
1922           cls : 'x-btn-text-icon',
1923           icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1924           text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
1925           xns : Roo.Toolbar,
1926           '|xns' : 'Roo.Toolbar',
1927           xtype : 'Button',
1928           listeners : {
1929            click : function()
1930             {
1931                  
1932                 Roo.log("add presed");
1933                  
1934                 // work out last 
1935                 var grid = _this.itemsrcgrid;
1936                  
1937                 // uses form defaults or last row value.
1938                 var nr = grid.ds.reader.newRow({
1939                      itemsrc_id : 0,
1940                      itemsrc_item_id : _this.form.findField('item_id').getValue(),
1941                      itemsrc_vend_id : 0,
1942                      itemsrc_vend_id_vend_name : '',
1943                      itemsrc_vend_item_number : '',
1944                      itemsrc_vend_item_descrip : '',
1945                      itemsrc_comments           : '',
1946                      itemsrc_vend_uom  :           'EA',
1947                      itemsrc_invvendoruomratio : 1.0,
1948                      itemsrc_minordqty        : 0,
1949                      itemsrc_multordqty        : 0,
1950                      itemsrc_leadtime         :  30,
1951                      itemsrc_ranking         :   0,
1952                      itemsrc_active          :   true,
1953                      itemsrc_manuf_name       :  '',
1954                      itemsrc_manuf_item_number : '',
1955                      itemsrc_manuf_item_descrip: '',
1956                      itemsrc_default          : true,
1957                      itemsrc_upccode    : ''
1958                                     
1959                 });
1960                 grid.stopEditing();
1961                 grid.ds.insert(0, nr); 
1962                 grid.startEditing(0, 0); // type..
1963             
1964             }
1965           }
1966          }
1967         ]
1968        },
1969        dataSource : {
1970         remoteSort : true,
1971         sortInfo : { field : 'itemsrc_vend_id_vend_name', direction: 'ASC' },
1972         xns : Roo.data,
1973         '|xns' : 'Roo.data',
1974         xtype : 'Store',
1975         listeners : {
1976          beforeload : function (_self, o)
1977           {
1978               
1979               var id = 1 * _this.form.findField('item_id').getValue();
1980               if (!id) {
1981                   this.removeAll();
1982                   return false;
1983               }
1984               o.params.itemsrc_item_id = id;
1985           },
1986          update : function (_self, record, operation)
1987           {
1988               Roo.log(operation);
1989                 Roo.log(record);
1990              
1991               if (operation != 'commit') {
1992                   return;
1993               }
1994               if (record.data.itemsrc_vend_id * 1 < 1) {
1995                   return; // do not save.
1996               }
1997               if (record.data.itemsrc_id * 1 < 0) {
1998                   return; // do not save. -- updating at present...
1999               }
2000               
2001               var p = Roo.apply({}, record.data);
2002               record.set('itemsrc_id', -1);    
2003               
2004               new Pman.Request({
2005                   url : baseURL + '/Roo/Itemsrc',
2006                   params : p,
2007                   method : 'POST',
2008                   success: function(res) {
2009                       if (record.data.itemsrc_id *1  < 1) { 
2010                           record.set('itemsrc_id', res.data.itemsrc_id);
2011                       }
2012                   }
2013               });
2014               
2015               
2016           }
2017         },
2018         proxy : {
2019          method : 'GET',
2020          url : baseURL + '/Roo/itemsrc.php',
2021          xns : Roo.data,
2022          '|xns' : 'Roo.data',
2023          xtype : 'HttpProxy'
2024         },
2025         reader : {
2026          fields : [
2027              {
2028                  'name': 'itemsrc_id',
2029                  'type': 'int'
2030              },
2031              {
2032                  'name': 'itemsrc_item_id',
2033                  'type': 'int'
2034              },
2035              {
2036                  'name': 'itemsrc_item_id',
2037                  'type': 'int'
2038              },
2039              {
2040                  'name': 'itemsrc_vend_id',
2041                  'type': 'int'
2042              },
2043              {
2044                  'name': 'itemsrc_vend_id',
2045                  'type': 'int'
2046              },
2047              {
2048                  'name': 'itemsrc_vend_item_number',
2049                  'type': 'string'
2050              },
2051              {
2052                  'name': 'itemsrc_vend_item_descrip',
2053                  'type': 'string'
2054              },
2055              {
2056                  'name': 'itemsrc_comments',
2057                  'type': 'string'
2058              },
2059              {
2060                  'name': 'itemsrc_vend_uom',
2061                  'type': 'string'
2062              },
2063              {
2064                  'name': 'itemsrc_invvendoruomratio',
2065                  'type': 'float'
2066              },
2067              {
2068                  'name': 'itemsrc_minordqty',
2069                  'type': 'float'
2070              },
2071              {
2072                  'name': 'itemsrc_multordqty',
2073                  'type': 'float'
2074              },
2075              {
2076                  'name': 'itemsrc_leadtime',
2077                  'type': 'int'
2078              },
2079              {
2080                  'name': 'itemsrc_ranking',
2081                  'type': 'int'
2082              },
2083              {
2084                  'name': 'itemsrc_active',
2085                  'type': 'int'
2086              },
2087              {
2088                  'name': 'itemsrc_manuf_name',
2089                  'type': 'string'
2090              },
2091              {
2092                  'name': 'itemsrc_manuf_item_number',
2093                  'type': 'string'
2094              },
2095              {
2096                  'name': 'itemsrc_manuf_item_descrip',
2097                  'type': 'string'
2098              },
2099              {
2100                  'name': 'itemsrc_default',
2101                  'type': 'int'
2102              },
2103              {
2104                  'name': 'itemsrc_upccode',
2105                  'type': 'string'
2106              }
2107          ],
2108          id : 'id',
2109          root : 'data',
2110          totalProperty : 'total',
2111          xns : Roo.data,
2112          '|xns' : 'Roo.data',
2113          xtype : 'JsonReader'
2114         }
2115        },
2116        colModel : [
2117         {
2118          dataIndex : 'itemsrc_vend_id',
2119          header : _this._strings['ec9ceefe0c19f4c029008c23e3c947b7'] /* Vendor */,
2120          renderer : function(v,x,r) { return String.format('{0}', r.data.itemsrc_vend_id_vend_name); },
2121          width : 120,
2122          xns : Roo.grid,
2123          '|xns' : 'Roo.grid',
2124          xtype : 'ColumnModel',
2125          editor : {
2126           xns : Roo.grid,
2127           '|xns' : 'Roo.grid',
2128           xtype : 'GridEditor',
2129           field : {
2130            allowBlank : false,
2131            displayField : 'vend_name',
2132            editable : true,
2133            emptyText : _this._strings['7996af9149ed376ce252e35c4da7146b'] /* Select Vendor */,
2134            forceSelection : true,
2135            hiddenName : 'itemsrc_vend_id',
2136            listWidth : 400,
2137            loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
2138            minChars : 2,
2139            name : 'itemsrc_vend_id_vend_name',
2140            pageSize : 20,
2141            qtip : _this._strings['dd24f967299e81b9603cb071693d5c32'] /* Select vendinfo */,
2142            queryParam : 'q[search]',
2143            selectOnFocus : true,
2144            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{vend_name}</b> </div>',
2145            triggerAction : 'all',
2146            typeAhead : true,
2147            valueField : 'vend_id',
2148            width : 300,
2149            xns : Roo.form,
2150            '|xns' : 'Roo.form',
2151            xtype : 'ComboBox',
2152            store : {
2153             remoteSort : true,
2154             sortInfo : { direction : 'ASC', field: 'id' },
2155             xns : Roo.data,
2156             '|xns' : 'Roo.data',
2157             xtype : 'Store',
2158             listeners : {
2159              beforeload : function (_self, o){
2160                   o.params = o.params || {};
2161                   // set more here
2162               }
2163             },
2164             proxy : {
2165              method : 'GET',
2166              url : baseURL + '/Roo/vendinfo.php',
2167              xns : Roo.data,
2168              '|xns' : 'Roo.data',
2169              xtype : 'HttpProxy'
2170             },
2171             reader : {
2172              fields : [{"name":"id","type":"int"},{"name":"vend_name","type":"string"}],
2173              id : 'id',
2174              root : 'data',
2175              totalProperty : 'total',
2176              xns : Roo.data,
2177              '|xns' : 'Roo.data',
2178              xtype : 'JsonReader'
2179             }
2180            }
2181           }
2182          }
2183         },
2184         {
2185          dataIndex : 'itemsrc_vend_item_number',
2186          header : _this._strings['e5353fc67b122d1b42181073b46cd060'] /* Vendor Ref# */,
2187          renderer : function(v) { return String.format('{0}', v); },
2188          width : 100,
2189          xns : Roo.grid,
2190          '|xns' : 'Roo.grid',
2191          xtype : 'ColumnModel',
2192          editor : {
2193           xns : Roo.grid,
2194           '|xns' : 'Roo.grid',
2195           xtype : 'GridEditor',
2196           field : {
2197            xns : Roo.form,
2198            '|xns' : 'Roo.form',
2199            xtype : 'TextField'
2200           }
2201          }
2202         },
2203         {
2204          dataIndex : 'itemsrc_comments',
2205          header : _this._strings['8413c683b4b27cc3f4dbd4c90329d8ba'] /* Comments */,
2206          renderer : function(v) { return String.format('{0}', v); },
2207          width : 200,
2208          xns : Roo.grid,
2209          '|xns' : 'Roo.grid',
2210          xtype : 'ColumnModel',
2211          editor : {
2212           xns : Roo.grid,
2213           '|xns' : 'Roo.grid',
2214           xtype : 'GridEditor',
2215           field : {
2216            xns : Roo.form,
2217            '|xns' : 'Roo.form',
2218            xtype : 'TextField'
2219           }
2220          }
2221         },
2222         {
2223          dataIndex : 'itemsrc_vend_uom',
2224          header : _this._strings['bb8913cd17d59f182acc7be1020007b7'] /* UOM */,
2225          renderer : function(v) { return String.format('{0}', v); },
2226          width : 50,
2227          xns : Roo.grid,
2228          '|xns' : 'Roo.grid',
2229          xtype : 'ColumnModel'
2230         },
2231         {
2232          align : 'right',
2233          dataIndex : 'itemsrc_minordqty',
2234          header : _this._strings['7be1fa478799242847d4ef861ff6f8e1'] /* Min Qty */,
2235          renderer : function(v) { return String.format('{0}', v); },
2236          width : 50,
2237          xns : Roo.grid,
2238          '|xns' : 'Roo.grid',
2239          xtype : 'ColumnModel',
2240          editor : {
2241           xns : Roo.grid,
2242           '|xns' : 'Roo.grid',
2243           xtype : 'GridEditor',
2244           field : {
2245            decimalPrecision : 0,
2246            minValue : 0,
2247            xns : Roo.form,
2248            '|xns' : 'Roo.form',
2249            xtype : 'NumberField'
2250           }
2251          }
2252         },
2253         {
2254          align : 'right',
2255          dataIndex : 'itemsrc_leadtime',
2256          header : _this._strings['0ac9012a8c03a76ee76f04321b3b7fda'] /* Lead time */,
2257          renderer : function(v) { return String.format('{0}', v); },
2258          width : 75,
2259          xns : Roo.grid,
2260          '|xns' : 'Roo.grid',
2261          xtype : 'ColumnModel',
2262          editor : {
2263           xns : Roo.grid,
2264           '|xns' : 'Roo.grid',
2265           xtype : 'GridEditor',
2266           field : {
2267            decimalPrecision : 0,
2268            minValue : 0,
2269            xns : Roo.form,
2270            '|xns' : 'Roo.form',
2271            xtype : 'NumberField'
2272           }
2273          }
2274         },
2275         {
2276          dataIndex : 'itemsrc_active',
2277          header : _this._strings['4d3d769b812b6faa6b76e1a8abaece2d'] /* Active */,
2278          renderer : function(v) { return String.format('{0}', v); },
2279          width : 50,
2280          xns : Roo.grid,
2281          '|xns' : 'Roo.grid',
2282          xtype : 'ColumnModel'
2283         }
2284        ]
2285       }
2286      },
2287      {
2288       background : true,
2289       fitContainer : true,
2290       fitToframe : true,
2291       region : 'center',
2292       tableName : 'events',
2293       title : _this._strings['16d2b386b2034b9488996466aaae0b57'] /* History */,
2294       xns : Roo,
2295       '|xns' : 'Roo',
2296       xtype : 'GridPanel',
2297       listeners : {
2298        activate : function() {
2299             _this.hpanel = this;
2300             if (_this.hgrid) {
2301                 _this.hgrid.footer.onClick('first');
2302             }
2303         }
2304       },
2305       grid : {
2306        autoExpandColumn : 'remarks',
2307        loadMask : true,
2308        xns : Roo.grid,
2309        '|xns' : 'Roo.grid',
2310        xtype : 'Grid',
2311        listeners : {
2312         render : function() 
2313          {
2314              _this.hgrid = this; 
2315              if (_this.hpanel.active) {
2316                 this.footer.onClick('first');
2317              }
2318          }
2319        },
2320        footer : {
2321         displayInfo : true,
2322         displayMsg : _this._strings['089ba2b5edc96565fc22c584ecfbb1a6'] /* Displaying events{0} - {1} of {2} */,
2323         emptyMsg : _this._strings['90e4ac2e5a22e53df63b6b186d8727ba'] /* No Events found */,
2324         pageSize : 25,
2325         xns : Roo,
2326         '|xns' : 'Roo',
2327         xtype : 'PagingToolbar'
2328        },
2329        dataSource : {
2330         remoteSort : true,
2331         sortInfo : { field : 'event_when', direction: 'DESC' },
2332         xns : Roo.data,
2333         '|xns' : 'Roo.data',
2334         xtype : 'Store',
2335         listeners : {
2336          beforeload : function (_self, options)
2337           {
2338               options.params = options.params || {};
2339               
2340               options.params.on_table = 'item';
2341               options.params.on_id = _this.form.findField('item_id').getValue();
2342           }
2343         },
2344         proxy : {
2345          method : 'GET',
2346          url : baseURL + '/Roo/events.php',
2347          xns : Roo.data,
2348          '|xns' : 'Roo.data',
2349          xtype : 'HttpProxy'
2350         },
2351         reader : {
2352          fields : [
2353              {
2354                  'name': 'event_when',
2355                  'type': 'date'
2356              },
2357              {
2358                  'name': 'action',
2359                  'type': 'string'
2360              },
2361              {
2362                  'name': 'ipaddr',
2363                  'type': 'string'
2364              },
2365              {
2366                  'name': 'person_id_name',
2367                  'type': 'string'
2368              },
2369              {
2370                  'name': 'remarks',
2371                  'type': 'string'
2372              }
2373          ],
2374          id : 'id',
2375          root : 'data',
2376          totalProperty : 'total',
2377          xns : Roo.data,
2378          '|xns' : 'Roo.data',
2379          xtype : 'JsonReader'
2380         }
2381        },
2382        colModel : [
2383         {
2384          dataIndex : 'event_when',
2385          header : _this._strings['820dbd2b8f606aff866c0bbfb6b737c1'] /* Changed */,
2386          renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); },
2387          width : 120,
2388          xns : Roo.grid,
2389          '|xns' : 'Roo.grid',
2390          xtype : 'ColumnModel'
2391         },
2392         {
2393          dataIndex : 'action',
2394          header : _this._strings['004bf6c9a40003140292e97330236c53'] /* Action */,
2395          renderer : function(v,x,r) { return String.format('{0} - {1}', v, r.data.on_table); },
2396          width : 200,
2397          xns : Roo.grid,
2398          '|xns' : 'Roo.grid',
2399          xtype : 'ColumnModel'
2400         },
2401         {
2402          dataIndex : 'ipaddr',
2403          header : _this._strings['5b8c99dad1893a85076709b2d3c2d2d0'] /* IP Address */,
2404          renderer : function(v) { return String.format('{0}', v); },
2405          width : 200,
2406          xns : Roo.grid,
2407          '|xns' : 'Roo.grid',
2408          xtype : 'ColumnModel'
2409         },
2410         {
2411          dataIndex : 'person_id_name',
2412          header : _this._strings['4ee972120bcda675f75222c87cb9d356'] /* Who */,
2413          renderer : function(v) { return String.format('{0}', v); },
2414          width : 75,
2415          xns : Roo.grid,
2416          '|xns' : 'Roo.grid',
2417          xtype : 'ColumnModel'
2418         },
2419         {
2420          dataIndex : 'remarks',
2421          header : _this._strings['f4c6f851b00d5518bf888815de279aba'] /* Notes */,
2422          renderer : function(v) { return String.format('{0}', v); },
2423          width : 200,
2424          xns : Roo.grid,
2425          '|xns' : 'Roo.grid',
2426          xtype : 'ColumnModel'
2427         }
2428        ]
2429       }
2430      }
2431     ]
2432    });
2433  }
2434 };