Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[IT][Event Request][Codeunit][12173] "Vendor Bill List - Post" - Function PostVendorBillLine() & Function PostBalanceAccount()

Đang mở Phù hợp với người mới
#12,422 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
66/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Lĩnh vực
backend

Hướng nghiên cứu

Mở Codeunit 12173 "Vendor Bill List - Post" và định vị các procedure PostVendorBillLine() và PostBalanceAccount(). Thêm hai khai báo [IntegrationEvent(false, false)] đúng như trong issue, giới thiệu biến IsHandled và bọc khối khởi tạo của Gen. Journal Line trong if not IsHandled then begin ... end; đồng thời giữ các sự kiện OnBefore* hiện có và các lệnh gọi GenJnlPostLine.RunWithCheck bên ngoài guard. Xong khi gói AL biên dịch được và các sự kiện mới có thể được gọi từ một extension; lưu ý đây là repo thuộc sở hữu của Microsoft nơi các yêu cầu mở rộng được phân loại (triage), vì vậy hãy xác nhận các maintainer chấp nhận thay đổi trước khi đầu tư.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

missing-info Team: Finance
Why do you need this change?

Hello,
We would need new events in the "PostVendorBillLine" and "PostBalanceAccount" procedures of Codeunit 12173 "Vendor Bill List - Post", in order to manage custom fields.

New Events and Code:

    procedure PostVendorBillLine(var GenJnlLine: Record "Gen. Journal Line"; VendorBillHeader: Record "Vendor Bill Header"; VendorBillLine: Record "Vendor Bill Line"; VendLedgEntry: Record "Vendor Ledger Entry"; Bill: Record Bill; var AmountLCY: Decimal)
    var
        Tax: Option " ",Withhold,"Free Lance",Company;
       //New Variable
        IsHandled: Boolean;
    begin
        GenJnlLine.Init();
//New Code
        IsHandled:=False; 
OnAfterInitGenJnlLineOnPostVendorBillLine(GenJnlLine,VendorBillHeader,VendorBillLine,VendLedgEntry,Bill,AmountLCY,IsHandled);
       if not IsHandled then begin
//
        GenJnlLine.Validate("Posting Date", VendorBillHeader."Posting Date");
        GenJnlLine."Document Type" := GenJnlLine."Document Type"::Payment;
        GenJnlLine."Document No." := VendorBillHeader."Vendor Bill List No.";
        GenJnlLine."Document Date" := VendorBillHeader."List Date";
        GenJnlLine."Account Type" := GenJnlLine."Account Type"::Vendor;
        GenJnlLine.Validate("Account No.", VendorBillLine."Vendor No.");
        GenJnlLine."Due Date" := VendorBillLine."Due Date";
        GenJnlLine."External Document No." := VendorBillLine."Vendor Bill List No.";
        GenJnlLine.Validate(Amount, VendorBillLine."Amount to Pay");
        GenJnlLine.Validate("Currency Code", VendorBillHeader."Currency Code");
        if not VendorBillLine."Manual Line" then begin
            GenJnlLine.Validate("Salespers./Purch. Code", VendLedgEntry."Purchaser Code");
            ApplyInvAndUpdateLedgEntry(GenJnlLine, VendorBillLine, Tax::" ");
        end else
            GenJnlLine."Applies-to Occurrence No." := VendorBillLine."Document Occurrence";
        GenJnlLine.Description := Bill.Description;
        GenJnlLine."Source Code" := Bill."Vend. Bill Source Code";
        GenJnlLine."System-Created Entry" := true;
        GenJnlLine."Reason Code" := VendorBillHeader."Reason Code";
        GenJnlLine."Shortcut Dimension 1 Code" := VendLedgEntry."Global Dimension 1 Code";
        GenJnlLine."Shortcut Dimension 2 Code" := VendLedgEntry."Global Dimension 2 Code";
        if not VendorBillLine."Manual Line" then
            GenJnlLine."Dimension Set ID" := VendLedgEntry."Dimension Set ID"
        else
            GenJnlLine."Dimension Set ID" := VendorBillLine."Dimension Set ID";
        GenJnlLine."Payment Method Code" := VendorBillHeader."Payment Method Code";
        AmountLCY := GenJnlLine."Amount (LCY)";
//New Code      
 end;
