Skip to content
ERP & Operations

From WhatsApp photos to a live order book: an ERP and offline field app for distributors

AIVCJ ERP replaces the Tally + Excel + WhatsApp loop: a field app that takes orders without signal and never syncs twice, credit holds decided in code, FEFO picking with GST invoices, and plain-English questions answered by a read-only query you can see. Measured with a two-phone sync test and a blind NL-to-SQL set.

6 min read
Owner dashboard: sales, margin, receivables ageing and what needs you

Most distributors we meet run on three tools: Tally for invoices, Excel for stock and dues, and WhatsApp for everything else. A rep photographs an order sheet in a shop, sends it to the office, someone types it into Tally the next morning, and only then does anyone notice the shop already owes ₹50,000 and hasn't paid in two months. Stock is "about 20 cases" until the day it isn't.

We built AIVCJ ERP to show what replaces that loop: a field app that works without signal, an order book that checks credit before anything ships, stock tracked by batch and expiry, GST invoices in one click, and a way for the owner to ask questions in plain English. It runs on a sample FMCG distributor — Northwind Distribution, with 3 warehouses (Nagpur, Indore, Hubli), 396 retailers, 8 field reps, 123 SKUs and 100 days of history. Every visitor gets their own copy.

The order, from the shop to the invoice

  1. In the shop — the rep opens the day's beat in the Northwind Sales app, sees the shop's credit status, adds cases and places the order. No signal? The order is saved on the phone and marked "waiting for signal".
  2. Sync — when the phone is back online, the queue uploads by itself. The ERP prices every line from its own price list and runs the credit check in code.
  3. Credit hold — if the shop is over its limit or an invoice is past its terms, the order lands on hold with the exact reason ("Outstanding ₹49,917 + this order ₹12,147 = ₹62,064, over the ₹50,000 limit; invoice NW/26-27/000993 is 74 days old"). The owner releases it with a reason, or cancels it. The rep's app updates on its own.
  4. Pick and invoice — the warehouse picks first-expiry-first-out by batch, skipping anything that expires within 15 days, and the GST tax invoice is generated with HSN codes, batch numbers, CGST + SGST or IGST and the amount in words.
  5. Reorder — run-rate × supplier lead time flags what will run out, grouped by supplier and warehouse; one click raises the purchase order, and receiving it adds new batches to stock.

Offline first, and never twice

Field sales in India happens in godowns, basements and small towns. An app that needs signal to save an order loses orders. So the Northwind Sales app (built with Expo / React Native) writes every order and collection to the phone first — SQLite on Android — and uploads later.

The hard part of offline is not storage; it is retries. A rep taps "place order", the request reaches the server, the reply is lost in a dead zone, and the phone tries again. Without care, that is two orders. Every item the app queues carries its own id, and the ERP returns the existing order when it sees an id twice. Prices and credit shown on the phone are only a preview: the ERP re-prices and re-checks everything on arrival, so a stale phone can never sell at an old price or past a limit.

Stock is allocated when the warehouse picks, not when the rep takes the order — two reps can sell the last 20 cases at the same time without either of them having signal. The second pick is then blocked with a clear shortage ("short by 850"), and the owner moves stock or raises a PO. Nothing is oversold and no batch goes negative.

Credit control in code, not in the model

Credit decisions are money decisions, so no AI is involved. A small rules module decides: exposure is outstanding invoices plus open orders not yet invoiced plus this order, compared with the shop's limit; and any unpaid invoice older than the shop's terms holds the order. (We found the open-orders gap during testing — a second order from the same shop ignored the first one on hold. It is fixed and now has its own unit test.) Releasing a hold always needs a reason, and every release, limit change and stock adjustment is written to an audit log.

Ask your data — with guard-rails

The one place we use AI is the owner asking questions: "Which Nagpur retailers are over 60 days due?", "Gross margin by category this month". Claude Haiku 4.5 writes one SQL query; the ERP then decides whether it may run:

  • the query runs in a read-only transaction, against 14 views of the visitor's own copy only (money in rupees, no phone numbers);
  • a guard in code rejects anything that is not a single SELECT, or that touches system tables, settings or anything outside those views — tested against 28 allow and attack cases;
  • 5-second timeout, 200-row cap, 15 questions per visitor per day;
  • the exact query is shown with every answer, as a table and a chart when the shape fits.

Questions the data can't answer — a competitor's price, next month's sales, "delete all cancelled orders" — get a short reply saying what it can answer instead. A question costs about $0.002.

What we measured

TestResultHow
Offline sync — 2 phones, a lost-reply retry, both ordering ~70% of the same shelf10/10 checks, on 6 local runs and on the live serverNo duplicate orders; ERP re-prices; first pick ships, second blocked with a shortage; no negative stock
Ask your data — blind set (20 questions)17/20 (85%); with n = 20 the honest range is roughly 64–95%Written by a separate author who never saw our prompt; run once, before any fix
Ask your data — our scripted set (30)17/30 on the first run → 30/30 after fixesWe tuned on this set, so treat 30/30 as a ceiling, not an accuracy figure
Rules, SQL guard and grader20 unit tests passingGST intra/inter-state, credit, FEFO, reorder; 28 SQL attack/allow cases

Two notes on honesty. First, answers are graded in code, not by an AI judge: the model's query and a hand-written correct query run on the same data, and the results are compared (same rows, same numbers within ±1%). Second, the three blind misses were real: one list was cut at 50 rows, one series came newest-first, and one competitor-price question was searched in our own catalogue instead of being declined. We fixed the first and third after the run; the 17/20 stays as measured. The first scripted run also caught four mistakes in our reference queries — shops with the same name were merged — which is why the seed now has unique shop names.

What it takes to connect Tally

Most distributors won't replace Tally on day one, and they don't need to. The practical path is a nightly or hourly sync: masters (ledgers, stock items, godowns) and outstanding bills come in from Tally's XML interface, sales orders flow back as vouchers once invoiced, and the ERP keeps what Tally doesn't — beats, field orders, batch-wise stock, holds and the audit trail. The demo doesn't call Tally or the GST portal; e-invoice (IRN) and e-way bill fields are ready for that step.

Try it: open erp.demos.aivcj.com, take an order for Shree Ganesh Kirana in the Sales app, watch it land on credit hold, release it, pick it and open the invoice. Then switch the app to "no signal" and do it again.

  • #ERP
  • #Distribution
  • #Offline-first
  • #React Native
  • #Case study
  • #Evaluation
LinkedInWhatsApp
Frequently asked questions

Frequently asked questions

01Does the field app really work without internet?
Yes. Orders and collections are saved on the phone (SQLite on Android) and upload by themselves when signal returns. Each item carries its own id, so a retry never creates a second order.
02Can the AI change data or see other customers' data?
No. It only writes a query; the ERP runs it read-only, on views of your own data, after a code check that allows a single SELECT. Credit, pricing, tax and stock decisions use no AI at all.
03Do we have to stop using Tally?
No. A typical rollout syncs masters and outstanding bills from Tally and pushes invoiced sales back, while the ERP adds field ordering, batch-wise stock, credit holds and the audit trail.
Need this built?

ERP — Inventory, Credit & Orders

Stock, credit sales, POs and SOs — in one clean system.

Keep reading