Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleSalesOrder.bjs
1 {
2  "name" : "Pman.Tab.XtupleSalesOrder",
3  "parent" : "Pman.Tab.XtupleSales",
4  "title" : "",
5  "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleSalesOrder.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "fdb35c1a9883acaa94378144a114dfe6" : "Cust. PO#",
10   "a8929eb5c1553d3f70497f862d25d0ce" : "Select Action",
11   "3bd9a9f36601eeb35d5afce4dcfbfce5" : "No cohead found",
12   "6f1bf85c9ebb3c7fa26251e1e335e032" : "Terms",
13   "d2fd3c49554ebcce7e57b85dfa682160" : "Displaying cohead{0} - {1} of {2}",
14   "72d6d7a1885885bb55a565fd1070581a" : "Import",
15   "36dc4ac22a9c9aa45d359e55937499da" : "as PDF",
16   "051f291b80c3336fc75368454ca2a8d2" : "Import HSBC csv file",
17   "f313afd5710eeea203821d3201cc27d8" : "Email to warehouse",
18   "a1fa27779242b4902f7ae3bdd5c6d508" : "Type",
19   "d1228f5476d15142b1358ae4b5fa2454" : "Order #",
20   "bf2234cf486127ba73efe4b2986eed78" : "Customer Statement",
21   "bcc3c81377e8aef6878f3048ad3e1845" : "cohead",
22   "be99bd9be2f6204e18d9be098b1cec84" : "AR Aging",
23   "ec211f7c20af43e742bf2570c3cb84f9" : "Add",
24   "ce26601dac0dea138b7295f02b7620a7" : "Customer",
25   "1243daf593fa297e07ab03bf06d925af" : "Searching...",
26   "3f7488c396d3d4e015d8886452db4110" : "Staff IC.",
27   "4351cfebe4b61d8aa5efa1d020710005" : "View",
28   "f38ab62162b94b4978679aeca58a270c" : "Select Order",
29   "8f3e1295a3a1d30b6ee5d8de6e0b8c0a" : "as Excel",
30   "13348442cc6a27032d2b4aa28b75a5d3" : "Search",
31   "26e09a1ee1517389c7b07f42df65561a" : "Ordered",
32   "8db91c5e3376bc85414ebca9c53fb53f" : "MYOPEN",
33   "904062c33353866aa5234f35ed29e114" : "Download Results",
34   "959462c653dede23e7152b97b45a8aa5" : "Clear Unpaid Orders",
35   "3e208ad5d41ca414bb432adbb7d39c33" : "View type",
36   "4d02be4779719ea23232946e4a34aa82" : "Magento Upload",
37   "74002cb040b036511b8d031da591364a" : "Ship to",
38   "5da618e8e4b89c66fe86e32cdafde142" : "From",
39   "ebe043e4c90950fe50c8a95d96af10f5" : "Quick Stock Check",
40   "54ca6e7fdb43298ae82cd9cb04e77f9b" : "#order",
41   "c91c7b93c28cd18741b71f727ee81ee3" : "Reports",
42   "96b0141273eabab320119c467cdcaf17" : "Total",
43   "99360e60ce244a99256c131555f20d4e" : "Sales Orders",
44   "1c5b744a085a30924e4436c89a79027e" : "Complete and Close",
45   "a2fdeac60e3c5b6c51a92e027fb9d533" : "Target Delivery",
46   "5fb63579fc981698f97d55bfecb213ea" : "Copy",
47   "b155bf2beaeeb2018389eded7c74b56f" : "Customer History",
48   "b0ca9fe87723f63f290ec66b891ec9ee" : "Import Waybill Delivery",
49   "2d899459cc25ea99ea2573d592860ec8" : "Customer#",
50   "fce6d3795b41b54dc0dab82df50517c1" : "Select custinfo",
51   "e12167aa0a7698e6ebc92b4ce3909b53" : "To",
52   "d720bb04db44a8269a09bea3b90352f4" : "Summary Excel",
53   "f4c6f851b00d5518bf888815de279aba" : "Notes"
54  },
55  "items" : [
56   {
57    "listeners" : {
58     "activate" : "function (_self)\n{\n    this.setTitle('Sales Orders (' + Pman.Login.authUser.dbname +')');\n}"
59    },
60    "region" : "center",
61    "xtype" : "NestedLayoutPanel",
62    "title" : "Sales Orders",
63    "$ xns" : "Roo",
64    "items" : [
65     {
66      "xtype" : "BorderLayout",
67      "$ xns" : "Roo",
68      "* prop" : "layout",
69      "items" : [
70       {
71        "xtype" : "LayoutRegion",
72        "title" : "Search",
73        "$ xns" : "Roo",
74        "width" : 200,
75        "split" : true,
76        "* prop" : "west"
77       },
78       {
79        "xtype" : "LayoutRegion",
80        "$ xns" : "Roo",
81        "* prop" : "center"
82       },
83       {
84        "listeners" : {
85         "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
86        },
87        "background" : true,
88        "fitToframe" : true,
89        "region" : "center",
90        "title" : "cohead",
91        "xtype" : "GridPanel",
92        "fitContainer" : true,
93        "$ xns" : "Roo",
94        "# builderCfg" : "{\"cols\":[{\"table\":\"cohead\",\"column\":\"cohead_number\",\"columnshort\":\"cohead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#order\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"},{\"table\":\"cohead\",\"column\":\"cohead_custponumber\",\"columnshort\":\"cohead_custponumber\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Cust. PO#\"},{\"table\":\"cohead\",\"column\":\"cohead_type\",\"columnshort\":\"cohead_type\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Type\"},{\"table\":\"cohead\",\"column\":\"cohead_orderdate\",\"columnshort\":\"cohead_orderdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ordered\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_name\",\"columnshort\":\"shipto_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ship to\"},{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_descrip\",\"columnshort\":\"terms_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Terms\"},{\"table\":\"curr_symbol\",\"column\":\"cohead_curr_id_curr_name\",\"columnshort\":\"curr_name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Currency\"}],\"cols_ex\":[\"cohead_cust_id_cust_name\"],\"table\":\"cohead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
95        "tableName" : "cohead",
96        "items" : [
97         {
98          "listeners" : {
99           "|rowdblclick" : "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('refresh');\n        Pman.Tab.XtupleSales.grid.footer.onClick('first');\n    }); \n}\n",
100           "|render" : "function() \n{\n    _this.grid = this; \n    try { \n        _this.dialog = Pman.Dialog.XtupleSalesOrder;\n    } catch(e) {}\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
101          },
102          "autoExpandColumn" : "cohead_cust_id_cust_name",
103          "xtype" : "Grid",
104          "loadMask" : true,
105          "$ xns" : "Roo.grid",
106          "* prop" : "grid",
107          "items" : [
108           {
109            "listeners" : {
110             "beforeload" : "function (_self, options)\n{\n    var vl;\n    try { \n         vl = _this.form.getFieldValues();\n     } catch (e) {\n        vl = {};\n     }\n\n     \n     \n    for(var x in vl) {\n        if (!(new String(vl[x])).length) {\n            continue;\n        }\n        options.params[x] = vl[x];\n        \n    }\n    try {\n        if (options.params['query[cohead_number]'].length) {\n            options.params.viewtype = 'REALALL';\n        }\n    } catch (e) {}\n}"
111            },
112            "remoteSort" : true,
113            "xtype" : "Store",
114            "$ sortInfo" : "{ field : 'cohead_orderdate', direction: 'DESC' }",
115            "$ xns" : "Roo.data",
116            "* prop" : "dataSource",
117            "# builderCfg" : "{\"cols\":[{\"table\":\"cohead\",\"column\":\"cohead_number\",\"columnshort\":\"cohead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#order\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"},{\"table\":\"cohead\",\"column\":\"cohead_custponumber\",\"columnshort\":\"cohead_custponumber\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Cust. PO#\"},{\"table\":\"cohead\",\"column\":\"cohead_type\",\"columnshort\":\"cohead_type\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Type\"},{\"table\":\"cohead\",\"column\":\"cohead_orderdate\",\"columnshort\":\"cohead_orderdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ordered\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_name\",\"columnshort\":\"shipto_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ship to\"},{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_descrip\",\"columnshort\":\"terms_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Terms\"},{\"table\":\"curr_symbol\",\"column\":\"cohead_curr_id_curr_name\",\"columnshort\":\"curr_name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Currency\"}],\"cols_ex\":[\"cohead_cust_id_cust_name\"],\"table\":\"cohead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
118            "items" : [
119             {
120              "$ url" : "baseURL + '/Roo/cohead.php'",
121              "method" : "GET",
122              "xtype" : "HttpProxy",
123              "timeout" : 60000,
124              "$ xns" : "Roo.data",
125              "* prop" : "proxy"
126             },
127             {
128              "id" : "id",
129              "root" : "data",
130              "xtype" : "JsonReader",
131              "$ xns" : "Roo.data",
132              "$ fields" : "[\n    {\n        'name': 'cohead_number',\n        'type': 'string'\n    },\n    {\n        'name': 'cohead_cust_id_cust_name',\n        'type': 'string'\n    },\n    {\n        'name': 'cohead_custponumber',\n        'type': 'string'\n    },\n    {\n        'name': 'cohead_type'\n    },\n    {\n        'name': 'cohead_orderdate',\n        'type': 'date'\n    },\n    {\n        'name': 'cohead_shipto_id_shipto_name',\n        'type': 'string'\n    },\n    {\n        'name': 'cohead_terms_id_terms_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'cohead_curr_id_curr_name',\n        'type': 'string'\n    }\n]",
133              "* prop" : "reader",
134              "totalProperty" : "total",
135              "# builderCfg" : "{\"cols\":[{\"table\":\"cohead\",\"column\":\"cohead_number\",\"columnshort\":\"cohead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#order\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"},{\"table\":\"cohead\",\"column\":\"cohead_custponumber\",\"columnshort\":\"cohead_custponumber\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Cust. PO#\"},{\"table\":\"cohead\",\"column\":\"cohead_type\",\"columnshort\":\"cohead_type\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Type\"},{\"table\":\"cohead\",\"column\":\"cohead_orderdate\",\"columnshort\":\"cohead_orderdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ordered\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_name\",\"columnshort\":\"shipto_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ship to\"},{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_descrip\",\"columnshort\":\"terms_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Terms\"},{\"table\":\"curr_symbol\",\"column\":\"cohead_curr_id_curr_name\",\"columnshort\":\"curr_name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Currency\"}],\"cols_ex\":[\"cohead_cust_id_cust_name\"],\"table\":\"cohead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}"
136             }
137            ]
138           },
139           {
140            "pageSize" : 25,
141            "xtype" : "PagingToolbar",
142            "emptyMsg" : "No cohead found",
143            "$ xns" : "Roo",
144            "displayInfo" : true,
145            "displayMsg" : "Displaying cohead{0} - {1} of {2}",
146            "* prop" : "footer",
147            "items" : [
148             {
149              "listeners" : {
150               "click" : "function ()\n{\n    new Pman.Download({\n        grid : _this.grid,\n        newWindow : true,\n        timeout : 6000000,\n        method : 'POST'\n    });     \n   \n}"
151              },
152              "text" : "Download Results",
153              "xtype" : "Button",
154              "cls" : "x-btn-text-icon",
155              "$ icon" : "rootURL + '/Pman/templates/images/spreadsheet.gif'",
156              "$ xns" : "Roo.Toolbar"
157             }
158            ]
159           },
160           {
161            "xtype" : "Toolbar",
162            "$ xns" : "Roo",
163            "* prop" : "toolbar",
164            "items" : [
165             {
166              "listeners" : {
167               "click" : "function (_self, e)\n{\n Pman.Dialog.XtupleInvHistory.show({\n \n \n    });\n}"
168              },
169              "text" : "Quick Stock Check",
170              "xtype" : "Button",
171              "$ xns" : "Roo.Toolbar"
172             },
173             {
174              "text" : "Import",
175              "xtype" : "Button",
176              "$ xns" : "Roo.Toolbar",
177              "items" : [
178               {
179                "xtype" : "Menu",
180                "$ xns" : "Roo.menu",
181                "* prop" : "menu",
182                "items" : [
183                 {
184                  "listeners" : {
185                   "click" : "function (_self, e)\n{\n   Pman.Dialog.Image.show(\n       {\n            _url : baseURL+'/Xtuple/Import/Magento',\n            timeout : 90000\n        \n       },\n       function (data) {\n            Roo.MessageBox.alert(\"Notice\", data); \n            _this.grid.footer.onClick('first');\n\n       }\n   );\n}"
186                  },
187                  "text" : "Magento Upload",
188                  "xtype" : "Item",
189                  "$ xns" : "Roo.menu"
190                 },
191                 {
192                  "listeners" : {
193                   "click" : "function (_self, e)\n{\n    Pman.Dialog.XtupleUploadHSBC.show( {} , function(res) {\n        Pman.Dialog.Image.show({\n            timeout : 900000,\n            _url : baseURL + '/Xtuple/Import/HSBC?' + Roo.urlEncode(res)\n        }, function(data) {\n            Roo.MessageBox.alert('Success', data);\n            _this.grid.footer.onClick('first');\n        });\n    }); \n}"
194                  },
195                  "text" : "Import HSBC csv file",
196                  "xtype" : "Item",
197                  "$ xns" : "Roo.menu"
198                 },
199                 {
200                  "listeners" : {
201                   "click" : "function (_self, e)\n{\n   Pman.Dialog.Image.show(\n       {\n            _url : baseURL+'/Xtuple/Import/WayBill',\n            timeout : 900000\n        \n       },\n       function (data) {\n            Roo.MessageBox.alert(\"Notice\", data); \n            _this.grid.footer.onClick('first');\n       }\n   );\n}"
202                  },
203                  "text" : "Import Waybill Delivery",
204                  "xtype" : "Item",
205                  "$ xns" : "Roo.menu"
206                 }
207                ]
208               }
209              ]
210             },
211             {
212              "text" : "Reports",
213              "xtype" : "Button",
214              "cls" : "x-btn-text-icon",
215              "$ icon" : "rootURL + '/Pman/templates/images/spreadsheet.gif'",
216              "$ xns" : "Roo.Toolbar",
217              "items" : [
218               {
219                "xtype" : "Menu",
220                "$ xns" : "Roo.menu",
221                "* prop" : "menu",
222                "items" : [
223                 {
224                  "text" : "AR Aging",
225                  "xtype" : "Item",
226                  "$ xns" : "Roo.menu",
227                  "items" : [
228                   {
229                    "xtype" : "Menu",
230                    "$ xns" : "Roo.menu",
231                    "* prop" : "menu",
232                    "items" : [
233                     {
234                      "listeners" : {
235                       "click" : "function (_self, e)\n{\n    var from = _this.form.findField('_fromdate').getValue();\n    var to = _this.form.findField('_todate').getValue();\n    \n    if(!from || !to){\n        Roo.Msg.alert('Error', 'Please select a date range for the report');\n        return;\n    }\n    \n    var params  =   {\n        template: 'ARAging',\n        filename : 'ARAging-' + to.format('Y-m-d'),\n        'param[0]':   \"startDate:string='\" + from.format('Y-m-d') + \"'\",\n        'param[1]':   \"relDate:string='\" + to.format('Y-m-d') + \"'\",\n        'param[2]':   \"useDocDate:number=1\"\n    };\n    var cust_id =     _this.form.findField('cohead_cust_id').getValue();\n    if (cust_id * 1 > 0) {\n        params['param[3]'] = 'cust_id:number=' + cust_id;\n    }\n \n    new Pman.Download({\n      url : baseURL + '/Xtuple/Print',\n      params :   params,\n      method : 'GET'\n    });\n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
236                      },
237                      "text" : "as PDF",
238                      "xtype" : "Item",
239                      "$ xns" : "Roo.menu"
240                     },
241                     {
242                      "listeners" : {
243                       "click" : "function (_self, e)\n{\n    var from = _this.form.findField('_fromdate').getValue();\n    var to = _this.form.findField('_todate').getValue();\n    \n   \n    \n    var params = {\n        '_group' : 'arAging',\n        '_name' : 'bydate',\n        'limit' : 99999,\n        \n          'startDate:text' : from ? from.format('Y-m-d') : '2000-01-01' ,\n        'relDate:text' : to ? to.format('Y-m-d') : '2100-01-01',\n     \n        \n        \n        'useDocDate:text' : 'TRUE',\n        'csvTitles' : '*',\n        'csvCols' : '*'\n    };\n    \n    \n    var cust_id =     _this.form.findField('cohead_cust_id').getValue();\n    if (cust_id * 1 > 0) {\n        params['cust_id:number'] = cust_id;\n    }\n    \n    new Pman.Download({\r\n      url : baseURL + '/Roo/Metasql',\r\n      params :   params,\r\n      method : 'GET'\r\n    });\r\n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\r\n    \r\n}"
244                      },
245                      "text" : "as Excel",
246                      "xtype" : "Item",
247                      "$ xns" : "Roo.menu"
248                     },
249                     {
250                      "listeners" : {
251                       "click" : "function (_self, e)\n{\n    var from = _this.form.findField('_fromdate').getValue();\n    var to = _this.form.findField('_todate').getValue();\n    \n   \n    \n    var params = {\n        '_group' : 'arAging',\n        '_name' : 'summary',\n        'limit' : 99999,\n        \n        \n      \n        'startDate:text' : from ? from.format('Y-m-d') : '2000-01-01' ,\n        'relDate:text' : to ? to.format('Y-m-d') : '2100-01-01',\n     \n        \n        'useDocDate:text' : 'TRUE',\n        'csvTitles' : '*',\n        'csvCols' : '*'\n    };\n    \n    var cust_id =     _this.form.findField('cohead_cust_id').getValue();\n    if (cust_id * 1 > 0) {\n        params['cust_id:number'] = cust_id;\n    }\n    \n    new Pman.Download({\r\n      url : baseURL + '/Roo/Metasql',\r\n      params :   params,\r\n      method : 'GET'\r\n    });\r\n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\r\n    \r\n}"
252                      },
253                      "text" : "Summary Excel",
254                      "xtype" : "Item",
255                      "$ xns" : "Roo.menu"
256                     }
257                    ]
258                   }
259                  ]
260                 },
261                 {
262                  "text" : "Customer History",
263                  "xtype" : "Item",
264                  "$ xns" : "Roo.menu",
265                  "items" : [
266                   {
267                    "xtype" : "Menu",
268                    "$ xns" : "Roo.menu",
269                    "* prop" : "menu",
270                    "items" : [
271                     {
272                      "listeners" : {
273                       "click" : "function (_self, e)\n{\n    var cust_id = _this.form.findField('cohead_cust_id').getValue();\n    if (cust_id * 1 < 1) {\n        Roo.Msg.alert('Error', 'Please select a customer');\n        return;\n    }\n    \n    var from = _this.form.findField('_fromdate').getValue();\n    var to = _this.form.findField('_todate').getValue();\n    \n    if(!from || !to){\n        Roo.Msg.alert('Error', 'Please select a date range for the report');\n        return;\n    }\n    \n    var params  =   {\n        template: 'customer_ar_history',\n        filename : 'customer_ar_history-' + to.format('Y-m-d'),\n        'param[0]':   \"startDate:string='\" + from.format('Y-m-d') + \"'\",\n        'param[1]':   \"endDate:string='\" + to.format('Y-m-d') + \"'\",\n        'param[2]':   \"cust_id:number=\" + cust_id\n    };\n         \n    new Pman.Download({\n        url : baseURL + '/Xtuple/Print',\n        params :   params,\n        method : 'GET'\n    });\n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
274                      },
275                      "text" : "as PDF",
276                      "xtype" : "Item",
277                      "$ xns" : "Roo.menu"
278                     },
279                     {
280                      "listeners" : {
281                       "click" : "function (_self, e)\n{\n    var cust_id = _this.form.findField('cohead_cust_id').getValue();\n    if (cust_id * 1 < 1) {\n        Roo.Msg.alert('Error', 'Please select a customer');\n        return;\n    }\n    \n    var from = _this.form.findField('_fromdate').getValue();\n    var to = _this.form.findField('_todate').getValue();\n    \n  \n    \n    var params = {\n        '_group' : 'customerHistory',\n        '_name' : 'detail',\n        'limit' : 99999,\n        \n        'startDate:text' : from ? from.format('Y-m-d') : '2000-01-01' ,\n        'endDate:text' : to ? to.format('Y-m-d') : '2100-01-01',\n       \n        'cust_id:number' : cust_id,\n        'csvTitles' : '*',\n        'csvCols' : '*'\n    };\n    \n    \n    new Pman.Download({\r\n      url : baseURL + '/Roo/Metasql',\r\n      params :   params,\r\n      method : 'GET'\r\n    });\r\n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
282                      },
283                      "text" : "as Excel",
284                      "xtype" : "Item",
285                      "$ xns" : "Roo.menu"
286                     }
287                    ]
288                   }
289                  ]
290                 },
291                 {
292                  "text" : "Customer Statement",
293                  "xtype" : "Item",
294                  "$ xns" : "Roo.menu",
295                  "items" : [
296                   {
297                    "xtype" : "Menu",
298                    "$ xns" : "Roo.menu",
299                    "* prop" : "menu",
300                    "items" : [
301                     {
302                      "listeners" : {
303                       "click" : "function (_self, e)\n{\n    var cust_id = _this.form.findField('cohead_cust_id').getValue();\n    if (cust_id * 1 < 1) {\n        Roo.Msg.alert('Error', 'Please select a customer');\n        return;\n    }\n    \n    var from = _this.form.findField('_fromdate').getValue();\n    var to = _this.form.findField('_todate').getValue();\n    \n \n     \n    var params  =   {\n        template: 'customer_ar_statement',\n        filename : 'customer_ar_statement-' +(to ? to.format('Y-m-d') : '2100-01-01'),\n        'param[0]':   \"startDate:string='\" + (from ? from.format('Y-m-d') : '2000-01-01') + \"'\",\n        'param[1]':   \"asofdate:string='\" + (to ? to.format('Y-m-d') : '2100-01-01')+ \"'\",\n        'param[2]':   \"cust_id:number=\" + cust_id\n    };\n    \n    new Pman.Download({\n        url : baseURL + '/Xtuple/Print',\n        params :   params,\n        method : 'GET'\n    });\n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
304                      },
305                      "text" : "as PDF",
306                      "xtype" : "Item",
307                      "$ xns" : "Roo.menu"
308                     },
309                     {
310                      "listeners" : {
311                       "click" : "function (_self, e)\n{\n    var cust_id = _this.form.findField('cohead_cust_id').getValue();\n    if (cust_id * 1 < 1) {\n        Roo.Msg.alert('Error', 'Please select a customer');\n        return;\n    }\n    \n   var from = _this.form.findField('_fromdate').getValue();\n   var to = _this.form.findField('_todate').getValue();\n\n    //if(!from || !to){\n    //    Roo.Msg.alert('Error', 'Please select a date range for the report');\n    //    return;\n    //}\n    \n    var params = {\n        '_group' : 'customerStatement',\n        '_name' : 'detail',\n        'limit' : 99999,\n        'startDate:text' : from ? from.format('Y-m-d') : '2000-01-01' ,\n        'asofdate:text' : to ? to.format('Y-m-d') : '2100-01-01',\n        'cust_id:number' : cust_id,\n        'csvTitles' : '*',\n        'csvCols' : '*'\n    };\n\n    \n    new Pman.Download({\r\n      url : baseURL + '/Roo/Metasql',\r\n      params :   params,\r\n      method : 'GET'\r\n    });\r\n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
312                      },
313                      "text" : "as Excel",
314                      "xtype" : "Item",
315                      "$ xns" : "Roo.menu"
316                     }
317                    ]
318                   }
319                  ]
320                 }
321                ]
322               }
323              ]
324             },
325             {
326              "listeners" : {
327               "|click" : "function (_self, e)\n{\n    var sels = _this.grid.getSelectionModel().getSelections();\n    \n    if (!sels.length) {\n        Roo.MessageBox.alert(\"Error\", \"Select an order\");\n        return;\n    }\n    var ids = [];\n    for (var i =0; i < sels.length; i++) {\n        var s = sels[i];    \n        \n        if(s.data.cohead_qtyuninvoiced * 1 > 0){\n            Roo.MessageBox.alert(\"Error\", \"Order has not been invoiced! - \" + s.data.cohead_number);\n            return;\n        }\n        \n        if(s.data.aropen_unpaid * 1 > 0){\n            Roo.MessageBox.alert(\"Error\", \"Order has not been paid! - \"  + s.data.cohead_number);\n            return;\n        }\n        ids.push(s.data.cohead_id);\n    }\n    \n    new Pman.Download({\r\n      url : baseURL + '/Xtuple/Reports/SalesOrderBookingDetail',\r\n      params :   {\n            cohead_id : ids.join(',')\n      },\r\n      method : 'GET'\r\n    });\r\n    \n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
328              },
329              "text" : "Email to warehouse",
330              "xtype" : "Button",
331              "cls" : "x-btn-text-icon",
332              "$ icon" : "Roo.rootURL + 'images/default/dd/email.gif'",
333              "$ xns" : "Roo.Toolbar"
334             },
335             {
336              "listeners" : {
337               "|click" : "function()\n{\n    var s = _this.grid.getSelectionModel().getSelected();\n    if (!s) {\n        Roo.MessageBox.alert(\"Error\", \"Select an order to close\");\n        return;\n    }\n    \n    if(s.data.cohead_status == 'C'){\n        Roo.MessageBox.alert(\"Error\", \"This order has been closed\");\n        return;\n    }\n    \n    Roo.MessageBox.confirm(\"Confirm\", \"Are you sure?\",\n        function(v) {\n            if (v != 'yes') {\n                return;\n            }\n            new Pman.Request({\n                url: baseURL + '/Roo/cohead',\n                method : 'POST',\n                params :  {\n                    cohead_id : s.data.cohead_id,\n                    _close : 1\n                },\n                mask : 'Sending',\n                success : function()\n                {\n                    Roo.MessageBox.alert(\"Notice\", \"DONE\");\n                    _this.grid.footer.onClick('first');\n                }\n           });\n        }\n    );\n    \n    \n}\n"
338              },
339              "text" : "Complete and Close",
340              "xtype" : "Button",
341              "cls" : "x-btn-text-icon",
342              "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'",
343              "$ xns" : "Roo.Toolbar"
344             },
345             {
346              "listeners" : {
347               "|click" : "function()\n{\n    \n    new Pman.Request({\n        url: baseURL + '/Roo/cohead',\n        method : 'POST',\n        params :  {\n            _clearUnpaid : 1\n        },\n        mask : 'Clearing',\n        success : function()\n        {\n            Roo.MessageBox.alert(\"Notice\", \"DONE\");\n            _this.grid.footer.onClick('first');\n        }\n   });\n    \n}\n"
348              },
349              "text" : "Clear Unpaid Orders",
350              "xtype" : "Button",
351              "cls" : "x-btn-text-icon",
352              "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'",
353              "$ xns" : "Roo.Toolbar"
354             },
355             {
356              "xtype" : "Fill",
357              "$ xns" : "Roo.Toolbar"
358             },
359             {
360              "listeners" : {
361               "|click" : "function()\n{\n   // check if the login in user have more than 25 open orders..\n   // if yes, warning...\n   new Pman.Request({\n        url : baseURL + '/Roo/cohead.php',\n        method :'GET',\n        params : {\n            viewtype : 'MYOPEN',\n            _count_order : 1 // make the search faster!\n        },\n        success : function(res) {\n            if(res.data[0].order_totals * 1 > 25){\n                Roo.MessageBox.alert(\"Warning\", \"Can you please close old orders before creating new ones\");\n            }\n        }\n    });\n   \n   Pman.Dialog.XtupleSalesOrderNew.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
362              },
363              "text" : "Add",
364              "xtype" : "Button",
365              "cls" : "x-btn-text-icon",
366              "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
367              "$ xns" : "Roo.Toolbar"
368             },
369             {
370              "listeners" : {
371               "|click" : "function()\n{\n   var s = _this.grid.getSelectionModel().getSelected();\n   if (!s) {\n        Roo.MessageBox.alert(\"Error\", \"Select an order to copy\");\n        return;\n   }\n   \n   \n   Pman.Dialog.XtupleSalesOrderCopy.show( { _copy_cohead_id : s.data.cohead_id } , function(data) {\n   \n        // get the id from the data, then \n   \n        _this.grid.footer.onClick('first');\n        Pman.Tab.XtupleSales.grid.footer.onClick('first');\n        // get the id from the data, then start editing it..\n        Roo.log(data);\n            _this.dialog.show(data,  function() {\n            _this.grid.footer.onClick('refresh');\n            Pman.Tab.XtupleSales.grid.footer.onClick('first');\n        }); \n        \n   }); \n}\n"
372              },
373              "text" : "Copy",
374              "xtype" : "Button",
375              "cls" : "x-btn-text-icon",
376              "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
377              "$ xns" : "Roo.Toolbar"
378             }
379            ]
380           },
381           {
382            "xtype" : "ColumnModel",
383            "sortable" : true,
384            "header" : "Ordered",
385            "width" : 75,
386            "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
387            "$ xns" : "Roo.grid",
388            "* prop" : "colModel[]",
389            "dataIndex" : "cohead_orderdate",
390            "# builderCfg" : "{\"table\":\"cohead\",\"column\":\"cohead_orderdate\",\"columnshort\":\"cohead_orderdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ordered\"}"
391           },
392           {
393            "hidden" : true,
394            "xtype" : "ColumnModel",
395            "sortable" : true,
396            "header" : "Target Delivery",
397            "width" : 75,
398            "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
399            "$ xns" : "Roo.grid",
400            "* prop" : "colModel[]",
401            "dataIndex" : "cohead_targetdate"
402           },
403           {
404            "xtype" : "ColumnModel",
405            "sortable" : true,
406            "header" : "Staff IC.",
407            "width" : 100,
408            "$ renderer" : "function(v,x,r) { \n\n    if (r.data.cohead_display_salesrep_id) {\n        return String.format('{0} ({1})', v, r.data.cohead_display_salesrep_id_salesrep_name);\n    }\n    return String.format('{0}', v );\n    \n    \n }",
409            "$ xns" : "Roo.grid",
410            "* prop" : "colModel[]",
411            "dataIndex" : "cohead_salesrep_id_salesrep_name",
412            "# builderCfg" : "{\"table\":\"cohead\",\"column\":\"cohead_orderdate\",\"columnshort\":\"cohead_orderdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ordered\"}"
413           },
414           {
415            "xtype" : "ColumnModel",
416            "sortable" : true,
417            "header" : "#order",
418            "width" : 100,
419            "$ renderer" : "function(v,x,r) {\n\n      \n      // we want to show more detail about status..\n      // like payment status / delivery etc...\n      \n      // I = invoiced\n      // R = Reserved\n      // S = shipped (or partial shipped)\n      // P = paid (or partial paid)\n      // online payment failed? >> on terms?\n      // \n      var tags = {\n        invoiced : '<span class=\"dragon-so-complete\" qtip=\"Invoiced\">I</span>',\n        invoiced_not : '<span class=\"dragon-so-complete-not\"  qtip=\"Not Invoiced\">I</span>',\n        stock_not : '<span class=\"dragon-so-complete-not\" qtip=\"Stock not reserved or shipped\">S</span>',        \n        stock_reserved : '<span class=\"dragon-so-complete-part\" qtip=\"Stock Reserved / Not shipped\">R</span>',\n        stock_shipped : '<span class=\"dragon-so-complete\" qtip=\"Shipped\">S</span>',\n        paid : '<span class=\"dragon-so-complete\" qtip=\"Paid\">P</span>',\n        paid_not : '<span class=\"dragon-so-complete-not\" qtip=\"Not Paid\">P</span>'\n    };        \n     \n     // invoiced\n     var tg = '';\n     \n       // stock status...\n     if (r.data.cohead_qtyunshipped > 0) {\n          \n          tg +=  (r.data.shipitem_qty*1 > 0)  ? tags.stock_reserved :tags.stock_not;\n     }     else {\n     \n         tg +=  tags.stock_shipped;\n    }\n     \n     tg += (r.data.cohead_qtyuninvoiced > 0) ? tags.invoiced_not : tags.invoiced;\n     // ?? partially invoiced??\n     \n     \n     if (r.data.cohead_qtyuninvoiced*1 < 1) {\n          tg += (r.data.aropen_unpaid*1 > 0) ? tags.paid_not : tags.paid;\n      }\n     \n     \n     \n    // payment status??\n\n      if (r.data.cohead_status == 'C') {\n          return tg + ' ' + String.format('<i qtip=\"closed\">{0}</i>', v); \n      }\n      if (r.data.cohead_status == 'X') {\n          return tg + ' ' +  String.format('<s qtip=\"void\">{0}</s>', v)  ; \n      }\n      return tg + ' ' + String.format('{0}', v); \n }",
420            "$ xns" : "Roo.grid",
421            "* prop" : "colModel[]",
422            "dataIndex" : "cohead_number"
423           },
424           {
425            "xtype" : "ColumnModel",
426            "sortable" : true,
427            "header" : "Customer#",
428            "width" : 100,
429            "$ renderer" : "function(v) { return String.format('{0}', v); }",
430            "$ xns" : "Roo.grid",
431            "* prop" : "colModel[]",
432            "dataIndex" : "cohead_cust_id_cust_number",
433            "# builderCfg" : "{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"}"
434           },
435           {
436            "xtype" : "ColumnModel",
437            "sortable" : true,
438            "header" : "Customer",
439            "width" : 200,
440            "$ renderer" : "function(v) { return String.format('{0}', v); }",
441            "$ xns" : "Roo.grid",
442            "* prop" : "colModel[]",
443            "dataIndex" : "cohead_cust_id_cust_name",
444            "# builderCfg" : "{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"}"
445           },
446           {
447            "xtype" : "ColumnModel",
448            "header" : "Cust. PO#",
449            "width" : 50,
450            "$ renderer" : "function(v) { return String.format('{0}', v); }",
451            "$ xns" : "Roo.grid",
452            "* prop" : "colModel[]",
453            "dataIndex" : "cohead_custponumber",
454            "# builderCfg" : "{\"table\":\"cohead\",\"column\":\"cohead_custponumber\",\"columnshort\":\"cohead_custponumber\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Cust. PO#\"}"
455           },
456           {
457            "xtype" : "ColumnModel",
458            "header" : "Type",
459            "width" : 50,
460            "$ renderer" : "function(v) { return String.format('{0}', v); }",
461            "$ xns" : "Roo.grid",
462            "* prop" : "colModel[]",
463            "dataIndex" : "cohead_type",
464            "# builderCfg" : "{\"table\":\"cohead\",\"column\":\"cohead_type\",\"columnshort\":\"cohead_type\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Type\"}"
465           },
466           {
467            "xtype" : "ColumnModel",
468            "header" : "From",
469            "width" : 100,
470            "$ renderer" : "function(v) { return String.format('{0}', v); }",
471            "$ xns" : "Roo.grid",
472            "* prop" : "colModel[]",
473            "dataIndex" : "cohead_src_locations"
474           },
475           {
476            "xtype" : "ColumnModel",
477            "header" : "Ship to",
478            "width" : 200,
479            "$ renderer" : "function(v) { return String.format('{0}', v); }",
480            "$ xns" : "Roo.grid",
481            "* prop" : "colModel[]",
482            "dataIndex" : "cohead_shiptoaddress1",
483            "# builderCfg" : "{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_name\",\"columnshort\":\"shipto_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ship to\"}"
484           },
485           {
486            "xtype" : "ColumnModel",
487            "header" : "Terms",
488            "width" : 100,
489            "$ renderer" : "function(v) { return String.format('{0}', v); }",
490            "$ xns" : "Roo.grid",
491            "* prop" : "colModel[]",
492            "dataIndex" : "cohead_terms_id_terms_descrip",
493            "# builderCfg" : "{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_descrip\",\"columnshort\":\"terms_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Terms\"}"
494           },
495           {
496            "hidden" : true,
497            "xtype" : "ColumnModel",
498            "header" : "Notes",
499            "width" : 100,
500            "$ renderer" : "function(v) { return String.format('{0}', v); }",
501            "$ xns" : "Roo.grid",
502            "* prop" : "colModel[]",
503            "dataIndex" : "cohead_ordercomments"
504           },
505           {
506            "align" : "right",
507            "xtype" : "ColumnModel",
508            "header" : "Total",
509            "width" : 100,
510            "$ renderer" : "function(v,x,r) { \n    var ret =  String.format('{0} {1}',\n         r.data.cohead_curr_id_curr_name, v ?   parseFloat(v).toFixed(3) : '---'\n     ); \n     \n     if (parseInt(r.data.cohead_qtyordered)  != 0 && \n        parseInt(r.data.cohead_unshipped) == 0 && \n         parseInt(r.data.cohead_qtyunshipped) == 0 &&\n         parseInt(r.data.cohead_qtyuninvoiced) == 0 &&         \n          parseInt(r.data.cohead_unshipped) == 0 &&\n         parseInt(r.data.cohead_uninvoiced) == 0 \n     ) {\n        return ret;\n    }\n     \n     return String.format('<b style=\"color:red\" ' + \n            'qtip=\"Products: {3} ({4}) &lt;BR/&gt;Unshipped: {1} ({5})&lt;BR&gt;Uninvoiced: {2} ({6})\">{0}</b>',\n         ret, \n            r.data.cohead_unshipped, r.data.cohead_uninvoiced, r.data.cohead_subtotal,\n            r.data.cohead_qtyordered, r.data.cohead_qtyunshipped, r.data.cohead_qtyuninvoiced\n         );\n     \n }",
511            "$ xns" : "Roo.grid",
512            "* prop" : "colModel[]",
513            "dataIndex" : "cohead_total"
514           }
515          ]
516         }
517        ]
518       },
519       {
520        "background" : false,
521        "region" : "west",
522        "xtype" : "ContentPanel",
523        "$ xns" : "Roo",
524        "items" : [
525         {
526          "xtype" : "Toolbar",
527          "$ xns" : "Roo",
528          "* prop" : "toolbar",
529          "items" : [
530           {
531            "xtype" : "Fill",
532            "$ xns" : "Roo.Toolbar"
533           },
534           {
535            "listeners" : {
536             "|click" : "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
537            },
538            "xtype" : "Button",
539            "cls" : "x-btn-icon",
540            "$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
541            "$ xns" : "Roo.Toolbar"
542           },
543           {
544            "listeners" : {
545             "|click" : "function (_self, e)\n{\n    _this.form.reset('');\n\n    \n    _this.grid.footer.onClick('first');\n}"
546            },
547            "xtype" : "Button",
548            "cls" : "x-btn-icon",
549            "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
550            "$ xns" : "Roo.Toolbar"
551           }
552          ]
553         },
554         {
555          "listeners" : {
556           "|rendered" : "function (form)\n{\n    _this.form= form;\n}\n"
557          },
558          "labelAlign" : "top",
559          "style" : "margin:5px;",
560          "method" : "POST",
561          "xtype" : "Form",
562          "$ xns" : "Roo.form",
563          "items" : [
564           {
565            "listeners" : {
566             "|render" : "function (_self)\n{\n  _this.viewtypeSel = _self;\n}",
567             "|select" : "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n}"
568            },
569            "listWidth" : 200,
570            "triggerAction" : "all",
571            "fieldLabel" : "View",
572            "forceSelection" : true,
573            "selectOnFocus" : true,
574            "pageSize" : 20,
575            "displayField" : "value",
576            "emptyText" : "View type",
577            "minChars" : 2,
578            "value" : "MYOPEN",
579            "valueField" : "key",
580            "xtype" : "ComboBox",
581            "allowBlank" : false,
582            "typeAhead" : true,
583            "editable" : false,
584            "width" : 150,
585            "$ xns" : "Roo.form",
586            "name" : "viewtype",
587            "qtip" : "Select Action",
588            "queryParam" : "query[action]",
589            "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{value}</b> </div>",
590            "loadingText" : "Searching...",
591            "items" : [
592             {
593              "id" : 0,
594              "xtype" : "SimpleStore",
595              "$ data" : "[\n  [ 'MYOPEN', 'My Open orders' ],\n  [ 'MYCLOSED', 'My Closed orders' ],\n  [ 'MYALL', 'My orders (all)' ],    \n  [ 'MYVOID', 'My Voided orders' ],      \n  [ 'OPEN', 'All Open orders' ],\n  [ 'NOTSHIPPED', 'All Un-shipped orders' ],\n  [ 'NOTPAID', 'All Un-paid orders' ],\n  [ 'PAIDNOTSHIPPED', 'All paid / not shipped orders' ],  \n  [ 'CLOSED', 'All Closed orders' ],\n  \n  [ 'ALL', 'All orders' ],\n  [ 'VOID', 'Voided orders' ],\n  [ 'INCOMPLETE', 'Incomplete orders' ],  \n  [ 'DRAFTSHIP', 'Have Un-confirmed Shipments' ],\n//  [ 'SHIPPOSTBUG', 'Bugs with Posted transactions' ],  \n//  [ 'SHIPQTYBUG', 'Bugs with Shipment Qty' ] ,\n  [ 'FIFOBUG', 'Problems with FIFO' ] \n    \n]",
596              "$ fields" : "[ 'key', 'value' ]",
597              "$ xns" : "Roo.data",
598              "* prop" : "store"
599             }
600            ]
601           },
602           {
603            "listeners" : {
604             "specialkey" : "function (_self, e)\n{\n    //Roo.log(e.getKey());\n    if (e.getKey() == 13) {\n        (function() { _this.grid.footer.onClick('first'); }).defer(100);\n        e.stopEvent();\n        _this.rsearch = true;\n    }\n    \n}",
605             "beforequery" : "function (combo, query, forceAll, cancel, e)\n{\n \n   if( _this.rsearch) {\n        _this.rsearch =false;\n        return false;\n    }\n \n}",
606             "select" : "function (combo, record, index)\n{\n    (function() { _this.grid.footer.onClick('first'); }).defer(100);\n}"
607            },
608            "listWidth" : 400,
609            "triggerAction" : "all",
610            "fieldLabel" : "Order #",
611            "forceSelection" : false,
612            "selectOnFocus" : true,
613            "pageSize" : 20,
614            "displayField" : "cohead_number",
615            "emptyText" : "Select Order",
616            "minChars" : 2,
617            "valueField" : "cohead_number",
618            "xtype" : "ComboBox",
619            "allowBlank" : true,
620            "typeAhead" : false,
621            "editable" : true,
622            "width" : 180,
623            "$ xns" : "Roo.form",
624            "name" : "query[cohead_number]",
625            "qtip" : "Select Order",
626            "queryParam" : "query[cohead_number]",
627            "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{cohead_number}</b> </div>",
628            "loadingText" : "Searching...",
629            "items" : [
630             {
631              "listeners" : {
632               "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    o.params['_columns'] = 'cohead_number';\n    // set more here\n}\n"
633              },
634              "xtype" : "Store",
635              "remoteSort" : true,
636              "$ sortInfo" : "{ direction : 'ASC', field: 'cohead_number' }",
637              "$ xns" : "Roo.data",
638              "* prop" : "store",
639              "items" : [
640               {
641                "$ url" : "baseURL + '/Roo/cohead.php'",
642                "xtype" : "HttpProxy",
643                "method" : "GET",
644                "$ xns" : "Roo.data",
645                "* prop" : "proxy"
646               },
647               {
648                "id" : "cohead_number",
649                "root" : "data",
650                "xtype" : "JsonReader",
651                "$ fields" : "[\"cohead_number\"]",
652                "$ xns" : "Roo.data",
653                "* prop" : "reader",
654                "totalProperty" : "total"
655               }
656              ]
657             }
658            ]
659           },
660           {
661            "listeners" : {
662             "select" : "function (combo, record, index)\n{\n       (function() { _this.grid.footer.onClick('first'); }).defer(100);\n}"
663            },
664            "listWidth" : 400,
665            "triggerAction" : "all",
666            "fieldLabel" : "Customer",
667            "forceSelection" : true,
668            "selectOnFocus" : true,
669            "pageSize" : 20,
670            "displayField" : "cust_name",
671            "emptyText" : "Select custinfo",
672            "hiddenName" : "cohead_cust_id",
673            "minChars" : 2,
674            "valueField" : "cust_id",
675            "xtype" : "ComboBox",
676            "allowBlank" : true,
677            "typeAhead" : false,
678            "editable" : true,
679            "width" : 180,
680            "$ xns" : "Roo.form",
681            "name" : "cohead_cust_id_cust_name",
682            "qtip" : "Select custinfo",
683            "queryParam" : "query[cust_name]",
684            "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b>  ({cust_number})</div>",
685            "loadingText" : "Searching...",
686            "items" : [
687             {
688              "listeners" : {
689               "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
690              },
691              "xtype" : "Store",
692              "remoteSort" : true,
693              "$ sortInfo" : "{ direction : 'ASC', field: 'cust_name' }",
694              "$ xns" : "Roo.data",
695              "* prop" : "store",
696              "items" : [
697               {
698                "$ url" : "baseURL + '/Roo/custinfo.php'",
699                "method" : "GET",
700                "xtype" : "HttpProxy",
701                "$ xns" : "Roo.data",
702                "* prop" : "proxy"
703               },
704               {
705                "id" : "cust_id",
706                "root" : "data",
707                "xtype" : "JsonReader",
708                "$ xns" : "Roo.data",
709                "$ fields" : "[{\"name\":\"cust_id\",\"type\":\"int\"},\"cust_name\"]",
710                "* prop" : "reader",
711                "totalProperty" : "total"
712               }
713              ]
714             }
715            ]
716           },
717           {
718            "listeners" : {
719             "select" : "function (combo, date)\n{\n    _this.grid.footer.onClick('first');\n}"
720            },
721            "fieldLabel" : "From",
722            "format" : "Y-m-d",
723            "xtype" : "DateField",
724            "width" : 100,
725            "$ xns" : "Roo.form",
726            "name" : "_fromdate"
727           },
728           {
729            "listeners" : {
730             "select" : "function (combo, date)\n{\n    _this.grid.footer.onClick('first');\n}"
731            },
732            "fieldLabel" : "To",
733            "format" : "Y-m-d",
734            "xtype" : "DateField",
735            "width" : 100,
736            "$ xns" : "Roo.form",
737            "name" : "_todate"
738           }
739          ]
740         }
741        ]
742       }
743      ]
744     }
745    ]
746   }
747  ]
748 }