Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleCustomer.bjs
1 {
2     "name" : "Pman.Tab.XtupleCustomer",
3     "parent" : "Pman.Tab.XtupleSales",
4     "title" : "",
5     "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleCustomer.bjs",
6     "permname" : "",
7     "modOrder" : "700",
8     "items" : [
9         {
10             "listeners" : {
11                 "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
12             },
13             "fitToframe" : true,
14             "region" : "center",
15             "background" : true,
16             "title" : "Customers",
17             "xtype" : "GridPanel",
18             "fitContainer" : true,
19             "$ xns" : "Roo",
20             "# builderCfg" : "{\"cols\":[{\"table\":\"custinfo\",\"column\":\"cust_active\",\"columnshort\":\"cust_active\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Active\"},{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_descrip\",\"columnshort\":\"custtype_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Customer type\"},{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_name\",\"columnshort\":\"salesrep_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":0,\"title\":\"Sales Rep\"},{\"table\":\"custinfo\",\"column\":\"cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Name\"}],\"cols_ex\":[\"cust_name\"],\"table\":\"custinfo\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
21             "tableName" : "custinfo",
22             "items" : [
23                 {
24                     "listeners" : {
25                         "|rowdblclick" : "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('refresh');\n    }); \n}\n",
26                         "|render" : "function() \n{\n    _this.grid = this; \n    _this.dialog = Pman.Dialog.XtupleCustomer;\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
27                     },
28                     "autoExpandColumn" : "cust_name",
29                     "xtype" : "Grid",
30                     "loadMask" : true,
31                     "$ xns" : "Roo.grid",
32                     "* prop" : "grid",
33                     "# builderCfg" : "{\"cols\":[{\"table\":\"custinfo\",\"column\":\"cust_active\",\"columnshort\":\"cust_active\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Active\"},{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_descrip\",\"columnshort\":\"custtype_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Customer type\"},{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_name\",\"columnshort\":\"salesrep_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":0,\"title\":\"Sales Rep\"},{\"table\":\"custinfo\",\"column\":\"cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Name\"}],\"cols_ex\":[\"cust_name\"],\"table\":\"custinfo\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
34                     "items" : [
35                         {
36                             "listeners" : {
37                                 "beforeload" : "function (_self, o)\n{\n    if (!_this.officeCombo) {\n        return false;\n    }\n    \n    o.params = o.params || {};\n    o.params['search[_mix]'] = _this.searchBox.getValue();\n    if (!_this.activeBtn.pressed) {\n        o.params.cust_active = 1;\n        o.params.cust_aropen_active = 1;\n    } \n    var dt = _this.dateSearch.getValue(); \n    if (dt) {\n        o.params['search[orders_since]'] = dt.format('Y-m-d');\n    }\n    dt = _this.dateSearchNo.getValue(); \n    if (dt) {\n        o.params['search[no_orders_since]'] = dt.format('Y-m-d');\n    }\n    \n    o.params['search[with_orders_since]'] = 1; //\n    o.params['search[with_balance]'] = 1;\n    o.params['search[with_address]'] = 1;\n    o.params['_with_char'] = 1;    \n    o.params['_with_group_data'] = 1;\n    o.params['search[_country]'] = _this.country.getValue();\n    o.params._get = 1; // for download\n    \n    o.params['cust_char_internalcompany'] = _this.officeCombo.getValue();\n}"
38                             },
39                             "xtype" : "Store",
40                             "remoteSort" : true,
41                             "$ sortInfo" : "{ field : 'cust_name', direction: 'ASC' }",
42                             "$ xns" : "Roo.data",
43                             "* prop" : "dataSource",
44                             "items" : [
45                                 {
46                                     "$ url" : "baseURL + '/Roo/custinfo.php'",
47                                     "xtype" : "HttpProxy",
48                                     "method" : "GET",
49                                     "$ xns" : "Roo.data",
50                                     "* prop" : "proxy"
51                                 },
52                                 {
53                                     "id" : "id",
54                                     "root" : "data",
55                                     "xtype" : "JsonReader",
56                                     "$ fields" : "[\n    {\n        'name': 'cust_active',\n        'type': 'boolean'\n    },\n    {\n        'name': 'cust_custtype_id_custtype_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'cust_salesrep_id_salesrep_name',\n        'type': 'string'\n    },\n    {\n        'name': 'cust_name',\n        'type': 'string'\n    }\n]",
57                                     "$ xns" : "Roo.data",
58                                     "* prop" : "reader",
59                                     "# builderCfg" : "{\"cols\":[{\"table\":\"custinfo\",\"column\":\"cust_active\",\"columnshort\":\"cust_active\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Active\"},{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_descrip\",\"columnshort\":\"custtype_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Customer type\"},{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_name\",\"columnshort\":\"salesrep_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":0,\"title\":\"Sales Rep\"},{\"table\":\"custinfo\",\"column\":\"cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Name\"}],\"cols_ex\":[\"cust_name\"],\"table\":\"custinfo\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
60                                     "totalProperty" : "total"
61                                 }
62                             ]
63                         },
64                         {
65                             "pageSize" : 25,
66                             "xtype" : "PagingToolbar",
67                             "emptyMsg" : "No custinfo found",
68                             "$ xns" : "Roo",
69                             "displayInfo" : true,
70                             "displayMsg" : "Displaying custinfo{0} - {1} of {2}",
71                             "* prop" : "footer",
72                             "items" : [
73                                 {
74                                     "text" : "Upload/Download",
75                                     "xtype" : "Button",
76                                     "$ xns" : "Roo.Toolbar",
77                                     "items" : [
78                                         {
79                                             "xtype" : "Menu",
80                                             "$ xns" : "Roo.menu",
81                                             "* prop" : "menu",
82                                             "items" : [
83                                                 {
84                                                     "listeners" : {
85                                                         "click" : "function (_self, e)\n{\n    \n    if (!Pman.hasPerm('Xtuple.CustomerDownload','S')) {\n        Roo.MessageBox.alert(\"Error\", \"Permission Denied\");\n        return;\n    }\n   \n    var params = {\n        '_group' : 'customer',\n        '_name' : 'subscribers',\n        'limit' : 99999,\n        'csvTitles' : '*',\n        'csvCols' : '*'\n    };\n    \n    \n    new Pman.Download({\n      url : baseURL + '/Roo/Metasql',\n      params :   params,\n      method : 'GET'\n    });\n    \n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n    \n}"
86                                                     },
87                                                     "text" : "Download Mailing list subscribers",
88                                                     "xtype" : "Item",
89                                                     "$ xns" : "Roo.menu"
90                                                 },
91                                                 {
92                                                     "listeners" : {
93                                                         "click" : "function (_self, e)\n{\n    \n    if (!Pman.hasPerm('Xtuple.CustomerDownload','S')) {\n        Roo.MessageBox.alert(\"Error\", \"Permission Denied\");\n        return;\n    }\n    _this.grid.ds.proxy.conn.method = 'POST';\n    new Pman.Download({\n        grid : _this.grid\n    });\n    \n}"
94                                                     },
95                                                     "text" : "Download Customers",
96                                                     "xtype" : "Item",
97                                                     "$ xns" : "Roo.menu"
98                                                 },
99                                                 {
100                                                     "listeners" : {
101                                                         "click" : "function (_self, e)\n{\n    \n    if (!Pman.hasPerm('Admin.Admin_Tab','S')) {\n        Roo.MessageBox.alert(\"Error\", \"Permission Denied\");\n        return;\n    }\n    \n    var c = _this.country.getValue();\n    if(!c.length){\n        Roo.MessageBox.alert(\"Error\", \"Please select a country\");\n        return;\n    }\n    \n    new Pman.Download({\n        url : baseURL + '/Roo/custinfo',\n        method : 'GET',\n        params : {\n            _my_json : 1,\n            limit : 9999,\n            'search[_country]' : c,\n            'search[with_address]' : 1\n        }\n        \n    });\n}"
102                                                     },
103                                                     "text" : "Download Customers As Json",
104                                                     "xtype" : "Item",
105                                                     "$ xns" : "Roo.menu"
106                                                 },
107                                                 {
108                                                     "listeners" : {
109                                                         "click" : "function (_self, e)\n{\n    \n    if (!Pman.hasPerm('Admin.Admin_Tab','S')) {\n        Roo.MessageBox.alert(\"Error\", \"Permission Denied\");\n        return;\n    }\n   \n   Pman.Dialog.Image.show(\n       {\n            _url : baseURL+'/Xtuple/Import/Customers' \n        \n       },\n       function (data) {\n            _this.grid.footer.onClick('first');\n            Roo.MessageBox.alert(\"Notice\", \"DONE\");\n//            Roo.MessageBox.alert(\"Notice\", msg.join(\"\\n\"));\n\n       }\n   );\n    \n}"
110                                                     },
111                                                     "text" : "Upload Customers",
112                                                     "xtype" : "Item",
113                                                     "$ xns" : "Roo.menu"
114                                                 },
115                                                 {
116                                                     "listeners" : {
117                                                         "click" : "function (_self, e)\n{\n    \n    if (!Pman.hasPerm('Admin.Admin_Tab','S')) {\n        Roo.MessageBox.alert(\"Error\", \"Permission Denied\");\n        return;\n    }\n   \n   Pman.Dialog.Image.show(\n       {\n            _url : baseURL+'/Xtuple/Import/MyCustomers' \n        \n       },\n       function (data) {\n            _this.grid.footer.onClick('first');\n            Roo.MessageBox.alert(\"Notice\", \"DONE\");\n//            Roo.MessageBox.alert(\"Notice\", msg.join(\"\\n\"));\n\n       }\n   );\n    \n}"
118                                                     },
119                                                     "text" : "Upload Customers Json File",
120                                                     "xtype" : "Item",
121                                                     "$ xns" : "Roo.menu"
122                                                 },
123                                                 {
124                                                     "listeners" : {
125                                                         "click" : "function (_self, e)\n{\n    \n    if (!Pman.hasPerm('Admin.Admin_Tab','S')) {\n        Roo.MessageBox.alert(\"Error\", \"Permission Denied\");\n        return;\n    }\n   \n   Pman.Dialog.Image.show(\n       {\n            _url : baseURL+'/Xtuple/Import/AUPostAccounts' \n        \n       },\n       function (data) {\n            _this.grid.footer.onClick('first');\n            Roo.MessageBox.alert(\"Notice\", data);\n\n       }\n   );\n    \n}"
126                                                     },
127                                                     "text" : "Upload AU Post Accounts",
128                                                     "xtype" : "Item",
129                                                     "$ xns" : "Roo.menu"
130                                                 }
131                                             ]
132                                         }
133                                     ]
134                                 }
135                             ]
136                         },
137                         {
138                             "xtype" : "Toolbar",
139                             "$ xns" : "Roo",
140                             "* prop" : "toolbar",
141                             "items" : [
142                                 {
143                                     "text" : "Search : ",
144                                     "xtype" : "TextItem",
145                                     "$ xns" : "Roo.Toolbar"
146                                 },
147                                 {
148                                     "listeners" : {
149                                         "specialkey" : "function (_self, e)\n{\n    _this.grid.footer.onClick('first');\n}",
150                                         "render" : "function (_self)\n{\n    _this.searchBox = _self;\n}"
151                                     },
152                                     "xtype" : "TextField",
153                                     "$ xns" : "Roo.form"
154                                 },
155                                 {
156                                     "listeners" : {
157                                         "|click" : "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
158                                     },
159                                     "xtype" : "Button",
160                                     "cls" : "x-btn-icon",
161                                     "$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
162                                     "$ xns" : "Roo.Toolbar"
163                                 },
164                                 {
165                                     "listeners" : {
166                                         "|click" : "function (_self, e)\n{\n    _this.searchBox.setValue('');\n    \n    \n    _this.grid.footer.onClick('first');\n}"
167                                     },
168                                     "xtype" : "Button",
169                                     "cls" : "x-btn-icon",
170                                     "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
171                                     "$ xns" : "Roo.Toolbar"
172                                 },
173                                 {
174                                     "listeners" : {
175                                         "render" : "function (_self)\n{\n  _this.officeCombo  = _self;\n}",
176                                         "select" : "function (combo, record, index)\n{\n\n    _this.grid.footer.onClick('first');\n}"
177                                     },
178                                     "listWidth" : 200,
179                                     "triggerAction" : "all",
180                                     "fieldLabel" : "Office",
181                                     "displayField" : "office",
182                                     "xtype" : "ComboBox",
183                                     "hiddenName" : "office",
184                                     "valueField" : "office",
185                                     "allowBlank" : true,
186                                     "editable" : false,
187                                     "width" : 75,
188                                     "$ xns" : "Roo.form",
189                                     "mode" : "local",
190                                     "name" : "office",
191                                     "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{office}</b> </div>",
192                                     "items" : [
193                                         {
194                                             "xtype" : "SimpleStore",
195                                             "$ data" : "[ \n    [ ''] ,\n    [ 'hk' ],\n    [ 'sg' ],\n    [ 'my' ],\n    [ 'cn' ],\n    [ 'au' ]\n]\n        ",
196                                             "$ fields" : "['office']",
197                                             "$ xns" : "Roo.data",
198                                             "* prop" : "store"
199                                         }
200                                     ]
201                                 },
202                                 {
203                                     "listeners" : {
204                                         "render" : "function (_self)\n{\n    _this.country = _self;\n}",
205                                         "select" : "function (combo, record, index)\n{\n    _this.grid.footer.onClick('first');\n}"
206                                     },
207                                     "alwaysQuery" : true,
208                                     "listWidth" : 300,
209                                     "triggerAction" : "all",
210                                     "fieldLabel" : "Country",
211                                     "forceSelection" : true,
212                                     "selectOnFocus" : true,
213                                     "pageSize" : 20,
214                                     "displayField" : "addr_country",
215                                     "emptyText" : "Select Country",
216                                     "hiddenName" : "addr_country",
217                                     "minChars" : 2,
218                                     "valueField" : "addr_country",
219                                     "xtype" : "ComboBox",
220                                     "allowBlank" : true,
221                                     "typeAhead" : true,
222                                     "editable" : true,
223                                     "width" : 150,
224                                     "$ xns" : "Roo.form",
225                                     "name" : "addr_country",
226                                     "qtip" : "Select Country",
227                                     "queryParam" : "query[addr_country]",
228                                     "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{addr_country}</b> </div>",
229                                     "loadingText" : "Searching...",
230                                     "items" : [
231                                         {
232                                             "listeners" : {
233                                                 "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    o.params._distinct = 'addr_country';\n    o.params._columns ='addr_country';\n}\n"
234                                             },
235                                             "xtype" : "Store",
236                                             "remoteSort" : true,
237                                             "$ sortInfo" : "{ direction : 'ASC', field: 'addr_country' }",
238                                             "$ xns" : "Roo.data",
239                                             "* prop" : "store",
240                                             "items" : [
241                                                 {
242                                                     "$ url" : "baseURL + '/Roo/Addr.php'",
243                                                     "xtype" : "HttpProxy",
244                                                     "method" : "GET",
245                                                     "$ xns" : "Roo.data",
246                                                     "* prop" : "proxy"
247                                                 },
248                                                 {
249                                                     "id" : "addr_id",
250                                                     "root" : "data",
251                                                     "xtype" : "JsonReader",
252                                                     "$ fields" : "[{\"name\":\"addr_id\",\"type\":\"int\"},{\"name\":\"addr_country\",\"type\":\"string\"}]",
253                                                     "$ xns" : "Roo.data",
254                                                     "* prop" : "reader",
255                                                     "totalProperty" : "total"
256                                                 }
257                                             ]
258                                         }
259                                     ]
260                                 },
261                                 {
262                                     "listeners" : {
263                                         "toggle" : "function (_self, pressed)\n{\n    _this.grid.footer.onClick('first');\n}",
264                                         "render" : "function (_self)\n{\n    _this.activeBtn = _self;\n}"
265                                     },
266                                     "text" : "Show / Hide Inactive",
267                                     "enableToggle" : true,
268                                     "pressed" : false,
269                                     "xtype" : "Button",
270                                     "$ xns" : "Roo.Toolbar"
271                                 },
272                                 {
273                                     "text" : "Has orders since",
274                                     "xtype" : "TextItem",
275                                     "$ xns" : "Roo.Toolbar"
276                                 },
277                                 {
278                                     "listeners" : {
279                                         "specialkey" : "function (_self, e)\n{\n   _this.grid.footer.onClick('first');\n}",
280                                         "render" : "function (_self)\n{\n    _this.dateSearch = _self\n}",
281                                         "select" : "function (combo, date)\n{\n    _this.grid.footer.onClick('first');\n}"
282                                     },
283                                     "format" : "Y-m-d",
284                                     "xtype" : "DateField",
285                                     "$ xns" : "Roo.form"
286                                 },
287                                 {
288                                     "text" : "No orders since",
289                                     "xtype" : "TextItem",
290                                     "$ xns" : "Roo.Toolbar"
291                                 },
292                                 {
293                                     "listeners" : {
294                                         "specialkey" : "function (_self, e)\n{\n   _this.grid.footer.onClick('first');\n}",
295                                         "render" : "function (_self)\n{\n    _this.dateSearchNo = _self\n}",
296                                         "select" : "function (combo, date)\n{\n   _this.grid.footer.onClick('first');\n}"
297                                     },
298                                     "format" : "Y-m-d",
299                                     "xtype" : "DateField",
300                                     "$ xns" : "Roo.form"
301                                 },
302                                 {
303                                     "xtype" : "Fill",
304                                     "$ xns" : "Roo.Toolbar"
305                                 },
306                                 {
307                                     "listeners" : {
308                                         "|click" : "function()\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
309                                     },
310                                     "text" : "Add",
311                                     "xtype" : "Button",
312                                     "cls" : "x-btn-text-icon",
313                                     "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
314                                     "$ xns" : "Roo.Toolbar"
315                                 },
316                                 {
317                                     "listeners" : {
318                                         "|click" : "function()\n{\n    var s = _this.grid.getSelectionModel().getSelections();\n    if (!s.length || (s.length > 1))  {\n        Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n        return;\n    }\n    if (!_this.dialog) return;\n    _this.dialog.show(s[0].data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n    \n}\n"
319                                     },
320                                     "text" : "Edit",
321                                     "xtype" : "Button",
322                                     "cls" : "x-btn-text-icon",
323                                     "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'",
324                                     "$ xns" : "Roo.Toolbar"
325                                 }
326                             ]
327                         },
328                         {
329                             "xtype" : "ColumnModel",
330                             "header" : "Active",
331                             "width" : 50,
332                             "$ renderer" : "function(v) { return String.format('{0}', v? 'Y' : 'N'); }",
333                             "$ xns" : "Roo.grid",
334                             "* prop" : "colModel[]",
335                             "dataIndex" : "cust_active",
336                             "# builderCfg" : "{\"table\":\"custinfo\",\"column\":\"cust_active\",\"columnshort\":\"cust_active\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Active\"}"
337                         },
338                         {
339                             "xtype" : "ColumnModel",
340                             "header" : "Last Order",
341                             "width" : 80,
342                             "$ renderer" : "function(v) { \n    if (!v) { \n        return '-none-';\n    }\n    var vv = Date.parseDate(v, 'Y-m-d');\n    return String.format('{0}',  vv.format('d/M/Y') ); \n}",
343                             "$ xns" : "Roo.grid",
344                             "* prop" : "colModel[]",
345                             "dataIndex" : "last_order"
346                         },
347                         {
348                             "xtype" : "ColumnModel",
349                             "sortable" : true,
350                             "header" : "Tax Status",
351                             "width" : 100,
352                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
353                             "$ xns" : "Roo.grid",
354                             "* prop" : "colModel[]",
355                             "dataIndex" : "cust_taxzone_id_taxzone_descrip",
356                             "# builderCfg" : "{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_descrip\",\"columnshort\":\"custtype_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Customer type\"}"
357                         },
358                         {
359                             "xtype" : "ColumnModel",
360                             "sortable" : true,
361                             "header" : "Terms",
362                             "width" : 100,
363                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
364                             "$ xns" : "Roo.grid",
365                             "* prop" : "colModel[]",
366                             "dataIndex" : "cust_terms_id_terms_descrip",
367                             "# builderCfg" : "{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_descrip\",\"columnshort\":\"custtype_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Customer type\"}"
368                         },
369                         {
370                             "xtype" : "ColumnModel",
371                             "sortable" : true,
372                             "header" : "Sales Rep",
373                             "width" : 100,
374                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
375                             "$ xns" : "Roo.grid",
376                             "* prop" : "colModel[]",
377                             "dataIndex" : "cust_salesrep_id_salesrep_name",
378                             "# builderCfg" : "{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_name\",\"columnshort\":\"salesrep_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":0,\"title\":\"Sales Rep\"}"
379                         },
380                         {
381                             "xtype" : "ColumnModel",
382                             "sortable" : true,
383                             "header" : "Curr/Price List",
384                             "width" : 80,
385                             "$ renderer" : "function(v,x,r) { \n    if (!v.length) {\n         return String.format('{0}<br/><span style=\"color:red\">No price list</span>', \n        r.data.cust_curr_id_curr_name  );\n     }    \n\n    return  String.format('{0}<br/>{1}', \n        r.data.cust_curr_id_curr_name,\n       v ); \n   }",
386                             "$ xns" : "Roo.grid",
387                             "* prop" : "colModel[]",
388                             "dataIndex" : "ipshead_id_name"
389                         },
390                         {
391                             "xtype" : "ColumnModel",
392                             "sortable" : true,
393                             "header" : "Ref No.",
394                             "width" : 80,
395                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
396                             "$ xns" : "Roo.grid",
397                             "* prop" : "colModel[]",
398                             "dataIndex" : "cust_number"
399                         },
400                         {
401                             "xtype" : "ColumnModel",
402                             "sortable" : true,
403                             "header" : "Name",
404                             "width" : 200,
405                             "$ renderer" : "function(v,x,r) {\n    if (!r.data.cust_char_internalcompany.length) {\n         return String.format('{0}', v); \n     }\n    return String.format('<span style=\"color:red\">[Internal company : {0}] {1}</span>',\n        r.data.cust_char_internalcompany,  v); \n }",
406                             "$ xns" : "Roo.grid",
407                             "* prop" : "colModel[]",
408                             "dataIndex" : "cust_name"
409                         },
410                         {
411                             "xtype" : "ColumnModel",
412                             "sortable" : true,
413                             "header" : "Billing Address",
414                             "width" : 200,
415                             "$ renderer" : "function(v,x,r) \n{ \n    if(!v.length){\n        var add = [];\r\n        Roo.each([ 'line1', 'line2', 'line3', 'city', 'state', 'country'], function (k) {\r\n            if (!r.data['cntct_addr_' + k].length) {\r\n                return;\r\n            }\r\n            add.push(String.format(\"{0}\", r.data['cntct_addr_' + k]));\r\n        \r\n        });\n        return add.join('<BR/>');\n    }\n    \n    var v = v.split(\"\\r\\n\").join(\"<br/>\");\n    return v; \n}",
416                             "$ xns" : "Roo.grid",
417                             "* prop" : "colModel[]",
418                             "dataIndex" : "cust_bill_info"
419                         },
420                         {
421                             "xtype" : "ColumnModel",
422                             "sortable" : true,
423                             "header" : "Shipping Address",
424                             "width" : 200,
425                             "$ renderer" : "function(v,x,r) \n{ \n    if(!v.length){\n        var add = [];\r\n        Roo.each([ 'line1', 'line2', 'line3', 'city', 'state', 'country'], function (k) {\r\n            if (!r.data['cntct_addr_' + k].length) {\r\n                return;\r\n            }\r\n            add.push(String.format(\"{0}\", r.data['cntct_addr_' + k]));\r\n        \r\n        });\n        return add.join('<BR/>');\n    }\n    \n    var v = v.split(\"\\r\\n\").join(\"<br/>\");\n    return v; \n}",
426                             "$ xns" : "Roo.grid",
427                             "* prop" : "colModel[]",
428                             "dataIndex" : "cust_ship_info"
429                         },
430                         {
431                             "xtype" : "ColumnModel",
432                             "sortable" : true,
433                             "header" : "Contact",
434                             "width" : 150,
435                             "$ renderer" : "function(v,x,r) \n{ \n    return String.format(\n        'Name: {0}<br/>' + \n        'Phone: {1}<br/>' + \n        'Email: <a href=\"mailto:{2}\">{2}</a>',\n    \n        r.data.cust_cntct_id_cntct_first_name,\n        r.data.cust_cntct_id_cntct_phone,\n        r.data.cust_cntct_id_cntct_email\n    );\n}",
436                             "$ xns" : "Roo.grid",
437                             "* prop" : "colModel[]",
438                             "dataIndex" : "cust_cntct_id_cntct_first_name"
439                         },
440                         {
441                             "hidden" : true,
442                             "xtype" : "ColumnModel",
443                             "sortable" : true,
444                             "header" : "AU Post#",
445                             "width" : 150,
446                             "$ renderer" : "function(v,x,r) \n{ \n    return String.format('{0}', v);\n}",
447                             "$ xns" : "Roo.grid",
448                             "* prop" : "colModel[]",
449                             "dataIndex" : "cust_char_au_post_accno"
450                         },
451                         {
452                             "hidden" : true,
453                             "xtype" : "ColumnModel",
454                             "sortable" : true,
455                             "header" : "Contact Number",
456                             "width" : 150,
457                             "$ renderer" : "function(v,x,r) \n{ \n    return String.format('{0}',v);\n}",
458                             "$ xns" : "Roo.grid",
459                             "* prop" : "colModel[]",
460                             "dataIndex" : "cust_cntct_id_cntct_phone"
461                         },
462                         {
463                             "hidden" : true,
464                             "xtype" : "ColumnModel",
465                             "sortable" : true,
466                             "header" : "Email",
467                             "width" : 150,
468                             "$ renderer" : "function(v,x,r) \n{ \n    return String.format('<a href=\"mailto:{0}\">{0}</a>', v);\n}",
469                             "$ xns" : "Roo.grid",
470                             "* prop" : "colModel[]",
471                             "dataIndex" : "cust_cntct_id_cntct_email"
472                         },
473                         {
474                             "align" : "right",
475                             "hidden" : true,
476                             "xtype" : "ColumnModel",
477                             "sortable" : true,
478                             "header" : "City",
479                             "width" : 75,
480                             "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
481                             "$ xns" : "Roo.grid",
482                             "* prop" : "colModel[]",
483                             "dataIndex" : "cntct_addr_city"
484                         },
485                         {
486                             "align" : "right",
487                             "hidden" : true,
488                             "xtype" : "ColumnModel",
489                             "sortable" : true,
490                             "header" : "State",
491                             "width" : 75,
492                             "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
493                             "$ xns" : "Roo.grid",
494                             "* prop" : "colModel[]",
495                             "dataIndex" : "cntct_addr_state"
496                         },
497                         {
498                             "align" : "right",
499                             "xtype" : "ColumnModel",
500                             "sortable" : true,
501                             "header" : "Country",
502                             "width" : 75,
503                             "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
504                             "$ xns" : "Roo.grid",
505                             "* prop" : "colModel[]",
506                             "dataIndex" : "cntct_addr_country"
507                         },
508                         {
509                             "xtype" : "ColumnModel",
510                             "sortable" : true,
511                             "header" : "Currency",
512                             "width" : 50,
513                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
514                             "$ xns" : "Roo.grid",
515                             "* prop" : "colModel[]",
516                             "dataIndex" : "cust_curr_id_curr_name",
517                             "# builderCfg" : "{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_descrip\",\"columnshort\":\"custtype_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Customer type\"}"
518                         },
519                         {
520                             "align" : "right",
521                             "xtype" : "ColumnModel",
522                             "header" : "Balance",
523                             "width" : 75,
524                             "$ renderer" : "function(v,x,r) { \n\n     \n    return String.format('{0}{1}', r.data.cust_curr_id_curr_symbol, Roo.util.Format.number(v,2)); \n}",
525                             "$ xns" : "Roo.grid",
526                             "* prop" : "colModel[]",
527                             "dataIndex" : "balance"
528                         }
529                     ]
530                 }
531             ]
532         }
533     ]
534 }