[Fix] Sales payment summary report (#12151)

diff --git a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js
index a01cc0f..a0e56de 100644
--- a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js
+++ b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js
@@ -7,12 +7,14 @@
 			"label": __("From Date"),
 			"fieldtype": "Date",
 			"default": frappe.datetime.get_today(),
+			"reqd": 1,
 			"width": "80"
 		},
 		{
 			"fieldname":"to_date",
 			"label": __("To Date"),
 			"fieldtype": "Date",
+			"reqd": 1,
 			"default": frappe.datetime.get_today()
 		},
 		{
diff --git a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
index b46f1be..3fcc1d3 100644
--- a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
+++ b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
@@ -37,11 +37,11 @@
 
 def get_conditions(filters):
 	conditions = ""
-	if filters.get("company"): conditions += " a.company=%(company)s"
+	if filters.get("from_date"): conditions += "a.posting_date >= %(from_date)s"
+	if filters.get("to_date"): conditions += " and a.posting_date <= %(to_date)s"
+	if filters.get("company"): conditions += " and 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("is_pos"): conditions += " and a.is_pos = %(is_pos)s"
 	return conditions