Skip to content
Draft
Show file tree
Hide file tree
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 @@ -507,7 +507,6 @@ codeunit 6103 "E-Document Subscribers"
DataClassificationEvalData.SetTableFieldsToNormal(Database::"E-Doc. Purchase Line History");
DataClassificationEvalData.SetTableFieldsToNormal(Database::"E-Document Line - Field");
DataClassificationEvalData.SetTableFieldsToNormal(Database::"ED Purchase Line Field Setup");
DataClassificationEvalData.SetTableFieldsToNormal(Database::"E-Doc. PO Matching Setup");
#if not CLEAN28
#pragma warning disable AL0432
DataClassificationEvalData.SetTableFieldsToNormal(Database::"EDoc Historical Matching Setup");
Expand All @@ -516,7 +515,6 @@ codeunit 6103 "E-Document Subscribers"
DataClassificationEvalData.SetTableFieldsToNormal(Database::"E-Doc. Vendor Assign. History");
DataClassificationEvalData.SetTableFieldsToNormal(Database::"E-Doc. Record Link");
DataClassificationEvalData.SetTableFieldsToNormal(Database::"E-Document Notification");
DataClassificationEvalData.SetTableFieldsToNormal(Database::"E-Doc. PO Matching Setup");
#if not CLEAN26
#pragma warning disable AL0432
DataClassificationEvalData.SetTableFieldsToNormal(Database::"EDoc. Purch. Line Field Setup");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,12 @@ codeunit 6117 "E-Doc. Create Purchase Invoice" implements IEDocumentFinishDraft,
EDocImpSessionTelemetry: Codeunit "E-Doc. Imp. Session Telemetry";
EmptyRecordId: RecordId;
IEDocumentFinishPurchaseDraft: Interface IEDocumentCreatePurchaseInvoice;
YourMatchedLinesAreNotValidErr: Label 'The purchase invoice cannot be created because one or more of its matched lines are not valid matches. Review if your configuration allows for receiving at invoice.';
SomeLinesNotYetReceivedErr: Label 'Some of the matched purchase order lines have not yet been received, you need to either receive the lines or remove the matches.';
MissingInformationForMatchErr: Label 'Some of the draft lines that were matched to purchase order lines are missing unit of measure information. Please specify the unit of measure for those lines and try again.';
begin
EDocumentPurchaseHeader.GetFromEDocument(EDocument);

if not EDocPOMatching.VerifyEDocumentMatchedLinesAreValidMatches(EDocumentPurchaseHeader) then
Error(YourMatchedLinesAreNotValidErr);

EDocPOMatching.SuggestReceiptsForMatchedOrderLines(EDocumentPurchaseHeader);
EDocPOMatching.CalculatePOMatchWarnings(EDocumentPurchaseHeader, TempPOMatchWarnings);
TempPOMatchWarnings.SetRange("Warning Type", "E-Doc PO Match Warning"::ExceedsInvoiceableQty);
if not TempPOMatchWarnings.IsEmpty() then
Error(SomeLinesNotYetReceivedErr);
TempPOMatchWarnings.SetRange("Warning Type", "E-Doc PO Match Warning"::MissingInformationForMatch);
if not TempPOMatchWarnings.IsEmpty() then
Error(MissingInformationForMatchErr);
Expand Down Expand Up @@ -88,17 +80,12 @@ codeunit 6117 "E-Doc. Create Purchase Invoice" implements IEDocumentFinishDraft,
VendorLedgerEntry: Record "Vendor Ledger Entry";
EDocumentPurchaseHeader: Record "E-Document Purchase Header";
EDocumentPurchaseLine: Record "E-Document Purchase Line";
PurchaseLine: Record "Purchase Line";
EDocRecordLink: Record "E-Doc. Record Link";
EDocPurchaseDocumentHelper: Codeunit "E-Doc. Purch. Doc. Helper";
PurchCalcDiscByType: Codeunit "Purch - Calc Disc. By Type";
EDocLineByReceipt: Query "E-Doc. Line by Receipt";
LastReceiptNo: Code[20];
PurchaseLineNo: Integer;
StopCreatingPurchaseInvoice: Boolean;
VendorInvoiceNo: Code[35];
ReceiptNoLbl: Label 'Receipt No. %1:', Comment = '%1 = Receipt No.';
NullGuid: Guid;
begin
EDocumentPurchaseHeader.GetFromEDocument(EDocument);
if not EDocPurchaseDocumentHelper.AllDraftLinesHaveTypeAndNumber(EDocumentPurchaseHeader) then begin
Expand Down Expand Up @@ -142,40 +129,12 @@ codeunit 6117 "E-Doc. Create Purchase Invoice" implements IEDocumentFinishDraft,
EDocRecordLink.InsertEDocumentHeaderLink(EDocumentPurchaseHeader, PurchaseHeader);

