The Brazilian presentation of the values of a DANFE: tax ids, CEP, dates, money, quantities and
the access key. Every function takes what the XML holds (text, nil when absent) and answers
text, or nil when there is nothing to show, so a missing field stays blank.
Summary
Functions
The 44 digits of an access key in groups of four.
The date of an ISO 8601 date or date-time as dd/mm/yyyy, as the issuer wrote it (no zone shift).
An ISO 8601 date-time as dd/mm/yyyy HH:MM:SS.
A decimal as money: two places, . for thousands and , for decimals (1.234,50).
The number of the document as 000.000.001 (9 digits in groups of three).
A rate as a percentage with 2 to 4 places (12.0000 is 12,00).
A phone as (00) 0000-0000 or (00) 00000-0000 when it has the area code, as is otherwise.
A decimal with at least 2 places and the ones that matter up to max (default 10), as quantities
and unit prices are written (10.0000 is 10,00; 25.1234500000 is 25,12345).
The series of the document with 3 digits (001).
A CNPJ (digits or letters, 14) as 00.000.000/0000-00, a CPF (11) as 000.000.000-00.
The time of an ISO 8601 date-time as HH:MM:SS, as the issuer wrote it.
A CEP as 00000-000.
Functions
The 44 digits of an access key in groups of four.
The date of an ISO 8601 date or date-time as dd/mm/yyyy, as the issuer wrote it (no zone shift).
An ISO 8601 date-time as dd/mm/yyyy HH:MM:SS.
A decimal as money: two places, . for thousands and , for decimals (1.234,50).
The number of the document as 000.000.001 (9 digits in groups of three).
A rate as a percentage with 2 to 4 places (12.0000 is 12,00).
A phone as (00) 0000-0000 or (00) 00000-0000 when it has the area code, as is otherwise.
@spec quantity(String.t() | nil, pos_integer()) :: String.t() | nil
A decimal with at least 2 places and the ones that matter up to max (default 10), as quantities
and unit prices are written (10.0000 is 10,00; 25.1234500000 is 25,12345).
The series of the document with 3 digits (001).
A CNPJ (digits or letters, 14) as 00.000.000/0000-00, a CPF (11) as 000.000.000-00.
The time of an ISO 8601 date-time as HH:MM:SS, as the issuer wrote it.
A CEP as 00000-000.