...
IF "Quantity Invoiced" = 0 THEN BEGIN
"Prepmt. Line Amount" := ROUND("Line Amount" * "Prepayment %" / 100,Currency."Amount Rounding Precision");
IF "Prepmt. Line Amount" < "Prepmt. Amt. Inv." THEN
FIELDERROR("Prepmt. Line Amount",STRSUBSTNO(Text049,"Prepmt. Amt. Inv."));
END ELSE BEGIN
// Delete the following lines.
IF "Prepayment %" <> 0 THEN
"Prepmt. Line Amount" := "Prepmt. Amt. Inv." +
ROUND("Line Amount" * (Quantity - "Quantity Invoiced") / Quantity * "Prepayment %" / 100,
Currency."Amount Rounding Precision")
ELSE
"Prepmt. Line Amount" := ROUND("Line Amount" * "Prepayment %" / 100,Currency."Amount Rounding Precision");
// End of the lines.
IF "Prepmt. Line Amount" > "Line Amount" THEN
FIELDERROR("Prepmt. Line Amount",STRSUBSTNO(Text049,"Prepmt. Line Amount"));
END;
END;
InitOutstandingAmount;
...
...
IF "Quantity Invoiced" = 0 THEN BEGIN
"Prepmt. Line Amount" := ROUND("Line Amount" * "Prepayment %" / 100,Currency."Amount Rounding Precision");
IF "Prepmt. Line Amount" < "Prepmt. Amt. Inv." THEN
FIELDERROR("Prepmt. Line Amount",STRSUBSTNO(Text049,"Prepmt. Amt. Inv."));
END ELSE BEGIN
// Add the following lines.
IF "Prepayment %" <> 0 THEN BEGIN
IF "Prepayment %" = xRec."Prepayment %" THEN
"Prepmt. Line Amount" :=
ROUND("Line Amount" * (Quantity - "Quantity Invoiced") / Quantity * "Prepayment %" / 100,
Currency."Amount Rounding Precision")
ELSE
"Prepmt. Line Amount" := "Prepmt. Line Amount" +
ROUND("Line Amount" * (Quantity - "Quantity Invoiced") / Quantity * ABS("Prepayment %" - xRec."Prepayment %") / 100,
Currency."Amount Rounding Precision");
END ELSE
"Prepmt. Line Amount" := 0;
// End of the lines.
IF "Prepmt. Line Amount" > "Line Amount" THEN
FIELDERROR("Prepmt. Line Amount",STRSUBSTNO(Text049,"Prepmt. Line Amount"));
END;
END;
InitOutstandingAmount;
...