Factory ERP Foundation: CRM, Stock and Procurement Workflow
A manufacturing case study showing how disconnected sales, stock, purchasing and finance workflows were moved into a documented ERP foundation.
Technologies Used
A manufacturing case study showing how disconnected sales, stock, purchasing and finance workflows were moved into a documented ERP foundation.
Technologies Used
This project is a large-scale, purpose-built ERP application developed for the internal operations of a manufacturing business. It is not a generic SaaS product and was not designed around a pre-packaged ERP template. The system has evolved directly around real production, sales, inventory, procurement, logistics, quality, finance and workforce processes.
What initially began as an operational foundation grew into an interconnected manufacturing platform where a customer order can be followed through product configuration, material requirements, customer-reserved stock, production planning, work orders, procurement, warehouse operations, shipment, delivery, financial exposure and reporting.
The architectural objective is not simply to store records. The ERP acts as an operational source of truth, connecting decisions made by sales, production, purchasing, warehouse, logistics, quality, finance and HR teams while preserving permissions, transaction integrity and traceability across those workflows.
Manufacturing operations cannot be represented accurately by isolated CRM, inventory or production screens. A customer order affects material demand; material demand affects procurement and production; production affects customer-reserved stock; available stock affects shipment planning; and shipment events affect both financial exposure and customer order completion.
The application therefore uses connected domain workflows rather than treating each department as an independent software module.
Commercial
Customer records, account ownership, addresses, contacts, customer-specific product codes, price lists, order lines, discounts, currencies and commercial documents.
Planning
Production plans, work orders, recipes, production lines, machines, molds, operator reporting, approvals, waste and production progress.
Supply
Inventory buckets, customer stock reservations, material requirements, purchase requests, supplier options, arrivals, returns and physical stock tracking.
Fulfilment
Shipment planning, warehouse confirmation, logistics costs, export documents, currency exposure, collections, margins and operational reporting.
Customer management extends beyond a conventional contact database. Customer records are connected directly to orders, representatives, addresses, authorized contacts, product codes, reserved stocks, financial information, purchasing requirements and operational history.
Orders are modeled as operational objects rather than simple sales records. A single order may carry customer-specific pricing, currency snapshots, packaging rules, quantities expressed as units or cases, technical recipes, customer product codes, shipment status and production requirements.
Price & Currency Control
Price lists, historical currency snapshots, tax, primary and secondary discounts, and customer-specific commercial terms.
Unit & Packaging Logic
Separate box, case and pieces-per-case rules prevent ambiguous quantity calculations between sales, production, shipment and reporting.
Order-Level Recipes
Recipes can be copied from customer or product defaults and then frozen or adjusted specifically for the individual order.
Controlled Lifecycle
Order state, production, procurement, shipment, delivery and financial context remain linked throughout the order lifecycle.
Product data is used by nearly every other ERP domain. Products can participate in customer orders, recipes, procurement, stock movements, production plans, quality rules and shipping calculations.
The application supports the distinction between finished goods, semi-finished products, raw materials, packaging components and other production-relevant item types instead of reducing everything to a generic SKU.
Finished products can consume raw materials, semi-finished products, packaging materials or other manufactured components through recipe relationships.
Material requirement calculations can recursively expand semi-finished products, making downstream manufacturing requirements visible before production begins.
Set products and their underlying manufactured components are handled as connected production structures rather than flat order lines.
Product and delivery packaging data feeds weight, volume, packing list and shipment calculations.
Different products can use standard quantity tracking or more detailed physical-unit models such as individually tracked raw-material rolls.
Product-specific quality rules can be associated with production processes and evaluated as part of manufacturing control.
Inventory is not represented by one stock number. Different quantities have different operational meanings: usable stock, semi-finished stock, customer-reserved stock, standard sales allocations and special-order allocations must remain distinguishable.
This becomes particularly important when production and procurement are calculated against actual customer demand. A product may physically exist in the warehouse while already being reserved for another customer or production requirement.
| Inventory Concern | ERP Capability | Operational Purpose |
|---|---|---|
| General stock | Product-level inventory buckets | Understand physically and operationally available quantities |
| Customer reservations | Customer-specific stock allocations | Prevent one customer's reserved production from appearing freely available |
| Critical stock | Minimum usable-stock thresholds | Identify materials requiring attention before production is blocked |
| Recipe demand | Material requirement and stock-gap calculations | Convert production demand into material requirements |
| Physical material units | Individually tracked rolls and movement history | Preserve physical traceability for weight-based raw materials |
| Auditability | Stock movement records and reconciliation | Explain why inventory changed rather than showing only the latest balance |
Some manufacturing materials cannot be managed accurately with only a generic kilogram balance. Individual material rolls can have their own identity, remaining weight, supplier lot, dimensions, warehouse location and movement history.
For applicable raw and semi-finished materials, the ERP supports individually identified rolls. A roll number can be reserved during procurement, activated when the physical material arrives, consumed during production and adjusted through controlled usage, waste and reversal movements.
Unique Material Identity
Physical rolls can retain unique codes independent of aggregate product stock.
Actual Weight Tracking
Planned procurement weight and actual received or remaining weight remain distinguishable.
Production Consumption
Operators can associate physical material consumption and waste with production records.
Reversible Audit Trail
Corrections use controlled reversal movements instead of deleting historical stock evidence.
Production is modeled from planning through execution rather than as a final quantity entry. Plans can be linked directly to customer orders or opened for general stock production.
The planning model understands production lines, manufacturing departments, machines, molds, nested production requirements and the relationship between finished goods and the semi-finished components required to manufacture them.
Hierarchical production lines and manufacturing departments model the actual structure of the factory floor.
Production can be associated with specific machines and molds, allowing planning to reflect physical manufacturing constraints.
Daily production records retain planned quantities, completed quantities, transfers, progress, dates and operational status.
Workshop-style work orders provide an additional planning layer for operations that require capacity-oriented scheduling rather than only daily quantity planning.
Production workloads can be represented through timeline-oriented planning views for more complex workshop and machine schedules.
Incomplete work can be transferred to future production plans without falsifying the quantity actually completed on the original day.
Shop-floor production is not immediately treated as official inventory. Operators can report production activity, while completed quantities pass through a separate approval process before becoming authoritative production state.
Start
Record when production activity actually begins.
Stop
Capture interruptions, downtime reasons and operator notes.
Resume / Finish
Build a usable production-time history instead of relying only on plan dates.
Approval
Separate operator-reported output from officially approved production and stock movement.
Customer Order
Order Recipe
Stock Gap
Produce / Procure
Quality Gate
Customer Stock
Shipment
Every stage can retain its own operational state while remaining connected to the original customer order. This allows teams to investigate the cause of a delay instead of seeing only a generic “order pending” status.
Procurement is demand-aware. Purchase requests can originate from general operational needs or be tied directly to a customer order and its individual order line. This preserves the relationship between the commercial commitment and the material being purchased.
A purchase request does not need to be fulfilled by one supplier or one delivery. The same requirement can be purchased in parts, and each purchase can itself arrive through multiple delivery records.
Requested
Material requirement
Purchased
One or more supplier orders
Received
One or more warehouse arrivals
Quality control is modeled as an operational gate rather than a note field added after production. Quality rules can be assigned to products or production records and evaluated during manufacturing.
Shipment planning is connected to actual customer-order lines. A shipment may contain lines from one or multiple orders and preserves quantities, package quantities, weight, volume, customer, product and fulfilment state.
Planning and warehouse execution are deliberately separated. The quantity planned for shipment is not automatically considered shipped; warehouse-reported and approved quantities determine the authoritative delivery state.
One logistics plan can combine appropriate lines from multiple customer orders.
Actual warehouse quantities remain separate from the quantities originally planned.
Packaging dimensions, quantities, net weight and gross weight support logistics calculations.
Loading and operational shipment-time information can be retained for logistics analysis.
Return shipments remain distinguishable and feed net shipment and reporting calculations.
Freight, driver, customs and other shipment costs can be tracked independently and reflected in reports.
ERP data is also used to generate operational and customer-facing documents. Document rendering shares the same order and shipment calculation rules instead of independently reimplementing totals in each PDF template.
Proforma Invoice
Commercial Invoice
Packing List
Order Form
Export Form
Bill of Lading
PDF / XLSX
CSV Export
Heavy document generation can be queued instead of blocking the user's page request, while generated documents retain order and user context.
The financial reporting layer connects commercial value with operational events. It does not look only at the price written on the order: purchase costs, shipment costs, payments, currency movements and delivery dates can all affect the economic interpretation of an order.
This allows management reporting to answer more useful questions than “what was the sales price?”—for example, what was purchased for the order, what logistics costs were incurred, how currency moved and what margin remains after those effects.
Workforce management is integrated as another operational domain. Employee profiles, shifts, attendance, overtime, field-work attendance, payroll calculations and payroll-accounting export records can be managed within the ERP.
Attendance events can arrive from devices, integrations, imported files or controlled mobile workflows.
Shift templates, employee assignments, weekly calendars, tolerances and manual overrides support factory scheduling.
Calculated overtime can remain operationally visible while only approved overtime is included in payroll calculations.
Geofenced attendance workflows can validate employee position against configured facility or field-work rules.
Country-aware payroll rules, attendance summaries, variable earnings, advances and salary slips are processed through dedicated payroll logic.
Payroll data uses stricter permission boundaries because salary and employee financial information require separate authorization.
A factory ERP cannot expose every customer, payroll record, financial figure or production action to every employee. Authorization is therefore part of the domain architecture rather than an interface-only concern.
Operational records are restricted to the user's permitted organizational context.
Selected employees can be limited to the customers and accounts they are authorized to manage.
Read, create, update, approval, download and sensitive-domain operations can have independent controls.
The application also explores a structured AI interaction model through Model Context Protocol (MCP). Instead of giving an AI model direct database access, ERP capabilities are exposed through explicit, permission-aware business tools.
This allows an authorized assistant to reason over ERP information while the application continues to enforce company scope, customer scope, quantity rules, recipes and business constraints.
Order 360° Analysis
Combine order lines, production, procurement, shipment, customer stock and operational risks into one contextual view.
Customer 360° Analysis
Bring open orders, reserved stock, production, procurement and recent shipments together for one customer.
Recipe Explosion
Recursively calculate the raw and semi-finished materials required to manufacture an order or product quantity.
Procurement Decision Support
Compare supplier options, purchase history, payment terms, currencies and purchasing rules.
Order Health Scoring
Evaluate due-date pressure, material shortages, missing plans, procurement gaps and pending production approvals.
Quality Gate Visibility
Read the active production-quality requirements and identify unresolved checks blocking production completion.
Supplier Scorecards
Analyze lead time, returns, pricing trends, quality and supplier-performance signals.
Margin Analysis
Combine order revenue, product cost and currency information into structured operational decision support.
The important design principle is that AI does not bypass ERP business rules. It works through controlled application services, the same way another trusted client or integration would interact with the ERP.
A large ERP inevitably becomes an integration platform. Mobile applications, attendance systems, external services, AI clients, document workflows and operational dashboards all need controlled access to the same business state.
The same architecture principles are used in my API Integration Services : explicit contracts, controlled authorization, idempotency, background processing and reconciliation instead of fragile direct database coupling.
Demand
Customers, pricing, order lines, recipes and delivery commitments.
Planning
Recipe requirements, production plans, work orders, machines and approvals.
Supply
Availability, raw materials, suppliers, arrivals and inventory movement.
Execution
Quality gates, customer stock, warehouse confirmation and shipment.
Intelligence
Margin, exposure, KPIs, alerts, MCP and management decision support.
ERP complexity is not primarily a UI problem. The difficult part is preserving business invariants when several workflows modify related state.
Production approval may alter finished-goods stock, customer-reserved stock, component quantities and physical material units. Procurement arrival may affect inventory and customer-linked demand. Shipment approval may affect delivered quantities, financial exposure and document calculations.
Related state changes are grouped so partial operational updates do not survive a failed workflow.
Critical concurrent stock and production operations use locking where shared state must remain consistent.
External and AI-assisted mutation flows can require stable request identities to prevent duplicate operations.
Sensitive stock and production corrections can preserve the original event and record a compensating movement.
Because sales, inventory, production, procurement and logistics share the same operational model, reporting can cross departmental boundaries rather than reproducing isolated spreadsheets.
Stock Valuation
Analyze inventory value using operational stock and cost information.
Product Costs
Connect product cost information with recipes, purchasing and operational margins.
Raw-Material Needs
Translate planned or demanded production into material gaps requiring stock or procurement action.
Production Load
Compare planned and produced quantities across dates and production lines.
Shipment Performance
Analyze shipment quantities, customers, dates, returns, costs and delivery results.
Financial Exposure
Review receivables, purchasing cost, logistics cost, exchange-rate movement and estimated margin.
The codebase reflects the scale of the business workflows it supports. The application combines traditional ERP screens with asynchronous jobs, real-time interfaces, document generation, integrations and AI-facing business tools.
PHP 8.5 + Laravel 12
Core domain logic, transactions, APIs, background processing and enterprise workflows.
Livewire 4
Data-intensive operational screens and reactive ERP interfaces.
TailwindCSS + Flowbite
Responsive user interfaces and reusable operational components.
Laravel Horizon + Redis
Queue-oriented processing for expensive and asynchronous workloads.
Laravel Reverb + Echo
Real-time application events and interactive operational communication.
Passport + Sanctum
Authentication foundations for APIs, mobile applications and integrations.
PDF / Excel / CSV Generation
Operational, financial, shipment and commercial document workflows.
QR & Barcode Workflows
Barcode generation and browser-side scanning capabilities for operational processes.
Frappe Gantt + Chart.js
Production planning timelines and data visualization.
Laravel MCP + Laravel AI
Permission-aware AI and structured ERP tool integration.
Google AI / Cloud Integrations
Infrastructure for AI, document, storage, translation and data-oriented integrations.
PWA & Mobile Integration
Support for operational mobile workflows and installable application experiences.
The value of this project comes from modeling the factory's actual operational rules. Packaging quantities, customer-specific recipes, semi-finished products, physical roll tracking, machine and mold relationships, approval flows, customer-reserved stock and shipment calculations are tightly connected.
Trying to reproduce these workflows only through generic configuration would either force the business to change proven operational processes or create a large collection of disconnected workarounds around the ERP.
The custom approach allowed the software model to follow operational reality while still applying engineering discipline around permissions, transactional consistency, APIs, background jobs, auditability and long-term maintainability.
This project represents one of the most comprehensive examples of my manufacturing software work. It combines CRM, ERP, MRP-style material planning, production execution, inventory control, procurement, logistics, quality, finance, HR, reporting and integration architecture in one continuously evolving codebase.
The most important part is not the number of modules. It is the relationship between them: customer demand can be traced into material requirements; material shortages into procurement; procurement and stock into production; production into customer inventory; customer inventory into shipment; and shipment back into financial and management reporting.
That end-to-end traceability is what turns separate business screens into an ERP.
Explore more projects showcasing CRM, ERP, and API integration work.
A deep-dive into TermiNode and GIS application architecture for geofencing, delivery zones, logistics, field operations,...
View details
Vinoks is a large factory in Istanbul, Turkey, that produces stainless steel kitchen and bathroom equipment. A web appli...
View details
Savory Cafe is a multi-tenant digital management platform for F&B businesses. It delivers real-time order processing, ca...
View detailsShare the current workflow and systems involved to get a practical direction for scope, integrations and a useful first release.
Typical response within 24 hours · Clear scope & timeline · Documentation included