@use('App\Services\Date') @extends('reports::layouts.master') @section('title', __('reports::reports.cost_center')) @section('page-link') @endsection @section('action_buttons')
@if(LaravelLocalization::getCurrentLocale() === 'en') @else @endif @if(request()->all()) @can('reports.cost-center.export') @endcan @endif
@endsection @section('section_title') @lang('reports::reports.cost_center') @endsection @section('form-open-tag')
@lang('Filter')
@php $selectedCostCenters = (array) request('cost_centers', []); $allCostCentersCount = app(\Modules\Products\Repositories\CostCentersRepository::class)->count(); $costCentersCollection = is_array($data['costCenters']) ? collect($data['costCenters']) : $data['costCenters']; $hasAccessToAllCostCenters = auth()->user()->adjustRolesLikeOwnerPermissions() || $costCentersCollection->count() >= $allCostCentersCount; @endphp @error('cost_center_id') @enderror
@error('fiscal_year_id') @enderror @error('from') @enderror @error('to') @enderror
@error('show_sub_accounts') @enderror
@endsection @section('koolreport') @if(request()->all())

@lang('reports::reports.cost_center')

{{ $data['companyName'] }}

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

@foreach($data['selectedCostCenters'] as $costCenter) @endforeach @foreach($data['categorizedAccounts'] as $categoryName => $subCategories) @foreach($data['selectedCostCenters'] as $costCenter) @endforeach @foreach($subCategories as $subCategoryName => $accounts) @foreach($data['selectedCostCenters'] as $costCenter) @endforeach @foreach($accounts as $account) @if(!isset($account['id'])) @php // Far from ideal solution, but it's the only way to fix the issue of the account not having an id $account['id'] = rand(1, 1000000); $account['code'] = '0'; $account['name'] = '0'; @endphp @endif @foreach($data['selectedCostCenters'] as $costCenter) @endforeach @isset($account['childs']) @foreach($account['childs'] as $key => $childAccount) @foreach($data['selectedCostCenters'] as $costCenter) @endforeach @endforeach @foreach($data['selectedCostCenters'] as $costCenter) @endforeach @endisset @endforeach @foreach($data['selectedCostCenters'] as $costCenter) @endforeach @endforeach @foreach($data['selectedCostCenters'] as $costCenter) @endforeach @foreach($data['selectedCostCenters'] as $costCenter) @endforeach
{{($costCenter['code']?$costCenter['code'] . "-":"") . $costCenter['name_' . app()->getLocale()]}}
{{$categoryName}}
{{$subCategoryName}}
@lang('reports::reports.total cost center') {{$subCategoryName}} {{ isset( $data['subCategoriesTotalValues'][$subCategoryName][$costCenter['id']] ) ? $data['subCategoriesTotalValues'][$subCategoryName][$costCenter['id']] < 0 ? "(" .number_format(floatval($data['subCategoriesTotalValues'][$subCategoryName][$costCenter['id']]) * -1 ,2) .")" : number_format(floatval($data['subCategoriesTotalValues'][$subCategoryName][$costCenter['id']]),2) : 0 }}
@lang('reports::reports.total cost center') {{$categoryName}} {{ isset( $data['CategoriesTotalValues'][$categoryName][$costCenter['id']] ) ? $data['CategoriesTotalValues'][$categoryName][$costCenter['id']] < 0 ? "(" .number_format(floatval($data['CategoriesTotalValues'][$categoryName][$costCenter['id']] ) * -1 ,2) .")" : number_format(floatval($data['CategoriesTotalValues'][$categoryName][$costCenter['id']]),2) : 0 }} @endforeach
@lang('reports::reports.trial_balance.total') {{ isset( $data['totalCategoriesRecords'][$costCenter['id']] ) ? $data['totalCategoriesRecords'][$costCenter['id']] <= 0 ? "(" .number_format(floatval($data['totalCategoriesRecords'][$costCenter['id']] ) * -1 ,2) .")" : number_format(floatval($data['totalCategoriesRecords'][$costCenter['id']]),2) : 0 }}
@endif @endsection @section('filter-by-dates') @endsection @section('extra_scripts_filter_by_date')