diff --git a/erpnext/config/crm.py b/erpnext/config/crm.py
index 9935aeffb7..7a55cc606d 100644
--- a/erpnext/config/crm.py
+++ b/erpnext/config/crm.py
@@ -32,6 +32,12 @@ def get_data():
"label": _("Reports"),
"icon": "fa fa-list",
"items": [
+ {
+ "type": "report",
+ "is_query_report": True,
+ "name": "Lead Details",
+ "doctype": "Lead"
+ },
{
"type": "page",
"name": "sales-funnel",
@@ -40,15 +46,15 @@ def get_data():
},
{
"type": "report",
- "name": "Minutes to First Response for Opportunity",
- "doctype": "Opportunity",
+ "name": "Prospects Engaged But Not Converted",
+ "doctype": "Lead",
"is_query_report": True
},
{
"type": "report",
- "is_query_report": True,
- "name": "Lead Details",
- "doctype": "Lead"
+ "name": "Minutes to First Response for Opportunity",
+ "doctype": "Opportunity",
+ "is_query_report": True
},
{
"type": "report",
diff --git a/erpnext/crm/report/prospects_engaged_but_not_converted/__init__.py b/erpnext/crm/report/prospects_engaged_but_not_converted/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.js b/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.js
new file mode 100644
index 0000000000..6f37719f63
--- /dev/null
+++ b/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.query_reports["Prospects Engaged But Not Converted"] = {
+ "filters": [
+ {
+ "fieldname": "lead",
+ "label": __("Lead"),
+ "fieldtype": "Link",
+ "options": "Lead"
+ },
+ {
+ "fieldname": "no_of_interaction",
+ "label": __("Number of Interaction"),
+ "fieldtype": "Int",
+ "default": 1
+ },
+ {
+ "fieldname": "lead_age",
+ "label": __("Minimum Lead Age (Days)"),
+ "fieldtype": "Int",
+ "default": 60
+ },
+ ]
+}
diff --git a/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.json b/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.json
new file mode 100644
index 0000000000..9a21e0b56f
--- /dev/null
+++ b/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.json
@@ -0,0 +1,29 @@
+{
+ "add_total_row": 0,
+ "apply_user_permissions": 1,
+ "creation": "2017-04-04 08:25:40.491063",
+ "disabled": 0,
+ "docstatus": 0,
+ "doctype": "Report",
+ "idx": 0,
+ "is_standard": "Yes",
+ "modified": "2017-04-04 10:00:10.253224",
+ "modified_by": "Administrator",
+ "module": "CRM",
+ "name": "Prospects Engaged But Not Converted",
+ "owner": "Administrator",
+ "ref_doctype": "Lead",
+ "report_name": "Prospects Engaged But Not Converted",
+ "report_type": "Script Report",
+ "roles": [
+ {
+ "role": "Sales User"
+ },
+ {
+ "role": "Sales Manager"
+ },
+ {
+ "role": "System Manager"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.py b/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.py
new file mode 100644
index 0000000000..36a4ad64ca
--- /dev/null
+++ b/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.py
@@ -0,0 +1,74 @@
+# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+from frappe.utils import add_days, now
+
+def execute(filters=None):
+ columns, data = [], []
+ set_defaut_value_for_filters(filters)
+ columns = get_columns()
+ data = get_data(filters)
+
+ return columns, data
+
+def set_defaut_value_for_filters(filters):
+ if not filters.get('no_of_interaction'): filters["no_of_interaction"] = 1
+ if not filters.get('lead_age'): filters["lead_age"] = 60
+
+def get_columns():
+ return [
+ _("Lead") + ":Link/Lead:100",
+ _("Name") + "::100",
+ _("Organization") + "::100",
+ _("Reference Document") + "::150",
+ _("Reference Name") + ":Dynamic Link/"+_("Reference Document")+":120",
+ _("Last Communication") + ":Data:200",
+ _("Last Communication Date") + ":Date:180"
+ ]
+
+def get_data(filters):
+ lead_details = []
+ lead_filters = get_lead_filters(filters)
+
+ for lead in frappe.get_all('Lead', fields = ['name', 'lead_name', 'company_name'], filters=lead_filters):
+ data = frappe.db.sql("""
+ select
+ `tabCommunication`.reference_doctype, `tabCommunication`.reference_name,
+ `tabCommunication`.content, `tabCommunication`.communication_date
+ from
+ (
+ (select name, lead from `tabOpportunity` where lead = %(lead)s)
+ union
+ (select name, lead from `tabQuotation` where lead = %(lead)s)
+ union
+ (select name, lead from `tabIssue` where lead = %(lead)s and status!='Closed')
+ union
+ (select %(lead)s, %(lead)s)
+ )
+ as ref_document, `tabCommunication`
+ where
+ `tabCommunication`.reference_name = ref_document.name and
+ `tabCommunication`.sent_or_received = 'Received'
+ order by
+ ref_document.lead, `tabCommunication`.creation desc limit %(limit)s""",
+ {'lead': lead.name, 'limit': filters.get('no_of_interaction')})
+
+ for lead_info in data:
+ lead_data = [lead.name, lead.lead_name, lead.company_name] + list(lead_info)
+ lead_details.append(lead_data)
+
+ return lead_details
+
+def get_lead_filters(filters):
+ lead_creation_date = get_creation_date_based_on_lead_age(filters)
+ lead_filters = [["status", "!=", "Converted"], ["creation", ">", lead_creation_date]]
+
+ if filters.get('lead'):
+ lead_filters.append(["name", "=", filters.get('lead')])
+ return lead_filters
+
+def get_creation_date_based_on_lead_age(filters):
+ return add_days(now(), (filters.get('lead_age') * -1))
\ No newline at end of file
diff --git a/erpnext/docs/assets/img/crm/report/__init__.py b/erpnext/docs/assets/img/crm/report/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/erpnext/docs/assets/img/crm/report/customer_address_and_contact.png b/erpnext/docs/assets/img/crm/report/customer_address_and_contact.png
new file mode 100644
index 0000000000..3f92edb19c
Binary files /dev/null and b/erpnext/docs/assets/img/crm/report/customer_address_and_contact.png differ
diff --git a/erpnext/docs/assets/img/crm/report/inactive_customers.png b/erpnext/docs/assets/img/crm/report/inactive_customers.png
new file mode 100644
index 0000000000..75330fd543
Binary files /dev/null and b/erpnext/docs/assets/img/crm/report/inactive_customers.png differ
diff --git a/erpnext/docs/assets/img/crm/report/lead.png b/erpnext/docs/assets/img/crm/report/lead.png
new file mode 100644
index 0000000000..92a3d70ec4
Binary files /dev/null and b/erpnext/docs/assets/img/crm/report/lead.png differ
diff --git a/erpnext/docs/assets/img/crm/report/minutes_to_first_response.png b/erpnext/docs/assets/img/crm/report/minutes_to_first_response.png
new file mode 100644
index 0000000000..1831382aa0
Binary files /dev/null and b/erpnext/docs/assets/img/crm/report/minutes_to_first_response.png differ
diff --git a/erpnext/docs/assets/img/crm/report/prospects_engaged_but_not_converted.png b/erpnext/docs/assets/img/crm/report/prospects_engaged_but_not_converted.png
new file mode 100644
index 0000000000..8406b68901
Binary files /dev/null and b/erpnext/docs/assets/img/crm/report/prospects_engaged_but_not_converted.png differ
diff --git a/erpnext/docs/assets/img/crm/report/sales_funnel.png b/erpnext/docs/assets/img/crm/report/sales_funnel.png
new file mode 100644
index 0000000000..0796441f89
Binary files /dev/null and b/erpnext/docs/assets/img/crm/report/sales_funnel.png differ
diff --git a/erpnext/docs/user/manual/en/CRM/crm_reports.md b/erpnext/docs/user/manual/en/CRM/crm_reports.md
new file mode 100644
index 0000000000..4ff9aa598d
--- /dev/null
+++ b/erpnext/docs/user/manual/en/CRM/crm_reports.md
@@ -0,0 +1,40 @@
+CRM module's reports helps users to get the information about the prospects. Using Following reports, user can analyze the data about prospect's history with a company and will helps user to build strong relationships with them.
+
+###Lead Details
+It has data about the leads and their contact and address details.
+
+
+###Sales Funnel
+By using the sales funnel report, and by quantifying the number of prospects at each stage of the process, you can get an idea of your potential customers.
+
+More than this, by looking at the way these numbers change over time, you can identify problems in the sales pipeline and take any corrective action at the early stage.
+
+For example, if you notice that very few communications with the prospects has taken place in a month which might indicate a decrease in the sales. From the next month, organization should make sure that more communications has to take place with the prospects.
+
+
+
+###Prospects Engaged But Not Converted
+Using this report, user gets the information about the leads who has shown interest in the business with you but due to some reason they were not converted into the customers.
+
+
+
+###Minutes to First Response for Opportunity
+Immediacy is so important – and so valued
+In this internet area, we all expect a quicker response time to any of our query. This report gives you the information about the first response time given to an opportunities or issues. Using this report, the organization can improve their first response time to the prospects which can help to the better sales in the future.
+
+
+
+###Customer Addresses And Contacts
+It has data about the customers and their contact and address details.
+
+
+###Inactive Customers
+This report shows the list of customers who has not purchased since long time.
+
+
diff --git a/erpnext/docs/user/manual/en/CRM/index.txt b/erpnext/docs/user/manual/en/CRM/index.txt
index 204123ae69..2fe3f4d6d5 100644
--- a/erpnext/docs/user/manual/en/CRM/index.txt
+++ b/erpnext/docs/user/manual/en/CRM/index.txt
@@ -3,4 +3,5 @@ customer
opportunity
contact
newsletter
+crm_reports
setup
\ No newline at end of file