I am trying to use a formula that is used for special VAT in the construction of our team . This formula works correctly when used in calculator or excel, although in our program gives different output when used within the function!
Here is the function:
function Fn_calcVat () {var vRate = Ext.getCmp ('crd_vat_rate'). GetValue (); Var vTranAmt = Ext.getCmp ('crd_tran_amt'). GetValue (); If (vRate! = '' & Amp; vTranAmt! = '') {Warning (Ext.getCmp ('vatable'). GetValue (.) ToString ()); Var vAmt = 0; If (Ext.getCmp ('vatable'). GetValue () ToString () == 'Y') {vAmt = (vRate / ((vTranAmt / 100) + 1)); Ext.getCmp ('crd_vat_amt') setValue (vAmt.toFixed (2)). Ext.getCmp ('crd_tran_tot') setValue (vTranAmt.toString ()). VAmt = 0; } And {vAmt = ((vRate / 100) * vTranAmt); Ext.getCmp ('crd_vat_amt') setValue (vAmt.toFixed (2)). Ext.getCmp ('crd_tran_tot'). Set val ((vTranAmt + vAmt)); VAmt = 0; }}}
The problem is the formula is vAmt = (vRate / ((vTranAmt / 100) + 1));
The other formula is working perfectly.
An example investment would be 100 with a VAT rate of 14.00, and the expected answer would be the tax amount of 14, although it returns as 7!
We use a mashup of EXTJS, js and c # ...
Any help would be greatly appreciated.
The kind regards
nick
The formula is wrong , It should be
vAmt = vTranAmt * (vRate / 100.0d);
Comments
Post a Comment