Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -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)
Expand Down Expand Up @@ -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() : '';
Expand Down Expand Up @@ -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";
Expand All @@ -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)
Expand Down
Loading