Bonnie Computer Hub - Website Development & Digital Services in Kenya
POS SYSTEMS Bonnie Computer Hub

HOW TO BUILD THE INVENTORY MODULE THAT UPDATES IN REAL TIME.

HOW TO BUILD THE INVENTORY MODULE THAT UPDATES IN REAL TIME.

Inventory is the second most critical module in any POS system.

Get it right and the business owner always knows what they have. Get it wrong and stock discrepancies, angry clients, and midnight reconciliation sessions become your reality.

The foundational principle — never update stock directly

This is the most important rule in POS inventory design.

Never write code that does this:

$product->stock_quantity = $product->stock_quantity - $quantity_sold;

Why is this wrong?

❌ No audit trail — you cannot see when or why the quantity changed

❌ Concurrent updates cause race conditions — two cashiers selling the last item simultaneously

❌ No history — you cannot reconstruct what happened

❌ Reconciliation is impossible

The right approach — always create a stock movement record.

Current stock is always calculated as the sum of all movements. This gives you a complete audit trail and makes reconciliation possible at any point in history.

Movement types your system must handle

✅ sale — stock out when a sale is completed

✅ sale return — stock in when a customer returns

✅ purchase — stock in when goods are received from supplier

✅ adjustment in — manual increase with reason and authorisation

✅ adjustment out — damaged, expired, lost with reason and authorisation

✅ transfer out — stock sent to another branch

✅ transfer in — stock received from another branch

✅ opening stock — initial stock when system goes live

Building the stock receiving module

When a supplier delivery arrives, open the pending purchase order, enter quantities actually received per item, system compares to quantity ordered and flags variances, confirm receipt, system creates stock in movements for each received item, and generates a Goods Received Note.

Never add stock without a corresponding purchase order or adjustment record.

Building the stock alert system

The system must notify management when:

✅ Product reaches reorder level

✅ Product reaches zero — out of stock

✅ Product expiry approaching — 30, 60, or 90 days

✅ Slow moving product — no sales in configured period

Build the alert checking as a scheduled job running at configurable intervals.

Building the stock taking module

Manager initiates stock take, system generates count sheet with expected quantities, physical count is conducted, actual counts entered, system calculates variance, manager reviews and investigates, approved variances posted as adjustment movements, stock take record saved permanently.

Performance considerations

✅ Index product and branch columns on stock movements table

✅ Consider a cached stock levels table updated on each movement — faster to query than summing all movements

✅ Rebuild cached levels from movement history periodically as a consistency check

Is your inventory module creating a movement record for every stock change — or is it just updating a number?

🌐 www.bonniecomputerhub.co.ke

📲 +254 729 820 689

© Bonnie Computer Hub | Empowering Through Technology

Share:
B

Written by

Bonnie Computer Hub

More in POS SYSTEMS

Need a Website or System Built?

From websites to custom business systems, BCH designs and builds tools your business will actually use.