fixes in gross profit report
diff --git a/erpnext/selling/search_criteria/gross_profit/gross_profit.py b/erpnext/selling/search_criteria/gross_profit/gross_profit.py
index 53a5fdb..5b4d3fa 100644
--- a/erpnext/selling/search_criteria/gross_profit/gross_profit.py
+++ b/erpnext/selling/search_criteria/gross_profit/gross_profit.py
@@ -71,7 +71,8 @@
r.append(purchase_cost)
gp = flt(r[col_idx['Amount']]) - flt(purchase_cost)
- gp_percent = purchase_cost and round((gp*100/flt(r[col_idx['Amount']])), 2) or 0
+ gp_percent = r[col_idx['Amount']] and purchase_cost and \
+ round((gp*100/flt(r[col_idx['Amount']])), 2) or 0
r.append(fmt_money(gp))
r.append(fmt_money(gp_percent))
out.append(r)