@php $totalCash = 0; $totalTransfer = 0; $totalSubtotalQrisCash = 0; $totalSubtotalCard = 0; @endphp @foreach ($invoices as $invoice) @if ($invoice->payment === 'Multi') @php $totalCash += $invoice->cash; $totalTransfer += $invoice->transfer; $totalSubtotalCard += $invoice->transfer; @endphp @elseif ($invoice->payment === 'Cash') @php $totalCash += $invoice->subtotal; // Add subtotal for Cash and Qris to totalCash $totalSubtotalQrisCash += $invoice->subtotal; @endphp @elseif ($invoice->payment === 'Qris') @php $totalSubtotalCard += $invoice->subtotal; @endphp @elseif ($invoice->payment === 'Card') @php $totalSubtotalCard += $invoice->subtotal; @endphp {{-- mz --}} @else @endif @endforeach
Invoice Tanggal Jam User Staff Qty Grand Total Return Cash Card
{{ $invoice->no }} {{ $invoice->created_at->format('d/m/y') }} {{ $invoice->created_at->format('H:i') }} {{ $invoice->user->name }} {{ $invoice->sales_name }} {{ $invoice->qty }} {{ $invoice->must_paid }}{{ $invoice->cash }} {{ $invoice->transfer }}{{ $invoice->subtotal }} 00 {{ $invoice->subtotal }}0 {{ $invoice->subtotal }}0 0
Total {{ $invoices->sum('qty') }} {{ $invoices->sum('must_paid') }} {{ $totalCash }} {{ $totalSubtotalCard }}