AI Bill-to-GRN Creation - Technical Documentation

AI Bill-to-GRN Creation - Technical Documentation

Overview

The AI Bill-to-GRN Creation feature enables users to create Goods Received Notes (GRN) by entering a natural language prompt (e.g., “Create GRN for indent number 1234”) with an optional vendor bill PDF upload. The system uses AI to:

  1. Parse the prompt and extract indent information
  2. Extract data from uploaded PDF (PO Number, Supplier Bill No, Date, Notes)Need to discuss only specific information we will show or everything in Bill
  3. Display a unified GRN preview for review (with PDF data shown to user)
  4. User reviews and decides what to use
  5. User confirms → GRN Created
  6. From created GRN, user can create BILL (separate action)

This follows the same approach as AI Invoice Creation - using existing validations and extending methods.

This is a two-step process:

  • Step 1: Create GRN from Indent (with optional PDF data shown for reference)
  • Step 2: Create Bill from GRN (user navigates to Bill creation separately)

Page Structure

1. Input Section (Always Visible)

  • Prompt Text Field: Multi-line input for natural language prompt
  • Auto-suggestions: Popover with prompt suggestions based on AI category “GrnCreation”
  • PDF Upload: File upload (.pdf, mandatory for this feature)
  • Buttons:
    • Reset: Clears the form
    • Analyze & Preview: Initiates AI processing

2. GRN Preview Section (Appears after AI processing)

  • PDF Data Display: Shows extracted PDF data to user for their reference
    • User decides what to use
    • No forced matching/validation
  • Header Card (Editable):
    • Party Details
    • Business Unit
    • GRN Type
    • Transporter
    • Store
    • Challan Information (Challan No, Date)
    • Notes (from PDF extraction if available)
  • Lines Table: Indent items with editable ChallanQty/GrnQty
  • Action: Confirm & Create GRN

3. After GRN Created

  • Shows success message with GRN Number
  • User can navigate to Bill creation for the created GRN

User Interactions Flow

┌─────────────────────┐
│  User enters        │
│  prompt + uploads   │
│  PDF                │
└──────────┬──────────┘
           │
           ▼
┌─────────────────────┐
│  Click "Analyze &   │
│  Preview"          │
└──────────┬──────────┘
           │
           ▼
┌─────────────────────┐     ┌─────────────────────┐
│  AI extracts        │────▶│  Display error      │
│  Indent No from     │     │  if invalid         │
│  prompt             │     │  (no indent found)  │
└──────────┬──────────┘     └─────────────────────┘
           │
           ▼
┌─────────────────────┐
│  Fetch Indent data  │
│  from database      │
└──────────┬──────────┘
           │
           ▼
┌─────────────────────┐
│  Extract PDF data   │
│  (shown to user)   │
└──────────┬──────────┘
           │
           ▼
┌─────────────────────┐
│  Display GRN        │
│  Preview Section    │
│  (with PDF data    │
│   for reference)   │
└──────────┬──────────┘
           │
           ▼
┌─────────────────────┐
│  User edits:        │
│  - Challan No      │
│  - Challan Date    │
│  - Quantities      │
│  - Notes           │
│  (User decides     │
│   what to use)     │
└──────────┬──────────┘
           │
           ▼
┌─────────────────────┐
│  Click "Create GRN" │
└──────────┬──────────┘
           │
           ▼
┌─────────────────────┐     ┌─────────────────────┐
│  Server-side        │────▶│  Show validation    │
│  validation         │     │  errors            │
└──────────┬──────────┘     └─────────────────────┘
           │ (valid)
           ▼
┌─────────────────────┐
│  GRN Created!      │
│  Show success msg   │
│  + GRN Number      │
└──────────┬──────────┘
           │
           ▼
┌─────────────────────┐
│  User clicks        │
│  "Create Bill"     │
│  (separate page)   │
└──────────┬──────────┘
           │
           ▼
┌─────────────────────┐
│  Navigate to        │
│  Bill Creation     │
└─────────────────────┘