frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
21.21k stars 7.25k forks source link

Prepare ERPNext for GST India #8711

Closed revant closed 7 years ago

revant commented 7 years ago

Phase 1

Phase 2

e.g GSTR1 Payload (GSP - GST Server)

{
  "gstin": "27AHQPA7588L1ZJ",
  "fp": "122016",
  "gt": 3782969.01,
  "b2b": [
    {
      "ctin": "01AABCE2207R1Z5",
      "inv": [
        {
          "inum": "S008400",
          "idt": "24-11-2016",
          "val": 729248.16,
          "pos": "06",
          "rchrg": "N",
          "prs": "Y",
          "od_num": "DR008400",
          "od_dt": "20-11-2016",
          "etin": "01AABCE5507R1Z4",
          "itms": [
            {
              "num": 1,
              "itm_det": {
                "ty": "G",
                "hsn_sc": "G1221",
                "txval": 10000,
                "irt": 3,
                "iamt": 833.33,
                "crt": 4,
                "camt": 500,
                "srt": 5,
                "samt": 900,
                "csrt": 2,
                "csamt": 500
              }
            }
          ]
        }
      ]
    }
  ],
  "b2ba": [
    {
      "ctin": "01AABCE2207R1Z5",
      "inv": [
        {
          "oinum": "S008400",
          "oidt": "24-11-2016",
          "inum": "S008400",
          "idt": "24-11-2016",
          "val": 729248.16,
          "pos": "06",
          "rchrg": "N",
          "prs": "Y",
          "od_num": "DR008400",
          "od_dt": "20-11-2016",
          "etin": "01AABCE5507R1Z4",
          "itms": [
            {
              "num": 1,
              "itm_det": {
                "ty": "G",
                "hsn_sc": "G1221",
                "txval": 10000,
                "irt": 3,
                "iamt": 833.33,
                "crt": 4,
                "camt": 500,
                "srt": 5,
                "samt": 900,
                "csrt": 2,
                "csamt": 500
              }
            }
          ]
        }
      ]
    }
  ],
  "b2cl": [
    {
      "state_cd": "05",
      "inv": [
        {
          "cname": "R_Glasswork Enterprise",
          "inum": "B129840",
          "idt": "14-04-2016",
          "val": 1000.03,
          "pos": "06",
          "prs": "Y",
          "od_num": "DR008400",
          "od_dt": "20-11-2016",
          "etin": "27AHQPA8875L1ZU",
          "itms": [
            {
              "num": 1,
              "itm_det": {
                "ty": "S",
                "hsn_sc": "S249",
                "txval": 10000,
                "irt": 3,
                "iamt": 833.33,
                "csrt": 2,
                "csamt": 500
              }
            }
          ]
        }
      ]
    }
  ],
  "b2cla": [
    {
      "state_cd": "05",
      "inv": [
        {
          "oinum": "9266",
          "oidt": "10-02-2016",
          "cname": "Glass store shop",
          "inum": "92661",
          "idt": "10-01-2016",
          "val": 784586.33,
          "pos": "01",
          "prs": "N",
          "od_num": "DR008400",
          "od_dt": "20-11-2016",
          "etin": "27AHQPA8875L1ZU",
          "itms": [
            {
              "num": 1,
              "itm_det": {
                "ty": "S",
                "hsn_sc": "S2469",
                "txval": 10000,
                "irt": 3,
                "iamt": 833.33,
                "csrt": 2,
                "csamt": 500
              }
            }
          ]
        }
      ]
    }
  ],
  "b2cs": [
    {
      "state_cd": "05",
      "ty": "G",
      "hsn_sc": "G2469",
      "txval": 10000,
      "irt": 3,
      "iamt": 500,
      "crt": 4,
      "camt": 500,
      "srt": 5,
      "samt": 900,
      "csrt": 3,
      "csamt": 833,
      "prs": "Y",
      "od_num": "DR008400",
      "od_dt": "20-11-2016",
      "etin": "20ABCDE7588L1ZJ",
      "typ": "E"
    }
  ],
  "b2csa": [
    {
      "omon": "122016",
      "oty": "S",
      "ohsn_sc": "S2811",
      "osupst_cd": "05",
      "ty": "G",
      "hsn_sc": "G811",
      "state_cd": "05",
      "txval": 10000,
      "irt": 3,
      "iamt": 500,
      "crt": 4,
      "camt": 500,
      "srt": 5,
      "samt": 900,
      "csrt": 3,
      "csamt": 833,
      "prs": "Y",
      "od_num": "DR008400",
      "od_dt": "20-11-2016",
      "etin": "20ABCDE7588L1ZJ",
      "typ": "E"
    }
  ],
  "cdnr": [
    {
      "ctin": "01AAAAP1208Q1ZS",
      "nt": [
        {
          "ntty": "C",
          "nt_num": "533515",
          "nt_dt": "23-09-2016",
          "rsn": "Not mentioned",
          "inum": "915914",
          "idt": "23-09-2016",
          "rchrg": "N",
          "val": 10000,
          "irt": 3,
          "iamt": 833.33,
          "crt": 4,
          "camt": 500,
          "srt": 5,
          "samt": 900,
          "csrt": 2,
          "csamt": 500,
          "etin": "01AAAAP1208Q1Z7"
        }
      ]
    }
  ],
  "cdnra": [
    {
      "ctin": "01AAAAP1208Q1ZS",
      "nt": [
        {
          "ntty": "C",
          "rsn": "Not mentioned",
          "ont_num": "533515",
          "ont_dt": "23-09-2016",
          "nt_num": "533515",
          "nt_dt": "23-09-2016",
          "inum": "915914",
          "idt": "23-09-2016",
          "rchrg": "N",
          "val": 5225.28,
          "irt": 3,
          "iamt": 833.33,
          "crt": 4,
          "camt": 500,
          "srt": 5,
          "samt": 900,
          "csrt": 2,
          "csamt": 500,
          "etin": "01AAAAP1208Q1Z7"
        }
      ]
    }
  ],
  "at": [
    {
      "typ": "B2B",
      "cpty": "12DEFPS5555D1Z2",
      "state_cd": "12",
      "doc_num": "100001",
      "doc_dt": "10-03-2016",
      "itms": [
        {
          "ty": "S",
          "hsn_sc": "S9043",
          "ad_amt": 100,
          "irt": 3,
          "iamt": 833.33,
          "crt": 4,
          "camt": 500,
          "srt": 5,
          "samt": 900,
          "csrt": 2,
          "csamt": 500
        }
      ]
    }
  ],
  "ata": [
    {
      "typ": "B2B",
      "ocpty": "R_Glasswork Enterprise",
      "odoc_num": "A100001",
      "odoc_dt": "10-03-2016",
      "cpty": "Glasswork Enterprise",
      "state_cd": "12",
      "doc_num": "100001",
      "doc_dt": "10-03-2016",
      "itms": [
        {
          "ty": "S",
          "hsn_sc": "S9043",
          "ad_amt": 10,
          "irt": 3,
          "iamt": 833.33,
          "crt": 4,
          "camt": 500,
          "srt": 5,
          "samt": 900,
          "csrt": 2,
          "csamt": 500
        }
      ]
    }
  ],
  "exp": [
    {
      "ex_tp": "WPAY",
      "inv": [
        {
          "inum": "81542",
          "idt": "12-02-2016",
          "val": 995048.36,
          "sbpcode": "ASB9950",
          "sbnum": "84298",
          "sbdt": "04-10-2016",
          "prs": "Y",
          "od_num": "DR008400",
          "od_dt": "20-11-2016",
          "itms": [
            {
              "ty": "G",
              "hsn_sc": "G9207",
              "txval": 10000,
              "irt": 3,
              "iamt": 833.33,
              "crt": 4,
              "camt": 500,
              "srt": 5,
              "samt": 900,
              "csrt": 2,
              "csamt": 500
            }
          ]
        }
      ]
    }
  ],
  "expa": [
    {
      "ex_tp": "WPAY",
      "inv": [
        {
          "oinum": "81542",
          "oidt": "12-02-2016",
          "inum": "815421",
          "idt": "22-02-2016",
          "val": 995048.36,
          "sbpcode": "ASB9950",
          "sbnum": "84298",
          "sbdt": "04-10-2016",
          "prs": "Y",
          "od_num": "DR008400",
          "od_dt": "20-11-2016",
          "itms": [
            {
              "ty": "G",
              "hsn_sc": "G9207",
              "txval": 10000,
              "irt": 3,
              "iamt": 833.33,
              "crt": 4,
              "camt": 500,
              "srt": 5,
              "samt": 900,
              "csrt": 2,
              "csamt": 500
            }
          ]
        }
      ]
    }
  ],
  "nil": [
    {
      "g": [
        {
          "sply_ty": "INTRB2B",
          "expt_amt": 123.45,
          "nil_amt": 1470.85,
          "ngsup_amt": 1258.5
        },
        {
          "sply_ty": "INTRB2C",
          "expt_amt": 123.45,
          "nil_amt": 1470.85,
          "ngsup_amt": 1258.5
        },
        {
          "sply_ty": "INTRAB2B",
          "expt_amt": 123.45,
          "nil_amt": 1470.85,
          "ngsup_amt": 1258.5
        },
        {
          "sply_ty": "INTRAB2C",
          "expt_amt": 123.45,
          "nil_amt": 1470.85,
          "ngsup_amt": 1258.5
        }
      ],
      "s": [
        {
          "sply_ty": "INTRB2B",
          "expt_amt": 123.45,
          "nil_amt": 1470.85,
          "ngsup_amt": 1258.5
        },
        {
          "sply_ty": "INTRB2C",
          "expt_amt": 123.45,
          "nil_amt": 1470.85,
          "ngsup_amt": 1258.5
        },
        {
          "sply_ty": "INTRAB2B",
          "expt_amt": 123.45,
          "nil_amt": 1470.85,
          "ngsup_amt": 1258.5
        },
        {
          "sply_ty": "INTRAB2C",
          "expt_amt": 123.45,
          "nil_amt": 1470.85,
          "ngsup_amt": 1258.5
        }
      ]
    }
  ],
  "hsn": [
    {
      "data": [
        {
          "num": 1,
          "ty": "G",
          "hsn_sc": "1009",
          "txval": 10.23,
          "irt": 12.52,
          "iamt": 14.52,
          "crt": 78.52,
          "camt": 78.52,
          "srt": 12.34,
          "samt": 12.9,
          "csrt": 2,
          "csamt": 500,
          "desc": "Goods Description",
          "uqc": "1",
          "qty": 2.05,
          "sply_ty": "INTRB2B"
        }
      ]
    }
  ],
  "txpd": [
    {
      "typ": "B2B",
      "cpty": "27ABCDE7588L1ZJ",
      "inum": "533515",
      "idt": "20-10-2016",
      "doc_num": "533515",
      "doc_dt": "23-09-2016",
      "irt": 3,
      "iamt": 833.33,
      "crt": 4,
      "camt": 500,
      "srt": 5,
      "samt": 900,
      "csrt": 2,
      "csamt": 500
    }
  ]
}
jk2081 commented 7 years ago

