@foreach ($bankAccounts as $accounts) @php $initialBlance = 0; if ($accounts->initial_balance) { $initialBlance = $accounts->initial_balance; } $deposit = $accounts->bankTrans ->where('transaction_type', 'deposit') ->whereBetween('transaction_date', [$from_date, $date_to]) ->sum('deposit'); $customerReceived = $accounts->customerPayment ->where('transaction_type', 'receive') ->whereBetween('date', [$from_date, $date_to]) ->sum('amount'); $supplierReceived = $accounts->supplierPayment ->where('transaction_type', 'receive') ->whereBetween('date', [$from_date, $date_to]) ->sum('amount'); $withdraw = $accounts->bankTrans ->where('transaction_type', 'withdraw') ->whereBetween('transaction_date', [$from_date, $date_to]) ->sum('withdraw'); $customerPayment = $accounts->customerPayment ->where('transaction_type', 'payment') ->whereBetween('date', [$from_date, $date_to]) ->sum('amount'); $supplierPayment = $accounts->supplierPayment ->where('transaction_type', 'payment') ->whereBetween('date', [$from_date, $date_to]) ->sum('amount'); $totalIn = $deposit + $customerReceived + $supplierReceived + $initialBlance - ($withdraw + $customerPayment + $supplierPayment); @endphp @endforeach @if (count($sales) > 0) @endif @foreach ($sales as $sale) @endforeach @if (count($customerTrans->where('transaction_type', 'receive')) > 0) @endif @foreach ($customerTrans->where('transaction_type', 'receive') as $customerTran) @endforeach @if (count($customerTrans->where('transaction_type', 'receive')) > 0) @endif @foreach ($customerTrans->where('transaction_type', 'receive') as $customerTran) @endforeach
Description Amount
Opening Balance
Bank Accounts 00.00
{{ $accounts->bank_name }} {{ $accounts->account_name }} {{ $accounts->account_number }} {{ number_format($totalIn, 2) }}
Cash in Hand {{ $cashInHand }}
Cash {{ $cashInHand }}
Receipt
Sales {{ number_format($sales->sum('total_paid'), 2) }}
{{ $sale->customer->customer_name }} {{ number_format($sale->total_paid, 2) }}
Customer Payment {{ number_format($customerTrans->where('transaction_type', 'receive')->sum('amount'), 2) }}
{{ $customerTran->customer->customer_name }} {{ number_format($customerTran->amount, 2) }}
Bank Deposits (Not Calculated) {{ number_format($customerTrans->where('transaction_type', 'receive')->sum('amount'), 2) }}
{{ $customerTran->customer->customer_name }} {{ number_format($customerTran->amount, 2) }}
Total
00.00
@foreach ($purchase as $purch) @endforeach @foreach ($bankAccounts as $accounts) @php $initialBlance = 0; if ($accounts->initial_balance) { $initialBlance = $accounts->initial_balance; } $deposit = $accounts->bankTrans ->where('transaction_type', 'deposit') ->whereBetween('transaction_date', [$from_date, $date_to]) ->sum('deposit'); $customerReceived = $accounts->customerPayment ->where('transaction_type', 'receive') ->whereBetween('date', [$from_date, $date_to]) ->sum('amount'); $supplierReceived = $accounts->supplierPayment ->where('transaction_type', 'receive') ->whereBetween('date', [$from_date, $date_to]) ->sum('amount'); $withdraw = $accounts->bankTrans ->where('transaction_type', 'withdraw') ->whereBetween('transaction_date', [$from_date, $date_to]) ->sum('withdraw'); $customerPayment = $accounts->customerPayment ->where('transaction_type', 'payment') ->whereBetween('date', [$from_date, $date_to]) ->sum('amount'); $supplierPayment = $accounts->supplierPayment ->where('transaction_type', 'payment') ->whereBetween('date', [$from_date, $date_to]) ->sum('amount'); $totalIn = $deposit + $customerReceived + $supplierReceived + $initialBlance - ($withdraw + $customerPayment + $supplierPayment); @endphp @endforeach
Description Amount
Payment
Closing Balance
Purchase 00.00
{{ $purch->supplier->supplier_name }} {{ number_format($purch->total_paid, 2) }}
Bank Accounts 00.00
{{ $accounts->bank_name }} {{ $accounts->account_name }} {{ $accounts->account_number }} {{ number_format($totalIn, 2) }}
Cash in Hand {{ $cashInHandOut }}
Cash {{ $cashInHandOut }}
Total
00.00