[minor] [fix] sales funnel

This commit is contained in:
Anand Doshi
2013-10-31 19:06:11 +05:30
parent 7944ea3067
commit b950a71fb2
2 changed files with 8 additions and 8 deletions

View File

@@ -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" },