This event can be used to make final adjustments to the total net price and gross price of a quote/order. The events execution is activated from the total calculation screen.
Example and syntax
procedure OnSalesheaderPriceFinalization(const aParams: TScriptOnSalesheaderPriceFinalizationParams);
var
vMultDiv,vAddSub: integer;
vDiscountpercent: double;
begin
if aParams.Grossprice > 0 then
vDiscountpercent := ((aParams.Grossprice - aParams.Netprice)/aParams.Grossprice)*100
else
vDiscountpercent := 0;
if aparams.Netprice > 5000 then
begin
//Round up to nearest 490 or 990
vMultDiv := 500;
vAddSub := 10;
//Rounds up to nearest 490 og 990 above original netprice
aParams.Netprice := vMultDiv*Ceil((aParams.Netprice+vAddSub)/vMultDiv)-vAddSub; //Calculate new netprice
aParams.Grossprice := aParams.Netprice / (100 - vDiscountpercent) *100 //Keep original discount percent
end;
end;