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                                                 
200                                                 var params = {
201                                                     '_group' : 'customer',
202                                                     '_name' : 'subscribers',
203                                                     'limit' : 99999,
204                                                     'csvTitles' : '*',
205                                                     'csvCols' : '*'
206                                                 };
207                                                 
208                                                 
209                                                 new Pman.Download({
210                                                   url : baseURL + '/Roo/Metasql',
211                                                   params :   params,
212                                                   method : 'GET'
213                                                 });
214                                                 Roo.MessageBox.alert("Notice", "Report will download shortly");
215                                             }
216                                         },
217                                         text : "Download Customers As Json"
218                                     },
219                                     {
220                                         xtype: 'Item',
221                                         xns: Roo.menu,
222                                         listeners : {
223                                             click : function (_self, e)
224                                             {
225                                                 
226                                                 if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
227                                                     Roo.MessageBox.alert("Error", "Permission Denied");
228                                                     return;
229                                                 }
230                                                
231                                                Pman.Dialog.Image.show(
232                                                    {
233                                                         _url : baseURL+'/Xtuple/Import/Customers' 
234                                                     
235                                                    },
236                                                    function (data) {
237                                                         _this.grid.footer.onClick('first');
238                                                         Roo.MessageBox.alert("Notice", "DONE");
239                                             //            Roo.MessageBox.alert("Notice", msg.join("\n"));
240                                             
241                                                    }
242                                                );
243                                                 
244                                             }
245                                         },
246                                         text : "Upload Customers"
247                                     },
248                                     {
249                                         xtype: 'Item',
250                                         xns: Roo.menu,
251                                         listeners : {
252                                             click : function (_self, e)
253                                             {
254                                                 
255                                                 if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
256                                                     Roo.MessageBox.alert("Error", "Permission Denied");
257                                                     return;
258                                                 }
259                                                
260                                                Pman.Dialog.Image.show(
261                                                    {
262                                                         _url : baseURL+'/Xtuple/Import/MyCustomers' 
263                                                     
264                                                    },
265                                                    function (data) {
266                                                         _this.grid.footer.onClick('first');
267                                                         Roo.MessageBox.alert("Notice", "DONE");
268                                             //            Roo.MessageBox.alert("Notice", msg.join("\n"));
269                                             
270                                                    }
271                                                );
272                                                 
273                                             }
274                                         },
275                                         text : "Upload Customers Json File"
276                                     },
277                                     {
278                                         xtype: 'Item',
279                                         xns: Roo.menu,
280                                         listeners : {
281                                             click : function (_self, e)
282                                             {
283                                                 
284                                                 if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
285                                                     Roo.MessageBox.alert("Error", "Permission Denied");
286                                                     return;
287                                                 }
288                                                
289                                                Pman.Dialog.Image.show(
290                                                    {
291                                                         _url : baseURL+'/Xtuple/Import/AUPostAccounts' 
292                                                     
293                                                    },
294                                                    function (data) {
295                                                         _this.grid.footer.onClick('first');
296                                                         Roo.MessageBox.alert("Notice", data);
297                                             
298                                                    }
299                                                );
300                                                 
301                                             }
302                                         },
303                                         text : "Upload AU Post Accounts"
304                                     }
305                                 ]
306                             }
307                         }
308                     ]
309                 },
310                 toolbar : {
311                     xtype: 'Toolbar',
312                     xns: Roo,
313                     items : [
314                         {
315                             xtype: 'TextItem',
316                             xns: Roo.Toolbar,
317                             text : "Search : "
318                         },
319                         {
320                             xtype: 'TextField',
321                             xns: Roo.form,
322                             listeners : {
323                                 render : function (_self)
324                                 {
325                                     _this.searchBox = _self;
326                                 },
327                                 specialkey : function (_self, e)
328                                 {
329                                     _this.grid.footer.onClick('first');
330                                 }
331                             }
332                         },
333                         {
334                             xtype: 'Button',
335                             xns: Roo.Toolbar,
336                             listeners : {
337                                 click : function (_self, e)
338                                 {
339                                 _this.grid.footer.onClick('first');
340                                 }
341                             },
342                             cls : 'x-btn-icon',
343                             icon : rootURL + '/Pman/templates/images/search.gif'
344                         },
345                         {
346                             xtype: 'Button',
347                             xns: Roo.Toolbar,
348                             listeners : {
349                                 click : function (_self, e)
350                                 {
351                                     _this.searchBox.setValue('');
352                                     
353                                     
354                                     _this.grid.footer.onClick('first');
355                                 }
356                             },
357                             cls : 'x-btn-icon',
358                             icon : rootURL + '/Pman/templates/images/edit-clear.gif'
359                         },
360                         {
361                             xtype: 'ComboBox',
362                             xns: Roo.form,
363                             listeners : {
364                                 render : function (_self)
365                                 {
366                                   _this.officeCombo  = _self;
367                                 },
368                                 select : function (combo, record, index)
369                                 {
370                                 
371                                     _this.grid.footer.onClick('first');
372                                 }
373                             },
374                             allowBlank : true,
375                             displayField : 'office',
376                             editable : false,
377                             fieldLabel : 'Office',
378                             hiddenName : 'office',
379                             listWidth : 200,
380                             mode : 'local',
381                             name : 'office',
382                             tpl : '<div class="x-grid-cell-text x-btn button"><b>{office}</b> </div>',
383                             triggerAction : 'all',
384                             valueField : 'office',
385                             width : 75,
386                             store : {
387                                 xtype: 'SimpleStore',
388                                 xns: Roo.data,
389                                 data : [ 
390                                     [ ''] ,
391                                     [ 'hk' ],
392                                     [ 'sg' ],
393                                     [ 'my' ],
394                                     [ 'cn' ],
395                                     [ 'au' ]
396                                 ],
397                                 fields : ['office']
398                             }
399                         },
400                         {
401                             xtype: 'ComboBox',
402                             xns: Roo.form,
403                             listeners : {
404                                 render : function (_self)
405                                 {
406                                     _this.country = _self;
407                                 },
408                                 select : function (combo, record, index)
409                                 {
410                                     _this.grid.footer.onClick('first');
411                                 }
412                             },
413                             allowBlank : true,
414                             alwaysQuery : true,
415                             displayField : 'addr_country',
416                             editable : true,
417                             emptyText : "Select Country",
418                             fieldLabel : 'Country',
419                             forceSelection : true,
420                             hiddenName : 'addr_country',
421                             listWidth : 300,
422                             loadingText : "Searching...",
423                             minChars : 2,
424                             name : 'addr_country',
425                             pageSize : 20,
426                             qtip : "Select Country",
427                             queryParam : 'query[addr_country]',
428                             selectOnFocus : true,
429                             tpl : '<div class="x-grid-cell-text x-btn button"><b>{addr_country}</b> </div>',
430                             triggerAction : 'all',
431                             typeAhead : true,
432                             valueField : 'addr_country',
433                             width : 150,
434                             store : {
435                                 xtype: 'Store',
436                                 xns: Roo.data,
437                                 listeners : {
438                                     beforeload : function (_self, o){
439                                         o.params = o.params || {};
440                                         o.params._distinct = 'addr_country';
441                                         o.params._columns ='addr_country';
442                                     }
443                                 },
444                                 remoteSort : true,
445                                 sortInfo : { direction : 'ASC', field: 'addr_country' },
446                                 proxy : {
447                                     xtype: 'HttpProxy',
448                                     xns: Roo.data,
449                                     method : 'GET',
450                                     url : baseURL + '/Roo/Addr.php'
451                                 },
452                                 reader : {
453                                     xtype: 'JsonReader',
454                                     xns: Roo.data,
455                                     id : 'addr_id',
456                                     root : 'data',
457                                     totalProperty : 'total',
458                                     fields : [{"name":"addr_id","type":"int"},{"name":"addr_country","type":"string"}]
459                                 }
460                             }
461                         },
462                         {
463                             xtype: 'Button',
464                             xns: Roo.Toolbar,
465                             listeners : {
466                                 toggle : function (_self, pressed)
467                                 {
468                                     _this.grid.footer.onClick('first');
469                                 },
470                                 render : function (_self)
471                                 {
472                                     _this.activeBtn = _self;
473                                 }
474                             },
475                             enableToggle : true,
476                             pressed : false,
477                             text : "Show / Hide Inactive"
478                         },
479                         {
480                             xtype: 'TextItem',
481                             xns: Roo.Toolbar,
482                             text : "Has orders since"
483                         },
484                         {
485                             xtype: 'DateField',
486                             xns: Roo.form,
487                             listeners : {
488                                 render : function (_self)
489                                 {
490                                     _this.dateSearch = _self
491                                 },
492                                 select : function (combo, date)
493                                 {
494                                     _this.grid.footer.onClick('first');
495                                 },
496                                 specialkey : function (_self, e)
497                                 {
498                                    _this.grid.footer.onClick('first');
499                                 }
500                             },
501                             format : 'Y-m-d'
502                         },
503                         {
504                             xtype: 'TextItem',
505                             xns: Roo.Toolbar,
506                             text : "No orders since"
507                         },
508                         {
509                             xtype: 'DateField',
510                             xns: Roo.form,
511                             listeners : {
512                                 render : function (_self)
513                                 {
514                                     _this.dateSearchNo = _self
515                                 },
516                                 select : function (combo, date)
517                                 {
518                                    _this.grid.footer.onClick('first');
519                                 },
520                                 specialkey : function (_self, e)
521                                 {
522                                    _this.grid.footer.onClick('first');
523                                 }
524                             },
525                             format : 'Y-m-d'
526                         },
527                         {
528                             xtype: 'Fill',
529                             xns: Roo.Toolbar
530                         },
531                         {
532                             xtype: 'Button',
533                             xns: Roo.Toolbar,
534                             listeners : {
535                                 click : function()
536                                 {
537                                     if (!_this.dialog) return;
538                                     _this.dialog.show( { id : 0 } , function() {
539                                         _this.grid.footer.onClick('first');
540                                    }); 
541                                 }
542                             },
543                             cls : 'x-btn-text-icon',
544                             text : "Add",
545                             icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
546                         },
547                         {
548                             xtype: 'Button',
549                             xns: Roo.Toolbar,
550                             listeners : {
551                                 click : function()
552                                 {
553                                     var s = _this.grid.getSelectionModel().getSelections();
554                                     if (!s.length || (s.length > 1))  {
555                                         Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
556                                         return;
557                                     }
558                                     if (!_this.dialog) return;
559                                     _this.dialog.show(s[0].data, function() {
560                                         _this.grid.footer.onClick('first');
561                                     }); 
562                                     
563                                 }
564                             },
565                             cls : 'x-btn-text-icon',
566                             text : "Edit",
567                             icon : Roo.rootURL + 'images/default/tree/leaf.gif'
568                         }
569                     ]
570                 },
571                 colModel : [
572                     {
573                         xtype: 'ColumnModel',
574                         xns: Roo.grid,
575                         dataIndex : 'cust_active',
576                         header : 'Active',
577                         width : 50,
578                         renderer : function(v) { return String.format('{0}', v? 'Y' : 'N'); }
579                     },
580                     {
581                         xtype: 'ColumnModel',
582                         xns: Roo.grid,
583                         dataIndex : 'last_order',
584                         header : 'Last Order',
585                         width : 80,
586                         renderer : function(v) { 
587                             if (!v) { 
588                                 return '-none-';
589                             }
590                             var vv = Date.parseDate(v, 'Y-m-d');
591                             return String.format('{0}',  vv.format('d/M/Y') ); 
592                         }
593                     },
594                     {
595                         xtype: 'ColumnModel',
596                         xns: Roo.grid,
597                         dataIndex : 'cust_taxzone_id_taxzone_descrip',
598                         header : 'Tax Status',
599                         sortable : true,
600                         width : 100,
601                         renderer : function(v) { return String.format('{0}', v); }
602                     },
603                     {
604                         xtype: 'ColumnModel',
605                         xns: Roo.grid,
606                         dataIndex : 'cust_terms_id_terms_descrip',
607                         header : 'Terms',
608                         sortable : true,
609                         width : 100,
610                         renderer : function(v) { return String.format('{0}', v); }
611                     },
612                     {
613                         xtype: 'ColumnModel',
614                         xns: Roo.grid,
615                         dataIndex : 'cust_salesrep_id_salesrep_name',
616                         header : 'Sales Rep',
617                         sortable : true,
618                         width : 100,
619                         renderer : function(v) { return String.format('{0}', v); }
620                     },
621                     {
622                         xtype: 'ColumnModel',
623                         xns: Roo.grid,
624                         dataIndex : 'ipshead_id_name',
625                         header : 'Curr/Price List',
626                         sortable : true,
627                         width : 80,
628                         renderer : function(v,x,r) { 
629                             if (!v.length) {
630                                  return String.format('{0}<br/><span style="color:red">No price list</span>', 
631                                 r.data.cust_curr_id_curr_name  );
632                              }    
633                         
634                             return  String.format('{0}<br/>{1}', 
635                                 r.data.cust_curr_id_curr_name,
636                                v ); 
637                            }
638                     },
639                     {
640                         xtype: 'ColumnModel',
641                         xns: Roo.grid,
642                         dataIndex : 'cust_number',
643                         header : 'Ref No.',
644                         sortable : true,
645                         width : 80,
646                         renderer : function(v) { return String.format('{0}', v); }
647                     },
648                     {
649                         xtype: 'ColumnModel',
650                         xns: Roo.grid,
651                         dataIndex : 'cust_name',
652                         header : 'Name',
653                         sortable : true,
654                         width : 200,
655                         renderer : function(v,x,r) {
656                             if (!r.data.cust_char_internalcompany.length) {
657                                  return String.format('{0}', v); 
658                              }
659                             return String.format('<span style="color:red">[Internal company : {0}] {1}</span>',
660                                 r.data.cust_char_internalcompany,  v); 
661                          }
662                     },
663                     {
664                         xtype: 'ColumnModel',
665                         xns: Roo.grid,
666                         dataIndex : 'cust_bill_info',
667                         header : 'Billing Address',
668                         sortable : true,
669                         width : 200,
670                         renderer : function(v,x,r) 
671                         { 
672                             if(!v.length){
673                                 var add = [];\r
674                                 Roo.each([ 'line1', 'line2', 'line3', 'city', 'state', 'country'], function (k) {\r
675                                     if (!r.data['cntct_addr_' + k].length) {\r
676                                         return;\r
677                                     }\r
678                                     add.push(String.format("{0}", r.data['cntct_addr_' + k]));\r
679                                 \r
680                                 });
681                                 return add.join('<BR/>');
682                             }
683                             
684                             var v = v.split("\r\n").join("<br/>");
685                             return v; 
686                         }
687                     },
688                     {
689                         xtype: 'ColumnModel',
690                         xns: Roo.grid,
691                         dataIndex : 'cust_ship_info',
692                         header : 'Shipping Address',
693                         sortable : true,
694                         width : 200,
695                         renderer : function(v,x,r) 
696                         { 
697                             if(!v.length){
698                                 var add = [];\r
699                                 Roo.each([ 'line1', 'line2', 'line3', 'city', 'state', 'country'], function (k) {\r
700                                     if (!r.data['cntct_addr_' + k].length) {\r
701                                         return;\r
702                                     }\r
703                                     add.push(String.format("{0}", r.data['cntct_addr_' + k]));\r
704                                 \r
705                                 });
706                                 return add.join('<BR/>');
707                             }
708                             
709                             var v = v.split("\r\n").join("<br/>");
710                             return v; 
711                         }
712                     },
713                     {
714                         xtype: 'ColumnModel',
715                         xns: Roo.grid,
716                         dataIndex : 'cust_cntct_id_cntct_first_name',
717                         header : 'Contact',
718                         sortable : true,
719                         width : 150,
720                         renderer : function(v,x,r) 
721                         { 
722                             return String.format(
723                                 'Name: {0}<br/>' + 
724                                 'Phone: {1}<br/>' + 
725                                 'Email: <a href="mailto:{2}">{2}</a>',
726                             
727                                 r.data.cust_cntct_id_cntct_first_name,
728                                 r.data.cust_cntct_id_cntct_phone,
729                                 r.data.cust_cntct_id_cntct_email
730                             );
731                         }
732                     },
733                     {
734                         xtype: 'ColumnModel',
735                         xns: Roo.grid,
736                         dataIndex : 'cust_char_au_post_accno',
737                         header : 'AU Post#',
738                         hidden : true,
739                         sortable : true,
740                         width : 150,
741                         renderer : function(v,x,r) 
742                         { 
743                             return String.format('{0}', v);
744                         }
745                     },
746                     {
747                         xtype: 'ColumnModel',
748                         xns: Roo.grid,
749                         dataIndex : 'cust_cntct_id_cntct_phone',
750                         header : 'Contact Number',
751                         hidden : true,
752                         sortable : true,
753                         width : 150,
754                         renderer : function(v,x,r) 
755                         { 
756                             return String.format('{0}',v);
757                         }
758                     },
759                     {
760                         xtype: 'ColumnModel',
761                         xns: Roo.grid,
762                         dataIndex : 'cust_cntct_id_cntct_email',
763                         header : 'Email',
764                         hidden : true,
765                         sortable : true,
766                         width : 150,
767                         renderer : function(v,x,r) 
768                         { 
769                             return String.format('<a href="mailto:{0}">{0}</a>', v);
770                         }
771                     },
772                     {
773                         xtype: 'ColumnModel',
774                         xns: Roo.grid,
775                         align : 'right',
776                         dataIndex : 'cntct_addr_city',
777                         header : 'City',
778                         hidden : true,
779                         sortable : true,
780                         width : 75,
781                         renderer : function(v) { return String.format('{0}', v ? v : ''); }
782                     },
783                     {
784                         xtype: 'ColumnModel',
785                         xns: Roo.grid,
786                         align : 'right',
787                         dataIndex : 'cntct_addr_state',
788                         header : 'State',
789                         hidden : true,
790                         sortable : true,
791                         width : 75,
792                         renderer : function(v) { return String.format('{0}', v ? v : ''); }
793                     },
794                     {
795                         xtype: 'ColumnModel',
796                         xns: Roo.grid,
797                         align : 'right',
798                         dataIndex : 'cntct_addr_country',
799                         header : 'Country',
800                         sortable : true,
801                         width : 75,
802                         renderer : function(v) { return String.format('{0}', v ? v : ''); }
803                     },
804                     {
805                         xtype: 'ColumnModel',
806                         xns: Roo.grid,
807                         dataIndex : 'cust_curr_id_curr_name',
808                         header : 'Currency',
809                         sortable : true,
810                         width : 50,
811                         renderer : function(v) { return String.format('{0}', v); }
812                     },
813                     {
814                         xtype: 'ColumnModel',
815                         xns: Roo.grid,
816                         align : 'right',
817                         dataIndex : 'balance',
818                         header : 'Balance',
819                         width : 75,
820                         renderer : function(v,x,r) { 
821                         
822                              
823                             return String.format('{0}{1}', r.data.cust_curr_id_curr_symbol, Roo.util.Format.number(v,2)); 
824                         }
825                     }
826                 ]
827             }
828         };
829     }
830 });