{ "id": "roo-file-68", "name": "Pman.Tab.XtupleSalesOrder", "parent": "Pman.Tab.XtupleSales", "title": "", "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleSalesOrder.bjs", "items": [ { "listeners": { "activate": "function (_self)\n{\n this.setTitle('Sales Orders (' + Pman.Login.authUser.dbname +')');\n}" }, "region": "center", "title": "Sales Orders", "xtype": "NestedLayoutPanel", "|xns": "Roo", "items": [ { "xtype": "BorderLayout", "|xns": "Roo", "*prop": "layout", "items": [ { "xtype": "LayoutRegion", "|xns": "Roo", "*prop": "west", "width": "200", "split": true, "title": "Search" }, { "xtype": "LayoutRegion", "|xns": "Roo", "*prop": "center" }, { "listeners": { "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}" }, ".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\"}", "background": true, "fitContainer": true, "fitToframe": true, "region": "center", "tableName": "cohead", "title": "cohead", "xtype": "GridPanel", "|xns": "Roo", "items": [ { "listeners": { "|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}", "|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" }, "*prop": "grid", "autoExpandColumn": "cohead_cust_id_cust_name", "loadMask": true, "xtype": "Grid", "|xns": "Roo.grid", "items": [ { "listeners": { "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}" }, "*prop": "dataSource", ".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\"}", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ field : 'cohead_orderdate', direction: 'DESC' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "method": "GET", "timeout": 60000, "xtype": "HttpProxy", "|url": "baseURL + '/Roo/cohead.php'", "|xns": "Roo.data" }, { "|xns": "Roo.data", "xtype": "JsonReader", "totalProperty": "total", "root": "data", ".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\"}", "*prop": "reader", "id": "id", "|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]" } ] }, { "*prop": "footer", "xtype": "PagingToolbar", "pageSize": 25, "displayInfo": true, "displayMsg": "Displaying cohead{0} - {1} of {2}", "emptyMsg": "No cohead found", "|xns": "Roo", "items": [ { "listeners": { "click": "function ()\n{\n new Pman.Download({\n grid : _this.grid,\n newWindow : true,\n timeout : 6000000,\n method : 'POST'\n }); \n \n}" }, "cls": "x-btn-text-icon", "text": "Download Results", "xtype": "Button", "|icon": "rootURL + '/Pman/templates/images/spreadsheet.gif'", "|xns": "Roo.Toolbar" } ] }, { "*prop": "toolbar", "xtype": "Toolbar", "|xns": "Roo", "items": [ { "listeners": { "click": "function (_self, e)\n{\n Pman.Dialog.XtupleInvHistory.show({\n \n \n });\n}" }, "text": "Quick Stock Check", "xtype": "Button", "|xns": "Roo.Toolbar" }, { "text": "Import", "xtype": "Button", "|xns": "Roo.Toolbar", "items": [ { "|xns": "Roo.menu", "xtype": "Menu", "*prop": "menu", "items": [ { "listeners": { "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}" }, "text": "Magento Upload", "xtype": "Item", "|xns": "Roo.menu" }, { "listeners": { "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}" }, "text": "Import HSBC csv file", "xtype": "Item", "|xns": "Roo.menu" }, { "listeners": { "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}" }, "text": "Import Waybill Delivery", "xtype": "Item", "|xns": "Roo.menu" } ] } ] }, { "cls": "x-btn-text-icon", "text": "Reports", "xtype": "Button", "|icon": "rootURL + '/Pman/templates/images/spreadsheet.gif'", "|xns": "Roo.Toolbar", "items": [ { "|xns": "Roo.menu", "xtype": "Menu", "*prop": "menu", "items": [ { "text": "AR Aging", "xtype": "Item", "|xns": "Roo.menu", "items": [ { "|xns": "Roo.menu", "xtype": "Menu", "*prop": "menu", "items": [ { "listeners": { "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}" }, "text": "as PDF", "xtype": "Item", "|xns": "Roo.menu" }, { "listeners": { "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}" }, "text": "as Excel", "xtype": "Item", "|xns": "Roo.menu" }, { "listeners": { "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}" }, "text": "Summary Excel", "xtype": "Item", "|xns": "Roo.menu" } ] } ] }, { "text": "Customer History", "xtype": "Item", "|xns": "Roo.menu", "items": [ { "|xns": "Roo.menu", "xtype": "Menu", "*prop": "menu", "items": [ { "listeners": { "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}" }, "text": "as PDF", "xtype": "Item", "|xns": "Roo.menu" }, { "listeners": { "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}" }, "text": "as Excel", "xtype": "Item", "|xns": "Roo.menu" } ] } ] }, { "text": "Customer Statement", "xtype": "Item", "|xns": "Roo.menu", "items": [ { "|xns": "Roo.menu", "xtype": "Menu", "*prop": "menu", "items": [ { "listeners": { "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}" }, "text": "as PDF", "xtype": "Item", "|xns": "Roo.menu" }, { "listeners": { "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}" }, "text": "as Excel", "xtype": "Item", "|xns": "Roo.menu" } ] } ] } ] } ] }, { "listeners": { "|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}" }, "cls": "x-btn-text-icon", "text": "Email to warehouse", "xtype": "Button", "|icon": "Roo.rootURL + 'images/default/dd/email.gif'", "|xns": "Roo.Toolbar" }, { "listeners": { "|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" }, "cls": "x-btn-text-icon", "text": "Complete and Close", "xtype": "Button", "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'", "|xns": "Roo.Toolbar" }, { "listeners": { "|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" }, "cls": "x-btn-text-icon", "text": "Clear Unpaid Orders", "xtype": "Button", "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'", "|xns": "Roo.Toolbar" }, { "xtype": "Fill", "|xns": "Roo.Toolbar" }, { "listeners": { "|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" }, "cls": "x-btn-text-icon", "text": "Add", "xtype": "Button", "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'", "|xns": "Roo.Toolbar" }, { "listeners": { "|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" }, "cls": "x-btn-text-icon", "text": "Copy", "xtype": "Button", "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'", "|xns": "Roo.Toolbar" } ] }, { "*prop": "colModel[]", ".builderCfg": "{\"table\":\"cohead\",\"column\":\"cohead_orderdate\",\"columnshort\":\"cohead_orderdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ordered\"}", "dataIndex": "cohead_orderdate", "header": "Ordered", "sortable": true, "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "cohead_targetdate", "header": "Target Delivery", "hidden": true, "sortable": true, "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", ".builderCfg": "{\"table\":\"cohead\",\"column\":\"cohead_orderdate\",\"columnshort\":\"cohead_orderdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ordered\"}", "dataIndex": "cohead_salesrep_id_salesrep_name", "header": "Staff IC.", "sortable": true, "width": 100, "xtype": "ColumnModel", "|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 }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "cohead_number", "header": "#order", "sortable": true, "width": 100, "xtype": "ColumnModel", "|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 : 'I',\n invoiced_not : 'I',\n stock_not : 'S', \n stock_reserved : 'R',\n stock_shipped : 'S',\n paid : 'P',\n paid_not : 'P'\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('{0}', v); \n }\n if (r.data.cohead_status == 'X') {\n return tg + ' ' + String.format('{0}', v) ; \n }\n return tg + ' ' + String.format('{0}', v); \n }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", ".builderCfg": "{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"}", "dataIndex": "cohead_cust_id_cust_number", "header": "Customer#", "sortable": true, "width": 100, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", ".builderCfg": "{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"}", "dataIndex": "cohead_cust_id_cust_name", "header": "Customer", "sortable": true, "width": 200, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", ".builderCfg": "{\"table\":\"cohead\",\"column\":\"cohead_custponumber\",\"columnshort\":\"cohead_custponumber\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Cust. PO#\"}", "dataIndex": "cohead_custponumber", "header": "Cust. PO#", "width": 50, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", ".builderCfg": "{\"table\":\"cohead\",\"column\":\"cohead_type\",\"columnshort\":\"cohead_type\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Type\"}", "dataIndex": "cohead_type", "header": "Type", "width": 50, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "cohead_src_locations", "header": "From", "width": 100, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", ".builderCfg": "{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_name\",\"columnshort\":\"shipto_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ship to\"}", "dataIndex": "cohead_shiptoaddress1", "header": "Ship to", "width": 200, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", ".builderCfg": "{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_descrip\",\"columnshort\":\"terms_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Terms\"}", "dataIndex": "cohead_terms_id_terms_descrip", "header": "Terms", "width": 100, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "cohead_ordercomments", "header": "Notes", "hidden": true, "width": 100, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "align": "right", "dataIndex": "cohead_total", "header": "Total", "width": 100, "xtype": "ColumnModel", "|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('{0}',\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 }", "|xns": "Roo.grid" } ] } ] }, { "background": false, "region": "west", "xtype": "ContentPanel", "|xns": "Roo", "items": [ { "|xns": "Roo", "xtype": "Toolbar", "*prop": "toolbar", "items": [ { "|xns": "Roo.Toolbar", "xtype": "Fill" }, { "listeners": { "|click": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}" }, "cls": "x-btn-icon", "xtype": "Button", "|icon": "rootURL + '/Pman/templates/images/search.gif'", "|xns": "Roo.Toolbar" }, { "listeners": { "|click": "function (_self, e)\n{\n _this.form.reset('');\n\n \n _this.grid.footer.onClick('first');\n}" }, "cls": "x-btn-icon", "xtype": "Button", "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'", "|xns": "Roo.Toolbar" } ] }, { "listeners": { "|rendered": "function (form)\n{\n _this.form= form;\n}\n" }, "labelAlign": "top", "method": "POST", "style": "margin:5px;", "xtype": "Form", "|xns": "Roo.form", "items": [ { "listeners": { "|select": "function (combo, record, index)\n{\n _this.grid.footer.onClick('first');\n}", "|render": "function (_self)\n{\n _this.viewtypeSel = _self;\n}" }, "allowBlank": false, "displayField": "value", "editable": false, "emptyText": "View type", "fieldLabel": "View", "forceSelection": true, "listWidth": 200, "loadingText": "Searching...", "minChars": 2, "name": "viewtype", "pageSize": 20, "qtip": "Select Action", "queryParam": "query[action]", "selectOnFocus": true, "tpl": "
{value}
", "triggerAction": "all", "typeAhead": true, "value": "MYOPEN", "valueField": "key", "width": 150, "xtype": "ComboBox", "|xns": "Roo.form", "items": [ { "*prop": "store", "id": 0, "xtype": "SimpleStore", "|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]", "|fields": "[ 'key', 'value' ]", "|xns": "Roo.data" } ] }, { "listeners": { "select": "function (combo, record, index)\n{\n (function() { _this.grid.footer.onClick('first'); }).defer(100);\n}", "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}", "beforequery": "function (combo, query, forceAll, cancel, e)\n{\n \n if( _this.rsearch) {\n _this.rsearch =false;\n return false;\n }\n \n}" }, "allowBlank": true, "displayField": "cohead_number", "editable": true, "emptyText": "Select Order", "fieldLabel": "Order #", "forceSelection": false, "listWidth": 400, "loadingText": "Searching...", "minChars": 2, "name": "query[cohead_number]", "pageSize": 20, "qtip": "Select Order", "queryParam": "query[cohead_number]", "selectOnFocus": true, "tpl": "
{cohead_number}
", "triggerAction": "all", "typeAhead": false, "valueField": "cohead_number", "width": 180, "xtype": "ComboBox", "|xns": "Roo.form", "items": [ { "listeners": { "|beforeload": "function (_self, o){\n o.params = o.params || {};\n o.params['_columns'] = 'cohead_number';\n // set more here\n}\n" }, "*prop": "store", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ direction : 'ASC', field: 'cohead_number' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "method": "GET", "xtype": "HttpProxy", "|url": "baseURL + '/Roo/cohead.php'", "|xns": "Roo.data" }, { "*prop": "reader", "id": "cohead_number", "root": "data", "totalProperty": "total", "xtype": "JsonReader", "|fields": "[\"cohead_number\"]", "|xns": "Roo.data" } ] } ] }, { "listeners": { "select": "function (combo, record, index)\n{\n (function() { _this.grid.footer.onClick('first'); }).defer(100);\n}" }, "allowBlank": true, "displayField": "cust_name", "editable": true, "emptyText": "Select custinfo", "fieldLabel": "Customer", "forceSelection": true, "hiddenName": "cohead_cust_id", "listWidth": 400, "loadingText": "Searching...", "minChars": 2, "name": "cohead_cust_id_cust_name", "pageSize": 20, "qtip": "Select custinfo", "queryParam": "query[cust_name]", "selectOnFocus": true, "tpl": "
{cust_name} ({cust_number})
", "triggerAction": "all", "typeAhead": false, "valueField": "cust_id", "width": 180, "xtype": "ComboBox", "|xns": "Roo.form", "items": [ { "*prop": "store", "|xns": "Roo.data", "|sortInfo": "{ direction : 'ASC', field: 'cust_name' }", "xtype": "Store", "remoteSort": true, "listeners": { "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n" }, "items": [ { "*prop": "proxy", "xtype": "HttpProxy", "method": "GET", "|xns": "Roo.data", "|url": "baseURL + '/Roo/custinfo.php'" }, { "*prop": "reader", "xtype": "JsonReader", "|xns": "Roo.data", "id": "cust_id", "root": "data", "totalProperty": "total", "|fields": "[{\"name\":\"cust_id\",\"type\":\"int\"},\"cust_name\"]" } ] } ] }, { "listeners": { "select": "function (combo, date)\n{\n _this.grid.footer.onClick('first');\n}" }, "fieldLabel": "From", "format": "Y-m-d", "name": "_fromdate", "width": 100, "xtype": "DateField", "|xns": "Roo.form" }, { "listeners": { "select": "function (combo, date)\n{\n _this.grid.footer.onClick('first');\n}" }, "fieldLabel": "To", "format": "Y-m-d", "name": "_todate", "width": 100, "xtype": "DateField", "|xns": "Roo.form" } ] } ] } ] } ] } ], "permname": "", "modOrder": "001" }