We have a script set against the onsave event for the Quote Product form in CRM 4.0, as below:
This script calculates the tax amount based on the rate selected by the user (pick list).
This works fine if the value first value in the picklist is selected i.e. 10%.
on saving the record all amounts are set correctly.
However if the user changes the tax rate pick list to any other another value e.g. 0% and then saves the record, the value in the picklist is set back to the first value.
any ideas as to why this would be happening?
//check value of tax rate pick list - if 1 = 10%
if (crmForm.all.new_taxrate.DataValue = 1)
var dtaxrate = 10;
//if 2 = 0%
else if (crmForm.all.new_taxrate.DataValue = 2)
var dtaxrate = 0;
// if 3 = 12.5%
else if (crmForm.all.new_taxrate.DataValue = 3)
var dtaxrate = 12.5;
var dTax = (crmForm.all.baseamount.DataValue - crmForm.all.manualdiscountamount.DataValue) * dtaxrate / 100;
var dNet = (crmForm.all.baseamount.DataValue - crmForm.all.manualdiscountamount.DataValue);
crmForm.all.tax.DataValue = dTax;
crmForm.all.new_netamount.DataValue = dNet;
crmForm.all.extendedamount.DataValue = crmForm.all.baseamount.DataValue - crmForm.all.manualdiscountamount.DataValue + crmForm.all.tax.DataValue;