From 7d57bd2e3f8e9c3a5ea11d378e1a5ebdc8dc57a6 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 21:52:41 +0000 Subject: [PATCH 1/2] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/settings.import.tsx | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/routes/settings.import.tsx b/src/routes/settings.import.tsx index cb0af55..dab5b7a 100644 --- a/src/routes/settings.import.tsx +++ b/src/routes/settings.import.tsx @@ -84,8 +84,25 @@ const toBool = (v: any) => { const toNum = (v: any) => { if (v === "" || v == null) return null; - const n = Number(String(v).replace(/[$,]/g, "")); - return isNaN(n) ? null : n; + if (typeof v === "number") return isNaN(v) ? null : v; + let s = String(v).trim(); + if (!s) return null; + // Accounting negatives: (123.45) → -123.45 + let negative = false; + if (/^\(.*\)$/.test(s)) { + negative = true; + s = s.slice(1, -1); + } + // Strip currency symbols, commas, spaces, and stray non-numeric chars (keep . and -) + s = s.replace(/[$£€¥,\s]/g, ""); + if (s.endsWith("-")) { + // trailing minus (e.g. "100-") + negative = true; + s = s.slice(0, -1); + } + const n = Number(s); + if (isNaN(n)) return null; + return negative ? -n : n; }; const toDate = (v: any): string | null => { From 51aeff96b191549eaf6fcc0281145d95868522d6 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 21:52:52 +0000 Subject: [PATCH 2/2] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/settings.import.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/routes/settings.import.tsx b/src/routes/settings.import.tsx index dab5b7a..68908fb 100644 --- a/src/routes/settings.import.tsx +++ b/src/routes/settings.import.tsx @@ -584,9 +584,14 @@ const IMPORTERS: ImporterConfig[] = [ issuedate: "issue_date", date: "issue_date", invoicedate: "issue_date", billdate: "issue_date", duedate: "due_date", status: "status", - subtotal: "subtotal", tax: "tax", total: "total", amount: "total", invoicetotal: "total", grandtotal: "total", - amountpaid: "amount_paid", paid: "amount_paid", paidamount: "amount_paid", - notes: "notes", memo: "notes", description: "notes", + subtotal: "subtotal", subtot: "subtotal", sub: "subtotal", netamount: "subtotal", net: "subtotal", + tax: "tax", taxamount: "tax", salestax: "tax", vat: "tax", gst: "tax", + total: "total", amount: "total", invoicetotal: "total", grandtotal: "total", invoiceamount: "total", + totalamount: "total", totaldue: "total", amountdue: "total", balance: "total", balancedue: "total", + billed: "total", billedamount: "total", feesbilled: "total", chargesbilled: "total", + amountpaid: "amount_paid", paid: "amount_paid", paidamount: "amount_paid", paymentsreceived: "amount_paid", + payments: "amount_paid", feespaid: "amount_paid", totalpaid: "amount_paid", + notes: "notes", memo: "notes", description: "notes", comments: "notes", }, numeric: ["subtotal", "tax", "total", "amount_paid"], dateCols: ["issue_date", "due_date"],