Skip to content

Commit b220d64

Browse files
fix: match enum value of purpose in stockout
1 parent 916e694 commit b220d64

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

app/Services/IngredientStockOutService.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,13 @@ public function approve(IngredientStockOut $stockOut, int $userId): void
159159
: (float) $stock->average_cost;
160160

161161
$this->inventoryService->decreaseStock($warehouse, $item->ingredient, [
162-
'transaction_type' => 'stock_out',
162+
'transaction_type' => match ($stockOut->purpose) {
163+
'production_use' => 'production_consume',
164+
'kitchen_use' => 'sale_consume',
165+
'transfer' => 'transfer_out',
166+
'wastage' => 'wastage',
167+
default => 'adjustment_out',
168+
},
163169
'quantity' => (float) $item->quantity,
164170
'unit_cost' => $unitCost,
165171
'batch_id' => $item->ingredient_batch_id,

0 commit comments

Comments
 (0)