[minor] added mins to first response for opportunity
This commit is contained in:
parent
a531ebea8a
commit
4cf914d902
@ -38,6 +38,12 @@ def get_data():
|
|||||||
"label": _("Sales Funnel"),
|
"label": _("Sales Funnel"),
|
||||||
"icon": "icon-bar-chart",
|
"icon": "icon-bar-chart",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "report",
|
||||||
|
"name": "Minutes to First Response for Opportunity",
|
||||||
|
"doctype": "Opportunity",
|
||||||
|
"is_query_report": True
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "report",
|
"type": "report",
|
||||||
"is_query_report": True,
|
"is_query_report": True,
|
||||||
|
0
erpnext/crm/report/__init__.py
Normal file
0
erpnext/crm/report/__init__.py
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
// For license information, please see license.txt
|
||||||
|
|
||||||
|
frappe.query_reports["Minutes to First Response for Opportunity"] = {
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"fieldname":"from_date",
|
||||||
|
"label": __("From Date"),
|
||||||
|
"fieldtype": "Date",
|
||||||
|
'reqd': 1,
|
||||||
|
"default": frappe.datetime.add_days(frappe.datetime.nowdate(), -30)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"to_date",
|
||||||
|
"label": __("To Date"),
|
||||||
|
"fieldtype": "Date",
|
||||||
|
'reqd': 1,
|
||||||
|
"default":frappe.datetime.nowdate()
|
||||||
|
},
|
||||||
|
],
|
||||||
|
get_chart_data: function(columns, result) {
|
||||||
|
return {
|
||||||
|
data: {
|
||||||
|
x: 'Date',
|
||||||
|
columns: [
|
||||||
|
['Date'].concat($.map(result, function(d) { return d[0]; })),
|
||||||
|
['Mins to first response'].concat($.map(result, function(d) { return d[1]; }))
|
||||||
|
]
|
||||||
|
// rows: [['Date', 'Mins to first response']].concat(result)
|
||||||
|
},
|
||||||
|
axis: {
|
||||||
|
x: {
|
||||||
|
type: 'timeseries',
|
||||||
|
tick: {
|
||||||
|
format: frappe.ui.py_date_format
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
chart_type: 'line',
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"add_total_row": 0,
|
||||||
|
"apply_user_permissions": 0,
|
||||||
|
"creation": "2016-06-17 11:28:25.867258",
|
||||||
|
"disabled": 0,
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Report",
|
||||||
|
"idx": 0,
|
||||||
|
"is_standard": "Yes",
|
||||||
|
"modified": "2016-06-17 11:28:25.867258",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "CRM",
|
||||||
|
"name": "Minutes to First Response for Opportunity",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"ref_doctype": "Opportunity",
|
||||||
|
"report_name": "Minutes to First Response for Opportunity",
|
||||||
|
"report_type": "Script Report"
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
def execute(filters=None):
|
||||||
|
columns = [
|
||||||
|
{
|
||||||
|
'fieldname': 'creation_date',
|
||||||
|
'label': 'Date',
|
||||||
|
'fieldtype': 'Date'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'fieldname': 'mins',
|
||||||
|
'fieldtype': 'Float',
|
||||||
|
'label': 'Mins to First Response'
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
data = frappe.db.sql('''select date(creation) as creation_date,
|
||||||
|
avg(mins_to_first_response) as mins
|
||||||
|
from tabOpportunity
|
||||||
|
where date(creation) between %s and %s
|
||||||
|
and mins_to_first_response > 0
|
||||||
|
group by creation_date order by creation_date desc''', (filters.from_date, filters.to_date))
|
||||||
|
|
||||||
|
return columns, data
|
@ -1,20 +1,20 @@
|
|||||||
frappe.query_reports["Minutes to First Response for Issues"] = {
|
frappe.query_reports["Minutes to First Response for Issues"] = {
|
||||||
"filters": [
|
"filters": [
|
||||||
{
|
{
|
||||||
"fieldname":"from_date",
|
"fieldname":"from_date",
|
||||||
"label": __("From Date"),
|
"label": __("From Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
'reqd': 1,
|
'reqd': 1,
|
||||||
"default": frappe.datetime.add_days(frappe.datetime.nowdate(), -30)
|
"default": frappe.datetime.add_days(frappe.datetime.nowdate(), -30)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname":"to_date",
|
"fieldname":"to_date",
|
||||||
"label": __("To Date"),
|
"label": __("To Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
'reqd': 1,
|
'reqd': 1,
|
||||||
"default":frappe.datetime.nowdate()
|
"default":frappe.datetime.nowdate()
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
get_chart_data: function(columns, result) {
|
get_chart_data: function(columns, result) {
|
||||||
return {
|
return {
|
||||||
data: {
|
data: {
|
||||||
@ -25,14 +25,14 @@ frappe.query_reports["Minutes to First Response for Issues"] = {
|
|||||||
]
|
]
|
||||||
// rows: [['Date', 'Mins to first response']].concat(result)
|
// rows: [['Date', 'Mins to first response']].concat(result)
|
||||||
},
|
},
|
||||||
axis: {
|
axis: {
|
||||||
x: {
|
x: {
|
||||||
type: 'timeseries',
|
type: 'timeseries',
|
||||||
tick: {
|
tick: {
|
||||||
format: '%Y-%m-%d'
|
format: frappe.ui.py_date_format
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
chart_type: 'line',
|
chart_type: 'line',
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,9 @@ def execute(filters=None):
|
|||||||
|
|
||||||
data = frappe.db.sql('''select date(creation) as creation_date,
|
data = frappe.db.sql('''select date(creation) as creation_date,
|
||||||
avg(mins_to_first_response) as mins
|
avg(mins_to_first_response) as mins
|
||||||
from tabIssue where date(creation) between %s and %s
|
from tabIssue
|
||||||
|
where date(creation) between %s and %s
|
||||||
|
and mins_to_first_response > 0
|
||||||
group by creation_date order by creation_date desc''', (filters.from_date, filters.to_date))
|
group by creation_date order by creation_date desc''', (filters.from_date, filters.to_date))
|
||||||
|
|
||||||
return columns, data
|
return columns, data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user