From eee74501cd849c942463fd885ab341ab162879cd Mon Sep 17 00:00:00 2001 From: Ty Reynolds Date: Wed, 14 Jan 2026 10:15:27 -0500 Subject: [PATCH] Invoice print format added. --- ns_app/hooks.py | 17 +- .../sales_invoice_ns/sales_invoice_ns.html | 153 ++++++++++++++++++ .../sales_invoice_ns/sales_invoice_ns.json | 8 + 3 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 ns_app/print_formats/sales_invoice_ns/sales_invoice_ns.html create mode 100644 ns_app/print_formats/sales_invoice_ns/sales_invoice_ns.json diff --git a/ns_app/hooks.py b/ns_app/hooks.py index d713671..6435b51 100644 --- a/ns_app/hooks.py +++ b/ns_app/hooks.py @@ -5,7 +5,22 @@ app_description = "Custom ERPNext extensions" app_email = "dev@nsinnovations.net" app_license = "MIT" +# Load on every page app_include_js = [ "/assets/ns_app/js/custom.js" - "/assets/ns_app/js/sales_invoice.js" +] + +# Load on Sales Invoice form +doctype_js = { + "Sales Invoice": "public/js/sales_invoice.js" +} + +# Fixtures tracked in Git +fixtures = [ + { + "dt": "Print Format", + "filters": [ + ["name", "=", "Sales Invoice - NS"] + ] + } ] diff --git a/ns_app/print_formats/sales_invoice_ns/sales_invoice_ns.html b/ns_app/print_formats/sales_invoice_ns/sales_invoice_ns.html new file mode 100644 index 0000000..5f9c14c --- /dev/null +++ b/ns_app/print_formats/sales_invoice_ns/sales_invoice_ns.html @@ -0,0 +1,153 @@ + + +
+ + {% set company_doc = frappe.get_doc("Company", company) %} + + + + + + + +
+

{{ company_doc.company_name }}

+

+ 1063 Chestnut Level Road, Quarryville PA 17566
+ {% if company_doc.address %}{{ company_doc.address }}
{% endif %} + {% if company_doc.phone_no %}Phone: {{ company_doc.phone_no }}{% endif %} + {% if company_doc.email %} | Email: {{ company_doc.email }}{% endif %} +

+
+ Invoice
+ {{ doc.name }}
+ Date: {{ frappe.utils.formatdate(doc.posting_date, "MM-dd-yyyy") }} +
+ + + + + + + + +
+ Due Date: {{ frappe.utils.formatdate(doc.due_date, "MM-dd-yyyy") }}
+ Terms: {{ doc.payment_terms_template or "Net 30" }} +
+ + + +
+ {{ doc.customer_name }}
+ {{ doc.address_display or doc.customer_address }} +
+ + +
+ + + {% if doc.custom_subscription_data or doc.custom_invoice_notes %} + + + + +
+ + {% if doc.custom_subscription_data %} +
+ {{ doc.custom_subscription_data }} +
+ {% endif %} + + {% if doc.custom_invoice_notes %} +
+ {{ doc.custom_invoice_notes }} +
+ {% endif %} + +
+ {% endif %} + + + + + + + + + + + + + + + + + {% for row in doc.items %} + + + + + + + + {% endfor %} + +
ItemDescriptionQtyRateAmount
{{ row.item_code }}{{ row.item_name }}{{ row.qty }}{{ row.rate }}{{ row.amount }}
+ +
+

+ Subtotal:{{ doc.total }} +

+ + {% for tax in doc.taxes %} +

+ {{ tax.account_head }} ({{ tax.rate }}%): + {{ tax.tax_amount }} +

+ {% endfor %} + +

+ Total:{{ doc.grand_total }} +

+

+ Paid:{{ doc.total_advance }} +

+

+ Balance Due:{{ doc.outstanding_amount }} +

+
+ + +
+ + +
+

+ Prompt payment is always appreciated. We accept payments by check or over the phone using a debit or credit card. Automatic payment setup is also available upon request. + + Invoices over 30 days may be charged a late payment fee of 1.5% per month with a minimum fee of $5. + + Thanks for your business. +

+
+ + +
diff --git a/ns_app/print_formats/sales_invoice_ns/sales_invoice_ns.json b/ns_app/print_formats/sales_invoice_ns/sales_invoice_ns.json new file mode 100644 index 0000000..4a61724 --- /dev/null +++ b/ns_app/print_formats/sales_invoice_ns/sales_invoice_ns.json @@ -0,0 +1,8 @@ +{ + "doctype": "Print Format", + "name": "Sales Invoice - NS", + "doc_type": "Sales Invoice", + "print_format_type": "Jinja", + "standard": "Yes", + "disabled": 0 +}