How ERPNext Connects Sales, Purchase, Inventory and Accounting: Complete Flow
The Problem: Disconnected Systems
Most companies use separate tools:
- Sales: Custom CRM or spreadsheet
- Purchasing: Email + Excel
- Inventory: Manual stock counting
- Accounting: QuickBooks or manual GL entries
Result:
- Data discrepancies (GL shows QAR 50k inventory, physical count shows QAR 35k)
- Month-end close takes 5–7 days
- No visibility into profitability by customer/product
- Manual GL entries cause errors (4–6% error rate typical)
The Solution: Integrated ERPNext Workflow
One system, one database, automated flow:
Sales Order → Delivery → Invoice → GL Entry
↓ ↓ ↓ ↓
Purchase ← Stock → Cost → Profit Report
Order Update Calculation
Complete Workflow: From Sale to Accounting
Step 1: Sales Order Created
When: Customer order received Who: Sales person What: Create Sales Order (SO) in ERPNext
Data Input:
Sales Order #001
├─ Customer: ABC Trading
├─ Items:
│ ├─ Product A: Qty 100 @ QAR 50 = QAR 5,000
│ ├─ Product B: Qty 50 @ QAR 100 = QAR 5,000
└─ Total: QAR 10,000
Automatic Actions:
-
Inventory Check: ERPNext checks stock availability
- Product A: 150 available (OK)
- Product B: 30 available (short 20 units)
-
GL Preview: Revenue GL prepared (not posted yet)
- Sales Revenue Account: +QAR 10,000
- Accounts Receivable: +QAR 10,000
-
Purchase Trigger: If stock low, auto-suggest purchase order
- Product B: Purchase 50 more units
Step 2: Delivery Note Created
When: Goods shipped to customer Who: Warehouse staff What: Create Delivery Note from SO
What ERPNext Does:
-
Stock Deduction (Inventory Journal created):
Warehouse: Main Store ├─ Product A: Qty -100 (leaves 50) ├─ Product B: Qty -50 (leaves -20, i.e., back-order) -
Cost Calculation:
Product A Cost = Qty 100 × Standard Cost (QAR 35) = QAR 3,500 Product B Cost = Qty 50 × Standard Cost (QAR 70) = QAR 3,500 Total COGS = QAR 7,000 -
GL Entry (Inventory Adjustment):
Debit: Cost of Goods Sold (COGS): QAR 7,000 Credit: Inventory Asset: QAR 7,000 -
Stock Aging:
- Product A FIFO: Used 100 units from batch dated 2025-03-01
- Cost linked to batch for traceability
Step 3: Sales Invoice Created
When: Ready to bill customer Who: Finance team What: Create Sales Invoice from Delivery Note
GL Entries Created (automatically):
Journal Entry #GL-001
├─ Debit: Accounts Receivable (ABC Trading): QAR 10,000
├─ Credit: Sales Revenue: QAR 10,000
├─ Debit: COGS: QAR 7,000
└─ Credit: Inventory: QAR 7,000
Result: Gross Profit = QAR 10,000 - QAR 7,000 = QAR 3,000 (30%)
Accounting GL Snapshot:
Accounts Receivable: +QAR 10,000
Sales Revenue: +QAR 10,000
COGS: +QAR 7,000
Inventory: -QAR 7,000
Step 4: Purchase Order (Triggered by Low Stock)
When: Stock falls below reorder point Who: Procurement team What: Create Purchase Order for Product B (20-unit shortfall)
ERPNext Auto-Generates:
- PO to Supplier "Chemical Supplies Inc."
- Qty: 50 units @ QAR 75 = QAR 3,750
- Expected delivery: 2025-06-01
- GL prepared (not posted yet):
Debit: Inventory: QAR 3,750 Credit: Accounts Payable: QAR 3,750
Step 5: Purchase Receipt (Goods Received)
When: Supplier delivery arrives Who: Warehouse staff What: Create Purchase Receipt from PO
GL Entry Created (Goods Receipt):
Debit: Inventory (Product B): QAR 3,750
Credit: Accounts Payable: QAR 3,750
Stock Update:
Before: Product B = -20 (back-order)
After: Product B = +30 (back-order fulfilled + 30 surplus)
Cost Valuation:
- New batch cost: QAR 75/unit
- Previous batch cost: QAR 70/unit
- Weighted average cost updates automatically
Step 6: Purchase Invoice (from Supplier)
When: Supplier invoice received Who: Accounts Payable team What: Match invoice to PO receipt (3-way match)
3-Way Match (Quality Control):
1. PO (promised): Qty 50 @ QAR 75 = QAR 3,750 ✓
2. Receipt (delivered): Qty 50 arrived ✓
3. Invoice (billed): Qty 50 @ QAR 75 = QAR 3,750 ✓
→ Match! Auto-approve for payment
If Mismatch:
- Invoice qty = 48 (not 50) → Hold, request clarification
- Invoice price = QAR 78 (not QAR 75) → Hold, dispute with supplier
GL Entry Created:
Debit: Accounts Payable: QAR 3,750
Credit: Cash: QAR 3,750
OR
Credit: Accrued Expenses (if payment deferred)
Complete Transaction Summary
General Ledger (GL) Final State
Account Debit Credit
────────────────────────────────────────────────────
Accounts Receivable (ABC) QAR 10,000
Sales Revenue QAR 10,000
COGS QAR 7,000
Inventory (Product A sold) QAR 3,500
Inventory (Product B sold) QAR 3,500
Inventory (Product B purchased) QAR 3,750
Accounts Payable (Supplier) QAR 3,750
Cash (Supplier payment) QAR 3,750
Accounts Payable QAR 3,750
────────────────────────────────────────────────────
Totals QAR 24,500 QAR 24,500
Profit & Loss Impact
Sales Revenue: QAR 10,000
Less: COGS (QAR 7,000)
────────────────────────────────────────────
Gross Profit: QAR 3,000 (30% margin)
Operating Expenses: (QAR 1,500)
────────────────────────────────────────────
Net Profit: QAR 1,500
Balance Sheet Impact
Before Transaction After Transaction
──────────────────── ────────────────────
Inventory: QAR 50k Inventory: QAR 45.75k
(QAR 50k - 3.5k + 3.75k - 3.5k)
AR: QAR 0 AR: QAR 10k
AP: QAR 0 AP: QAR 0 (paid)
Retained Earnings: QAR 0 RE: QAR 1.5k (profit)
Key Benefits of Integration
1. Data Accuracy
- Single database = no discrepancies
- Example: Inventory GL matches physical inventory 99%+ accuracy
2. Real-Time Profitability
- Know margin on each customer/product immediately
- Example: ABC Trading = 30% gross margin, Supplier X = QAR 500/unit cost
3. Faster Month-End Close
- Before: 5–7 days (manual GL entries, reconciliation)
- After: 1–2 days (GL auto-created, reconciliation automated)
4. Inventory Valuation Accuracy
- Automatic FIFO/weighted-average cost calculation
- Example: Product A batch from March 2025 used first (FIFO)
5. Cash Flow Visibility
- Know exactly when cash hits (supplier payment dates)
- Predict cash flow 3–6 months out
- Example: Supplier terms 30 days = cash leaves June 1, not May 1
6. Compliance & Audit Trail
- Every GL entry linked to source document (SO, PO, Receipt)
- Auditors can trace QAR 1 from invoice to GL to payment
Common Customizations
Multi-Currency Transactions
Customer in USD, Supplier in AED, GL in QAR
ERPNext handles FX conversion automatically
Example: USD 100 @ 3.64 QAR/USD = QAR 364
Multi-location Inventory
Sale from Doha warehouse
Delivery from Al Daayen warehouse (stock transfer first)
ERPNext tracks transfer GL + destination stock
Intercompany Transactions
Company A buys from Company B
ERPNext creates PO in A, SO in B automatically
Eliminates intercompany GL entries (consolidation)
Revenue Recognition (ASC 606)
Long-term contracts (e.g., 12-month software license)
Revenue recognized monthly (not upfront)
ERPNext creates monthly revenue GL entries automatically
Implementation at Qatar Water Company (Case Study)
Before ERPNext
- Sales: Manual SO in Excel
- Purchases: Emails to suppliers
- Inventory: Weekly manual counts
- Accounting: QuickBooks (disconnected)
Problem: Month-end discrepancy of QAR 50,000 between GL inventory and physical count
After ERPNext (12 Weeks)
- Day 1: Create SO (auto-stock check)
- Day 2: Delivery note (auto-GL entry for COGS)
- Day 3: Invoice (auto-revenue GL)
- Day 5: PO for restocking (triggered by low inventory alert)
- Day 10: Supplier receipt + 3-way match
- Day 30: Month-end close (1.5 hours vs 2 days before)
Results:
- Inventory accuracy: 99.5% (was 85%)
- Month-end close time: 1.5 hours (was 5 days)
- Profitability visibility: By product, customer, region
- Cash flow forecasting: 90-day outlook (was guesswork)
Star Tech's ERPNext Implementation
✓ End-to-end workflow design ✓ GL account mapping (Chart of Accounts optimization) ✓ Inventory valuation method setup (FIFO, weighted-average, standard cost) ✓ Sales/purchase process automation ✓ Multi-location & multi-currency configuration ✓ Compliance setup (VAT, ZAKAT) ✓ Post-go-live support (3 months included)
Get ERPNext Workflow Demo → See the full integrated process in action.
