Domain and technical terminology used throughout AquaDealers. Sorted alphabetically.
| Term | Definition |
|---|---|
| Balance Due | Unpaid portion of a single bill: total − amount_paid. A bill with zero balance due is considered settled. |
| Bill / Invoice | A sales transaction created at the counter. Deducts inventory (FIFO), records payment (full or partial), and updates the farmer's ledger. Generated via the create_bill_v2 RPC. |
| Branch | A physical shop location. Each dealer has one main branch plus optional additional branches. Each branch maintains its own inventory and can have its own color theme. |
| Cashbook | Daily record of all cash inflows (collections, walk-in sales) and outflows (purchases, expenses). Supports daily closing with opening/closing balance. |
| client_ref | UUID generated client-side before a bill is created. Used for offline sync idempotency — if the same client_ref is sent twice, the server returns the existing bill instead of creating a duplicate. |
| Collection | A payment received from a farmer against outstanding dues. Allocated to specific bills using the payment allocation system. Reduces farmer.total_due. |
| Crop Status | Current state of a farmer's aquaculture cycle. Tracks whether ponds are stocked, growing, or harvested. Used for harvest-timed collection planning. |
| Daily Book | AquaDealers' register-styled daily summary. Shows all bills, collections, purchases, and expenses for a single day in a traditional register format. |
| Dealer | The business owner using AquaDealers. Sells aqua feed and medicines to farmers. Each dealer has their own isolated data space via RLS. The primary user role. |
| Due / Outstanding | Money owed by a farmer. Stored as farmer.total_due and automatically recalculated by database triggers whenever bills, payments, or returns change. |
| Edge Function | Serverless Deno function deployed on Supabase infrastructure. Used for WhatsApp API integration (sending messages via authkey.io) and other server-side operations. |
| Estimate | A quote or proforma invoice. Created with is_estimate = true. Has no stock deduction, no payment recording, and no ledger impact. Can be converted to a real bill. |
| Farmer | The customer. An aquaculture farmer (fish or shrimp). Called "farmer" throughout the system, never "customer." Has a ledger, due balance, and optional credit limit. |
| Feed | Aquaculture animal feed. Sold by weight (bags/kg). Uses direct selling price (no MRP/discount system). The primary product category by volume. |
| FIFO | First-In-First-Out inventory method. Oldest lots (by expiry date or receipt date) are consumed first when creating bills. Determines cost of goods sold for profit reporting. |
| FIFO COGS | Cost of Goods Sold calculated from FIFO lot cost prices. When a bill consumes inventory, the cost is traced back to the specific lots used, giving accurate per-bill profit margins. |
| HSN Code | Harmonized System of Nomenclature code. Required for GST classification in India. Each product can have an HSN code that determines its GST rate. |
| Ledger | Chronological record of all bills and payments for a farmer, with a running balance. Each entry shows date, type (bill/payment/return), amount, and cumulative balance due. |
| Lot | A batch of stock from a single purchase order. Each lot has its own batch number, expiry date, cost price, and remaining quantity. Consumed in FIFO order. |
| Medicine | Aquaculture treatment products (probiotics, minerals, antibiotics). Uses MRP/discount pricing model. Has expiry date tracking. Typically higher margin than feed. |
| MRP | Maximum Retail Price. Used for medicine products. The selling price is calculated as MRP − discount. Feed products use direct selling price instead. |
| Payment Allocation | The mapping of a payment to specific bills. When a farmer pays, the amount is allocated to their oldest unpaid bills first (FIFO allocation). Tracked in payment_allocations table. |
| PWA | Progressive Web App. AquaDealers is installable on mobile devices and works offline. Uses a service worker for caching and IndexedDB + React Query for offline data persistence. |
| Rate Diff | The difference between a product's standard selling_price and a farmer-specific discounted price. Stored per-farmer per-product and recalled automatically on future bills. |
| Return Credit | When a return's value exceeds the bill's remaining balance, the excess is stored as farmer.return_credit_balance. Applied automatically to future bills. |
| RLS | Row Level Security. PostgreSQL feature that restricts data access per user. Every core table has RLS enabled so dealers can only access their own data. Enforced at the database level. |
| RPC | Remote Procedure Call. A Supabase database function called from the client via supabase.rpc(). All critical writes (bill creation, payments, returns) go through RPCs for atomicity and validation. |
| Settlement Discount | A discount applied at payment time, separate from per-item product discounts. Reduces the effective total the farmer owes. Commonly used when farmers pay in bulk. |
| Stocking Date | The date a farmer stocks their pond with fish or shrimp seed. Marks the start of a crop cycle (typically 3-5 months). Used for harvest-timed collection planning. |
| Supplier | A company or distributor from whom the dealer purchases stock. Has its own ledger tracking purchases and payments. Stock receipts create inventory lots. |
| Transaction Event | An audit record in the transaction_events table. Created for every financial operation (bill, payment, return, edit, cancellation). Enables the universal undo feature within the 48-hour window. |
| Walk-in | A customer without a farmer account. Walk-in sales require full payment at the counter — no credit or dues allowed. The bill is not linked to any farmer record. |