fix(India): NIL Rated, Exempted and non gst invoices in GSTR-1 report
diff --git a/erpnext/regional/report/gstr_1/gstr_1.js b/erpnext/regional/report/gstr_1/gstr_1.js
index ef2bdb6..4b98978 100644
--- a/erpnext/regional/report/gstr_1/gstr_1.js
+++ b/erpnext/regional/report/gstr_1/gstr_1.js
@@ -53,7 +53,8 @@
 				{ "value": "CDNR-REG", "label": __("Credit/Debit Notes (Registered) - 9B") },
 				{ "value": "CDNR-UNREG", "label": __("Credit/Debit Notes (Unregistered) - 9B") },
 				{ "value": "EXPORT", "label": __("Export Invoice - 6A") },
-				{ "value": "Advances", "label": __("Tax Liability (Advances Received) - 11A(1), 11A(2)") }
+				{ "value": "Advances", "label": __("Tax Liability (Advances Received) - 11A(1), 11A(2)") },
+				{ "value": "NIL Rated", "label": __("NIL RATED/EXEMPTED Invoices") }
 			],
 			"default": "B2B"
 		}
diff --git a/erpnext/regional/report/gstr_1/gstr_1.py b/erpnext/regional/report/gstr_1/gstr_1.py
index 11b684d..5944683 100644
--- a/erpnext/regional/report/gstr_1/gstr_1.py
+++ b/erpnext/regional/report/gstr_1/gstr_1.py
@@ -41,6 +41,7 @@
 			shipping_bill_number,
 			shipping_bill_date,
 			reason_for_issuing_document
+			company_gstin
 		"""
 
 	def run(self):
@@ -62,6 +63,8 @@
 			self.get_b2c_data()
 		elif self.filters.get("type_of_business") == "Advances":
 			self.get_advance_data()
+		elif self.filters.get("type_of_business") == "NIL Rated":
+			self.get_nil_rated_invoices()
 		elif self.invoices:
 			for inv, items_based_on_rate in self.items_based_on_tax_rate.items():
 				invoice_details = self.invoices.get(inv)
@@ -91,6 +94,57 @@
 			row= [key[0], key[1], value[0], value[1]]
 			self.data.append(row)
 
+	def get_nil_rated_invoices(self):
+		nil_exempt_output = [
+			{
+				"description": "Inter-State supplies to registered persons",
+				"nil_rate": 0.0,
+				"exempted": 0.0,
+				"non_gst": 0.0
+			},
+			{
+				"description": "Intra-State supplies to registered persons",
+				"nil_rate": 0.0,
+				"exempted": 0.0,
+				"non_gst": 0.0
+			},
+			{
+				"description": "Inter-State supplies to unregistered persons",
+				"nil_rate": 0.0,
+				"exempted": 0.0,
+				"non_gst": 0.0
+			},
+			{
+				"description": "Intra-State supplies to registered persons",
+				"nil_rate": 0.0,
+				"exempted": 0.0,
+				"non_gst": 0.0
+			}
+		]
+
+		for invoice, details in self.nil_exempt_non_gst.items():
+			invoice_detail = self.invoice.get(invoice)
+			if invoice_detail.get('gst_category') in ("Registered Regular", "Deemed Export", "SEZ"):
+				if is_inter_state(invoice_detail):
+					nil_exempt_output[0]["nil_rated"] += details[0]
+					nil_exempt_output[0]["exempted"] += details[1]
+					nil_exempt_output[0]["non_gst"] += details[2]
+				else:
+					nil_exempt_output[1]["nil_rated"] += details[0]
+					nil_exempt_output[1]["exempted"] += details[1]
+					nil_exempt_output[1]["non_gst"] += details[2]
+			else:
+				if is_inter_state(invoice_detail):
+					nil_exempt_output[2]["nil_rated"] += details[0]
+					nil_exempt_output[2]["exempted"] += details[1]
+					nil_exempt_output[2]["non_gst"] += details[2]
+				else:
+					nil_exempt_output[3]["nil_rated"] += details[0]
+					nil_exempt_output[3]["exempted"] += details[1]
+					nil_exempt_output[3]["non_gst"] += details[2]
+
+		self.data = nil_exempt_output
+
 	def get_b2c_data(self):
 		b2cs_output = {}
 
@@ -240,10 +294,11 @@
 	def get_invoice_items(self):
 		self.invoice_items = frappe._dict()
 		self.item_tax_rate = frappe._dict()
+		self.nil_exempt_non_gst = {}
 
 		items = frappe.db.sql("""
-			select item_code, parent, taxable_value, base_net_amount, item_tax_rate
-			from `tab%s Item`
+			select item_code, parent, taxable_value, base_net_amount, item_tax_rate, is_nil_exempt,
+			is_non_gst from `tab%s Item`
 			where parent in (%s)
 		""" % (self.doctype, ', '.join(['%s']*len(self.invoices))), tuple(self.invoices), as_dict=1)
 
@@ -260,6 +315,16 @@
 					tax_rate_dict = self.item_tax_rate.setdefault(d.parent, {}).setdefault(d.item_code, [])
 					tax_rate_dict.append(rate)
 
+			if d.is_nil_exempt:
+				self.nil_exempt_non_gst.setdefault(d.parent, [0.0, 0.0, 0.0])
+				if item_tax_rate:
+					self.nil_exempt_non_gst[d.parent][0] += d.get('taxable_value', 0)
+				else:
+					self.nil_exempt_non_gst[d.parent][1] += d.get('taxable_value', 0)
+			elif d.is_non_gst:
+				self.nil_exempt_non_gst.setdefault(d.parent, [0.0, 0.0, 0.0])
+				self.nil_exempt_non_gst[d.parent][2] += d.get('taxable_value', 0)
+
 	def get_items_based_on_tax_rate(self):
 		self.tax_details = frappe.db.sql("""
 			select
@@ -705,6 +770,33 @@
 						"width": 100
 				}
 			]
+		elif self.filters.get("type_of_business") == "NIL Rated":
+			self.invoice_columns = [
+				{
+					"fieldname": "descripton",
+					"label": "Description",
+					"fieldtype": "Data",
+					"width": 120
+				},
+				{
+					"fieldname": "nil_rated",
+					"label": "Nil Rated",
+					"fieldtype": "Currency",
+					"width": 200
+				},
+				{
+					"fieldname": "exempted",
+					"label": "Exempted",
+					"fieldtype": "Currency",
+					"width": 200
+				},
+				{
+					"fieldname": "non_gst",
+					"label": "Non GST",
+					"fieldtype": "Currency",
+					"width": 200
+				}
+			]
 
 		self.columns = self.invoice_columns + self.tax_columns + self.other_columns
 
@@ -1064,3 +1156,9 @@
 	frappe.response['filecontent'] = data['data']
 	frappe.response['content_type'] = 'application/json'
 	frappe.response['type'] = 'download'
+
+def is_inter_state(invoice_detail):
+	if invoice_detail.place_of_supply.split("-")[0] != invoice_detail.company_gstin[:2]:
+		return True
+	else:
+		return False
\ No newline at end of file