Totales de factura
invoice-totalCalcula una factura desde ítems (cantidad, precio, descuento %, impuesto %): totales por línea, subtotal, impuestos por tasa y total. Cuándo: un cálculo de dinero, impuestos o matemática financiera tiene que ser exacto y reproducible (redondeo, centavos, tasas). No para: dividir una cuenta entre personas con propina opcional y redondeo de cada parte (bill-split). Efectos secundarios: ninguno (solo lectura, sin red, sin estado guardado). Determinista: la misma entrada da la misma salida. Límites: entrada JSON de hasta 64 KB, 1 s por llamada, resultado de hasta 1 MB.
EN: Computes an invoice from line items (quantity, unit price, line discount %, tax rate %): line totals, subtotal, discount, tax grouped by rate, and grand total, rounded per line to the currency's minor units. When: a money, tax or financial-math result has to be exact and reproducible (rounding, cents, rates). Not for: splitting a bill among people with an optional tip % (bill-split). [EN completo / full EN: inputSchema.description]
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | Line items (array of object; required; at least 1 items; up to 1000 items). | |
| currency | No | ISO 4217 currency code (string; optional; default "USD"; pattern ^[A-Za-z]{3}$). | USD |
| global_discount_percent | No | Discount % on subtotal (number; optional; default 0; min 0; max 100). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lines | No | ||
| total | No | ||
| currency | No | ||
| discount | No | ||
| subtotal | No | ||
| tax_total | No | ||
| taxable_base | No | ||
| taxes_by_rate | No |