From d70cb30c5aadcc4b7bde737d11f60286a56b402f Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 8 Jul 2021 23:01:21 +0800 Subject: [PATCH] Add invoice print support for bootstrap theme --- .../bootstrap/html/mod_invoice_invoice.phtml | 2 +- .../bootstrap/html/mod_invoice_print.phtml | 267 ++++++++++++++++++ 2 files changed, 268 insertions(+), 1 deletion(-) create mode 100644 src/bb-themes/bootstrap/html/mod_invoice_print.phtml diff --git a/src/bb-themes/bootstrap/html/mod_invoice_invoice.phtml b/src/bb-themes/bootstrap/html/mod_invoice_invoice.phtml index 80375a7ce..fde60839b 100755 --- a/src/bb-themes/bootstrap/html/mod_invoice_invoice.phtml +++ b/src/bb-themes/bootstrap/html/mod_invoice_invoice.phtml @@ -215,7 +215,7 @@ {% if invoice.status == 'unpaid' %} {% trans 'Change payment method' %} {% endif %} - {% trans 'Download PDF' %} + {% trans 'Download PDF' %} {% trans 'Print' %}

diff --git a/src/bb-themes/bootstrap/html/mod_invoice_print.phtml b/src/bb-themes/bootstrap/html/mod_invoice_print.phtml new file mode 100644 index 000000000..104f7ec2f --- /dev/null +++ b/src/bb-themes/bootstrap/html/mod_invoice_print.phtml @@ -0,0 +1,267 @@ +{% set nr = invoice.serie ~ "%05s"|format(invoice.nr) %} +{% set seller = invoice.seller %} +{% set buyer = invoice.buyer %} +{% set company = guest.system_company %} + + + + + + + + + + + +
+
+
+
+

{% trans 'Invoice' %} {{nr}}

+
+
+
+
+ +
+ {% if company.logo_url %} + Logo + {% endif %} +
+
{% trans 'Invoice number' %}:
+
{{ nr }}
+
{% trans 'Invoice date' %}:
+
{% if invoice.created_at %} + {{ invoice.created_at | bb_date }} + {% else %} + ----- + {% endif %} +
+
{% trans 'Due date' %}:
+
{% if invoice.due_at %} + {{ invoice.due_at | bb_date }} + {% else %} + ----- + {% endif %} +
+
{% trans 'Invoice status' %}:
+
+ + + {{ invoice.status | capitalize }} + +
+
+
+
+
+
+

{% trans 'Company' %}

+
+ {% if seller.company %} +
{% trans 'Name' %}:
+
{{seller.company}}
+ {% endif %} + + {% if seller.company_vat%} +
{% trans 'VAT' %}:
+
{{seller.company_vat}}
+ {% endif %} + + {% if seller.address%} +
{% trans 'Address' %}:
+
{{seller.address}}
+ {% endif %} + + {% if seller.phone %} +
{% trans 'Phone' %}:
+
{{seller.phone}}
+ {% endif %} + + {% if seller.email %} +
{% trans 'Email' %}:
+
{{seller.email}}
+ {% endif %} + + {% if seller.account_number %} +
{% trans 'Account' %}:
+
{{seller.account_number}}
+ {% endif %} + + {% if seller.note %} +
{% trans 'Note' %}:
+
{{seller.note}}
+ {% endif %} +
+
+
+ + +
+
+

{% trans 'Billing & Delivery address' %}

+
+ {% if buyer.first_name or buyer.last_name %} +
{% trans 'Name' %}:
+
{{buyer.first_name}} {{buyer.last_name}}
+ {% endif %} + + {% if buyer.company %} +
{% trans 'Company' %}:
+
{{buyer.company}}
+ {% endif %} + + {% if buyer.company_number %} +
{% trans 'Company number' %}:
+
{{buyer.company_number}}
+ {% endif %} + + {% if buyer.company_vat %} +
{% trans 'Company VAT' %}:
+
{{buyer.company_vat}}
+ {% endif %} + + {% if buyer.address %} +
{% trans 'Address' %}:
+
{{buyer.address}}
+
{{buyer.city}}, {{buyer.state}}
+
{{buyer.zip}}, {{guest.system_countries[buyer.country]}}
+ {% endif %} + + {% if buyer.phone %} +
{% trans 'Phone' %}:
+
{{buyer.phone}}
+ {% endif %} +
+
+
+
+ + {% if invoice.text_1 %} +
+ {{ invoice.text_1|markdown }} +
+ {% endif %} + + + + + + + + + + + + {% for i, item in invoice.lines %} + + + + + + + + {% endfor %} + + +
{% trans '#' %}{% trans 'Title' %}{% trans 'Price' %}{% trans 'Total' %}
{{ i+1 }}. + {% if item.order_id%} + {{ item.title }} + {% else %} + {{ item.title }} + {% endif %} + + {{ item.price | money(invoice.currency) }} + {% if item.quantity > 1 %} + x {{ item.quantity }} {# item.unit #} + {% endif %} + {{ item.total | money(invoice.currency) }}
+
+
+
+ + {% if invoice.tax > 0 %} + + + + + {% endif %} + {% if invoice.discount > 0 %} + + + + + {% endif %} + + + + + +
{{ invoice.taxname }} {{ invoice.taxrate }}%{{ invoice.tax | money(invoice.currency) }}
{% trans 'Discount' %}{{ invoice.discount | money(invoice.currency) }}
{% trans 'Total' %}{{ invoice.total | money(invoice.currency) }}
+
+
+ + {% if invoice.text_2 %} +
+ {{ invoice.text_2|markdown }} +
+ {% endif %} +
+
+
+
+ +