@extends('layouts.pdf') @php $is_official = request()->is_official; $show_official_tag = !empty($is_official) && $is_official != 'combine'; $show_official = ($is_official == 'official' || $is_official == 'separate' || $is_official == 'combine' || empty($is_official)); $show_unofficial = ($is_official == 'unofficial' || $is_official == 'separate'); $is_summary = request()->report_type =='summary'; $summary_sub_grp_ids = request()->custom_summary_subgroup_ids ?? []; @endphp @section('title') {{ $extra['module_name'] }} @endsection @section('content') @php $head_name = array(); @endphp
@include('admin.partials.header', ['extra' => $extra]) @if($show_official) @endif @if($show_unofficial) @endif @php $net_profit = 0; @endphp @foreach ($data as $key => $group) {{-- Type --}} {{-- Expense, Revenue --}} @php $firstLevelTotal = 0; $secondLevelTotal = 0; $thirdLevelTotal = 0; @endphp @foreach ($group as $groupKey =>$groupValue) {{-- Group --}} @foreach ($groupValue as $subGroupKey => $subGroupValue) {{-- Sub Group --}} @php $code = reset($subGroupValue); $summary_group = $is_summary || in_array($subgroup_id,$summary_sub_grp_ids); @endphp @foreach ($subGroupValue as $transactionsKey => $transactionsValue) {{-- Transactions --}} @php $category = $transactionsValue['category_name']; $dr = $transactionsValue['dr']; $cr = $transactionsValue['cr']; $dr_unofficial = $transactionsValue['dr_unofficial']; $cr_unofficial = $transactionsValue['cr_unofficial']; if(empty($is_official) || $is_official=='combine'){ $dr = $dr + $dr_unofficial; $cr = $cr + $cr_unofficial; } $amount = $dr - $cr; $abs_amount = abs($amount); $is_less = ($amount) < 0; $amount_unofficial = $dr_unofficial - $cr_unofficial; $abs_amount_unofficial = abs($amount_unofficial); $is_less_unofficial = ($amount_unofficial) < 0; $firstLevelTotal += $amount; $secondLevelTotal += $amount; $thirdLevelTotal += $amount; $firstLevelTotal_unofficial += $amount_unofficial; $secondLevelTotal_unofficial += $amount_unofficial; $thirdLevelTotal_unofficial += $amount_unofficial; if(strtoupper($category) == 'EXPENSES'){ $total_expenses += $amount; $total_expenses_unofficial += $amount_unofficial; }else if(strtoupper($category) == 'REVENUE'){ $total_revenue += $amount; $total_revenue_unofficial += $amount_unofficial; } $hide_head = $transactionsValue['head_check'] == 1; @endphp @if(!$summary_group && !$hide_head) @if($show_official) @endif @if($show_unofficial) @endif @endif @endforeach {{-- End Transactions --}} @if($show_official) @endif @if($show_unofficial) @endif @php $secondLevelTotal = 0; $secondLevelTotal_unofficial = 0; @endphp @endforeach {{-- End Sub Group --}} @endforeach {{-- End Group --}} @if($show_official) @endif @if($show_unofficial) @endif @php $thirdLevelTotal = 0; $thirdLevelTotal_unofficial = 0; $net_profit = $total_revenue + $total_expenses; $net_profit_unofficial = $total_revenue_unofficial + $total_expenses_unofficial; @endphp @endforeach {{-- End Type --}} @if($show_official) @endif @if($show_unofficial) @endif
{{__('lang.code')}} {{__('lang.head')}}{{__('lang.amount')}} @if($show_official_tag) {{__('lang.official')}} @endif {{$transaction->systemSettingCurrency()}}{{__('lang.amount')}} {{__('lang.unofficial')}} {{$transaction->systemSettingCurrency()}}
{{ strtoupper($key) }}
{{ $groupKey }}
{{ $subGroupKey }}
{{ $transactionsKey}} {{$transactionsValue['name']}} @if ($is_less < 0) {{'Less'}} @endif {{ $transaction->convert_money_format($abs_amount) }} @if ($is_less_unofficial < 0) {{'Less'}} @endif {{ $transaction->convert_money_format($abs_amount_unofficial) }}
{{ strtoupper($subGroupKey) }} {{__('lang.total')}}{{ $transaction->isNegative($secondLevelTotal ) }}{{ $transaction->isNegative($secondLevelTotal_unofficial ) }}
{{ strtoupper($key) }} {{__('lang.total')}}{{ $transaction->isNegative($thirdLevelTotal ) }} {{ $transaction->isNegative($thirdLevelTotal_unofficial ) }}
{{__('lang.net_profit_loss')}}{{ $transaction->isNegative($net_profit) }}{{ $transaction->isNegative($net_profit_unofficial) }}

@stop