Logo @if(!$is_pdf) Back @endif
{{ $company->company_name ?? '' }}
{{ $company->address ?? '' }}, {{ $company->city ?? '' }}, {{ $company->state ?? ''}}
Phone: {{ $company->phone1 ?? ''}}
GST NO: {{ $company->gst_no ?? '' }}

BILL NOT UPDATED
@if(!$is_pdf)
Reset
@endif @php $grandBalance = 0; @endphp @forelse($groupedOrders as $order_id => $transactions) @php $transactions = collect($transactions); $first = $transactions->first(); $rowCount = $transactions->count(); // total order amount $totalAmount = (float) ($first->order_amount ?? 0); // last transaction (for balance) $lastTxn = $transactions->last(); $remaining = (float) ($lastTxn->remaining_amount ?? 0); @endphp @foreach($transactions as $index => $txn) {{-- SHOW ONLY FIRST ROW --}} @if($index == 0) @endif {{-- TOTAL --}} {{-- PAID --}} {{-- BALANCE ONLY LAST ROW --}} {{-- DATE --}} {{-- PAYMENT METHOD --}} {{-- RECEIPT --}} {{-- REMARK --}} @php // update total for next row (running balance) $totalAmount = (float) ($txn->remaining_amount ?? 0); @endphp @endforeach @empty @endforelse {{-- GRAND TOTAL --}}
Order No Rec No Customer Name Total Paid Balance Transaction Date Payment Method Receipt Type Remark
{{ $txn->order_code ?? '-' }} {{ $txn->rec_no ?? '-' }} {{ $txn->customer_name ?? '-' }} {{ number_format($totalAmount, 2) }} {{ number_format((float) ($txn->pay_amount ?? 0), 2) }} @if($index == $rowCount - 1) @php $grandBalance += $totalAmount-$txn->pay_amount; @endphp {{ number_format($totalAmount-$txn->pay_amount, 2) }} @else {{number_format($totalAmount-$txn->pay_amount, 2)}} @endif {{ !empty($txn->transaction_date) ? \Carbon\Carbon::parse($txn->transaction_date)->format('d-m-Y') : '-' }} @php $mode = $txn->payment_mode ?? ''; @endphp @if($mode === 'Bank Transfer') Bank Transfer
Bank: {{ $txn->bank_name ?? '-' }}
Ac: {{ $txn->account_number ?? '-' }}
IFSC: {{ $txn->ifsc_code ?? '-' }} @elseif($mode === 'Cheque') Cheque
No: {{ $txn->cheque_number ?? '-' }} @elseif($mode === 'Online') Online
Txn: {{ $txn->reference_id ?? '-' }} @else {{ $mode ?: '-' }} @endif
{{ $txn->receipt_type ?? '-' }} {{ is_scalar($txn->remark ?? null) ? $txn->remark : '-' }}
No records found
Total Balance {{ number_format($grandBalance, 2) }}


@if(!$is_pdf) Download @endif