Daily work summary reply report (#14583)

* Add daily work summary reply report

* Show user name instead of email

* Remove print statement

* Change field datatype

* ReRun Travis
diff --git a/erpnext/hr/report/daily_work_summary_replies/__init__.py b/erpnext/hr/report/daily_work_summary_replies/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/hr/report/daily_work_summary_replies/__init__.py
diff --git a/erpnext/hr/report/daily_work_summary_replies/daily_work_summary_replies.js b/erpnext/hr/report/daily_work_summary_replies/daily_work_summary_replies.js
new file mode 100644
index 0000000..0980c69
--- /dev/null
+++ b/erpnext/hr/report/daily_work_summary_replies/daily_work_summary_replies.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+/* eslint-disable */
+frappe.query_reports["Daily Work Summary Replies"] = {
+	"filters": [
+		{
+			"fieldname":"group",
+			"label": __("Group"),
+			"fieldtype": "Link",
+			"options": "Daily Work Summary Group",
+			"reqd": 1
+		},
+		{
+			"fieldname": "range",
+			"label": __("Date Range"),
+			"fieldtype": "DateRange",
+			"reqd": 1
+		}
+	]
+}
diff --git a/erpnext/hr/report/daily_work_summary_replies/daily_work_summary_replies.json b/erpnext/hr/report/daily_work_summary_replies/daily_work_summary_replies.json
new file mode 100644
index 0000000..04c8850
--- /dev/null
+++ b/erpnext/hr/report/daily_work_summary_replies/daily_work_summary_replies.json
@@ -0,0 +1,25 @@
+{
+ "add_total_row": 0,
+ "creation": "2018-06-04 10:30:25.673452",
+ "disabled": 0,
+ "docstatus": 0,
+ "doctype": "Report",
+ "idx": 0,
+ "is_standard": "Yes",
+ "modified": "2018-06-04 10:44:04.694509",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "Daily Work Summary Replies",
+ "owner": "Administrator",
+ "ref_doctype": "Daily Work Summary",
+ "report_name": "Daily Work Summary Replies",
+ "report_type": "Script Report",
+ "roles": [
+  {
+   "role": "Employee"
+  },
+  {
+   "role": "HR User"
+  }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/hr/report/daily_work_summary_replies/daily_work_summary_replies.py b/erpnext/hr/report/daily_work_summary_replies/daily_work_summary_replies.py
new file mode 100644
index 0000000..f5eabf5
--- /dev/null
+++ b/erpnext/hr/report/daily_work_summary_replies/daily_work_summary_replies.py
@@ -0,0 +1,49 @@
+# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe import _
+import frappe
+from erpnext.hr.doctype.daily_work_summary.daily_work_summary import get_user_emails_from_group
+
+def execute(filters=None):
+	if not filters.group: return [], []
+	columns, data = get_columns(), get_data(filters)
+	return columns, data
+
+def get_columns(filters=None):
+	columns = [
+		{
+			"label": _("User"),
+			"fieldname": "user",
+			"fieldtype": "Data",
+			"width": 800
+		},
+		{
+			"label": _("Reply Count"),
+			"fieldname": "count",
+			"fieldtype": "data",
+			"width": 150,
+			"align": 'right',
+		}
+	]
+	return columns
+
+def get_data(filters):
+	daily_summary_emails = frappe.get_all('Daily Work Summary',
+		fields=["name"],
+		filters=[["creation","Between", filters.range]])
+	daily_summary_emails = [d.get('name') for d in daily_summary_emails]
+	replies = frappe.get_all('Communication',
+			fields=['content', 'text_content', 'sender'],
+			filters=[['reference_doctype','=', 'Daily Work Summary'],
+				['reference_name', 'in', daily_summary_emails],
+				['communication_type', '=', 'Communication'],
+				['sent_or_received', '=', 'Received']],
+			order_by='creation asc')
+	data = []
+	for user in get_user_emails_from_group(filters.group):
+		userName = frappe.get_value('User', user, 'full_name')
+		count = len([d for d in replies if d.sender == user])
+		data.append([userName, "{0} / {1}".format(count, len(daily_summary_emails))])
+	return data
\ No newline at end of file