...
IF "Direct Unit Cost" < 0 THEN
FIELDERROR("Direct Unit Cost",STRSUBSTNO(Text043,FIELDCAPTION("Prepayment %")));
END;
IF PurchHeader."Document Type" <> PurchHeader."Document Type"::Invoice THEN BEGIN
"Prepayment VAT Difference" := 0;
// Delete the following lines.
"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(Text037,"Prepmt. Amt. Inv."));
// End of the deleted lines.
END;
IF PurchHeader.Status = PurchHeader.Status::Released THEN
UpdateVATAmounts;
InitOutstandingAmount;
...
...
IF "Direct Unit Cost" < 0 THEN
FIELDERROR("Direct Unit Cost",STRSUBSTNO(Text043,FIELDCAPTION("Prepayment %")));
END;
IF PurchHeader."Document Type" <> PurchHeader."Document Type"::Invoice THEN BEGIN
"Prepayment VAT Difference" := 0;
// Add the following lines.
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(Text037,"Prepmt. Amt. Inv."));
END ELSE BEGIN
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");
IF ("Prepmt. Line Amount" > "Line Amount") AND ("Prepayment %" <> 0) THEN
FIELDERROR("Prepmt. Line Amount",STRSUBSTNO(Text037,"Prepmt. Line Amount"));
END;
//End of the added lines.
END;
IF PurchHeader.Status = PurchHeader.Status::Released THEN
UpdateVATAmounts;
InitOutstandingAmount;
...