microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
773 stars 610 forks source link

[Event Request] codeunit 816 "Purch. Post Invoice" - RunOnCalculateVATAmountsAfterVatCalculationType #27314

Open RZ440 opened 1 week ago

RZ440 commented 1 week ago

Describe the request

Hello, can you please add a new Event RunOnCalculateVATAmountsAfterVatCalculationType in codeunit 816 "Purch. Post Invoice"?

    local procedure CalculateVATAmounts(PurchHeader: Record "Purchase Header"; var InvoicePostingBuffer: Record "Invoice Posting Buffer")
    var
.
.
.
                            GLSetup.Get();
                            if GLSetup."Additional Reporting Currency" <> '' then
                                InvoicePostingBuffer."VAT Amount (ACY)" :=
                                    CurrExchRate.ExchangeAmtLCYToFCY(
                                        PurchHeader."Posting Date", GLSetup."Additional Reporting Currency",
                                        InvoicePostingBuffer."VAT Amount", 0);
                            InvoicePostingBuffer.Modify();
                        end;
                    else
                        PurchPostInvoiceEvents.RunOnCalculateVATAmountsAfterVatCalculationType(TempInvoicePostingBuffer, PurchHeader, VATPostingSetup);
                end;
            until InvoicePostingBuffer.Next() = 0;
    end;
codeunit 826 "Purch. Post Invoice Events"
.
.
.
    procedure RunOnCalculateVATAmountsAfterVatCalculationType(var TempInvoicePostingBuffer: Record "Invoice Posting Buffer" temporary; var PurchHeader: Record "Purchase Header"; VatPostingSetup: Record "VAT Posting Setup")
    begin
        OnCalculateVATAmountsAfterVatCalculationType(TempInvoicePostingBuffer, PurchHeader, VatPostingSetup);
    end;

    [IntegrationEvent(false, false)]
    local procedure OnCalculateVATAmountsAfterVatCalculationType(var TempInvoicePostingBuffer: Record "Invoice Posting Buffer" temporary; var PurchHeader: Record "Purchase Header"; VatPostingSetup: Record "VAT Posting Setup")
    begin
    end;

Additional context

We have an additional vat case. Internal work item: AB#550246