fix: add patch for setting default value of report field
diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json
index 70e8104..8004659 100644
--- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json
+++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json
@@ -326,7 +326,8 @@
"fieldname": "report",
"fieldtype": "Select",
"label": "Report",
- "options": "General Ledger\nAccounts Receivable"
+ "options": "General Ledger\nAccounts Receivable",
+ "reqd": 1
},
{
"default": "Today",
@@ -372,7 +373,7 @@
}
],
"links": [],
- "modified": "2023-06-19 18:37:10.040570",
+ "modified": "2023-06-23 10:13:15.051950",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Process Statement Of Accounts",
diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py
index db186d8..08f4cf4 100644
--- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py
+++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py
@@ -160,7 +160,7 @@
template_path = (
"erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.html"
if doc.report == "General Ledger"
- else "erpnext/accounts/report/accounts_receivable/accounts_receivable.html"
+ else "erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts_accounts_receivable.html"
)
if doc.letter_head:
diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts_accounts_receivable.html b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts_accounts_receivable.html
new file mode 100644
index 0000000..07e1896
--- /dev/null
+++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts_accounts_receivable.html
@@ -0,0 +1,348 @@
+<style>
+ .print-format {
+ padding: 4mm;
+ font-size: 8.0pt !important;
+ }
+ .print-format td {
+ vertical-align:middle !important;
+ }
+ </style>
+
+ <h2 class="text-center" style="margin-top:0">{{ _(report.report_name) }}</h2>
+ <h4 class="text-center">
+ {% if (filters.customer_name) %}
+ {{ filters.customer_name }}
+ {% else %}
+ {{ filters.customer ~ filters.supplier }}
+ {% endif %}
+ </h4>
+ <h6 class="text-center">
+ {% if (filters.tax_id) %}
+ {{ _("Tax Id: ") }}{{ filters.tax_id }}
+ {% endif %}
+ </h6>
+ <h5 class="text-center">
+ {{ _(filters.ageing_based_on) }}
+ {{ _("Until") }}
+ {{ frappe.format(filters.report_date, 'Date') }}
+ </h5>
+
+ <div class="clearfix">
+ <div class="pull-left">
+ {% if(filters.payment_terms) %}
+ <strong>{{ _("Payment Terms") }}:</strong> {{ filters.payment_terms }}
+ {% endif %}
+ </div>
+ <div class="pull-right">
+ {% if(filters.credit_limit) %}
+ <strong>{{ _("Credit Limit") }}:</strong> {{ frappe.utils.fmt_money(filters.credit_limit) }}
+ {% endif %}
+ </div>
+ </div>
+
+ {% if(filters.show_future_payments) %}
+ {% set balance_row = data.slice(-1).pop() %}
+ {% for i in report.columns %}
+ {% if i.fieldname == 'age' %}
+ {% set elem = i %}
+ {% endif %}
+ {% endfor %}
+ {% set start = report.columns.findIndex(elem) %}
+ {% set range1 = report.columns[start].label %}
+ {% set range2 = report.columns[start+1].label %}
+ {% set range3 = report.columns[start+2].label %}
+ {% set range4 = report.columns[start+3].label %}
+ {% set range5 = report.columns[start+4].label %}
+ {% set range6 = report.columns[start+5].label %}
+
+ {% if(balance_row) %}
+ <table class="table table-bordered table-condensed">
+ <caption class="text-right">(Amount in {{ data[0]["currency"] ~ "" }})</caption>
+ <colgroup>
+ <col style="width: 30mm;">
+ <col style="width: 18mm;">
+ <col style="width: 18mm;">
+ <col style="width: 18mm;">
+ <col style="width: 18mm;">
+ <col style="width: 18mm;">
+ <col style="width: 18mm;">
+ <col style="width: 18mm;">
+ </colgroup>
+
+ <thead>
+ <tr>
+ <th>{{ _(" ") }}</th>
+ <th>{{ _(range1) }}</th>
+ <th>{{ _(range2) }}</th>
+ <th>{{ _(range3) }}</th>
+ <th>{{ _(range4) }}</th>
+ <th>{{ _(range5) }}</th>
+ <th>{{ _(range6) }}</th>
+ <th>{{ _("Total") }}</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{ _("Total Outstanding") }}</td>
+ <td class="text-right">
+ {{ format_number(balance_row["age"], null, 2) }}
+ </td>
+ <td class="text-right">
+ {{ frappe.utils.fmt_money(balance_row["range1"], data[data.length-1]["currency"]) }}
+ </td>
+ <td class="text-right">
+ {{ frappe.utils.fmt_money(balance_row["range2"], data[data.length-1]["currency"]) }}
+ </td>
+ <td class="text-right">
+ {{ frappe.utils.fmt_money(balance_row["range3"], data[data.length-1]["currency"]) }}
+ </td>
+ <td class="text-right">
+ {{ frappe.utils.fmt_money(balance_row["range4"], data[data.length-1]["currency"]) }}
+ </td>
+ <td class="text-right">
+ {{ frappe.utils.fmt_money(balance_row["range5"], data[data.length-1]["currency"]) }}
+ </td>
+ <td class="text-right">
+ {{ frappe.utils.fmt_money(flt(balance_row["outstanding"]), data[data.length-1]["currency"]) }}
+ </td>
+ </tr>
+ <td>{{ _("Future Payments") }}</td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td class="text-right">
+ {{ frappe.utils.fmt_money(flt(balance_row[("future_amount")]), data[data.length-1]["currency"]) }}
+ </td>
+ <tr class="cvs-footer">
+ <th class="text-left">{{ _("Cheques Required") }}</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ <th></th>
+ <th></th>
+ <th></th>
+ <th class="text-right">
+ {{ frappe.utils.fmt_money(flt(balance_row["outstanding"] - balance_row[("future_amount")]), data[data.length-1]["currency"]) }}</th>
+ </tr>
+ </tbody>
+
+ </table>
+ {% endif %}
+ {% endif %}
+ <table class="table table-bordered">
+ <thead>
+ <tr>
+ {% if(report.report_name == "Accounts Receivable" or report.report_name == "Accounts Payable") %}
+ <th style="width: 10%">{{ _("Date") }}</th>
+ <th style="width: 4%">{{ _("Age (Days)") }}</th>
+
+ {% if(report.report_name == "Accounts Receivable" and filters.show_sales_person) %}
+ <th style="width: 14%">{{ _("Reference") }}</th>
+ <th style="width: 10%">{{ _("Sales Person") }}</th>
+ {% else %}
+ <th style="width: 24%">{{ _("Reference") }}</th>
+ {% endif %}
+ {% if not(filters.show_future_payments) %}
+ <th style="width: 20%">
+ {% if (filters.customer or filters.supplier or filters.customer_name) %}
+ {{ _("Remarks") }}
+ {% else %}
+ {{ _("Party") }}
+ {% endif %}
+ </th>
+ {% endif %}
+ <th style="width: 10%; text-align: right">{{ _("Invoiced Amount") }}</th>
+ {% if not(filters.show_future_payments) %}
+ <th style="width: 10%; text-align: right">{{ _("Paid Amount") }}</th>
+ <th style="width: 10%; text-align: right">
+ {% if report.report_name == "Accounts Receivable" %}
+ {{ _('Credit Note') }}
+ {% else %}
+ {{ _('Debit Note') }}
+ {% endif %}
+ </th>
+ {% endif %}
+ <th style="width: 10%; text-align: right">{{ _("Outstanding Amount") }}</th>
+ {% if(filters.show_future_payments) %}
+ {% if(report.report_name == "Accounts Receivable") %}
+ <th style="width: 12%">{{ _("Customer LPO No.") }}</th>
+ {% endif %}
+ <th style="width: 10%">{{ _("Future Payment Ref") }}</th>
+ <th style="width: 10%">{{ _("Future Payment Amount") }}</th>
+ <th style="width: 10%">{{ _("Remaining Balance") }}</th>
+ {% endif %}
+ {% else %}
+ <th style="width: 40%">
+ {% if (filters.customer or filters.supplier or filters.customer_name) %}
+ {{ _("Remarks")}}
+ {% else %}
+ {{ _("Party") }}
+ {% endif %}
+ </th>
+ <th style="width: 15%">{{ _("Total Invoiced Amount") }}</th>
+ <th style="width: 15%">{{ _("Total Paid Amount") }}</th>
+ <th style="width: 15%">
+ {% if report.report_name == "Accounts Receivable Summary" %}
+ {{ _('Credit Note Amount') }}
+ {% else %}
+ {{ _('Debit Note Amount') }}
+ {% endif %}
+ </th>
+ <th style="width: 15%">{{ _("Total Outstanding Amount") }}</th>
+ {% endif %}
+ </tr>
+ </thead>
+ <tbody>
+ {% for i in range(data|length) %}
+ <tr>
+ {% if(report.report_name == "Accounts Receivable" or report.report_name == "Accounts Payable") %}
+ {% if(data[i]["party"]) %}
+ <td>{{ (data[i]["posting_date"]) }}</td>
+ <td style="text-align: right">{{ data[i]["age"] }}</td>
+ <td>
+ {% if not(filters.show_future_payments) %}
+ {{ data[i]["voucher_type"] }}
+ <br>
+ {% endif %}
+ {{ data[i]["voucher_no"] }}
+ </td>
+
+ {% if(report.report_name == "Accounts Receivable" and filters.show_sales_person) %}
+ <td>{{ data[i]["sales_person"] }}</td>
+ {% endif %}
+
+ {% if not (filters.show_future_payments) %}
+ <td>
+ {% if(not(filters.customer or filters.supplier or filters.customer_name)) %}
+ {{ data[i]["party"] }}
+ {% if(data[i]["customer_name"] and data[i]["customer_name"] != data[i]["party"]) %}
+ <br> {{ data[i]["customer_name"] }}
+ {% elif(data[i]["supplier_name"] != data[i]["party"]) %}
+ <br> {{ data[i]["supplier_name"] }}
+ {% endif %}
+ {% endif %}
+ <div>
+ {% if data[i]["remarks"] %}
+ {{ _("Remarks") }}:
+ {{ data[i]["remarks"] }}
+ {% endif %}
+ </div>
+ </td>
+ {% endif %}
+
+ <td style="text-align: right">
+ {{ frappe.utils.fmt_money(data[i]["invoiced"], currency=data[i]["currency"]) }}</td>
+
+ {% if not(filters.show_future_payments) %}
+ <td style="text-align: right">
+ {{ frappe.utils.fmt_money(data[i]["paid"], currency=data[i]["currency"]) }}</td>
+ <td style="text-align: right">
+ {{ frappe.utils.fmt_money(data[i]["credit_note"], currency=data[i]["currency"]) }}</td>
+ {% endif %}
+ <td style="text-align: right">
+ {{ frappe.utils.fmt_money(data[i]["outstanding"], currency=data[i]["currency"]) }}</td>
+
+ {% if(filters.show_future_payments) %}
+ {% if(report.report_name == "Accounts Receivable") %}
+ <td style="text-align: right">
+ {{ data[i]["po_no"] }}</td>
+ {% endif %}
+ <td style="text-align: right">{{ data[i]["future_ref"] }}</td>
+ <td style="text-align: right">{{ frappe.utils.fmt_money(data[i]["future_amount"], currency=data[i]["currency"]) }}</td>
+ <td style="text-align: right">{{ frappe.utils.fmt_money(data[i]["remaining_balance"], currency=data[i]["currency"]) }}</td>
+ {% endif %}
+ {% else %}
+ <td></td>
+ {% if not(filters.show_future_payments) %}
+ <td></td>
+ {% endif %}
+ {% if(report.report_name == "Accounts Receivable" and filters.show_sales_person) %}
+ <td></td>
+ {% endif %}
+ <td></td>
+ <td style="text-align: right"><b>{{ _("Total") }}</b></td>
+ <td style="text-align: right">
+ {{ frappe.utils.fmt_money(data[i]["invoiced"], data[i]["currency"]) }}</td>
+
+ {% if not(filters.show_future_payments) %}
+ <td style="text-align: right">
+ {{ frappe.utils.fmt_money(data[i]["paid"], currency=data[i]["currency"]) }}</td>
+ <td style="text-align: right">{{ frappe.utils.fmt_money(data[i]["credit_note"], currency=data[i]["currency"]) }} </td>
+ {% endif %}
+ <td style="text-align: right">
+ {{ frappe.utils.fmt_money(data[i]["outstanding"], currency=data[i]["currency"]) }}</td>
+
+ {% if(filters.show_future_payments) %}
+ {% if(report.report_name == "Accounts Receivable") %}
+ <td style="text-align: right">
+ {{ data[i]["po_no"] }}</td>
+ {% endif %}
+ <td style="text-align: right">{{ data[i]["future_ref"] }}</td>
+ <td style="text-align: right">{{ frappe.utils.fmt_money(data[i]["future_amount"], currency=data[i]["currency"]) }}</td>
+ <td style="text-align: right">{{ frappe.utils.fmt_money(data[i]["remaining_balance"], currency=data[i]["currency"]) }}</td>
+ {% endif %}
+ {% endif %}
+ {% else %}
+ {% if(data[i]["party"] or " ") %}
+ {% if not(data[i]["is_total_row"]) %}
+ <td>
+ {% if(not(filters.customer | filters.supplier)) %}
+ {{ data[i]["party"] }}
+ {% if(data[i]["customer_name"] and data[i]["customer_name"] != data[i]["party"]) %}
+ <br> {{ data[i]["customer_name"] }}
+ {% elif(data[i]["supplier_name"] != data[i]["party"]) %}
+ <br> {{ data[i]["supplier_name"] }}
+ {% endif %}
+ {% endif %}
+ <br>{{ _("Remarks") }}:
+ {{ data[i]["remarks"] }}
+ </td>
+ {% else %}
+ <td><b>{{ _("Total") }}</b></td>
+ {% endif %}
+ <td style="text-align: right">{{ frappe.utils.fmt_money(data[i]["invoiced"], currency=data[i]["currency"]) }}</td>
+ <td style="text-align: right">{{ frappe.utils.fmt_money(data[i]["paid"], currency=data[i]["currency"]) }}</td>
+ <td style="text-align: right">{{ frappe.utils.fmt_money(data[i]["credit_note"], currency=data[i]["currency"]) }}</td>
+ <td style="text-align: right">{{ frappe.utils.fmt_money(data[i]["outstanding"], currency=data[i]["currency"]) }}</td>
+ {% endif %}
+ {% endif %}
+ </tr>
+ {% endfor %}
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td style="text-align: right"><b>{{ frappe.utils.fmt_money(data|sum(attribute="invoiced"), currency=data[0]["currency"]) }}</b></td>
+ <td style="text-align: right"><b>{{ frappe.utils.fmt_money(data|sum(attribute="paid"), currency=data[0]["currency"]) }}</b></td>
+ <td style="text-align: right"><b>{{ frappe.utils.fmt_money(data|sum(attribute="credit_note"), currency=data[0]["currency"]) }}</b></td>
+ <td style="text-align: right"><b>{{ frappe.utils.fmt_money(data|sum(attribute="outstanding"), currency=data[0]["currency"]) }}</b></td>
+ </tbody>
+ </table>
+ <br>
+ {% if ageing %}
+ <h4 class="text-center">{{ _("Ageing Report based on ") }} {{ ageing.ageing_based_on }}
+ {{ _("up to " ) }} {{ frappe.format(filters.report_date, 'Date')}}
+ </h4>
+ <table class="table table-bordered">
+ <thead>
+ <tr>
+ <th style="width: 25%">30 Days</th>
+ <th style="width: 25%">60 Days</th>
+ <th style="width: 25%">90 Days</th>
+ <th style="width: 25%">120 Days</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{ frappe.utils.fmt_money(ageing.range1, currency=data[0]["currency"]) }}</td>
+ <td>{{ frappe.utils.fmt_money(ageing.range2, currency=data[0]["currency"]) }}</td>
+ <td>{{ frappe.utils.fmt_money(ageing.range3, currency=data[0]["currency"]) }}</td>
+ <td>{{ frappe.utils.fmt_money(ageing.range4, currency=data[0]["currency"]) }}</td>
+ </tr>
+ </tbody>
+ </table>
+ {% endif %}
+ <p class="text-right text-muted">{{ _("Printed On ") }}{{ frappe.utils.now() }}</p>
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
index 07e1896..ed3b991 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
@@ -8,56 +8,51 @@
}
</style>
- <h2 class="text-center" style="margin-top:0">{{ _(report.report_name) }}</h2>
+ <h2 class="text-center" style="margin-top:0">{%= __(report.report_name) %}</h2>
<h4 class="text-center">
- {% if (filters.customer_name) %}
- {{ filters.customer_name }}
- {% else %}
- {{ filters.customer ~ filters.supplier }}
- {% endif %}
+ {% if (filters.customer_name) { %}
+ {%= filters.customer_name %}
+ {% } else { %}
+ {%= filters.customer || filters.supplier %}
+ {% } %}
</h4>
<h6 class="text-center">
- {% if (filters.tax_id) %}
- {{ _("Tax Id: ") }}{{ filters.tax_id }}
- {% endif %}
+ {% if (filters.tax_id) { %}
+ {%= __("Tax Id: ")%} {%= filters.tax_id %}
+ {% } %}
</h6>
<h5 class="text-center">
- {{ _(filters.ageing_based_on) }}
- {{ _("Until") }}
- {{ frappe.format(filters.report_date, 'Date') }}
+ {%= __(filters.ageing_based_on) %}
+ {%= __("Until") %}
+ {%= frappe.datetime.str_to_user(filters.report_date) %}
</h5>
<div class="clearfix">
<div class="pull-left">
- {% if(filters.payment_terms) %}
- <strong>{{ _("Payment Terms") }}:</strong> {{ filters.payment_terms }}
- {% endif %}
+ {% if(filters.payment_terms) { %}
+ <strong>{%= __("Payment Terms") %}:</strong> {%= filters.payment_terms %}
+ {% } %}
</div>
<div class="pull-right">
- {% if(filters.credit_limit) %}
- <strong>{{ _("Credit Limit") }}:</strong> {{ frappe.utils.fmt_money(filters.credit_limit) }}
- {% endif %}
+ {% if(filters.credit_limit) { %}
+ <strong>{%= __("Credit Limit") %}:</strong> {%= format_currency(filters.credit_limit) %}
+ {% } %}
</div>
</div>
- {% if(filters.show_future_payments) %}
- {% set balance_row = data.slice(-1).pop() %}
- {% for i in report.columns %}
- {% if i.fieldname == 'age' %}
- {% set elem = i %}
- {% endif %}
- {% endfor %}
- {% set start = report.columns.findIndex(elem) %}
- {% set range1 = report.columns[start].label %}
- {% set range2 = report.columns[start+1].label %}
- {% set range3 = report.columns[start+2].label %}
- {% set range4 = report.columns[start+3].label %}
- {% set range5 = report.columns[start+4].label %}
- {% set range6 = report.columns[start+5].label %}
-
- {% if(balance_row) %}
+ {% if(filters.show_future_payments) { %}
+ {% var balance_row = data.slice(-1).pop();
+ var start = report.columns.findIndex((elem) => (elem.fieldname == 'age'));
+ var range1 = report.columns[start].label;
+ var range2 = report.columns[start+1].label;
+ var range3 = report.columns[start+2].label;
+ var range4 = report.columns[start+3].label;
+ var range5 = report.columns[start+4].label;
+ var range6 = report.columns[start+5].label;
+ %}
+ {% if(balance_row) { %}
<table class="table table-bordered table-condensed">
- <caption class="text-right">(Amount in {{ data[0]["currency"] ~ "" }})</caption>
+ <caption class="text-right">(Amount in {%= data[0]["currency"] || "" %})</caption>
<colgroup>
<col style="width: 30mm;">
<col style="width: 18mm;">
@@ -71,42 +66,42 @@
<thead>
<tr>
- <th>{{ _(" ") }}</th>
- <th>{{ _(range1) }}</th>
- <th>{{ _(range2) }}</th>
- <th>{{ _(range3) }}</th>
- <th>{{ _(range4) }}</th>
- <th>{{ _(range5) }}</th>
- <th>{{ _(range6) }}</th>
- <th>{{ _("Total") }}</th>
+ <th>{%= __(" ") %}</th>
+ <th>{%= __(range1) %}</th>
+ <th>{%= __(range2) %}</th>
+ <th>{%= __(range3) %}</th>
+ <th>{%= __(range4) %}</th>
+ <th>{%= __(range5) %}</th>
+ <th>{%= __(range6) %}</th>
+ <th>{%= __("Total") %}</th>
</tr>
</thead>
<tbody>
<tr>
- <td>{{ _("Total Outstanding") }}</td>
+ <td>{%= __("Total Outstanding") %}</td>
<td class="text-right">
- {{ format_number(balance_row["age"], null, 2) }}
+ {%= format_number(balance_row["age"], null, 2) %}
</td>
<td class="text-right">
- {{ frappe.utils.fmt_money(balance_row["range1"], data[data.length-1]["currency"]) }}
+ {%= format_currency(balance_row["range1"], data[data.length-1]["currency"]) %}
</td>
<td class="text-right">
- {{ frappe.utils.fmt_money(balance_row["range2"], data[data.length-1]["currency"]) }}
+ {%= format_currency(balance_row["range2"], data[data.length-1]["currency"]) %}
</td>
<td class="text-right">
- {{ frappe.utils.fmt_money(balance_row["range3"], data[data.length-1]["currency"]) }}
+ {%= format_currency(balance_row["range3"], data[data.length-1]["currency"]) %}
</td>
<td class="text-right">
- {{ frappe.utils.fmt_money(balance_row["range4"], data[data.length-1]["currency"]) }}
+ {%= format_currency(balance_row["range4"], data[data.length-1]["currency"]) %}
</td>
<td class="text-right">
- {{ frappe.utils.fmt_money(balance_row["range5"], data[data.length-1]["currency"]) }}
+ {%= format_currency(balance_row["range5"], data[data.length-1]["currency"]) %}
</td>
<td class="text-right">
- {{ frappe.utils.fmt_money(flt(balance_row["outstanding"]), data[data.length-1]["currency"]) }}
+ {%= format_currency(flt(balance_row["outstanding"]), data[data.length-1]["currency"]) %}
</td>
</tr>
- <td>{{ _("Future Payments") }}</td>
+ <td>{%= __("Future Payments") %}</td>
<td></td>
<td></td>
<td></td>
@@ -114,10 +109,10 @@
<td></td>
<td></td>
<td class="text-right">
- {{ frappe.utils.fmt_money(flt(balance_row[("future_amount")]), data[data.length-1]["currency"]) }}
+ {%= format_currency(flt(balance_row[("future_amount")]), data[data.length-1]["currency"]) %}
</td>
<tr class="cvs-footer">
- <th class="text-left">{{ _("Cheques Required") }}</th>
+ <th class="text-left">{%= __("Cheques Required") %}</th>
<th></th>
<th></th>
<th></th>
@@ -125,224 +120,168 @@
<th></th>
<th></th>
<th class="text-right">
- {{ frappe.utils.fmt_money(flt(balance_row["outstanding"] - balance_row[("future_amount")]), data[data.length-1]["currency"]) }}</th>
+ {%= format_currency(flt(balance_row["outstanding"] - balance_row[("future_amount")]), data[data.length-1]["currency"]) %}</th>
</tr>
</tbody>
</table>
- {% endif %}
- {% endif %}
+ {% } %}
+ {% } %}
<table class="table table-bordered">
<thead>
<tr>
- {% if(report.report_name == "Accounts Receivable" or report.report_name == "Accounts Payable") %}
- <th style="width: 10%">{{ _("Date") }}</th>
- <th style="width: 4%">{{ _("Age (Days)") }}</th>
+ {% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %}
+ <th style="width: 10%">{%= __("Date") %}</th>
+ <th style="width: 4%">{%= __("Age (Days)") %}</th>
- {% if(report.report_name == "Accounts Receivable" and filters.show_sales_person) %}
- <th style="width: 14%">{{ _("Reference") }}</th>
- <th style="width: 10%">{{ _("Sales Person") }}</th>
- {% else %}
- <th style="width: 24%">{{ _("Reference") }}</th>
- {% endif %}
- {% if not(filters.show_future_payments) %}
- <th style="width: 20%">
- {% if (filters.customer or filters.supplier or filters.customer_name) %}
- {{ _("Remarks") }}
- {% else %}
- {{ _("Party") }}
- {% endif %}
- </th>
- {% endif %}
- <th style="width: 10%; text-align: right">{{ _("Invoiced Amount") }}</th>
- {% if not(filters.show_future_payments) %}
- <th style="width: 10%; text-align: right">{{ _("Paid Amount") }}</th>
- <th style="width: 10%; text-align: right">
- {% if report.report_name == "Accounts Receivable" %}
- {{ _('Credit Note') }}
- {% else %}
- {{ _('Debit Note') }}
- {% endif %}
- </th>
- {% endif %}
- <th style="width: 10%; text-align: right">{{ _("Outstanding Amount") }}</th>
- {% if(filters.show_future_payments) %}
- {% if(report.report_name == "Accounts Receivable") %}
- <th style="width: 12%">{{ _("Customer LPO No.") }}</th>
- {% endif %}
- <th style="width: 10%">{{ _("Future Payment Ref") }}</th>
- <th style="width: 10%">{{ _("Future Payment Amount") }}</th>
- <th style="width: 10%">{{ _("Remaining Balance") }}</th>
- {% endif %}
- {% else %}
- <th style="width: 40%">
- {% if (filters.customer or filters.supplier or filters.customer_name) %}
- {{ _("Remarks")}}
- {% else %}
- {{ _("Party") }}
- {% endif %}
- </th>
- <th style="width: 15%">{{ _("Total Invoiced Amount") }}</th>
- <th style="width: 15%">{{ _("Total Paid Amount") }}</th>
- <th style="width: 15%">
- {% if report.report_name == "Accounts Receivable Summary" %}
- {{ _('Credit Note Amount') }}
- {% else %}
- {{ _('Debit Note Amount') }}
- {% endif %}
- </th>
- <th style="width: 15%">{{ _("Total Outstanding Amount") }}</th>
- {% endif %}
+ {% if(report.report_name === "Accounts Receivable" && filters.show_sales_person) { %}
+ <th style="width: 14%">{%= __("Reference") %}</th>
+ <th style="width: 10%">{%= __("Sales Person") %}</th>
+ {% } else { %}
+ <th style="width: 24%">{%= __("Reference") %}</th>
+ {% } %}
+ {% if(!filters.show_future_payments) { %}
+ <th style="width: 20%">{%= (filters.customer || filters.supplier) ? __("Remarks"): __("Party") %}</th>
+ {% } %}
+ <th style="width: 10%; text-align: right">{%= __("Invoiced Amount") %}</th>
+ {% if(!filters.show_future_payments) { %}
+ <th style="width: 10%; text-align: right">{%= __("Paid Amount") %}</th>
+ <th style="width: 10%; text-align: right">{%= report.report_name === "Accounts Receivable" ? __('Credit Note') : __('Debit Note') %}</th>
+ {% } %}
+ <th style="width: 10%; text-align: right">{%= __("Outstanding Amount") %}</th>
+ {% if(filters.show_future_payments) { %}
+ {% if(report.report_name === "Accounts Receivable") { %}
+ <th style="width: 12%">{%= __("Customer LPO No.") %}</th>
+ {% } %}
+ <th style="width: 10%">{%= __("Future Payment Ref") %}</th>
+ <th style="width: 10%">{%= __("Future Payment Amount") %}</th>
+ <th style="width: 10%">{%= __("Remaining Balance") %}</th>
+ {% } %}
+ {% } else { %}
+ <th style="width: 40%">{%= (filters.customer || filters.supplier) ? __("Remarks"): __("Party") %}</th>
+ <th style="width: 15%">{%= __("Total Invoiced Amount") %}</th>
+ <th style="width: 15%">{%= __("Total Paid Amount") %}</th>
+ <th style="width: 15%">{%= report.report_name === "Accounts Receivable Summary" ? __('Credit Note Amount') : __('Debit Note Amount') %}</th>
+ <th style="width: 15%">{%= __("Total Outstanding Amount") %}</th>
+ {% } %}
</tr>
</thead>
<tbody>
- {% for i in range(data|length) %}
+ {% for(var i=0, l=data.length; i<l; i++) { %}
<tr>
- {% if(report.report_name == "Accounts Receivable" or report.report_name == "Accounts Payable") %}
- {% if(data[i]["party"]) %}
- <td>{{ (data[i]["posting_date"]) }}</td>
- <td style="text-align: right">{{ data[i]["age"] }}</td>
+ {% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %}
+ {% if(data[i]["party"]) { %}
+ <td>{%= frappe.datetime.str_to_user(data[i]["posting_date"]) %}</td>
+ <td style="text-align: right">{%= data[i]["age"] %}</td>
<td>
- {% if not(filters.show_future_payments) %}
- {{ data[i]["voucher_type"] }}
+ {% if(!filters.show_future_payments) { %}
+ {%= data[i]["voucher_type"] %}
<br>
- {% endif %}
- {{ data[i]["voucher_no"] }}
+ {% } %}
+ {%= data[i]["voucher_no"] %}
</td>
- {% if(report.report_name == "Accounts Receivable" and filters.show_sales_person) %}
- <td>{{ data[i]["sales_person"] }}</td>
- {% endif %}
+ {% if(report.report_name === "Accounts Receivable" && filters.show_sales_person) { %}
+ <td>{%= data[i]["sales_person"] %}</td>
+ {% } %}
- {% if not (filters.show_future_payments) %}
+ {% if(!filters.show_future_payments) { %}
<td>
- {% if(not(filters.customer or filters.supplier or filters.customer_name)) %}
- {{ data[i]["party"] }}
- {% if(data[i]["customer_name"] and data[i]["customer_name"] != data[i]["party"]) %}
- <br> {{ data[i]["customer_name"] }}
- {% elif(data[i]["supplier_name"] != data[i]["party"]) %}
- <br> {{ data[i]["supplier_name"] }}
- {% endif %}
- {% endif %}
+ {% if(!(filters.customer || filters.supplier)) { %}
+ {%= data[i]["party"] %}
+ {% if(data[i]["customer_name"] && data[i]["customer_name"] != data[i]["party"]) { %}
+ <br> {%= data[i]["customer_name"] %}
+ {% } else if(data[i]["supplier_name"] != data[i]["party"]) { %}
+ <br> {%= data[i]["supplier_name"] %}
+ {% } %}
+ {% } %}
<div>
{% if data[i]["remarks"] %}
- {{ _("Remarks") }}:
- {{ data[i]["remarks"] }}
- {% endif %}
+ {%= __("Remarks") %}:
+ {%= data[i]["remarks"] %}
+ {% } %}
</div>
</td>
- {% endif %}
+ {% } %}
<td style="text-align: right">
- {{ frappe.utils.fmt_money(data[i]["invoiced"], currency=data[i]["currency"]) }}</td>
+ {%= format_currency(data[i]["invoiced"], data[i]["currency"]) %}</td>
- {% if not(filters.show_future_payments) %}
+ {% if(!filters.show_future_payments) { %}
<td style="text-align: right">
- {{ frappe.utils.fmt_money(data[i]["paid"], currency=data[i]["currency"]) }}</td>
+ {%= format_currency(data[i]["paid"], data[i]["currency"]) %}</td>
<td style="text-align: right">
- {{ frappe.utils.fmt_money(data[i]["credit_note"], currency=data[i]["currency"]) }}</td>
- {% endif %}
+ {%= format_currency(data[i]["credit_note"], data[i]["currency"]) %}</td>
+ {% } %}
<td style="text-align: right">
- {{ frappe.utils.fmt_money(data[i]["outstanding"], currency=data[i]["currency"]) }}</td>
+ {%= format_currency(data[i]["outstanding"], data[i]["currency"]) %}</td>
- {% if(filters.show_future_payments) %}
- {% if(report.report_name == "Accounts Receivable") %}
+ {% if(filters.show_future_payments) { %}
+ {% if(report.report_name === "Accounts Receivable") { %}
<td style="text-align: right">
- {{ data[i]["po_no"] }}</td>
- {% endif %}
- <td style="text-align: right">{{ data[i]["future_ref"] }}</td>
- <td style="text-align: right">{{ frappe.utils.fmt_money(data[i]["future_amount"], currency=data[i]["currency"]) }}</td>
- <td style="text-align: right">{{ frappe.utils.fmt_money(data[i]["remaining_balance"], currency=data[i]["currency"]) }}</td>
- {% endif %}
- {% else %}
+ {%= data[i]["po_no"] %}</td>
+ {% } %}
+ <td style="text-align: right">{%= data[i]["future_ref"] %}</td>
+ <td style="text-align: right">{%= format_currency(data[i]["future_amount"], data[i]["currency"]) %}</td>
+ <td style="text-align: right">{%= format_currency(data[i]["remaining_balance"], data[i]["currency"]) %}</td>
+ {% } %}
+ {% } else { %}
<td></td>
- {% if not(filters.show_future_payments) %}
+ {% if(!filters.show_future_payments) { %}
<td></td>
- {% endif %}
- {% if(report.report_name == "Accounts Receivable" and filters.show_sales_person) %}
+ {% } %}
+ {% if(report.report_name === "Accounts Receivable" && filters.show_sales_person) { %}
<td></td>
- {% endif %}
+ {% } %}
<td></td>
- <td style="text-align: right"><b>{{ _("Total") }}</b></td>
+ <td style="text-align: right"><b>{%= __("Total") %}</b></td>
<td style="text-align: right">
- {{ frappe.utils.fmt_money(data[i]["invoiced"], data[i]["currency"]) }}</td>
+ {%= format_currency(data[i]["invoiced"], data[i]["currency"] ) %}</td>
- {% if not(filters.show_future_payments) %}
+ {% if(!filters.show_future_payments) { %}
<td style="text-align: right">
- {{ frappe.utils.fmt_money(data[i]["paid"], currency=data[i]["currency"]) }}</td>
- <td style="text-align: right">{{ frappe.utils.fmt_money(data[i]["credit_note"], currency=data[i]["currency"]) }} </td>
- {% endif %}
+ {%= format_currency(data[i]["paid"], data[i]["currency"]) %}</td>
+ <td style="text-align: right">{%= format_currency(data[i]["credit_note"], data[i]["currency"]) %} </td>
+ {% } %}
<td style="text-align: right">
- {{ frappe.utils.fmt_money(data[i]["outstanding"], currency=data[i]["currency"]) }}</td>
+ {%= format_currency(data[i]["outstanding"], data[i]["currency"]) %}</td>
- {% if(filters.show_future_payments) %}
- {% if(report.report_name == "Accounts Receivable") %}
+ {% if(filters.show_future_payments) { %}
+ {% if(report.report_name === "Accounts Receivable") { %}
<td style="text-align: right">
- {{ data[i]["po_no"] }}</td>
- {% endif %}
- <td style="text-align: right">{{ data[i]["future_ref"] }}</td>
- <td style="text-align: right">{{ frappe.utils.fmt_money(data[i]["future_amount"], currency=data[i]["currency"]) }}</td>
- <td style="text-align: right">{{ frappe.utils.fmt_money(data[i]["remaining_balance"], currency=data[i]["currency"]) }}</td>
- {% endif %}
- {% endif %}
- {% else %}
- {% if(data[i]["party"] or " ") %}
- {% if not(data[i]["is_total_row"]) %}
+ {%= data[i]["po_no"] %}</td>
+ {% } %}
+ <td style="text-align: right">{%= data[i]["future_ref"] %}</td>
+ <td style="text-align: right">{%= format_currency(data[i]["future_amount"], data[i]["currency"]) %}</td>
+ <td style="text-align: right">{%= format_currency(data[i]["remaining_balance"], data[i]["currency"]) %}</td>
+ {% } %}
+ {% } %}
+ {% } else { %}
+ {% if(data[i]["party"]|| " ") { %}
+ {% if(!data[i]["is_total_row"]) { %}
<td>
- {% if(not(filters.customer | filters.supplier)) %}
- {{ data[i]["party"] }}
- {% if(data[i]["customer_name"] and data[i]["customer_name"] != data[i]["party"]) %}
- <br> {{ data[i]["customer_name"] }}
- {% elif(data[i]["supplier_name"] != data[i]["party"]) %}
- <br> {{ data[i]["supplier_name"] }}
- {% endif %}
- {% endif %}
- <br>{{ _("Remarks") }}:
- {{ data[i]["remarks"] }}
+ {% if(!(filters.customer || filters.supplier)) { %}
+ {%= data[i]["party"] %}
+ {% if(data[i]["customer_name"] && data[i]["customer_name"] != data[i]["party"]) { %}
+ <br> {%= data[i]["customer_name"] %}
+ {% } else if(data[i]["supplier_name"] != data[i]["party"]) { %}
+ <br> {%= data[i]["supplier_name"] %}
+ {% } %}
+ {% } %}
+ <br>{%= __("Remarks") %}:
+ {%= data[i]["remarks"] %}
</td>
- {% else %}
- <td><b>{{ _("Total") }}</b></td>
- {% endif %}
- <td style="text-align: right">{{ frappe.utils.fmt_money(data[i]["invoiced"], currency=data[i]["currency"]) }}</td>
- <td style="text-align: right">{{ frappe.utils.fmt_money(data[i]["paid"], currency=data[i]["currency"]) }}</td>
- <td style="text-align: right">{{ frappe.utils.fmt_money(data[i]["credit_note"], currency=data[i]["currency"]) }}</td>
- <td style="text-align: right">{{ frappe.utils.fmt_money(data[i]["outstanding"], currency=data[i]["currency"]) }}</td>
- {% endif %}
- {% endif %}
+ {% } else { %}
+ <td><b>{%= __("Total") %}</b></td>
+ {% } %}
+ <td style="text-align: right">{%= format_currency(data[i]["invoiced"], data[i]["currency"]) %}</td>
+ <td style="text-align: right">{%= format_currency(data[i]["paid"], data[i]["currency"]) %}</td>
+ <td style="text-align: right">{%= format_currency(data[i]["credit_note"], data[i]["currency"]) %}</td>
+ <td style="text-align: right">{%= format_currency(data[i]["outstanding"], data[i]["currency"]) %}</td>
+ {% } %}
+ {% } %}
</tr>
- {% endfor %}
- <td></td>
- <td></td>
- <td></td>
- <td></td>
- <td style="text-align: right"><b>{{ frappe.utils.fmt_money(data|sum(attribute="invoiced"), currency=data[0]["currency"]) }}</b></td>
- <td style="text-align: right"><b>{{ frappe.utils.fmt_money(data|sum(attribute="paid"), currency=data[0]["currency"]) }}</b></td>
- <td style="text-align: right"><b>{{ frappe.utils.fmt_money(data|sum(attribute="credit_note"), currency=data[0]["currency"]) }}</b></td>
- <td style="text-align: right"><b>{{ frappe.utils.fmt_money(data|sum(attribute="outstanding"), currency=data[0]["currency"]) }}</b></td>
+ {% } %}
</tbody>
</table>
- <br>
- {% if ageing %}
- <h4 class="text-center">{{ _("Ageing Report based on ") }} {{ ageing.ageing_based_on }}
- {{ _("up to " ) }} {{ frappe.format(filters.report_date, 'Date')}}
- </h4>
- <table class="table table-bordered">
- <thead>
- <tr>
- <th style="width: 25%">30 Days</th>
- <th style="width: 25%">60 Days</th>
- <th style="width: 25%">90 Days</th>
- <th style="width: 25%">120 Days</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>{{ frappe.utils.fmt_money(ageing.range1, currency=data[0]["currency"]) }}</td>
- <td>{{ frappe.utils.fmt_money(ageing.range2, currency=data[0]["currency"]) }}</td>
- <td>{{ frappe.utils.fmt_money(ageing.range3, currency=data[0]["currency"]) }}</td>
- <td>{{ frappe.utils.fmt_money(ageing.range4, currency=data[0]["currency"]) }}</td>
- </tr>
- </tbody>
- </table>
- {% endif %}
- <p class="text-right text-muted">{{ _("Printed On ") }}{{ frappe.utils.now() }}</p>
+ <p class="text-right text-muted">{{ __("Printed On ") }}{%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %}</p>
\ No newline at end of file
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 18bd10f..8c0fa6b 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -339,3 +339,4 @@
execute:frappe.delete_doc('DocType', 'Cash Flow Mapping Template', ignore_missing=True)
execute:frappe.delete_doc('DocType', 'Cash Flow Mapping Accounts', ignore_missing=True)
erpnext.patches.v14_0.cleanup_workspaces
+erpnext.patches.v14_0.set_report_in_process_SOA
diff --git a/erpnext/patches/v14_0/set_report_in_process_SOA.py b/erpnext/patches/v14_0/set_report_in_process_SOA.py
new file mode 100644
index 0000000..1cb7e41
--- /dev/null
+++ b/erpnext/patches/v14_0/set_report_in_process_SOA.py
@@ -0,0 +1,10 @@
+# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
+# License: MIT. See LICENSE
+
+import frappe
+
+
+def execute():
+ process_soa = frappe.qb.DocType("Process Statement of Accounts")
+ q = frappe.qb.update(process_soa).set(process_soa.report, "General Ledger")
+ q.run()