Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleCustomer.bjs
1 {
2     "name" : "Pman.Dialog.XtupleCustomer",
3     "parent" : "Pman",
4     "title" : "",
5     "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleCustomer.bjs",
6     "permname" : "",
7     "modOrder" : "001",
8     "items" : [
9         {
10             "modal" : true,
11             "collapsible" : false,
12             "title" : "Customer Information",
13             "xtype" : "LayoutDialog",
14             "width" : 900,
15             "$ xns" : "Roo",
16             "closable" : false,
17             "resizable" : true,
18             "height" : 670,
19             "# builderCfg" : "{\"cols\":[{\"table\":\"custinfo\",\"column\":\"cust_custtype_id\",\"columnshort\":\"cust_custtype_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"custtype_id\",\"deps\":[{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_code\",\"columnshort\":\"custtype_code\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_descrip\",\"columnshort\":\"custtype_descrip\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_char\",\"columnshort\":\"custtype_char\",\"ctype\":\"bool\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Customer Type\",\"display\":\"cust_custtype_id_custtype_descrip\"},{\"table\":\"custinfo\",\"column\":\"cust_salesrep_id\",\"columnshort\":\"cust_salesrep_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"salesrep_id\",\"deps\":[{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_active\",\"columnshort\":\"salesrep_active\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_number\",\"columnshort\":\"salesrep_number\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_name\",\"columnshort\":\"salesrep_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_commission\",\"columnshort\":\"salesrep_commission\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_method\",\"columnshort\":\"salesrep_method\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_emp_id\",\"columnshort\":\"salesrep_emp_id\",\"ctype\":\"int4\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Sales Rep\",\"display\":\"cust_salesrep_id_salesrep_name\"},{\"table\":\"custinfo\",\"column\":\"cust_commprcnt\",\"columnshort\":\"cust_commprcnt\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"cust_commprcnt\"},{\"table\":\"custinfo\",\"column\":\"cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Name\"},{\"table\":\"custinfo\",\"column\":\"cust_creditlmt\",\"columnshort\":\"cust_creditlmt\",\"ctype\":\"int4\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Credit Limit\",\"display\":\"cust_creditlmt_curr_id_curr_symbol\"},{\"table\":\"custinfo\",\"column\":\"cust_creditrating\",\"columnshort\":\"cust_creditrating\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Credit Rating\"},{\"table\":\"custinfo\",\"column\":\"cust_financecharge\",\"columnshort\":\"cust_financecharge\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Apply Finance Charge\"},{\"table\":\"custinfo\",\"column\":\"cust_backorder\",\"columnshort\":\"cust_backorder\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Allow Back Order\"},{\"table\":\"custinfo\",\"column\":\"cust_partialship\",\"columnshort\":\"cust_partialship\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Allow Partial Shipment\"},{\"table\":\"custinfo\",\"column\":\"cust_terms_id\",\"columnshort\":\"cust_terms_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"terms_id\",\"deps\":[{\"table\":\"terms\",\"column\":\"cust_terms_id_terms_code\",\"columnshort\":\"terms_code\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cust_terms_id_terms_descrip\",\"columnshort\":\"terms_descrip\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cust_terms_id_terms_type\",\"columnshort\":\"terms_type\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cust_terms_id_terms_duedays\",\"columnshort\":\"terms_duedays\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cust_terms_id_terms_discdays\",\"columnshort\":\"terms_discdays\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cust_terms_id_terms_discprcnt\",\"columnshort\":\"terms_discprcnt\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cust_terms_id_terms_cutoffday\",\"columnshort\":\"terms_cutoffday\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cust_terms_id_terms_ap\",\"columnshort\":\"terms_ap\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cust_terms_id_terms_ar\",\"columnshort\":\"terms_ar\",\"ctype\":\"bool\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Terms\",\"display\":\"cust_terms_id_terms_descrip\"},{\"table\":\"custinfo\",\"column\":\"cust_discntprcnt\",\"columnshort\":\"cust_discntprcnt\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Discount Percent\"},{\"table\":\"custinfo\",\"column\":\"cust_balmethod\",\"columnshort\":\"cust_balmethod\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Balance Method\"},{\"table\":\"custinfo\",\"column\":\"cust_ffshipto\",\"columnshort\":\"cust_ffshipto\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"is ff Ship To\"},{\"table\":\"custinfo\",\"column\":\"cust_shipform_id\",\"columnshort\":\"cust_shipform_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"shipform_id\",\"deps\":[{\"table\":\"shipform\",\"column\":\"cust_shipform_id_shipform_name\",\"columnshort\":\"shipform_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"shipform\",\"column\":\"cust_shipform_id_shipform_report_id\",\"columnshort\":\"shipform_report_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"shipform\",\"column\":\"cust_shipform_id_shipform_report_name\",\"columnshort\":\"shipform_report_name\",\"ctype\":\"text\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Shipment Form\",\"display\":\"cust_shipform_id_shipform_name\"},{\"table\":\"custinfo\",\"column\":\"cust_shipvia\",\"columnshort\":\"cust_shipvia\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ship Via\"},{\"table\":\"custinfo\",\"column\":\"cust_creditstatus\",\"columnshort\":\"cust_creditstatus\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Credit Status\"},{\"table\":\"custinfo\",\"column\":\"cust_comments\",\"columnshort\":\"cust_comments\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Comments\"},{\"table\":\"custinfo\",\"column\":\"cust_ffbillto\",\"columnshort\":\"cust_ffbillto\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"is ff Bill To\"},{\"table\":\"custinfo\",\"column\":\"cust_number\",\"columnshort\":\"cust_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Customer #\"},{\"table\":\"custinfo\",\"column\":\"cust_dateadded\",\"columnshort\":\"cust_dateadded\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Added\"},{\"table\":\"custinfo\",\"column\":\"cust_curr_id\",\"columnshort\":\"cust_curr_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"curr_id\",\"deps\":[{\"table\":\"curr_symbol\",\"column\":\"cust_curr_id_curr_base\",\"columnshort\":\"curr_base\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"curr_symbol\",\"column\":\"cust_curr_id_curr_name\",\"columnshort\":\"curr_name\",\"ctype\":\"varchar\",\"desc\":\"\"},{\"table\":\"curr_symbol\",\"column\":\"cust_curr_id_curr_symbol\",\"columnshort\":\"curr_symbol\",\"ctype\":\"varchar\",\"desc\":\"\"},{\"table\":\"curr_symbol\",\"column\":\"cust_curr_id_curr_abbr\",\"columnshort\":\"curr_abbr\",\"ctype\":\"varchar\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Currency\",\"display\":\"cust_curr_id_curr_symbol\"},{\"table\":\"custinfo\",\"column\":\"cust_creditlmt_curr_id\",\"columnshort\":\"cust_creditlmt_curr_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"curr_id\",\"deps\":[{\"table\":\"curr_symbol\",\"column\":\"cust_creditlmt_curr_id_curr_base\",\"columnshort\":\"curr_base\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"curr_symbol\",\"column\":\"cust_creditlmt_curr_id_curr_name\",\"columnshort\":\"curr_name\",\"ctype\":\"varchar\",\"desc\":\"\"},{\"table\":\"curr_symbol\",\"column\":\"cust_creditlmt_curr_id_curr_symbol\",\"columnshort\":\"curr_symbol\",\"ctype\":\"varchar\",\"desc\":\"\"},{\"table\":\"curr_symbol\",\"column\":\"cust_creditlmt_curr_id_curr_abbr\",\"columnshort\":\"curr_abbr\",\"ctype\":\"varchar\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Credit Limit Currency\",\"display\":\"cust_creditlmt_curr_id_curr_symbol\"},{\"table\":\"custinfo\",\"column\":\"cust_cntct_id\",\"columnshort\":\"cust_cntct_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"cntct_id\",\"deps\":[{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_crmacct_id\",\"columnshort\":\"cntct_crmacct_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_addr_id\",\"columnshort\":\"cntct_addr_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_first_name\",\"columnshort\":\"cntct_first_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_last_name\",\"columnshort\":\"cntct_last_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_honorific\",\"columnshort\":\"cntct_honorific\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_initials\",\"columnshort\":\"cntct_initials\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_active\",\"columnshort\":\"cntct_active\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_phone\",\"columnshort\":\"cntct_phone\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_phone2\",\"columnshort\":\"cntct_phone2\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_fax\",\"columnshort\":\"cntct_fax\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_email\",\"columnshort\":\"cntct_email\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_webaddr\",\"columnshort\":\"cntct_webaddr\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_notes\",\"columnshort\":\"cntct_notes\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_title\",\"columnshort\":\"cntct_title\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_number\",\"columnshort\":\"cntct_number\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_middle\",\"columnshort\":\"cntct_middle\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_suffix\",\"columnshort\":\"cntct_suffix\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_owner_username\",\"columnshort\":\"cntct_owner_username\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_name\",\"columnshort\":\"cntct_name\",\"ctype\":\"text\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Contact\",\"display\":\"cust_cntct_id_cntct_name\"},{\"table\":\"custinfo\",\"column\":\"cust_corrcntct_id\",\"columnshort\":\"cust_corrcntct_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"cntct_id\",\"deps\":[{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_crmacct_id\",\"columnshort\":\"cntct_crmacct_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_addr_id\",\"columnshort\":\"cntct_addr_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_first_name\",\"columnshort\":\"cntct_first_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_last_name\",\"columnshort\":\"cntct_last_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_honorific\",\"columnshort\":\"cntct_honorific\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_initials\",\"columnshort\":\"cntct_initials\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_active\",\"columnshort\":\"cntct_active\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_phone\",\"columnshort\":\"cntct_phone\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_phone2\",\"columnshort\":\"cntct_phone2\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_fax\",\"columnshort\":\"cntct_fax\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_email\",\"columnshort\":\"cntct_email\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_webaddr\",\"columnshort\":\"cntct_webaddr\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_notes\",\"columnshort\":\"cntct_notes\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_title\",\"columnshort\":\"cntct_title\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_number\",\"columnshort\":\"cntct_number\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_middle\",\"columnshort\":\"cntct_middle\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_suffix\",\"columnshort\":\"cntct_suffix\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_owner_username\",\"columnshort\":\"cntct_owner_username\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_name\",\"columnshort\":\"cntct_name\",\"ctype\":\"text\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Corr? Contact\",\"display\":\"cust_corrcntct_id_cntct_name\"},{\"table\":\"custinfo\",\"column\":\"cust_taxzone_id\",\"columnshort\":\"cust_taxzone_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"taxzone_id\",\"deps\":[{\"table\":\"taxzone\",\"column\":\"cust_taxzone_id_taxzone_code\",\"columnshort\":\"taxzone_code\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"taxzone\",\"column\":\"cust_taxzone_id_taxzone_descrip\",\"columnshort\":\"taxzone_descrip\",\"ctype\":\"text\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Tax Zone\",\"display\":\"cust_taxzone_id_taxzone_descrip\"}],\"cols_ex\":[\"cust_custtype_id_custtype_descrip\",\"cust_salesrep_id_salesrep_name\",\"cust_terms_id_terms_descrip\",\"cust_shipform_id_shipform_name\",\"cust_curr_id_curr_symbol\",\"cust_creditlmt_curr_id_curr_symbol\",\"cust_cntct_id_cntct_name\",\"cust_corrcntct_id_cntct_name\",\"cust_taxzone_id_taxzone_descrip\"],\"table\":\"custinfo\",\"xtype\":\"LayoutDialog\",\"|xns\":\"Roo\"}",
20             "items" : [
21                 {
22                     "alwaysShowTabs" : true,
23                     "xtype" : "LayoutRegion",
24                     "$ xns" : "Roo",
25                     "tabPosition" : "top",
26                     "* prop" : "center",
27                     "items" : [
28                         {
29                             "xtype" : "Toolbar",
30                             "$ xns" : "Roo",
31                             "* prop" : "toolbar",
32                             "items" : [
33                                 {
34                                     "xtype" : "Fill",
35                                     "$ xns" : "Roo.Toolbar"
36                                 },
37                                 {
38                                     "listeners" : {
39                                         "click" : "function (_self, e)\n{\n    var cid = _this.form.findField('cust_id').getValue();\n    if(!cid){\n        Roo.Msg.alert('Error','please save the customer first');\n        return;\n    }\n    \n    Pman.Dialog.XtupleCustomerCode.show({cust_id : cid}, function(res){\n        _this.form.reset();\n       _this.form.fireEvent('actioncomplete', _this.form,  { type: 'setdata', data: {cust_id : res.cust_id} });\n    \n    });\n    \n}"
40                                     },
41                                     "text" : "Change Customer Code",
42                                     "xtype" : "Button",
43                                     "$ xns" : "Roo.Toolbar"
44                                 }
45                             ]
46                         }
47                     ]
48                 },
49                 {
50                     "background" : false,
51                     "region" : "center",
52                     "title" : "Details",
53                     "xtype" : "NestedLayoutPanel",
54                     "$ xns" : "Roo",
55                     "items" : [
56                         {
57                             "xtype" : "BorderLayout",
58                             "$ xns" : "Roo",
59                             "* prop" : "layout",
60                             "items" : [
61                                 {
62                                     "xtype" : "LayoutRegion",
63                                     "$ xns" : "Roo",
64                                     "* prop" : "center"
65                                 },
66                                 {
67                                     "xtype" : "LayoutRegion",
68                                     "width" : 300,
69                                     "$ xns" : "Roo",
70                                     "* prop" : "east"
71                                 },
72                                 {
73                                     "region" : "center",
74                                     "xtype" : "ContentPanel",
75                                     "$ xns" : "Roo",
76                                     "items" : [
77                                         {
78                                             "listeners" : {
79                                                 "|actioncomplete" : "function(_self,action)\n{\n    if (action.type == 'setdata') {\n    \n        _this.dialog.layout.getRegion('center').showPanel(0);\n    \n        if (_this.data.cust_id) {\n           this.load({ method: 'GET', params: { '_id' : _this.data.cust_id, '_with_char' : true }});\n           return;\n       } \n       this.findField('cust_active').setValue(true);\n      _this.grid.ds.load({});\n      _this.dialog.setTitle(\"New Customer\");\n\n      \n      \n       return;\n    }\n    if (action.type == 'load') {\n    \n          _this.dialog.setTitle(\"Edit Customer (\" + _this.data.cust_id +\") \" + _this.form.findField('cust_name').getValue() );\n    \n        _this.grid.ds.load({});\n        \n        \n        return;\n    }\n    if (action.type =='submit') {\n        \n        \n        if (_this.data.cust_id > 0 ) {\n            \n            \n            _this.dialog.hide();\n        \n             if (_this.callback) {\n                _this.callback.call(_this, _this.form.getValues());\n             }\n             _this.form.reset();\n             return;\n         }\n         // carry on editing.. and set data..\n\n         _this.data.cust_id = action.result.data.cust_id;\n         _this.form.fireEvent('actioncomplete', \n                _this.form,  { type: 'setdata', data: _this.data });\n         \n         \n    }\n}\n",
80                                                 "|rendered" : "function (form)\n{\n    _this.form= form;\n}\n"
81                                             },
82                                             "$ url" : "baseURL + '/Roo/custinfo.php'",
83                                             "xtype" : "Form",
84                                             "method" : "POST",
85                                             "style" : "margin:10px;",
86                                             "$ xns" : "Roo.form",
87                                             "items" : [
88                                                 {
89                                                     "xtype" : "FieldSet",
90                                                     "legend" : "Basic Details",
91                                                     "style" : "width:460px",
92                                                     "$ xns" : "Roo.form",
93                                                     "items" : [
94                                                         {
95                                                             "fieldLabel" : "Login Email",
96                                                             "vtype" : "email",
97                                                             "xtype" : "TextField",
98                                                             "allowBlank" : false,
99                                                             "width" : 300,
100                                                             "$ xns" : "Roo.form",
101                                                             "name" : "cust_login_email"
102                                                         },
103                                                         {
104                                                             "listeners" : {
105                                                                 "keyup" : "function (_self, e)\n{\n    if (!(_this.form.findField('cust_id').getValue() * 1)) {\n    \n        _this.form.findField('cust_number').setValue(this.getValue().replace(/[^a-z0-9]/ig, '').toUpperCase());\n    \n    }\n}"
106                                                             },
107                                                             "fieldLabel" : "Name",
108                                                             "xtype" : "TextField",
109                                                             "allowBlank" : false,
110                                                             "width" : 300,
111                                                             "$ xns" : "Roo.form",
112                                                             "name" : "cust_name"
113                                                         },
114                                                         {
115                                                             "xtype" : "Row",
116                                                             "$ xns" : "Roo.form",
117                                                             "items" : [
118                                                                 {
119                                                                     "fieldLabel" : "Customer #",
120                                                                     "xtype" : "TextField",
121                                                                     "allowBlank" : false,
122                                                                     "readOnly" : true,
123                                                                     "width" : 150,
124                                                                     "$ xns" : "Roo.form",
125                                                                     "name" : "cust_number"
126                                                                 },
127                                                                 {
128                                                                     "listWidth" : 250,
129                                                                     "triggerAction" : "all",
130                                                                     "fieldLabel" : "BG Company",
131                                                                     "forceSelection" : true,
132                                                                     "selectOnFocus" : true,
133                                                                     "pageSize" : 20,
134                                                                     "displayField" : "charopt_value",
135                                                                     "emptyText" : "",
136                                                                     "hiddenName" : "cust_char_internalcompany",
137                                                                     "minChars" : 2,
138                                                                     "valueField" : "charopt_value",
139                                                                     "xtype" : "ComboBox",
140                                                                     "allowBlank" : true,
141                                                                     "typeAhead" : true,
142                                                                     "editable" : false,
143                                                                     "width" : 70,
144                                                                     "$ xns" : "Roo.form",
145                                                                     "name" : "cust_char_internalcompany",
146                                                                     "qtip" : "Select charopt",
147                                                                     "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{charopt_value}</b> </div>",
148                                                                     "loadingText" : "Searching...",
149                                                                     "items" : [
150                                                                         {
151                                                                             "listeners" : {
152                                                                                 "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    o.params.charopt_char_id_char_name = 'INTERNALCOMPANY';\n    o.params['!charopt_value'] = baseURL.split('/').pop().split('.').shift();\n    \n}\n"
153                                                                             },
154                                                                             "xtype" : "Store",
155                                                                             "remoteSort" : true,
156                                                                             "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
157                                                                             "$ xns" : "Roo.data",
158                                                                             "* prop" : "store",
159                                                                             "items" : [
160                                                                                 {
161                                                                                     "$ url" : "baseURL + '/Roo/charopt.php'",
162                                                                                     "method" : "GET",
163                                                                                     "xtype" : "HttpProxy",
164                                                                                     "$ xns" : "Roo.data",
165                                                                                     "* prop" : "proxy"
166                                                                                 },
167                                                                                 {
168                                                                                     "id" : "id",
169                                                                                     "root" : "data",
170                                                                                     "xtype" : "JsonReader",
171                                                                                     "$ xns" : "Roo.data",
172                                                                                     "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"charopt_value\",\"type\":\"string\"}]",
173                                                                                     "* prop" : "reader",
174                                                                                     "totalProperty" : "total"
175                                                                                 }
176                                                                             ]
177                                                                         }
178                                                                     ]
179                                                                 }
180                                                             ]
181                                                         },
182                                                         {
183                                                             "xtype" : "Row",
184                                                             "$ xns" : "Roo.form",
185                                                             "width" : 500,
186                                                             "items" : [
187                                                                 {
188                                                                     "fieldLabel" : "Active",
189                                                                     "$ inputValue" : true,
190                                                                     "xtype" : "Checkbox",
191                                                                     "valueOff" : 0,
192                                                                     "width" : 100,
193                                                                     "$ xns" : "Roo.form",
194                                                                     "name" : "cust_active"
195                                                                 },
196                                                                 {
197                                                                     "labelAlign" : "right",
198                                                                     "xtype" : "Row",
199                                                                     "labelWidth" : 50,
200                                                                     "$ xns" : "Roo.form",
201                                                                     "items" : [
202                                                                         {
203                                                                             "listWidth" : 400,
204                                                                             "triggerAction" : "all",
205                                                                             "fieldLabel" : "Type",
206                                                                             "forceSelection" : true,
207                                                                             "selectOnFocus" : true,
208                                                                             "pageSize" : 20,
209                                                                             "displayField" : "custtype_descrip",
210                                                                             "emptyText" : "Select Type",
211                                                                             "hiddenName" : "cust_custtype_id",
212                                                                             "minChars" : 2,
213                                                                             "valueField" : "custtype_id",
214                                                                             "xtype" : "ComboBox",
215                                                                             "allowBlank" : false,
216                                                                             "typeAhead" : true,
217                                                                             "editable" : false,
218                                                                             "width" : 160,
219                                                                             "$ xns" : "Roo.form",
220                                                                             "name" : "cust_custtype_id_custtype_descrip",
221                                                                             "qtip" : "Select custtype",
222                                                                             "queryParam" : "q[cust_descript]",
223                                                                             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{custtype_code}</b> {custtype_descrip}</div>",
224                                                                             "loadingText" : "Searching...",
225                                                                             "items" : [
226                                                                                 {
227                                                                                     "listeners" : {
228                                                                                         "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
229                                                                                     },
230                                                                                     "xtype" : "Store",
231                                                                                     "remoteSort" : true,
232                                                                                     "$ xns" : "Roo.data",
233                                                                                     "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
234                                                                                     "* prop" : "store",
235                                                                                     "items" : [
236                                                                                         {
237                                                                                             "$ url" : "baseURL + '/Roo/custtype.php'",
238                                                                                             "method" : "GET",
239                                                                                             "xtype" : "HttpProxy",
240                                                                                             "$ xns" : "Roo.data",
241                                                                                             "* prop" : "proxy"
242                                                                                         },
243                                                                                         {
244                                                                                             "id" : "id",
245                                                                                             "root" : "data",
246                                                                                             "xtype" : "JsonReader",
247                                                                                             "$ xns" : "Roo.data",
248                                                                                             "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"custtype_code\",\"type\":\"string\"}]",
249                                                                                             "* prop" : "reader",
250                                                                                             "totalProperty" : "total"
251                                                                                         }
252                                                                                     ]
253                                                                                 }
254                                                                             ]
255                                                                         }
256                                                                     ]
257                                                                 }
258                                                             ]
259                                                         },
260                                                         {
261                                                             "fieldLabel" : "AU POST #",
262                                                             "xtype" : "TextField",
263                                                             "width" : 150,
264                                                             "$ xns" : "Roo.form",
265                                                             "name" : "cust_char_au_post_accno"
266                                                         },
267                                                         {
268                                                             "listWidth" : 250,
269                                                             "triggerAction" : "all",
270                                                             "fieldLabel" : "Forecast Type",
271                                                             "forceSelection" : true,
272                                                             "selectOnFocus" : true,
273                                                             "pageSize" : 20,
274                                                             "displayField" : "charopt_value",
275                                                             "emptyText" : "",
276                                                             "hiddenName" : "cust_char_salesforecast",
277                                                             "minChars" : 2,
278                                                             "valueField" : "charopt_value",
279                                                             "xtype" : "ComboBox",
280                                                             "allowBlank" : true,
281                                                             "typeAhead" : true,
282                                                             "editable" : false,
283                                                             "width" : 150,
284                                                             "$ xns" : "Roo.form",
285                                                             "name" : "cust_char_salesforecast",
286                                                             "qtip" : "Select charopt",
287                                                             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{charopt_value}</b> </div>",
288                                                             "loadingText" : "Searching...",
289                                                             "items" : [
290                                                                 {
291                                                                     "listeners" : {
292                                                                         "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    o.params.charopt_char_id_char_name = 'SALESFORECAST';\n    \n}\n"
293                                                                     },
294                                                                     "xtype" : "Store",
295                                                                     "remoteSort" : true,
296                                                                     "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
297                                                                     "$ xns" : "Roo.data",
298                                                                     "* prop" : "store",
299                                                                     "items" : [
300                                                                         {
301                                                                             "$ url" : "baseURL + '/Roo/charopt.php'",
302                                                                             "method" : "GET",
303                                                                             "xtype" : "HttpProxy",
304                                                                             "$ xns" : "Roo.data",
305                                                                             "* prop" : "proxy"
306                                                                         },
307                                                                         {
308                                                                             "id" : "id",
309                                                                             "root" : "data",
310                                                                             "xtype" : "JsonReader",
311                                                                             "$ xns" : "Roo.data",
312                                                                             "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"charopt_value\",\"type\":\"string\"}]",
313                                                                             "* prop" : "reader",
314                                                                             "totalProperty" : "total"
315                                                                         }
316                                                                     ]
317                                                                 }
318                                                             ]
319                                                         },
320                                                         {
321                                                             "fieldLabel" : "Comments",
322                                                             "xtype" : "TextArea",
323                                                             "width" : 300,
324                                                             "$ xns" : "Roo.form",
325                                                             "name" : "cust_comments",
326                                                             "height" : 50
327                                                         },
328                                                         {
329                                                             "listWidth" : 400,
330                                                             "triggerAction" : "all",
331                                                             "fieldLabel" : "Currency",
332                                                             "forceSelection" : true,
333                                                             "selectOnFocus" : true,
334                                                             "pageSize" : 20,
335                                                             "displayField" : "curr_symbol",
336                                                             "emptyText" : "Select curr_symbol",
337                                                             "hiddenName" : "cust_curr_id",
338                                                             "minChars" : 2,
339                                                             "valueField" : "curr_id",
340                                                             "xtype" : "ComboBox",
341                                                             "allowBlank" : false,
342                                                             "typeAhead" : true,
343                                                             "editable" : false,
344                                                             "width" : 100,
345                                                             "$ xns" : "Roo.form",
346                                                             "name" : "cust_curr_id_curr_symbol",
347                                                             "qtip" : "Select curr_symbol",
348                                                             "queryParam" : "query[curr_symbol]",
349                                                             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{curr_symbol}</b> </div>",
350                                                             "loadingText" : "Searching...",
351                                                             "items" : [
352                                                                 {
353                                                                     "listeners" : {
354                                                                         "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
355                                                                     },
356                                                                     "xtype" : "Store",
357                                                                     "remoteSort" : true,
358                                                                     "$ sortInfo" : "{ direction : 'ASC', field: 'curr_symbol' }",
359                                                                     "$ xns" : "Roo.data",
360                                                                     "* prop" : "store",
361                                                                     "items" : [
362                                                                         {
363                                                                             "$ url" : "baseURL + '/Roo/curr_symbol.php'",
364                                                                             "method" : "GET",
365                                                                             "xtype" : "HttpProxy",
366                                                                             "$ xns" : "Roo.data",
367                                                                             "* prop" : "proxy"
368                                                                         },
369                                                                         {
370                                                                             "id" : "curr_id",
371                                                                             "root" : "data",
372                                                                             "xtype" : "JsonReader",
373                                                                             "$ xns" : "Roo.data",
374                                                                             "$ fields" : "[{\"name\":\"curr_id\",\"type\":\"int\"},\"curr_symbol\"]",
375                                                                             "* prop" : "reader",
376                                                                             "totalProperty" : "total"
377                                                                         }
378                                                                     ]
379                                                                 }
380                                                             ]
381                                                         },
382                                                         {
383                                                             "listWidth" : 400,
384                                                             "triggerAction" : "all",
385                                                             "forceSelection" : true,
386                                                             "selectOnFocus" : true,
387                                                             "fieldLabel" : "Tax Zone",
388                                                             "pageSize" : 20,
389                                                             "xtype" : "ComboBox",
390                                                             "emptyText" : "Select taxzone",
391                                                             "minChars" : 2,
392                                                             "valueField" : "taxzone_id",
393                                                             "displayField" : "taxzone_descrip",
394                                                             "hiddenName" : "cust_taxzone_id",
395                                                             "allowBlank" : false,
396                                                             "typeAhead" : true,
397                                                             "editable" : false,
398                                                             "$ xns" : "Roo.form",
399                                                             "width" : 300,
400                                                             "qtip" : "Select taxzone",
401                                                             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{taxzone_descrip}</b> </div>",
402                                                             "queryParam" : "query[taxzone_descrip]",
403                                                             "name" : "cust_taxzone_id_taxzone_descrip",
404                                                             "loadingText" : "Searching...",
405                                                             "items" : [
406                                                                 {
407                                                                     "listeners" : {
408                                                                         "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
409                                                                     },
410                                                                     "xtype" : "Store",
411                                                                     "remoteSort" : true,
412                                                                     "$ sortInfo" : "{ direction : 'ASC', field: 'taxzone_descrip' }",
413                                                                     "$ xns" : "Roo.data",
414                                                                     "* prop" : "store",
415                                                                     "items" : [
416                                                                         {
417                                                                             "$ url" : "baseURL + '/Roo/taxzone.php'",
418                                                                             "method" : "GET",
419                                                                             "xtype" : "HttpProxy",
420                                                                             "$ xns" : "Roo.data",
421                                                                             "* prop" : "proxy"
422                                                                         },
423                                                                         {
424                                                                             "id" : "taxzone_id",
425                                                                             "root" : "data",
426                                                                             "xtype" : "JsonReader",
427                                                                             "$ xns" : "Roo.data",
428                                                                             "$ fields" : "[{\"name\":\"taxzone_id\",\"type\":\"int\"},\"taxzone_descrip\"]",
429                                                                             "* prop" : "reader",
430                                                                             "totalProperty" : "total"
431                                                                         }
432                                                                     ]
433                                                                 }
434                                                             ]
435                                                         },
436                                                         {
437                                                             "listWidth" : 400,
438                                                             "triggerAction" : "all",
439                                                             "forceSelection" : true,
440                                                             "selectOnFocus" : true,
441                                                             "fieldLabel" : "Sales Rep",
442                                                             "pageSize" : 20,
443                                                             "xtype" : "ComboBox",
444                                                             "emptyText" : "Select salesrep",
445                                                             "minChars" : 2,
446                                                             "valueField" : "salesrep_id",
447                                                             "displayField" : "salesrep_name",
448                                                             "hiddenName" : "cust_salesrep_id",
449                                                             "allowBlank" : false,
450                                                             "typeAhead" : true,
451                                                             "editable" : false,
452                                                             "$ xns" : "Roo.form",
453                                                             "width" : 300,
454                                                             "qtip" : "Select salesrep",
455                                                             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{salesrep_name}</b> </div>",
456                                                             "queryParam" : "query[salesrep_name]",
457                                                             "name" : "cust_salesrep_id_salesrep_name",
458                                                             "loadingText" : "Searching...",
459                                                             "items" : [
460                                                                 {
461                                                                     "listeners" : {
462                                                                         "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
463                                                                     },
464                                                                     "xtype" : "Store",
465                                                                     "remoteSort" : true,
466                                                                     "$ sortInfo" : "{ direction : 'ASC', field: 'salesrep_name' }",
467                                                                     "$ xns" : "Roo.data",
468                                                                     "* prop" : "store",
469                                                                     "items" : [
470                                                                         {
471                                                                             "$ url" : "baseURL + '/Roo/salesrep.php'",
472                                                                             "method" : "GET",
473                                                                             "xtype" : "HttpProxy",
474                                                                             "$ xns" : "Roo.data",
475                                                                             "* prop" : "proxy"
476                                                                         },
477                                                                         {
478                                                                             "id" : "salesrep_id",
479                                                                             "root" : "data",
480                                                                             "xtype" : "JsonReader",
481                                                                             "$ xns" : "Roo.data",
482                                                                             "$ fields" : "[{\"name\":\"salesrep_id\",\"type\":\"int\"},\"salesrep_name\"]",
483                                                                             "* prop" : "reader",
484                                                                             "totalProperty" : "total"
485                                                                         }
486                                                                     ]
487                                                                 }
488                                                             ]
489                                                         },
490                                                         {
491                                                             "alwaysQuery" : true,
492                                                             "listWidth" : 400,
493                                                             "triggerAction" : "all",
494                                                             "fieldLabel" : "Price Level",
495                                                             "forceSelection" : true,
496                                                             "selectOnFocus" : true,
497                                                             "pageSize" : 50,
498                                                             "displayField" : "ipshead_name",
499                                                             "emptyText" : "Select price level",
500                                                             "hiddenName" : "ipshead_id",
501                                                             "minChars" : 2,
502                                                             "valueField" : "ipshead_id",
503                                                             "xtype" : "ComboBox",
504                                                             "allowBlank" : true,
505                                                             "typeAhead" : true,
506                                                             "editable" : false,
507                                                             "width" : 300,
508                                                             "$ xns" : "Roo.form",
509                                                             "name" : "ipshead_id_name",
510                                                             "qtip" : "Select ipshead",
511                                                             "queryParam" : "q",
512                                                             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{ipshead_name}</b> </div>",
513                                                             "loadingText" : "Searching...",
514                                                             "items" : [
515                                                                 {
516                                                                     "listeners" : {
517                                                                         "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    o.params.ipshead_curr_id = _this.form.findField('cust_curr_id').getValue();\n    // set more here\n}\n"
518                                                                     },
519                                                                     "xtype" : "Store",
520                                                                     "remoteSort" : true,
521                                                                     "$ sortInfo" : "{ direction : 'ASC', field: 'ipshead_id_name' }",
522                                                                     "$ xns" : "Roo.data",
523                                                                     "* prop" : "store",
524                                                                     "items" : [
525                                                                         {
526                                                                             "$ url" : "baseURL + '/Roo/ipshead.php'",
527                                                                             "method" : "GET",
528                                                                             "xtype" : "HttpProxy",
529                                                                             "$ xns" : "Roo.data",
530                                                                             "* prop" : "proxy"
531                                                                         },
532                                                                         {
533                                                                             "id" : "id",
534                                                                             "root" : "data",
535                                                                             "xtype" : "JsonReader",
536                                                                             "$ xns" : "Roo.data",
537                                                                             "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"ipshead_name\",\"type\":\"string\"}]",
538                                                                             "* prop" : "reader",
539                                                                             "totalProperty" : "total"
540                                                                         }
541                                                                     ]
542                                                                 }
543                                                             ]
544                                                         }
545                                                     ]
546                                                 },
547                                                 {
548                                                     "xtype" : "FieldSet",
549                                                     "legend" : "Financial",
550                                                     "style" : "width:420px",
551                                                     "$ xns" : "Roo.form",
552                                                     "items" : [
553                                                         {
554                                                             "listWidth" : 400,
555                                                             "triggerAction" : "all",
556                                                             "forceSelection" : true,
557                                                             "selectOnFocus" : true,
558                                                             "fieldLabel" : "Terms",
559                                                             "pageSize" : 20,
560                                                             "xtype" : "ComboBox",
561                                                             "emptyText" : "Select terms",
562                                                             "minChars" : 2,
563                                                             "valueField" : "terms_id",
564                                                             "displayField" : "terms_descrip",
565                                                             "hiddenName" : "cust_terms_id",
566                                                             "allowBlank" : false,
567                                                             "typeAhead" : true,
568                                                             "editable" : false,
569                                                             "$ xns" : "Roo.form",
570                                                             "width" : 300,
571                                                             "qtip" : "Select terms",
572                                                             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{terms_descrip}</b> </div>",
573                                                             "queryParam" : "query[terms_descrip]",
574                                                             "name" : "cust_terms_id_terms_descrip",
575                                                             "loadingText" : "Searching...",
576                                                             "items" : [
577                                                                 {
578                                                                     "listeners" : {
579                                                                         "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
580                                                                     },
581                                                                     "xtype" : "Store",
582                                                                     "remoteSort" : true,
583                                                                     "$ sortInfo" : "{ direction : 'ASC', field: 'terms_descrip' }",
584                                                                     "$ xns" : "Roo.data",
585                                                                     "* prop" : "store",
586                                                                     "items" : [
587                                                                         {
588                                                                             "$ url" : "baseURL + '/Roo/terms.php'",
589                                                                             "method" : "GET",
590                                                                             "xtype" : "HttpProxy",
591                                                                             "$ xns" : "Roo.data",
592                                                                             "* prop" : "proxy"
593                                                                         },
594                                                                         {
595                                                                             "id" : "terms_id",
596                                                                             "root" : "data",
597                                                                             "xtype" : "JsonReader",
598                                                                             "$ xns" : "Roo.data",
599                                                                             "$ fields" : "[{\"name\":\"terms_id\",\"type\":\"int\"},\"terms_descrip\"]",
600                                                                             "* prop" : "reader",
601                                                                             "totalProperty" : "total"
602                                                                         }
603                                                                     ]
604                                                                 }
605                                                             ]
606                                                         },
607                                                         {
608                                                             "fieldLabel" : "Credit Limit",
609                                                             "align" : "right",
610                                                             "xtype" : "NumberField",
611                                                             "$ xns" : "Roo.form",
612                                                             "width" : 100,
613                                                             "name" : "cust_creditlmt"
614                                                         }
615                                                     ]
616                                                 },
617                                                 {
618                                                     "xtype" : "FieldSet",
619                                                     "legend" : "Shipping",
620                                                     "style" : "width:420px",
621                                                     "$ xns" : "Roo.form",
622                                                     "items" : [
623                                                         {
624                                                             "listWidth" : 400,
625                                                             "triggerAction" : "all",
626                                                             "forceSelection" : true,
627                                                             "selectOnFocus" : true,
628                                                             "fieldLabel" : "Shipment Form",
629                                                             "pageSize" : 20,
630                                                             "xtype" : "ComboBox",
631                                                             "emptyText" : "Select shipform",
632                                                             "minChars" : 2,
633                                                             "valueField" : "shipform_id",
634                                                             "displayField" : "shipform_name",
635                                                             "hiddenName" : "cust_shipform_id",
636                                                             "allowBlank" : false,
637                                                             "typeAhead" : true,
638                                                             "editable" : false,
639                                                             "$ xns" : "Roo.form",
640                                                             "width" : 300,
641                                                             "qtip" : "Select shipform",
642                                                             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{shipform_name}</b> </div>",
643                                                             "queryParam" : "query[shipform_name]",
644                                                             "name" : "cust_shipform_id_shipform_name",
645                                                             "loadingText" : "Searching...",
646                                                             "items" : [
647                                                                 {
648                                                                     "listeners" : {
649                                                                         "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
650                                                                     },
651                                                                     "xtype" : "Store",
652                                                                     "remoteSort" : true,
653                                                                     "$ sortInfo" : "{ direction : 'ASC', field: 'shipform_name' }",
654                                                                     "$ xns" : "Roo.data",
655                                                                     "* prop" : "store",
656                                                                     "items" : [
657                                                                         {
658                                                                             "$ url" : "baseURL + '/Roo/shipform.php'",
659                                                                             "method" : "GET",
660                                                                             "xtype" : "HttpProxy",
661                                                                             "$ xns" : "Roo.data",
662                                                                             "* prop" : "proxy"
663                                                                         },
664                                                                         {
665                                                                             "id" : "shipform_id",
666                                                                             "root" : "data",
667                                                                             "xtype" : "JsonReader",
668                                                                             "$ xns" : "Roo.data",
669                                                                             "$ fields" : "[{\"name\":\"shipform_id\",\"type\":\"int\"},\"shipform_name\"]",
670                                                                             "* prop" : "reader",
671                                                                             "totalProperty" : "total"
672                                                                         }
673                                                                     ]
674                                                                 }
675                                                             ]
676                                                         },
677                                                         {
678                                                             "fieldLabel" : "Ship Via",
679                                                             "xtype" : "TextField",
680                                                             "$ xns" : "Roo.form",
681                                                             "width" : 300,
682                                                             "name" : "cust_shipvia"
683                                                         }
684                                                     ]
685                                                 },
686                                                 {
687                                                     "xtype" : "FieldSet",
688                                                     "legend" : "Reference",
689                                                     "style" : "width:420px",
690                                                     "$ xns" : "Roo.form",
691                                                     "items" : [
692                                                         {
693                                                             "fieldLabel" : "Date Added",
694                                                             "format" : "Y-m-d",
695                                                             "xtype" : "TextField",
696                                                             "readOnly" : true,
697                                                             "width" : 100,
698                                                             "$ xns" : "Roo.form",
699                                                             "name" : "cust_dateadded"
700                                                         }
701                                                     ]
702                                                 },
703                                                 {
704                                                     "xtype" : "Hidden",
705                                                     "$ xns" : "Roo.form",
706                                                     "name" : "cust_cntct_id"
707                                                 },
708                                                 {
709                                                     "xtype" : "Hidden",
710                                                     "$ xns" : "Roo.form",
711                                                     "name" : "cust_creditlmt_curr_id"
712                                                 },
713                                                 {
714                                                     "$ update" : "function() {\n     var ship = [];\n    _this.grid.ds.each(function(r) {\n        if (r.data.is_ship * 1) {\n            ship.push(r.data.cntct_id);\n        }\n    });\n    this.setValue(ship.join(','));\n}\n",
715                                                     "xtype" : "Hidden",
716                                                     "$ xns" : "Roo.form",
717                                                     "name" : "shiplist"
718                                                 },
719                                                 {
720                                                     "xtype" : "Hidden",
721                                                     "$ xns" : "Roo.form",
722                                                     "name" : "cust_id"
723                                                 }
724                                             ]
725                                         }
726                                     ]
727                                 },
728                                 {
729                                     "listeners" : {
730                                         "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.ds.load({});\n    }\n}"
731                                     },
732                                     "background" : false,
733                                     "fitToframe" : true,
734                                     "region" : "east",
735                                     "title" : "cntct",
736                                     "xtype" : "GridPanel",
737                                     "fitContainer" : true,
738                                     "$ xns" : "Roo",
739                                     "# builderCfg" : "{\"cols\":[{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_line1\",\"columnshort\":\"addr_line1\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_line2\",\"columnshort\":\"addr_line2\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_line3\",\"columnshort\":\"addr_line3\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_country\",\"columnshort\":\"addr_country\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"cntct\",\"column\":\"cntct_phone\",\"columnshort\":\"cntct_phone\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"cntct\",\"column\":\"cntct_phone2\",\"columnshort\":\"cntct_phone2\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"cntct\",\"column\":\"cntct_name\",\"columnshort\":\"cntct_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"cntct_addr_id_addr_line1\"],\"table\":\"cntct\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
740                                     "tableName" : "cntct",
741                                     "items" : [
742                                         {
743                                             "listeners" : {
744                                                 "|rowdblclick" : "function (_self, rowIndex, e)\n{\n   \n    var d =this.getDataSource().getAt(rowIndex).data;\n    Pman.Dialog.XtupleContact.show( \n        {\n            cntct_id : d.cntct_id , \n            customer_id : _this.form.findField('cust_id').getValue()\n        } , function() {\n        _this.grid.ds.load({});\n    });\n}\n",
745                                                 "cellclick" : "function (_self, rowIndex, columnIndex, e)\n{\n\n       if (columnIndex > 1 ) {\n           return;\n       } \n       var d = this.ds.getAt(rowIndex);\n       var f = this.cm.getDataIndex(columnIndex);\n       \n       // toggle it..\n\n       d.set(f, d.data[f] * 1 ? 0 : 1);\n       \n         \n        if (f == 'is_main' && d.data[f] > 0 ) { // removed..\n            // set new main contact - remove old..\n            var cc = _this.form.findField('cust_cntct_id');\n            var old = cc.getValue() * 1;\n            if (old > 1) {\n                this.ds.each(function(r) {\n                    if (r.data.cntct_id == old) {\n                        r.set('is_main', 0);\n                    }\n                });\n            }\n            cc.setValue(d.data.cntct_id);\n        }\n        // sort out shipping.\n        _this.form.findField('shiplist').update();\n          \n       \n}",
746                                                 "|render" : "function() \n{\n    _this.grid = this; \n\n    if (_this.panel.active) {\n       this.ds.load({});\n    }\n}"
747                                             },
748                                             "autoExpandColumn" : "cntct_addr_id_addr_line1",
749                                             "xtype" : "Grid",
750                                             "loadMask" : true,
751                                             "$ xns" : "Roo.grid",
752                                             "* prop" : "grid",
753                                             "# builderCfg" : "{\"cols\":[{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_line1\",\"columnshort\":\"addr_line1\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_line2\",\"columnshort\":\"addr_line2\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_line3\",\"columnshort\":\"addr_line3\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_country\",\"columnshort\":\"addr_country\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"cntct\",\"column\":\"cntct_phone\",\"columnshort\":\"cntct_phone\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"cntct\",\"column\":\"cntct_phone2\",\"columnshort\":\"cntct_phone2\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"cntct\",\"column\":\"cntct_name\",\"columnshort\":\"cntct_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"cntct_addr_id_addr_line1\"],\"table\":\"cntct\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
754                                             "items" : [
755                                                 {
756                                                     "listeners" : {
757                                                         "beforeload" : "function (_self, options)\n{\n     options.params =  options.params || {};\n     options.params.limit = 99;\n    options.params._customer_id = _this.form.findField('cust_id').getValue() * 1;\n    if (options.params._customer_id < 1) {\n        this.removeAll();\n        _this.grid.view.el.mask(\"Save first\");\n        return false;\n    }\n    options.params._add_is_types = 1;\n    _this.grid.view.el.unmask();    \n}",
758                                                         "load" : "function (_self, records, options)\n{\n     var cc = _this.form.findField('cust_cntct_id');\n     var old = cc.getValue() * 1;\n     if (old > 1) {\n        Roo.each(records,function(r) {\n            if (r.data.cntct_id == old) {\n                r.set('is_main',1);\n            }\n        });\n    }\n    (function() { \n         _this.form.findField('shiplist').update();\n     }).defer(50);\n}"
759                                                     },
760                                                     "xtype" : "Store",
761                                                     "remoteSort" : true,
762                                                     "$ sortInfo" : "{ field : 'cntct_name', direction: 'ASC' }",
763                                                     "$ xns" : "Roo.data",
764                                                     "* prop" : "dataSource",
765                                                     "items" : [
766                                                         {
767                                                             "$ url" : "baseURL + '/Roo/cntct.php'",
768                                                             "method" : "GET",
769                                                             "xtype" : "HttpProxy",
770                                                             "$ xns" : "Roo.data",
771                                                             "* prop" : "proxy"
772                                                         },
773                                                         {
774                                                             "id" : "id",
775                                                             "root" : "data",
776                                                             "xtype" : "JsonReader",
777                                                             "$ xns" : "Roo.data",
778                                                             "$ fields" : "[\n    {\n        'name': 'cntct_addr_id_addr_line1',\n        'type': 'string'\n    },\n    {\n        'name': 'cntct_addr_id_addr_line2',\n        'type': 'string'\n    },\n    {\n        'name': 'cntct_addr_id_addr_line3',\n        'type': 'string'\n    },\n    {\n        'name': 'cntct_addr_id_addr_country',\n        'type': 'string'\n    },\n    {\n        'name': 'cntct_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'cntct_phone2',\n        'type': 'string'\n    },\n    {\n        'name': 'cntct_name',\n        'type': 'string'\n    }\n]",
779                                                             "* prop" : "reader",
780                                                             "totalProperty" : "total",
781                                                             "# builderCfg" : "{\"cols\":[{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_line1\",\"columnshort\":\"addr_line1\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_line2\",\"columnshort\":\"addr_line2\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_line3\",\"columnshort\":\"addr_line3\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_country\",\"columnshort\":\"addr_country\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"cntct\",\"column\":\"cntct_phone\",\"columnshort\":\"cntct_phone\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"cntct\",\"column\":\"cntct_phone2\",\"columnshort\":\"cntct_phone2\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"cntct\",\"column\":\"cntct_name\",\"columnshort\":\"cntct_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"cntct_addr_id_addr_line1\"],\"table\":\"cntct\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}"
782                                                         }
783                                                     ]
784                                                 },
785                                                 {
786                                                     "xtype" : "RowSelectionModel",
787                                                     "singleSelect" : true,
788                                                     "$ xns" : "Roo.grid",
789                                                     "* prop" : "sm"
790                                                 },
791                                                 {
792                                                     "xtype" : "Toolbar",
793                                                     "$ xns" : "Roo",
794                                                     "* prop" : "toolbar",
795                                                     "items" : [
796                                                         {
797                                                             "xtype" : "Fill",
798                                                             "$ xns" : "Roo.Toolbar"
799                                                         },
800                                                         {
801                                                             "listeners" : {
802                                                                 "|click" : "function()\n{\n       \n \n Pman.Dialog.XtupleQuickContact.show( \n        {\n             _id : 0,\n             customer_id : _this.form.findField('cust_id').getValue()\n        },\n        \n        function (data) {\n              _this.grid.ds.load({});\n        }\n    ); \n\n    \n}\n"
803                                                             },
804                                                             "text" : "Add",
805                                                             "xtype" : "Button",
806                                                             "cls" : "x-btn-text-icon",
807                                                             "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
808                                                             "$ xns" : "Roo.Toolbar"
809                                                         },
810                                                         {
811                                                             "listeners" : {
812                                                                 "|click" : "function()\n{\n    // will this work?\n     var sel = _this.grid.sm.getSelected();\n    if (!sel  || !sel.data.cntct_id) {\n        Roo.MessageBox.alert(\"Error\", \"Select a contact to delete\");\n        return;\n    }\n    new Pman.Request({\n        url : baseURL + '/Roo/cntct',\n        method : 'POST',\n        params : {\n            _delete : sel.data.cntct_id\n        },\n        success : function() \n        {\n            _this.grid.ds.load({});\n        }\n    });\n    \n    \n \n}\n        "
813                                                             },
814                                                             "text" : "Delete",
815                                                             "xtype" : "Button",
816                                                             "cls" : "x-btn-text-icon",
817                                                             "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
818                                                             "$ xns" : "Roo.Toolbar"
819                                                         }
820                                                     ]
821                                                 },
822                                                 {
823                                                     "xtype" : "ColumnModel",
824                                                     "header" : "Main",
825                                                     "width" : 30,
826                                                     "$ renderer" : "function(v,x,r) { \n\n    return     '<img class=\"x-grid-check-icon' + \n                                        (v*1 ? '-checked' : '')  + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                                        \n    \n}",
827                                                     "$ xns" : "Roo.grid",
828                                                     "* prop" : "colModel[]",
829                                                     "dataIndex" : "is_main"
830                                                 },
831                                                 {
832                                                     "xtype" : "ColumnModel",
833                                                     "header" : "Ship",
834                                                     "width" : 30,
835                                                     "$ renderer" : "function(v,x,r) { \n\n// simple view of address:\n      return     '<img class=\"x-grid-check-icon' + \n                                        (v*1 ? '-checked' : '')  + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                                        \n    \n    \n    \n}",
836                                                     "$ xns" : "Roo.grid",
837                                                     "* prop" : "colModel[]",
838                                                     "dataIndex" : "is_ship"
839                                                 },
840                                                 {
841                                                     "xtype" : "ColumnModel",
842                                                     "header" : "Contact / Address",
843                                                     "width" : 200,
844                                                     "$ renderer" : "function(v,x,r) { \n\n// simple view of address:\n\n    var add = [];\n    Roo.each([ 'line1', 'line2', 'line3', 'city', 'state', 'country'], function (k) {\n        if (!r.data['cntct_addr_id_addr_' + k].length) {\n            return;\n        }\n        add.push(String.format(\"{0}\", r.data['cntct_addr_id_addr_' + k]));\n    \n    });\n\n    return String.format(\n        'Name: <B>{0}</B><br/>' + \n        'Phone: <B>{1}</B> / Mobile: <B>{2}</B><br/>' + \n        'Email: <a href=\"mailto:{3}\">{3}</a>' +         \n        (add.length  ? '<BR/>' : '')  + '<B>' + add.join('<BR/>') + '</B>',\n    \n        r.data.cntct_name,\n        r.data.cntct_phone,\n        r.data.cntct_phone2,\n        \n        r.data.cntct_email\n    );\n    \n    \n}",
845                                                     "$ xns" : "Roo.grid",
846                                                     "* prop" : "colModel[]",
847                                                     "dataIndex" : "cntct_addr_id_addr_line1"
848                                                 }
849                                             ]
850                                         }
851                                     ]
852                                 }
853                             ]
854                         }
855                     ]
856                 },
857                 {
858                     "listeners" : {
859                         "|activate" : "function() {\n    _this.hpanel = this;\n    if (_this.hgrid) {\n        _this.hgrid.footer.onClick('first');\n    }\n}"
860                     },
861                     "fitToframe" : true,
862                     "background" : true,
863                     "region" : "center",
864                     "title" : "History",
865                     "xtype" : "GridPanel",
866                     "fitContainer" : true,
867                     "$ xns" : "Roo",
868                     "tableName" : "cohist",
869                     "items" : [
870                         {
871                             "listeners" : {
872                                 "|rowdblclick" : "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n",
873                                 "|render" : "function() \n{\n    _this.hgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.hpanel.active) {\n       this.footer.onClick('first');\n    }\n}"
874                             },
875                             "autoExpandColumn" : "item_descrip1",
876                             "xtype" : "Grid",
877                             "loadMask" : true,
878                             "$ xns" : "Roo.grid",
879                             "* prop" : "grid",
880                             "items" : [
881                                 {
882                                     "listeners" : {
883                                         "beforeload" : "function (_self, o)\n{\n\n  \n    Roo.apply(o.params, {\n        _group : 'salesHistory',\n        _name : 'detail',\n        'cust_id:number' : _this.form.findField('cust_id').getValue(),\n        'credit:text' : 'credit',\n        'return:text' : 'return',\n        'includeFormatted:int' :  1,\n        'startDate:text' : _this.dateFrom.getValue(),\n        'endDate:text' :  _this.dateTo.getValue()\n    });\n    \n    \n    \n}",
884                                         "load" : "function (_self, records, options)\n{\n    function setText(str) {\n    \n        _this.hgrid.footer.el.select('.sales-footer-text', \n                true).first().dom.innerHTML = str;\n    }\n    \n    \n    if (!records.length) {\n        //_this.footertext.setText('');\n        Roo.log(\"no records\");\n        setText('');\n        return;\n    }\n    new Pman.Request({\n        method : 'GET',\n        url : baseURL + '/Roo/cohist',\n        params : {\n            _sums : 1,\n            \n            cust_id : _this.form.findField('cust_id').getValue(),\n            startDate : _this.dateFrom.getValue(),\n            endDate :  _this.dateTo.getValue()\n        },\n        success : function(res) \n        {\n            setText(\"Total Orders : \" + parseInt(res.data[0].total_orders) + \n                    \"  Total Shipped : \" + parseInt(res.data[0].total_shipped) +                  \n                   \"   Total Value: \" + res.data[0].total_basecurr + \" \" +\n                    Roo.util.Format.number(res.data[0].total_value,2)\n            );\n        }\n    });\n    \n        \n}"
885                                     },
886                                     "xtype" : "Store",
887                                     "remoteSort" : true,
888                                     "$ sortInfo" : "{ field : 'cohist_shipvia', direction: 'ASC' }",
889                                     "$ xns" : "Roo.data",
890                                     "* prop" : "dataSource",
891                                     "items" : [
892                                         {
893                                             "$ url" : "baseURL + '/Roo/metasql.php'",
894                                             "xtype" : "HttpProxy",
895                                             "method" : "GET",
896                                             "$ xns" : "Roo.data",
897                                             "* prop" : "proxy"
898                                         },
899                                         {
900                                             "id" : "id",
901                                             "root" : "data",
902                                             "xtype" : "JsonReader",
903                                             "$ xns" : "Roo.data",
904                                             "$ fields" : "[\n    {\n        'name': 'cohist_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cohist_cust_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cohist_itemsite_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cohist_shipdate',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'cohist_shipvia',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_ordernumber',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_orderdate',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'cohist_invcnumber',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_invcdate',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'cohist_qtyshipped',\n        'type': 'float'\n    },\n    {\n        'name': 'cohist_unitprice',\n        'type': 'float'\n    },\n    {\n        'name': 'cohist_shipto_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cohist_salesrep_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cohist_duedate',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'cohist_imported',\n        'type': 'int'\n    },\n    {\n        'name': 'cohist_billtoname',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_billtoaddress1',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_billtoaddress2',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_billtoaddress3',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_billtocity',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_billtostate',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_billtozip',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_shiptoname',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_shiptoaddress1',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_shiptoaddress2',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_shiptoaddress3',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_shiptocity',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_shiptostate',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_shiptozip',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_commission',\n        'type': 'float'\n    },\n    {\n        'name': 'cohist_commissionpaid',\n        'type': 'int'\n    },\n    {\n        'name': 'cohist_unitcost',\n        'type': 'float'\n    },\n    {\n        'name': 'cohist_misc_type',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_misc_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_misc_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cohist_doctype',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_promisedate',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'cohist_ponumber',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cohist_sequence',\n        'type': 'int'\n    },\n    {\n        'name': 'cohist_taxtype_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cohist_taxzone_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cohist_curr_id_curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cohist_curr_id_curr_base',\n        'type': 'int'\n    },\n    {\n        'name': 'cohist_curr_id_curr_name',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_curr_id_curr_symbol',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_curr_id_curr_abbr',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_taxzone_id_taxzone_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cohist_taxzone_id_taxzone_code',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_taxzone_id_taxzone_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_taxtype_id_taxtype_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cohist_taxtype_id_taxtype_name',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_taxtype_id_taxtype_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'cohist_taxtype_id_taxtype_sys',\n        'type': 'int'\n    }\n]",
905                                             "* prop" : "reader",
906                                             "totalProperty" : "total"
907                                         }
908                                     ]
909                                 },
910                                 {
911                                     "pageSize" : 25,
912                                     "xtype" : "PagingToolbar",
913                                     "emptyMsg" : "No cohist found",
914                                     "$ xns" : "Roo",
915                                     "displayMsg" : "Displaying Sales {0} - {1} of {2}",
916                                     "displayInfo" : true,
917                                     "* prop" : "footer",
918                                     "items" : [
919                                         {
920                                             "text" : "<span class=\"sales-footer-text\"></span>",
921                                             "xtype" : "TextItem",
922                                             "$ xns" : "Roo.Toolbar"
923                                         }
924                                     ]
925                                 },
926                                 {
927                                     "xtype" : "Toolbar",
928                                     "$ xns" : "Roo",
929                                     "* prop" : "toolbar",
930                                     "items" : [
931                                         {
932                                             "text" : "From",
933                                             "xtype" : "TextItem",
934                                             "$ xns" : "Roo.Toolbar"
935                                         },
936                                         {
937                                             "listeners" : {
938                                                 "render" : "function (_self)\n{\n  _this.dateFrom = _self;\n}"
939                                             },
940                                             "format" : "d/M/Y",
941                                             "xtype" : "DateField",
942                                             "useIso" : true,
943                                             "| value" : "(function() {return (new Date()).add(Date.MONTH, -3); })()",
944                                             "$ xns" : "Roo.form"
945                                         },
946                                         {
947                                             "text" : "To",
948                                             "xtype" : "TextItem",
949                                             "$ xns" : "Roo.Toolbar"
950                                         },
951                                         {
952                                             "listeners" : {
953                                                 "render" : "function (_self)\n{\n_this.dateTo = _self;\n}"
954                                             },
955                                             "format" : "d/M/Y",
956                                             "xtype" : "DateField",
957                                             "useIso" : true,
958                                             "| value" : "(function() {return (new Date()) })()",
959                                             "$ xns" : "Roo.form"
960                                         },
961                                         {
962                                             "listeners" : {
963                                                 "click" : "function (_self, e)\n{\n    _this.hgrid.footer.onClick('first');\n}"
964                                             },
965                                             "text" : "Refresh",
966                                             "xtype" : "Button",
967                                             "$ xns" : "Roo.Toolbar"
968                                         },
969                                         {
970                                             "xtype" : "Fill",
971                                             "$ xns" : "Roo.Toolbar"
972                                         },
973                                         {
974                                             "listeners" : {
975                                                 "click" : "function (_self, e)\n{\n    new Pman.Download({\n        grid : _this.hgrid\n    });\n}"
976                                             },
977                                             "text" : "Download",
978                                             "xtype" : "Button",
979                                             "$ xns" : "Roo.Toolbar"
980                                         }
981                                     ]
982                                 },
983                                 {
984                                     "xtype" : "ColumnModel",
985                                     "header" : "Customer",
986                                     "width" : 75,
987                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
988                                     "$ xns" : "Roo.grid",
989                                     "* prop" : "colModel[]",
990                                     "dataIndex" : "cust_name"
991                                 },
992                                 {
993                                     "xtype" : "ColumnModel",
994                                     "header" : "Order",
995                                     "width" : 75,
996                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
997                                     "$ xns" : "Roo.grid",
998                                     "* prop" : "colModel[]",
999                                     "dataIndex" : "cohist_ordernumber"
1000                                 },
1001                                 {
1002                                     "xtype" : "ColumnModel",
1003                                     "header" : "Invoice Month",
1004                                     "width" : 75,
1005                                     "$ renderer" : "function(v) { \n    \n    return String.format('{0}',v);\n }",
1006                                     "$ xns" : "Roo.grid",
1007                                     "* prop" : "colModel[]",
1008                                     "dataIndex" : "invmonth"
1009                                 },
1010                                 {
1011                                     "xtype" : "ColumnModel",
1012                                     "header" : "Invoice date",
1013                                     "width" : 75,
1014                                     "$ renderer" : "function(v) { \n    var d = Date.parseDate(v, 'Y-m-d');\n    return String.format('{0}', d ? d.format('d/M/Y') : '');\n }",
1015                                     "$ xns" : "Roo.grid",
1016                                     "* prop" : "colModel[]",
1017                                     "dataIndex" : "cohead_orderdate"
1018                                 },
1019                                 {
1020                                     "xtype" : "ColumnModel",
1021                                     "header" : "Invoice date",
1022                                     "width" : 75,
1023                                     "$ renderer" : "function(v) { \n    var d = Date.parseDate(v, 'Y-m-d');\n    return String.format('{0}', d ? d.format('d/M/Y') : '');\n }",
1024                                     "$ xns" : "Roo.grid",
1025                                     "* prop" : "colModel[]",
1026                                     "dataIndex" : "cohist_invcdate"
1027                                 },
1028                                 {
1029                                     "xtype" : "ColumnModel",
1030                                     "header" : "Invoice#",
1031                                     "width" : 75,
1032                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1033                                     "$ xns" : "Roo.grid",
1034                                     "* prop" : "colModel[]",
1035                                     "dataIndex" : "cohist_invcnumber"
1036                                 },
1037                                 {
1038                                     "xtype" : "ColumnModel",
1039                                     "header" : "Item No.",
1040                                     "width" : 75,
1041                                     "$ renderer" : "function(v) { return String.format('{0}', v ? v   : ''); }",
1042                                     "$ xns" : "Roo.grid",
1043                                     "* prop" : "colModel[]",
1044                                     "dataIndex" : "item_number"
1045                                 },
1046                                 {
1047                                     "xtype" : "ColumnModel",
1048                                     "header" : "Description",
1049                                     "width" : 200,
1050                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1051                                     "$ xns" : "Roo.grid",
1052                                     "* prop" : "colModel[]",
1053                                     "dataIndex" : "item_descrip1"
1054                                 },
1055                                 {
1056                                     "align" : "right",
1057                                     "xtype" : "ColumnModel",
1058                                     "header" : "Qty",
1059                                     "width" : 70,
1060                                     "$ renderer" : "function(v) { return parseInt(v); }",
1061                                     "$ xns" : "Roo.grid",
1062                                     "* prop" : "colModel[]",
1063                                     "dataIndex" : "cohist_qtyshipped"
1064                                 },
1065                                 {
1066                                     "xtype" : "ColumnModel",
1067                                     "header" : "Currency",
1068                                     "width" : 75,
1069                                     "$ renderer" : "function(v) { return String.format('{0}', v.split(/\\s+/)[0]); }",
1070                                     "$ xns" : "Roo.grid",
1071                                     "* prop" : "colModel[]",
1072                                     "dataIndex" : "currabbr"
1073                                 },
1074                                 {
1075                                     "align" : "right",
1076                                     "xtype" : "ColumnModel",
1077                                     "header" : "Unit Price",
1078                                     "width" : 75,
1079                                     "$ renderer" : "function(v) { return Roo.util.Format.number( v, 2); }",
1080                                     "$ xns" : "Roo.grid",
1081                                     "* prop" : "colModel[]",
1082                                     "dataIndex" : "cohist_unitprice"
1083                                 },
1084                                 {
1085                                     "align" : "right",
1086                                     "xtype" : "ColumnModel",
1087                                     "header" : "Ext Cost",
1088                                     "width" : 75,
1089                                     "$ renderer" : "function(v) { return Roo.util.Format.number( v, 2); }",
1090                                     "$ xns" : "Roo.grid",
1091                                     "* prop" : "colModel[]",
1092                                     "dataIndex" : "extprice"
1093                                 }
1094                             ]
1095                         }
1096                     ]
1097                 },
1098                 {
1099                     "listeners" : {
1100                         "|activate" : "function() {\n    _this.ipanel = this;\n    if (_this.igrid) {\n        _this.igrid.footer.onClick('first');\n    }\n}"
1101                     },
1102                     "region" : "center",
1103                     "fitToframe" : true,
1104                     "background" : true,
1105                     "title" : "Images",
1106                     "xtype" : "GridPanel",
1107                     "fitContainer" : true,
1108                     "$ xns" : "Roo",
1109                     "tableName" : "Images",
1110                     "items" : [
1111                         {
1112                             "listeners" : {
1113                                 "rowdblclick" : "function (_self, rowIndex, e)\n{\n   var s =  _self.getDataSource().getAt(rowIndex);\n   \n   new Pman.Download({\n        url : baseURL + '/Images/Download/' + s.data.id\n    });\n   \n}",
1114                                 "|render" : "function() \n{\n    _this.igrid = this; \n\n    if (_this.ipanel.active) {\n       this.footer.onClick('first');\n    }\n}"
1115                             },
1116                             "autoExpandColumn" : "imgtype",
1117                             "xtype" : "Grid",
1118                             "loadMask" : true,
1119                             "$ xns" : "Roo.grid",
1120                             "* prop" : "grid",
1121                             "items" : [
1122                                 {
1123                                     "listeners" : {
1124                                         "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {}\n    \n    var cust_id = _this.form.findField('cust_id').getValue() * 1;\n    \n    if(cust_id < 1){\n        this.removeAll();\n        return false;\n    }\n\n    o.params.ontable = 'custinfo';\n    o.params.onid = cust_id;\n}"
1125                                     },
1126                                     "xtype" : "Store",
1127                                     "remoteSort" : true,
1128                                     "$ sortInfo" : "{ field : 'id', direction: 'ASC' }",
1129                                     "$ xns" : "Roo.data",
1130                                     "* prop" : "dataSource",
1131                                     "items" : [
1132                                         {
1133                                             "$ url" : "baseURL + '/Roo/Images.php'",
1134                                             "method" : "GET",
1135                                             "xtype" : "HttpProxy",
1136                                             "$ xns" : "Roo.data",
1137                                             "* prop" : "proxy"
1138                                         },
1139                                         {
1140                                             "id" : "id",
1141                                             "root" : "data",
1142                                             "xtype" : "JsonReader",
1143                                             "$ xns" : "Roo.data",
1144                                             "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'filename',\n        'type': 'string'\n    },\n    {\n        'name': 'imgtype',\n        'type': 'string'\n    },\n    {\n        'name': 'created',\n        'type': 'date',\n        'dateFormat': 'Y-m-d H:i:s'\n    }\n]",
1145                                             "* prop" : "reader",
1146                                             "totalProperty" : "total"
1147                                         }
1148                                     ]
1149                                 },
1150                                 {
1151                                     "pageSize" : 25,
1152                                     "xtype" : "PagingToolbar",
1153                                     "emptyMsg" : "No Images found",
1154                                     "$ xns" : "Roo",
1155                                     "displayMsg" : "Displaying Images {0} - {1} of {2}",
1156                                     "displayInfo" : true,
1157                                     "* prop" : "footer"
1158                                 },
1159                                 {
1160                                     "xtype" : "ColumnModel",
1161                                     "header" : "Image",
1162                                     "width" : 100,
1163                                     "$ renderer" : "function(v,x,r) {\n    return String.format('<img src=\"{0}/Images/Thumb/100/{1}/{2}\" height=\"50\">', baseURL, v, r.data.filename);\n}",
1164                                     "$ xns" : "Roo.grid",
1165                                     "* prop" : "cm[]",
1166                                     "dataIndex" : "id"
1167                                 },
1168                                 {
1169                                     "xtype" : "ColumnModel",
1170                                     "width" : 150,
1171                                     "header" : "Date",
1172                                     "$ renderer" : "function(v) { \n    return String.format('{0}', v ? v.format('d/M/Y') : '');\n }",
1173                                     "$ xns" : "Roo.grid",
1174                                     "* prop" : "cm[]",
1175                                     "dataIndex" : "created"
1176                                 },
1177                                 {
1178                                     "xtype" : "ColumnModel",
1179                                     "header" : "File Name",
1180                                     "width" : 200,
1181                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1182                                     "$ xns" : "Roo.grid",
1183                                     "* prop" : "cm[]",
1184                                     "dataIndex" : "filename"
1185                                 },
1186                                 {
1187                                     "xtype" : "ColumnModel",
1188                                     "header" : "Type",
1189                                     "width" : 200,
1190                                     "$ renderer" : "function(v) { \n    return String.format('{0}',v);\n }",
1191                                     "$ xns" : "Roo.grid",
1192                                     "* prop" : "cm[]",
1193                                     "dataIndex" : "imgtype"
1194                                 }
1195                             ]
1196                         }
1197                     ]
1198                 },
1199                 {
1200                     "listeners" : {
1201                         "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
1202                     },
1203                     "text" : "Cancel",
1204                     "xtype" : "Button",
1205                     "$ xns" : "Roo",
1206                     "* prop" : "buttons[]"
1207                 },
1208                 {
1209                     "listeners" : {
1210                         "click" : "function (_self, e)\n{\n    // do some checks?\n     \n     var bg_comp = _this.form.findField('cust_char_internalcompany').getValue();\n     var ctype  = _this.form.findField('cust_custtype_id').el.dom.value;\n     if (bg_comp.length && !ctype.match(/internal/i)) {\n        Roo.MessageBox.alert(\"Error\" ,\n            \"BG Company should only be set for internal companies\"\n        );\n        return;\n    }\n     \n     \n     \n     \n     \n    \n \n    _this.form.doAction(\"submit\");\n\n}"
1211                     },
1212                     "text" : "Save",
1213                     "xtype" : "Button",
1214                     "$ xns" : "Roo",
1215                     "* prop" : "buttons[]"
1216                 }
1217             ]
1218         }
1219     ]
1220 }