//
        OnBeforePostVendorBillLine(GenJnlLine, VendorBillHeader, VendorBillLine, VendLedgEntry);
        GenJnlPostLine.RunWithCheck(GenJnlLine);
    end;

    procedure PostBalanceAccount(GenJnlLine: Record "Gen. Journal Line"; VendorBillHeader: Record "Vendor Bill Header"; VendorBillLine: Record "Vendor Bill Line"; VendLedgEntry: Record "Vendor Ledger Entry"; Bill: Record Bill)
var
IsHandled:Boolean;    
begin
        GenJnlLine.Init();
//New Code
        IsHandled:=False; OnAfterInitGenJnlLineOnPostBalanceAccount(GenJnlLine,VendorBillHeader,VendorBillLine,VendLedgEntry,Bill,IsHandled);
if not IsHandled then begin
//
        GenJnlLine.Validate("Posting Date", VendorBillHeader."Posting Date");
        GenJnlLine."Document Type" := GenJnlLine."Document Type"::Payment;
        GenJnlLine."Document No." := VendorBillHeader."Vendor Bill List No.";
        GenJnlLine."Document Date" := VendorBillHeader."List Date";
        GenJnlLine."Account Type" := GenJnlLine."Account Type"::"Bank Account";
        GenJnlLine.Validate("Account No.", VendorBillHeader."Bank Account No.");
        GenJnlLine."Currency Code" := VendorBillHeader."Currency Code";
        GenJnlLine.Validate(Amount, -BalanceAmount);
        GenJnlLine.Validate("Amount (LCY)", -BalanceAmountLCY);
        GenJnlLine.Description := Bill.Description;
        GenJnlLine."Source Code" := Bill."Vend. Bill Source Code";
        GenJnlLine."System-Created Entry" := true;
        GenJnlLine."Reason Code" := VendorBillHeader."Reason Code";
        if not VendorBillLine."Manual Line" then
            GenJnlLine.Validate("Salespers./Purch. Code", VendLedgEntry."Purchaser Code");

        GenJnlLine."Shortcut Dimension 1 Code" := VendLedgEntry."Global Dimension 1 Code";
        GenJnlLine."Shortcut Dimension 2 Code" := VendLedgEntry."Global Dimension 2 Code";
        if not VendorBillLine."Manual Line" then
            GenJnlLine."Dimension Set ID" := VendLedgEntry."Dimension Set ID"
        else
            GenJnlLine."Dimension Set ID" := VendorBillLine."Dimension Set ID";
//New Code
end;
//
        GenJnlLine.CreateDimFromDefaultDim(GenJnlLine.FieldNo("Account No."));
        OnBeforePostBalanceAccount(GenJnlLine, VendorBillHeader, VendorBillLine, VendLedgEntry);
        GenJnlPostLine.RunWithCheck(GenJnlLine);
    end;

Signature:

 [IntegrationEvent(false, false)]
  OnAfterInitGenJnlLineOnPostVendorBillLine(var GenJnlLine: Record "Gen. Journal Line"; VendorBillHeader: Record "Vendor Bill Header"; VendorBillLine: Record "Vendor Bill Line"; VendLedgEntry: Record "Vendor Ledger Entry"; Bill: Record Bill; var AmountLCY: Decimal;var IsHandled:Boolean)
  begin
  end;
 [IntegrationEvent(false, false)]
  OnAfterInitGenJnlLineOnPostBalanceAccount(GenJnlLine: Record "Gen. Journal Line"; VendorBillHeader: Record "Vendor Bill Header"; VendorBillLine: Record "Vendor Bill Line"; VendLedgEntry: Record "Vendor Ledger Entry"; Bill: Record Bill;var IsHandled:Boolean)
  begin
  end;

Thank You,
Luca

Describe the request

We need this events to be able to manage custom fields on the Line Insert procedures, and we need to manage the validate triggers of the fields.
This request is a follow-up to an issue opened about a year ago. The requested change has not yet been implemented in the Business Central Base Application.

For reference, please see the previous discussion: https://github.com/microsoft/ALAppExtensions/issues/29093#issuecomment-3883244614

Provide an implementation (optional)
  • I will provide the implementation for this extensibility request
Ngôn ngữ chính
AL
Star
697
Fork
473
Merge trung bình
2 ngày 19 giờ
Pull request đã merge (30 ngày)
493

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/BCApps

Tất cả issue của microsoft/BCApps

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.