{ "id": "roo-file-21", "name": "Pman.Dialog.XtuplePurchaseOrder", "parent": "", "title": "", "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtuplePurchaseOrder.bjs", "items": [ { "listeners": { "show": "function () \n{\n this.layout.getRegion('center').showPanel(0);\n}" }, "closable": false, "collapsible": false, "height": 550, "modal": true, "resizable": true, "title": "New Purchase Order", "width": 900, "xtype": "LayoutDialog", "|xns": "Roo", "items": [ { "|xns": "Roo", "xtype": "LayoutRegion", "*prop": "center", "alwaysShowTabs": true, "tabPosition": "top", "items": [ { "|xns": "Roo", "xtype": "Toolbar", "*prop": "toolbar", "items": [ { "|xns": "Roo.Toolbar", "xtype": "Fill" }, { "listeners": { "click": "function ()\n{\n var hid = _this.form.findField('pohead_id').getValue();\n\n if(!hid.length){\n Roo.MessageBox.alert(\"Error\", \"Please save your purchase order first\"); \n return false;\n }\n\n \n if (!_this.grid) {\n _dialog.layout.showPanel(1);\n doit.defer(500);\n return;\n }\n \n \n \n var doit = function () { \n new Pman.Download({\n grid : _this.grid\n });\n }\n doit();\n \n \n}" }, "cls": "x-btn-text-icon", "text": "Download Purchase Order Items (Excel)", "xtype": "Button", "|icon": "rootURL + '/Pman/templates/images/save.gif'", "|xns": "Roo.Toolbar" }, { "listeners": { "render": "function (_self)\n{\n _this.uploadBtn = _self;\n}" }, "text": "Upload Purchase Order", "xtype": "Button", "|xns": "Roo.Toolbar", "items": [ { "|xns": "Roo.menu", "xtype": "Menu", "*prop": "menu", "items": [ { "listeners": { "click": "function (_self, e)\n{\n var hid = _this.form.findField('pohead_id').getValue();\n \n if(!hid.length){\n Roo.MessageBox.alert(\"Error\", \"Please save your purchase order first\"); \n return false;\n }\n Pman.Dialog.Image.show(\n {\n timeout : 60000,\n _url : baseURL+'/Xtuple/Import/PurchaseOrder?' + Roo.urlEncode({'pohead_id' : hid})\n \n },\n function () {\n if(_this.grid){\n _this.grid.footer.onClick('first');\n }\n Roo.MessageBox.alert(\"Notice\", 'UPLOADED');\n }\n );\n}" }, "text": "Upload Standard Excel", "xtype": "Item", "|xns": "Roo.menu" }, { "listeners": { "click": "function (_self, e)\n{\n\n var hid = _this.form.findField('pohead_id').getValue();\n \n if(!hid.length){\n Roo.MessageBox.alert(\"Error\", \"Please save your purchase order first\"); \n return false;\n }\n \n Pman.Dialog.Image.show(\n {\n _url : baseURL+'/Xtuple/Import/AUPurchaseOrder?' + Roo.urlEncode({'pohead_id' :hid})\n \n },\n function (data) {\n if(_this.grid){\n _this.grid.footer.onClick('first');\n }\n Roo.MessageBox.alert(\"Notice\", 'IMPORTED');\n\n });\n}" }, "text": "Upload AU Import Excel", "xtype": "Item", "|xns": "Roo.menu" } ] } ] } ] } ] }, { "region": "center", "title": "Order Details", "xtype": "ContentPanel", "|xns": "Roo", "items": [ { "listeners": { "|actioncomplete": "function(_self,action)\n{\n if (action.type == 'setdata') {\n _this.uploadBtn.disabled = false;\n if(!_this.data.pohead_id && Pman.Login.authUser.name.length){\n _this.saveBtn.show();\n _this.form.findField('pohead_agent_username').setValue(Pman.Login.authUser.name);\n _this.form.findField('pohead_orderdate').setValue(new Date());\n _this.form.findField('pohead_bg_arrival_est_day').setValue(new Date());\n _this.form.findField('pohead_bg_available_est_day').setValue(new Date());\n _this.form.findField('pohead_bg_available_latest_day').setValue(new Date());\n return;\n }\n _this.dialog.setTitle(\"Edit Purchase Order\");\n var params = {\n '_id' : _this.data.pohead_id\n }\n if(_this.data.office){\n params['_roo_office'] = _this.data.office;\n }\n \n this.load({ method: 'GET', params: params});\n return;\n }\n if (action.type == 'load') {\n _this.dontClose = false;\n if(_this.data.office){\n _this.uploadBtn.disabled = true;\n }\n _this.saveBtn.hide();\n if (action.result.data.pohead_status == 'U') {\n _this.saveBtn.show();\n }\n var cn = _this.form.findField('pohead_curr_id');\n cn.setDisabled(true);\n if (action.result.data.pohead_id * 1 < 1) {\n cn.setDisabled(false);\n }\n \n if(_this.grid){\n _this.grid.footer.onClick('first');\n }\n \n return;\n }\n if (action.type =='submit') {\n \n\n var cid = this.findField('pohead_id').getValue()*1;\n if (cid && !_this.dontClose) {\n \n _this.dialog.hide();\n \n if (_this.callback) {\n _this.callback.call(_this, _this.form.getValues());\n }\n _this.form.reset();\n return;\n }\n Roo.log(action);\n _this.dontClose = false;\n _this.data.pohead_id = action.result.data.pohead_id;\n this.fireEvent('actioncomplete', this, { \n type: 'setdata', \n data: { \n pohead_id : action.result.data.pohead_id\n } \n });\n\n \n }\n}\n", "|rendered": "function (form)\n{\n _this.form= form;\n}\n", "actionfailed": "function (_self, action)\n{\n _this.dialog.el.unmask();\n if (action.failureType == 'client') {\n Roo.MessageBox.alert(\"Error\", \"Please fill in all the required fields\");\n }\n if (action.failureType == 'server') {\n Roo.MessageBox.alert(\"Error\", action.result.errorMsg);\n }\n _this.dialog.layout.getRegion('center').showPanel(0);\n\n}" }, "labelWidth": 200, "method": "POST", "style": "margin:10px;", "xtype": "Form", "|url": "baseURL + '/Xtuple/Roo/Pohead.php'", "|xns": "Roo.form", "items": [ { "emptyText": "Automatic", "fieldLabel": "Order #", "name": "pohead_number", "readOnly": true, "width": 150, "xtype": "TextField", "|xns": "Roo.form" }, { "allowBlank": false, "fieldLabel": "Order Date", "format": "Y-m-d", "name": "pohead_orderdate", "width": 150, "xtype": "DateField", "|xns": "Roo.form" }, { "fieldLabel": "Estimated Arrival Date", "format": "Y-m-d", "name": "pohead_bg_arrival_est_day", "width": 150, "xtype": "DateField", "|xns": "Roo.form" }, { "fieldLabel": "Estimated Available Date", "format": "Y-m-d", "name": "pohead_bg_available_est_day", "width": 150, "xtype": "DateField", "|xns": "Roo.form" }, { "fieldLabel": "Latest Estimated Available Date", "format": "Y-m-d", "name": "pohead_bg_available_latest_day", "width": 150, "xtype": "DateField", "|xns": "Roo.form" }, { "fieldLabel": "VA", "name": "pohead_bg_va", "width": 150, "xtype": "TextField", "|xns": "Roo.form" }, { "fieldLabel": "Vendor", "name": "pohead_vend_id_vend_name", "readOnly": true, "width": 250, "xtype": "TextField", "|xns": "Roo.form" }, { "allowBlank": false, "displayField": "fname", "editable": false, "fieldLabel": "Status", "hiddenName": "pohead_status", "listWidth": 200, "mode": "local", "name": "pohead_status", "readOnly": true, "tpl": "