3 "name": "Pman.Tab.XtupleCustomer",
4 "parent": "Pman.Tab.XtupleSales",
6 "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleCustomer.bjs",
10 "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}"
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\"}",
17 "tableName": "custinfo",
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"
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",
36 "beforeload": "function (_self, o)\n{\n if (!_this.officeCombo) {\n return false;\n }\n \n o.params = o.params || {};\n o.params['search[cust_name]'] = _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}"
38 "*prop": "dataSource",
41 "|sortInfo": "{ field : 'cust_name', direction: 'ASC' }",
48 "|url": "baseURL + '/Roo/custinfo.php'",
53 "xtype": "JsonReader",
54 "totalProperty": "total",
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\"}",
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]"
65 "xtype": "PagingToolbar",
68 "displayMsg": "Displaying custinfo{0} - {1} of {2}",
69 "emptyMsg": "No custinfo found",
73 "text": "Upload/Download",
75 "|xns": "Roo.Toolbar",
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 _this.grid.ds.proxy.conn.method = 'POST';\n new Pman.Download({\n grid : _this.grid\n });\n \n}"
86 "text": "Download Mailing list subscribers",
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}"
94 "text": "Download Customers",
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}"
102 "text": "Download Customers As Json",
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}"
110 "text": "Upload Customers",
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}"
118 "text": "Upload Customers Json File",
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}"
126 "text": "Upload AU Post Accounts",
144 "|xns": "Roo.Toolbar"
148 "render": "function (_self)\n{\n _this.searchBox = _self;\n}",
149 "specialkey": "function (_self, e)\n{\n _this.grid.footer.onClick('first');\n}"
151 "xtype": "TextField",
156 "|click": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
160 "|icon": "rootURL + '/Pman/templates/images/search.gif'",
161 "|xns": "Roo.Toolbar"
165 "|click": "function (_self, e)\n{\n _this.searchBox.setValue('');\n \n \n _this.grid.footer.onClick('first');\n}"
169 "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
170 "|xns": "Roo.Toolbar"
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}"
179 "displayField": "office",
181 "fieldLabel": "Office",
182 "hiddenName": "office",
186 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{office}</b> </div>",
187 "triggerAction": "all",
188 "valueField": "office",
194 "xtype": "SimpleStore",
195 "|data": "[ \n [ ''] ,\n [ 'hk' ],\n [ 'sg' ],\n [ 'my' ],\n [ 'cn' ],\n [ 'au' ]\n]\n ",
196 "|fields": "['office']",
203 "render": "function (_self)\n{\n _this.country = _self;\n}",
204 "select": "function (combo, record, index)\n{\n _this.grid.footer.onClick('first');\n}"
208 "displayField": "addr_country",
210 "emptyText": "Select Country",
211 "fieldLabel": "Country",
212 "forceSelection": true,
213 "hiddenName": "addr_country",
215 "loadingText": "Searching...",
217 "name": "addr_country",
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",
225 "valueField": "addr_country",
232 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n o.params._distinct = 'addr_country';\n o.params._columns ='addr_country';\n}\n"
237 "|sortInfo": "{ direction : 'ASC', field: 'addr_country' }",
243 "xtype": "HttpProxy",
244 "|url": "baseURL + '/Roo/Addr.php'",
251 "totalProperty": "total",
252 "xtype": "JsonReader",
253 "|fields": "[{\"name\":\"addr_id\",\"type\":\"int\"},{\"name\":\"addr_country\",\"type\":\"string\"}]",
262 "toggle": "function (_self, pressed)\n{\n _this.grid.footer.onClick('first');\n}",
263 "render": "function (_self)\n{\n _this.activeBtn = _self;\n}"
265 "enableToggle": true,
267 "text": "Show / Hide Inactive",
269 "|xns": "Roo.Toolbar"
272 "text": "Has orders since",
274 "|xns": "Roo.Toolbar"
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}"
283 "xtype": "DateField",
287 "text": "No orders since",
289 "|xns": "Roo.Toolbar"
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}"
298 "xtype": "DateField",
303 "|xns": "Roo.Toolbar"
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"
309 "cls": "x-btn-text-icon",
312 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
313 "|xns": "Roo.Toolbar"
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"
319 "cls": "x-btn-text-icon",
322 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
323 "|xns": "Roo.Toolbar"
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",
333 "xtype": "ColumnModel",
334 "|renderer": "function(v) { return String.format('{0}', v? 'Y' : 'N'); }",
338 "*prop": "colModel[]",
339 "dataIndex": "last_order",
340 "header": "Last Order",
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}",
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",
353 "xtype": "ColumnModel",
354 "|renderer": "function(v) { return String.format('{0}', v); }",
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",
364 "xtype": "ColumnModel",
365 "|renderer": "function(v) { return String.format('{0}', v); }",
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",
375 "xtype": "ColumnModel",
376 "|renderer": "function(v) { return String.format('{0}', v); }",
380 "*prop": "colModel[]",
381 "dataIndex": "ipshead_id_name",
382 "header": "Curr/Price List",
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 }",
390 "*prop": "colModel[]",
391 "dataIndex": "cust_number",
395 "xtype": "ColumnModel",
396 "|renderer": "function(v) { return String.format('{0}', v); }",
400 "*prop": "colModel[]",
401 "dataIndex": "cust_name",
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 }",
410 "*prop": "colModel[]",
411 "dataIndex": "cust_bill_info",
412 "header": "Billing Address",
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}",
420 "*prop": "colModel[]",
421 "dataIndex": "cust_ship_info",
422 "header": "Shipping Address",
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}",
430 "*prop": "colModel[]",
431 "dataIndex": "cust_cntct_id_cntct_first_name",
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}",
440 "*prop": "colModel[]",
441 "dataIndex": "cust_char_au_post_accno",
442 "header": "AU Post#",
446 "xtype": "ColumnModel",
447 "|renderer": "function(v,x,r) \n{ \n return String.format('{0}', v);\n}",
451 "*prop": "colModel[]",
452 "dataIndex": "cust_cntct_id_cntct_phone",
453 "header": "Contact Number",
457 "xtype": "ColumnModel",
458 "|renderer": "function(v,x,r) \n{ \n return String.format('{0}',v);\n}",
462 "*prop": "colModel[]",
463 "dataIndex": "cust_cntct_id_cntct_email",
468 "xtype": "ColumnModel",
469 "|renderer": "function(v,x,r) \n{ \n return String.format('<a href=\"mailto:{0}\">{0}</a>', v);\n}",
473 "*prop": "colModel[]",
475 "dataIndex": "cntct_addr_city",
480 "xtype": "ColumnModel",
481 "|renderer": "function(v) { return String.format('{0}', v ? v : ''); }",
485 "*prop": "colModel[]",
487 "dataIndex": "cntct_addr_state",
492 "xtype": "ColumnModel",
493 "|renderer": "function(v) { return String.format('{0}', v ? v : ''); }",
497 "*prop": "colModel[]",
499 "dataIndex": "cntct_addr_country",
503 "xtype": "ColumnModel",
504 "|renderer": "function(v) { return String.format('{0}', v ? v : ''); }",
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",
514 "xtype": "ColumnModel",
515 "|renderer": "function(v) { return String.format('{0}', v); }",
519 "*prop": "colModel[]",
521 "dataIndex": "balance",
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}",