Fixed issues
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index fb4a86c..0c108a4 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -24,7 +24,7 @@
 	elif company:
 		cond = """('%s' in (select company from `tabFiscal Year Company`
 			where `tabFiscal Year Company`.parent = `tabFiscal Year`.name)) 
-			and '%s' >= year_start_date and '%s' <= year_end_date """ %(company, date, date)
+			and '%s' >= year_start_date and '%s' <= year_end_date """ %(company.replace("'", "\'"), date, date)
 	else:
 		cond = "'%s' >= year_start_date and '%s' <= year_end_date" %(date, date)