Merge branch 'hotfix'
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 8f59fc8..2597ed9 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -4,7 +4,7 @@
 import frappe
 from erpnext.hooks import regional_overrides
 
-__version__ = '9.2.20'
+__version__ = '9.2.21'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/accounts/report/sales_payment_summary/__init__.py b/erpnext/accounts/report/sales_payment_summary/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/report/sales_payment_summary/__init__.py
diff --git a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js
new file mode 100644
index 0000000..6b46214
--- /dev/null
+++ b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js
@@ -0,0 +1,57 @@
+// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+// License: GNU General Public License v3. See license.txt
+
+frappe.query_reports["Sales Payment Summary"] = {
+	"filters": [
+		{
+			"fieldname":"from_date",
+			"label": __("From Date"),
+			"fieldtype": "Date",
+			"default": frappe.datetime.get_today(),
+			"width": "80"
+		},
+		{
+			"fieldname":"to_date",
+			"label": __("To Date"),
+			"fieldtype": "Date",
+			"default": frappe.datetime.get_today()
+		},
+		{
+			"fieldname":"company",
+			"label": __("Company"),
+			"fieldtype": "Link",
+			"options": "Company",
+			"default": frappe.defaults.get_user_default("Company")
+		},
+		{
+			"fieldname":"mode_of_payment",
+			"label": __("Mode of Payment"),
+			"fieldtype": "Link",
+			"options": "Mode of Payment"
+		},
+		{
+			"fieldname":"owner",
+			"label": __("Owner"),
+			"fieldtype": "Link",
+			"options": "User",
+			"defaults": user
+		},
+		{
+			"fieldname":"cost_center",
+			"label": __("Cost Center"),
+			"fieldtype": "Link",
+			"options": "Cost Center"
+		},
+		{
+			"fieldname":"warehouse",
+			"label": __("Warehouse"),
+			"fieldtype": "Link",
+			"options": "Warehouse"
+		},
+		{
+			"fieldname":"is_pos",
+			"label": __("POS?"),
+			"fieldtype": "Check"
+		}
+	]
+};
diff --git a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.json b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.json
new file mode 100644
index 0000000..1ff56d3
--- /dev/null
+++ b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.json
@@ -0,0 +1,26 @@
+{
+ "add_total_row": 0, 
+ "apply_user_permissions": 1, 
+ "creation": "2017-11-03 16:31:45.757516", 
+ "disabled": 0, 
+ "docstatus": 0, 
+ "doctype": "Report", 
+ "idx": 0, 
+ "is_standard": "Yes", 
+ "modified": "2017-11-03 17:00:37.871577", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "Sales Payment Summary", 
+ "owner": "Administrator", 
+ "ref_doctype": "Sales Invoice", 
+ "report_name": "Sales Payment Summary", 
+ "report_type": "Script Report", 
+ "roles": [
+  {
+   "role": "Accounts Manager"
+  }, 
+  {
+   "role": "Accounts User"
+  }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
new file mode 100644
index 0000000..bb80955
--- /dev/null
+++ b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
@@ -0,0 +1,66 @@
+# 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 _
+
+def execute(filters=None):
+	columns, data = [], []
+	columns=get_columns()
+	data=get_sales_payment_data(filters, columns)
+	return columns, data
+
+def get_columns():
+	return [
+		_("Date") + ":Date:80",
+		_("Owner") + "::150",
+		_("Payment Mode") + "::120",
+		_("Warehouse") + ":Link/Cost Center:100",
+		_("Cost Center") + ":Link/Warehouse:100",
+		_("Sales and Returns") + ":Currency/currency:120",
+		_("Taxes") + ":Currency/currency:120",
+		_("Payments") + ":Currency/currency:120",
+		_("Reconciliation") + ":Currency/currency:120"
+	]
+
+def get_sales_payment_data(filters, columns):
+	sales_invoice_data = get_sales_invoice_data(filters)
+	data = []
+	for inv in sales_invoice_data:
+		row = [inv.posting_date, inv.owner, inv.mode_of_payment,inv.warehouse,
+			inv.cost_center,inv.net_total, inv.total_taxes, inv.paid_amount,
+			(inv.net_total + inv.total_taxes - inv.paid_amount)]
+		data.append(row)
+	return data
+
+def get_conditions(filters):
+	conditions = ""
+	if filters.get("company"): conditions += " a.company=%(company)s"
+	if filters.get("customer"): conditions += " and a.customer = %(customer)s"
+	if filters.get("owner"): conditions += " and a.owner = %(owner)s"
+	if filters.get("from_date"): conditions += " and a.posting_date >= %(from_date)s"
+	if filters.get("to_date"): conditions += " and a.posting_date <= %(to_date)s"
+	if filters.get("mode_of_payment"): conditions += " and c.mode_of_payment >= %(mode_of_payment)s"
+	if filters.get("warehouse"): conditions += " and b.warehouse <= %(warehouse)s"
+	if filters.get("cost_center"): conditions += " and b.cost_center <= %(cost_center)s"
+	if filters.get("is_pos"): conditions += " and a.is_pos = %(is_pos)s"
+
+	return conditions
+
+def get_sales_invoice_data(filters):
+	conditions = get_conditions(filters)
+	return frappe.db.sql("""
+		select
+			a.owner, a.posting_date, c.mode_of_payment, b.warehouse, b.cost_center,
+			sum(a.net_total) as "net_total",
+			sum(a.total_taxes_and_charges) as "total_taxes",
+			sum(a.base_paid_amount) as "paid_amount"
+		from `tabSales Invoice` a, `tabSales Invoice Item` b, `tabSales Invoice Payment` c
+		where
+			a.name = b.parent
+			and a.name = c.parent
+			and {conditions}
+			group by
+			a.owner, a.posting_date, c.mode_of_payment, b.warehouse, b.cost_center
+	""".format(conditions=conditions), filters, as_dict=1)
\ No newline at end of file
diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py
index cdce13b..58fb2f0 100644
--- a/erpnext/config/accounts.py
+++ b/erpnext/config/accounts.py
@@ -468,6 +468,12 @@
 					"name": "Customer Credit Balance",
 					"doctype": "Customer"
 				},
+				{
+					"type": "report",
+					"is_query_report": True,
+					"name": "Sales Payment Summary",
+					"doctype": "Sales Invoice"
+				}
 			]
 		},
 		{