Book invoices with VAT as journal
invoices_to_journalBook issued and received invoices as journal entries with VAT split, rechecking totals and flagging duplicates or mismatches for review.
Instructions
Book issued and received invoices (facturas emitidas y recibidas) as journal entries with VAT split out.
Read each invoice (PDF, photo, Facturae, email) yourself and pass its figures; this tool does the bookkeeping deterministically. Per invoice: {"kind": "issued"|"received", "number": "F-2026-031", "date": "2026-02-28", "nif": "B12345678", "name": "Talleres Ruiz SL", "taxes": [{"base": "1000.00", "rate": "21", "vat": "210.00" (optional, checked), "recargo_rate": "5.2" (optional)}], "irpf_rate": "15" or "irpf_amount": "150.00" (optional), "total": "1060.00" (optional but recommended: checked), "account": "43000012" (optional), "counterpart_account": "62300000" (optional, default 700 / 600), "concept": optional}. Shortcut for one VAT rate: "base" + "vat_rate". Negative amounts = factura rectificativa (sides swap).
Issued: Debe 430 total (+ 473 IRPF retenido por el cliente) / Haber 700 base + 477 IVA. Received: Debe 600
base + 472 IVA / Haber 4751 IRPF + 400 total. Tax is recomputed (base x rate, half up); a 1-cent difference
with the invoice total is absorbed in the largest tax line, more than that sends the invoice to review
with the reason, unbooked. Duplicates (same kind + NIF + number) also go to review.
Args: accounts: Override default roots {customers 430, suppliers 400, sales 700, purchases 600, vat_output 477, vat_input 472, irpf_withheld 4751, irpf_suffered 473}. party_accounts: {NIF: subaccount}, e.g. {"B12345678": "43000012"}. Invoices with no account are booked to the generic 430/400 and listed in generic_party_account so the accountant assigns them. vat_accounts: {rate: subaccount}, e.g. {"21": "47700021", "10": "47700010", "re5.2": "47700052"}. target_format / account_digits / company_code / ...: as in build_journal.
Returns the import file, vat_summary (base and cuota per rate for the libro registro / modelo 303),
vat_register (one row per invoice and rate), review and open_items to pass to bank_to_journal.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"invoices": "<invoices>"
},
"name": "invoices_to_journal"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accounts | No | ||
| invoices | Yes | ||
| a3_format | No | ||
| date_style | No | ||
| fiscal_year | No | ||
| company_code | No | 00001 | |
| vat_accounts | No | ||
| account_split | No | ||
| decimal_comma | No | ||
| target_format | No | csv | |
| xero_tax_rate | No | No VAT | |
| account_digits | No | ||
| party_accounts | No | ||
| start_entry_number | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||