ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Codeunit 74 Purch.-Get Receipt CreateInvLines

Open BWilczewski opened this issue 6 years ago • 1 comments

Hello, I would like to post a follwing event request:

` procedure CreateInvLines(var PurchRcptLine2: Record "Purch. Rcpt. Line") var TransferLine: Boolean; PrepmtAmtToDeductRounding: Decimal; ShowVendMessage: Boolean; begin OnBeforeCreateInvLines(PurchRcptLine2, TransferLine);

    with PurchRcptLine2 do begin
        SetFilter("Qty. Rcd. Not Invoiced", '<>0');
        OnCreateInvLinesOnBeforeFind(PurchRcptLine2);
        if Find('-') then begin
            PurchLine.LockTable();
            PurchLine.SetRange("Document Type", PurchHeader."Document Type");
            PurchLine.SetRange("Document No.", PurchHeader."No.");
            PurchLine."Document Type" := PurchHeader."Document Type";
            PurchLine."Document No." := PurchHeader."No.";
            // mod here
            ShowVendMessage := PurchRcptHeader."Pay-to Vendor No." <> PurchHeader."Pay-to Vendor No.";
            // mod end
            OnBeforeInsertLines(PurchHeader);

            repeat
                if PurchRcptHeader."No." <> "Document No." then begin
                    PurchRcptHeader.Get("Document No.");
                    TransferLine := true;
                    if PurchRcptHeader."Currency Code" <> PurchHeader."Currency Code" then begin
                        Message(
                          Text000,
                          PurchHeader.FieldCaption("Currency Code"),
                          PurchHeader.TableCaption, PurchHeader."No.",
                          PurchRcptHeader.TableCaption, PurchRcptHeader."No.");
                        TransferLine := false;
                    end;
                    // mod here
                    OnBeforeCheckVendor(PurchHeader, PurchRcptHeader, ShowVendMessage, TransferLine);
                    if ShowVendMessage then begin
                        // mod end
                        Message(
                          Text000,
                          PurchHeader.FieldCaption("Pay-to Vendor No."),
                          PurchHeader.TableCaption, PurchHeader."No.",
                          PurchRcptHeader.TableCaption, PurchRcptHeader."No.");
                        TransferLine := false;
                    end;

[IntegrationEvent(false, false)] local procedure OnBeforeCheckVendor(PurchHeader: Record "Purchase Header"; PurchRcptHeader: Record "Purch. Rcpt. Header"; var ShowDifferentPayToVendMsg: Boolean; var TransferLine: Boolean) begin end; `

This would allow modfying system behvior in cases where it is possible to have different pay to vendor and also create custom code for this situation.

Thanks, Bartek

BWilczewski avatar Oct 13 '20 20:10 BWilczewski

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. We will update this issue with information about availability.

bc-ghost avatar Oct 21 '20 06:10 bc-ghost