[fix] currecny symbol for customer's total annual billing, total unpaid amount
This commit is contained in:
parent
12a396ef25
commit
c857f37f3a
@ -112,9 +112,9 @@ $.extend(erpnext.utils, {
|
|||||||
if(frm.doc.__onload && frm.doc.__onload.dashboard_info) {
|
if(frm.doc.__onload && frm.doc.__onload.dashboard_info) {
|
||||||
var info = frm.doc.__onload.dashboard_info;
|
var info = frm.doc.__onload.dashboard_info;
|
||||||
frm.dashboard.add_indicator(__('Annual Billing: {0}',
|
frm.dashboard.add_indicator(__('Annual Billing: {0}',
|
||||||
[format_currency(info.billing_this_year, frm.doc.default_currency)]), 'blue');
|
[format_currency(info.billing_this_year, info.currency)]), 'blue');
|
||||||
frm.dashboard.add_indicator(__('Total Unpaid: {0}',
|
frm.dashboard.add_indicator(__('Total Unpaid: {0}',
|
||||||
[format_currency(info.total_unpaid, frm.doc.default_currency)]),
|
[format_currency(info.total_unpaid, info.currency)]),
|
||||||
info.total_unpaid ? 'orange' : 'green');
|
info.total_unpaid ? 'orange' : 'green');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -12,6 +12,7 @@ from erpnext.utilities.transaction_base import TransactionBase
|
|||||||
from erpnext.utilities.address_and_contact import load_address_and_contact
|
from erpnext.utilities.address_and_contact import load_address_and_contact
|
||||||
from erpnext.accounts.party import validate_party_accounts, get_timeline_data # keep this
|
from erpnext.accounts.party import validate_party_accounts, get_timeline_data # keep this
|
||||||
from erpnext.accounts.party_status import get_party_status
|
from erpnext.accounts.party_status import get_party_status
|
||||||
|
from erpnext import get_default_currency
|
||||||
|
|
||||||
class Customer(TransactionBase):
|
class Customer(TransactionBase):
|
||||||
def get_feed(self):
|
def get_feed(self):
|
||||||
@ -24,7 +25,7 @@ class Customer(TransactionBase):
|
|||||||
|
|
||||||
def load_dashboard_info(self):
|
def load_dashboard_info(self):
|
||||||
billing_this_year = frappe.db.sql("""
|
billing_this_year = frappe.db.sql("""
|
||||||
select sum(debit_in_account_currency) - sum(credit_in_account_currency)
|
select sum(debit_in_account_currency) - sum(credit_in_account_currency), account_currency
|
||||||
from `tabGL Entry`
|
from `tabGL Entry`
|
||||||
where voucher_type='Sales Invoice' and party_type = 'Customer'
|
where voucher_type='Sales Invoice' and party_type = 'Customer'
|
||||||
and party=%s and fiscal_year = %s""",
|
and party=%s and fiscal_year = %s""",
|
||||||
@ -36,6 +37,7 @@ class Customer(TransactionBase):
|
|||||||
|
|
||||||
info = {}
|
info = {}
|
||||||
info["billing_this_year"] = billing_this_year[0][0] if billing_this_year else 0
|
info["billing_this_year"] = billing_this_year[0][0] if billing_this_year else 0
|
||||||
|
info["currency"] = billing_this_year[0][1] if billing_this_year else get_default_currency()
|
||||||
info["total_unpaid"] = total_unpaid[0][0] if total_unpaid else 0
|
info["total_unpaid"] = total_unpaid[0][0] if total_unpaid else 0
|
||||||
|
|
||||||
self.set_onload('dashboard_info', info)
|
self.set_onload('dashboard_info', info)
|
||||||
|
Loading…
Reference in New Issue
Block a user