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 Change Request] Codeunit 826 "Purch. Post Invoice Events" - RunOnCalculateVATAmountsOnAfterGetReverseChargeVATPostingSetup #27342

Open RZ440 opened 5 days ago

RZ440 commented 5 days ago

Describe the request

Hello, can you please add "PurchHeader" to the procedure RunOnCalculateVATAmountsOnAfterGetReverseChargeVATPostingSetup and to the event OnCalculateVATAmountsOnAfterGetReverseChargeVATPostingSetup in codeunit 826 "Purch. Post Invoice Events"?

    local procedure CalculateVATAmounts(PurchHeader: Record "Purchase Header"; var InvoicePostingBuffer: Record "Invoice Posting Buffer")
    var
.
.
.
        if InvoicePostingBuffer.FindSet() then
            repeat
                case InvoicePostingBuffer."VAT Calculation Type" of
                    InvoicePostingBuffer."VAT Calculation Type"::"Reverse Charge VAT":
                        begin
                            VATPostingSetup.Get(InvoicePostingBuffer."VAT Bus. Posting Group", InvoicePostingBuffer."VAT Prod. Posting Group");
                            PurchPostInvoiceEvents.RunOnCalculateVATAmountsOnAfterGetReverseChargeVATPostingSetup(VATPostingSetup, PurchHeader);

                            VATBaseAmount := InvoicePostingBuffer."VAT Base Amount" * (1 - PurchHeader."VAT Base Discount %" / 100);
                            VATBaseAmountACY := InvoicePostingBuffer."VAT Base Amount (ACY)" * (1 - PurchHeader."VAT Base Discount %" / 100);
    procedure RunOnCalculateVATAmountsOnAfterGetReverseChargeVATPostingSetup(var VATPostingSetup: Record "VAT Posting Setup")
    begin
        OnCalculateVATAmountsOnAfterGetReverseChargeVATPostingSetup(VATPostingSetup);
    end;

    [IntegrationEvent(false, false)]
    local procedure OnCalculateVATAmountsOnAfterGetReverseChargeVATPostingSetup(var VATPostingSetup: Record "VAT Posting Setup")
    begin
    end;

Additional context

We would like to change VAT % depending on the posting date of the purchase header. Internal work item: AB#550926