Back to ER Diagram
Receiving & Inspection

Receiving & Inspection Logic

Goods Receipt Note (GRN) processing, quality inspection, three-way match (PO-GRN-Invoice), and debit note management.

PostgreSQL
6 Tables
Schema: receiving
3-Way Match

Overview

The Receiving module handles material receipt at project stores. When materials arrive, a GRN is created referencing the PO. Quality inspection is performed per Material Inspection Plan. Accepted quantities update inventory stock. The three-way match engine validates PO quantity, GRN received quantity, and Invoice billed quantity before payment approval. Debit notes handle short receipts, rejections, and price discrepancies.


Material Arrival

Create GRN

Quality Check

3-Way Match

Update Stock
6
Receiving Tables
100%
Inspection Coverage
Auto
3-Way Match
Real-time
Stock Update

Status States

StatusDescriptionAllowed ActionsNext States
DraftGRN created, pending inspectionAdd Lines, Edit QtyUnder Inspection
Under InspectionQuality team inspecting materialPass, Fail, PartialAccepted, Rejected
AcceptedMaterial passed inspectionUpdate Stock, Match InvoiceMatched
RejectedMaterial failed quality checkCreate Debit Note, Return
Matched3-way match completed successfullyProcess Payment
PartialSome items accepted, some rejectedSplit GRN, Debit NoteAccepted

Database Schema

receiving.grn

  • grn_id — PK, goods receipt note header
  • po_id — FK → procurement.purchase_order
  • vendor_id — FK → vendor.vendor_master
  • grn_number, grn_date — Document tracking
  • store_id — FK → inventory.store (receiving location)
  • status, received_by — Lifecycle and user tracking

receiving.grn_line

  • line_id — PK
  • grn_id — FK → receiving.grn
  • po_line_id — FK → procurement.po_line
  • ordered_qty, received_qty, accepted_qty, rejected_qty — Quantity breakdown
  • rejection_reason — Free text for failed items

receiving.quality_inspection

  • inspection_id — PK
  • grn_line_id — FK → receiving.grn_line
  • inspection_type — visual | dimensional | lab_test | functional
  • result — pass | fail | conditional
  • inspector_id — FK → admin.user
  • remarks, test_report_url — Observations and reports

receiving.three_way_match

  • match_id — PK
  • po_id, grn_id, invoice_id — FK references for 3-way match
  • po_qty, grn_qty, invoice_qty — Quantities from each document
  • match_status — matched | qty_variance | price_variance
  • tolerance_pct — Configurable variance threshold

receiving.debit_note

  • dn_id — PK, debit note for rejections/shortages
  • grn_id — FK → receiving.grn
  • vendor_id — FK → vendor.vendor_master
  • dn_amount, reason_code — Financial impact and categorization
  • status — Draft → Submitted → Acknowledged

Receiving Process

1

GRN Creation

Store keeper creates GRN when material arrives. References PO for expected items and quantities. Records actual received quantities, delivery challan number, and vehicle details.

2

Quality Inspection

Quality team inspects each GRN line item per Material Inspection Plan. Visual, dimensional, or lab tests as applicable. Results recorded with pass/fail/conditional status.

3

Accept/Reject

Accepted quantities update inventory stock ledger via stock transaction. Rejected quantities flagged with reason. Debit note created for rejected/short-received material.

4

Three-Way Match

System compares PO ordered qty, GRN received qty, and Invoice billed qty. If all three match within tolerance (default ±2%), invoice approved for payment. Variances flagged for review.

5

Debit Note Processing

For rejections, shortages, or price variances, debit note issued to vendor. Vendor acknowledges and either replaces material or accepts credit adjustment.

Receiving Queries

Three-Way Match Validation

-- Check 3-way match status for pending invoices
SELECT m.match_id, po.po_number, g.grn_number,
       m.po_qty, m.grn_qty, m.invoice_qty,
       CASE
         WHEN ABS(m.grn_qty - m.po_qty) / m.po_qty * 100 > m.tolerance_pct
           THEN 'QTY_VARIANCE'
         WHEN ABS(m.invoice_qty - m.grn_qty) / m.grn_qty * 100 > m.tolerance_pct
           THEN 'PRICE_VARIANCE'
         ELSE 'MATCHED'
       END AS match_result
FROM receiving.three_way_match m
JOIN procurement.purchase_order po ON po.po_id = m.po_id
JOIN receiving.grn g ON g.grn_id = m.grn_id;

Validation Rules

Business Rules

  • GRN vs PO: Received qty per line cannot exceed PO ordered qty + tolerance
  • Inspection Mandatory: GRN cannot be accepted without quality inspection record
  • Match Tolerance: Default ±2% for qty, ±1% for price; configurable per material category
  • Debit Note Limit: Debit note amount cannot exceed GRN line value

Integration Points

Connected Modules

  • Procurement: GRN references PO; received qty updates PO delivery status
  • Inventory: Accepted GRN quantities auto-create stock receipt transactions
  • Finance: 3-way match approval triggers AP invoice payment processing
  • Vendor: Inspection results feed vendor quality performance score

Best Practices

Recommended

  • Inspect 100% of first-time vendor deliveries
  • Use handheld scanners for GRN line item verification
  • Set up material-specific inspection checklists
  • Configure auto-escalation for GRN pending >48 hours