3 "name": "Pman.Dialog.XtupleDiscountOfInvoice",
6 "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleDiscountOfInvoice.bjs",
10 "show": "function (_self)\n{\n _this.form.findField('discount').focus();\n}"
16 "title": "% Discount to Offer",
18 "xtype": "LayoutDialog",
23 "xtype": "LayoutRegion",
28 "xtype": "ContentPanel",
33 "rendered": "function (form)\n{\n _this.form = form;\n}"
41 "allowDecimals": true,
42 "allowNegative": false,
43 "decimalPrecision": 2,
44 "fieldLabel": "% Discount to Offer.",
47 "xtype": "NumberField",
51 "name": "invchead_id",
61 "click": "function (_self, e)\n{\n _this.dialog.hide();\n \n }"
70 "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}"