//Code.Remove.begin
IF (Quantity - "Quantity Invoiced") <> 0 THEN BEGIN
GetSalesHeader;
IF SalesHeader."Prices Including VAT" THEN
"Prepmt Amt to Deduct" :=
ROUND(
ROUND(
ROUND(
ROUND("Unit Price" * "Qty. to Invoice",Currency."Amount Rounding Precision") *
(1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") *
("Prepayment %" / 100) / (1 + ("VAT %" / 100)),Currency."Amount Rounding Precision") *
(1 + ("VAT %" / 100)),Currency."Amount Rounding Precision")
ELSE
"Prepmt Amt to Deduct" :=
ROUND(
ROUND(
ROUND("Unit Price" * "Qty. to Invoice",Currency."Amount Rounding Precision") *
(1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") *
"Prepayment %" / 100 ,Currency."Amount Rounding Precision")
END ELSE
"Prepmt Amt to Deduct" := 0
//Code.Remove.end