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