...
// Delete the following line.
GLSetup.GetRoundingParamenters(Currency,RoundingPrecision,RoundingDirection);
Currency.TESTFIELD("Invoice Rounding Precision");
InvoiceRoundingAmount :=
-ROUND(
TotalSalesLine."Amount Including VAT" -
ROUND(
TotalSalesLine."Amount Including VAT",
Currency."Invoice Rounding Precision",
Currency.InvoiceRoundingDirection),
// Delete the following line.
RoundingPrecision);
IF InvoiceRoundingAmount <>0 THEN BEGIN
CustPostingGr.GET(SalesHeader."Customer Posting Group");
CustPostingGr.TESTFIELD("Invoice Rounding Account");
WITH SalesLine DO BEGIN
...
...
Currency.TESTFIELD("Invoice Rounding Precision");
InvoiceRoundingAmount :=
-ROUND(
TotalSalesLine."Amount Including VAT" -
ROUND(
TotalSalesLine."Amount Including VAT",
Currency."Invoice Rounding Precision",
Currency.InvoiceRoundingDirection),
// Add the following line.
Currency."Amount Rounding Precision");
IF InvoiceRoundingAmount <> 0 THEN BEGIN
CustPostingGr.GET(SalesHeader."Customer Posting Group");
CustPostingGr.TESTFIELD("Invoice Rounding Account");
// Add the following lines.
IF GLSetup."Rounding VAT (LCY)" <> GLSetup."Amount Rounding Precision" THEN BEGIN
GLAcc.GET(CustPostingGr."Invoice Rounding Account");
IF VATPostingSetup.GET(SalesHeader."VAT Bus. Posting Group",GLAcc."VAT Prod. Posting Group") THEN
IF VATPostingSetup."VAT %" <> 0 THEN
ERROR(Text054,CustPostingGr.FIELDCAPTION("Invoice Rounding Account"),CustPostingGr."Invoice Rounding Account");
END;
// End of the added lines.
WITH SalesLine DO BEGIN
...
...
ELSE
VALIDATE(
"Unit Price",
ROUND(
InvoiceRoundingAmount /
(1 + (1 - SalesHeader."VAT Base Discount %" / 100) * "VAT %" / 100),
// Delete the following line.
RoundingPrecision));
VALIDATE("Amount Including VAT",InvoiceRoundingAmount);
...
...
ELSE
VALIDATE(
"Unit Price",
ROUND(
InvoiceRoundingAmount /
(1 + (1 - SalesHeader."VAT Base Discount %" / 100) * "VAT %" / 100),
// Add the following line.
Currency."Amount Rounding Precision"));
VALIDATE("Amount Including VAT",InvoiceRoundingAmount);
...