2 "name" : "Pman.Tab.XtupleCustomer",
3 "parent" : "Pman.Tab.XtupleSales",
5 "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleCustomer.bjs",
11 "|activate" : "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}"
16 "title" : "Customers",
17 "xtype" : "GridPanel",
18 "fitContainer" : true,
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",
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}"
28 "autoExpandColumn" : "cust_name",
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\"}",
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}"
41 "$ sortInfo" : "{ field : 'cust_name', direction: 'ASC' }",
43 "* prop" : "dataSource",
46 "$ url" : "baseURL + '/Roo/custinfo.php'",
47 "xtype" : "HttpProxy",
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]",
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"
66 "xtype" : "PagingToolbar",
67 "emptyMsg" : "No custinfo found",
70 "displayMsg" : "Displaying custinfo{0} - {1} of {2}",
74 "text" : "Upload/Download",
76 "$ xns" : "Roo.Toolbar",
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}"
87 "text" : "Download Mailing list subscribers",
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}"
95 "text" : "Download Customers",
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}"
103 "text" : "Download Customers As Json",
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}"
111 "text" : "Upload Customers",
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}"
119 "text" : "Upload Customers Json File",
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}"
127 "text" : "Upload AU Post Accounts",
140 "* prop" : "toolbar",
143 "text" : "Search : ",
144 "xtype" : "TextItem",
145 "$ xns" : "Roo.Toolbar"
149 "specialkey" : "function (_self, e)\n{\n _this.grid.footer.onClick('first');\n}",
150 "render" : "function (_self)\n{\n _this.searchBox = _self;\n}"
152 "xtype" : "TextField",
157 "|click" : "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
160 "cls" : "x-btn-icon",
161 "$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
162 "$ xns" : "Roo.Toolbar"
166 "|click" : "function (_self, e)\n{\n _this.searchBox.setValue('');\n \n \n _this.grid.footer.onClick('first');\n}"
169 "cls" : "x-btn-icon",
170 "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
171 "$ xns" : "Roo.Toolbar"
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}"
179 "triggerAction" : "all",
180 "fieldLabel" : "Office",
181 "displayField" : "office",
182 "xtype" : "ComboBox",
183 "hiddenName" : "office",
184 "valueField" : "office",
188 "$ xns" : "Roo.form",
191 "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{office}</b> </div>",
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",
204 "render" : "function (_self)\n{\n _this.country = _self;\n}",
205 "select" : "function (combo, record, index)\n{\n _this.grid.footer.onClick('first');\n}"
207 "alwaysQuery" : true,
209 "triggerAction" : "all",
210 "fieldLabel" : "Country",
211 "forceSelection" : true,
212 "selectOnFocus" : true,
214 "displayField" : "addr_country",
215 "emptyText" : "Select Country",
216 "hiddenName" : "addr_country",
218 "valueField" : "addr_country",
219 "xtype" : "ComboBox",
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...",
233 "|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' }",
238 "$ xns" : "Roo.data",
242 "$ url" : "baseURL + '/Roo/Addr.php'",
243 "xtype" : "HttpProxy",
245 "$ xns" : "Roo.data",
251 "xtype" : "JsonReader",
252 "$ fields" : "[{\"name\":\"addr_id\",\"type\":\"int\"},{\"name\":\"addr_country\",\"type\":\"string\"}]",
253 "$ xns" : "Roo.data",
255 "totalProperty" : "total"
263 "toggle" : "function (_self, pressed)\n{\n _this.grid.footer.onClick('first');\n}",
264 "render" : "function (_self)\n{\n _this.activeBtn = _self;\n}"
266 "text" : "Show / Hide Inactive",
267 "enableToggle" : true,
270 "$ xns" : "Roo.Toolbar"
273 "text" : "Has orders since",
274 "xtype" : "TextItem",
275 "$ xns" : "Roo.Toolbar"
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}"
284 "xtype" : "DateField",
288 "text" : "No orders since",
289 "xtype" : "TextItem",
290 "$ xns" : "Roo.Toolbar"
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}"
299 "xtype" : "DateField",
304 "$ xns" : "Roo.Toolbar"
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"
312 "cls" : "x-btn-text-icon",
313 "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
314 "$ xns" : "Roo.Toolbar"
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"
322 "cls" : "x-btn-text-icon",
323 "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'",
324 "$ xns" : "Roo.Toolbar"
329 "xtype" : "ColumnModel",
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\"}"
339 "xtype" : "ColumnModel",
340 "header" : "Last Order",
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"
348 "xtype" : "ColumnModel",
350 "header" : "Tax Status",
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\"}"
359 "xtype" : "ColumnModel",
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\"}"
370 "xtype" : "ColumnModel",
372 "header" : "Sales Rep",
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\"}"
381 "xtype" : "ColumnModel",
383 "header" : "Curr/Price List",
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"
391 "xtype" : "ColumnModel",
393 "header" : "Ref No.",
395 "$ renderer" : "function(v) { return String.format('{0}', v); }",
396 "$ xns" : "Roo.grid",
397 "* prop" : "colModel[]",
398 "dataIndex" : "cust_number"
401 "xtype" : "ColumnModel",
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"
411 "xtype" : "ColumnModel",
413 "header" : "Billing Address",
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"
421 "xtype" : "ColumnModel",
423 "header" : "Shipping Address",
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"
431 "xtype" : "ColumnModel",
433 "header" : "Contact",
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"
442 "xtype" : "ColumnModel",
444 "header" : "AU Post#",
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"
453 "xtype" : "ColumnModel",
455 "header" : "Contact Number",
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"
464 "xtype" : "ColumnModel",
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"
476 "xtype" : "ColumnModel",
480 "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
481 "$ xns" : "Roo.grid",
482 "* prop" : "colModel[]",
483 "dataIndex" : "cntct_addr_city"
488 "xtype" : "ColumnModel",
492 "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
493 "$ xns" : "Roo.grid",
494 "* prop" : "colModel[]",
495 "dataIndex" : "cntct_addr_state"
499 "xtype" : "ColumnModel",
501 "header" : "Country",
503 "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
504 "$ xns" : "Roo.grid",
505 "* prop" : "colModel[]",
506 "dataIndex" : "cntct_addr_country"
509 "xtype" : "ColumnModel",
511 "header" : "Currency",
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\"}"
521 "xtype" : "ColumnModel",
522 "header" : "Balance",
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"