Skip to content

[NL][Report][11403][CreateElecVATDeclaration][CalcVATAmount] Add integration event OnCalcVATAmountOnAfterSetDateFilter #30178

@KateDovgalova

Description

@KateDovgalova

Why do you need this change?

In 4PS Construct we need to give user possibility to select one of two options to filter VAT statement line: within the period (standard) or before and within the period (new option). To do this we need to be able to override the date filter on VATStatementLine after the base report sets it in procedure CalcVATAmount of report 11403 "Create Elec. VAT Declaration".

Describe the request

Dear ALAppExtensions team,

On behalf of 4PS I would like to request integration event 'OnCalcVATAmountOnAfterSetDateFilter' to be added to procedure CalcVATAmount of report 11403 "Create Elec. VAT Declaration":

    local procedure CalcVATAmount(Category: Integer; SubCategory: Integer): Text[30]
    var
        VATStatementLine: Record "VAT Statement Line";
        VATStatementName: Record "VAT Statement Name";
        ElecTaxDeclVATCategory: Record "Elec. Tax Decl. VAT Category";
        VATStatement: Report "VAT Statement";
        CategoryCode: Code[10];
        Value: Decimal;
    begin
        CategoryCode := ElecTaxDeclVATCategory.GetCategoryCode(Category, SubCategory);
        ElecTaxDeclVATCategory.Get(CategoryCode);

        VATStatementLine.SetRange("Statement Template Name", VATTemplateName);
        VATStatementLine.SetRange("Statement Name", VATStmtName);
        VATStatementLine.SetRange("Elec. Tax Decl. Category Code", CategoryCode);

        case ElecTaxDeclVATCategory.Optional of
            true:
                if not VATStatementLine.FindFirst() then
                    exit('0');
            false:
                VATStatementLine.FindFirst();
        end;

        VATStatementName.Get(VATTemplateName, VATStmtName);

        VATStatementLine.SetRange("Date Filter",
          "Elec. Tax Declaration Header"."Declaration Period From Date", "Elec. Tax Declaration Header"."Declaration Period To Date");
        OnCalcVATAmountOnAfterSetDateFilter(VATStatementLine, "Elec. Tax Declaration Header"); //new
        VATStatement.SetElectronicVAT(true);
        VATStatement.InitializeRequest(
          VATStatementName, VATStatementLine, "VAT Statement Report Selection"::Open,
          "VAT Statement Report Period Selection"::"Within Period", true, false);
        VATStatement.CalcLineTotal(VATStatementLine, Value, 0);
    [IntegrationEvent(false, false)]
    local procedure OnCalcVATAmountOnAfterSetDateFilter(var VATStatementLine: Record "VAT Statement Line"; ElecTaxDeclarationHeader: Record "Elec. Tax Declaration Header")
    begin
        //new
    end;

Metadata

Metadata

Assignees

No one assigned

    Labels

    FinanceGitHub request for Finance areaevent-requestRequest for adding an event

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions