{{-- this +1 is for the total debit & credit for single journal entry --}}
| {{ $journalEntry['journal_date'] }} |
{{ $journalEntry['transaction_type'] }} |
{{ $journalEntry['code'] }} |
{{ $journalEntry['description'] }} |
{{ (@$journalEntry['journalRecords'][0]->account) ? $journalEntry['journalRecords'][0]->account->name : ''}} |
{{-- if supplier is null then it must be customer, so check if the first operand is null it will get the second --}}
@if(@$journalEntry['journalRecords'][0]->supplier)
{{$journalEntry['journalRecords'][0]->supplier->name}}
@elseif(@$journalEntry['journalRecords'][0]->customer)
{{$journalEntry['journalRecords'][0]->customer->name}}
@endif
|
{{-- THIS IN THE SERVICE ... COST A NESTED LOOP TO JUST GET THE CREDIT AND DEBIT, why not just do it in the view ??? --}}
{{-- {{ $journalEntry['journalRecords'][0]->description}} | --}}
{{ number_format($journalEntry['journalRecords'][0]->debit ?? 0,2)}} |
{{ number_format($journalEntry['journalRecords'][0]->credit ?? 0,2)}} |
{{-- @if($recordsCount > 1) --}}
@foreach ($journalEntry['journalRecords'] as $journalRecord)
@if ($loop->first) @continue @endif
| last) rowspan="2" @endif>{{ ($journalRecord->account)?$journalRecord->account->name:''}} |
{{-- if supplier is null then it must be customer, so check if the first operand is null it will get the second --}}
last) rowspan="2" @endif>
@if(@$journalRecord->supplier)
{{$journalRecord->supplier->name}}
@elseif(@$journalRecord->customer)
{{$journalRecord->customer->name}}
@endif
|
{{-- THIS IN THE SERVICE ... COST A NESTED LOOP TO JUST GET THE CREDIT AND DEBIT, why not just do it in the view ??? --}}
{{-- last) rowspan="2" @endif>{{ $journalRecord->description}} | --}}
{{ number_format($journalRecord->debit ?? 0,2)}} |
{{ number_format($journalRecord->credit ?? 0,2)}} |
@endforeach
{{-- @endif --}}