diff --git a/src/routes/settings.import.tsx b/src/routes/settings.import.tsx index 5873da6..bf92579 100644 --- a/src/routes/settings.import.tsx +++ b/src/routes/settings.import.tsx @@ -969,9 +969,13 @@ function ImportPage() { } } - // Mark as already invoiced via placeholder voided invoice (per client) - if (clientId && !row.invoice_id) { - const invId = await ensurePreInvoicedInvoice(clientId, caseId); + // Link to a real invoice ONLY when the source row provided an + // invoice number. Otherwise leave invoice_id null so the user can + // bill these items normally later. + const invNumber = row._invoice ? String(row._invoice).trim() : ""; + delete row._invoice; + if (invNumber && clientId && !row.invoice_id) { + const invId = await ensureNamedInvoice(clientId, caseId, invNumber); if (invId) row.invoice_id = invId; }