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