diff --git a/india_compliance/gst_india/data/test_gstr_2b.json b/india_compliance/gst_india/data/test_gstr_2b.json index d84202a6e..74fac8dee 100644 --- a/india_compliance/gst_india/data/test_gstr_2b.json +++ b/india_compliance/gst_india/data/test_gstr_2b.json @@ -35,6 +35,18 @@ "cgst": 200, "sgst": 200, "cess": 100 + }, + "ecom": { + "igst": 400, + "cgst": 200, + "sgst": 200, + "cess": 100 + }, + "ecoma": { + "igst": 400, + "cgst": 200, + "sgst": 200, + "cess": 100 } }, "isdsup": { @@ -187,6 +199,18 @@ "cgst": 200, "sgst": 200, "cess": 100 + }, + "ecom": { + "igst": 400, + "cgst": 200, + "sgst": 200, + "cess": 100 + }, + "ecoma": { + "igst": 400, + "cgst": 200, + "sgst": 200, + "cess": 100 } }, "isdsup": { @@ -309,6 +333,128 @@ "cess": 100 } } + }, + "itcrev": { + "nonrevsup": { + "igst": 1600, + "cgst": 800, + "sgst": 800, + "cess": 400, + "b2b": { + "igst": 400, + "cgst": 200, + "sgst": 200, + "cess": 100 + }, + "b2ba": { + "igst": 400, + "cgst": 200, + "sgst": 200, + "cess": 100 + }, + "cdnr": { + "igst": 400, + "cgst": 200, + "sgst": 200, + "cess": 100 + }, + "cdnra": { + "igst": 400, + "cgst": 200, + "sgst": 200, + "cess": 100 + } + }, + "isdsup": { + "igst": 0, + "cgst": 0, + "sgst": 0, + "cess": 0, + "isd": { + "igst": 0, + "cgst": 0, + "sgst": 0, + "cess": 0 + }, + "isda": { + "igst": 0, + "cgst": 0, + "sgst": 0, + "cess": 0 + } + }, + "imports": { + "igst": 0, + "cgst": 0, + "sgst": 0, + "cess": 0, + "impg": { + "igst": 0, + "cgst": 0, + "sgst": 0, + "cess": 0 + }, + "impgsez": { + "igst": 0, + "cgst": 0, + "sgst": 0, + "cess": 0 + }, + "impga": { + "igst": 0, + "cgst": 0, + "sgst": 0, + "cess": 0 + }, + "impgasez": { + "igst": 0, + "cgst": 0, + "sgst": 0, + "cess": 0 + } + }, + "othersup": { + "igst": 1600, + "cgst": 800, + "sgst": 800, + "cess": 400, + "cdnr": { + "igst": 400, + "cgst": 200, + "sgst": 200, + "cess": 100 + }, + "cdnra": { + "igst": 400, + "cgst": 200, + "sgst": 200, + "cess": 100 + }, + "cdnrrev": { + "igst": 400, + "cgst": 200, + "sgst": 200, + "cess": 100 + }, + "cdnrarev": { + "igst": 400, + "cgst": 200, + "sgst": 200, + "cess": 100 + }, + "isd": { + "igst": 400, + "cgst": 200, + "sgst": 200, + "cess": 100 + }, + "isda": { + "igst": 400, + "cgst": 200, + "sgst": 200, + "cess": 100 + } + } } }, "cpsumm": { @@ -408,6 +554,112 @@ "igst": 400, "cess": 100 } + ], + "ecom": [ + { + "sgst": 0, + "ttldocs": 1, + "trdnm": "GSTN", + "supprd": "012023", + "supfildt": "26-08-2023", + "txval": 12324, + "ctin": "07USERR0205A1ZS", + "cgst": 0, + "cess": 0, + "igst": 123.24 + }, + { + "sgst": 0, + "ttldocs": 1, + "trdnm": "GSTN", + "supprd": "052023", + "supfildt": "26-08-2023", + "txval": 443, + "ctin": "07USERR0205A1ZS", + "cgst": 0, + "cess": 0, + "igst": 4.43 + } + ], + "ecoma": [ + { + "sgst": 0, + "ttldocs": 1, + "trdnm": "GSTN", + "supprd": "012023", + "supfildt": "26-08-2023", + "txval": 12324, + "ctin": "07USERR0205A1ZS", + "cgst": 0, + "cess": 0, + "igst": 123.24 + }, + { + "sgst": 0, + "ttldocs": 1, + "trdnm": "GSTN", + "supprd": "052023", + "supfildt": "26-08-2023", + "txval": 443, + "ctin": "07USERR0205A1ZS", + "cgst": 0, + "cess": 0, + "igst": 4.43 + } + ], + "itcrev": [ + { + "b2b": { + "ctin": "00AABCE2207R1Z5", + "trdnm": "GSTN", + "supprd": "022020", + "supfildt": "02-03-2020", + "ttldocs": 3, + "txval": 500, + "igst": 400, + "cgst": 0, + "sgst": 0, + "cess": 100 + }, + "b2ba": { + "ctin": "00AABCE2207R1Z5", + "trdnm": "GSTN", + "supprd": "022020", + "supfildt": "02-03-2020", + "ttldocs": 3, + "txval": 500, + "igst": 400, + "cgst": 0, + "sgst": 0, + "cess": 100 + }, + "cdnr": { + "ctin": "00AABCE2207R1Z5", + "trdnm": "GSTN", + "supprd": "022020", + "supfildt": "02-03-2020", + "nttyp": "D", + "ttldocs": 3, + "txval": 400, + "igst": 0, + "cgst": 200, + "sgst": 200, + "cess": 0 + }, + "cdnra": { + "ctin": "00AABCE2207R1Z5", + "trdnm": "GSTN", + "supprd": "022020", + "supfildt": "02-03-2020", + "nttyp": "D", + "ttldocs": 3, + "txval": 400, + "igst": 0, + "cgst": 200, + "sgst": 200, + "cess": 0 + } + } ] }, "docdata": { @@ -421,6 +673,11 @@ { "inum": "S008400", "typ": "R", + "txval": 12200, + "sgst": 0, + "cgst": 0, + "cess": 0, + "igst": 183, "dt": "24-11-2016", "val": 729248.16, "pos": "06", @@ -430,18 +687,7 @@ "diffprcnt": 1, "srctyp": "e-Invoice", "irn": "897ADG56RTY78956HYUG90BNHHIJK453GFTD99845672FDHHHSHGFH4567FG56TR", - "irngendate": "24-12-2019", - "items": [ - { - "num": 1, - "rt": 5, - "txval": 400, - "igst": 0, - "cgst": 200, - "sgst": 200, - "cess": 0 - } - ] + "irngendate": "24-12-2019" } ] } @@ -458,24 +704,18 @@ "oidt": "24-11-2016", "inum": "S008400", "typ": "R", + "txval": 12200, + "sgst": 0, + "cgst": 0, + "cess": 0, + "igst": 183, "dt": "24-11-2016", "val": 729248.16, "pos": "06", "rev": "N", "itcavl": "N", "rsn": "P", - "diffprcnt": 1, - "items": [ - { - "num": 1, - "rt": 5, - "txval": 400, - "igst": 0, - "cgst": 200, - "sgst": 200, - "cess": 0 - } - ] + "diffprcnt": 1 } ] } @@ -493,6 +733,11 @@ "suptyp": "R", "dt": "23-09-2016", "val": 729248.16, + "txval": 12200, + "sgst": 0, + "cgst": 0, + "cess": 0, + "igst": 183, "pos": "01", "rev": "N", "itcavl": "N", @@ -500,18 +745,7 @@ "diffprcnt": 1, "srctyp": "e-Invoice", "irn": "897ADG56RTY78956HYUG90BNHHIJK453GFTD99845672FDHHHSHGFH4567FG56TR", - "irngendate": "24-12-2019", - "items": [ - { - "num": 1, - "rt": 5, - "txval": 400, - "igst": 400, - "cgst": 0, - "sgst": 0, - "cess": 0 - } - ] + "irngendate": "24-12-2019" } ] } @@ -529,25 +763,19 @@ "ontdt": "23-09-2016", "ntnum": "533515", "typ": "C", + "txval": 12200, "suptyp": "R", + "sgst": 0, + "cgst": 0, + "cess": 0, + "igst": 183, "dt": "23-09-2016", "val": 729248.16, "pos": "01", "rev": "N", "itcavl": "N", "rsn": "C", - "diffprcnt": 1, - "items": [ - { - "num": 1, - "rt": 5, - "txval": 400, - "igst": 0, - "cgst": 200, - "sgst": 200, - "cess": 0 - } - ] + "diffprcnt": 1 } ] } @@ -630,6 +858,217 @@ } ] } + ], + "ecom": [ + { + "inv": [ + { + "dt": "01-01-2023", + "val": 343242, + "sgst": 0, + "cgst": 0, + "cess": 0, + "igst": 183, + "txval": 12200, + "rev": "N", + "itcavl": "Y", + "pos": "23", + "typ": "R", + "inum": "doc1", + "rsn": "", + "srctyp": "e-Invoice", + "irn": "897ADG56RTY78956HYUG90BNHHIJK453GFTD99845672FDHHHSHGFH4567FG56TR", + "irngendate": "24-12-2019" + } + ], + "trdnm": "GSTN", + "supfildt": "26-08-2023", + "supprd": "012023", + "ctin": "07USERR0205A1ZS" + }, + { + "inv": [ + { + "dt": "01-05-2023", + "val": 234324234, + "sgst": 0, + "cgst": 0, + "cess": 0, + "igst": 183, + "txval": 12200, + "rev": "N", + "itcavl": "Y", + "pos": "23", + "typ": "R", + "inum": "E123", + "rsn": "", + "srctyp": "e-Invoice", + "irn": "897ADG56RTY78956HYUG90BNHHIJK453GFTD99845672FDHHHSHGFH4567FG56TR", + "irngendate": "24-12-2019" + } + ], + "trdnm": "GSTN", + "supfildt": "26-08-2023", + "supprd": "052023", + "ctin": "07USERR0205A1ZS" + } + ], + "ecoma": [ + { + "inv": [ + { + "dt": "01-01-2023", + "oinum": "S008400", + "oidt": "24-11-2016", + "val": 343242, + "sgst": 0, + "cgst": 0, + "cess": 0, + "igst": 183, + "txval": 12200, + "rev": "N", + "itcavl": "Y", + "pos": "23", + "typ": "R", + "inum": "doc1", + "rsn": "", + "srctyp": "e-Invoice", + "irn": "897ADG56RTY78956HYUG90BNHHIJK453GFTD99845672FDHHHSHGFH4567FG56TR", + "irngendate": "24-12-2019" + } + ], + "trdnm": "GSTN", + "supfildt": "26-08-2023", + "supprd": "012023", + "ctin": "07USERR0205A1ZS" + }, + { + "inv": [ + { + "dt": "01-05-2023", + "val": 234324234, + "sgst": 0, + "cgst": 0, + "cess": 0, + "igst": 183, + "txval": 12200, + "rev": "N", + "itcavl": "Y", + "pos": "23", + "typ": "R", + "inum": "E123", + "rsn": "", + "srctyp": "e-Invoice", + "irn": "897ADG56RTY78956HYUG90BNHHIJK453GFTD99845672FDHHHSHGFH4567FG56TR", + "irngendate": "24-12-2019" + } + ], + "trdnm": "GSTN", + "supfildt": "26-08-2023", + "supprd": "052023", + "ctin": "07USERR0205A1ZS" + } + ], + "itcrev": [ + { + "b2b": [ + { + "ctin": "01AABCE2207R1Z5", + "trdnm": "GSTN", + "supfildt": "18-11-2019", + "supprd": "112019", + "inv": [ + { + "inum": "S008400", + "typ": "R", + "dt": "24-11-2016", + "val": 729248.16, + "pos": "06", + "rev": "N", + "itcavl": "N", + "rsn": "P", + "diffprcnt": 1, + "srctyp": "e-Invoice", + "irn": "897ADG56RTY78956HYUG90BNHHIJK453GFTD99845672FDHHHSHGFH4567FG56TR", + "irngendate": "24-12-2019" + } + ] + } + ], + "b2ba": [ + { + "ctin": "01AABCE2207R1Z5", + "trdnm": "GSTN", + "supfildt": "18-11-2019", + "supprd": "112019", + "inv": [ + { + "oinum": "S008400", + "oidt": "24-11-2016", + "inum": "S008400", + "typ": "R", + "dt": "24-11-2016", + "val": 729248.16, + "pos": "06", + "rev": "N", + "itcavl": "N", + "rsn": "P", + "diffprcnt": 1 + } + ] + } + ], + "cdnr": [ + { + "ctin": "01AAAAP1208Q1ZS", + "trdnm": "GSTN", + "supfildt": "18-11-2019", + "supprd": "112019", + "nt": [ + { + "ntnum": "533515", + "typ": "D", + "suptyp": "R", + "dt": "23-09-2016", + "val": 729248.16, + "pos": "01", + "rev": "N", + "itcavl": "N", + "rsn": "C", + "diffprcnt": 1, + "srctyp": "e-Invoice", + "irn": "897ADG56RTY78956HYUG90BNHHIJK453GFTD99845672FDHHHSHGFH4567FG56TR", + "irngendate": "24-12-2019" + } + ] + } + ], + "cdnra": [ + { + "ctin": "01AAAAP1208Q1ZS", + "trdnm": "GSTN", + "supfildt": "18-11-2019", + "supprd": "112019", + "nt": [ + { + "onttyp": "D", + "ontnum": "533515", + "ontdt": "23-09-2016", + "ntnum": "533515", + "typ": "D", + "suptyp": "R", + "dt": "23-09-2016", + "val": 729248.16, + "pos": "01", + "rev": "N", + "itcavl": "N", + "rsn": "C", + "diffprcnt": 1 + } + ] + } + ] + } ] } } diff --git a/india_compliance/gst_india/utils/gstr_2/gstr.py b/india_compliance/gst_india/utils/gstr_2/gstr.py index f9979cc59..a5a4384bb 100644 --- a/india_compliance/gst_india/utils/gstr_2/gstr.py +++ b/india_compliance/gst_india/utils/gstr_2/gstr.py @@ -128,7 +128,7 @@ def get_invoice_details(self, invoice): def get_transaction_items(self, invoice): return [ self.get_transaction_item(frappe._dict(item)) - for item in invoice.get(self.get_key("items_key")) + for item in invoice.get(self.get_key("items_key"), []) ] def get_transaction_item(self, item): diff --git a/india_compliance/gst_india/utils/gstr_2/gstr_2b.py b/india_compliance/gst_india/utils/gstr_2/gstr_2b.py index 1e9b348b1..47f166745 100644 --- a/india_compliance/gst_india/utils/gstr_2/gstr_2b.py +++ b/india_compliance/gst_india/utils/gstr_2/gstr_2b.py @@ -19,23 +19,22 @@ def get_supplier_details(self, supplier): "sup_return_period": supplier.supprd, } - def get_transaction_item(self, item): - return { - "item_number": item.num, - "rate": item.rt, - "taxable_value": item.txval, - "igst": item.igst, - "cgst": item.cgst, - "sgst": item.sgst, - "cess": item.cess, - } + def get_transaction_items(self, invoice): + return [ + { + "taxable_value": invoice.txval, + "igst": invoice.igst, + "cgst": invoice.cgst, + "sgst": invoice.sgst, + "cess": invoice.cess, + } + ] class GSTR2bB2B(GSTR2b): def setup(self): super().setup() self.set_key("invoice_key", "inv") - self.set_key("items_key", "items") def get_invoice_details(self, invoice): return { @@ -132,10 +131,6 @@ def get_invoice_details(self, invoice): "document_value": invoice.igst + invoice.cgst + invoice.sgst + invoice.cess, } - # item details are included in invoice details - def get_transaction_items(self, invoice): - return [self.get_transaction_item(invoice)] - class GSTR2bISDA(GSTR2bISD): def get_invoice_details(self, invoice): @@ -168,10 +163,6 @@ def get_invoice_details(self, invoice): "itc_availability": "Yes", # always available } - # item details are included in invoice details - def get_transaction_items(self, invoice): - return [self.get_transaction_item(invoice)] - class GSTR2bIMPG(GSTR2bIMPGSEZ): def get_supplier_details(self, supplier): diff --git a/india_compliance/gst_india/utils/gstr_2/test_gstr_2b.py b/india_compliance/gst_india/utils/gstr_2/test_gstr_2b.py index 47f2a14cb..6d2f69720 100644 --- a/india_compliance/gst_india/utils/gstr_2/test_gstr_2b.py +++ b/india_compliance/gst_india/utils/gstr_2/test_gstr_2b.py @@ -60,12 +60,10 @@ def test_gstr2b_b2b(self): "doc_type": "Invoice", "items": [ { - "item_number": 1, - "rate": 5, - "taxable_value": 400, - "igst": 0, - "cgst": 200, - "sgst": 200, + "taxable_value": 12200, + "igst": 183, + "cgst": 0, + "sgst": 0, "cess": 0, } ], @@ -100,12 +98,10 @@ def test_gstr2b_b2ba(self): "doc_type": "Invoice", "items": [ { - "item_number": 1, - "rate": 5, - "taxable_value": 400, - "igst": 0, - "cgst": 200, - "sgst": 200, + "taxable_value": 12200, + "igst": 183, + "cgst": 0, + "sgst": 0, "cess": 0, } ], @@ -140,10 +136,8 @@ def test_gstr2b_cdnr(self): "doc_type": "Credit Note", "items": [ { - "item_number": 1, - "rate": 5, - "taxable_value": 400, - "igst": 400, + "taxable_value": 12200, + "igst": 183, "cgst": 0, "sgst": 0, "cess": 0, @@ -178,12 +172,10 @@ def test_gstr2b_cdnra(self): "doc_type": "Credit Note", "items": [ { - "item_number": 1, - "rate": 5, - "taxable_value": 400, - "igst": 0, - "cgst": 200, - "sgst": 200, + "taxable_value": 12200, + "igst": 183, + "cgst": 0, + "sgst": 0, "cess": 0, } ],