Skip to content

feat: E-Way Bill JSON Generator Integration (GST Portal Compatible) #378

Description

@tbhatia2006

Problem statement

Add a fully integrated E-Way Bill JSON Generator within the Invoice PDF Preview screen.

Proposed solution

E-Way Bill JSON Generator Integration (GST Portal Compatible)

Objective

Add a fully integrated E-Way Bill JSON Generator within the Invoice PDF Preview screen.

The system will generate a GST/NIC compliant E-Way Bill JSON file from invoice data and allow users to manually upload the generated JSON on the E-Way Bill portal.

No NIC API integration is required.

Workflow:

Invoice → Generate E-Way JSON → Download JSON → Upload on E-Way Portal

The generated JSON must follow the latest NIC Bulk E-Way Bill schema and should be accepted by the GST E-Way Portal.


UI Integration

Invoice PDF Preview

Add a new button:

  • Print
  • Download PDF
  • Share
  • Generate E-Way Bill

Place the Generate E-Way Bill button beside Download PDF.


Visibility Rules

Show button only when:

  • Invoice Type = Tax Invoice
  • Invoice Status = Saved
  • GST Enabled = True

Hide for:

  • Quotation
  • Estimate
  • Proforma Invoice
  • Purchase Order

Workflow

Invoice Created

Invoice Saved

PDF Preview

Generate E-Way Bill

System Validates Invoice Against NIC Schema

Missing Fields Identified

Single E-Way Bill Details Form Opens

User Completes Missing Information

Review Screen

Generate JSON

Download JSON


Smart Missing Data Detection

When user clicks Generate E-Way Bill:

System must:

  1. Read invoice data.
  2. Read business profile.
  3. Read customer profile.
  4. Compare against all mandatory NIC EWB attributes.
  5. Identify missing fields.
  6. Ask only for missing information.

Do not ask for fields already available.

Example:

Available:

✓ Seller GSTIN
✓ Seller Address
✓ Buyer GSTIN
✓ Buyer Address

Missing:

✗ Vehicle Number
✗ Distance
✗ Transport Mode

Show only those missing fields.


Single E-Way Bill Details Tab

All missing information should appear in ONE consolidated screen.

No multi-step wizard.

Sections:

Seller Details

  • GSTIN
  • Trade Name
  • Address Line 1
  • Address Line 2
  • Place
  • State Code
  • Pincode

Buyer Details

  • GSTIN
  • Trade Name
  • Address Line 1
  • Address Line 2
  • Place
  • State Code
  • Pincode

Document Details

  • Document Type
  • Document Number
  • Document Date

Supply Details

Supply Type

Default:

Outward

Options:

  • Outward
  • Inward

Sub Supply Type

Options:

  • Supply
  • Import
  • Export
  • Job Work
  • For Own Use
  • Sales Return
  • Exhibition
  • Line Sales
  • Others

If Others:

Show:

Sub Supply Description

Mandatory.


Transport Details

Transport Mode

Options:

1 Road
2 Rail
3 Air
4 Ship

Vehicle Number

Distance (KM)

Transporter GSTIN

Transporter Name

Vehicle Type

Default:

R


Saved Transporter Profiles

The system should remember transporter details.

Store:

  • Transporter Name
  • Transporter GSTIN
  • Transport Mode
  • Vehicle Type

When generating future E-Way Bills:

Auto-fill saved transporter details.


Edit Saved Transporter Details

Always provide:

[ Edit Transport Details ]

even when transporter details are prefilled.

User may modify:

  • Transporter Name
  • Transporter GSTIN
  • Transport Mode
  • Vehicle Type
  • Distance
  • Vehicle Number

Save As Default Option

After editing transporter details:

Display:

☐ Save as Default Transporter

If checked:

Update saved transporter profile.

If unchecked:

Apply only to current E-Way Bill.


Multiple Transporters Support

Provide transporter management.

Dropdown:

Select Transporter

Options:

  • ABC Logistics
  • XYZ Transport
  • Fast Cargo

Buttons:

  • Add New
  • Edit

This allows users to switch transporters easily.


Vehicle Number Handling

Vehicle Number should never be permanently reused automatically without user review.

Always allow editing before JSON generation.


Item Validation

Each item must contain:

  • Product Name
  • Product Description
  • HSN Code
  • Quantity
  • Unit
  • Taxable Value
  • Tax Rates

If any item lacks HSN:

Prevent JSON generation.

Display error.


Validation Rules

Before Generate JSON:

Validate:

GSTIN

Valid GSTIN format.

State Code

Valid GST State Code.

Pincode

6 digits.

Distance

Numeric value.

Vehicle Number

Valid Indian vehicle format.

Invoice Date

DD/MM/YYYY

Tax Values

Numeric.

HSN

Mandatory on all items.

Mandatory Fields

No blank NIC mandatory fields allowed.


Review Screen

Before JSON generation display:

Seller Details

Buyer Details

Supply Details

Transport Details

Tax Summary

Item Summary

Buttons:

  • Back
  • Edit
  • Generate JSON

JSON Structure

Generate NIC compliant EWB JSON.

Structure:

{
"version": "1.0.1118",
"billLists": [
{
...
}
]
}

One invoice = one billLists object.


Mapping

Header

userGstin → Seller GSTIN

supplyType → O

subSupplyType → User Selection

docType → INV

docNo → Invoice Number

docDate → Invoice Date


Seller

fromGstin

fromTrdName

fromAddr1

fromAddr2

fromPlace

fromPincode

actFromStateCode

fromStateCode


Buyer

toGstin

toTrdName

toAddr1

toAddr2

toPlace

toPincode

actToStateCode

toStateCode


Tax

totalValue

cgstValue

sgstValue

igstValue

cessValue

totInvValue


Transport

transMode

transporterId

transporterName

transDistance

vehicleNo

vehicleType


Item List

Each invoice item becomes:

{
"productName":"",
"productDesc":"",
"hsnCode":"",
"quantity":0,
"qtyUnit":"",
"taxableAmount":0,
"cgstRate":0,
"sgstRate":0,
"igstRate":0,
"cessRate":0
}


Download

After successful generation:

Auto-download:

EWB_.json

Example:

EWB_INV000123.json

Display:

"E-Way Bill JSON generated successfully. Upload this file on the GST E-Way Bill Portal."


Technical Requirements

  • Do not modify existing invoice generation logic.
  • Reuse invoice/customer/business master data wherever possible.
  • Generate JSON from a centralized EWB schema mapping.
  • Follow the attributes defined in EWB_Attributes_new.xlsx.
  • UTF-8 encoded JSON output.
  • Prevent generation if mandatory NIC fields are missing.
  • Future NIC schema updates should require only schema mapping updates and not UI rewrites.
  • JSON must be accepted by the GST E-Way Bill Portal without manual editing.

Alternatives considered

No response

Impact

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions