Merge branch 'nabinhait-mc3' into develop

This commit is contained in:
Anand Doshi 2015-09-17 14:43:58 +05:30
commit 8c1a4c0c48
6 changed files with 943 additions and 948 deletions

View File

@ -39,16 +39,12 @@ cur_frm.cscript.make_dashboard = function(doc) {
},
callback: function(r) {
if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager")) {
if(r.message["company_currency"].length == 1) {
cur_frm.dashboard.set_headline(
__("Total Billing This Year: ") + "<b>"
+ format_currency(r.message.billing_this_year, r.message.company_currency[0])
+ '</b> / <span class="text-muted">' + __("Total Unpaid") + ": <b>"
+ format_currency(r.message.total_unpaid, r.message.company_currency[0])
+ '</b></span>');
} else {
cur_frm.dashboard.set_headline("");
}
cur_frm.dashboard.set_headline(
__("Total Billing This Year: ") + "<b>"
+ format_currency(r.message.billing_this_year, cur_frm.doc.party_account_currency)
+ '</b> / <span class="text-muted">' + __("Total Unpaid") + ": <b>"
+ format_currency(r.message.total_unpaid, cur_frm.doc.party_account_currency)
+ '</b></span>');
}
cur_frm.dashboard.set_badge_count(r.message);
}

View File

@ -178,7 +178,7 @@
"ignore_user_permissions": 1,
"in_filter": 0,
"in_list_view": 0,
"label": "Default Currency",
"label": "Billing Currency",
"no_copy": 1,
"options": "Currency",
"permlevel": 0,
@ -534,7 +534,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"modified": "2015-09-11 15:51:26",
"modified": "2015-09-17 14:05:24.793609",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier",

View File

@ -93,9 +93,11 @@ def get_dashboard_info(supplier):
out[doctype] = frappe.db.get_value(doctype,
{"supplier": supplier, "docstatus": ["!=", 2] }, "count(*)")
billing_this_year = frappe.db.sql("""select sum(base_grand_total)
from `tabPurchase Invoice`
where supplier=%s and docstatus = 1 and fiscal_year = %s""",
billing_this_year = frappe.db.sql("""
select sum(ifnull(credit_in_account_currency, 0)) - sum(ifnull(debit_in_account_currency, 0))
from `tabGL Entry`
where voucher_type='Purchase Invoice' and party_type = 'Supplier'
and party=%s and fiscal_year = %s""",
(supplier, frappe.db.get_default("fiscal_year")))
total_unpaid = frappe.db.sql("""select sum(outstanding_amount)

View File

@ -64,16 +64,12 @@ cur_frm.cscript.setup_dashboard = function(doc) {
},
callback: function(r) {
if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager")) {
if(r.message["company_currency"].length == 1) {
cur_frm.dashboard.set_headline(
__("Total Billing This Year: ") + "<b>"
+ format_currency(r.message.billing_this_year, r.message["company_currency"][0])
+ '</b> / <span class="text-muted">' + __("Unpaid") + ": <b>"
+ format_currency(r.message.total_unpaid, r.message["company_currency"][0])
+ '</b></span>');
} else {
cur_frm.dashboard.set_headline("");
}
cur_frm.dashboard.set_headline(
__("Total Billing This Year: ") + "<b>"
+ format_currency(r.message.billing_this_year, cur_frm.doc.party_account_currency)
+ '</b> / <span class="text-muted">' + __("Unpaid") + ": <b>"
+ format_currency(r.message.total_unpaid, cur_frm.doc.party_account_currency)
+ '</b></span>');
}
cur_frm.dashboard.set_badge_count(r.message);
}

File diff suppressed because it is too large Load Diff

View File

@ -128,9 +128,11 @@ def get_dashboard_info(customer):
out[doctype] = frappe.db.get_value(doctype,
{"customer": customer, "docstatus": ["!=", 2] }, "count(*)")
billing_this_year = frappe.db.sql("""select sum(base_grand_total)
from `tabSales Invoice`
where customer=%s and docstatus = 1 and fiscal_year = %s""",
billing_this_year = frappe.db.sql("""
select sum(ifnull(debit_in_account_currency, 0)) - sum(ifnull(credit_in_account_currency, 0))
from `tabGL Entry`
where voucher_type='Sales Invoice' and party_type = 'Customer'
and party=%s and fiscal_year = %s""",
(customer, frappe.db.get_default("fiscal_year")))
total_unpaid = frappe.db.sql("""select sum(outstanding_amount)
@ -139,7 +141,6 @@ def get_dashboard_info(customer):
out["billing_this_year"] = billing_this_year[0][0] if billing_this_year else 0
out["total_unpaid"] = total_unpaid[0][0] if total_unpaid else 0
out["company_currency"] = frappe.db.sql_list("select distinct default_currency from tabCompany")
return out