PurchaseLineNo := EDocPurchaseDocumentHelper.GetLastPurchaseLineNo("Purchase Document Type"::Invoice, PurchaseHeader."No."); // We get the last line number, even if this is a new document since recurrent lines get inserted on the header's creation
// We create first the lines without any PO matches
EDocLineByReceipt.SetRange(EDocumentEntryNo, EDocument."Entry No");
EDocLineByReceipt.SetRange(ReceiptNo, '');
EDocLineByReceipt.SetRange(PurchaseLineSystemId, NullGuid);
EDocLineByReceipt.Open();
while EDocLineByReceipt.Read() do begin
EDocumentPurchaseLine.GetBySystemId(EDocLineByReceipt.SystemId);
PurchaseLineNo += 10000;
EDocPurchaseDocumentHelper.CreatePurchaseLineFromDraft(PurchaseHeader, EDocumentPurchaseLine, EDocumentPurchaseHeader."Total Discount" > 0, PurchaseLineNo);
end;
EDocLineByReceipt.Close();

// Then we create the lines with receipt no., adding comment lines for each receipt no.
LastReceiptNo := '';
EDocLineByReceipt.SetFilter(ReceiptNo, '<> %1', '');
EDocLineByReceipt.SetRange(PurchaseLineSystemId);
EDocLineByReceipt.Open();
while EDocLineByReceipt.Read() do begin
if LastReceiptNo <> EDocLineByReceipt.ReceiptNo then begin // A receipt no. for which we have not created a header comment line yet
Clear(PurchaseLine);
PurchaseLine."Document Type" := PurchaseHeader."Document Type";
PurchaseLine."Document No." := PurchaseHeader."No.";
EDocumentPurchaseLine.SetRange("E-Document Entry No.", EDocument."Entry No");
if EDocumentPurchaseLine.FindSet() then
repeat
PurchaseLineNo += 10000;
PurchaseLine."Line No." := PurchaseLineNo;
PurchaseLine.Type := PurchaseLine.Type::" ";
PurchaseLine.Description := StrSubstNo(ReceiptNoLbl, EDocLineByReceipt.ReceiptNo);
PurchaseLine.Insert();
end;
EDocumentPurchaseLine.GetBySystemId(EDocLineByReceipt.SystemId);
PurchaseLineNo += 10000;
EDocPurchaseDocumentHelper.CreatePurchaseLineFromDraft(PurchaseHeader, EDocumentPurchaseLine, EDocumentPurchaseHeader."Total Discount" > 0, PurchaseLineNo);
LastReceiptNo := EDocLineByReceipt.ReceiptNo;
end;
EDocLineByReceipt.Close();
EDocPurchaseDocumentHelper.CreatePurchaseLineFromDraft(PurchaseHeader, EDocumentPurchaseLine, EDocumentPurchaseHeader."Total Discount" > 0, PurchaseLineNo);
until EDocumentPurchaseLine.Next() = 0;
PurchaseHeader.Modify();
PurchCalcDiscByType.ApplyInvDiscBasedOnAmt(EDocumentPurchaseHeader."Total Discount", PurchaseHeader);
EDocPurchaseDocumentHelper.ApplyVATDifferenceToLines(PurchaseHeader, EDocumentPurchaseHeader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ page 6183 "E-Doc. Purchase Draft Subform"
field(MatchWarnings; MatchWarningsCaption)
{
ApplicationArea = All;
Caption = 'Order match warnings';
Caption = 'Warnings';
Editable = false;
Visible = HasEDocumentOrderMatchWarnings;
StyleExpr = MatchWarningsStyleExpr;
Expand Down Expand Up @@ -188,9 +188,9 @@ page 6183 "E-Doc. Purchase Draft Subform"
action(MatchToOrderLine)
{
ApplicationArea = All;
Caption = 'Match to order line';
Caption = 'Match to order lines';
Image = LinkWithExisting;
ToolTip = 'Match this incoming invoice line to a purchase order line.';
ToolTip = 'Match this incoming invoice line to purchase order lines.';
Scope = Repeater;

trigger OnAction()
Expand All @@ -211,9 +211,9 @@ page 6183 "E-Doc. Purchase Draft Subform"
action(SpecifyReceiptLines)
{
ApplicationArea = All;
Caption = 'Specify receipt line';
Caption = 'Specify receipt lines';
Image = ReceiptLines;
ToolTip = 'Specify the corresponding receipt line to the matched order line.';
ToolTip = 'Specify the corresponding receipt lines to the matched order lines.';
Scope = Repeater;
Enabled = IsLineMatchedToOrderLine;

Expand All @@ -235,9 +235,9 @@ page 6183 "E-Doc. Purchase Draft Subform"
action(OpenMatchedOrder)
{
ApplicationArea = All;
Caption = 'Open matched order';
Caption = 'Open matched orders';
Image = ViewOrder;
ToolTip = 'Opens the matched purchase order.';
ToolTip = 'Opens the matched purchase orders.';
Scope = Repeater;
Enabled = IsLineMatchedToOrderLine;

Expand All @@ -249,9 +249,9 @@ page 6183 "E-Doc. Purchase Draft Subform"
action(OpenMatchedReceipt)
{
ApplicationArea = All;
Caption = 'Open matched receipt';
Caption = 'Open matched receipts';
Image = PostedReceipt;
ToolTip = 'Opens the matched purchase receipt.';
ToolTip = 'Opens the matched purchase receipts.';
Scope = Repeater;
Enabled = IsLineMatchedToReceiptLine;

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading