{{-- Company Info --}}
@if(isset($oneAccount))
{{-- Selected Bank Info --}}
| Bank Name |
: |
{{ $oneAccount->bank_name }} |
| Account Number |
: |
{{ $oneAccount->account_number ?? '---' }} |
{{-- Ledger Table --}}
Account Ledger
{{-- @if(isset($oneAccount) && isset($sdate)))
@php
$balance = $oneAccount->opening_balance ?? 0;
@endphp --}}
|
Previous Balance |
0 |
0 |
0 |
0 |
{{ $previous_balance_closing }} |
{{-- @else
@endif --}}
@php
$balance = 0;
@endphp
@foreach($bank_transaction as $transaction)
@php
$fromBankId = null;
$toBankId = null;
if ($transaction->trans_type === 'transfer') {
$fromBankId = $transaction->from_bank_id ?? null;
$toBankId = $transaction->to_bank_id ?? null;
}
$debit = 0;
$credit = 0;
if ($transaction->trans_type === 'withdraw') {
$debit = $transaction->amount;
} elseif ($transaction->trans_type === 'deposit') {
$credit = $transaction->amount;
} elseif ($transaction->trans_type === 'transfer') {
if ($fromBankId == $oneAccount->id) {
// এই account থেকে টাকা গেছে → শুধু debit
$debit = $transaction->amount;
} elseif ($toBankId == $oneAccount->id) {
// এই account এ টাকা এসেছে → শুধু credit
$credit = $transaction->amount;
}
}
$invoice = App\Models\Invoice::where('id',$transaction->invoice_id)->first();
$balance = $balance + $credit - $debit;
@endphp
| {{ date('Y-m-d', strtotime($transaction->date)) }} |
@if($transaction->pay_type == 'purchase')
Purchase
( {{$transaction->purchase?->purchase_no }} )
@elseif($transaction->pay_type == 'ownpay')
Owner Deposit
@elseif($transaction->pay_type == 'ownwith')
Owner Withdrow
@elseif($transaction->pay_type == 'invpay')
Sale
( {{$transaction->invoice?->invoice_no }} )
@else
{{$transaction->pay_type}}
@endif
|
{{ $transaction?->note_type ?? $invoice?->note_type }} |
{{ $transaction?->note ?? $invoice?->note }} |
{{ $debit }} |
{{ $credit }} |
{{ $balance }} |
@endforeach
{{-- Closing Balance --}}
Closing Balance : {{ $balance_closing }}
@else
Please Select a Bank Account
@endif