From 0aefdeb5ffe958ed5e217b0d2802c2204ce22c02 Mon Sep 17 00:00:00 2001 From: Norman King Date: Thu, 9 Jul 2026 07:52:07 -0400 Subject: [PATCH] fix(statements): set envelope geometry for #9 double-window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- docs/CUSTOMER_STATEMENTS.md | 2 +- ns_app/api/statements.py | 7 +++++-- ns_app/templates/statements/customer_statement.html | 7 ++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/CUSTOMER_STATEMENTS.md b/docs/CUSTOMER_STATEMENTS.md index 5f746d2..1dbb260 100644 --- a/docs/CUSTOMER_STATEMENTS.md +++ b/docs/CUSTOMER_STATEMENTS.md @@ -3,7 +3,7 @@ > Branch: `feature/customer-statements` Generates printable, **one-page-per-customer** account statements — formatted to -fit a standard #10 **double-window envelope** — for customers with overdue +fit a standard #9 (9x4) **double-window envelope** — for customers with overdue invoices, and (optionally) bills a **late-payment fee** that posts to the ledger and is collectible through the app's existing payment flow. diff --git a/ns_app/api/statements.py b/ns_app/api/statements.py index e50f11a..84f81e8 100644 --- a/ns_app/api/statements.py +++ b/ns_app/api/statements.py @@ -202,6 +202,9 @@ def _wrap_document(pages): overflow: hidden; }} .statement-page:last-of-type {{ page-break-after: auto; }} + /* Window positions match the app's proven #9 (9x4) double-window envelope + geometry — recipient window at top:1.5in/left:1.125in, mirroring + sales_invoice_ns.html ("9x4 envelope position"). */ .return-window {{ position: absolute; top: 0.55in; left: 0.6in; width: 3.5in; font-size: 11px; line-height: 1.3; @@ -212,11 +215,11 @@ def _wrap_document(pages): }} .doc-header .doc-title {{ font-size: 20px; font-weight: bold; letter-spacing: 1px; }} .recipient-window {{ - position: absolute; top: 1.9in; left: 1.125in; + position: absolute; top: 1.5in; left: 1.125in; width: 4.5in; height: 1.25in; font-size: 15px; line-height: 1.15em; overflow: hidden; }} - .statement-body {{ padding: 3.35in 0.6in 0.6in 0.6in; }} + .statement-body {{ padding: 2.95in 0.6in 0.6in 0.6in; }} .intro {{ font-size: 12px; margin-bottom: 12px; }} table.items, table.aging {{ width: 100%; border-collapse: collapse; }} table.items th, table.items td, diff --git a/ns_app/templates/statements/customer_statement.html b/ns_app/templates/statements/customer_statement.html index 2b48f65..63ce8b1 100644 --- a/ns_app/templates/statements/customer_statement.html +++ b/ns_app/templates/statements/customer_statement.html @@ -1,7 +1,8 @@ {# One customer account statement = one printed page. - Envelope geometry (recipient window at top:1.9in / left:1.125in) mirrors the - existing double-window print formats so the same #10 double-window envelopes - work. Rendered via frappe.render_template with context key `s` + Envelope geometry (recipient window at top:1.5in / left:1.125in) mirrors the + app's proven #9 (9x4) double-window print format (sales_invoice_ns.html) so + the same #9 double-window envelopes work. Rendered via + frappe.render_template with context key `s` (see ns_app.api.statements.get_statement_data). #} {% set fmt = frappe.utils.fmt_money %}