diff --git a/src/Apps/W1/EDocument/App/src/Processing/Import/Purchase/EDocPurchaseDraftSubform.Page.al b/src/Apps/W1/EDocument/App/src/Processing/Import/Purchase/EDocPurchaseDraftSubform.Page.al index 3b770f226a..6ed6b86930 100644 --- a/src/Apps/W1/EDocument/App/src/Processing/Import/Purchase/EDocPurchaseDraftSubform.Page.al +++ b/src/Apps/W1/EDocument/App/src/Processing/Import/Purchase/EDocPurchaseDraftSubform.Page.al @@ -87,7 +87,7 @@ page 6183 "E-Doc. Purchase Draft Subform" trigger OnValidate() begin - UpdateCalculatedAmounts(true); + UpdateCalculatedAmounts(true, true); end; } field("Direct Unit Cost"; Rec."Unit Price") @@ -96,7 +96,7 @@ page 6183 "E-Doc. Purchase Draft Subform" Editable = true; trigger OnValidate() begin - UpdateCalculatedAmounts(true); + UpdateCalculatedAmounts(true, true); end; } field("Total Discount"; Rec."Total Discount") @@ -106,7 +106,7 @@ page 6183 "E-Doc. Purchase Draft Subform" Editable = true; trigger OnValidate() begin - UpdateCalculatedAmounts(true); + UpdateCalculatedAmounts(true, true); end; } field("Line Amount"; LineAmount) @@ -336,7 +336,7 @@ page 6183 "E-Doc. Purchase Draft Subform" if EDocumentPurchaseLine.Get(Rec."E-Document Entry No.", Rec."Line No.") then; AdditionalColumns := Rec.AdditionalColumnsDisplayText(); SetHasAdditionalColumns(); - UpdateCalculatedAmounts(false); + UpdateCalculatedAmounts(false, false); IsLineMatchedToOrderLine := EDocPOMatching.IsEDocumentLineMatchedToAnyPOLine(EDocumentPurchaseLine); IsLineMatchedToReceiptLine := EDocPOMatching.IsEDocumentLineMatchedToAnyReceiptLine(EDocumentPurchaseLine); OrderMatchedCaption := IsLineMatchedToOrderLine ? GetSummaryOfMatchedOrders() : ''; @@ -374,7 +374,7 @@ page 6183 "E-Doc. Purchase Draft Subform" DimVisible1, DimVisible2, DimOther, DimOther, DimOther, DimOther, DimOther, DimOther); end; - local procedure UpdateCalculatedAmounts(UpdateParentRecord: Boolean) + local procedure UpdateCalculatedAmounts(UpdateParentRecord: Boolean; LaunchErrorOnInvalidDiscount: Boolean) var TotalEDocPurchaseLine: Record "E-Document Purchase Line"; EDocumentImportHelper: Codeunit "E-Document Import Helper"; @@ -383,6 +383,7 @@ page 6183 "E-Doc. Purchase Draft Subform" begin LineSubtotal := Rec.Quantity * Rec."Unit Price"; LineAmount := LineSubtotal - Rec."Total Discount"; + if LaunchErrorOnInvalidDiscount then if LineSubtotal = 0 then begin if Rec."Total Discount" > 0 then Error(DiscountExceedsSubtotalErr)