Erpnext: Prepare ERPNext for GST India

Created on 5 May 2017  路  15Comments  路  Source: frappe/erpnext

Phase 1

  • [ ] State Doctype to have state code and state name https://bitbucket.org/mntechnique/gst_api/raw/3e9af570eb86600bd0a81c8ebad2c103dcb88c63/gst_api/fixtures/gst_india_state.json
  • [x] Add link to State doctype in Address, Warehouse Address

    • [ ] Copy Address from selected link to address_display (small text/html)

  • [x] Add HSN Code Doctype to record Category and code https://bitbucket.org/mntechnique/gst_api/raw/3e9af570eb86600bd0a81c8ebad2c103dcb88c63/gst_api/fixtures/hsn_code.json
  • [x] Link to HSN code in Item master
  • [x] PAN to be added for all customers / suppliers https://github.com/frappe/erpnext/issues/8373
  • [x] GSTIN to be added for company, Address and Warehouse
  • [ ] Default tax account and template for SGST/CGST/IGST/UGST for Intra/Inter State
  • [ ] In transactions, based on based on first 2 digits of source and target GSTIN, identify intra/inter state and accordingly set tax template.
  • [x] Prepare data for GSTR1 Sales Invoice (Item-wise Sales Register)
  • [x] Prepare data for GSTR2 Purchase Invoice (Item-wise Purchase Register)
  • [ ] Prepare data for GSTR6 Input service distributors (Purchase Invoice for services)
  • [ ] Prepare data for GSTR8 Annual Returns
  • [ ] Reconciliation Tool for GSTR2A and Item-wise Purchase Register
  • [ ] Manual Export of data via reports so that users can export xls, csv and submit it to their Auditors/Tax consultants
  • [ ] GST on charges like transport, packing etc (Maintain Item for such charges as it has HSN codes and should be submitted in GSTR1 as line item)
  • [x] Validation for GSTIN

    • should be alphanumeric, 15 digits and first 2 digits should be state code

  • [x] Add HSN Code on Sales/Purchase Invoice Item and item-wise sales/purchase register
  • [ ] GST for stock transfer

    • via Stock Entry

    • Introduce tax table, item-wise tax calculation

    • Fetch Addresses from Warehouse

    • Validate that source and target warehouse belong to one state respectively

  • [x] Patch

    • Remove standard tax_id field from Supplier and create custom field where data exists

    • Create State record based on value in Address

    • Remove address fields from warehouse and patch to create address records

Phase 2

  • [ ] Field to record GST Portal Username (The taxpayer who has registered on portal with a mobile number, otp will be sent to this number/username)
  • [ ] Prepare Payload for GSP integration

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
    }
  ]
}
Accounts

Most helpful comment

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..

All 15 comments

+1

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.

  • If B2B
  • If B2C
  • If Invoice > 2.5 lakh
  • If POS
  • If Export
  • If Inter State
  • If Intra State
  • If advance
  • If good is returned
  • if ecommerce transaction
    etc...

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?

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..

Here are my inputs:

  • Separation of taxes and charges template, since GST requires amount before taxes and after charges to be mentioned in GSTR1.
  • A report for reconciling electronic ledger maintained by govt. with our books. In case of mismatch, an option to notify the supplier of the mismatch.

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.

  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

@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.

@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).

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

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}

Closing this. Please create specific issues.

Does the the GSTR1 export to JSON work?

Does the the GSTR1 export to JSON work?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cradford picture cradford  路  4Comments

royalhospital picture royalhospital  路  4Comments

nabinhait picture nabinhait  路  4Comments

gbard picture gbard  路  4Comments

mubeenmazhar picture mubeenmazhar  路  4Comments