fix: Process SOA enhancement

This commit is contained in:
Anuja P 2021-05-13 14:26:27 +05:30
parent b9078a0c86
commit ab1ae418cc
3 changed files with 93 additions and 52 deletions

View File

@ -1,24 +1,43 @@
<h1 class="text-center" style="page-break-before:always">{{ filters.party[0] }}</h1> <div class="page-break">
<h3 class="text-center">{{ _("Statement of Accounts") }}</h3> <div id="header-html" class="hidden-pdf">
{% if letter_head %}
<div class="letter-head text-center">{{ letter_head.content }}</div>
<hr style="height:2px;border-width:0;color:black;background-color:black;">
{% endif %}
</div>
<div id="footer-html" class="visible-pdf">
{% if letter_head.footer %}
<div class="letter-head-footer">
<hr style="border-width:0;color:black;background-color:black;padding-bottom:2px;">
{{ letter_head.footer }}
</div>
{% endif %}
</div>
<h5 class="text-center"> <h2 class="text-center">{{ _("STATEMENTS OF ACCOUNTS") }}</h2>
{{ frappe.format(filters.from_date, 'Date')}} <div>
{{ _("to") }} <h5 style="float: left;">{{ _("Customer: ") }} <b>{{filters.party[0] }}</b></h5>
{{ frappe.format(filters.to_date, 'Date')}} <h5 style="float: right;">
</h5> {{ _("Date: ") }}
<b>{{ frappe.format(filters.from_date, 'Date')}}
{{ _("to") }}
{{ frappe.format(filters.to_date, 'Date')}}</b>
</h5>
</div>
<br>
<table class="table table-bordered"> <table class="table table-bordered">
<thead> <thead>
<tr> <tr>
<th style="width: 12%">{{ _("Date") }}</th> <th style="width: 12%">{{ _("Date") }}</th>
<th style="width: 15%">{{ _("Ref") }}</th> <th style="width: 15%">{{ _("Reference") }}</th>
<th style="width: 25%">{{ _("Party") }}</th> <th style="width: 25%">{{ _("Remarks") }}</th>
<th style="width: 15%">{{ _("Debit") }}</th> <th style="width: 15%">{{ _("Debit") }}</th>
<th style="width: 15%">{{ _("Credit") }}</th> <th style="width: 15%">{{ _("Credit") }}</th>
<th style="width: 18%">{{ _("Balance (Dr - Cr)") }}</th> <th style="width: 18%">{{ _("Balance (Dr - Cr)") }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for row in data %} {% for row in data %}
<tr> <tr>
{% if(row.posting_date) %} {% if(row.posting_date) %}
@ -58,32 +77,35 @@
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<br><br> <br>
{% if aging %} {% if aging %}
<h3 class="text-center">{{ _("Ageing Report Based On ") }} {{ aging.ageing_based_on }}</h3> <h4 class="text-center">{{ _("Ageing Report based on ") }} {{ aging.ageing_based_on }}
<h5 class="text-center"> {{ _("up to " ) }} {{ frappe.format(filters.to_date, 'Date')}}
{{ _("Up to " ) }} {{ frappe.format(filters.to_date, 'Date')}} </h4>
</h5> <table class="table table-bordered">
<br> <thead>
<tr>
<table class="table table-bordered"> <th style="width: 25%">30 Days</th>
<thead> <th style="width: 25%">60 Days</th>
<tr> <th style="width: 25%">90 Days</th>
<th style="width: 12%">30 Days</th> <th style="width: 25%">120 Days</th>
<th style="width: 15%">60 Days</th> </tr>
<th style="width: 25%">90 Days</th> </thead>
<th style="width: 15%">120 Days</th> <tbody>
</tr> <tr>
</thead> <td>{{ frappe.utils.fmt_money(aging.range1, currency=filters.presentation_currency) }}</td>
<tbody> <td>{{ frappe.utils.fmt_money(aging.range2, currency=filters.presentation_currency) }}</td>
<tr> <td>{{ frappe.utils.fmt_money(aging.range3, currency=filters.presentation_currency) }}</td>
<td>{{ frappe.utils.fmt_money(aging.range1, currency=filters.presentation_currency) }}</td> <td>{{ frappe.utils.fmt_money(aging.range4, currency=filters.presentation_currency) }}</td>
<td>{{ frappe.utils.fmt_money(aging.range2, currency=filters.presentation_currency) }}</td> </tr>
<td>{{ frappe.utils.fmt_money(aging.range3, currency=filters.presentation_currency) }}</td> </tbody>
<td>{{ frappe.utils.fmt_money(aging.range4, currency=filters.presentation_currency) }}</td> </table>
</tr> {% endif %}
</tbody> <!-- <p class="text-right text-muted">Printed On {{ frappe.format(frappe.utils.get_datetime(), 'Datetime') }}</p> -->
</table> {% if terms_and_conditions %}
{% endif %} <div>
<p class="text-right text-muted">Printed On {{ frappe.format(frappe.utils.get_datetime(), 'Datetime') }}</p> {{ terms_and_conditions }}
</div>
{% endif %}
</div>

