Brian Dunning's FileMaker Custom Functions

Validate_Generate_CNPJ ( fnType ; CNPJ )

A variation of Francisco Carlos Otani's

  Average rating: 4.3 (41 votes) Log in to vote

Edward Souza   Edward Souza
Duana A.S. Designs, LLC
n/a

Share on Facebook Share on Twitter

  Sample input:
Validate_Generate_CNPJ ( 1 , 123456789123 )
  Sample output:
12.345.678/1234-56

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

The Brazilian Government IRS employs a Modulus 11 Algorithm variation to calculate a tax-oriented cadastral number -- compulsory to all companies countrywide -- entitled "CNPJ".
Francisco Carlos Otani wrote a useful CF (http://www.briandunning.com/cf/1215) to validate the cadastral number checksum digits, which are the last two of a series of 14 numerical digits. Looking at Otani's CF code, I realized it could be restructured modularly; it would be concurrently conciser and more abstract, hence used as the starting point to another Modulus 11 Algorithm variation. Also, since it validated checksum numbers, the CF could as well spawn them.

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.