← Back to docs

Calculations — Recipes and Cost Calculation

Calculations are technology cards (recipes) that describe the composition of a product or service and allow the system to automatically calculate raw material consumption and cost price.

Calculations are the critical link between orders and inventory.

Orders use calculations to determine required ingredients. Calculations drive inventory write-offs and cost price computation.


What Is a Calculation

A calculation is a structured description of:

  • what a product or service consists of
  • which ingredients are used and in what quantities
  • which semi-finished goods are part of the composition

Based on a calculation, the system:

  • writes off raw materials from inventory at the "Ready" stage
  • calculates cost price for the order
  • monitors inventory requirements across concurrent orders

Why Calculations Matter

Calculations allow you to:

  • automate raw material accounting
  • eliminate manual ingredient math
  • understand cost price precisely
  • scale production with confidence
  • reduce human error

Without calculations:

  • inventory cannot correctly write off raw materials
  • cost price will be inaccurate or unavailable

Calculation Structure

A calculation consists of:

  • a product or service (the output)
  • a list of components (inputs)
  • a quantity for each component

Components can be:

  • raw materials — base ingredients or materials
  • semi-finished goods — intermediate products with their own calculations

Nested Calculations (Key Feature)

The system supports multi-level nesting:

Product
  → Semi-finished good
      → Semi-finished good
          → Raw material

This means:

  • semi-finished goods can have their own calculations
  • the system resolves the full chain recursively
  • all raw material consumption is computed bottom-up

Nesting allows you to model real-world production accurately, including bakery doughs, sauces, and other reusable intermediates.


How Calculations Work in an Order

When an order is moved to "In Progress":

  • the system analyzes the attached calculation
  • determines raw material requirements
  • shows what is missing in inventory

When an order is moved to "Ready":

  • automatic raw material write-off occurs in inventory
  • all nesting levels are resolved

For the full sequence of events, see Order Lifecycle.


Cost Price Calculation

Cost price is calculated:

  • based on the calculation structure
  • using average ingredient costs from inventory

Logic:

  • each ingredient has a unit cost
  • costs are aggregated across the full nesting chain
  • the total forms the cost price of the product

Cost price is used:

  • in the sales document
  • in reports
  • for profit analysis

Dynamic Changes (Flexibility)

During order execution you can:

  • modify a calculation
  • substitute ingredients
  • adjust quantities

This is useful when:

  • a raw material is out of stock
  • a recipe has changed
  • rapid adaptation is required

⚠️ Changes to a calculation affect the cost price of that order.


Working with Semi-Finished Goods

Semi-finished goods allow you to:

  • prepare batches in advance
  • reuse them across multiple orders
  • simplify complex production processes

Examples:

  • Dough → used in multiple baked products
  • Cream → used in several desserts

Semi-finished goods:

  • have their own calculations
  • are written off as separate units from inventory
  • can be prepared manually via the inventory module

Inventory Integration

Calculations directly control inventory:

  • they define what to write off
  • they define how much to write off
  • they affect stock balances

If a calculation is incorrect:

  • inventory will record inaccurate balances
  • cost price will be distorted

Inventory Modes and Calculations

Strict Mode

  • the calculation is used to enforce inventory limits
  • an order cannot proceed without sufficient raw materials

Allow Negative Stock

  • the calculation is used for cost computation only
  • inventory does not block order execution

⚠️ Cost price may be inaccurate in this mode.


Common Mistakes

  • not listing all ingredients
  • incorrect quantities
  • missing calculations for semi-finished goods
  • unit of measure mismatches

These lead to:

  • incorrect write-offs
  • inaccurate cost price

Best Practices

  • create calculations for all products
  • use semi-finished goods for recurring components
  • regularly verify ingredient prices in inventory
  • avoid overusing "allow negative stock" mode

Related Sections

  • Inventory — raw material tracking and write-offs
  • Orders — order execution and status transitions
  • Order Lifecycle — when write-offs and documents are triggered

FAQ

Are calculations required? No, but without them inventory write-offs and cost price will not work correctly.

Can I change a recipe while an order is in progress? Yes, changes are allowed at the "In Progress" stage.

How are semi-finished goods accounted for? Through nested calculations — the system resolves the full chain to raw materials.

Why does my cost price look wrong? Common causes:

  • incorrect or incomplete calculation
  • outdated ingredient prices
  • "allow negative stock" mode active