@if ($tampilan == 'rekap') @else @endif @foreach ($transaksi as $tran) @if ($tampilan == 'rekap') @else @endif @endforeach
No Nama BarangSatuan Stok Qty Pembelian Qty Penjualan Qty Stok Opname Qty Stok PromoTanggal Invoice Transaksi Customer/Supplier Jumlah Stok Tersedia Keterangan Harga
{{ $loop->iteration }} {{ $tran->barang->nama ?? '-' }}{{ $tran->barang->satuan ?? '-' }} {{ number_format($tran->barang->stok->stok ?? 0, 0, ',', '.') }} {{ number_format($tran->qty_pembelian, 0, ',', '.') }} {{ number_format($tran->qty_penjualan, 0, ',', '.') }} {{ number_format($tran->qty_stok_opname, 0, ',', '.') }} {{ number_format($tran->qty_stok_promo, 0, ',', '.') }} {{ date('d/m/Y', strtotime($tran->transaksi->tanggal_faktur ?? '-')) }} {{ $tran->transaksi->no_faktur ?? '-' }} {{ isset($tran->transaksi->jenis) ? $jenis[$tran->transaksi->jenis] : '-' }} @if ($tran->transaksi) @if ($tran->transaksi->supplier) Supplier {{ $tran->transaksi->supplier->nama_perusahaan }} @elseif($tran->transaksi->customer) Customer {{ $tran->transaksi->customer->nama }} @else - @endif @else - @endif @php $jumlah = $tran->jumlah; $promo_quantity = 0; // Cek jika ada promo if ($tran->transaksi && $tran->transaksi->jenis == 2) { $promo = $tran->barang->promos() ->where('start_date', '<=', $tran->transaksi->tanggal_faktur) ->where('end_date', '>=', $tran->transaksi->tanggal_faktur) ->first(); if ($promo) { if ($promo->is_multiplier) { $kelipatan = floor($jumlah / $promo->minimum_quantity); $promo_quantity = $kelipatan * $promo->promo_quantity; } else { $promo_quantity = $promo->promo_quantity; } } } $total_jumlah = $jumlah + $promo_quantity; $color = ''; // Tentukan warna berdasarkan jenis transaksi if ($tran->transaksi) { switch ($tran->transaksi->jenis) { case 1: // Pembelian case 4: // Retur Penjualan $color = 'color: green;'; break; case 2: // Penjualan case 3: // Retur Pembelian $color = 'color: red;'; break; } } @endphp {{ number_format($total_jumlah, 0, ',', '.') }} @if($promo_quantity > 0) ({{ number_format($jumlah, 0, ',', '.') }} + {{ number_format($promo_quantity, 0, ',', '.') }} promo) @endif @php $stok_gudang_1 = $tran->barang->lokasi_barang->stok_lokasi_1 ?? 0; $stok_gudang_2 = $tran->barang->lokasi_barang->stok_lokasi_2 ?? 0; $total_stok = $stok_gudang_1 + $stok_gudang_2; @endphp {{ number_format($total_stok, 0, ',', '.') }} {{ $tran->transaksi->keterangan }} @php $harga = 0; if ($tran->transaksi) { switch ($tran->transaksi->jenis) { case 1: // Pembelian $harga = $tran->harga_beli * $tran->jumlah; break; case 2: // Penjualan $harga = $tran->harga_jual * $tran->jumlah; break; case 3: // Retur Pembelian $harga = $tran->harga_beli * $tran->jumlah; break; case 4: // Retur Penjualan $harga = $tran->harga_jual * $tran->jumlah; break; } } @endphp Rp {{ number_format($harga, 0, ',', '.') }}
@push('scripts') @endpush