Pman.Dialog.XtupleCreditMemo.bjs
authorAlan Knowles <alan@roojs.com>
Tue, 28 Jan 2014 04:26:40 +0000 (12:26 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 28 Jan 2014 04:26:40 +0000 (12:26 +0800)
Pman.Dialog.XtupleCreditMemo.js

Pman.Dialog.XtupleCreditMemo.bjs
Pman.Dialog.XtupleCreditMemo.js

index 7c3fad1..ca27767 100644 (file)
                                                                     "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"
                                                                 },
                                                                 {
index 29240e1..b98dba3 100644 (file)
@@ -492,7 +492,8 @@ Pman.Dialog.XtupleCreditMemo = {
                                                                     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) {