Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Belgium VAT codes
Message
General information
Forum:
Visual FoxPro
Category:
Contracts, agreements and general business
Miscellaneous
Thread ID:
00510875
Message ID:
00512080
Views:
13
>Does anyone please have a set of rules that apply to Validating Belgium VAT codes.
>
>I admit it's a boring one to ask - I want to include this in a clean-up application but have tried the usual Internet search routes and come up with nothing.
>
>Many thanks in advance,
>
>Ian

These lines should do it:
*---------------------- Location Section ----------------------
*  Library...........:
*  Class.............: Ctvatextbox
*  Method............: Valid()
*-------------------------- Copyright -------------------------
*  Author............: José Constant                      
*  Project...........: Prosal                             
*  Created...........: 29/07/96  10:23:59
*  Copyright.........: (c) Terre-Engineering S.A.             , 1996
*----------------------- Usage Section ------------------------
*) Description.......: Validate a VAT number.
*)                   : if a belgian VAT number
*)                   : Take the 7 first digits
*)                   : divide by 97
*)                   : (97 - modulo) must be == last 2 digits
*  Scope.............:
*  Parameters........: None
*$ Usage.............: Drop on any form, just set the control source right
*% Example...........:
*  Returns...........: logical
*------------------- Maintenance Section ----------------------
*@ Inputs:...........:
*  Outputs...........:
*  Pre-condt. invar..:
*  Post-condt.invar..:
*? Notes.............: None
*  Collab.methods....: None
*--Process...........:
*  Change log........:
*--------------------------------------------------------------
LOCAL llBelge, ;
      lnNumerator, ;
      lnModulo

llBelge     = UPPER(SUBSTR(this.Value, 1, 2)) = "BE"
lnNumerator = VAL(SUBSTR(this.Value,3,7))
lnModulo    = VAL(SUBSTR(this.Value, 10, 2))

IF llBelge
	IF 97 - MOD(lnNumerator, 97) = lnModulo
	  RETURN .T.
	ELSE
	  = ErrorMsg(ILLEGALVALUE_LOC)
	  RETURN .F.
	ENDIF
ELSE
	*-- no control yet
	RETURN .T.
ENDIF
Previous
Reply
Map
View

Click here to load this message in the networking platform