View File

@ -1,6 +1,5 @@
{ {
"actions": [], "actions": [],
"allow_workflow": 1,
"autoname": "Prompt", "autoname": "Prompt",
"creation": "2020-05-22 16:46:18.712954", "creation": "2020-05-22 16:46:18.712954",
"doctype": "DocType", "doctype": "DocType",
@ -28,9 +27,11 @@
"customers", "customers",
"preferences", "preferences",
"orientation", "orientation",
"section_break_14",
"include_ageing", "include_ageing",
"ageing_based_on", "ageing_based_on",
"section_break_14",
"letter_head",
"terms_and_conditions",
"section_break_1", "section_break_1",
"enable_auto_email", "enable_auto_email",
"section_break_18", "section_break_18",
@ -270,10 +271,22 @@
"fieldname": "body", "fieldname": "body",
"fieldtype": "Text Editor", "fieldtype": "Text Editor",
"label": "Body" "label": "Body"
},
{
"fieldname": "letter_head",
"fieldtype": "Link",
"label": "Letter Head",
"options": "Letter Head"
},
{
"fieldname": "terms_and_conditions",
"fieldtype": "Link",
"label": "Terms and Conditions",
"options": "Terms and Conditions"
} }
], ],
"links": [], "links": [],
"modified": "2020-08-08 08:47:09.185728", "modified": "2021-05-13 12:44:19.574844",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Process Statement Of Accounts", "name": "Process Statement Of Accounts",

View File

@ -62,6 +62,9 @@ def get_report_pdf(doc, consolidated=True):
tax_id = frappe.get_doc('Customer', entry.customer).tax_id tax_id = frappe.get_doc('Customer', entry.customer).tax_id
presentation_currency = get_party_account_currency('Customer', entry.customer, doc.company) \ presentation_currency = get_party_account_currency('Customer', entry.customer, doc.company) \
or doc.currency or get_company_currency(doc.company) or doc.currency or get_company_currency(doc.company)
if doc.letter_head:
from frappe.www.printview import get_letter_head
letter_head = get_letter_head(doc, 0)
filters= frappe._dict({ filters= frappe._dict({
'from_date': doc.from_date, 'from_date': doc.from_date,
@ -88,7 +91,10 @@ def get_report_pdf(doc, consolidated=True):
if len(res) == 3: if len(res) == 3:
continue continue
html = frappe.render_template(template_path, \ html = frappe.render_template(template_path, \
{"filters": filters, "data": res, "aging": aging[0] if doc.include_ageing else None}) {"filters": filters, "data": res, "aging": aging[0] if doc.include_ageing else None,
"letter_head": letter_head if doc.letter_head else None,
"terms_and_conditions": frappe.db.get_value('Terms and Conditions', doc.terms_and_conditions, 'terms')
if doc.terms_and_conditions else None})
html = frappe.render_template(base_template_path, {"body": html, \ html = frappe.render_template(base_template_path, {"body": html, \
"css": get_print_style(), "title": "Statement For " + entry.customer}) "css": get_print_style(), "title": "Statement For " + entry.customer})
statement_dict[entry.customer] = html statement_dict[entry.customer] = html