Skip to main content

Internal Consumption

Base path: /api/internal-consumption

Internal consumption tracks products used within the salon (e.g., dye or treatments consumed during services). Costs are always calculated using the purchase_price, never the sale price.

info

This feature can be disabled via Settings > Features (internal_consumption_enabled). It requires purchase_orders_enabled to be active.

GET /internal-consumption/orders

List all internal consumption orders with staff name and item counts.

Auth: Logged in

Query parameters:

ParameterTypeDescription
pageintegerPage number (activates pagination)
limitintegerItems per page (default 50)
fromdate (YYYY-MM-DD)Start date filter
todate (YYYY-MM-DD)End date filter

Each order in the list includes an item_count field.


POST /internal-consumption/orders

Create a new internal consumption order and immediately deduct stock.

Auth: Logged in

Request body:

FieldTypeRequiredDescription
staff_idintegerYesStaff member who consumed the products
itemsarrayYesArray of consumed items (min 1)
notesstringNoReason / notes

Item object

{
"product_id": 5,
"qty": 2,
"unit_price": 3.50
}

unit_price should be the product's purchase_price. The order total is calculated as the sum of qty * unit_price across all items.

The order receives an auto-generated number using the EIGEN sequence (e.g., EIGEN2601). Stock is deducted from products.quantity_on_hand and inventory_transactions rows are created with a negative delta.

Response (201): Created order object with order_number, total, staff_name, and the full items array including product_name and product_sku.


GET /internal-consumption/orders/:id

Get a single order with all its items.

Auth: Logged in

Response: Order object with items array. Each item includes product_name, product_sku, and product_article_number.


DELETE /internal-consumption/orders/:id

Delete an internal consumption order and restore stock.

Auth: Admin

Deleting an order is fully reversible: each consumed product's quantity_on_hand is incremented by the recorded quantity, and a reversing inventory_transactions row is created with a positive delta and reason "Eigen verbruik {order_number} teruggedraaid".

Response: { "ok": true }


Auto-numbering

Internal consumption orders use the EIGEN sequence prefix with yearly reset.

Format: EIGEN{YY}{NN} (e.g., EIGEN2601, EIGEN2602).