CLEAR(SalesLineArch);
SalesLineArch.DELETEALL;
SalesLineArchive.SETRANGE("Document Type","Sales Header Archive"."Document Type");
SalesLineArchive.SETRANGE("Document No.","Sales Header Archive"."No.");
SalesLineArchive.SETRANGE("Version No.","Sales Header Archive"."Version No.");
IF SalesLineArchive.FINDSET THEN
REPEAT
SalesLineArch := SalesLineArchive;
SalesLineArch.INSERT;
UNTIL SalesLineArchive.NEXT = 0;
VATAmountLine.DELETEALL;
IF Number > 1 THEN
CopyText := Text003;
CurrReport.PAGENO := 1;
CLEAR(SalesLineArch);
SalesLineArch.DELETEALL;
SalesLineArchive.SETRANGE("Document Type","Sales Header Archive"."Document Type");
SalesLineArchive.SETRANGE("Document No.","Sales Header Archive"."No.");
SalesLineArchive.SETRANGE("Version No.","Sales Header Archive"."Version No.");
IF SalesLineArchive.FINDSET THEN
REPEAT
SalesLineArch := SalesLineArchive;
SalesLineArch.INSERT;
// Add the following lines.
TempSalesLine.TRANSFERFIELDS(SalesLineArchive);
TempSalesLine.INSERT;
// End of the lines.
UNTIL SalesLineArchive.NEXT = 0;
VATAmountLine.DELETEALL;
// Add the following lines.
TempSalesHeader.TRANSFERFIELDS("Sales Header Archive");
TempSalesLine."Prepayment Line" := TRUE; // used as flag in CalcVATAmountLines -> not invoice rounding
TempSalesLine.CalcVATAmountLines(0,TempSalesHeader,TempSalesLine,VATAmountLine);
VATAmount := VATAmountLine.GetTotalVATAmount;
VATBaseAmount := VATAmountLine.GetTotalVATBase;
VATDiscountAmount :=
VATAmountLine.GetTotalVATDiscount(TempSalesHeader."Currency Code",TempSalesHeader."Prices Including VAT");
TotalAmountInclVAT := VATAmountLine.GetTotalAmountInclVAT;
// End of the lines.
IF Number > 1 THEN
CopyText := Text003;
CurrReport.PAGENO := 1;