@extends('reports::layouts.master_pdf') @section('extra_styles') @endsection @php $subdomain = request()->route()->parameter('subdomain'); $is_student = app(\Hyn\Tenancy\Repositories\HostnameRepository::class)->findByHostname($subdomain)->website->company->is_student; @endphp @section('koolreport') @if(isset($data['journalEntries']) )
@if($is_student) @include('draft_report') @endif

@lang('reports::reports.Journal Report')

{{$data['companyName']}}

@lang('from') {{$data['dates']['from']}} @lang('to') {{$data['dates']['to']}}

@if(isset($data['cost_center_name']))

@lang('reports::reports.cost_center'): {{$data['cost_center_name']}}

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