{ "id": "roo-file-393", "name": "Pman.Tab.XtupleSalesInvoice", "parent": "Pman.Tab.XtupleSales", "title": "", "path": "/home/alan/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleSalesInvoice.bjs", "items": [ { "listeners": { "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}" }, ".builderCfg": "{\"cols\":[{\"table\":\"invchead\",\"column\":\"invchead_ordernumber\",\"columnshort\":\"invchead_ordernumber\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Sales Order#\"},{\"table\":\"invchead\",\"column\":\"invchead_orderdate\",\"columnshort\":\"invchead_orderdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ordered\"},{\"table\":\"invchead\",\"column\":\"invchead_posted\",\"columnshort\":\"invchead_posted\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Posted\"},{\"table\":\"invchead\",\"column\":\"invchead_printed\",\"columnshort\":\"invchead_printed\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Printed?\"},{\"table\":\"invchead\",\"column\":\"invchead_invcdate\",\"columnshort\":\"invchead_invcdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Invoiced\"},{\"table\":\"invchead\",\"column\":\"invchead_billto_name\",\"columnshort\":\"invchead_billto_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Bill To\"}],\"cols_ex\":[\"invchead_billto_name\"],\"table\":\"invchead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}", "background": true, "fitContainer": true, "fitToframe": true, "region": "center", "tableName": "invchead", "title": "Invoices", "xtype": "GridPanel", "|xns": "Roo", "items": [ { "listeners": { "|render": "function() \n{\n _this.grid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.panel.active) {\n this.footer.onClick('first');\n }\n}", "|rowdblclick": "function (_self, rowIndex, e)\n{\n \n \n var d = this.getDataSource().getAt(rowIndex).data;\n \n if (d.cohead_id) {\n \n Pman.Dialog.XtupleSalesOrder.show( {\n cohead_id : d.cohead_id\n \n }, function() {\n _this.grid.footer.onClick('refresh');\n // updated..\n Pman.Tab.XtupleSales.grid.footer.onClick('first');\n }); \n return;\n }\n \n // other wise not a sales order related..\n \n \n Pman.Dialog.XtupleInvc.show( {\n _id : d.invchead_id\n \n }, function() {\n _this.grid.footer.onClick('refresh');\n // updated..\n Pman.Tab.XtupleSales.grid.footer.onClick('first');\n }); \n \n}\n" }, "*prop": "grid", "autoExpandColumn": "cust_name", "loadMask": true, "xtype": "Grid", "|xns": "Roo.grid", "items": [ { "listeners": { "beforeload": "function (_self, o)\n{\n if (_this.ordernumber.getValue().length) {\n o.params['query[invchead_ordernumber]'] = _this.ordernumber.getValue();\n }\n \n if (_this.invcnumber.getValue().length) {\n o.params['query[invchead_invcnumber]'] = _this.invcnumber.getValue();\n }\n \n \n if (_this.customer.getValue()) {\n o.params.invchead_cust_id = _this.customer.getValue();\n }\n if (_this.fromDate.getValue()) {\n o.params['search[fromDate]'] = _this.fromDate.getValue().format('Y-m-d');\n }\n if (_this.toDate.getValue()) {\n o.params['search[toDate]'] = _this.toDate.getValue().format('Y-m-d');\n }\n o.params._show_status = _this.status.getValue();\n \n o.params._with_salesorder = 1;\n}" }, "*prop": "dataSource", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ field : 'invchead_invcdate', direction: 'DESC' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "xtype": "HttpProxy", "method": "GET", "|url": "baseURL + '/Roo/invchead.php'", "|xns": "Roo.data" }, { "|xns": "Roo.data", "xtype": "JsonReader", "totalProperty": "total", "root": "data", ".builderCfg": "{\"cols\":[{\"table\":\"invchead\",\"column\":\"invchead_ordernumber\",\"columnshort\":\"invchead_ordernumber\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Sales Order#\"},{\"table\":\"invchead\",\"column\":\"invchead_orderdate\",\"columnshort\":\"invchead_orderdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ordered\"},{\"table\":\"invchead\",\"column\":\"invchead_posted\",\"columnshort\":\"invchead_posted\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Posted\"},{\"table\":\"invchead\",\"column\":\"invchead_printed\",\"columnshort\":\"invchead_printed\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Printed?\"},{\"table\":\"invchead\",\"column\":\"invchead_invcdate\",\"columnshort\":\"invchead_invcdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Invoiced\"},{\"table\":\"invchead\",\"column\":\"invchead_billto_name\",\"columnshort\":\"invchead_billto_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Bill To\"}],\"cols_ex\":[\"invchead_billto_name\"],\"table\":\"invchead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}", "*prop": "reader", "id": "id", "|fields": "[\n {\n 'name': 'invchead_ordernumber',\n 'type': 'string'\n },\n {\n 'name': 'invchead_orderdate',\n 'type': 'date'\n },\n {\n 'name': 'invchead_posted',\n 'type': 'boolean'\n },\n {\n 'name': 'invchead_printed',\n 'type': 'boolean'\n },\n {\n 'name': 'invchead_invcdate',\n 'type': 'date'\n },\n {\n 'name': 'invchead_billto_name',\n 'type': 'string'\n }\n]" } ] }, { "*prop": "footer", "xtype": "PagingToolbar", "pageSize": 25, "displayInfo": true, "displayMsg": "Displaying invchead{0} - {1} of {2}", "emptyMsg": "No invchead found", "|xns": "Roo", "items": [ { "listeners": { "click": "function (_self, e)\n{\n new Pman.Download({\n grid: _this.grid\n });\n Roo.MessageBox.alert(\"Notice\", \"Download should start soon\");\n}" }, "text": "Download", "xtype": "Button", "|xns": "Roo.Toolbar" } ] }, { "*prop": "toolbar", "xtype": "Toolbar", "|xns": "Roo", "items": [ { "listeners": { "render": "function (_self)\n{\n _this.invcnumber = _self;\n}", "specialkey": "function (_self, e)\n{\n _this.grid.footer.onClick('first');\n}" }, "emptyText": "Invoice #", "width": 70, "xtype": "TextField", "|xns": "Roo.form" }, { "listeners": { "render": "function (_self)\n{\n _this.ordernumber = _self;\n}", "select": "function (combo, record, index)\n{\n Roo.log('select');\n _this.grid.footer.onClick('first');\n}" }, "allowBlank": true, "displayField": "invchead_ordernumber", "editable": true, "emptyText": "Order", "fieldLabel": "ordernumber", "forceSelection": true, "hiddenName": "invchead_id", "listWidth": 400, "loadingText": "Searching...", "minChars": 2, "name": "invchead_ordernumber", "pageSize": 20, "qtip": "Select invchead", "queryParam": "query[invchead_ordernumber]", "selectOnFocus": true, "tpl": "
{invchead_ordernumber}
", "triggerAction": "all", "valueField": "invchead_ordernumber", "width": 150, "xtype": "ComboBox", "|xns": "Roo.form", "items": [ { "*prop": "store", "|xns": "Roo.data", "|sortInfo": "{ direction : 'ASC', field: 'invchead_ordernumber' }", "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/invchead.php'" }, { "*prop": "reader", "xtype": "JsonReader", "|xns": "Roo.data", "id": "invchead_id", "root": "data", "totalProperty": "total", "|fields": "[{\"name\":\"invchead_id\",\"type\":\"int\"},\"invchead_ordernumber\"]" } ] } ] }, { "listeners": { "render": "function (_self)\n{\n _this.customer = _self;\n}", "select": "function (combo, record, index)\n{\n _this.grid.footer.onClick('first');\n}" }, "allowBlank": true, "displayField": "cust_name", "editable": true, "emptyText": "Select Customer", "fieldLabel": "cust_name", "forceSelection": true, "hiddenName": "cust_id", "listWidth": 400, "loadingText": "Searching...", "minChars": 2, "name": "cust_name", "pageSize": 20, "qtip": "Select custinfo", "queryParam": "query[cust_name]", "selectOnFocus": true, "tpl": "
{cust_name}
", "triggerAction": "all", "valueField": "cust_id", "width": 200, "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": { "render": "function (_self)\n{\n _this.status = _self;\n}", "beforeselect": "function (combo, record, index)\n{\n (function() { _this.grid.footer.onClick('first'); }).defer(100);\n}" }, "allowBlank": false, "displayField": "fname", "editable": false, "fieldLabel": "Status", "hiddenName": "status", "listWidth": 200, "mode": "local", "name": "status", "triggerAction": "all", "value": "A", "valueField": "ftype", "width": 100, "xtype": "ComboBox", "|xns": "Roo.form", "items": [ { "*prop": "store", "xtype": "SimpleStore", "|data": "[ \n [ 'U', \"Unpaid\"],\n [ 'NV' , \"Not Void Only\"],\n [ 'V' , \"Void Only\"], \n [ 'A', \"All\"] \n]\n", "|fields": "[ 'ftype', 'fname']", "|xns": "Roo.data" } ] }, { "text": "From:", "xtype": "TextItem", "|xns": "Roo.Toolbar" }, { "listeners": { "select": "function (combo, date)\n{\n _this.grid.footer.onClick('first');\n}", "render": "function (_self)\n{\n _this.fromDate = _self;\n}" }, "format": "Y-m-d", "xtype": "DateField", "|xns": "Roo.form" }, { "text": " To:", "xtype": "TextItem", "|xns": "Roo.Toolbar" }, { "listeners": { "select": "function (combo, date)\n{\n _this.grid.footer.onClick('first');\n}", "render": "function (_self)\n{\n _this.toDate = _self;\n}" }, "format": "Y-m-d", "xtype": "DateField", "|xns": "Roo.form" }, { "|xns": "Roo.Toolbar", "xtype": "Fill" }, { "listeners": { "|click": "function ()\n{\n\n if (!Pman.hasPerm('Xtuple.InvoiceAll', 'S')) {\n Roo.MessageBox.alert(\"Error\", \"You do not have permissions to do that, please contact the administrator to void invoices, or edit the sales order.\");\n return;\n \n }\n \n \n var sel = _this.grid.getSelectionModel().getSelected();\n if (!sel) {\n Roo.MessageBox.alert(\"Error\", \"Select a invoice\");\n return;\n }\n // check current status of shipment..\n \n Roo.MessageBox.confirm(\"Are you sure\", \"Are you sure you want to VOID that invoice?\",\n function(r) {\n if (r != 'yes') {\n return;\n }\n new Pman.Request({\n mask : 'Sending',\n url : baseURL + '/Roo/invchead',\n method : 'POST',\n params : {\n invchead_id : sel.data.invchead_id,\n _void : 1\n },\n success : function() {\n _this.grid.footer.onClick('refresh');\n }\n })\n \n }\n );\n \n \n \n}" }, "cls": "x-btn-text-icon", "text": "Void Invoice", "xtype": "Button", "|icon": "rootURL + '/Pman/templates/images/trash.gif'", "|xns": "Roo.Toolbar" } ] }, { "*prop": "colModel[]", "align": "right", "dataIndex": "invchead_ordernumber", "header": "Sales Order#", "width": 100, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "align": "right", "dataIndex": "invchead_invcnumber", "header": "Invoice#", "width": 100, "xtype": "ColumnModel", "|renderer": "function(v,x,r) {\n if (r.data.invchead_void) { \n var vv = v.split('x-').shift();\n return String.format('{0}', vv); \n }\n return String.format('{0}', v);\n }", "|xns": "Roo.grid" }, { "xtype": "ColumnModel", ".builderCfg": "{\"table\":\"invchead\",\"column\":\"invchead_orderdate\",\"columnshort\":\"invchead_orderdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ordered\"}", "header": "Ordered", "width": 75, "dataIndex": "invchead_orderdate", "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }", "|xns": "Roo.grid", "*prop": "colModel[]" }, { "*prop": "colModel[]", "dataIndex": "invchead_posted", "header": "Posted", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v,x,r) { \n \n if (r.data.invchead_void) { \n return String.format('VOID', v); \n }\n \n return String.format('{0}', v); \n}", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "invchead_void", "header": "Void", "hidden": true, "width": 75, "xtype": "ColumnModel", "|renderer": "function(v,x,r) { \n \n \n return String.format('{0}', v); \n}", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "invchead_salesrep_id_salesrep_name", "header": "Sales Rep", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "cust_salesrep_id_salesrep_name", "header": "Customer Rep", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", ".builderCfg": "{\"table\":\"invchead\",\"column\":\"invchead_printed\",\"columnshort\":\"invchead_printed\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Printed?\"}", "dataIndex": "invchead_printed", "header": "Printed?", "hidden": true, "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "xtype": "ColumnModel", ".builderCfg": "{\"table\":\"invchead\",\"column\":\"invchead_invcdate\",\"columnshort\":\"invchead_invcdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Invoiced\"}", "header": "Invoiced", "width": 75, "dataIndex": "invchead_invcdate", "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }", "|xns": "Roo.grid", "*prop": "colModel[]" }, { "*prop": "colModel[]", "dataIndex": "cust_addr_id_addr_postalcode", "header": "Customer Postcode", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "cust_addr_id_addr_state", "header": "Customer State", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "cust_name", "header": "Customer", "width": 200, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "invchead_curr_id_curr_symbol", "header": "Currency", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v ? v : '??'); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "align": "right", "dataIndex": "invchead_total", "header": "Value", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return v ? Roo.util.Format.usMoney( v) : ''; }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "align": "right", "dataIndex": "aropen_amount", "header": "w/Tax", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return v ? Roo.util.Format.usMoney( v) : ''; }", "|xns": "Roo.grid" } ] } ] } ], "permname": "", "modOrder": "300" }