+1

felixvarghese commented 7 years ago

I think we should consider breaking this into multiple issues and grouping them into a Milestone.

The reason is, certain points are quite a bit more difficult to calculate than others, and will require discussion. At the very least, the GSTR formats are actually quite complicated.

For example, here is an (older) sample of the GSTR1 format to download: http://files.caknowledge.in/download/gstr-1-form-outward-supplies-made-taxpayer/. There is a tremendous amount of logic involved to correctly prepare the return. We'll have to define the logic in ERPNext terms, and also hopefully have a CA validate it.

revant commented 7 years ago

I'll separate issues Anyone can help me separate and reference them here?

My interpretation

B2B : Supplier / Customer has GSTIN, B2Ba and B2B seems to be related by order number and invoice number B2Cs : no GSTIN, under 2.5 lakh to be shown aggregate B2Cl : no GSTIN shown separate invoices POS is place of sale/service, inter state and intra state is GSP/GST responsibility, entering pos and state_cd is enough for accounting / ERP software export : multi currency?

sagarvora commented 7 years ago

Hi, maybe we should add add Tax ID (GST TIN) to Address doctype instead of customer / supplier.. this will help in the case where a customer / supplier (for ex. MNC) has multiple units in multiple states..

vorasmit commented 7 years ago

Here are my inputs:

