Merge pull request #13691 from saurabh6790/supp_180417_1

[hotfix] multiple fixes
diff --git a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
index 5b7d73f..0556e9b 100644
--- a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
+++ b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
@@ -29,11 +29,11 @@
 	cheque_print.html = """
 <div style="position: relative; top:%(starting_position_from_top_edge)scm">
 	<div style="width:%(cheque_width)scm;height:%(cheque_height)scm;">
-		<span style="top: {{ %(acc_pay_dist_from_top_edge)s }}cm; left: {{ %(acc_pay_dist_from_left_edge)s }}cm;
+		<span style="top:%(acc_pay_dist_from_top_edge)scm; left:%(acc_pay_dist_from_left_edge)scm;
 			border-bottom: solid 1px;border-top:solid 1px; position: absolute;">
 				%(message_to_show)s
 		</span>
-		<span style="top:%(date_dist_from_top_edge)s cm; left:%(date_dist_from_left_edge)scm;
+		<span style="top:%(date_dist_from_top_edge)scm; left:%(date_dist_from_left_edge)scm;
 			position: absolute;">
 			{{ frappe.utils.formatdate(doc.reference_date) or '' }}
 		</span>
diff --git a/erpnext/stock/report/stock_balance/stock_balance.py b/erpnext/stock/report/stock_balance/stock_balance.py
index 45035f2..3e05716 100644
--- a/erpnext/stock/report/stock_balance/stock_balance.py
+++ b/erpnext/stock/report/stock_balance/stock_balance.py
@@ -200,13 +200,14 @@
 	item_details = {}
 	if not items:
 		items = list(set([d.item_code for d in sle]))
-
-	for item in frappe.db.sql("""
-		select name, item_name, description, item_group, brand, stock_uom
-		from `tabItem`
-		where name in ({0})
-		""".format(', '.join(['"' + frappe.db.escape(i, percent=False) + '"' for i in items])), as_dict=1):
-			item_details.setdefault(item.name, item)
+		
+	if items:
+		for item in frappe.db.sql("""
+			select name, item_name, description, item_group, brand, stock_uom
+			from `tabItem`
+			where name in ({0})
+			""".format(', '.join(['"' + frappe.db.escape(i, percent=False) + '"' for i in items])), as_dict=1):
+				item_details.setdefault(item.name, item)
 
 	if filters.get('show_variant_attributes', 0) == 1:
 		variant_values = get_variant_values_for(item_details.keys())
@@ -215,11 +216,14 @@
 	return item_details
 
 def get_item_reorder_details(items):
-	item_reorder_details = frappe.db.sql("""
-		select parent, warehouse, warehouse_reorder_qty, warehouse_reorder_level
-		from `tabItem Reorder`
-		where parent in ({0})
-	""".format(', '.join(['"' + frappe.db.escape(i, percent=False) + '"' for i in items])), as_dict=1)
+	item_reorder_details = frappe._dict()
+
+	if items:
+		item_reorder_details = frappe.db.sql("""
+			select parent, warehouse, warehouse_reorder_qty, warehouse_reorder_level
+			from `tabItem Reorder`
+			where parent in ({0})
+		""".format(', '.join(['"' + frappe.db.escape(i, percent=False) + '"' for i in items])), as_dict=1)
 
 	return dict((d.parent + d.warehouse, d) for d in item_reorder_details)
 
diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py
index 5e185e0..e29f50a 100644
--- a/erpnext/stock/report/stock_ledger/stock_ledger.py
+++ b/erpnext/stock/report/stock_ledger/stock_ledger.py
@@ -93,11 +93,14 @@
 	if not items:
 		items = list(set([d.item_code for d in sl_entries]))
 
+	if not items:
+		return item_details
+
 	for item in frappe.db.sql("""
 		select name, item_name, description, item_group, brand, stock_uom
 		from `tabItem`
 		where name in ({0})
-		""".format(', '.join(['"' + frappe.db.escape(i,percent=False) + '"' for i in items])), as_dict=1):
+		""".format(', '.join(['"' + frappe.db.escape(i,percent=False) + '"' for i in items])), as_dict=1, debug=1):
 			item_details.setdefault(item.name, item)
 
 	return item_details