customer and supplier dashboard info
This commit is contained in:
parent
b893972486
commit
f78283fbff
@ -42,8 +42,8 @@ cur_frm.cscript.make_dashboard = function(doc) {
|
||||
if(r.message["company_currency"].length == 1) {
|
||||
cur_frm.dashboard.set_headline(
|
||||
__("Total Billing This Year: ") + "<b>"
|
||||
+ format_currency(r.message.total_billing, r.message.company_currency[0])
|
||||
+ '</b> / <span class="text-muted">' + __("Unpaid") + ": <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>');
|
||||
}
|
||||
|
@ -89,14 +89,18 @@ def get_dashboard_info(supplier):
|
||||
out[doctype] = frappe.db.get_value(doctype,
|
||||
{"supplier": supplier, "docstatus": ["!=", 2] }, "count(*)")
|
||||
|
||||
billing = frappe.db.sql("""select sum(base_grand_total), sum(outstanding_amount)
|
||||
billing_this_year = frappe.db.sql("""select sum(base_grand_total)
|
||||
from `tabPurchase Invoice`
|
||||
where supplier=%s
|
||||
and docstatus = 1
|
||||
and fiscal_year = %s""", (supplier, frappe.db.get_default("fiscal_year")))
|
||||
where supplier=%s and docstatus = 1 and fiscal_year = %s""",
|
||||
(supplier, frappe.db.get_default("fiscal_year")))
|
||||
|
||||
total_unpaid = frappe.db.sql("""select sum(outstanding_amount)
|
||||
from `tabPurchase Invoice`
|
||||
where supplier=%s and docstatus = 1""", supplier)
|
||||
|
||||
|
||||
out["total_billing"] = billing[0][0]
|
||||
out["total_unpaid"] = billing[0][1]
|
||||
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
|
||||
|
@ -58,7 +58,7 @@ cur_frm.cscript.setup_dashboard = function(doc) {
|
||||
if(r.message["company_currency"].length == 1) {
|
||||
cur_frm.dashboard.set_headline(
|
||||
__("Total Billing This Year: ") + "<b>"
|
||||
+ format_currency(r.message.total_billing, r.message["company_currency"][0])
|
||||
+ 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>');
|
||||
|
@ -123,14 +123,17 @@ def get_dashboard_info(customer):
|
||||
out[doctype] = frappe.db.get_value(doctype,
|
||||
{"customer": customer, "docstatus": ["!=", 2] }, "count(*)")
|
||||
|
||||
billing = frappe.db.sql("""select sum(base_grand_total), sum(outstanding_amount)
|
||||
billing_this_year = frappe.db.sql("""select sum(base_grand_total)
|
||||
from `tabSales Invoice`
|
||||
where customer=%s
|
||||
and docstatus = 1
|
||||
and fiscal_year = %s""", (customer, frappe.db.get_default("fiscal_year")))
|
||||
where customer=%s and docstatus = 1 and fiscal_year = %s""",
|
||||
(customer, frappe.db.get_default("fiscal_year")))
|
||||
|
||||
total_unpaid = frappe.db.sql("""select sum(outstanding_amount)
|
||||
from `tabSales Invoice`
|
||||
where customer=%s and docstatus = 1""", customer)
|
||||
|
||||
out["total_billing"] = billing[0][0]
|
||||
out["total_unpaid"] = billing[0][1]
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user