mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-13 01:34:10 +00:00
feat: create sales invoice print format (#45403)
* feat: create sales invoice print format * fix: linter issue * style: remove border from table * refactor: change label to uppercase and show taxes * refactor: format date and add translation on label * refactor: remove default header and format labels * refactor: change label style and small fix * chore: Qty in title case --------- Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
"allow_import": 1,
|
||||
"autoname": "naming_series:",
|
||||
"creation": "2022-01-25 10:29:57.771398",
|
||||
"default_print_format": "Sales Invoice Print",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
@@ -2201,6 +2202,7 @@
|
||||
"print_hide": 1
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"icon": "fa fa-file-text",
|
||||
"idx": 181,
|
||||
"is_submittable": 1,
|
||||
@@ -2211,7 +2213,7 @@
|
||||
"link_fieldname": "consolidated_invoice"
|
||||
}
|
||||
],
|
||||
"modified": "2025-02-06 15:59:54.636202",
|
||||
"modified": "2025-03-05 17:06:59.720616",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice",
|
||||
@@ -2257,6 +2259,7 @@
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"row_format": "Dynamic",
|
||||
"search_fields": "posting_date, due_date, customer, base_grand_total, outstanding_amount",
|
||||
"show_name_in_global_search": 1,
|
||||
"sort_field": "creation",
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
{%- macro add_header(page_num, max_pages, doc, letter_head, no_letterhead, footer, print_settings=None, print_heading_template=None) -%}
|
||||
{% if letter_head and not no_letterhead %}
|
||||
<div class="letter-head">{{ letter_head }}</div>
|
||||
{% endif %}
|
||||
{% if print_heading_template %}
|
||||
{{ frappe.render_template(print_heading_template, {"doc":doc}) }}
|
||||
{% else %}
|
||||
{% endif %}
|
||||
{%- if doc.meta.is_submittable and doc.docstatus==2-%}
|
||||
<div class="text-center" document-status="cancelled">
|
||||
<h4 style="margin: 0px;">{{ _("CANCELLED") }}</h4>
|
||||
</div>
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
{% for page in layout %}
|
||||
<div class="page-break">
|
||||
<div {% if print_settings.repeat_header_footer %} id="header-html" class="hidden-pdf" {% endif %}>
|
||||
{{ add_header(loop.index, layout|len, doc, letter_head, no_letterhead, footer, print_settings) }}
|
||||
</div>
|
||||
<style>
|
||||
.taxes-section .order-taxes.mt-5{
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
.taxes-section .order-taxes .border-btm.pb-5{
|
||||
padding-bottom: 0px !important;
|
||||
}
|
||||
.print-format label{
|
||||
color: #74808b;
|
||||
font-size: 12px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
{% if print_settings.repeat_header_footer %}
|
||||
<div id="footer-html" class="visible-pdf">
|
||||
{% if not no_letterhead and footer %}
|
||||
<div class="letter-head-footer">
|
||||
{{ footer }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<p class="text-center small page-number visible-pdf">
|
||||
{{ _("Page {0} of {1}").format('<span class="page"></span>', '<span class="topage"></span>') }}
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="row section-break" style="margin-bottom: 10px;">
|
||||
<div class="col-xs-6 p-0">
|
||||
<div class="col-xs-12 value text-uppercase"><b>{{ doc.customer }}</b></div>
|
||||
<div class="col-xs-12">
|
||||
{{ doc.address_display }}
|
||||
</div>
|
||||
<div class="col-xs-12">
|
||||
{{ _("Conatct: ")+doc.contact_display if doc.contact_display else '' }}
|
||||
</div>
|
||||
<div class="col-xs-12">
|
||||
{{ _("Mobile: ")+doc.contact_mobile if doc.contact_mobile else '' }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-3"></div>
|
||||
<div class="col-xs-3" style="padding-left: 5px;">
|
||||
<div>
|
||||
<div><label>{{ _("Invoice ID") }}</label></div>
|
||||
<div>{{ doc.name }}</div>
|
||||
</div>
|
||||
<div style="margin-top: 20px;">
|
||||
<div><label>{{ _("Invoice Date") }}</label></div>
|
||||
<div>{{ frappe.utils.format_date(doc.posting_date) }}</div>
|
||||
</div>
|
||||
<div style="margin-top: 20px;">
|
||||
<div><label>{{ _("Due Date") }}</label></div>
|
||||
<div>{{ frappe.utils.format_date(doc.due_date) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-break">
|
||||
<table class="table table-bordered table-condensed mb-0" style="width: 100%; border-collapse: collapse; font-size: 12px;">
|
||||
<colgroup>
|
||||
<col style="width: 5%">
|
||||
<col style="width: 45%">
|
||||
<col style="width: 10%">
|
||||
<col style="width: 20%">
|
||||
<col style="width: 20%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-uppercase" style="text-align:center">{{ _("Sr") }}</th>
|
||||
<th class="text-uppercase" style="text-align:center">{{ _("Details") }}</th>
|
||||
<th class="text-uppercase" style="text-align:center">{{ _("Qty") }}</th>
|
||||
<th class="text-uppercase" style="text-align:right">{{ _("Rate") }}</th>
|
||||
<th class="text-uppercase" style="text-align:right">{{ _("Amount") }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% for item in doc.items %}
|
||||
<tr>
|
||||
<td style="text-align:center">{{ loop.index }}</td>
|
||||
<td>
|
||||
<b>{{ item.item_code }}: {{ item.item_name }}</b>
|
||||
{% if (item.description != item.item_name) %}
|
||||
<br>{{ item.description }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
{{ item.get_formatted("qty", 0) }}
|
||||
{{ item.get_formatted("uom", 0) }}
|
||||
</td>
|
||||
<td style="text-align: right;">{{ item.get_formatted("net_rate", doc) }}</td>
|
||||
<td style="text-align: right;">{{ item.get_formatted("net_amount", doc) }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
<!-- total -->
|
||||
<div class="row">
|
||||
|
||||
<div class="col-xs-6">
|
||||
<div>
|
||||
<label>{{ _("Amount in Words") }}</label>
|
||||
{{ doc.in_words }}
|
||||
</div>
|
||||
<div style="margin-top: 20px;">
|
||||
<label>{{ _("Payment Status") }}</label>
|
||||
{{ doc.status }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="row section-break">
|
||||
<div class="col-xs-7"><div>{{ _("Sub Total") }}</div></div>
|
||||
<div class="col-xs-5" style="text-align: right;">{{ doc.get_formatted("net_total", doc) }}</div>
|
||||
</div>
|
||||
<div>
|
||||
{% for d in doc.taxes %}
|
||||
{% if d.tax_amount %}
|
||||
<div class="row">
|
||||
<div class="col-xs-8"><div>{{ _(d.description) }}</div></div>
|
||||
<div class="col-xs-4" style="text-align: right;">{{ d.get_formatted("tax_amount") }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-7"><div>{{ _("Total") }}</div></div>
|
||||
<div class="col-xs-5" style="text-align: right;">{{ doc.get_formatted("grand_total", doc) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="row important data-field">
|
||||
<div class="col-xs-12"><label>{{ _("Terms and Conditions") }}: </label></div>
|
||||
<div class="col-xs-12">{{ doc.terms if doc.terms else '' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"absolute_value": 0,
|
||||
"align_labels_right": 0,
|
||||
"creation": "2025-01-22 16:23:51.012200",
|
||||
"css": "",
|
||||
"custom_format": 0,
|
||||
"default_print_language": "en",
|
||||
"disabled": 0,
|
||||
"doc_type": "Sales Invoice",
|
||||
"docstatus": 0,
|
||||
"doctype": "Print Format",
|
||||
"font": "",
|
||||
"font_size": 14,
|
||||
"idx": 0,
|
||||
"line_breaks": 0,
|
||||
"margin_bottom": 0.0,
|
||||
"margin_left": 0.0,
|
||||
"margin_right": 0.0,
|
||||
"margin_top": 0.0,
|
||||
"modified": "2025-01-22 16:23:51.012200",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice Print",
|
||||
"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"
|
||||
}
|
||||
Reference in New Issue
Block a user