mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 15:42:52 +00:00
[minor] [fix] sales funnel
This commit is contained in:
@@ -7,23 +7,23 @@ import webnotes
|
||||
@webnotes.whitelist()
|
||||
def get_funnel_data(from_date, to_date):
|
||||
active_leads = webnotes.conn.sql("""select count(*) from `tabLead`
|
||||
where (`modified` between %s and %s)
|
||||
where (date(`modified`) between %s and %s)
|
||||
and status != "Do Not Contact" """, (from_date, to_date))[0][0]
|
||||
|
||||
active_leads += webnotes.conn.sql("""select count(distinct customer) from `tabContact`
|
||||
where (`modified` between %s and %s)
|
||||
where (date(`modified`) between %s and %s)
|
||||
and status != "Passive" """, (from_date, to_date))[0][0]
|
||||
|
||||
opportunities = webnotes.conn.sql("""select count(*) from `tabOpportunity`
|
||||
where docstatus = 1 and (`modified` between %s and %s)
|
||||
where docstatus = 1 and (date(`creation`) between %s and %s)
|
||||
and status != "Lost" """, (from_date, to_date))[0][0]
|
||||
|
||||
quotations = webnotes.conn.sql("""select count(*) from `tabQuotation`
|
||||
where docstatus = 1 and (`modified` between %s and %s)
|
||||
where docstatus = 1 and (date(`creation`) between %s and %s)
|
||||
and status != "Lost" """, (from_date, to_date))[0][0]
|
||||
|
||||
sales_orders = webnotes.conn.sql("""select count(*) from `tabQuotation`
|
||||
where docstatus = 1 and (`modified` between %s and %s)""", (from_date, to_date))[0][0]
|
||||
where docstatus = 1 and (date(`creation`) between %s and %s)""", (from_date, to_date))[0][0]
|
||||
|
||||
return [
|
||||
{ "title": "Active Leads / Customers", "value": active_leads, "color": "#B03B46" },
|
||||
|
||||
Reference in New Issue
Block a user