...
// PL001.begin
// Delete the following line.
CollectPrevPrepmts(0,'',0D,SalesHeader."No.",FALSE,PrepmtDocs,PrepmtInvAmount);
WITH SalesLine DO BEGIN
SETRANGE("Document Type",SalesHeader."Document Type");
SETRANGE("Document No.",SalesHeader."No.");
IF FINDSET THEN
REPEAT
IF "Adjust Prepmt. Amount" THEN
Adjustment := Adjustment + "Prepmt. Rounding Amount";
// Delete the following line.
PrepmtAmount := PrepmtAmount + "Prepmt. Amt. Incl. VAT";
UNTIL NEXT = 0;
...
...
// PL001.begin
WITH SalesLine DO BEGIN
SETRANGE("Document Type",SalesHeader."Document Type");
SETRANGE("Document No.",SalesHeader."No.");
IF FINDSET THEN
REPEAT
// Add the following line.
IF PrepmtAmount(SalesLine,DocumentType) <> 0 THEN BEGIN
IF "Adjust Prepmt. Amount" THEN
Adjustment := Adjustment + "Prepmt. Rounding Amount";
// Add the following lines.
PrepmtAmt := PrepmtAmt + "Prepmt. Amt. Incl. VAT";
PrepmtInvAmt := PrepmtInvAmt + "Prepmt. Amt. Inv.";
END;
UNTIL NEXT = 0;
...