Browse Source
* fix: Credit note enhancement * Fix: Print format for Sales Invoice Return * fix: Zero quantity validation fix for credit notedevelop
Deepesh Garg
5 years ago
committed by
Nabin Hait
7 changed files with 182 additions and 4 deletions
@ -0,0 +1,129 @@ |
|||
{%- from "templates/print_formats/standard_macros.html" import add_header, render_field, print_value, fieldmeta, |
|||
get_width, get_align_class -%} |
|||
|
|||
{%- macro render_currency(df, doc) -%} |
|||
<div class="row {% if df.bold %}important{% endif %} data-field"> |
|||
<div class="col-xs-{{ "9" if df.fieldtype=="Check" else "5" }} |
|||
{%- if doc._align_labels_right %} text-right{%- endif -%}"> |
|||
<label>{{ _(df.label) }}</label> |
|||
</div> |
|||
<div class="col-xs-{{ "3" if df.fieldtype=="Check" else "7" }} value"> |
|||
{% if doc.get(df.fieldname) != None -%} |
|||
{{ frappe.utils.fmt_money((doc[df.fieldname])|int|abs, currency=doc.currency) }} |
|||
{% endif %} |
|||
</div> |
|||
</div> |
|||
{%- endmacro -%} |
|||
|
|||
{%- macro render_taxes(df, doc) -%} |
|||
{%- set data = doc.get(df.fieldname)[df.start:df.end] -%} |
|||
<div class="row"> |
|||
<div class="col-xs-6"></div> |
|||
<div class="col-xs-6"> |
|||
{%- for charge in data -%} |
|||
{%- if (charge.tax_amount or doc.flags.print_taxes_with_zero_amount) and (not charge.included_in_print_rate or doc.flags.show_inclusive_tax_in_print) -%} |
|||
<div class="row"> |
|||
<div class="col-xs-5 {%- if doc._align_labels_right %} text-right{%- endif -%}"> |
|||
<label>{{ charge.get_formatted("description") }}</label></div> |
|||
<div class="col-xs-7 text-right"> |
|||
{{ frappe.utils.fmt_money((charge.tax_amount)|int|abs, currency=doc.currency) }} |
|||
</div> |
|||
</div> |
|||
{%- endif -%} |
|||
{%- endfor -%} |
|||
</div> |
|||
</div> |
|||
{%- endmacro -%} |
|||
|
|||
{%- macro render_table(df, doc) -%} |
|||
{%- set table_meta = frappe.get_meta(df.options) -%} |
|||
{%- set data = doc.get(df.fieldname)[df.start:df.end] -%} |
|||
{%- if doc.print_templates and |
|||
doc.print_templates.get(df.fieldname) -%} |
|||
{% include doc.print_templates[df.fieldname] %} |
|||
{%- else -%} |
|||
{%- if data -%} |
|||
{%- set visible_columns = get_visible_columns(doc.get(df.fieldname), |
|||
table_meta, df) -%} |
|||
<div {{ fieldmeta(df) }}> |
|||
<table class="table table-bordered table-condensed"> |
|||
<thead> |
|||
<tr> |
|||
<th style="width: 40px" class="table-sr">{{ _("Sr") }}</th> |
|||
{% for tdf in visible_columns %} |
|||
{% if (data and not data[0].flags.compact_item_print) or tdf.fieldname in doc.get(df.fieldname)[0].flags.compact_item_fields %} |
|||
<th style="width: {{ get_width(tdf) }};" class="{{ get_align_class(tdf) }}" {{ fieldmeta(df) }}> |
|||
{{ _(tdf.label) }}</th> |
|||
{% endif %} |
|||
{% endfor %} |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
{% for d in data %} |
|||
<tr> |
|||
<td class="table-sr">{{ d.idx }}</td> |
|||
{% for tdf in visible_columns %} |
|||
{% if not d.flags.compact_item_print or tdf.fieldname in doc.get(df.fieldname)[0].flags.compact_item_fields %} |
|||
<td class="{{ get_align_class(tdf) }}" {{ fieldmeta(df) }}> |
|||
{% if tdf.fieldtype == 'Currency' %} |
|||
<div class="value">{{ frappe.utils.fmt_money((d[tdf.fieldname])|int|abs, currency=doc.currency) }}</div></td> |
|||
{% else %} |
|||
<div class="value">{{ print_value(tdf, d, doc, visible_columns) }}</div></td> |
|||
{% endif %} |
|||
{% endif %} |
|||
{% endfor %} |
|||
</tr> |
|||
{% endfor %} |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
{%- endif -%} |
|||
{%- 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> |
|||
|
|||
{% 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 %} |
|||
|
|||
{% for section in page %} |
|||
<div class="row section-break"> |
|||
{% if section.columns.fields %} |
|||
{%- if doc._line_breaks and loop.index != 1 -%}<hr>{%- endif -%} |
|||
{%- if doc._show_section_headings and section.label and section.has_data -%} |
|||
<h4 class='col-sm-12'>{{ _(section.label) }}</h4> |
|||
{% endif %} |
|||
{%- endif -%} |
|||
{% for column in section.columns %} |
|||
<div class="col-xs-{{ (12 / section.columns|len)|int }} column-break"> |
|||
{% for df in column.fields %} |
|||
{% if df.fieldname == 'taxes' %} |
|||
{{ render_taxes(df, doc) }} |
|||
{% elif df.fieldtype == 'Currency' %} |
|||
{{ render_currency(df, doc) }} |
|||
{% elif df.fieldtype =='Table' %} |
|||
{{ render_table(df, doc)}} |
|||
{% elif doc[df.fieldname] %} |
|||
{{ render_field(df, doc) }} |
|||
{% endif %} |
|||
{% endfor %} |
|||
</div> |
|||
{% endfor %} |
|||
</div> |
|||
{% endfor %} |
|||
</div> |
|||
{% endfor %} |
@ -0,0 +1,24 @@ |
|||
{ |
|||
"align_labels_right": 1, |
|||
"creation": "2019-07-24 20:13:30.259953", |
|||
"custom_format": 0, |
|||
"default_print_language": "en-US", |
|||
"disabled": 0, |
|||
"doc_type": "Sales Invoice", |
|||
"docstatus": 0, |
|||
"doctype": "Print Format", |
|||
"font": "Default", |
|||
"html": "", |
|||
"idx": 0, |
|||
"line_breaks": 1, |
|||
"modified": "2019-07-24 20:13:30.259953", |
|||
"modified_by": "Administrator", |
|||
"module": "Accounts", |
|||
"name": "Sales Invoice Return", |
|||
"owner": "Administrator", |
|||
"print_format_builder": 0, |
|||
"print_format_type": "Jinja", |
|||
"raw_printing": 0, |
|||
"show_section_headings": 1, |
|||
"standard": "Yes" |
|||
} |
Loading…
Reference in new issue