Commit Graph

24 Commits

Author SHA1 Message Date
0aefdeb5ff fix(statements): set envelope geometry for #9 double-window
Reset the statement window positions to the app's proven #9 (9x4)
double-window geometry, mirroring sales_invoice_ns.html — recipient
window at top:1.5in/left:1.125in. It previously copied the dunning
format's 1.9in, which sits too low for a #9. Tighten the body
padding-top to keep clearance below the higher window, and correct the
stale #10 references in the template comment and docs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-09 07:52:07 -04:00
c20dd18287 feat(statements): untaxed late-fee series, skip-fee option, audit trail
- Bill late-fee invoices under a dedicated naming series (LPF-.YYYY.-),
  registered on Sales Invoice via after_migrate, so they are easy to spot
  and filter.
- Late fees are never taxed: a zero 'Actual' tax line keeps the taxes
  table non-empty so ERPNext skips auto-applying company/item tax
  templates (posts nothing to the ledger). Fee total == computed fee.
- generate_statements(skip_late_fee=...) generates a statement without
  billing a fee.
- Record every generation on the customer's timeline (add_comment) as an
  audit trail, noting Total Due and the fee invoice raised / skipped.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 19:52:03 -04:00
acd7df1129 feat(statements): bill late fee as a collectible Sales Invoice
Charge a late-payment fee when statements are generated so the customer's
receivable reflects it (the gap ERPNext Dunning leaves — it never
increases AR). The fee is billed as a submitted Sales Invoice (item ->
Dunning Type income account, rate = computed fee) rather than a Journal
Entry, so the app's existing payment flow (Run Payment / AutoPay /
multi-invoice) charges and settles it automatically via its Sales Invoice
references — a bare JE would sit uncollected.

Fee schedule/amounts come from the existing Dunning Type settings (yearly
rate_of_interest + flat dunning_fee), interest computed with ERPNext's own
Dunning formula. The fee Item is configured via a new Late Fee Item custom
field on Dunning Type (created in an after_migrate hook; ns_app/setup.py).
Nothing is auto-seeded: generation stops with a clear error if no Dunning
Type is configured or its income account / fee item is unset.

Billing is idempotent per customer/company/month, and prior fee invoices
are excluded from the interest base (no fee-on-fee). The fee invoice shows
on the statement flagged 'late fee', folded into Total Due (which equals
the customer's balance and is fully collectible).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 19:35:04 -04:00
75a9c9d154 feat(statements): statement builder + printable envelope template
Add get_statement_data (open invoices, aging buckets, totals, formatted
customer + company addresses) and generate_statements, which renders one
page per customer via a Jinja template and returns a printable HTML
document. Recipient window geometry (top:1.9in/left:1.125in) mirrors the
existing double-window print formats for #10 envelope compatibility; each
page uses page-break-after:always. Late fee is a zero placeholder here.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 19:04:47 -04:00
63bf0b68f5 feat(statements): add overdue-customers query API
Add ns_app/api/statements.py with get_customers_with_overdue_invoices
(one aggregated row per customer with overdue Sales Invoices) plus the
_get_outstanding_invoices / _aging_bucket helpers used to build the
per-customer statement.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 19:01:03 -04:00
Ty Reynolds
4e0acde164 Added multiple invoice payment feature. Fixed autopay to run using security key. 2026-06-11 09:36:01 -04:00
Ty Reynolds
7789d13584 Added some fail safes for inconsequential errors. 2026-05-27 13:19:12 -04:00
Ty Reynolds
8c4f1f753e Finished sign up for auto pay feature from pay invoice form. Also, added a doc file for the payment flow. 2026-05-15 13:47:35 -04:00
Ty Reynolds
74d3d7f5c1 Removed duplicate name check. 2026-05-04 13:59:05 -04:00
Ty Reynolds
e0912a4c60 added missed import. 2026-04-24 11:45:00 -04:00
Ty Reynolds
e7e9fc96c2 Added feature toggle for the check box on custom form. Turned off at the moment so we can push to prod even though this feature is complete. 2026-04-14 09:40:36 -04:00
Ty Reynolds
cc44683972 Changed the opt in for auto pay to be a check box on thecustom form. Improves work flow and is more professional. Added this as checkbox under the zip code entry field. Did no testing on the logic yet. 2026-04-08 08:02:42 -04:00
Ty Reynolds
ac51c2ce4e Added card holder name and zip to manual payment form. Known bug for loading Collect.Js after 1st instance post cache clear. Working on a fix. 2026-03-23 13:24:59 -04:00
Ty Reynolds
bddbb35541 Sign up customer for autopay? feature when manual payment is ran. Version 1 2026-03-19 08:24:28 -04:00
Ty Reynolds
4e5b4e0a41 Version 1 of Collect.JS no autopay, invoice payment feature. 2026-03-18 15:59:03 -04:00
Ty Reynolds
1ef7e6968c Updated logic for collect checkout to use Security Key. 2026-03-13 09:02:25 -04:00
Ty Reynolds
cd57206be1 added to the collect checkout logic. 2026-03-12 14:24:34 -04:00
Ty Reynolds
961504dd83 payment api updated and running, invoice print format updated. 2026-03-12 10:35:25 -04:00
Ty Reynolds
aefb2d4cc6 Finished Quick Entry 2026-02-13 10:59:38 -05:00
Ty Reynolds
4357ce7fcc Updated invoice and autopay logic. 2026-02-10 08:42:57 -05:00
Ty Reynolds
75600fdbeb Custom Quick entry version 1 done. Zip API done and Customer backend added. 2026-02-09 15:03:17 -05:00
Ty Reynolds
a636cdd9fa Upgraded the autopay functions and finished up the iframe. 2026-02-02 08:08:00 -05:00
Ty Reynolds
e3d0d24b04 Added and updated autopay logic 2026-01-21 10:28:22 -05:00
Ty Reynolds
f871334fb4 Autopay api logic prototype. 2026-01-13 11:10:35 -05:00