minor changes in dashboard
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index 7c12ece..4620733 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -464,25 +464,25 @@
companies = frappe.db.sql("""
select distinct company from `tab{0}`
- where docstatus =1 and {1} = %s
- """.format(doctype, party_type.lower()), (party), as_dict=1)
+ where docstatus =1 and {1} = %s"""
+ .format(doctype, party_type.lower()), (party), as_dict=1)
company_wise_info = []
company_wise_grand_total = frappe._dict(frappe.db.sql("""
- select company, sum(grand_total)
- from `tab{0}`
- where {1}=%s and docstatus=1 and posting_date between %s and %s
- group by company
- """.format(doctype, party_type.lower()),
+ select company, sum(grand_total)
+ from `tab{0}`
+ where {1}=%s and docstatus=1 and posting_date between %s and %s
+ group by company"""
+ .format(doctype, party_type.lower()),
(party, current_fiscal_year.year_start_date, current_fiscal_year.year_end_date)))
company_wise_base_grand_total = frappe._dict(frappe.db.sql("""
- select company, sum(base_grand_total)
- from `tab{0}`
- where {1}=%s and docstatus=1 and posting_date between %s and %s
- group by company
- """.format(doctype, party_type.lower()),
+ select company, sum(base_grand_total)
+ from `tab{0}`
+ where {1}=%s and docstatus=1 and posting_date between %s and %s
+ group by company"""
+ .format(doctype, party_type.lower()),
(party, current_fiscal_year.year_start_date, current_fiscal_year.year_end_date)))
company_wise_total_unpaid = frappe._dict(frappe.db.sql("""
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 6d7b167..b80f8ac 100644
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -104,16 +104,21 @@
set_party_dashboard_indicators: function(frm) {
if(frm.doc.__onload && frm.doc.__onload.dashboard_info) {
var company_wise_info = frm.doc.__onload.dashboard_info;
- frm.dashboard.add_indicator(__('Company'), '', 4);
- frm.dashboard.add_indicator(__('Annual Billing'), '', 4);
- frm.dashboard.add_indicator(__('Total Unpaid'), '', 4);
- company_wise_info.forEach(function(info){
- frm.dashboard.add_indicator(__('{0}',[info.company]), '', 4);
- frm.dashboard.add_indicator(__('{0}',
- [format_currency(info.billing_this_year, info.currency)]), '', 4);
- frm.dashboard.add_indicator(__('{0}',
- [format_currency(info.total_unpaid, info.currency)]), '', 4);
- });
+ if(company_wise_info[0]) {
+ frm.dashboard.stats_area.removeClass('hidden');
+ frm.dashboard.stats_area_row.append(
+ '<div class="col-xs-4"><h6>Company</h6></div>'+
+ '</div><div class="col-xs-4"><h6>Annual Billing</h6></div>' +
+ '<div class="col-xs-4"><h6>Total Unpaid</h6></div>'
+ );
+ company_wise_info.forEach(function(info) {
+ frm.dashboard.stats_area_row.append(
+ '<div class="col-xs-4 small" style="margin-bottom:10px">'+info.company+'</div>' +
+ '</div><div class="col-xs-4 small" style="margin-bottom:10px"><span class="indicator blue">'+format_currency(info.billing_this_year, info.currency)+'</span></div>' +
+ '<div class="col-xs-4 small" style="margin-bottom:10px"><span class="indicator orange">'+format_currency(info.billing_this_year, info.currency)+'</span></div>'
+ );
+ });
+ }
}
},