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] Table 11021 "Sales VAT Advance Notif." in Elster Extension - OnBeforeShowWrongPlaceError #27382

Open
BITNilsRoolf opened this issue Oct 8, 2024 · 0 comments

Comments

@BITNilsRoolf
Copy link

Describe the request

I propose to add this extensibility event to the Sales VAT Advance Notif. Table in procedure CheckVATNo.

procedure CheckVATNo(var PosTaxoffice: Integer; var NumberTaxOffice: Integer; var PosArea: Integer; var NumberArea: Integer; var PosDistinction: Integer; var NumberDistinction: Integer) VATNo: Text[30]
var
    CompanyInfo: Record "Company Information";
    //New Variable
    ShouldSkipWrongPlaceError: Boolean;
begin
    CompanyInfo.Get();
    CompanyInfo.TestField("Tax Office Area");
    CompanyInfo.TestField("Registration No.");

    VATNo := CopyStr(DelChr(CompanyInfo."Registration No."), 1, MaxStrLen(VATNo));
    VATNo := CopyStr(DelChr(VATNo, '=', '/'), 1, MaxStrLen(VATNo));

    case CompanyInfo."Tax Office Area" of
        8, 4, 2, 3, 7, 1, 16:               // resedually old areas
            begin
                PosTaxoffice := 9;
                NumberTaxOffice := 2;       // Tax Office No.
                PosArea := 12;
                NumberArea := 3;            // Area No.
                PosDistinction := 16;
                NumberDistinction := 4;     // Distinction No.
            end;
        6, 9, 10, 11, 12, 13, 14, 15:            // Bavaria, Saarland and new areas
            begin
                PosTaxoffice := 8;
                NumberTaxOffice := 3;
                PosArea := 12;
                NumberArea := 3;
                PosDistinction := 16;
                NumberDistinction := 4;
            end;
        5:                              // Nordrhein-Westfalen
            begin
                PosTaxoffice := 8;
                NumberTaxOffice := 3;
                PosArea := 12;
                NumberArea := 4;
                PosDistinction := 17;
                NumberDistinction := 3;
            end;
    end;
    ShouldSkipWrongPlaceError := not (StrLen(VATNo) <> NumberTaxOffice + NumberArea + NumberDistinction + 1);
    OnBeforeShowWrongPlaceError(CompanyInfo, VATNo, NumberTaxOffice, NumberArea, NumberDistinction, ShouldSkipWrongPlaceError);
    if not ShouldSkipWrongPlaceError then
        Error(
          WrongPlaceErr,
          CompanyInfo.FieldCaption("Registration No."),
          CompanyInfo."Tax Office Area", NumberTaxOffice + NumberArea + NumberDistinction + 1);
end;

Event definition:

[IntegrationEvent(false, false)]
local procedure OnBeforeShowWrongPlaceError(CompanyInfo: Record "Company Information"; var VATNo: Text[30]; var NumberTaxOffice: Integer; var NumberArea: Integer; var NumberDistinction: Integer; var ShouldSkipWrongPlaceError: Boolean)
begin
end;

Additional context

For my business case, I need to have the possibility to skip the Error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant