Changes after review
This commit is contained in:
parent
83c8ed0827
commit
7bd7df3742
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
frappe.query_reports["Campaign Efficiency"] = {
|
||||||
frappe.query_reports["Campaign Efficiency"] = {
|
|
||||||
"filters": [
|
"filters": [
|
||||||
{
|
{
|
||||||
"fieldname": "from_date",
|
"fieldname": "from_date",
|
||||||
@ -16,6 +15,5 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
|||||||
"default": frappe.defaults.get_user_default("year_end_date"),
|
"default": frappe.defaults.get_user_default("year_end_date"),
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
};
|
||||||
});
|
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,8 @@ def get_lead_data(filters):
|
|||||||
conditions += " and date(creation) >= %(from_date)s"
|
conditions += " and date(creation) >= %(from_date)s"
|
||||||
if filters.to_date:
|
if filters.to_date:
|
||||||
conditions += " and date(creation) <= %(to_date)s"
|
conditions += " and date(creation) <= %(to_date)s"
|
||||||
data = frappe.db.sql("""select campaign_name as "Campaign Name", count(name) as "Lead Count" from `tabLead` where 1 = 1 %s group by campaign_name""" % (conditions,),filters, as_dict=1)
|
data = frappe.db.sql("""select campaign_name as "Campaign Name", count(name) as "Lead Count" from `tabLead`
|
||||||
|
where 1 = 1 %s group by campaign_name""" % (conditions,),filters, as_dict=1)
|
||||||
dl=list(data)
|
dl=list(data)
|
||||||
for row in dl:
|
for row in dl:
|
||||||
is_quot_count_zero = False
|
is_quot_count_zero = False
|
||||||
@ -59,11 +60,14 @@ def get_lead_opp_count(campaign):
|
|||||||
|
|
||||||
def get_quotation_ordered_count(campaign):
|
def get_quotation_ordered_count(campaign):
|
||||||
quotation_ordered_count = frappe.db.sql("""select count(name) from `tabQuotation`
|
quotation_ordered_count = frappe.db.sql("""select count(name) from `tabQuotation`
|
||||||
where status = 'Ordered' and lead in (select name from `tabLead` where campaign_name = %s)""",campaign)
|
where status = 'Ordered' and lead in
|
||||||
|
(select name from `tabLead` where campaign_name = %s)""",campaign)
|
||||||
return flt(quotation_ordered_count[0][0]) if quotation_ordered_count else 0
|
return flt(quotation_ordered_count[0][0]) if quotation_ordered_count else 0
|
||||||
|
|
||||||
def get_order_amount(campaign):
|
def get_order_amount(campaign):
|
||||||
ordered_count_amount = frappe.db.sql("""select sum(base_net_amount) from `tabSales Order Item`
|
ordered_count_amount = frappe.db.sql("""select sum(base_net_amount) from `tabSales Order Item`
|
||||||
where prevdoc_docname in (select name from `tabQuotation`
|
where prevdoc_docname in
|
||||||
where status = 'Ordered' and lead in (select name from `tabLead` where campaign_name = %s))""",campaign)
|
(select name from `tabQuotation`
|
||||||
|
where status = 'Ordered' and lead in
|
||||||
|
(select name from `tabLead` where campaign_name = %s))""",campaign)
|
||||||
return flt(ordered_count_amount[0][0]) if ordered_count_amount else 0
|
return flt(ordered_count_amount[0][0]) if ordered_count_amount else 0
|
||||||
@ -1,6 +1,5 @@
|
|||||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
|
||||||
frappe.query_reports["Lead Owner Efficiency"] = {
|
frappe.query_reports["Lead Owner Efficiency"] = {
|
||||||
"filters": [
|
"filters": [
|
||||||
{
|
{
|
||||||
@ -15,7 +14,4 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
|||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"default": frappe.defaults.get_user_default("year_end_date"),
|
"default": frappe.defaults.get_user_default("year_end_date"),
|
||||||
}
|
}
|
||||||
]
|
]};
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|||||||
@ -59,11 +59,13 @@ def get_lead_opp_count(leadowner):
|
|||||||
|
|
||||||
def get_quotation_ordered_count(leadowner):
|
def get_quotation_ordered_count(leadowner):
|
||||||
quotation_ordered_count = frappe.db.sql("""select count(name) from `tabQuotation`
|
quotation_ordered_count = frappe.db.sql("""select count(name) from `tabQuotation`
|
||||||
where status = 'Ordered' and lead in (select name from `tabLead` where lead_owner = %s)""",leadowner)
|
where status = 'Ordered' and lead in
|
||||||
|
(select name from `tabLead` where lead_owner = %s)""",leadowner)
|
||||||
return flt(quotation_ordered_count[0][0]) if quotation_ordered_count else 0
|
return flt(quotation_ordered_count[0][0]) if quotation_ordered_count else 0
|
||||||
|
|
||||||
def get_order_amount(leadowner):
|
def get_order_amount(leadowner):
|
||||||
ordered_count_amount = frappe.db.sql("""select sum(base_net_amount) from `tabSales Order Item`
|
ordered_count_amount = frappe.db.sql("""select sum(base_net_amount) from `tabSales Order Item`
|
||||||
where prevdoc_docname in (select name from `tabQuotation`
|
where prevdoc_docname in (select name from `tabQuotation`
|
||||||
where status = 'Ordered' and lead in (select name from `tabLead` where lead_owner = %s))""",leadowner)
|
where status = 'Ordered' and lead in
|
||||||
|
(select name from `tabLead` where lead_owner = %s))""",leadowner)
|
||||||
return flt(ordered_count_amount[0][0]) if ordered_count_amount else 0
|
return flt(ordered_count_amount[0][0]) if ordered_count_amount else 0
|
||||||
Loading…
x
Reference in New Issue
Block a user