Hi all,
I have following JavaScript on Quote Form and I have added it on Change of "Pre-Freight Amount" and Onload and On Save on the Form: The code calculate the Total tax and Total Amount, if a Discount is added:
function CalculateTax(executionContext){
var formContext = executionContext.getFormContext();
var preFreight = formContext.getAttribute('totalamountlessfreight').getValue();
var tax = formContext.getAttribute("tv_tax").getText();
var total = formContext.getAttribute('tv_totalamounts').getValue();
var total_tax = formContext.getAttribute("tv_totaltax").getValue();
var percent = parseFloat(tax);
debugger;
if (tax != "" && tax != null){
var Discount = preFreight * percent/100;
formContext.getAttribute("tv_totaltax").setValue(parseFloat(eval(Discount)));
formContext.getAttribute('tv_totaltax2').setValue(Discount);
var Amount = preFreight + formContext.getAttribute("tv_totaltax").getValue();
formContext.getAttribute('tv_totalamounts').setValue(Amount);
formContext.getAttribute('totalamount').setValue(Amount);
}
else {
formContext.getAttribute("tv_totaltax").setValue(parseFloat(eval(0)));
formContext.getAttribute('tv_totaltax2').setValue(0);
}
}
But after changing the Discount amount in Discount percent or Discount field, the changes remains unsaved on the Form.
could somebody tell me, what could be the reason of that?
Many Thanks