vorasmit commented 7 years ago

Hi, I have come across the provisions for GST on advance payments. And reduced GST on invoice to the extent advance received.

http://www.caclubindia.com/articles/please-note-gst-has-to-be-paid-on-advance--29973.asp

Hope this link helps.

adityaduggal commented 7 years ago
  1. State doctype can be added to the main repo since this is needed for GST implementation:

https://github.com/adityaduggal/rohit-common/tree/master/rohit_common/rohit_common/doctype/state

  1. Address doctype should have 2 fields GSTIN and PAN as per the custom json:

https://github.com/adityaduggal/rohit-common/blob/master/rohit_common/rohit_common/custom/address.json#L52-L149

Please note that having GSTIN in customer or supplier master would not give the option to have multiple locations for a customer in different states since different locations in different states would have different GSTIN numbers

  1. Validate the GSTIN number, currently it does not check the check digit logic but including that would also be great:

https://github.com/adityaduggal/rohit-common/blob/master/rohit_common/rohit_common/validations/address.py#L23-L41

I have also included this post in the github issue number 8711

PawanMeh commented 7 years ago

@adityaduggal , with reference to multiple GSTIN numbers wouldn't the legal entity be different ? Which could imply Customer Name or Supplier Name would be different?

If multiple GSTINs are allowed for same legal entity then putting GSTIN at address level may make sense. Not sure about this scenario but would wait for more feedback from community on this.

felixvarghese commented 7 years ago

@PawanMeh Nope. Apparently, we're supposed to register for a GSTIN in EACH state we are liable to pay GST in. So, if we operate in 2 states where we are liable, then we have two GSTINS (even though we only have one PAN and are one entity).

revant commented 7 years ago

Developer Portal : http://developer.gstsystem.co.in/apiportal/ Refer for API Payload (Phase 2)

revant commented 7 years ago

GSTIN of the Tax Payer .Regular Expression used for GSTIN validation is [0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[Z]{1}[0-9a-zA-Z]{1}

sagarvora commented 7 years ago
rmehta commented 7 years ago

Closing this. Please create specific issues.

sherifmayika commented 6 years ago

Does the the GSTR1 export to JSON work?

sherifmayika commented 6 years ago

Does the the GSTR1 export to JSON work?