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