ExCius.AllowanceChargeXML (ExCius v0.3.2)
View SourceBuilds UBL 2.1 AllowanceCharge XML elements.
This module generates XML elements for both document-level and line-level allowances and charges according to the UBL 2.1 specification and Croatian CIUS-2025 requirements.
Document Level AllowanceCharge
Document-level allowances/charges appear directly under the Invoice element and MUST include a TaxCategory element because they affect the overall tax calculation.
Line Level AllowanceCharge
Line-level allowances/charges appear within InvoiceLine elements and SHOULD NOT include a TaxCategory element (they inherit tax from the line).
XML Structure
<cac:AllowanceCharge>
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
<cbc:AllowanceChargeReasonCode>95</cbc:AllowanceChargeReasonCode>
<cbc:AllowanceChargeReason>Discount</cbc:AllowanceChargeReason>
<cbc:MultiplierFactorNumeric>10</cbc:MultiplierFactorNumeric>
<cbc:Amount currencyID="EUR">10.00</cbc:Amount>
<cbc:BaseAmount currencyID="EUR">100.00</cbc:BaseAmount>
<!-- Document level only: -->
<cac:TaxCategory>
<cbc:ID>S</cbc:ID>
<cbc:Percent>25</cbc:Percent>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:TaxCategory>
</cac:AllowanceCharge>
Summary
Functions
Builds a single document-level AllowanceCharge XML element.
Builds XML elements for a list of document-level allowances/charges.
Builds a single line-level AllowanceCharge XML element.
Builds XML elements for a list of line-level allowances/charges.
Functions
Builds a single document-level AllowanceCharge XML element.
Document-level allowances/charges include TaxCategory.
Builds XML elements for a list of document-level allowances/charges.
Returns a list of cac:AllowanceCharge XML elements with TaxCategory included.
Parameters
allowances_charges- List of validated allowance/charge mapscurrency_id- The currency code (e.g., "EUR")
Example
iex> ExCius.AllowanceChargeXML.build_document_level_list([
...> %{
...> charge_indicator: true,
...> allowance_charge_reason_code: :freight,
...> allowance_charge_reason: "Shipping",
...> amount: "15.00",
...> tax_category: %{id: :standard_rate, percent: 25, tax_scheme_id: :vat}
...> }
...> ], "EUR")
Builds a single line-level AllowanceCharge XML element.
Line-level allowances/charges do NOT include TaxCategory.
Builds XML elements for a list of line-level allowances/charges.
Returns a list of cac:AllowanceCharge XML elements WITHOUT TaxCategory.
Parameters
allowances_charges- List of validated allowance/charge mapscurrency_id- The currency code (e.g., "EUR")