Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#12,422 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
66/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
領域
backend

調査の方向性

Codeunit 12173 "Vendor Bill List - Post" を開き、手続き PostVendorBillLine() と PostBalanceAccount() を特定してください。issue に記載されているとおりに 2 つの [IntegrationEvent(false, false)] 宣言を正確に追加し、変数 IsHandled を導入した上で、Gen. Journal Line の初期化ブロックを if not IsHandled then begin ... end; で囲ってください。既存の OnBefore* イベントと GenJnlPostLine.RunWithCheck の呼び出しはガードの外に配置したままにしてください。完了条件は、AL パッケージがコンパイルでき、新しいイベントが拡張機能から呼び出せることです。なお、これは Microsoft 所有のリポジトリであり、拡張性の要求はトリアージされるため、時間を投資する前にメンテナンス担当者が変更を受け入れるかどうかを確認してください。

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
AL
スター
714
フォーク
482
平均マージ
3日 1時間
マージ済み PR(30日)
541

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/BCApps のほかの issue

microsoft/BCApps の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。