…
i := 1;
ELSE
i := 0;
END;
IF i > 0 THEN BEGIN
IF i > 1 THEN
TempVatEntry.SETRANGE("Entry No.",EntryNoBegin[i - 1],TempVatEntry."Entry No.")
ELSE
TempVatEntry.SETRANGE("Entry No.",TempVatEntry."Entry No.");
TempVatEntry.FINDSET;
REPEAT
VATEntrySaved := TempVatEntry;
CASE DtldCustLedgEntry2."Entry Type" OF
…
…
i := 1;
ELSE
i := 0;
END;
IF i > 0 THEN BEGIN
IF i > 1 THEN BEGIN
IF EntryNoBegin[i - 1] < TempVatEntry."Entry No." THEN
TempVatEntry.SETRANGE("Entry No.",EntryNoBegin[i - 1],TempVatEntry."Entry No.")
ELSE
TempVatEntry.SETRANGE("Entry No.",TempVatEntry."Entry No.",EntryNoBegin[i - 1]);
END ELSE
TempVatEntry.SETRANGE("Entry No.",TempVatEntry."Entry No.");
TempVatEntry.FINDSET;
REPEAT
VATEntrySaved := TempVatEntry;
CASE DtldCustLedgEntry2."Entry Type" OF
…
…
DtldCustLedgEntry2."Entry Type"::"Payment Tolerance (VAT Excl.)",
DtldCustLedgEntry2."Entry Type"::"Payment Discount Tolerance (VAT Excl.)"]
THEN BEGIN
VATEntryTemp.SETRANGE("VAT Bus. Posting Group",DtldCustLedgEntry2."VAT Bus. Posting Group");
VATEntryTemp.SETRANGE("VAT Prod. Posting Group",DtldCustLedgEntry2."VAT Prod. Posting Group");
IF NOT VATEntryTemp.FINDFIRST THEN BEGIN
VATEntryTemp.RESET;
IF VATEntryTemp.FINDLAST THEN
VATEntryTemp."Entry No." := VATEntryTemp."Entry No." + 1
ELSE
VATEntryTemp."Entry No." := 1;
VATEntryTemp.INIT;
VATEntryTemp."VAT Bus. Posting Group" := DtldCustLedgEntry2."VAT Bus. Posting Group";
VATEntryTemp."VAT Prod. Posting Group" := DtldCustLedgEntry2."VAT Prod. Posting Group";
VATEntry.SETCURRENTKEY(VATEntry."Transaction No.");
VATEntry.SETRANGE("Transaction No.",DtldCustLedgEntry2."Transaction No.");
VATEntry.SETRANGE("VAT Bus. Posting Group",DtldCustLedgEntry2."VAT Bus. Posting Group");
VATEntry.SETRANGE("VAT Prod. Posting Group",DtldCustLedgEntry2."VAT Prod. Posting Group");
IF VATEntry.FINDSET THEN
REPEAT
IF VATEntry."Unrealized VAT Entry No." = 0 THEN BEGIN
VATEntryTemp.Base := VATEntryTemp.Base + VATEntry.Base;
VATEntryTemp.Amount := VATEntryTemp.Amount + VATEntry.Amount;
…
…
DtldCustLedgEntry2."Entry Type"::"Payment Tolerance (VAT Excl.)",
DtldCustLedgEntry2."Entry Type"::"Payment Discount Tolerance (VAT Excl.)"]
THEN BEGIN
VATEntryTemp.SETRANGE("VAT Bus. Posting Group",DtldCustLedgEntry2."VAT Bus. Posting Group");
VATEntryTemp.SETRANGE("VAT Prod. Posting Group",DtldCustLedgEntry2."VAT Prod. Posting Group");
VATEntryTemp.SETRANGE("Gen. Prod. Posting Group",DtldCustLedgEntry2."Gen. Prod. Posting Group");
IF NOT VATEntryTemp.FINDFIRST THEN BEGIN
VATEntryTemp.RESET;
IF VATEntryTemp.FINDLAST THEN
VATEntryTemp."Entry No." := VATEntryTemp."Entry No." + 1
ELSE
VATEntryTemp."Entry No." := 1;
VATEntryTemp.INIT;
VATEntryTemp."VAT Bus. Posting Group" := DtldCustLedgEntry2."VAT Bus. Posting Group";
VATEntryTemp."VAT Prod. Posting Group" := DtldCustLedgEntry2."VAT Prod. Posting Group";
VATEntryTemp."Gen. Prod. Posting Group" := DtldCustLedgEntry2."Gen. Prod. Posting Group";
VATEntry.SETCURRENTKEY(VATEntry."Transaction No.");
VATEntry.SETRANGE("Transaction No.",DtldCustLedgEntry2."Transaction No.");
VATEntry.SETRANGE("VAT Bus. Posting Group",DtldCustLedgEntry2."VAT Bus. Posting Group");
VATEntry.SETRANGE("VAT Prod. Posting Group",DtldCustLedgEntry2."VAT Prod. Posting Group");
VATEntry.SETRANGE("Gen. Prod. Posting Group",DtldCustLedgEntry2."Gen. Prod. Posting Group");
IF VATEntry.FINDSET THEN
REPEAT
IF VATEntry."Unrealized VAT Entry No." = 0 THEN BEGIN
VATEntryTemp.Base := VATEntryTemp.Base + VATEntry.Base;
VATEntryTemp.Amount := VATEntryTemp.Amount + VATEntry.Amount;
…