Skip to content

Commit

Permalink
Merge 4fb228a into 1728589
Browse files Browse the repository at this point in the history
  • Loading branch information
Alchez committed Sep 8, 2020
2 parents 1728589 + 4fb228a commit b672939
Show file tree
Hide file tree
Showing 41 changed files with 929 additions and 487 deletions.
3 changes: 2 additions & 1 deletion erpnext/accounts/report/general_ledger/general_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def execute(filters=None):

validate_filters(filters, account_details)

validate_party(filters)
if filters.get('party_type'):
validate_party(filters)

filters = set_account_currency(filters)

Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<h2 class="text-center">{%= __("Statement of Account") %}</h2>
<h4 class="text-center">
{% if (filters.party_name) { %}
{%= filters.party_name %}
{% } else if (filters.party && filters.party.length) { %}
{%= filters.party %}
{% } else if (filters.account) { %}
{%= filters.account %}
{% } %}
</h4>

<h6 class="text-center">
{% if (filters.tax_id) { %}
{%= __("Tax Id: ")%} {%= filters.tax_id %}
{% } %}
</h6>

<h5 class="text-center">
{%= frappe.datetime.str_to_user(filters.from_date) %}
{%= __("to") %}
{%= frappe.datetime.str_to_user(filters.to_date) %}
</h5>
<hr>
<table class="table table-bordered">
<thead>
<tr>
<th style="width: 12%">{%= __("Date") %}</th>
<th style="width: 15%">{%= __("Description") %}</th>
<th style="width: 15%">{%= __("Invoice") %}</th>
<th style="width: 15%">{%= __("Payment/Credit") %}</th>
<th style="width: 18%">{%= __("Balance (Dr - Cr)") %}</th>
</tr>
</thead>
<tbody>
{% for(var i=0, l=data.length; i<l; i++) { %}
<tr>
{% if(data[i].posting_date) { %}
<td>{%= frappe.datetime.str_to_user(data[i].posting_date) %}</td>
<td>{%= data[i].voucher_type %}
<br>{%= data[i].voucher_no %}</td>
<td style="text-align: right">
{%= format_currency(data[i].debit, filters.presentation_currency) %}</td>
<td style="text-align: right">
{%= format_currency(data[i].credit, filters.presentation_currency) %}</td>
{% } else { %}
<td></td>
<td><b>{%= frappe.format(data[i].account, {fieldtype: "Link"}) || "&nbsp;" %}</b></td>
<td style="text-align: right">
{%= data[i].account && format_currency(data[i].debit, filters.presentation_currency) %}
</td>
<td style="text-align: right">
{%= data[i].account && format_currency(data[i].credit, filters.presentation_currency) %}
</td>
{% } %}
<td style="text-align: right">
{%= format_currency(data[i].balance, filters.presentation_currency) %}
</td>
</tr>
{% } %}
</tbody>
</table>
<p class="text-right text-muted">Printed On {%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %}</p>
105 changes: 105 additions & 0 deletions erpnext/accounts/report/statement_of_account/statement_of_account.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
/* eslint-disable */

frappe.query_reports["Statement of Account"] = {
"filters": [
{
"fieldname":"company",
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
"default": frappe.defaults.get_user_default("Company"),
"reqd": 1
},
{
"fieldname":"finance_book",
"label": __("Finance Book"),
"fieldtype": "Link",
"options": "Finance Book"
},
{
"fieldname":"from_date",
"label": __("From Date"),
"fieldtype": "Date",
"default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
"reqd": 1,
"width": "60px"
},
{
"fieldname":"to_date",
"label": __("To Date"),
"fieldtype": "Date",
"default": frappe.datetime.get_today(),
"reqd": 1,
"width": "60px"
},
{
"fieldname":"account",
"label": __("Account"),
"fieldtype": "Link",
"options": "Account",
"get_query": function() {
var company = frappe.query_report.get_filter_value('company');
return {
"doctype": "Account",
"filters": {
"company": company,
}
}
}
},
{
"fieldtype": "Break",
},
{
"fieldname":"party_type",
"label": __("Party Type"),
"fieldtype": "Link",
"options": "Party Type",
"default": "",
on_change: function() {
frappe.query_report.set_filter_value('party', "");
}
},
{
"fieldname":"party",
"label": __("Party"),
"fieldtype": "MultiSelectList",
get_data: function(txt) {
if (!frappe.query_report.filters) {
return true;
}
let party_type = frappe.query_report.get_filter_value('party_type');
if (!party_type) {
return true;
}

return frappe.db.get_link_options(party_type, txt);
},
on_change: function() {
var party_type = frappe.query_report.get_filter_value('party_type');
var parties = frappe.query_report.get_filter_value('party');

if(!party_type || parties.length === 0 || parties.length > 1) {
frappe.query_report.set_filter_value('party_name', "");
return;
} else {
var party = parties[0];
var fieldname = erpnext.utils.get_party_name(party_type) || "name";
frappe.db.get_value(party_type, party, fieldname, function(value) {
frappe.query_report.set_filter_value('party_name', value[fieldname]);
});
}
}
},
{
"fieldname":"party_name",
"label": __("Party Name"),
"fieldtype": "Data",
"hidden": 1
},
]
};

erpnext.utils.add_dimensions('Statement of Account', 15)
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"add_total_row": 0,
"creation": "2020-08-18 02:02:09.794045",
"disable_prepared_report": 0,
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 0,
"is_standard": "Yes",
"modified": "2020-08-19 08:16:14.432529",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Statement of Account",
"owner": "Administrator",
"prepared_report": 0,
"ref_doctype": "Sales Invoice",
"report_name": "Statement of Account",
"report_type": "Script Report",
"roles": [
{
"role": "Accounts User"
},
{
"role": "Accounts Manager"
},
{
"role": "Fulfillment User"
}
]
}
Loading

0 comments on commit b672939

Please sign in to comment.