Commit graph

6 commits

Author SHA1 Message Date
Claude
15addbeae8
Configurable date/paper format; multi-line dynamic tax system
Date format
- Replace hardcoded toLocaleDateString with a config-driven formatter
- date-format key in config (default "d MMMM YYYY") supports tokens:
  d, dd, M, MM, MMM, MMMM, YY, YYYY (regex replace, longest match first)

Paper format
- paper-format key in config: "a4" (default) or "letter"
- Passed directly to jsPDF; page dimensions adjusted accordingly

Tax system redesign
- Remove single-select tax-rates from config; add tax-types list, each
  with a key and per-language labels (VAT, GST, Sales Tax, Withholding,
  Other)
- Totals section now has a dynamic tax-tbody: each row has a number
  field, a % / Amount selector, and a tax-type label selector; rows
  are added with "+ Add new tax" and removed with ×
- calcTotals iterates tLines: % rows compute sub × (val/100), Amount
  rows use the fixed value directly; each row shows its calculated
  amount live
- gatherData collects all tax lines into a taxes[] array with lineLabel
  (e.g. "VAT 7%" or "GST (50.00)") and amt; both preview and PDF
  render one row per tax entry
- relabel() rebuilds tax-line dropdowns on language switch

https://claude.ai/code/session_015iyCBgoTXNNqaErR287U1u
2026-05-19 08:26:52 +00:00
Claude
f90718ba34
Five fixes to invoice form and PDF
- Date picker: change invoice date from month picker to full date picker
  (type=date, formatted as "19 May 2026" in output)

- Invoice currency: add currency selector under invoice date, populated
  from config.currencies list, saved to localStorage; shown in invoice
  meta block on both preview and PDF

- Recipient currency: add currency field to each charge-to entry in
  config.yml; selecting a predefined recipient auto-sets invoice currency

- Lock predefined recipients: selecting a predefined charge-to entry
  locks all its fields (pointer-events off + muted style via #ct-fields
  .locked); switching to Other or clearing unlocks them

- Fix foreign-currency exchange rate calculation: the formula was
  inverted (per / rate instead of per * rate). If 1 USD = 32 local and
  per-item is USD 100, local price is now correctly 100 × 32 = 3200,
  not 100 / 32 = 3.125. Fix applied in calcFxFromPer, calcLine display,
  and gatherData (foreignTot = per × qty, the foreign-currency total).
  Updated fx note text to the specified format:
  "Converted from USD: 1 USD = 32.00000 THB. Per item: USD 100.00,
  line total: USD 500.00"

https://claude.ai/code/session_015iyCBgoTXNNqaErR287U1u
2026-05-19 08:09:39 +00:00
Claude
f39eed979a
Replace browser print with jsPDF Helvetica PDF generation
The browser print-to-PDF approach requires the user to manually toggle
"Background graphics" on and "Headers and footers" off — impossible to
control programmatically. Replace with direct jsPDF generation:

- Loads jsPDF 2.5.1 UMD from CDN
- buildPDF() draws the invoice programmatically using Helvetica (PDF
  built-in font, no embedding needed)
- Layout: sender/title header, navy rule, charge-to block with navy
  accent bar, line-items table (navy header, alternating rows, multi-
  line description wrapping, foreign-currency sub-row), totals with
  navy To-Pay bar — all in mm on A4
- PDF downloads directly as invoice-{no}.pdf with no dialog
- HTML preview overlay retained for review before download
- Replace "print-invoice" config key with "download-pdf"

https://claude.ai/code/session_015iyCBgoTXNNqaErR287U1u
2026-05-19 07:52:40 +00:00
Claude
8bac41fe77
Build invoicing app: app/index.html and app/config.yml
Static single-page invoice app per spec. Features:
- Multilingual UI (EN/DE/FR/NO) loaded from config.yml; form always
  prints in the default language
- Sender fields + invoice details (date, project code, invoice no.)
  persisted in localStorage; invoice number auto-increments after
  each generation
- Predefined charge-to recipients selectable from config, or manual entry
- Dynamic invoice line items: predefined products with UOM/price
  pre-fill, free-text fallback, foreign-currency sub-row with
  exchange-rate and per-item price that calculates back to local currency
- Subtotal / tax (configurable rates) / paid / to-pay calculated live
- "Generate Invoice" renders a clean A4-formatted preview overlay;
  "Print / Save as PDF" triggers browser print-to-PDF

https://claude.ai/code/session_015iyCBgoTXNNqaErR287U1u
2026-05-18 18:03:48 +00:00
c5d3019e3f
Add project specification for kbenestad/invoice
Added detailed specification for the kbenestad/invoice project, including goals, planned structure, features, and configuration file details.
2026-05-19 00:54:22 +07:00
1fec8e1533
Initial commit 2026-05-18 23:16:11 +07:00