@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) @section('content') @include('layouts.navbars.auth.topnav', ['title' => 'Outstanding PR Detail']) @php $bsart = $bsart ?? request('bsart'); $codeRows = $outstandingPrCodeRows ?? []; $nonRows = $outstandingPrNonRows ?? []; $formatDate = function ($date) { return !empty($date) && $date !== '0000-00-00' ? \Carbon\Carbon::parse($date)->format('d-m-Y') : '-'; }; $dateOrder = function ($date) { return !empty($date) && $date !== '0000-00-00' ? $date : '1900-01-01'; }; $currentBsart = $bsart ?? ''; $bsartList = ['ZR15', 'ZR16', 'ZR17']; $renderRows = function ($rows, $label, $limit) use ($formatDate, $dateOrder) { $html = ''; foreach ($rows as $row) { $badat = $row['BADAT'] ?? null; $agingDays = (!empty($badat) && $badat !== '0000-00-00') ? abs(\Carbon\Carbon::parse($badat)->startOfDay()->diffInDays(now('Asia/Jakarta')->startOfDay())) : 0; $rowStyle = $agingDays > $limit ? ' style="background-color:#FFE1E1;"' : ''; $matnr = trim((string) ($row['MATNR'] ?? '')); $matnrClass = $matnr !== '' ? 'matnr-cell item-code-link' : ''; $html .= ''; $html .= '' . $label . ''; $html .= ''; $html .= '' . e($formatDate($row['BADAT'] ?? null)) . ''; $html .= '' . e($row['BANFN'] ?? '-') . ''; $html .= '' . (isset($row['BNFPO']) ? number_format((float) $row['BNFPO'], 0, '', '') : '-') . ''; $html .= '' . e($row['AFNAM'] ?? '-') . ''; $html .= '' . e($row['TXZ01'] ?? '-') . ''; $html .= '' . e($matnr !== '' ? $matnr : '-') . ''; $html .= '' . e($row['MATKL'] ?? '-') . ''; $html .= '' . number_format((float) ($row['MENGE'] ?? 0), 2, ',', '.') . ''; $html .= '' . e($row['MEINS'] ?? '-') . ''; $html .= '' . e($formatDate($row['LFDAT'] ?? null)) . ''; $html .= '' . e($formatDate($row['FRGDT'] ?? null)) . ''; $html .= '' . e(!empty($row['EBELN']) ? $row['EBELN'] : '-') . ''; $html .= '' . (!empty($row['EBELP']) ? number_format((float) $row['EBELP'], 0, '', '') : '-') . ''; $html .= '' . (!empty($row['BSMNG']) ? number_format((float) $row['BSMNG'], 2, ',', '.') : '-') . ''; $html .= '' . number_format((float) ($row['SISA'] ?? 0), 2, ',', '.') . ''; $html .= '' . number_format($agingDays, 0) . ''; $html .= ''; } if (empty($rows)) { $html .= ''; $html .= '' . $label . ''; $html .= '-'; $html .= '-'; $html .= '-'; $html .= '-'; $html .= '-'; $html .= 'No data'; $html .= '-'; $html .= '-'; $html .= '-'; $html .= '-'; $html .= '-'; $html .= '-'; $html .= '-'; $html .= '-'; $html .= '-'; $html .= '-'; $html .= '-'; $html .= ''; } return $html; }; @endphp
List Detail Outstanding PR @if($currentBsart) - {{ $currentBsart }} ({{ getBsartLabel($currentBsart) }}) @endif
{{ $currentBsart ?: 'Pilih Document Type terlebih dahulu' }}
Back
@foreach ($bsartList as $docType) {{ $docType }} @endforeach
@if (empty($currentBsart))
Silakan pilih Document Type terlebih dahulu untuk menampilkan data.
@else @php $tableHead = ' Section No Date PR No Item Requestor Remark Code Group Qty Unit Delivery Release PO No PO Item PO Qty Sisa Aging '; @endphp
{!! $tableHead !!} {!! $renderRows($codeRows, 'CODE', 3) !!}
{!! $tableHead !!} {!! $renderRows($nonRows, 'NON CODE', 14) !!}
@endif
@endsection @push('js') @endpush