@use('App\Services\Date') @extends('reports::layouts.master') @section('title', __('reports::reports.Purchases Summary Report')) @section('page-link') @endsection @section('action_buttons')
@if(LaravelLocalization::getCurrentLocale() === 'en') @else @endif @if(request()->all()) @can('reports.purchases-summary.export') @endcan @endif
@endsection @section('section_title') @lang('reports::reports.Purchases Summary Report') @endsection @section('form-open-tag')
@lang('Filter')
@php $selectedCostCenters = (array) request('cost_centers', []); // Fallback logic if needed if (empty($selectedCostCenters) && request()->has('cost_center_id')) { $selectedCostCenters = (array) request('cost_center_id'); } $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('supplier_id') @enderror
@error('fiscal_year_id') @enderror @error('from') @enderror @error('to') @enderror
@endsection @section('extra_styles') @parent @endsection @section('koolreport') @if(request()->all())

@lang('reports::reports.Purchases Summary Report')

@lang('reports::reports.company name') :{{ $data['companyName'] }}

@lang('reports::reports.supplier name') :{{optional(@$data['suppliers']->where('id',$data['purchasesTransactions'])->first()->supplier_id)->first()->name ?? $data['suppliers']->where('id',request('supplier_id'))->first()->name}}

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


@lang('reports::reports.report summary'):

@lang('reports::reports.total purchases')

{{ number_format($data['total_purchases'],2,".",",") }}

{!! __('settings::currencies.SAR') !!}

@lang('reports::reports.total paid')

{{ number_format($data['paid_purchases'],2,".",",") }}

{!! __('settings::currencies.SAR') !!}

@lang('reports::reports.total remaining')

{{ number_format($data['remaining_purchases'],2,".",",") }}

{!! __('settings::currencies.SAR') !!}

@lang('reports::reports.total payment')

{{ number_format($data['total_payment'],2,".",",") }}

{!! __('settings::currencies.SAR') !!}

@lang('reports::reports.not assigned pay in')

{{ number_format($data['not_assigned_pay_in'],2,".",",") }}

{!! __('settings::currencies.SAR') !!}

@lang('reports::reports.not assigned pay out')

{{ number_format($data['not_assigned_pay_out'],2,".",",") }}

{!! __('settings::currencies.SAR') !!}

@if(!count($data['purchasesTransactions'])) @else @foreach ($data['purchasesTransactions'] as $transaction) @endforeach @endif
@lang('purchases::transactions.Date') @lang('purchases::transactions.Reference ID') @lang('purchases::transactions.type') @lang('purchases::purchase_bills.Description') @lang('purchases::purchase_bills.Supplier Invoice Reference Number') @lang('purchases::transactions.status') @lang('purchases::purchase_bills.gross') @lang('purchases::purchase_bills.vat_value') @lang('purchases::purchase_bills.total_amount') @lang('purchases::transactions.paid') @lang('purchases::purchase_bills.remaningAmount')
{{__('reports::reports.no_data')}}
{{$transaction->date}}{{ Date::format($transaction->date, 'date') }} route_name}.show", ['subdomain' => $subdomain, "{$transaction->routeVariableName}" => $transaction->id])}}">{{$transaction->reference}} {{ $transaction->operationType }} {{ $transaction->description }} {{ $transaction->supplier_invoice_reference_number }} {{ $transaction->status ? Modules\Purchases\Enums\BillStatusEnum::toString($transaction->status) : ($transaction->kind ? Modules\Purchases\Enums\PaymentReceiptTypesEnum::toString($transaction->kind) : '') }} {{ number_format(abs($transaction->gross),2,".",",") }} {{ number_format(abs($transaction->total_vat),2,".",",") }} {{ number_format(abs($transaction->total),2,".",",") }} {{ ($transaction->paid_amount < 0 ) ? '(' . number_format(abs($transaction->paid_amount),2,".",",") . ')' : number_format($transaction->paid_amount,2,".",",") }} {{ ($transaction->outstanding < 0 ) ? '(' . number_format(abs($transaction->outstanding),2,".",",") . ')' : number_format($transaction->outstanding,2,".",",") }}

@lang('reports::reports.accrual_basis') {{ Date::format(now(), 'datetime') }}
@endif @endsection @section('extra_scripts_filter_by_date') @endsection