Pman.Tab.XtupleSalesOrder.bjs
[Pman.Xtuple] / Pman.Tab.XtupleSalesOrder.bjs
1 {
2     "id": "roo-file-390",
3     "name": "Pman.Tab.XtupleSalesOrder",
4     "parent": "Pman.Tab.XtupleSales",
5     "title": "",
6     "path": "/home/alan/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleSalesOrder.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "activate": "function (_self)\n{\n    this.setTitle('Sales Orders (' + Pman.Login.authUser.dbname +')');\n}"
11             },
12             "region": "center",
13             "title": "Sales Orders",
14             "xtype": "NestedLayoutPanel",
15             "|xns": "Roo",
16             "items": [
17                 {
18                     "xtype": "BorderLayout",
19                     "|xns": "Roo",
20                     "*prop": "layout",
21                     "items": [
22                         {
23                             "xtype": "LayoutRegion",
24                             "|xns": "Roo",
25                             "*prop": "west",
26                             "width": "200",
27                             "split": true,
28                             "title": "Search"
29                         },
30                         {
31                             "xtype": "LayoutRegion",
32                             "|xns": "Roo",
33                             "*prop": "center"
34                         },
35                         {
36                             "listeners": {
37                                 "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
38                             },
39                             ".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\"}",
40                             "background": true,
41                             "fitContainer": true,
42                             "fitToframe": true,
43                             "region": "center",
44                             "tableName": "cohead",
45                             "title": "cohead",
46                             "xtype": "GridPanel",
47                             "|xns": "Roo",
48                             "items": [
49                                 {
50                                     "listeners": {
51                                         "|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}",
52                                         "|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"
53                                     },
54                                     "*prop": "grid",
55                                     "autoExpandColumn": "cohead_cust_id_cust_name",
56                                     "loadMask": true,
57                                     "xtype": "Grid",
58                                     "|xns": "Roo.grid",
59                                     "items": [
60                                         {
61                                             "listeners": {
62                                                 "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}"
63                                             },
64                                             "*prop": "dataSource",
65                                             ".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\"}",
66                                             "remoteSort": true,
67                                             "xtype": "Store",
68                                             "|sortInfo": "{ field : 'cohead_orderdate', direction: 'DESC' }",
69                                             "|xns": "Roo.data",
70                                             "items": [
71                                                 {
72                                                     "*prop": "proxy",
73                                                     "method": "GET",
74                                                     "timeout": 60000,
75                                                     "xtype": "HttpProxy",
76                                                     "|url": "baseURL + '/Roo/cohead.php'",
77                                                     "|xns": "Roo.data"
78                                                 },
79                                                 {
80                                                     "|xns": "Roo.data",
81                                                     "xtype": "JsonReader",
82                                                     "totalProperty": "total",
83                                                     "root": "data",
84                                                     ".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\"}",
85                                                     "*prop": "reader",
86                                                     "id": "id",
87                                                     "|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]"
88                                                 }
89                                             ]
90                                         },
91                                         {
92                                             "*prop": "footer",
93                                             "xtype": "PagingToolbar",
94                                             "pageSize": 25,
95                                             "displayInfo": true,
96                                             "displayMsg": "Displaying cohead{0} - {1} of {2}",
97                                             "emptyMsg": "No cohead found",
98                                             "|xns": "Roo",
99                                             "items": [
100                                                 {
101                                                     "listeners": {
102                                                         "click": "function ()\n{\n    new Pman.Download({\n        grid : _this.grid\n    });     \n   \n}"
103                                                     },
104                                                     "cls": "x-btn-text-icon",
105                                                     "text": "Download Results",
106                                                     "xtype": "Button",
107                                                     "|icon": "rootURL + '/Pman/templates/images/spreadsheet.gif'",
108                                                     "|xns": "Roo.Toolbar"
109                                                 }
110                                             ]
111                                         },
112                                         {
113                                             "*prop": "toolbar",
114                                             "xtype": "Toolbar",
115                                             "|xns": "Roo",
116                                             "items": [
117                                                 {
118                                                     "listeners": {
119                                                         "click": "function (_self, e)\n{\n Pman.Dialog.XtupleInvHistory.show({\n \n \n    });\n}"
120                                                     },
121                                                     "text": "Quick Stock Check",
122                                                     "xtype": "Button",
123                                                     "|xns": "Roo.Toolbar"
124                                                 },
125                                                 {
126                                                     "listeners": {
127                                                         "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}"
128                                                     },
129                                                     "text": "Magento Upload",
130                                                     "xtype": "Button",
131                                                     "|xns": "Roo.Toolbar"
132                                                 },
133                                                 {
134                                                     "cls": "x-btn-text-icon",
135                                                     "text": "Reports",
136                                                     "xtype": "Button",
137                                                     "|icon": "rootURL + '/Pman/templates/images/spreadsheet.gif'",
138                                                     "|xns": "Roo.Toolbar",
139                                                     "items": [
140                                                         {
141                                                             "|xns": "Roo.menu",
142                                                             "xtype": "Menu",
143                                                             "*prop": "menu",
144                                                             "items": [
145                                                                 {
146                                                                     "text": "AR Aging",
147                                                                     "xtype": "Item",
148                                                                     "|xns": "Roo.menu",
149                                                                     "items": [
150                                                                         {
151                                                                             "|xns": "Roo.menu",
152                                                                             "xtype": "Menu",
153                                                                             "*prop": "menu",
154                                                                             "items": [
155                                                                                 {
156                                                                                     "listeners": {
157                                                                                         "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}"
158                                                                                     },
159                                                                                     "text": "as PDF",
160                                                                                     "xtype": "Item",
161                                                                                     "|xns": "Roo.menu"
162                                                                                 },
163                                                                                 {
164                                                                                     "listeners": {
165                                                                                         "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}"
166                                                                                     },
167                                                                                     "text": "as Excel",
168                                                                                     "xtype": "Item",
169                                                                                     "|xns": "Roo.menu"
170                                                                                 },
171                                                                                 {
172                                                                                     "listeners": {
173                                                                                         "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}"
174                                                                                     },
175                                                                                     "text": "Summary Excel",
176                                                                                     "xtype": "Item",
177                                                                                     "|xns": "Roo.menu"
178                                                                                 }
179                                                                             ]
180                                                                         }
181                                                                     ]
182                                                                 },
183                                                                 {
184                                                                     "text": "Customer History",
185                                                                     "xtype": "Item",
186                                                                     "|xns": "Roo.menu",
187                                                                     "items": [
188                                                                         {
189                                                                             "|xns": "Roo.menu",
190                                                                             "xtype": "Menu",
191                                                                             "*prop": "menu",
192                                                                             "items": [
193                                                                                 {
194                                                                                     "listeners": {
195                                                                                         "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}"
196                                                                                     },
197                                                                                     "text": "as PDF",
198                                                                                     "xtype": "Item",
199                                                                                     "|xns": "Roo.menu"
200                                                                                 },
201                                                                                 {
202                                                                                     "listeners": {
203                                                                                         "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}"
204                                                                                     },
205                                                                                     "text": "as Excel",
206                                                                                     "xtype": "Item",
207                                                                                     "|xns": "Roo.menu"
208                                                                                 }
209                                                                             ]
210                                                                         }
211                                                                     ]
212                                                                 },
213                                                                 {
214                                                                     "text": "Customer Statement",
215                                                                     "xtype": "Item",
216                                                                     "|xns": "Roo.menu",
217                                                                     "items": [
218                                                                         {
219                                                                             "|xns": "Roo.menu",
220                                                                             "xtype": "Menu",
221                                                                             "*prop": "menu",
222                                                                             "items": [
223                                                                                 {
224                                                                                     "listeners": {
225                                                                                         "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}"
226                                                                                     },
227                                                                                     "text": "as PDF",
228                                                                                     "xtype": "Item",
229                                                                                     "|xns": "Roo.menu"
230                                                                                 },
231                                                                                 {
232                                                                                     "listeners": {
233                                                                                         "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}"
234                                                                                     },
235                                                                                     "text": "as Excel",
236                                                                                     "xtype": "Item",
237                                                                                     "|xns": "Roo.menu"
238                                                                                 }
239                                                                             ]
240                                                                         }
241                                                                     ]
242                                                                 }
243                                                             ]
244                                                         }
245                                                     ]
246                                                 },
247                                                 {
248                                                     "listeners": {
249                                                         "|click": "function (_self, e)\n{\n    var s = _this.grid.getSelectionModel().getSelected();\n    if (!s) {\n        Roo.MessageBox.alert(\"Error\", \"Select an order\");\n        return;\n    }\n    \n    new Pman.Download({\r\n      url : baseURL + '/Xtuple/Reports/SalesOrderBookingDetail',\r\n      params :   {\n        cohead_id : s.data.cohead_id\n      },\r\n      method : 'GET'\r\n    });\r\n    \n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
250                                                     },
251                                                     "cls": "x-btn-text-icon",
252                                                     "text": "Email to warehouse",
253                                                     "xtype": "Button",
254                                                     "|icon": "Roo.rootURL + 'images/default/dd/email.gif'",
255                                                     "|xns": "Roo.Toolbar"
256                                                 },
257                                                 {
258                                                     "listeners": {
259                                                         "|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    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"
260                                                     },
261                                                     "cls": "x-btn-text-icon",
262                                                     "text": "Complete and Close",
263                                                     "xtype": "Button",
264                                                     "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
265                                                     "|xns": "Roo.Toolbar"
266                                                 },
267                                                 {
268                                                     "xtype": "Fill",
269                                                     "|xns": "Roo.Toolbar"
270                                                 },
271                                                 {
272                                                     "listeners": {
273                                                         "|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"
274                                                     },
275                                                     "cls": "x-btn-text-icon",
276                                                     "text": "Add",
277                                                     "xtype": "Button",
278                                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
279                                                     "|xns": "Roo.Toolbar"
280                                                 },
281                                                 {
282                                                     "listeners": {
283                                                         "|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"
284                                                     },
285                                                     "cls": "x-btn-text-icon",
286                                                     "text": "Copy",
287                                                     "xtype": "Button",
288                                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
289                                                     "|xns": "Roo.Toolbar"
290                                                 }
291                                             ]
292                                         },
293                                         {
294                                             "*prop": "colModel[]",
295                                             ".builderCfg": "{\"table\":\"cohead\",\"column\":\"cohead_orderdate\",\"columnshort\":\"cohead_orderdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ordered\"}",
296                                             "dataIndex": "cohead_orderdate",
297                                             "header": "Ordered",
298                                             "sortable": true,
299                                             "width": 75,
300                                             "xtype": "ColumnModel",
301                                             "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
302                                             "|xns": "Roo.grid"
303                                         },
304                                         {
305                                             "*prop": "colModel[]",
306                                             "dataIndex": "cohead_targetdate",
307                                             "header": "Target Delivery",
308                                             "hidden": true,
309                                             "sortable": true,
310                                             "width": 75,
311                                             "xtype": "ColumnModel",
312                                             "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
313                                             "|xns": "Roo.grid"
314                                         },
315                                         {
316                                             "*prop": "colModel[]",
317                                             ".builderCfg": "{\"table\":\"cohead\",\"column\":\"cohead_orderdate\",\"columnshort\":\"cohead_orderdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ordered\"}",
318                                             "dataIndex": "cohead_salesrep_id_salesrep_name",
319                                             "header": "Staff IC.",
320                                             "sortable": true,
321                                             "width": 100,
322                                             "xtype": "ColumnModel",
323                                             "|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 }",
324                                             "|xns": "Roo.grid"
325                                         },
326                                         {
327                                             "*prop": "colModel[]",
328                                             "dataIndex": "cohead_number",
329                                             "header": "#order",
330                                             "sortable": true,
331                                             "width": 100,
332                                             "xtype": "ColumnModel",
333                                             "|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</>',\n        invoiced_not : '<span class=\"dragon-so-complete-not\"  qtip=\"Not Invoiced\">I</>',\n        stock_not : '<span class=\"dragon-so-complete-not\" qtip=\"Stock not reserved or shipped\">S</>',        \n        stock_reserved : '<span class=\"dragon-so-complete-not\" qtip=\"Stock Reserved / Not shipped\">R</>',\n        stock_shipped : '<span class=\"dragon-so-complete\" qtip=\"Shipped\">S</>'\n    };        \n      \n      \n      \n      if (r.data.cohead_status == 'C') {\n          return String.format('<i qtip=\"closed\">{0}</i>', v); \n      }\n      if (r.data.cohead_status == 'X') {\n          return String.format('<s qtip=\"void\">{0}</s>', v); \n      }\n      return String.format('{0}', v); \n }",
334                                             "|xns": "Roo.grid"
335                                         },
336                                         {
337                                             "*prop": "colModel[]",
338                                             ".builderCfg": "{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"}",
339                                             "dataIndex": "cohead_cust_id_cust_number",
340                                             "header": "Customer#",
341                                             "sortable": true,
342                                             "width": 100,
343                                             "xtype": "ColumnModel",
344                                             "|renderer": "function(v) { return String.format('{0}', v); }",
345                                             "|xns": "Roo.grid"
346                                         },
347                                         {
348                                             "*prop": "colModel[]",
349                                             ".builderCfg": "{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"}",
350                                             "dataIndex": "cohead_cust_id_cust_name",
351                                             "header": "Customer",
352                                             "sortable": true,
353                                             "width": 200,
354                                             "xtype": "ColumnModel",
355                                             "|renderer": "function(v) { return String.format('{0}', v); }",
356                                             "|xns": "Roo.grid"
357                                         },
358                                         {
359                                             "*prop": "colModel[]",
360                                             ".builderCfg": "{\"table\":\"cohead\",\"column\":\"cohead_custponumber\",\"columnshort\":\"cohead_custponumber\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Cust. PO#\"}",
361                                             "dataIndex": "cohead_custponumber",
362                                             "header": "Cust. PO#",
363                                             "width": 50,
364                                             "xtype": "ColumnModel",
365                                             "|renderer": "function(v) { return String.format('{0}', v); }",
366                                             "|xns": "Roo.grid"
367                                         },
368                                         {
369                                             "*prop": "colModel[]",
370                                             ".builderCfg": "{\"table\":\"cohead\",\"column\":\"cohead_type\",\"columnshort\":\"cohead_type\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Type\"}",
371                                             "dataIndex": "cohead_type",
372                                             "header": "Type",
373                                             "width": 50,
374                                             "xtype": "ColumnModel",
375                                             "|renderer": "function(v) { return String.format('{0}', v); }",
376                                             "|xns": "Roo.grid"
377                                         },
378                                         {
379                                             "*prop": "colModel[]",
380                                             "dataIndex": "cohead_src_locations",
381                                             "header": "From",
382                                             "width": 100,
383                                             "xtype": "ColumnModel",
384                                             "|renderer": "function(v) { return String.format('{0}', v); }",
385                                             "|xns": "Roo.grid"
386                                         },
387                                         {
388                                             "*prop": "colModel[]",
389                                             ".builderCfg": "{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_name\",\"columnshort\":\"shipto_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ship to\"}",
390                                             "dataIndex": "cohead_shiptoaddress1",
391                                             "header": "Ship to",
392                                             "width": 200,
393                                             "xtype": "ColumnModel",
394                                             "|renderer": "function(v) { return String.format('{0}', v); }",
395                                             "|xns": "Roo.grid"
396                                         },
397                                         {
398                                             "*prop": "colModel[]",
399                                             ".builderCfg": "{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_descrip\",\"columnshort\":\"terms_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Terms\"}",
400                                             "dataIndex": "cohead_terms_id_terms_descrip",
401                                             "header": "Terms",
402                                             "width": 100,
403                                             "xtype": "ColumnModel",
404                                             "|renderer": "function(v) { return String.format('{0}', v); }",
405                                             "|xns": "Roo.grid"
406                                         },
407                                         {
408                                             "*prop": "colModel[]",
409                                             "align": "right",
410                                             "dataIndex": "cohead_total",
411                                             "header": "Total",
412                                             "width": 100,
413                                             "xtype": "ColumnModel",
414                                             "|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 }",
415                                             "|xns": "Roo.grid"
416                                         }
417                                     ]
418                                 }
419                             ]
420                         },
421                         {
422                             "background": false,
423                             "region": "west",
424                             "xtype": "ContentPanel",
425                             "|xns": "Roo",
426                             "items": [
427                                 {
428                                     "|xns": "Roo",
429                                     "xtype": "Toolbar",
430                                     "*prop": "toolbar",
431                                     "items": [
432                                         {
433                                             "|xns": "Roo.Toolbar",
434                                             "xtype": "Fill"
435                                         },
436                                         {
437                                             "listeners": {
438                                                 "|click": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
439                                             },
440                                             "cls": "x-btn-icon",
441                                             "xtype": "Button",
442                                             "|icon": "rootURL + '/Pman/templates/images/search.gif'",
443                                             "|xns": "Roo.Toolbar"
444                                         },
445                                         {
446                                             "listeners": {
447                                                 "|click": "function (_self, e)\n{\n    _this.form.reset('');\n\n    \n    _this.grid.footer.onClick('first');\n}"
448                                             },
449                                             "cls": "x-btn-icon",
450                                             "xtype": "Button",
451                                             "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
452                                             "|xns": "Roo.Toolbar"
453                                         }
454                                     ]
455                                 },
456                                 {
457                                     "listeners": {
458                                         "|rendered": "function (form)\n{\n    _this.form= form;\n}\n"
459                                     },
460                                     "labelAlign": "top",
461                                     "method": "POST",
462                                     "style": "margin:5px;",
463                                     "xtype": "Form",
464                                     "|xns": "Roo.form",
465                                     "items": [
466                                         {
467                                             "listeners": {
468                                                 "|select": "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n}",
469                                                 "|render": "function (_self)\n{\n  _this.viewtypeSel = _self;\n}"
470                                             },
471                                             "allowBlank": false,
472                                             "displayField": "value",
473                                             "editable": false,
474                                             "emptyText": "View type",
475                                             "fieldLabel": "View",
476                                             "forceSelection": true,
477                                             "listWidth": 200,
478                                             "loadingText": "Searching...",
479                                             "minChars": 2,
480                                             "name": "viewtype",
481                                             "pageSize": 20,
482                                             "qtip": "Select Action",
483                                             "queryParam": "query[action]",
484                                             "selectOnFocus": true,
485                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{value}</b> </div>",
486                                             "triggerAction": "all",
487                                             "typeAhead": true,
488                                             "value": "MYOPEN",
489                                             "valueField": "key",
490                                             "width": 150,
491                                             "xtype": "ComboBox",
492                                             "|xns": "Roo.form",
493                                             "items": [
494                                                 {
495                                                     "*prop": "store",
496                                                     "id": 0,
497                                                     "xtype": "SimpleStore",
498                                                     "|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  [ 'CLOSED', 'All Closed orders' ],\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]",
499                                                     "|fields": "[ 'key', 'value' ]",
500                                                     "|xns": "Roo.data"
501                                                 }
502                                             ]
503                                         },
504                                         {
505                                             "listeners": {
506                                                 "select": "function (combo, record, index)\n{\n    (function() { _this.grid.footer.onClick('first'); }).defer(100);\n}",
507                                                 "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}",
508                                                 "beforequery": "function (combo, query, forceAll, cancel, e)\n{\n \n   if( _this.rsearch) {\n        _this.rsearch =false;\n        return false;\n    }\n \n}"
509                                             },
510                                             "allowBlank": true,
511                                             "displayField": "cohead_number",
512                                             "editable": true,
513                                             "emptyText": "Select Order",
514                                             "fieldLabel": "Order #",
515                                             "forceSelection": false,
516                                             "listWidth": 400,
517                                             "loadingText": "Searching...",
518                                             "minChars": 2,
519                                             "name": "query[cohead_number]",
520                                             "pageSize": 20,
521                                             "qtip": "Select Order",
522                                             "queryParam": "query[cohead_number]",
523                                             "selectOnFocus": true,
524                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cohead_number}</b> </div>",
525                                             "triggerAction": "all",
526                                             "typeAhead": false,
527                                             "valueField": "cohead_number",
528                                             "width": 180,
529                                             "xtype": "ComboBox",
530                                             "|xns": "Roo.form",
531                                             "items": [
532                                                 {
533                                                     "listeners": {
534                                                         "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    o.params['_columns'] = 'cohead_number';\n    // set more here\n}\n"
535                                                     },
536                                                     "*prop": "store",
537                                                     "remoteSort": true,
538                                                     "xtype": "Store",
539                                                     "|sortInfo": "{ direction : 'ASC', field: 'cohead_number' }",
540                                                     "|xns": "Roo.data",
541                                                     "items": [
542                                                         {
543                                                             "*prop": "proxy",
544                                                             "method": "GET",
545                                                             "xtype": "HttpProxy",
546                                                             "|url": "baseURL + '/Roo/cohead.php'",
547                                                             "|xns": "Roo.data"
548                                                         },
549                                                         {
550                                                             "*prop": "reader",
551                                                             "id": "cohead_number",
552                                                             "root": "data",
553                                                             "totalProperty": "total",
554                                                             "xtype": "JsonReader",
555                                                             "|fields": "[\"cohead_number\"]",
556                                                             "|xns": "Roo.data"
557                                                         }
558                                                     ]
559                                                 }
560                                             ]
561                                         },
562                                         {
563                                             "listeners": {
564                                                 "select": "function (combo, record, index)\n{\n       (function() { _this.grid.footer.onClick('first'); }).defer(100);\n}"
565                                             },
566                                             "allowBlank": true,
567                                             "displayField": "cust_name",
568                                             "editable": true,
569                                             "emptyText": "Select custinfo",
570                                             "fieldLabel": "Customer",
571                                             "forceSelection": true,
572                                             "hiddenName": "cohead_cust_id",
573                                             "listWidth": 400,
574                                             "loadingText": "Searching...",
575                                             "minChars": 2,
576                                             "name": "cohead_cust_id_cust_name",
577                                             "pageSize": 20,
578                                             "qtip": "Select custinfo",
579                                             "queryParam": "query[cust_name]",
580                                             "selectOnFocus": true,
581                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b>  ({cust_number})</div>",
582                                             "triggerAction": "all",
583                                             "typeAhead": false,
584                                             "valueField": "cust_id",
585                                             "width": 180,
586                                             "xtype": "ComboBox",
587                                             "|xns": "Roo.form",
588                                             "items": [
589                                                 {
590                                                     "*prop": "store",
591                                                     "|xns": "Roo.data",
592                                                     "|sortInfo": "{ direction : 'ASC', field: 'cust_name' }",
593                                                     "xtype": "Store",
594                                                     "remoteSort": true,
595                                                     "listeners": {
596                                                         "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
597                                                     },
598                                                     "items": [
599                                                         {
600                                                             "*prop": "proxy",
601                                                             "xtype": "HttpProxy",
602                                                             "method": "GET",
603                                                             "|xns": "Roo.data",
604                                                             "|url": "baseURL + '/Roo/custinfo.php'"
605                                                         },
606                                                         {
607                                                             "*prop": "reader",
608                                                             "xtype": "JsonReader",
609                                                             "|xns": "Roo.data",
610                                                             "id": "cust_id",
611                                                             "root": "data",
612                                                             "totalProperty": "total",
613                                                             "|fields": "[{\"name\":\"cust_id\",\"type\":\"int\"},\"cust_name\"]"
614                                                         }
615                                                     ]
616                                                 }
617                                             ]
618                                         },
619                                         {
620                                             "listeners": {
621                                                 "select": "function (combo, date)\n{\n    _this.grid.footer.onClick('first');\n}"
622                                             },
623                                             "fieldLabel": "From",
624                                             "format": "Y-m-d",
625                                             "name": "_fromdate",
626                                             "width": 100,
627                                             "xtype": "DateField",
628                                             "|xns": "Roo.form"
629                                         },
630                                         {
631                                             "listeners": {
632                                                 "select": "function (combo, date)\n{\n    _this.grid.footer.onClick('first');\n}"
633                                             },
634                                             "fieldLabel": "To",
635                                             "format": "Y-m-d",
636                                             "name": "_todate",
637                                             "width": 100,
638                                             "xtype": "DateField",
639                                             "|xns": "Roo.form"
640                                         }
641                                     ]
642                                 }
643                             ]
644                         }
645                     ]
646                 }
647             ]
648         }
649     ],
650     "permname": "",
651     "modOrder": "001"
652 }