minor changes in dashboard
This commit is contained in:
parent
0e8c36473a
commit
a1cffc3490
@ -464,25 +464,25 @@ def get_dashboard_info(party_type, party):
|
|||||||
|
|
||||||
companies = frappe.db.sql("""
|
companies = frappe.db.sql("""
|
||||||
select distinct company from `tab{0}`
|
select distinct company from `tab{0}`
|
||||||
where docstatus =1 and {1} = %s
|
where docstatus =1 and {1} = %s"""
|
||||||
""".format(doctype, party_type.lower()), (party), as_dict=1)
|
.format(doctype, party_type.lower()), (party), as_dict=1)
|
||||||
|
|
||||||
company_wise_info = []
|
company_wise_info = []
|
||||||
|
|
||||||
company_wise_grand_total = frappe._dict(frappe.db.sql("""
|
company_wise_grand_total = frappe._dict(frappe.db.sql("""
|
||||||
select company, sum(grand_total)
|
select company, sum(grand_total)
|
||||||
from `tab{0}`
|
from `tab{0}`
|
||||||
where {1}=%s and docstatus=1 and posting_date between %s and %s
|
where {1}=%s and docstatus=1 and posting_date between %s and %s
|
||||||
group by company
|
group by company"""
|
||||||
""".format(doctype, party_type.lower()),
|
.format(doctype, party_type.lower()),
|
||||||
(party, current_fiscal_year.year_start_date, current_fiscal_year.year_end_date)))
|
(party, current_fiscal_year.year_start_date, current_fiscal_year.year_end_date)))
|
||||||
|
|
||||||
company_wise_base_grand_total = frappe._dict(frappe.db.sql("""
|
company_wise_base_grand_total = frappe._dict(frappe.db.sql("""
|
||||||
select company, sum(base_grand_total)
|
select company, sum(base_grand_total)
|
||||||
from `tab{0}`
|
from `tab{0}`
|
||||||
where {1}=%s and docstatus=1 and posting_date between %s and %s
|
where {1}=%s and docstatus=1 and posting_date between %s and %s
|
||||||
group by company
|
group by company"""
|
||||||
""".format(doctype, party_type.lower()),
|
.format(doctype, party_type.lower()),
|
||||||
(party, current_fiscal_year.year_start_date, current_fiscal_year.year_end_date)))
|
(party, current_fiscal_year.year_start_date, current_fiscal_year.year_end_date)))
|
||||||
|
|
||||||
company_wise_total_unpaid = frappe._dict(frappe.db.sql("""
|
company_wise_total_unpaid = frappe._dict(frappe.db.sql("""
|
||||||
|
|||||||
@ -104,16 +104,21 @@ $.extend(erpnext.utils, {
|
|||||||
set_party_dashboard_indicators: function(frm) {
|
set_party_dashboard_indicators: function(frm) {
|
||||||
if(frm.doc.__onload && frm.doc.__onload.dashboard_info) {
|
if(frm.doc.__onload && frm.doc.__onload.dashboard_info) {
|
||||||
var company_wise_info = frm.doc.__onload.dashboard_info;
|
var company_wise_info = frm.doc.__onload.dashboard_info;
|
||||||
frm.dashboard.add_indicator(__('Company'), '', 4);
|
if(company_wise_info[0]) {
|
||||||
frm.dashboard.add_indicator(__('Annual Billing'), '', 4);
|
frm.dashboard.stats_area.removeClass('hidden');
|
||||||
frm.dashboard.add_indicator(__('Total Unpaid'), '', 4);
|
frm.dashboard.stats_area_row.append(
|
||||||
company_wise_info.forEach(function(info){
|
'<div class="col-xs-4"><h6>Company</h6></div>'+
|
||||||
frm.dashboard.add_indicator(__('{0}',[info.company]), '', 4);
|
'</div><div class="col-xs-4"><h6>Annual Billing</h6></div>' +
|
||||||
frm.dashboard.add_indicator(__('{0}',
|
'<div class="col-xs-4"><h6>Total Unpaid</h6></div>'
|
||||||
[format_currency(info.billing_this_year, info.currency)]), '', 4);
|
);
|
||||||
frm.dashboard.add_indicator(__('{0}',
|
company_wise_info.forEach(function(info) {
|
||||||
[format_currency(info.total_unpaid, info.currency)]), '', 4);
|
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>'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user