Pman.Dialog.XtupleCreditMemo.js
"name": "cmhead_misc_per",
"width": 35,
"xtype": "NumberField",
- "|update": "function() {\n var m = _this.form.findField('cmhead_misc_per');\n var pv = parseFloat(_this.form.findField('cmhead_value').getValue());\n var discount = parseFloat(_this.form.findField('cmhead_misc').getValue());\n \n if (discount > 0.0) {\n this.setValue(0); \n return;\n }\n if (pv < 0) {\n this.setValue(0); \n return;\n }\n var val = ((discount) / pv) * -100;\n \n //Roo.log(\"update discount?\" + val);\n this.setValue(val.toFixed(1));\n \n if (val > 0.0) {\n _this.form.findField('cmhead_misc_descrip').setValue(\"Discount of \" + val.toFixed(1)+'%');\n \n }\n \n \n}\n",
+ "|update": "function() {\n var m = _this.form.findField('cmhead_misc_per');\n var pv = parseFloat(_this.form.findField('cmhead_taxfree_value').getValue()) + \n parseFloat(_this.form.findField('cmhead_taxable_value').getValue()) ;\n var discount = parseFloat(_this.form.findField('cmhead_misc').getValue());\n \n if (discount > 0.0) {\n this.setValue(0); \n return;\n }\n if (pv < 0) {\n this.setValue(0); \n return;\n }\n var val = ((discount) / pv) * -100;\n \n //Roo.log(\"update discount?\" + val);\n this.setValue(val.toFixed(1));\n \n if (val > 0.0) {\n _this.form.findField('cmhead_misc_descrip').setValue(\"Discount of \" + val.toFixed(1)+'%');\n \n }\n \n \n}\n",
"|xns": "Roo.form"
},
{
width : 35,
update : function() {
var m = _this.form.findField('cmhead_misc_per');
- var pv = parseFloat(_this.form.findField('cmhead_value').getValue());
+ var pv = parseFloat(_this.form.findField('cmhead_taxfree_value').getValue()) +
+ parseFloat(_this.form.findField('cmhead_taxable_value').getValue()) ;
var discount = parseFloat(_this.form.findField('cmhead_misc').getValue());
if (discount > 0.0) {