@php $isLoading = $tallySheet->isLoading(); $docTitle = $tallySheet->title ?: \App\Models\TallySheet::getTitleForType($tallySheet->operation_type); @endphp {{ $docTitle }} - {{ $tallySheet->vessel_name ?: 'MV' }}
{{ $docTitle }} - {{ $tallySheet->vessel_name ?: 'MV' }} Pratinjau Cetak Formulir ({{ $isLoading ? 'Untuk Loading' : 'Untuk Discharging' }}) • Total Lembar: {{ count($tallySheet->resolved_sheets) }}
Kembali
@php $sheets = $tallySheet->resolved_sheets; $totalSheetsCount = count($sheets); @endphp @foreach($sheets as $sIdx => $sh) @php $sItems = $sh['tally_items'] ?? []; $sTotals = $sh['totals'] ?? []; $sUnits = $sTotals['total_units'] ?? 0; $sPkgs = $sTotals['total_pkgs'] ?? 0; $sNo = $sh['sheet_no'] ?? ($sIdx + 1); $filledItems = array_values(array_filter($sItems, function ($r) { $bl = trim((string)($r['bl_no'] ?? '')); $desc = trim((string)($r['description'] ?? '')); $u = trim((string)($r['units'] ?? '')); $p = trim((string)($r['pkgs'] ?? '')); $tally = $r['tally'] ?? []; $hasTally = false; if (is_array($tally)) { foreach ($tally as $t) { if (trim((string)$t) !== '') { $hasTally = true; break; } } } return ($bl !== '' || $desc !== '' || $u !== '' || $p !== '' || $hasTally); })); $rowsToRender = count($filledItems) > 0 ? $filledItems : [ [ 'bl_no' => '', 'description' => '', 'tally' => array_fill(0, 10, ''), 'units' => '', 'pkgs' => '', ] ]; @endphp
{{-- Kop Surat Perusahaan --}}
Kop Surat PT. Anugrah Permata Samudra
{{-- Header with Sheet Number badge --}}

{{ $docTitle }}

SHEET {{ $sNo }} / {{ $totalSheetsCount }}
{{-- Meta Fields --}}
VESSEL : MV. {{ $tallySheet->vessel_name ?: '-' }} VOY. : {{ $tallySheet->voyage ?: '-' }}
BERTH : {{ $tallySheet->berth ?: '-' }} BERTHED TIME : {{ $tallySheet->berthed_time ?: '-' }} HRS    DATE : {{ $tallySheet->berthed_date ?: '-' }}
LOADING PORT : {{ $tallySheet->loading_port ?: '-' }} COMMENCED TIME : {{ $tallySheet->commenced_time ?: '-' }} HRS    DATE : {{ !empty($sh['date']) ? $sh['date'] : ($tallySheet->commenced_date ?: '-') }}
DISCHARGING PORT : {{ $tallySheet->discharging_port ?: '-' }} COMPLETED TIME : {{ $tallySheet->completed_time ?: '-' }} HRS    DATE : {{ $tallySheet->completed_date ?: '-' }}
{{-- Main Tally Table --}} @for($c = 1; $c <= 10; $c++) @endfor @foreach($rowsToRender as $r) @php $t = $r['tally'] ?? array_fill(0, 10, ''); @endphp @for($i = 0; $i < 10; $i++) @endfor @endforeach
B/L NO. DESCRIPTION OF CARGO TALLY TOTAL
{{ $c }}UNITS PKGS
{!! !empty($r['bl_no']) ? e($r['bl_no']) : ' ' !!} {!! !empty($r['description']) ? e($r['description']) : ' ' !!}{!! !empty($t[$i]) ? e($t[$i]) : ' ' !!}{{ !empty($r['units']) ? number_format((float)$r['units']) : '' }} {{ !empty($r['pkgs']) ? number_format((float)$r['pkgs']) : '' }}
TOTAL SHEET {{ $sNo }} {{ $sUnits > 0 ? number_format((float)$sUnits) : '-' }} {{ $sPkgs > 0 ? number_format((float)$sPkgs) : '-' }}
{{-- Signatures --}}
CHIEF CHECKER
{{ $tallySheet->chief_checker ?: '' }}
CHIEF OFFICER
{{ $tallySheet->chief_officer ?: '' }}
@endforeach