...
TaxDiffEntry.SETRANGE("Transaction No.",Number);
END ELSE BEGIN
GLReg.GET(Number);
...
...
TaxDiffEntry.SETRANGE("Transaction No.",Number);
// Add the following line.
ValueEntry.SETRANGE("Entry No.",0);
// End of the added line.
END ELSE BEGIN
GLReg.GET(Number);
...
...
VATEntry.SETRANGE("Entry No.",GLReg."From VAT Entry No.",GLReg."To VAT Entry No.");
GLItemLedgRelation.SETCURRENTKEY(GLItemLedgRelation."G/L Register No.");
GLItemLedgRelation.SETRANGE("G/L Register No.",GLReg."No.");
IF GLItemLedgRelation.FINDFIRST THEN
FromValueEntryNo := GLItemLedgRelation."Value Entry No.";
IF GLItemLedgRelation.FINDLAST THEN
ToValueEntryNo := GLItemLedgRelation."Value Entry No.";
ValueEntry.SETRANGE("Entry No.",FromValueEntryNo,ToValueEntryNo);
...
...
VATEntry.SETRANGE("Entry No.",GLReg."From VAT Entry No.",GLReg."To VAT Entry No.");
// Add the following lines.
FromValueEntryNo := 0;
ToValueEntryNo := 0;
IF VATAllocOnCost THEN BEGIN
// End of the added lines.
GLItemLedgRelation.SETCURRENTKEY(GLItemLedgRelation."G/L Register No.");
GLItemLedgRelation.SETRANGE("G/L Register No.",GLReg."No.");
IF GLItemLedgRelation.FINDFIRST THEN
FromValueEntryNo := GLItemLedgRelation."Value Entry No.";
IF GLItemLedgRelation.FINDLAST THEN
ToValueEntryNo := GLItemLedgRelation."Value Entry No.";
// Add the following line.
END;
// End of the added line.
ValueEntry.SETRANGE("Entry No.",FromValueEntryNo,ToValueEntryNo);
...