@extends('layouts.teknisi') @section('title', 'History Produksi - Teknisi') @section('content')

History Produksi

Riwayat produksi yang sudah selesai

Kembali ke Produksi Aktif
{{-- Quick Stats --}} @php $totalHistory = $productions->total(); $thisMonth = $productions->where('end_date', '>=', now()->startOfMonth())->count(); $totalCost = $productions->sum(function($p) { $materialTotal = $p->total_material_cost ?? 0; $sparepartTotal = $p->total_sparepart_cost ?? 0; $directTotal = $materialTotal + $sparepartTotal; $laborTotal = $p->labor_cost ?? 0; return $directTotal + $laborTotal; }); @endphp

Total History

{{ $totalHistory }}

Selesai Bulan Ini

{{ $thisMonth }}

Total Biaya

Rp {{ number_format($totalCost, 0, ',', '.') }}

@if($productions->count() > 0)
@foreach($productions as $production) @php $materialTotal = $production->total_material_cost ?? 0; $sparepartTotal = $production->total_sparepart_cost ?? 0; $directTotal = $materialTotal + $sparepartTotal; $laborTotal = $production->labor_cost ?? 0; $actualTotal = $directTotal + $laborTotal; @endphp @endforeach
Produk Customer Qty Tanggal Selesai Biaya Langsung Biaya Labor Total Aktual Aksi
Selesai
{{ $production->product->product_title ?? 'N/A' }}
ID: #{{ $production->id }}
{{ $production->order->customer_name ?? 'N/A' }}
Order #{{ $production->order->id ?? 'N/A' }}
{{ $production->quantity }} unit
{{ $production->end_date ? $production->end_date->format('d M Y') : 'N/A' }}
@if($production->start_date)
Mulai: {{ $production->start_date->format('d M Y') }}
@endif
Rp {{ number_format($directTotal, 0, ',', '.') }}
Bahan: Rp {{ number_format($materialTotal, 0, ',', '.') }}
Sparepart: Rp {{ number_format($sparepartTotal, 0, ',', '.') }}
@if($laborTotal > 0)
Rp {{ number_format($laborTotal, 0, ',', '.') }}
/unit: Rp {{ number_format($laborTotal / max($production->quantity, 1), 0, ',', '.') }}
@else - @endif
Rp {{ number_format($actualTotal, 0, ',', '.') }}
/unit: Rp {{ number_format($actualTotal / max($production->quantity, 1), 0, ',', '.') }}
Detail
{{ $productions->links() }}
@else

Belum Ada History

Anda belum menyelesaikan produksi apapun. History akan muncul setelah produksi selesai.

Kembali ke Produksi Aktif
@endif
@endsection