@extends('layouts.app') @section('title', 'Production Details #' . $production->id) @section('content')

Production Order

#PROD-{{ str_pad($production->id, 5, '0', STR_PAD_LEFT) }}
{{ $production->product->name_ar ?? $production->product->name_en }}
{{ $production->product->code }}
{{ $production->branch->name ?? 'Main Store or Deleted' }}
{{ $production->created_at->format('M d, Y') }}
{{ $production->created_at->format('H:i') }}
Qty: {{ number_format($production->quantity_produced, 2) }}
Total: ${{ number_format($production->total_cost, 2) }}
Ingredients Used (Consumption Detail)
@if($production->product->recipe) @foreach($production->product->recipe->ingredients as $item) @php $ref = $item->ingredient ?? $item->childProduct; $name = $ref->name_ar ?? $ref->name_en ?? $ref->name; $consumed = $item->quantity * $production->quantity_produced; $unitCost = $item->ingredient ? $item->ingredient->cost_price : ($item->childProduct->base_purchase_price ?? 0); @endphp @endforeach @else @endif
Ingredient / Item Qty per Unit Total Consumed Estimated Cost
{{ $name }}
{{ $ref->code ?? '' }}
{{ number_format($item->quantity, 3) }} {{ number_format($consumed, 2) }} ${{ number_format($consumed * $unitCost, 2) }}
Recipe data not available for this production batch.
Batch Production Cost: ${{ number_format($production->total_cost, 2) }}
Production Summary

This production was authorized and performed by registered user ID#{{ $production->performed_by }}. All ingredients have been deducted from central/branch inventory according to the approved recipe.

${{ number_format($production->unit_cost, 2) }}
@endsection