Changes after review

This commit is contained in:
pawan
2017-04-24 13:48:40 +05:30
parent 7bd7df3742
commit 134487ab2a
2 changed files with 17 additions and 19 deletions

View File

@@ -59,15 +59,12 @@ def get_lead_opp_count(campaign):
return flt(opportunity_count[0][0]) if opportunity_count else 0 return flt(opportunity_count[0][0]) if opportunity_count else 0
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'
where status = 'Ordered' and lead in and lead in (select name from `tabLead` where campaign_name = %s)""",campaign)
(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 where prevdoc_docname in (select name from `tabQuotation` where status = 'Ordered' and
(select name from `tabQuotation` 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(ordered_count_amount[0][0]) if ordered_count_amount else 0 return flt(ordered_count_amount[0][0]) if ordered_count_amount else 0

View File

@@ -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 lead_owner as "Lead Owner", count(name) as "Lead Count" from `tabLead` where 1 = 1 %s group by lead_owner""" % (conditions,),filters, as_dict=1) data = frappe.db.sql("""select lead_owner as "Lead Owner", count(name) as "Lead Count"
from `tabLead` where 1 = 1 %s group by lead_owner""" % (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