Calculate VAT (IVA) and IRPF withholding
calculate_vatCompute the taxable base, VAT (IVA) amount, optional recargo de equivalencia and optional IRPF withholding from an amount. By default importe is the taxable base (sin IVA). With incluye_iva=true, importe is the TOTAL with VAT already included and the base is derived backwards (quitar IVA / reverse VAT). It only applies the rates it is given: it does NOT decide which VAT or IRPF rate applies to a case.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| irpf | No | IRPF withholding rate in %, e.g. 15, 19. Default 0 | |
| importe | Yes | Amount: taxable base, or total with VAT if incluye_iva=true | |
| recargo | No | Recargo de equivalencia rate in %, e.g. 5.2, 1.4, 0.5, 1.75. Default 0 | |
| tipo_iva | Yes | VAT rate in %, e.g. 21, 10, 4, 0 | |
| incluye_iva | No | True if `importe` already includes VAT (reverse calculation) |