Production Costing
Define what a product should cost to make (Standard Cost), record what it actually cost (Actual Cost), and review the gap (Variance) so you can spot over-budget jobs and act on them.
production/ProductionCosting and is a single feature
with three screens — Standard Costs (the landing page), Actual Costs, and
Cost Variance Analysis — plus an Order Cost Detail drill-down. All of it is gated
by one permission, manufacturing_costing, and requires the
manufacturing module to be enabled.
The big picture
Costing answers three questions, in order:
Every cost — standard or actual — is broken into cost categories. Standard costs use four: Material, Labor, Machine, and Overhead. Actual costs add two more that have no standard equivalent: Scrap and Rework.
Raw materials consumed to make one unit, per the BOM.
Machine / equipment running cost per unit.
Allocated indirect (overhead) expense per unit.
Cost of scrapped / wasted material. Added into Total Actual; no standard equivalent.
Cost of reworking defective output. Added into Total Actual; no standard equivalent.
Actual − Standard. A
positive number means the job ran over budget (shown red / unfavorable); a
negative number means it ran under budget (shown green / favorable); zero is
on budget. Don't misread a red positive number as savings.
Feeds actual labor into the analysis views.
Actual costs and variance are captured per work order.
Where the run that consumes materials is scheduled.
Standard Costs — the landing page
Standard Costs is the entry point (production/ProductionCosting). It lists every
standard cost record — what a product should cost per its Bill of
Materials — and lets you create, edit, and delete them. A standard cost is always anchored
to an approved BOM, and there is exactly one active standard cost per BOM at a time.
What's on the page
| Element | What it does |
|---|---|
| New Standard Cost button | Opens the standard cost modal to add a record. |
| Actual Costs button | Navigates to the Actual Costs screen. |
| Variance Analysis button | Navigates to the Cost Variance Analysis dashboard. |
#standard-costs-table (appTable) | Lists all standard cost records. Columns below. |
| Row actions | Pencil icon = Edit, times/× icon = Delete. |
Standard Costs table columns
| Column | Meaning | Required | Notes |
|---|---|---|---|
| BOM | The Bill of Materials this standard cost applies to. | Display | Shows bom_code joined from the BOM. |
| Product | The product the BOM builds. | Display | Derived from the BOM on save (product_id). |
| Material | Standard material cost per unit. | Display | Stored decimal(15,4). |
| Labor | Standard direct labor cost per unit. | Display | |
| Machine | Standard machine cost per unit. | Display | |
| Overhead | Standard allocated overhead per unit. | Display | |
| Total Cost | Standard total per unit = Material + Labor + Machine + Overhead. | Computed | Shown bold; auto-computed on save. |
| Effective From | Date this standard cost becomes valid. | Required | Rows are ordered newest effective_from first. |
| Status | Whether this is the live cost for the BOM. | Display | Green Active label or grey Inactive label. |
| Actions | Edit and Delete for the row. | — | Pencil = edit, × = delete. |
The Standard Cost modal form
Reached from New Standard Cost (blank) or the pencil icon (pre-filled). Every field:
| Field | Meaning | Required | Notes |
|---|---|---|---|
id — (hidden) | Primary key of the record. | No | Empty for new, populated for edit; drives insert vs. update. |
bom_id — BOM | The Bill of Materials this standard cost applies to. | Required | Select2, sourced from approved BOMs only; shows bom_code - product_name. product_id is derived from the chosen BOM on save. Carries data-rule-required. |
material_cost — Material Cost | Standard cost of raw materials to make one unit. | Optional | Number, step 0.0001, defaults 0.0000. decimal(15,4). |
labor_cost — Labor Cost | Standard direct labor cost per unit. | Optional | Number, step 0.0001, defaults 0.0000. |
machine_cost — Machine Cost | Standard machine / equipment running cost per unit. | Optional | Number, step 0.0001, defaults 0.0000. |
overhead_cost — Overhead Cost | Standard allocated overhead (indirect cost) per unit. | Optional | Number, step 0.0001, defaults 0.0000. |
uom_id — UOM | Unit of measure the standard cost is expressed in. | Optional | Select2 of active UOMs (is_active=1) shown as name (symbol). Defaults to 0 if blank — the column is NOT NULL, so it stores 0 when unset. |
effective_from — Effective From | Date this standard cost becomes valid. | Required | Date input, defaults to today (Y-m-d). Carries data-rule-required. |
effective_to — Effective To | Date this standard cost stops being valid. | Optional | Open-ended if blank; saved as NULL when empty. |
is_active — Set as Active | Marks this as the current live standard cost for the BOM. | Optional | Yes/No dropdown, defaults Yes. Saving with Yes deactivates all other standard costs for the same BOM. |
notes — Notes | Free-text remarks about this standard cost. | Optional | Textarea, 2 rows. |
total_cost — Total Cost | Standard total per unit. | Computed | Not on the form. Auto-computed on save as Material + Labor + Machine + Overhead. |
The footer has a Close button and a Save button.
Active vs. Inactive — the standard cost lifecycle
The two states swap back and forth as you edit. Saving a new active cost, or editing one and choosing Set as Active = Yes, makes it Active and pushes the others to Inactive. Editing and choosing Set as Active = No makes it Inactive.
SOP — set up a standard cost per product
Open Production Costing
You land on the Standard Costs page.
Click New Standard Cost
The standard cost modal opens blank.
Select the approved BOM
Pick from the dropdown (approved BOMs only). The product is derived automatically on save.
Enter the per-unit category costs
Fill in Material, Labor, Machine, and Overhead costs per unit.
Set the effective window
Set Effective From (defaults to today) and Effective To only if the cost is temporary. Optionally set UOM and Notes.
Set as Active = Yes
Leave this on to make it the live standard.
Save and verify
Click Save. Confirm Total Cost equals the sum of the four categories, Status shows Active, and any earlier standard cost for the same BOM flipped to Inactive.
record_saved). If it fails you'll see “An error occurred. Please try again.”
(error_occurred).
Replacing an outdated standard cost
To roll a product's standard forward, don't edit the old figure in place — create a fresh record:
Add a new standard cost for the same BOM
Enter the updated figures and a new Effective From date.
Keep Set as Active = Yes and Save
The previous active cost for that BOM is automatically set Inactive.
(Optional) Close out the old record
Edit the old record and set an Effective To date for clean record-keeping.
Deleting a standard cost
data-action="delete-confirmation") prompts you
before removal. On success you'll see “Record deleted successfully”
(record_deleted); if it can't be removed, record_cannot_be_deleted.
Deletes are soft (deleted = 1) — the row stays in the database and a DBA can restore it.
Actual Costs
The Actual Costs screen (production/ProductionCosting/actual_costs) lists the
as-incurred cost records you capture per Work Order and compares each
to the standard benchmark you entered, showing the variance amount and variance %.
What's on the page
| Element | What it does |
|---|---|
| New Actual Cost button | Opens the actual cost modal. |
| Standard Costs button | Back to the landing page. |
| Variance Analysis button | To the variance dashboard. |
#actual-costs-table | Lists all actual cost records. Columns below. |
| Row action | times/× icon = Delete. There is no edit action on actual costs. |
Actual Costs table columns
| Column | Meaning | Notes |
|---|---|---|
| Work Order | The order the actual costs belong to. | Shown as order_number - product_name. |
| Material | Actual material cost incurred. | |
| Labor | Actual labor cost incurred. | |
| Machine | Actual machine cost incurred. | |
| Overhead | Actual overhead allocated. | |
| Total Actual | Sum of all six actual components. | Shown bold; computed on save. |
| Standard | The standard benchmark you entered. | Manually typed on the form (see gotcha below). |
| Variance | Total Actual − Standard. | Red label when > 0 (over standard); green label when ≤ 0. |
| Variance % | Variance as a percent of standard. | (cost_variance / standard_cost) × 100, rounded to 2 dp; 0 when standard is 0. |
| Actions | Delete the row. | × only — no edit. |
The Actual Cost modal form
Reached from New Actual Cost. Every field:
| Field | Meaning | Required | Notes |
|---|---|---|---|
order_id — Work Order | The work order the actual costs belong to. | Required | Select2 of all work orders, shown as order_number - product_name. Unique per order (DB unique key on order_id + deleted). Carries data-rule-required. |
actual_material_cost — Material Cost | Actual material cost incurred on the order. | Optional | Number, step 0.01, default 0.00. decimal(15,2). |
actual_labor_cost — Labor Cost | Actual labor cost incurred. | Optional | Number, step 0.01, default 0.00. |
actual_machine_cost — Machine Cost | Actual machine / equipment cost incurred. | Optional | Number, step 0.01, default 0.00. |
actual_overhead_cost — Overhead Cost | Actual overhead allocated to the order. | Optional | Number, step 0.01, default 0.00. |
scrap_cost — Scrap Cost | Cost of scrapped / wasted material on the order. | Optional | Number, step 0.01, default 0.00. Added into Total Actual; actual-only (no standard equivalent). |
rework_cost — Rework Cost | Cost of reworking defective output. | Optional | Number, step 0.01, default 0.00. Added into Total Actual; actual-only. |
standard_cost — Standard Cost | The standard figure to benchmark the actuals against. | Optional | Number, step 0.01, default 0.00. Manually entered here — NOT auto-pulled from the standard cost record. Drives the variance calculation. |
total_actual_cost — Total Actual | Sum of all six actual components. | Computed | Material + Labor + Machine + Overhead + Scrap + Rework, computed on save. |
cost_variance — Variance | Total Actual − Standard. | Computed | Computed on save. Red label if > 0, green if ≤ 0. |
variance_percentage — Variance % | Variance as a percent of standard. | Computed | (cost_variance / standard_cost) × 100, rounded 2 dp; 0 when standard is 0. decimal(5,2). |
calculated_at — (not shown) | Timestamp the variance was calculated. | System | Set to current UTC on save. |
The footer has a Close button and a Save button.
0.00, Variance %
will read 0 and Variance will equal the whole Total Actual. Type the standard benchmark
deliberately.
order_id). You generally record
one actual cost per order, and there is no update path — saving always inserts. To change a
figure, delete the record and re-add it.
SOP — capture actual costs for a completed job
Open Actual Costs, click New Actual Cost
From the Standard Costs page, click Actual Costs, then New Actual Cost.
Select the Work Order
Pick the order from the dropdown.
Enter each actual component
Fill Material, Labor, Machine, Overhead, plus Scrap and Rework.
Enter the Standard Cost benchmark
Type the standard figure to compare against — remember it is not auto-filled.
Save
The system computes Total Actual, Variance (
Total Actual − Standard) and Variance %. The row appears with a red (over) or green (under) variance label.
Cost Variance Analysis
The Variance Analysis dashboard
(production/ProductionCosting/variance_analysis) is a company-wide roll-up of standard
vs. actual cost across all completed work orders, with four summary cards and a per-order
table that links into the drill-down.
completed appear here and in the roll-up totals.
In-progress orders won't show. Work Order status is set in the
Work Orders feature, not here.
manufacturing_actual_costs records
are a separate data set — the two views can disagree.
Summary cards
The Total Variance card carries a suffix that reads Over Budget when variance > 0, Under Budget when variance < 0, or On Budget when it's exactly 0.
“Variance by Work Order” table
| Column | Meaning | Notes |
|---|---|---|
| Work Order | The completed order. | Hyperlink — opens the Order Cost Detail drill-down. |
| BOM | The BOM the order builds. | |
| Standard Cost | Active standard total × quantity produced. | Per-unit standard scaled by the order quantity. |
| Actual Cost | Summed material issues + labor tracking. | Machine & overhead actuals are 0 here (see gotcha). |
| Variance | Actual − Standard. | Colored red (over) or green (under). |
| Variance % | Variance as a percent of standard. | Drives the status badge. |
| Status | Variance band badge. | High Variance / Moderate / On Target — see legend. |
Variance status bands
Each completed order is classified by the absolute value of its variance %:
Order Cost Detail — the drill-down
Clicking a Work Order link opens the per-order drill-down
(production/ProductionCosting/order_cost_detail/{order_id}). It compares standard vs.
actual cost for each cost component with per-line and total variance, and a headline variance
status. A Back button returns you to Variance Analysis.
Work Order Information panel
| Field | Meaning | Notes |
|---|---|---|
| Work Order | The order being analysed. | |
| Product | The product produced. | |
| BOM | The Bill of Materials used. | |
| Quantity Produced | Units the order produced. | Standard per-unit cost is multiplied by this. If 0, standard totals show 0. |
| Status | The work order status. | Only completed orders reach this view via the dashboard. |
Cost Breakdown table
| Cost Component | Standard Cost | Actual Cost | Variance |
|---|---|---|---|
| Material | Std unit × qty produced | Σ material issues | Actual − Standard (red over / green under) |
| Labor | Std unit × qty produced | Σ labor tracking | Actual − Standard |
| Machine | Std unit × qty produced | 0 (not summed) | Actual − Standard |
| Overhead | Std unit × qty produced | 0 (not summed) | Actual − Standard |
| Total | Sum of standard rows | Sum of actual rows | Total variance |
Per-line and total variance are computed as
component variance = actual − (standard unit cost × quantity produced), colored
red when over and green when under.
Variance Summary cards
The Variance Status badge uses the same bands as the dashboard — On Target Moderate High Variance.
How the numbers are colored
SOP — set a standard cost and review variance
completed; component-level actuals come from recorded material issues and labor tracking.Set the standard
On Standard Costs, create the active standard cost for the product's approved BOM (see the standard-cost SOP above).
Run and complete the job
Produce against the work order and mark it completed in Work Orders so it rolls into the dashboard.
Open Variance Analysis
Click Variance Analysis and read the four summary cards for the overall over/under-budget picture.
Spot the outliers
Scan the “Variance by Work Order” table for red High Variance and amber Moderate badges.
Drill into an order
Click the Work Order number to open Order Cost Detail.
Read the component breakdown
Inspect the Material / Labor / Machine / Overhead standard-vs-actual rows to see which category drove the variance.
Read the status and act
Check the Variance Status badge, then investigate the cause (material waste, labor overrun, etc.). Click Back to return to the dashboard.
Two variances live side by side — don't confuse them
This is the single most common point of confusion. There are two independent “variance” numbers:
Where: the Actual Costs list. Standard used: the number you manually typed
into the standard_cost field on each actual cost record. Actual used: the six
components you typed on that same record. Entirely operator-entered.
Where: Variance Analysis and Order Cost Detail. Standard used: the active standard cost total × quantity produced — the typed actual records are ignored. Actual used: summed material issues + labor tracking (material and labor only — machine and overhead read 0). Entirely recomputed from source data.
Gotchas & things to watch
Permissions & access
| Item | Detail |
|---|---|
| Permission key | manufacturing_costing — single permission gating the entire feature (view, create, update, delete across Standard Costs, Actual Costs, Variance Analysis and Order Cost Detail). |
| Label / action / category | Label “Production Costing”, action “Access Production Costing”, category “Manufacturing: Costing”. |
| Module gate | The manufacturing module must be enabled (with_module('manufacturing','redirect')). Without permission or module, you are redirected. |
See Permissions & Roles for the full matrix.
Validation & messages reference
| Situation | Rule / message |
|---|---|
| Save standard cost | id numeric, bom_id required + numeric, effective_from required. |
| Save actual cost | order_id required + numeric. |
| Delete (either) | id required + numeric. |
| Open standard modal | id numeric. |
| Client-side blocks | BOM, Work Order and Effective From carry data-rule-required — the form won't submit if empty. |
| Save success | “Record saved successfully” (record_saved). |
| Save failure | “An error occurred. Please try again.” (error_occurred). |
| Delete success | “Record deleted successfully” (record_deleted). |
| Delete failure | record_cannot_be_deleted. |
| Empty variance table | “No variance data available.” |
| Missing / bad order | Order Cost Detail returns a 404 if no order_id is supplied or the order is not found. |
Where the numbers come from
Costing does not stand alone — the analysis views pull live data from the rest of the shop floor:
- BOM (approved only)
- Standard costs are keyed to a BOM; only approved BOMs are selectable, and the product is derived from the BOM on save. See Bill of Materials.
- UOM (active only)
- The standard cost UOM dropdown lists only active units of measure as
name (symbol). - Work Orders
- Actual costs attach to a work order; Variance Analysis pulls only orders with status
completed; quantity produced scales the per-unit standard into a total. See Work Orders. - Material Issues
- The live actual material cost in the analysis/detail views is the sum of the order's material issues. See Material Requisitions & Issues.
- Labor Tracking
- The live actual labor cost is the sum of the order's labor records. See Labor Tracking.