Jump to content
  • 0

[Custom Function] Controle BE BTW-nummers


Rony Rabijns

Question

Posted

Syntax : CF_BEBTWProef(BTWNummer)

 

Let(
[
BTW = Filter ( BTWNummer ; "0123456789" );
Restwaarde = 97 - Mod(Left(BTW;7);97)
];

Case(
not(Length(BTW) = 9 and Right(BTW;2)= restwaarde);"Ongeldig BTW-nummer";
"Geldig BTW-nummer"
)
)

 

Voorbeeld-bestand in bijlage.

BTWBEProef.zip

2 answers to this question

Recommended Posts

  • 0
Posted
Syntax : CF_BEBTWProef(BTWNummer)

 

Let(
[
BTW = Filter ( BTWNummer ; "0123456789" );
Restwaarde = 97 - Mod(Left(BTW;7);97)
];

Case(
not(Length(BTW) = 9 and Right(BTW;2)= restwaarde);"Ongeldig BTW-nummer";
"Geldig BTW-nummer"
)
)

 

Voorbeeld-bestand in bijlage.

 

NIET 100 % juist Rony.

Het gaat namelijk fout als de restwaarde maar 1 cijfer is, want dan wordt bvb 1 vergeleken met 01.

Gewoon een GetAsNumber toevoegen is ok.

 

Nieuwe aangepaste code

 

Let(
[
BTW = Filter ( BTWNummer ; "0123456789" );
Restwaarde = 97 - Mod(Left(BTW;7);97)
];

Case(
not(Length(BTW) = 9 and GetAsNumber (Right(BTW;2))= restwaarde);"Ongeldig BTW-nummer";
"Geldig BTW-nummer"
)
)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...