| Business-BR-Ids documentation | view source | Contained in the Business-BR-Ids distribution. |
Business::BR::IE - Perl module to test for correct IE numbers
use Business::BR::IE qw(test_ie canon_ie format_ie random_ie);
test_ie('sp', '110.042.490.114') # 1
test_ie('pr', '123.45678-50') # 1
test_ie('ac', '01.004.823/001-12') # 1
test_ie('al', '24.000.004-8') # 1
test_ie('am', '04.117.161-6') # 1
test_ie('ba', '123456-63') # 1
test_ie('ma', '12.000.038-5') # 1
test_ie('mg', '062.307.904/0081') #1
test_ie('rr', '24.006.628-1') # 1
test_ie('ap', '03.012.345-9') # 1
YET TO COME. Handles IE for the states of Acre (AC), Alagoas (AL), Amapá (AP), Amazonas (AM), Bahia (BA), Maranhão (MA), Minas Gerais (MG), Paraná (PR), Rondônia (RO), Roraima (RR) and Sao Paulo (SP) by now.
test_ie is exported by default. canon_ie, format_ie,
random_ie and parse_ie can be exported on demand.
Each state has its own rules for IE numbers. In this section, we gloss over each one of these
The state of Acre uses:
'01.004.823/001-12' a_1 a_2 a_3 a_4 a_5 a_6 a_7 a_8 a_9 a_10 a_11 d_1 d_2
a_1 a_2 = 0 1
4 a_1 + 3 a_2 + 2 a_3 + 9 a_4 + 8 a_5 + 7 a_6 + 6 a_7 +
5 a_8 + 4 a_9 + 3 a_10 + 2 a_11 + d_1 = 0 (mod 11) or
= 1 (mod 11) (if d_1 = 0)
5 a_1 + 4 a_2 + 3 a_3 + 2 a_4 + 9 a_5 + 8 a_6 + 7 a_7 +
6 a_8 + 5 a_9 + 4 a_10 + 3 a_11 + 2 d_1 + d_2 = 0 (mod 11) or
= 1 (mod 11) (if d_2 = 0)
The state of Alagoas uses:
'24.000.004-8' a_1 a_2 a_3 a_4 a_5 a_6 a_7 a_8 d_1
a_1 a_2 = 2 4
0 - "normal" 1 - "normal" 3 - "produtor rural" 5 - "substituta" 6 - "empresa pequeno porte" 7 - "micro empresa ambulante" 8 - "micro empresa" 9 - "especial"
( 9 a_1 + 2 a_2 + 3 a_3 + 4 a_4 + 5 a_5
6 a_6 + 7 a_7 + 8 a_8 ) * 10 - d_1 = 0 (mod 11) or
= 10 (mod 11) (if d_1 = 0)
The state of Amazonas uses:
'11.111.111-0' a_1 a_2 a_3 a_4 a_5 a_6 a_7 a_8 d_1
9 a_1 + 8 a_2 + 7 a_3 + 6 a_4 + 5 a_5
4 a_6 + 3 a_7 + 2 a_8 + d_1 = 0 (mod 11) or
= 1 (mod 11) (if d_1 = 0)
The state of Bahia uses:
'123456-63'The state of Maranhão uses:
'12.000.038-5' a_1 a_2 a_3 a_4 a_5 a_6 a_7 a_8 d_1
a_1 a_2 = 1 2
( 9 a_1 + 8 a_2 + 7 a_3 + 6 a_4 + 5 a_5
4 a_6 + 3 a_7 + 2 a_8 ) - d_1 = 0 (mod 11) or
= 10 (mod 11) (if d_1 = 0)
The state of Minas Gerais uses:
'062.307.904/0081' http://www.sintegra.gov.br/Cad_Estados/cad_MG.html
The state of Paraná uses:
'123.45678-50'The state of Rondônia uses:
'0000000062521-3' a_1 a_2 a_3 a_4 a_5 a_6 a_7 a_8 a_9 a_10 a_11 a_12 a_13 d_1
( 6 a_1 + 5 a_2 + 4 a_3 + 3 a_4 + 2 a_5 +
9 a_6 + 8 a_7 + 7 a_8 + 6 a_9 + 5 a_10 +
4 a_11 + 3 a_12 + 2 a_13 + d_1 = 0 (mod 11) or
= 1 (mod 11) if d_1 = 0
The state of Roraima uses:
'24.006.628-1' a_1 a_2 a_3 a_4 a_5 a_6 a_7 a_8 d_1
a_1 a_2 = 2 4
( 1 a_1 + 2 a_2 + 3 a_3 + 4 a_4 + 5 a_5
6 a_6 + 7 a_7 + 8 a_8 ) - d_1 = 0 (mod 9)
The state of São Paulo uses:
'110.042.490.114'Please reports bugs via CPAN RT, http://rt.cpan.org/NoAuth/Bugs.html?Dist=Business-BR-Ids By doing so, the author will receive your reports and patches, as well as the problem and solutions will be documented.
A. R. Ferreira, <ferreira@cpan.org>
Copyright (C) 2005-2007 by A. R. Ferreira
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Business-BR-Ids documentation | view source | Contained in the Business-BR-Ids distribution. |