[minor] [fix] sales funnel
This commit is contained in:
parent
7944ea3067
commit
b950a71fb2
@ -8,14 +8,14 @@ wn.pages['sales-funnel'].onload = function(wrapper) {
|
|||||||
single_column: true
|
single_column: true
|
||||||
});
|
});
|
||||||
|
|
||||||
wrapper.crm_funnel = new erpnext.CRMFunnel(wrapper);
|
wrapper.sales_funnel = new erpnext.SalesFunnel(wrapper);
|
||||||
|
|
||||||
wrapper.appframe.add_module_icon("Selling", "sales-funnel", function() {
|
wrapper.appframe.add_module_icon("Selling", "sales-funnel", function() {
|
||||||
wn.set_route("selling-home");
|
wn.set_route("selling-home");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
erpnext.CRMFunnel = Class.extend({
|
erpnext.SalesFunnel = Class.extend({
|
||||||
init: function(wrapper) {
|
init: function(wrapper) {
|
||||||
var me = this;
|
var me = this;
|
||||||
// 0 setTimeout hack - this gives time for canvas to get width and height
|
// 0 setTimeout hack - this gives time for canvas to get width and height
|
||||||
@ -72,7 +72,7 @@ erpnext.CRMFunnel = Class.extend({
|
|||||||
var me = this;
|
var me = this;
|
||||||
wn.call({
|
wn.call({
|
||||||
module: "selling",
|
module: "selling",
|
||||||
page: "crm_funnel",
|
page: "sales_funnel",
|
||||||
method: "get_funnel_data",
|
method: "get_funnel_data",
|
||||||
args: {
|
args: {
|
||||||
from_date: this.options.from_date,
|
from_date: this.options.from_date,
|
||||||
|
@ -7,23 +7,23 @@ import webnotes
|
|||||||
@webnotes.whitelist()
|
@webnotes.whitelist()
|
||||||
def get_funnel_data(from_date, to_date):
|
def get_funnel_data(from_date, to_date):
|
||||||
active_leads = webnotes.conn.sql("""select count(*) from `tabLead`
|
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]
|
and status != "Do Not Contact" """, (from_date, to_date))[0][0]
|
||||||
|
|
||||||
active_leads += webnotes.conn.sql("""select count(distinct customer) from `tabContact`
|
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]
|
and status != "Passive" """, (from_date, to_date))[0][0]
|
||||||
|
|
||||||
opportunities = webnotes.conn.sql("""select count(*) from `tabOpportunity`
|
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]
|
and status != "Lost" """, (from_date, to_date))[0][0]
|
||||||
|
|
||||||
quotations = webnotes.conn.sql("""select count(*) from `tabQuotation`
|
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]
|
and status != "Lost" """, (from_date, to_date))[0][0]
|
||||||
|
|
||||||
sales_orders = webnotes.conn.sql("""select count(*) from `tabQuotation`
|
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 [
|
return [
|
||||||
{ "title": "Active Leads / Customers", "value": active_leads, "color": "#B03B46" },
|
{ "title": "Active Leads / Customers", "value": active_leads, "color": "#B03B46" },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user