...
DtldCVLedgEntryBuf."Entry Type"::"Payment Tolerance (VAT Excl.)":
BEGIN
DtldCVLedgEntryBuf.TESTFIELD("Gen. Prod. Posting Group");
GenPostingSetup.GET(
DtldCVLedgEntryBuf."Gen. Bus. Posting Group",
DtldCVLedgEntryBuf."Gen. Prod. Posting Group");
CASE GLSetup."Payment Tolerance Posting" OF
GLSetup."Payment Tolerance Posting"::"Payment Tolerance Accounts":
IF DtldCVLedgEntryBuf."Amount (LCY)" > 0 THEN BEGIN
GenPostingSetup.TESTFIELD("Sales Pmt. Tol. Debit Acc.");
AccNo := GenPostingSetup."Sales Pmt. Tol. Debit Acc.";
END ELSE BEGIN
GenPostingSetup.TESTFIELD("Sales Pmt. Tol. Credit Acc.");
AccNo := GenPostingSetup."Sales Pmt. Tol. Credit Acc.";
END;
GLSetup."Payment Tolerance Posting"::"Payment Discount Accounts":
IF DtldCVLedgEntryBuf."Amount (LCY)" > 0 THEN BEGIN
GenPostingSetup.TESTFIELD("Sales Pmt. Disc. Debit Acc.");
AccNo := GenPostingSetup."Sales Pmt. Disc. Debit Acc.";
END ELSE BEGIN
GenPostingSetup.TESTFIELD("Sales Pmt. Disc. Credit Acc.");
AccNo := GenPostingSetup."Sales Pmt. Disc. Credit Acc.";
END;
END;
InitGLEntry(AccNo,-DtldCVLedgEntryBuf."Amount (LCY)",0,FALSE,TRUE);
GLEntry."Additional-Currency Amount" := -DtldCVLedgEntryBuf."Additional-Currency Amount";
GLEntry."Gen. Posting Type" := GLEntry."Gen. Posting Type"::Sale;
GLEntry."Gen. Bus. Posting Group" := DtldCVLedgEntryBuf."Gen. Bus. Posting Group";
GLEntry."Gen. Prod. Posting Group" := DtldCVLedgEntryBuf."Gen. Prod. Posting Group";
GLEntry."VAT Bus. Posting Group" := DtldCVLedgEntryBuf."VAT Bus. Posting Group";
GLEntry."VAT Prod. Posting Group" := DtldCVLedgEntryBuf."VAT Prod. Posting Group";
GLEntry."Tax Area Code" := DtldCVLedgEntryBuf."Tax Area Code";
GLEntry."Tax Liable" := DtldCVLedgEntryBuf."Tax Liable";
GLEntry."Tax Group Code" := DtldCVLedgEntryBuf."Tax Group Code";
GLEntry."Use Tax" := DtldCVLedgEntryBuf."Use Tax";
InsertGLEntry(TRUE);
END;
...
...
DtldCVLedgEntryBuf."Entry Type"::"Payment Tolerance (VAT Excl.)":
BEGIN
DtldCVLedgEntryBuf.TESTFIELD("Gen. Prod. Posting Group");
GenPostingSetup.GET(
DtldCVLedgEntryBuf."Gen. Bus. Posting Group",
DtldCVLedgEntryBuf."Gen. Prod. Posting Group");
CASE GLSetup."Payment Tolerance Posting" OF
GLSetup."Payment Tolerance Posting"::"Payment Tolerance Accounts":
IF DtldCVLedgEntryBuf."Amount (LCY)" > 0 THEN BEGIN
GenPostingSetup.TESTFIELD("Sales Pmt. Tol. Debit Acc.");
AccNo := GenPostingSetup."Sales Pmt. Tol. Debit Acc.";
END ELSE BEGIN
GenPostingSetup.TESTFIELD("Sales Pmt. Tol. Credit Acc.");
AccNo := GenPostingSetup."Sales Pmt. Tol. Credit Acc.";
END;
GLSetup."Payment Tolerance Posting"::"Payment Discount Accounts":
IF DtldCVLedgEntryBuf."Amount (LCY)" > 0 THEN BEGIN
GenPostingSetup.TESTFIELD("Sales Pmt. Disc. Debit Acc.");
AccNo := GenPostingSetup."Sales Pmt. Disc. Debit Acc.";
END ELSE BEGIN
GenPostingSetup.TESTFIELD("Sales Pmt. Disc. Credit Acc.");
AccNo := GenPostingSetup."Sales Pmt. Disc. Credit Acc.";
END;
END;
InitGLEntry(AccNo,-DtldCVLedgEntryBuf."Amount (LCY)",0,FALSE,TRUE);
GLEntry."Additional-Currency Amount" := -DtldCVLedgEntryBuf."Additional-Currency Amount";
// Add the following line.
GLEntry."VAT Amount" := -DtldCVLedgEntryBuf."VAT Amount (LCY)";
// End of the added line.
GLEntry."Gen. Posting Type" := GLEntry."Gen. Posting Type"::Sale;
GLEntry."Gen. Bus. Posting Group" := DtldCVLedgEntryBuf."Gen. Bus. Posting Group";
GLEntry."Gen. Prod. Posting Group" := DtldCVLedgEntryBuf."Gen. Prod. Posting Group";
GLEntry."VAT Bus. Posting Group" := DtldCVLedgEntryBuf."VAT Bus. Posting Group";
GLEntry."VAT Prod. Posting Group" := DtldCVLedgEntryBuf."VAT Prod. Posting Group";
GLEntry."Tax Area Code" := DtldCVLedgEntryBuf."Tax Area Code";
GLEntry."Tax Liable" := DtldCVLedgEntryBuf."Tax Liable";
GLEntry."Tax Group Code" := DtldCVLedgEntryBuf."Tax Group Code";
GLEntry."Use Tax" := DtldCVLedgEntryBuf."Use Tax";
InsertGLEntry(TRUE);
END;
...