A robust enterprise system connecting Order-to-Cash (O2C) and Procure-to-Pay (P2P) workflows.
Engineered to handle complex document lifecycles, temporal pricing logic, and strictly consistent inventory auditing.
This application serves as the central nervous system for a trading enterprise. It bridges the gap between the Sales Department (Commercial) and the Warehouse (Logistics), ensuring that financial documents perfectly match physical inventory reality.
The core engineering challenge was to implement strict Business Rules that prevent data inconsistency during concurrent user operations (e.g., creating invoices while stock is moving).
The system relies on a Highly Normalized Relational Model. The architecture explicitly defines relationships between Articles, Warehouses, and their dynamic states via Stock Cards.
erDiagram
WAREHOUSE ||--|{ STOCK_CARD : maintains
ARTICLE ||--|{ STOCK_CARD : tracked_by
STOCK_CARD ||--|{ TRANSACTION_ITEM : records_movement
TRANSACTION_DOC ||--|{ TRANSACTION_ITEM : contains
TRANSACTION_DOC }|--|| WAREHOUSE : originates_from
CUSTOMER ||--|{ ORDER : places
ORDER ||--o| INVOICE : generates
ARTICLE {
string SKU
string Name
string UnitOfMeasure
}
STOCK_CARD {
decimal Quantity_Physical
decimal Quantity_Reserved
decimal Total_Value
decimal Average_Price
}
TRANSACTION_DOC {
string DocNumber
date Date
enum Type "Receipt | Delivery | Transfer"
enum Status "Draft | Posted | Reversed"
}
Designed for the Sales Representative persona, this module handles the commercial lifecycle with a focus on flexibility and financial accuracy.
- Order-to-Invoice: Sales Reps can input a Customer Order (Narudžbenica). Upon approval, the system can auto-generate a generic Invoice inheriting all line items.
- Direct Invoicing: Supports ad-hoc sales where no prior order exists (Direct Entry).
- Temporal Pricing Logic: The system manages Price Lists (Cenovnici). When creating an invoice, the engine resolves the Item Price and VAT Rate based on the Invoice Date (not necessarily the current date), ensuring historical accuracy.
- Granular Calculation:
- Calculates VAT (PDV) and Base Amount per Line Item.
- Aggregates totals at the Document Header level.
- Customer Invoice: Generates a professional PDF with all line items for external distribution.
- Sales Ledger (KIF - Knjiga izlaznih faktura): A mandatory fiscal report aggregating all issued invoices within a user-defined date range.
Designed for the Warehouse Manager, acting as the "Source of Truth" for physical goods.
The system supports full lifecycle management for three distinct document types:
- Goods Receipt (Primka): Increases stock value/quantity.
- Delivery Note (Otpremnica): Decreases stock value/quantity.
- Inter-Warehouse Transfer (Međumagacinski promet): Atomically moves stock between locations (Credit Origin / Debit Destination).
- Draft: Editable state. No impact on the ledger.
- Posted (Knjižen): Finalized state. Updates the Stock Card permanently.
- Reversed (Stornirano): Corrective mechanism. Instead of deleting records (which destroys audit trails), the system creates a "Storno" effect to nullify the financial impact while keeping the history.
- Opening Balance (Početno Stanje): Specialized functionality to initialize Stock Cards at the beginning of a fiscal year.
This is the most technically complex part of the system, ensuring synchronization between Sales and Warehouse.
To prevent "Overselling," the system enforces strict checks during the Invoice creation process:
-
Real-Time Availability Check:
- When a Sales Rep enters an item, the system queries the specific Stock Card (Article + Warehouse combo).
- Logic: If
Requested > (Physical - Reserved), the system warns the user and blocks the line item.
-
Dynamic Reservation Updates (CUD Hooks):
- The attribute
ReservedQuantityon the Stock Card is automatically updated via event listeners on:- Create: Adding an item increments reservation.
- Update: Changing quantity adjusts the reservation delta.
- Delete: Removing an item releases the reservation.
- The attribute
-
Automated Document Chaining:
- Once an Invoice is finalized, the system can automatically generate a corresponding Delivery Note (Otpremnica), carrying over all data to the warehouse team.
The system provides deep insights into inventory health and financial standing.
| Report Type | Description | Technical Implementation |
|---|---|---|
| Stock List (Lager Lista) | Shows current Quantity and Total Value for all items in a warehouse. | Aggregates data from active Stock Cards. |
| Stock Card Analytics (Magacinska Kartica) | A detailed chronological ledger of every movement. | Reconstructs history: Opening + Inputs - Outputs = Balance. |
- Platform: Mendix Studio Pro (Model-Driven Engineering)
- Database: Relational SQL Schema (3NF)
- Logic: Event-driven Microflows for reservation handling.
- Reporting: OQL (Object Query Language) for complex datasets.
The system is designed to uphold ACID (Atomicity, Consistency, Isolation, Durability) properties. Critical financial data is protected against partial updates, ensuring the ledger is always balanced.