The additional barcode of the documents printed in contingency on the security form (FS-DA, and FS-IA of the NF-e): "Dados da NF-e" (MOC 7.0, Anexo II, item 2.9.2) and "Dados do CT-e" (MOC 3.00a of the DACTE, item 2.18.2). It is a Code 128 subset C of 36 digits, and the same 36 digits in nine blocks of four go printed in the box next to it.
The layout, every field right aligned, zero padded and without formatting:
| Field | Size | Content |
|---|---|---|
cUF | 2 | IBGE code of the UF of the recipient (or sender); 99 for a foreign one |
tpEmis | 1 | the emission type |
CNPJ | 14 | CNPJ of the recipient (or sender), its CPF zero padded, zeros when foreign |
vNF | 14 | the total value in cents (vNF of the NF-e, vTPrest of the CT-e) |
ICMSp | 1 | 1 when the own ICMS is shown on the document, else 2 |
ICMSs | 1 | 1 when the ICMS of the tax substitution is shown, else 2 |
DD | 2 | the day of the emission |
DV | 1 | the check digit, modulo 11 as the one of the access key |
Pure: build/1 takes what the data modules read from the XML and answers the digits and their
presentation.
Summary
Functions
The code of a document: %{"digits" => "...36 digits...", "formatted" => "9999 9999 ..."}.
The check digit of digits: modulo 11 with weights 2 to 9 from the right, as the access key's. It
is 11 - rem(sum, 11), and 0 when the remainder is 0 or 1.
The digits in blocks of four, separated by a space.
Whether a decimal as the XML writes it (28.80) is greater than zero.
The IBGE code of a UF; 99 for EX, an unknown UF or none.
Types
Functions
The code of a document: %{"digits" => "...36 digits...", "formatted" => "9999 9999 ..."}.
:uf- the UF of the recipient or sender ("EX"or none for a foreign one);:emission_type- thetpEmis;:tax_id- the CNPJ (14 digits) or CPF (11 digits, zero padded) of the same party,nilwhen foreign; punctuation is ignored;:amount- the total value as the XML writes it ("252.00");:own_icms?and:st_icms?- the ICMS flags;:issued_at- thedhEmi(ISO 8601), of which the day is taken.
@spec check_digit(String.t()) :: 0..9
The check digit of digits: modulo 11 with weights 2 to 9 from the right, as the access key's. It
is 11 - rem(sum, 11), and 0 when the remainder is 0 or 1.
The digits in blocks of four, separated by a space.
Whether a decimal as the XML writes it (28.80) is greater than zero.
The IBGE code of a UF; 99 for EX, an unknown UF or none.