Pman.Tab.XtupleCustomer.bjs
[Pman.Xtuple] / Pman.Tab.XtupleCustomer.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.XtupleCustomer = new Roo.XComponent({
6     part     :  ["Xtuple","Customer"],
7     order    : '700-Pman.Tab.XtupleCustomer',
8     region   : 'center',
9     parent   : 'Pman.Tab.XtupleSales',
10     name     : "unnamed module",
11     disabled : false, 
12     permname : '', 
13     _tree : function()
14     {
15         var _this = this;
16         var MODULE = this;
17         return {
18             xtype: 'GridPanel',
19             xns: Roo,
20             listeners : {
21                 activate : function() {
22                     _this.panel = this;
23                     if (_this.grid) {
24                         _this.grid.footer.onClick('first');
25                     }
26                 }
27             },
28             background : true,
29             fitContainer : true,
30             fitToframe : true,
31             region : 'center',
32             tableName : 'custinfo',
33             title : "Customers",
34             grid : {
35                 xtype: 'Grid',
36                 xns: Roo.grid,
37                 listeners : {
38                     render : function() 
39                     {
40                         _this.grid = this; 
41                         _this.dialog = Pman.Dialog.XtupleCustomer;
42                         if (_this.panel.active) {
43                            this.footer.onClick('first');
44                         }
45                     },
46                     rowdblclick : function (_self, rowIndex, e)
47                     {
48                         if (!_this.dialog) return;
49                         _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
50                             _this.grid.footer.onClick('refresh');
51                         }); 
52                     }
53                 },
54                 autoExpandColumn : 'cust_name',
55                 loadMask : true,
56                 dataSource : {
57                     xtype: 'Store',
58                     xns: Roo.data,
59                     listeners : {
60                         beforeload : function (_self, o)
61                         {
62                             if (!_this.officeCombo) {
63                                 return false;
64                             }
65                             
66                             o.params = o.params || {};
67                             o.params['search[cust_name]'] = _this.searchBox.getValue();
68                             if (!_this.activeBtn.pressed) {
69                                 o.params.cust_active = 1;
70                             } 
71                             var dt = _this.dateSearch.getValue(); 
72                             if (dt) {
73                                 o.params['search[orders_since]'] = dt.format('Y-m-d');
74                             }
75                             dt = _this.dateSearchNo.getValue(); 
76                             if (dt) {
77                                 o.params['search[no_orders_since]'] = dt.format('Y-m-d');
78                             }
79                             
80                             o.params['search[with_orders_since]'] = 1; //
81                             o.params['search[with_balance]'] = 1;
82                             o.params['search[with_address]'] = 1;
83                             o.params['_with_char'] = 1;    
84                             o.params['_with_group_data'] = 1;
85                             o.params['search[_country]'] = _this.country.getValue();
86                             o.params._get = 1; // for download
87                             
88                             o.params['cust_char_internalcompany'] = _this.officeCombo.getValue();
89                         }
90                     },
91                     remoteSort : true,
92                     sortInfo : { field : 'cust_name', direction: 'ASC' },
93                     proxy : {
94                         xtype: 'HttpProxy',
95                         xns: Roo.data,
96                         method : 'GET',
97                         url : baseURL + '/Roo/custinfo.php'
98                     },
99                     reader : {
100                         xtype: 'JsonReader',
101                         xns: Roo.data,
102                         totalProperty : 'total',
103                         root : 'data',
104                         id : 'id',
105                         fields : [
106                             {
107                                 'name': 'cust_active',
108                                 'type': 'boolean'
109                             },
110                             {
111                                 'name': 'cust_custtype_id_custtype_descrip',
112                                 'type': 'string'
113                             },
114                             {
115                                 'name': 'cust_salesrep_id_salesrep_name',
116                                 'type': 'string'
117                             },
118                             {
119                                 'name': 'cust_name',
120                                 'type': 'string'
121                             }
122                         ]
123                     }
124                 },
125                 footer : {
126                     xtype: 'PagingToolbar',
127                     xns: Roo,
128                     pageSize : 25,
129                     displayInfo : true,
130                     displayMsg : "Displaying custinfo{0} - {1} of {2}",
131                     emptyMsg : "No custinfo found",
132                     items : [
133                         {
134                             xtype: 'Button',
135                             xns: Roo.Toolbar,
136                             text : "Upload/Download",
137                             menu : {
138                                 xtype: 'Menu',
139                                 xns: Roo.menu,
140                                 items : [
141                                     {
142                                         xtype: 'Item',
143                                         xns: Roo.menu,
144                                         listeners : {
145                                             click : function (_self, e)
146                                             {
147                                                 
148                                                 if (!Pman.hasPerm('Xtuple.CustomerDownload','S')) {
149                                                     Roo.MessageBox.alert("Error", "Permission Denied");
150                                                     return;
151                                                 }
152                                                 _this.grid.ds.proxy.conn.method = 'POST';
153                                                 new Pman.Download({
154                                                     grid : _this.grid
155                                                 });
156                                                 
157                                             }
158                                         },
159                                         text : "Download Mailing list subscribers"
160                                     },
161                                     {
162                                         xtype: 'Item',
163                                         xns: Roo.menu,
164                                         listeners : {
165                                             click : function (_self, e)
166                                             {
167                                                 
168                                                 if (!Pman.hasPerm('Xtuple.CustomerDownload','S')) {
169                                                     Roo.MessageBox.alert("Error", "Permission Denied");
170                                                     return;
171                                                 }
172                                                 _this.grid.ds.proxy.conn.method = 'POST';
173                                                 new Pman.Download({
174                                                     grid : _this.grid
175                                                 });
176                                                 
177                                             }
178                                         },
179                                         text : "Download Customers"
180                                     },
181                                     {
182                                         xtype: 'Item',
183                                         xns: Roo.menu,
184                                         listeners : {
185                                             click : function (_self, e)
186                                             {
187                                                 
188                                                 if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
189                                                     Roo.MessageBox.alert("Error", "Permission Denied");
190                                                     return;
191                                                 }
192                                                 
193                                                 var c = _this.country.getValue();
194                                                 if(!c.length){
195                                                     Roo.MessageBox.alert("Error", "Please select a country");
196                                                     return;
197                                                 }
198                                                 
199                                                 new Pman.Download({
200                                                     url : baseURL + '/Roo/custinfo',
201                                                     method : 'GET',
202                                                     params : {
203                                                         _my_json : 1,
204                                                         limit : 9999,
205                                                         'search[_country]' : c,
206                                                         'search[with_address]' : 1
207                                                     }
208                                                     
209                                                 });
210                                             }
211                                         },
212                                         text : "Download Customers As Json"
213                                     },
214                                     {
215                                         xtype: 'Item',
216                                         xns: Roo.menu,
217                                         listeners : {
218                                             click : function (_self, e)
219                                             {
220                                                 
221                                                 if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
222                                                     Roo.MessageBox.alert("Error", "Permission Denied");
223                                                     return;
224                                                 }
225                                                
226                                                Pman.Dialog.Image.show(
227                                                    {
228                                                         _url : baseURL+'/Xtuple/Import/Customers' 
229                                                     
230                                                    },
231                                                    function (data) {
232                                                         _this.grid.footer.onClick('first');
233                                                         Roo.MessageBox.alert("Notice", "DONE");
234                                             //            Roo.MessageBox.alert("Notice", msg.join("\n"));
235                                             
236                                                    }
237                                                );
238                                                 
239                                             }
240                                         },
241                                         text : "Upload Customers"
242                                     },
243                                     {
244                                         xtype: 'Item',
245                                         xns: Roo.menu,
246                                         listeners : {
247                                             click : function (_self, e)
248                                             {
249                                                 
250                                                 if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
251                                                     Roo.MessageBox.alert("Error", "Permission Denied");
252                                                     return;
253                                                 }
254                                                
255                                                Pman.Dialog.Image.show(
256                                                    {
257                                                         _url : baseURL+'/Xtuple/Import/MyCustomers' 
258                                                     
259                                                    },
260                                                    function (data) {
261                                                         _this.grid.footer.onClick('first');
262                                                         Roo.MessageBox.alert("Notice", "DONE");
263                                             //            Roo.MessageBox.alert("Notice", msg.join("\n"));
264                                             
265                                                    }
266                                                );
267                                                 
268                                             }
269                                         },
270                                         text : "Upload Customers Json File"
271                                     },
272                                     {
273                                         xtype: 'Item',
274                                         xns: Roo.menu,
275                                         listeners : {
276                                             click : function (_self, e)
277                                             {
278                                                 
279                                                 if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
280                                                     Roo.MessageBox.alert("Error", "Permission Denied");
281                                                     return;
282                                                 }
283                                                
284                                                Pman.Dialog.Image.show(
285                                                    {
286                                                         _url : baseURL+'/Xtuple/Import/AUPostAccounts' 
287                                                     
288                                                    },
289                                                    function (data) {
290                                                         _this.grid.footer.onClick('first');
291                                                         Roo.MessageBox.alert("Notice", data);
292                                             
293                                                    }
294                                                );
295                                                 
296                                             }
297                                         },
298                                         text : "Upload AU Post Accounts"
299                                     }
300                                 ]
301                             }
302                         }
303                     ]
304                 },
305                 toolbar : {
306                     xtype: 'Toolbar',
307                     xns: Roo,
308                     items : [
309                         {
310                             xtype: 'TextItem',
311                             xns: Roo.Toolbar,
312                             text : "Search : "
313                         },
314                         {
315                             xtype: 'TextField',
316                             xns: Roo.form,
317                             listeners : {
318                                 render : function (_self)
319                                 {
320                                     _this.searchBox = _self;
321                                 },
322                                 specialkey : function (_self, e)
323                                 {
324                                     _this.grid.footer.onClick('first');
325                                 }
326                             }
327                         },
328                         {
329                             xtype: 'Button',
330                             xns: Roo.Toolbar,
331                             listeners : {
332                                 click : function (_self, e)
333                                 {
334                                 _this.grid.footer.onClick('first');
335                                 }
336                             },
337                             cls : 'x-btn-icon',
338                             icon : rootURL + '/Pman/templates/images/search.gif'
339                         },
340                         {
341                             xtype: 'Button',
342                             xns: Roo.Toolbar,
343                             listeners : {
344                                 click : function (_self, e)
345                                 {
346                                     _this.searchBox.setValue('');
347                                     
348                                     
349                                     _this.grid.footer.onClick('first');
350                                 }
351                             },
352                             cls : 'x-btn-icon',
353                             icon : rootURL + '/Pman/templates/images/edit-clear.gif'
354                         },
355                         {
356                             xtype: 'ComboBox',
357                             xns: Roo.form,
358                             listeners : {
359                                 render : function (_self)
360                                 {
361                                   _this.officeCombo  = _self;
362                                 },
363                                 select : function (combo, record, index)
364                                 {
365                                 
366                                     _this.grid.footer.onClick('first');
367                                 }
368                             },
369                             allowBlank : true,
370                             displayField : 'office',
371                             editable : false,
372                             fieldLabel : 'Office',
373                             hiddenName : 'office',
374                             listWidth : 200,
375                             mode : 'local',
376                             name : 'office',
377                             tpl : '<div class="x-grid-cell-text x-btn button"><b>{office}</b> </div>',
378                             triggerAction : 'all',
379                             valueField : 'office',
380                             width : 75,
381                             store : {
382                                 xtype: 'SimpleStore',
383                                 xns: Roo.data,
384                                 data : [ 
385                                     [ ''] ,
386                                     [ 'hk' ],
387                                     [ 'sg' ],
388                                     [ 'my' ],
389                                     [ 'cn' ],
390                                     [ 'au' ]
391                                 ],
392                                 fields : ['office']
393                             }
394                         },
395                         {
396                             xtype: 'ComboBox',
397                             xns: Roo.form,
398                             listeners : {
399                                 render : function (_self)
400                                 {
401                                     _this.country = _self;
402                                 },
403                                 select : function (combo, record, index)
404                                 {
405                                     _this.grid.footer.onClick('first');
406                                 }
407                             },
408                             allowBlank : true,
409                             alwaysQuery : true,
410                             displayField : 'addr_country',
411                             editable : true,
412                             emptyText : "Select Country",
413                             fieldLabel : 'Country',
414                             forceSelection : true,
415                             hiddenName : 'addr_country',
416                             listWidth : 300,
417                             loadingText : "Searching...",
418                             minChars : 2,
419                             name : 'addr_country',
420                             pageSize : 20,
421                             qtip : "Select Country",
422                             queryParam : 'query[addr_country]',
423                             selectOnFocus : true,
424                             tpl : '<div class="x-grid-cell-text x-btn button"><b>{addr_country}</b> </div>',
425                             triggerAction : 'all',
426                             typeAhead : true,
427                             valueField : 'addr_country',
428                             width : 150,
429                             store : {
430                                 xtype: 'Store',
431                                 xns: Roo.data,
432                                 listeners : {
433                                     beforeload : function (_self, o){
434                                         o.params = o.params || {};
435                                         o.params._distinct = 'addr_country';
436                                         o.params._columns ='addr_country';
437                                     }
438                                 },
439                                 remoteSort : true,
440                                 sortInfo : { direction : 'ASC', field: 'addr_country' },
441                                 proxy : {
442                                     xtype: 'HttpProxy',
443                                     xns: Roo.data,
444                                     method : 'GET',
445                                     url : baseURL + '/Roo/Addr.php'
446                                 },
447                                 reader : {
448                                     xtype: 'JsonReader',
449                                     xns: Roo.data,
450                                     id : 'addr_id',
451                                     root : 'data',
452                                     totalProperty : 'total',
453                                     fields : [{"name":"addr_id","type":"int"},{"name":"addr_country","type":"string"}]
454                                 }
455                             }
456                         },
457                         {
458                             xtype: 'Button',
459                             xns: Roo.Toolbar,
460                             listeners : {
461                                 toggle : function (_self, pressed)
462                                 {
463                                     _this.grid.footer.onClick('first');
464                                 },
465                                 render : function (_self)
466                                 {
467                                     _this.activeBtn = _self;
468                                 }
469                             },
470                             enableToggle : true,
471                             pressed : false,
472                             text : "Show / Hide Inactive"
473                         },
474                         {
475                             xtype: 'TextItem',
476                             xns: Roo.Toolbar,
477                             text : "Has orders since"
478                         },
479                         {
480                             xtype: 'DateField',
481                             xns: Roo.form,
482                             listeners : {
483                                 render : function (_self)
484                                 {
485                                     _this.dateSearch = _self
486                                 },
487                                 select : function (combo, date)
488                                 {
489                                     _this.grid.footer.onClick('first');
490                                 },
491                                 specialkey : function (_self, e)
492                                 {
493                                    _this.grid.footer.onClick('first');
494                                 }
495                             },
496                             format : 'Y-m-d'
497                         },
498                         {
499                             xtype: 'TextItem',
500                             xns: Roo.Toolbar,
501                             text : "No orders since"
502                         },
503                         {
504                             xtype: 'DateField',
505                             xns: Roo.form,
506                             listeners : {
507                                 render : function (_self)
508                                 {
509                                     _this.dateSearchNo = _self
510                                 },
511                                 select : function (combo, date)
512                                 {
513                                    _this.grid.footer.onClick('first');
514                                 },
515                                 specialkey : function (_self, e)
516                                 {
517                                    _this.grid.footer.onClick('first');
518                                 }
519                             },
520                             format : 'Y-m-d'
521                         },
522                         {
523                             xtype: 'Fill',
524                             xns: Roo.Toolbar
525                         },
526                         {
527                             xtype: 'Button',
528                             xns: Roo.Toolbar,
529                             listeners : {
530                                 click : function()
531                                 {
532                                     if (!_this.dialog) return;
533                                     _this.dialog.show( { id : 0 } , function() {
534                                         _this.grid.footer.onClick('first');
535                                    }); 
536                                 }
537                             },
538                             cls : 'x-btn-text-icon',
539                             text : "Add",
540                             icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
541                         },
542                         {
543                             xtype: 'Button',
544                             xns: Roo.Toolbar,
545                             listeners : {
546                                 click : function()
547                                 {
548                                     var s = _this.grid.getSelectionModel().getSelections();
549                                     if (!s.length || (s.length > 1))  {
550                                         Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
551                                         return;
552                                     }
553                                     if (!_this.dialog) return;
554                                     _this.dialog.show(s[0].data, function() {
555                                         _this.grid.footer.onClick('first');
556                                     }); 
557                                     
558                                 }
559                             },
560                             cls : 'x-btn-text-icon',
561                             text : "Edit",
562                             icon : Roo.rootURL + 'images/default/tree/leaf.gif'
563                         }
564                     ]
565                 },
566                 colModel : [
567                     {
568                         xtype: 'ColumnModel',
569                         xns: Roo.grid,
570                         dataIndex : 'cust_active',
571                         header : 'Active',
572                         width : 50,
573                         renderer : function(v) { return String.format('{0}', v? 'Y' : 'N'); }
574                     },
575                     {
576                         xtype: 'ColumnModel',
577                         xns: Roo.grid,
578                         dataIndex : 'last_order',
579                         header : 'Last Order',
580                         width : 80,
581                         renderer : function(v) { 
582                             if (!v) { 
583                                 return '-none-';
584                             }
585                             var vv = Date.parseDate(v, 'Y-m-d');
586                             return String.format('{0}',  vv.format('d/M/Y') ); 
587                         }
588                     },
589                     {
590                         xtype: 'ColumnModel',
591                         xns: Roo.grid,
592                         dataIndex : 'cust_taxzone_id_taxzone_descrip',
593                         header : 'Tax Status',
594                         sortable : true,
595                         width : 100,
596                         renderer : function(v) { return String.format('{0}', v); }
597                     },
598                     {
599                         xtype: 'ColumnModel',
600                         xns: Roo.grid,
601                         dataIndex : 'cust_terms_id_terms_descrip',
602                         header : 'Terms',
603                         sortable : true,
604                         width : 100,
605                         renderer : function(v) { return String.format('{0}', v); }
606                     },
607                     {
608                         xtype: 'ColumnModel',
609                         xns: Roo.grid,
610                         dataIndex : 'cust_salesrep_id_salesrep_name',
611                         header : 'Sales Rep',
612                         sortable : true,
613                         width : 100,
614                         renderer : function(v) { return String.format('{0}', v); }
615                     },
616                     {
617                         xtype: 'ColumnModel',
618                         xns: Roo.grid,
619                         dataIndex : 'ipshead_id_name',
620                         header : 'Curr/Price List',
621                         sortable : true,
622                         width : 80,
623                         renderer : function(v,x,r) { 
624                             if (!v.length) {
625                                  return String.format('{0}<br/><span style="color:red">No price list</span>', 
626                                 r.data.cust_curr_id_curr_name  );
627                              }    
628                         
629                             return  String.format('{0}<br/>{1}', 
630                                 r.data.cust_curr_id_curr_name,
631                                v ); 
632                            }
633                     },
634                     {
635                         xtype: 'ColumnModel',
636                         xns: Roo.grid,
637                         dataIndex : 'cust_number',
638                         header : 'Ref No.',
639                         sortable : true,
640                         width : 80,
641                         renderer : function(v) { return String.format('{0}', v); }
642                     },
643                     {
644                         xtype: 'ColumnModel',
645                         xns: Roo.grid,
646                         dataIndex : 'cust_name',
647                         header : 'Name',
648                         sortable : true,
649                         width : 200,
650                         renderer : function(v,x,r) {
651                             if (!r.data.cust_char_internalcompany.length) {
652                                  return String.format('{0}', v); 
653                              }
654                             return String.format('<span style="color:red">[Internal company : {0}] {1}</span>',
655                                 r.data.cust_char_internalcompany,  v); 
656                          }
657                     },
658                     {
659                         xtype: 'ColumnModel',
660                         xns: Roo.grid,
661                         dataIndex : 'cust_bill_info',
662                         header : 'Billing Address',
663                         sortable : true,
664                         width : 200,
665                         renderer : function(v,x,r) 
666                         { 
667                             if(!v.length){
668                                 var add = [];\r
669                                 Roo.each([ 'line1', 'line2', 'line3', 'city', 'state', 'country'], function (k) {\r
670                                     if (!r.data['cntct_addr_' + k].length) {\r
671                                         return;\r
672                                     }\r
673                                     add.push(String.format("{0}", r.data['cntct_addr_' + k]));\r
674                                 \r
675                                 });
676                                 return add.join('<BR/>');
677                             }
678                             
679                             var v = v.split("\r\n").join("<br/>");
680                             return v; 
681                         }
682                     },
683                     {
684                         xtype: 'ColumnModel',
685                         xns: Roo.grid,
686                         dataIndex : 'cust_ship_info',
687                         header : 'Shipping Address',
688                         sortable : true,
689                         width : 200,
690                         renderer : function(v,x,r) 
691                         { 
692                             if(!v.length){
693                                 var add = [];\r
694                                 Roo.each([ 'line1', 'line2', 'line3', 'city', 'state', 'country'], function (k) {\r
695                                     if (!r.data['cntct_addr_' + k].length) {\r
696                                         return;\r
697                                     }\r
698                                     add.push(String.format("{0}", r.data['cntct_addr_' + k]));\r
699                                 \r
700                                 });
701                                 return add.join('<BR/>');
702                             }
703                             
704                             var v = v.split("\r\n").join("<br/>");
705                             return v; 
706                         }
707                     },
708                     {
709                         xtype: 'ColumnModel',
710                         xns: Roo.grid,
711                         dataIndex : 'cust_cntct_id_cntct_first_name',
712                         header : 'Contact',
713                         sortable : true,
714                         width : 150,
715                         renderer : function(v,x,r) 
716                         { 
717                             return String.format(
718                                 'Name: {0}<br/>' + 
719                                 'Phone: {1}<br/>' + 
720                                 'Email: <a href="mailto:{2}">{2}</a>',
721                             
722                                 r.data.cust_cntct_id_cntct_first_name,
723                                 r.data.cust_cntct_id_cntct_phone,
724                                 r.data.cust_cntct_id_cntct_email
725                             );
726                         }
727                     },
728                     {
729                         xtype: 'ColumnModel',
730                         xns: Roo.grid,
731                         dataIndex : 'cust_char_au_post_accno',
732                         header : 'AU Post#',
733                         hidden : true,
734                         sortable : true,
735                         width : 150,
736                         renderer : function(v,x,r) 
737                         { 
738                             return String.format('{0}', v);
739                         }
740                     },
741                     {
742                         xtype: 'ColumnModel',
743                         xns: Roo.grid,
744                         dataIndex : 'cust_cntct_id_cntct_phone',
745                         header : 'Contact Number',
746                         hidden : true,
747                         sortable : true,
748                         width : 150,
749                         renderer : function(v,x,r) 
750                         { 
751                             return String.format('{0}',v);
752                         }
753                     },
754                     {
755                         xtype: 'ColumnModel',
756                         xns: Roo.grid,
757                         dataIndex : 'cust_cntct_id_cntct_email',
758                         header : 'Email',
759                         hidden : true,
760                         sortable : true,
761                         width : 150,
762                         renderer : function(v,x,r) 
763                         { 
764                             return String.format('<a href="mailto:{0}">{0}</a>', v);
765                         }
766                     },
767                     {
768                         xtype: 'ColumnModel',
769                         xns: Roo.grid,
770                         align : 'right',
771                         dataIndex : 'cntct_addr_city',
772                         header : 'City',
773                         hidden : true,
774                         sortable : true,
775                         width : 75,
776                         renderer : function(v) { return String.format('{0}', v ? v : ''); }
777                     },
778                     {
779                         xtype: 'ColumnModel',
780                         xns: Roo.grid,
781                         align : 'right',
782                         dataIndex : 'cntct_addr_state',
783                         header : 'State',
784                         hidden : true,
785                         sortable : true,
786                         width : 75,
787                         renderer : function(v) { return String.format('{0}', v ? v : ''); }
788                     },
789                     {
790                         xtype: 'ColumnModel',
791                         xns: Roo.grid,
792                         align : 'right',
793                         dataIndex : 'cntct_addr_country',
794                         header : 'Country',
795                         sortable : true,
796                         width : 75,
797                         renderer : function(v) { return String.format('{0}', v ? v : ''); }
798                     },
799                     {
800                         xtype: 'ColumnModel',
801                         xns: Roo.grid,
802                         dataIndex : 'cust_curr_id_curr_name',
803                         header : 'Currency',
804                         sortable : true,
805                         width : 50,
806                         renderer : function(v) { return String.format('{0}', v); }
807                     },
808                     {
809                         xtype: 'ColumnModel',
810                         xns: Roo.grid,
811                         align : 'right',
812                         dataIndex : 'balance',
813                         header : 'Balance',
814                         width : 75,
815                         renderer : function(v,x,r) { 
816                         
817                              
818                             return String.format('{0}{1}', r.data.cust_curr_id_curr_symbol, Roo.util.Format.number(v,2)); 
819                         }
820                     }
821                 ]
822             }
823         };
824     }
825 });