Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Event Request] Report 10715 "Telematic VAT Declaration" - OnBeforeSetVATEntryFilters #28015

Open
genisbosch opened this issue Jan 29, 2025 · 0 comments
Labels
event-request Request for adding an event Finance GitHub request for Finance area

Comments

@genisbosch
Copy link

genisbosch commented Jan 29, 2025

Describe the request

Current Code:

`VATStatementLine2.Type::"VAT Entry Totaling":
begin
VATEntry.Reset();
NoTaxableEntry.Reset();
IsNoTaxableEntry := false;

                if VATPostingSetup.Get(VATStatementLine2."VAT Bus. Posting Group", VATStatementLine2."VAT Prod. Posting Group") and
                   (VATPostingSetup."VAT Calculation Type" = VATPostingSetup."VAT Calculation Type"::"No Taxable VAT")
                then begin
                    IsNoTaxableEntry := true;
                    SetFilterOnNoTaxableEntry(NoTaxableEntry, VATStatementLine2);
                    if NoTaxableEntry.FindFirst() then;
                end
                else begin
                    if VATEntry.SetCurrentKey(Type, Closed, "VAT Bus. Posting Group", "VAT Prod. Posting Group", "Posting Date") then begin
                        VATEntry.SetRange("VAT Bus. Posting Group", VATStatementLine2."VAT Bus. Posting Group");
                        VATEntry.SetRange("VAT Prod. Posting Group", VATStatementLine2."VAT Prod. Posting Group");
                    end
                    else begin
                        VATEntry.SetCurrentKey(Type, Closed, "Tax Jurisdiction Code", "Use Tax", "Posting Date");
                        VATEntry.SetRange("Tax Jurisdiction Code", VATStatementLine2."Tax Jurisdiction Code");
                        VATEntry.SetRange("Use Tax", VATStatementLine2."Use Tax");
                    end;`

VATStatementLine2.Type::"EC Entry Totaling": begin VATEntry.Reset(); if VATEntry.SetCurrentKey( Type, Closed, "VAT Bus. Posting Group", "VAT Prod. Posting Group", "Posting Date") then begin VATEntry.SetRange("VAT Bus. Posting Group", VATStatementLine2."VAT Bus. Posting Group"); VATEntry.SetRange("VAT Prod. Posting Group", VATStatementLine2."VAT Prod. Posting Group"); end else begin VATEntry.SetCurrentKey( Type, Closed, "Tax Jurisdiction Code", "Use Tax", "Posting Date"); VATEntry.SetRange("Tax Jurisdiction Code", VATStatementLine2."Tax Jurisdiction Code"); VATEntry.SetRange("Use Tax", VATStatementLine2."Use Tax"); end;

Requested:

`VATStatementLine2.Type::"VAT Entry Totaling":
begin
VATEntry.Reset();
NoTaxableEntry.Reset();
IsNoTaxableEntry := false;

                OnBeforeSetVATEntryFilters(VATEntry, VATStatementLine2);  // <--- NEW EVENT

                if VATPostingSetup.Get(VATStatementLine2."VAT Bus. Posting Group", VATStatementLine2."VAT Prod. Posting Group") and
                   (VATPostingSetup."VAT Calculation Type" = VATPostingSetup."VAT Calculation Type"::"No Taxable VAT")
                then begin
                    IsNoTaxableEntry := true;
                    SetFilterOnNoTaxableEntry(NoTaxableEntry, VATStatementLine2);
                    if NoTaxableEntry.FindFirst() then;
                end
                else begin
                    if VATEntry.SetCurrentKey(Type, Closed, "VAT Bus. Posting Group", "VAT Prod. Posting Group", "Posting Date") then begin
                        VATEntry.SetRange("VAT Bus. Posting Group", VATStatementLine2."VAT Bus. Posting Group");
                        VATEntry.SetRange("VAT Prod. Posting Group", VATStatementLine2."VAT Prod. Posting Group");
                    end
                    else begin
                        VATEntry.SetCurrentKey(Type, Closed, "Tax Jurisdiction Code", "Use Tax", "Posting Date");
                        VATEntry.SetRange("Tax Jurisdiction Code", VATStatementLine2."Tax Jurisdiction Code");
                        VATEntry.SetRange("Use Tax", VATStatementLine2."Use Tax");
                    end;`

`VATStatementLine2.Type::"EC Entry Totaling":
begin
VATEntry.Reset();

                OnBeforeSetVATEntryFilters(VATEntry, VATStatementLine2);  // <--- NEW EVENT

                if VATEntry.SetCurrentKey(
                     Type, Closed, "VAT Bus. Posting Group", "VAT Prod. Posting Group", "Posting Date")
                then begin
                    VATEntry.SetRange("VAT Bus. Posting Group", VATStatementLine2."VAT Bus. Posting Group");
                    VATEntry.SetRange("VAT Prod. Posting Group", VATStatementLine2."VAT Prod. Posting Group");
                end else begin
                    VATEntry.SetCurrentKey(
                      Type, Closed, "Tax Jurisdiction Code", "Use Tax", "Posting Date");
                    VATEntry.SetRange("Tax Jurisdiction Code", VATStatementLine2."Tax Jurisdiction Code");
                    VATEntry.SetRange("Use Tax", VATStatementLine2."Use Tax");
                end;`

New Event:

[IntegrationEvent(false, false)] local procedure OnBeforePostSalesDoc(var VATEntry: Record "VAT Entry"; VATStatementLine2: Record "VAT Statement Line"; var IsHandled: Boolean) begin end;

Additional context

We need an event to modify filters in VATEntries when calculating Telematic VAT Declaration CalcTotLine.
Internal work item: AB#563992

@AndersLarsenMicrosoft AndersLarsenMicrosoft added event-request Request for adding an event Finance GitHub request for Finance area labels Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event-request Request for adding an event Finance GitHub request for Finance area
Projects
None yet
Development

No branches or pull requests

2 participants