Overview
The electronic invoice system supports dual-currency invoicing, displaying amounts in both Venezuelan Bolívares (BSD) and US Dollars (USD). This is essential for businesses operating in Venezuela’s multi-currency economy.Supported Currencies
BSD - Bolívares
Primary CurrencyVenezuelan Bolívares - the legal tender and official invoicing currency. All tax calculations and official amounts use BSD.
USD - US Dollars
Secondary CurrencyUS Dollars - reference currency for international pricing and customer convenience. Displayed in
TotalesOtraMoneda section.Currency Structure in JSON
Each invoice contains two parallel sets of totals:Exchange Rate Application
The exchange rate (Tasa) is read from the Excel input and stored in the invoice:main.py:174-176
Exchange Rate Field
Exchange rate from USD to BSDExample:
"154.9825" means 1 USD = 154.9825 BSDSource: Excel column TasaFormat: Decimal string with 4 decimal places (standard Venezuelan exchange rate precision)Calculation Relationship
The exchange rate is provided in the input Excel file, not calculated by the system. This allows for using official, agreed-upon rates for invoicing.
Amount Extraction from Excel
The system reads currency amounts from specific Excel columns:main.py:79-84
Excel Column Mapping
| Excel Column | Currency | Description | Decimal Places |
|---|---|---|---|
bolivares | BSD | Total amount with IVA | 2 |
bolivares sin iva | BSD | Subtotal before IVA | 2 |
Total | USD | Total amount with IVA | 0 (rounded) |
precio sin iva | USD | Subtotal before IVA | 2 |
Tasa | - | Exchange rate | 4-6 |
IVA (VAT) Calculation
IVA is calculated separately for each currency by subtracting the base amount from the total.BSD IVA Calculation
main.py:83
USD IVA Calculation
main.py:84
IVA Rate
The system uses a fixed 16% IVA rate, which is Venezuela’s standard VAT rate:main.py:155
main.py:219
IVA Verification
Verification Formula:
Totales Structure (Primary Currency)
TheTotales section contains all monetary amounts in the primary currency (BSD):
main.py:137-172
Key Amount Fields (BSD)
Subtotal before any discounts (pre-tax)Source:
bolivares_sin_iva from ExcelExample: "3874.56"Subtotal after discounts, before taxIn this system, same as
SubtotalAntesDescuento (no discounts applied)Example: "3874.56"Total IVA amountCalculation:
MontoTotalConIVA - SubtotalExample: "619.93"Total taxable amount (includes IVA)Same as:
MontoTotalConIVAExample: "4494.49"Total amount including IVASource:
bolivares from ExcelExample: "4494.49"Final amount to paySame as:
MontoTotalConIVA (no additional charges)Example: "4494.49"TotalesOtraMoneda Structure (Secondary Currency)
TheTotalesOtraMoneda section mirrors the primary totals structure in USD:
main.py:174-198
Key Amount Fields (USD)
Exchange rate from USD to BSDExample:
"154.9825"Subtotal before tax (USD)Source:
precio_sin_iva from ExcelExample: "25.0"IVA amount (USD)Calculation:
monto_usd - precio_sin_ivaExample: "4.0"Final amount to pay (USD)Source:
Total from Excel (rounded to 0 decimals)Example: "29.0"Amount in Words
Both currency sections include amounts written in Spanish words for legal compliance.BSD Amount to Words
main.py:36-49
USD Amount to Words
main.py:51-71
Tax Breakdown (ImpuestosSubtotal)
Both currency sections include a detailed tax breakdown:BSD Tax Breakdown
main.py:152-159
USD Tax Breakdown
main.py:190-197
Tax Code Meanings:
"G"= Gravado (Taxable)"E"= Exento (Exempt) - not used in this system"AlicuotaImp"= Tax rate (always 16.00% for Venezuelan IVA)
Payment Method Currency
The payment method always uses the primary currency (BSD):main.py:160-169
Why BSD for payments?Venezuelan tax law requires invoices to be denominated and paid in Bolívares. The USD amounts in
TotalesOtraMoneda are for reference only. The legal payment obligation is always in BSD.Complete Currency Example
Here’s a complete example showing both currencies side-by-side:View Complete Multi-Currency Example
View Complete Multi-Currency Example
Calculation Verification
Consistency Check Passed:
- IVA rate is 16% in both currencies ✓
- Exchange rate applied correctly ✓
- Rounding follows currency conventions ✓