@extends('mitra.layouts.app') @section('title', 'Rekapan Invoice Harian') @section('content')

Rekapan Invoice Harian

{{ $sppg->nama }} — {{ \Carbon\Carbon::parse($tanggal)->translatedFormat('d F Y') }}

Total: Rp {{ number_format($totalHarian, 0, ',', '.') }} ({{ count($rows) }} baris / nota)

@if(($anggaranHarian ?? 0) > 0 || ($keuntungan !== null && $keuntungan >= 0))

Info Keuntungan

Anggaran harian: Rp {{ number_format($anggaranHarian ?? 0, 0, ',', '.') }} Total penagihan: Rp {{ number_format($totalHarian, 0, ',', '.') }} @if($keuntungan !== null && $keuntungan >= 0) Keuntungan (selisih): Rp {{ number_format($keuntungan, 0, ',', '.') }} @endif
@endif
@foreach($rows as $row) @php $pembelian = $row->pembelian ?? null; $itemAlloc = $row->item_allocation ?? null; $useItemAllocation = is_array($itemAlloc) && count($itemAlloc) > 0; @endphp @if(!$pembelian) @continue @endif
{{ $pembelian->nota->nomor_nota_sistem ?? '-' }} {{ $pembelian->penjual_nama }} @if($row->is_pecah) Alokasi pecah {{ $row->jumlah_hari }} hari @endif
Rp {{ number_format($row->amount, 0, ',', '.') }}
@if($useItemAllocation) @foreach($pembelian->items as $item) @php $alloc = $row->item_allocation[$item->id] ?? null; $showAlloc = $alloc && ((float)($alloc['quantity'] ?? 0) > 0 || (float)($alloc['amount'] ?? 0) > 0); @endphp @if($showAlloc) @php $jmlAlloc = (float) ($alloc['quantity'] ?? 0); $satuanRaw = strtolower($item->satuan ?? $item->bahan->satuan_bahan ?? 'gram'); if ($satuanRaw === 'l') { $satuanRaw = 'liter'; } elseif ($satuanRaw === 'gr') { $satuanRaw = 'gram'; } elseif ($satuanRaw === 'mililiter') { $satuanRaw = 'ml'; } $showKg = ($satuanRaw === 'gram' && $jmlAlloc >= 1000); $showLiter = ($satuanRaw === 'ml' && $jmlAlloc >= 1000); $jmlDisplay = ($showKg || $showLiter) ? $jmlAlloc / 1000 : $jmlAlloc; $satuanDisplay = $showKg ? 'kg' : ($showLiter ? 'liter' : $satuanRaw); @endphp @endif @endforeach @endif @if(!$useItemAllocation) @foreach($pembelian->items as $item) @php $jmlDiterima = (float) $item->jumlah_diterima; $satuanRaw = strtolower($item->satuan ?? $item->bahan->satuan_bahan ?? 'gram'); if ($satuanRaw === 'l') { $satuanRaw = 'liter'; } elseif ($satuanRaw === 'gr') { $satuanRaw = 'gram'; } elseif ($satuanRaw === 'mililiter') { $satuanRaw = 'ml'; } $showKg = ($satuanRaw === 'gram' && $jmlDiterima >= 1000); $showLiter = ($satuanRaw === 'ml' && $jmlDiterima >= 1000); $jmlDisplay = ($showKg || $showLiter) ? $jmlDiterima / 1000 : $jmlDiterima; $satuanDisplay = $showKg ? 'kg' : ($showLiter ? 'liter' : $satuanRaw); @endphp @endforeach @endif
Bahan Jumlah Harga/satuan Total
{{ $item->bahan->nama_bahan ?? '-' }} {{ number_format($jmlDisplay, 2, ',', '.') }} {{ $satuanDisplay }} Rp {{ number_format($item->harga_jual_penjual_per_satuan ?? 0, 0, ',', '.') }} Rp {{ number_format($alloc['amount'] ?? 0, 0, ',', '.') }}
{{ $item->bahan->nama_bahan ?? '-' }} {{ number_format($jmlDisplay, 2, ',', '.') }} {{ $satuanDisplay }} Rp {{ number_format($item->harga_jual_penjual_per_satuan, 0, ',', '.') }} Rp {{ number_format($item->total_harga_beli, 0, ',', '.') }}
@endforeach Kembali @endsection