Masukkan harga jual untuk masing-masing unit agar keuntungan tercatat akurat per barang.
@foreach($hps as $hp)
{{ $hp->merk_model }}
{{ $hp->imei }}
@if($hp->warna)
{{ $hp->warna }}
@endif
@if($hp->keterangan_minus)
Minus: {{ $hp->keterangan_minus }}
@endif
@if(auth()->user()?->isAdmin())
Modal: {{ number_format($hp->total_modal ?? 0, 0, ',', '.') }}
@endif
{{-- Kalkulasi Laba Realtime (khusus admin) --}}
@if(auth()->user()?->isAdmin() && isset($harga_jual_items[$hp->id]) && is_numeric($harga_jual_items[$hp->id]))
@php $laba = $harga_jual_items[$hp->id] - ($hp->total_modal ?? 0); @endphp
Laba:
Rp {{ number_format($laba, 0, ',', '.') }}
@endif
@endforeach
{{-- Summary Check --}}
@php
$sumItems = 0;
foreach($harga_jual_items as $val) {
$sumItems += (float) $val;
}
@endphp
Total Rincian:
Rp {{ number_format($sumItems, 0, ',', '.') }}
@if($sumItems != $total_transaksi)
Selisih: Rp {{ number_format($total_transaksi - $sumItems, 0, ',', '.') }}
@endif