From a3196200de8cec83bad238dfc415d7e379d3661b Mon Sep 17 00:00:00 2001 From: JasonFraser Date: Thu, 27 Aug 2026 18:00:19 -0400 Subject: [PATCH] Add Receipt Generator tool Same pattern as the Payslip Generator: self-contained, entirely client-side (fill in details, live preview, download PDF), no server- side logic, so no logic.py - just a route serving the page. Applied the same fixes proactively, since it's the same design/PDF pattern that had these exact issues: - SRI-pinned standalone html2canvas + jsPDF instead of html2pdf.js, whose bundled html2canvas mis-renders shorter content on this kind of page (confirmed on the Payslip Generator via a controlled A/B test against the current standalone html2canvas). - Page-fit math carried over: hotfixes:['px_scaling'], height clamped to >= width with explicit orientation:'portrait' (avoids jsPDF swapping width/height for landscape-shaped short content), +8px buffer against a sub-pixel-rounding extra-page bug. - Header logo linked back to / (every other tool's header does this). - Box-shadow stripped on capture - screen chrome, not part of the document. - Wired into the platform: Blueprint at /receipt/, registered in main.py, landing-page card added. Verified end-to-end (headless Chromium, real Download button) across defaults, zero items, and a tall/complex receipt with discount/tax/ tip/cash payment - single page, fully rendered, no cropping. Co-Authored-By: Claude Sonnet 5 --- app/main.py | 13 + app/tools/receipt/__init__.py | 3 + app/tools/receipt/routes.py | 12 + templates/receipt/index.html | 946 ++++++++++++++++++++++++++++++++++ 4 files changed, 974 insertions(+) create mode 100644 app/tools/receipt/__init__.py create mode 100644 app/tools/receipt/routes.py create mode 100644 templates/receipt/index.html diff --git a/app/main.py b/app/main.py index 16f497b..93eab8e 100644 --- a/app/main.py +++ b/app/main.py @@ -5,6 +5,7 @@ from tools.eib import eib_bp from tools.donor_report import donor_report_bp from tools.financial_reports import financial_reports_bp from tools.payslip import payslip_bp +from tools.receipt import receipt_bp # ── Tool registry ──────────────────────────────────────────────────────────── # Each entry drives one card on the landing page. Add a new tool by @@ -54,6 +55,17 @@ TOOLS = [ "url": "/payslip/", "status": "online", }, + { + "name": "Receipt Generator", + "tagline": "Fill in, preview, download PDF", + "description": ( + "Generates a formatted point-of-sale style receipt from business " + "details, line items, discount/tax/tip, entirely in the browser - " + "nothing is uploaded to a server." + ), + "url": "/receipt/", + "status": "online", + }, ] @@ -67,6 +79,7 @@ def create_app(): app.register_blueprint(donor_report_bp) app.register_blueprint(financial_reports_bp) app.register_blueprint(payslip_bp) + app.register_blueprint(receipt_bp) @app.route("/") def home(): diff --git a/app/tools/receipt/__init__.py b/app/tools/receipt/__init__.py new file mode 100644 index 0000000..76bd565 --- /dev/null +++ b/app/tools/receipt/__init__.py @@ -0,0 +1,3 @@ +from .routes import receipt_bp + +__all__ = ["receipt_bp"] diff --git a/app/tools/receipt/routes.py b/app/tools/receipt/routes.py new file mode 100644 index 0000000..5e7fb62 --- /dev/null +++ b/app/tools/receipt/routes.py @@ -0,0 +1,12 @@ +from flask import Blueprint, render_template + +# Receipt Generator is entirely client-side (form -> live preview -> PDF, +# all in the browser, nothing uploaded) - there's no server-side business +# logic, so unlike this repo's other tools there's no logic.py, just the +# one page route. +receipt_bp = Blueprint("receipt", __name__, url_prefix="/receipt") + + +@receipt_bp.route("/") +def index(): + return render_template("receipt/index.html") diff --git a/templates/receipt/index.html b/templates/receipt/index.html new file mode 100644 index 0000000..fa1bf55 --- /dev/null +++ b/templates/receipt/index.html @@ -0,0 +1,946 @@ + + + + + +Receipt Generator — Undo Designs + + + + + + + + +
+ +
+ + + +
+ Receipt Generator +
+
+ + + + Runs entirely in your browser — nothing is uploaded +
+
+ +
+
+
Undo Designs
+

Receipt Generator

+

Fill in the details on the left — the receipt updates live on the right. Your logo and figures never leave this page: there's no server, no upload, no tracking.

+
+ + +
+
+
1Business
+
+ +
+ +
Click to upload or drag & drop — stays on this page only
+
+ Logo preview + +
+
+
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+
+ +
+
2Receipt details
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+
+ + +
+ +
+
+ +
+
3Items
+
+
Description
Qty
Price
+
+
+ +
+ +
+
4Discount, tax & tip
+
+ +
+
None
+
%
+
Fixed
+
+
+ +
+ + +
+
+ +
+
15%
+
18%
+
20%
+
+ +
+
+ +
+
5Footer message
+
+ +
+
+ +
+ + +
+
+ + +
+
+
Live preview
+
+ + +
+
+ +
+
+
+ +
Undo Designs Coffee Bar
+
19 Charlotte Street, Toronto, ON
(416) 555-0142
+ +
+ +
Receipt #10432
+
Date—
+
CashierSam
+ + +
+ +
+ ItemQtyAmt +
+
+ +
+ +
+ +
+ +
+
PaymentCredit Card
+
Card•••• 4417
+ +
+ + + +
+
10432
+
+
+
+
+
+
+ +
+ Built by Undo Designs · Receipt Generator v1 · 100% client-side +
+ + + + \ No newline at end of file