@php $grandTotalPrice = 0; $grandTotalCogs = 0; $grandTotalMarginNominal = 0; $grandTotalMarginPercent = 0; @endphp @forelse($data as $key => $item) @php $itemPrice = floatval($item->amount) / floatval($item->quantity); $itemCogs = floatval($item->cost_of_products_sold); $itemMarginNominal = floatval($itemPrice) - floatval($itemCogs); if($itemMarginNominal > 0.00){ $itemMarginPercent = ( floatval($itemMarginNominal) / floatval($itemCogs) ) * 100; }else{ $itemMarginPercent = 0; } $grandTotalPrice += $itemPrice; $grandTotalCogs += $itemCogs; $grandTotalMarginNominal += $itemMarginNominal; $grandTotalMarginPercent += $itemMarginPercent; @endphp @empty @endforelse
Kode Penjualaan Kode Produk Nama Produk Satuan Jumlah Harga Discount Total Cogs Margin
{{ $item->selling ? $item->selling->code : "-" }} {{ $item->product ? $item->product->code : "-" }} {{ $item->product ? $item->product->name : "-" }} {{ $item->product ? $item->product->selling_unit : "-" }} {{ number_format($item->quantity ?? 0,2,',','.') }} {{ number_format($item->price ?? 0,2,',','.') }} @if($item->selling) @if($item->selling->discount_type == "NOMINAL") ( RP ) @else ( % ) @endif @endif {{ number_format($item->discount ?? 0,2,',','.') }} {{ number_format($item->amount ?? 0,2,',','.') }} {{ number_format($item->cost_of_products_sold ?? 0,2,',','.') }} Margin (RP) : {{$itemMarginNominal}}
Margin (%) : {{$itemMarginPercent}}
Data tidak ditemukan
Total Harga {{ number_format($grandTotalPrice ?? 0,2,',','.') }}
Total Cogs {{ number_format($grandTotalCogs ?? 0,2,',','.') }}
Total Margin (Rp) {{ number_format($grandTotalMarginNominal ?? 0,2,',','.') }}
Total Margin (%) {{ number_format($grandTotalMarginPercent ?? 0,2,',','.') }}