Skip to content

Commit

Permalink
[FIX] repeat header all page
Browse files Browse the repository at this point in the history
  • Loading branch information
newtratip committed Jan 19, 2025
1 parent f608808 commit 3f79dde
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 0 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"absolute_value": 0,
"align_labels_right": 0,
"creation": "2025-01-16 18:53:30.495503",
"css": "body {\n padding: 0mm 0 5mm !important;\n}\n.print-format {\n font-family: \"TH Sarabun New\";\n font-size: 16px;\n line-height: 1;\n margin-left: 5mm;\n margin-right: 5mm;\n}\n.print-format td, .print-format th {\n padding: 5px !important;\n}\n.print-format-preview{\n padding: 30px;\n}\ntable {\n width: 100%;\n}\n.summary, .note {\n page-break-inside: avoid;\n}\n.logo {\n width: 100px;\n}\n.text-color {\n color: #FB6F92 !important;\n}\n.head-col {\n background-color: #FB6F92;\n color: #FFFFFF !important;\n font-weight: bold !important;\n border-right: 1px solid #FFFFFF;\n}\n.with-border {\n border-bottom: 2px solid #d3d3d3;\n}\n.inv-detail h1 {\n margin-bottom: 0;\n}\n.inv-detail {\n line-height: 1.5;\n}\n.col-4, .col-6, .col-7 {\n width: 10%;\n}\n.col-1, .col-5 {\n width: 5%;\n}\n.col-2 {\n width: 20%;\n}\n.col-3 {\n width: 40%;\n}\n.inline-footer {\n border-top: 2px solid #d3d3d3;\n line-height: 2;\n}\n.original, .copy {\n display: none;\n}\n.footer {\n visibility: hidden;\n}",
"custom_format": 1,
"default_print_language": "en",
"disabled": 0,
"doc_type": "Sales Invoice",
"docstatus": 0,
"doctype": "Print Format",
"font_size": 14,
"html": "<style>\n @font-face {\n font-family: \"TH Sarabun New\";\n src: url(\"{{ frappe.utils.get_url() }}/assets/menghua_co/fonts/th-sarabun-new/THSarabunNew.ttf\") format(\"truetype\");\n }\n</style>\n\n{% set company = frappe.db.get_value(\n \"Company\",\n {\"name\": doc.company},\n [\"company_logo\", \"company_name\", \"tax_id\"],\n as_dict=True) %}\n{% set parent_company_address = frappe.db.get_all(\n \"Dynamic Link\",\n {\"link_doctype\": \"Company\", \"link_name\": company.company_name},\n pluck=\"parent\") %}\n{% set company_address = frappe.db.get_value(\n \"Address\",\n {\"name\": (\"in\", parent_company_address), \"address_type\": \"Permanent\"},\n [\"address_line1\", \"address_line2\", \"city\", \"county\", \"state\", \"pincode\", \"phone\"],\n as_dict=True) %}\n{% set customer = frappe.db.get_value(\n \"Customer\",\n {\"name\": doc.customer},\n [\"customer_name\", \"tax_id\"],\n as_dict=True) %}\n{% set customer_address = frappe.db.get_value(\n \"Address\",\n {\"name\": (\"=\", doc.customer_address)},\n [\"address_line1\", \"address_line2\", \"city\", \"county\", \"state\", \"pincode\", \"phone\", \"contact\"],\n as_dict=True) %}\n{% set shipping_address = frappe.db.get_value(\n \"Address\",\n {\"name\": (\"=\", doc.shipping_address_name)},\n [\"address_title\", \"address_line1\", \"address_line2\", \"city\", \"county\", \"state\", \"pincode\", \"phone\", \"contact\"],\n as_dict=True) or customer_address %}\n{% set sale_orders = set(frappe.db.get_all(\n \"Sales Invoice Item\",\n {\"parenttype\": \"Sales Invoice\", \"parentfield\": \"items\", \"parent\": doc.name},\n pluck=\"sales_order\")) | reject(\"none\") | list %}\n{% set sale_persons = set(frappe.db.get_all(\n \"Sales Team\",\n {\"parenttype\": \"Sales Invoice\", \"parentfield\": \"sales_team\", \"parent\": doc.name},\n pluck=\"sales_person\")) | reject(\"none\") | list %}\n\n{% set number_of_copies = 2 %}\n\n<!-- Show this form only sales invoice No VAT -->\n{% if doc.name[:3] == \"INV\" or (doc.name[:2] != \"NV\" and doc.taxes) %}\n {% set number_of_copies = 0 %}\n <div id=\"header-html\" class=\"hidden-pdf\"></div>\n <h1 style=\"color: red;\">\u0e1f\u0e2d\u0e23\u0e4c\u0e21\u0e19\u0e35\u0e49\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a Sales Invoice \u0e17\u0e35\u0e48\u0e44\u0e21\u0e48\u0e21\u0e35 Vat <strong style=\"color: red;\">\u0e40\u0e2d\u0e01\u0e2a\u0e32\u0e23\u0e19\u0e35\u0e49 {{ doc.name or \"-\"}} \u0e21\u0e35 Vat</strong> \u0e01\u0e23\u0e38\u0e13\u0e32\u0e40\u0e25\u0e37\u0e2d\u0e01\u0e1f\u0e2d\u0e23\u0e4c\u0e21 Sales Invoice MH (VAT) \u0e41\u0e17\u0e19\u0e17\u0e35\u0e48</h1>\n <div id=\"footer-html\" class=\"hidden-pdf\"></div>\n{% endif %}\n\n{% for copy in range(number_of_copies) %}\n <div class=\"{{ 'page-break' if copy < number_of_copies - 1 else '' }}\">\n <div id=\"header-html\" class=\"hidden-pdf\">\n <script>\n // This script can used with only 1 original + 1 copy, If you have more copy page. please validate this function again\n window.onload = function() {\n var vars = {};\n var x = document.location.search.substring(1).split(\"&\");\n for (var i in x) {\n var z = x[i].split(\"=\", 2);\n vars[z[0]] = unescape(z[1]);\n }\n if (vars[\"page\"] <= vars[\"topage\"] / {{ number_of_copies }}) {\n document.querySelectorAll(\".original\")[0].style.display = \"block\";\n } else {\n document.querySelectorAll(\".copy\")[0].style.display = \"block\";\n }\n };\n </script>\n <br>\n <div class=\"row section-break\">\n <div class=\"col-xs-7\"></div>\n <div class=\"col-xs-5 inv-detail\">\n <div class=\"row section-break\">\n <div class=\"col-xs-12 text-center\">\n <h1>\n <strong class=\"text-color\">\n \u0e43\u0e1a\u0e2a\u0e48\u0e07\u0e02\u0e2d\u0e07/\u0e43\u0e1a\u0e41\u0e08\u0e49\u0e07\u0e2b\u0e19\u0e35\u0e49\n </strong>\n </h1>\n <p>\n <strong>\n <span class=\"original text-color\">\n \u0e15\u0e49\u0e19\u0e09\u0e1a\u0e31\u0e1a\n </span>\n <span class=\"copy text-color\">\n \u0e2a\u0e33\u0e40\u0e19\u0e32\n </span>\n </strong>\n </p>\n </div>\n </div>\n <div class=\"row section-break\">\n <div class=\"col-xs-12\">\n <div class=\"with-border\"></div>\n </div>\n </div>\n <div class=\"row section-break\">\n <div class=\"col-xs-3 text-color\">\n \u0e40\u0e25\u0e02\u0e17\u0e35\u0e48\n </div>\n <div class=\"col-xs-9\">\n {{ doc.name or \"-\" }}\n </div>\n </div>\n <div class=\"row section-break\">\n <div class=\"col-xs-3 text-color\">\n \u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\n </div>\n <div class=\"col-xs-9\">\n {{ doc.posting_date and frappe.utils.getdate(doc.posting_date).strftime(\"%d/%m/%Y\") or \"-\" }}\n </div>\n </div>\n <div class=\"row section-break\">\n <div class=\"col-xs-12\">\n <div class=\"with-border\"></div>\n </div>\n </div>\n <div class=\"row section-break\">\n <div class=\"col-xs-3 text-color\">\n \u0e2d\u0e49\u0e32\u0e07\u0e2d\u0e34\u0e07\n </div>\n <div class=\"col-xs-9\">\n {{ sale_orders and sale_orders | join(\", \") or \"-\" }}\n </div>\n </div>\n <div class=\"row section-break\">\n <div class=\"col-xs-3 text-color\">\n PO\n </div>\n <div class=\"col-xs-9\">\n {{ doc.po_no or \"-\" }}\n </div>\n </div>\n <div class=\"row section-break\">\n <div class=\"col-xs-3 text-color\">\n \u0e1c\u0e39\u0e49\u0e02\u0e32\u0e22\n </div>\n <div class=\"col-xs-9\">\n {{ sale_persons and sale_persons | join(\", \") or \"-\" }}\n </div>\n </div>\n </div>\n </div>\n <br>\n <div class=\"row section-break\">\n <div class=\"col-xs-6\">\n <p class=\"text-color\">\n \u0e25\u0e39\u0e01\u0e04\u0e49\u0e32\n </p>\n <p>\n {{ customer.customer_name or \"-\" }}\n </p>\n <p>\u0e17\u0e35\u0e48\u0e2d\u0e22\u0e39\u0e48\n {% if customer_address %}\n {{ customer_address.address_line1 or ''}}\n {{ customer_address.address_line2 or ''}}\n {{ customer_address.city or ''}}\n {{ customer_address.county or ''}}\n {{ customer_address.state or ''}}\n {{ customer_address.pincode or ''}}\n {% else %}\n -\n {% endif %}\n </p>\n <p>\n \u0e15\u0e34\u0e14\u0e15\u0e48\u0e2d {{ customer_address.contact or \"-&nbsp;&nbsp;&nbsp;\" }} \u0e42\u0e17\u0e23 {{ customer_address.phone or \"-\" }}\n </p>\n </div>\n <div class=\"col-xs-6\">\n <p class=\"text-color\">\n \u0e17\u0e35\u0e48\u0e2d\u0e22\u0e39\u0e48\u0e08\u0e31\u0e14\u0e2a\u0e48\u0e07\n </p>\n <p>\n {{ shipping_address.address_title or customer.customer_name or \"-\" }}\n </p>\n <p>\u0e17\u0e35\u0e48\u0e2d\u0e22\u0e39\u0e48\n {% if shipping_address %}\n {{ shipping_address.address_line1 or \"\"}}\n {{ shipping_address.address_line2 or \"\"}}\n {{ shipping_address.city or \"\"}}\n {{ shipping_address.county or \"\"}}\n {{ shipping_address.state or \"\"}}\n {{ shipping_address.pincode or \"\"}}\n {% else %}\n -\n {% endif %}\n </p>\n <p>\n \u0e15\u0e34\u0e14\u0e15\u0e48\u0e2d {{ shipping_address.contact or \"-&nbsp;&nbsp;&nbsp;\" }} \u0e42\u0e17\u0e23 {{ shipping_address.phone or \"-\" }}\n </p>\n </div>\n </div>\n </div>\n <div id=\"detail-html\">\n <table>\n <thead>\n <tr>\n <th class=\"text-center head-col col-1\">#</th>\n <th class=\"text-center head-col col-2\">\u0e23\u0e2b\u0e31\u0e2a\u0e2a\u0e34\u0e19\u0e04\u0e49\u0e32</th>\n <th class=\"text-center head-col col-3\">\u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14</th>\n <th class=\"text-center head-col col-4\">\u0e08\u0e33\u0e19\u0e27\u0e19</th>\n <th class=\"text-center head-col col-5\"></th>\n <th class=\"text-center head-col col-6\">\u0e23\u0e32\u0e04\u0e32\u0e15\u0e48\u0e2d\u0e2b\u0e19\u0e48\u0e27\u0e22</th>\n <th class=\"text-center head-col col-7\">\u0e22\u0e2d\u0e14\u0e23\u0e27\u0e21</th>\n </tr>\n </thead>\n <tbody>\n {% for item in doc.items %}\n <tr>\n <td class=\"text-center with-border\">\n {{ item.idx }}\n </td>\n <td class=\"with-border\">\n {{ item.item_code }}\n </td>\n <td class=\"with-border\">\n {{ item.item_name }}\n </td>\n <td class=\"text-right with-border\">\n {{ item.qty | int if item.qty - item.qty | int == 0 else \"{:,.2f}\".format(item.qty) }}\n </td>\n <td class=\"with-border\">\n {{ item.uom }}\n </td>\n <td class=\"text-right with-border\">\n {{ \"{:,.2f}\".format(item.rate) }}\n </td>\n <td class=\"text-right with-border\">\n {{ \"{:,.2f}\".format(item.amount) }}\n </td>\n </tr>\n {% endfor %}\n </tbody>\n </table>\n <table class=\"summary\">\n <tr>\n <td colspan=\"5\" class=\"text-color text-right\">\n \u0e23\u0e27\u0e21\u0e40\u0e1b\u0e47\u0e19\u0e40\u0e07\u0e34\u0e19\n </td>\n <td colspan=\"2\" class=\"text-right\">\n {{ \"{:,.2f}\".format(doc.total) }}\n {{ doc.currency == \"THB\" and \"\u0e1a\u0e32\u0e17\" or doc.currency }}\n </td>\n </tr>\n <tr>\n <td colspan=\"5\" class=\"text-color text-right\">\n \u0e2a\u0e48\u0e27\u0e19\u0e25\u0e14\n </td>\n <td colspan=\"2\" class=\"text-right\">\n {{ \"{:,.2f}\".format(doc.discount_amount) }}\n {{ doc.currency == \"THB\" and \"\u0e1a\u0e32\u0e17\" or doc.currency }}\n </td>\n </tr>\n <tr>\n <td colspan=\"5\" class=\"text-color text-right\">\n \u0e23\u0e32\u0e04\u0e32\u0e2b\u0e25\u0e31\u0e07\u0e2b\u0e31\u0e01\u0e2a\u0e48\u0e27\u0e19\u0e25\u0e14\n </td>\n <td colspan=\"2\" class=\"text-right\">\n {{ \"{:,.2f}\".format(doc.net_total) }}\n {{ doc.currency == \"THB\" and \"\u0e1a\u0e32\u0e17\" or doc.currency }}\n </td>\n </tr>\n <tr>\n <td colspan=\"3\">\n ({{ amount_in_bahttext(doc.grand_total) }})\n </td>\n <td colspan=\"2\" class=\"text-color text-right\">\n \u0e08\u0e33\u0e19\u0e27\u0e19\u0e40\u0e07\u0e34\u0e19\u0e23\u0e27\u0e21\u0e17\u0e31\u0e49\u0e07\u0e2a\u0e34\u0e49\u0e19\n </td>\n <td colspan=\"2\" class=\"text-right\">\n {{ \"{:,.2f}\".format(doc.grand_total) }}\n {{ doc.currency == \"THB\" and \"\u0e1a\u0e32\u0e17\" or doc.currency }}\n </td>\n </tr>\n </table>\n <br>\n <div class=\"row section-break note\">\n <div class=\"col-xs-12\">\n <p class=\"text-color\">\n \u0e2b\u0e21\u0e32\u0e22\u0e40\u0e2b\u0e15\u0e38\n </p>\n <div>\n {{ doc.terms or \"-\" }}\n </div>\n </div>\n </div>\n </div>\n <div id=\"footer-html\" class=\"visible-pdf\">\n <script>\n // This script can used with only 1 original + 1 copy, If you have more copy page. please validate this function again\n window.onload = function() {\n var vars = {};\n var x = document.location.search.substring(1).split(\"&\");\n for (var i in x) {\n var z = x[i].split(\"=\", 2);\n vars[z[0]] = unescape(z[1]);\n }\n if (vars[\"page\"] == vars[\"topage\"] / {{ number_of_copies }} || vars[\"page\"] == vars[\"topage\"]) {\n document.querySelectorAll(\".footer\")[0].style.visibility = \"visible\";\n }\n var page_number = vars[\"page\"] - (vars[\"topage\"] / {{ number_of_copies }})\n if (page_number <= 0) {\n page_number = vars[\"page\"]\n }\n document.querySelectorAll(\".page-number\")[0].innerHTML = \"\u0e2b\u0e19\u0e49\u0e32\u0e17\u0e35\u0e48 \" + page_number + \"/\" + vars[\"topage\"]/{{ number_of_copies }};\n };\n </script>\n <div class=\"footer\">\n <div class=\"row section-break\">\n <div class=\"col-xs-4 text-center\">\n <div class=\"inline-footer\">\u0e1c\u0e39\u0e49\u0e23\u0e31\u0e1a\u0e2a\u0e34\u0e19\u0e04\u0e49\u0e32/\u0e1a\u0e23\u0e34\u0e01\u0e32\u0e23</div>\n </div>\n <div class=\"col-xs-4 text-center\">\n <div class=\"inline-footer\">\u0e1c\u0e39\u0e49\u0e2a\u0e48\u0e07\u0e2a\u0e34\u0e19\u0e04\u0e49\u0e32/\u0e1a\u0e23\u0e34\u0e01\u0e32\u0e23</div>\n </div>\n <div class=\"col-xs-4 text-center\">\n <div class=\"inline-footer\">\u0e1c\u0e39\u0e49\u0e2d\u0e19\u0e38\u0e21\u0e31\u0e15\u0e34</div>\n </div>\n </div>\n </br></br>\n <div class=\"row section-break\">\n <div class=\"col-xs-4 text-center\">\n <div class=\"inline-footer\">\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48</div>\n </div>\n <div class=\"col-xs-4 text-center\">\n <div class=\"inline-footer\">\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48</div>\n </div>\n <div class=\"col-xs-4 text-center\">\n <div class=\"inline-footer\">\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48</div>\n </div>\n </div>\n </div>\n <p class=\"page-number\"></p>\n </div>\n </div>\n{% endfor %}",
"idx": 0,
"line_breaks": 0,
"margin_bottom": 15.0,
"margin_left": 15.0,
"margin_right": 15.0,
"margin_top": 15.0,
"modified": "2025-01-20 01:45:34.737893",
"modified_by": "Administrator",
"module": "Menghua Co",
"name": "Sales Invoice MH (No VAT)",
"owner": "Administrator",
"page_number": "Hide",
"print_format_builder": 0,
"print_format_builder_beta": 0,
"print_format_type": "Jinja",
"raw_printing": 0,
"show_section_headings": 0,
"standard": "Yes"
}
Empty file.
Loading

0 comments on commit 3f79dde

Please sign in to comment.