Skip to content

[Event Request] - Add OnBeforeCalcRevChargeVATAmountInPurchLine (IsHandled) in Non-Deductible VAT #29958

Description

@skully1991

Why do you need this change?

Within the Data Dynamic AG construct, there is a requirement to calculate the VAT amount based on custom business logic. For this reason, the event described below is needed.

Describe the request

  • Add IntegrationEvent in codeunit 6200 "Non-Deductible VAT"
  • Change procedure CalcRevChargeVATAmountInPurchLine in codeunit 6201 "Non-Ded. VAT Impl.".

New IntegrationEvent in codeunit 6200 "Non-Deductible VAT":

    [IntegrationEvent(false, false)]
    local procedure OnBeforeCalcRevChargeVATAmountInPurchLine(PurchaseLine: Record "Purchase Line"; var IsHandled: Boolean; var VATAmount: Decimal)
    begin
    end;

Invoke the new event in the local procedure CalcRevChargeVATAmountInPurchLine in codeunit 6201 "Non-Ded. VAT Impl.".

    local procedure CalcRevChargeVATAmountInPurchLine(PurchaseLine: Record "Purchase Line") VATAmount: Decimal;
    var
        VATPostingSetup: Record "VAT Posting Setup";
        Currency: Record Currency;
        IsHandled: Boolean;
    begin
        //Add new IntegrationEvent begin
        NonDeductibleVAT.OnBeforeCalcRevChargeVATAmountInPurchLine(PurchaseLine, IsHandled, VATAmount);
        If IsHandled then
            exit(VATAmount);
        //Add new IntegrationEvent end

        VATPostingSetup.Get(PurchaseLine."VAT Bus. Posting Group", PurchaseLine."VAT Prod. Posting Group");
        Currency.Initialize(PurchaseLine."Currency Code", true);
        VATAmount :=
            Round(
                PurchaseLine.Amount * VATPostingSetup."VAT %" / 100,
                Currency."Amount Rounding Precision", Currency.VATRoundingDirection());
    end;

Internal work item: AB#632747

Metadata

Metadata

Assignees

No one assigned

    Labels

    FinanceGitHub request for Finance areaevent-requestRequest for adding an event

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions