{ "id": "roo-file-7", "name": "Pman.Dialog.XtupleDiscountOfInvoice", "parent": "", "title": "", "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleDiscountOfInvoice.bjs", "items": [ { "listeners": { "show": "function (_self)\n{\n _this.form.findField('discount').focus();\n}" }, "closable": false, "height": 150, "modal": true, "resizable": false, "title": "% Discount to Offer", "width": 400, "xtype": "LayoutDialog", "|xns": "Roo", "items": [ { "|xns": "Roo", "xtype": "LayoutRegion", "*prop": "center" }, { "region": "center", "xtype": "ContentPanel", "|xns": "Roo", "items": [ { "listeners": { "rendered": "function (form)\n{\n _this.form = form;\n}" }, "labelWidth": 150, "xtype": "Form", "|xns": "Roo.form", "items": [ { "allowBlank": false, "allowDecimals": true, "allowNegative": false, "decimalPrecision": 2, "fieldLabel": "% Discount to Offer.", "name": "discount", "width": 200, "xtype": "NumberField", "|xns": "Roo.form" }, { "name": "invchead_id", "xtype": "Hidden", "|xns": "Roo.form" } ] } ] }, { "listeners": { "click": "function (_self, e)\n{\n _this.dialog.hide();\n \n }" }, "*prop": "buttons[]", "text": "Cancel", "xtype": "Button", "|xns": "Roo" }, { "listeners": { "click": "function (_self, e)\n{\n var data = _this.form.getFieldValues();\n \n if (data.invchead_id * 1 < 1) {\n Roo.MessageBox.alert(\"Error\", \"Missing invchead_id\");\n return;\n }\n \n if(data.discount > 100){\n Roo.MessageBox.alert(\"Error\", \"Maximum of discount value is 100\");\n return;\n }\n \n var discount = 100 - data.discount;\n \n var params = {\n template: 'Shipping-Invoice-' + baseURL.split('/').pop().split('.').shift(),\n filename : 'Shipping-Invoice-' + data.invchead_id,\n 'param[0]': \"invchead_id:integer='\" + data.invchead_id + \"'\",\n 'param[1]': \"discount:integer='\" + discount + \"'\"\n };\n \n new Pman.Download({\n url : baseURL + '/Xtuple/Print',\n method : 'GET',\n params : params,\n success : function() {\n\n }\n })\n _this.dialog.hide();\n}" }, "*prop": "buttons[]", "text": "OK", "xtype": "Button", "|xns": "Roo" } ] } ], "permname": "", "modOrder": "001" }