{{-- HEADER --}}

LAPORAN PURCHASE REQUEST

Dicetak pada {{ now()->format('d/m/Y H:i:s') }}
{{-- FILTER --}}
Filter Laporan
Pencarian {{ $search !== '' ? $search : 'Semua' }} Tanggal @if ($dateFrom !== '' || $dateTo !== '') {{ $dateFrom !== '' ? \Carbon\Carbon::parse($dateFrom)->format('d/m/Y') : '...' }} s/d {{ $dateTo !== '' ? \Carbon\Carbon::parse($dateTo)->format('d/m/Y') : '...' }} @else Semua @endif
Approval {{ $approvalStatus !== '' ? $approvalStatus : 'Semua' }} Procurement {{ $procurementStatus !== '' ? $procurementStatus : 'Semua' }}
Department {{ $departmentId !== '' ? $departmentId : 'Semua Department' }}
{{-- REPORT --}} @if ($purchaseRequests->count() > 0) @foreach ($purchaseRequests as $index => $purchaseRequest) @php $totalEstimasi = $purchaseRequest->items ? $purchaseRequest->items->sum('total_amount') : 0; $approvalStatusValue = $purchaseRequest->approval_status ?? '-'; $procurementStatusValue = $purchaseRequest->procurement_status ?? '-'; $approvalClass = match (strtolower((string) $approvalStatusValue)) { 'approved' => 'status-approved', 'rejected' => 'status-rejected', default => 'status-pending', }; $procurementClass = match (strtolower((string) $procurementStatusValue)) { 'completed' => 'status-completed', 'canceled', 'cancelled' => 'status-canceled', 'processing' => 'status-processing', 'ordered' => 'status-ordered', 'received' => 'status-received', default => 'status-pending', }; @endphp {{-- NO --}} {{-- PR NUMBER --}} {{-- REQUEST DATE --}} {{-- EMPLOYEE --}} {{-- DEPARTMENT --}} {{-- VENDOR --}} {{-- TOTAL --}} {{-- APPROVAL 1 --}} {{-- APPROVAL 2 --}} {{-- APPROVAL STATUS --}} {{-- PROCUREMENT STATUS --}} {{-- REQUIRED DATE --}} {{-- REASON --}} @endforeach
No No. PR Tanggal Pengaju Department Vendor Total Estimasi Approval 1 Approval 2 Approval Procurement Tgl Dibutuhkan Alasan Pembelian
{{ $index + 1 }} {{ $purchaseRequest->pr_number ?? '-' }} @if ($purchaseRequest->request_date) {{ \Carbon\Carbon::parse($purchaseRequest->request_date)->format('d/m/Y') }} @else - @endif {{ $purchaseRequest->employee?->full_name ?? '-' }} {{ $purchaseRequest->department?->department_name ?? '-' }} {{ $purchaseRequest->vendor?->supplier_name ?? '-' }} Rp {{ number_format($totalEstimasi, 0, ',', '.') }} {{ $purchaseRequest->approval1?->name ?? '-' }} {{ $purchaseRequest->approval2?->name ?? '-' }} {{ $approvalStatusValue }} {{ $procurementStatusValue }} @if ($purchaseRequest->required_date) {{ \Carbon\Carbon::parse($purchaseRequest->required_date)->format('d/m/Y') }} @else - @endif {{ $purchaseRequest->reason ?? '-' }}
TOTAL Rp {{ number_format( $purchaseRequests->sum( fn($pr) => $pr->items ? $pr->items->sum('total_amount') : 0 ), 0, ',', '.' ) }}
@else
Tidak ada data Purchase Request berdasarkan filter yang dipilih.
@endif {{-- FOOTER --}}