{{__('messages.Achievements')}}

category_id {{-- branch_selected --}} {{__('messages.All Categories')}} @foreach(\App\Models\Category::whereNull("category_id")->where("active" ,1)->get() as $category) @endforeach
@if ($category_id )
{{ \App\Models\Category::find($category_id)->name}}
@php $target_query = \App\Models\Target::query(); $target_query->where("active",1); $target_query->whereDate("created_at" ,">=" , $from); $target_query->whereDate("created_at" ,"<=" , $to); $monthly_target_points_qry = \App\Models\MonthlyTargetPoint::query(); $monthly_target_points_qry->where("category_id" ,$category_id); $target_query->whereIn("monthly_target_point_id" ,$monthly_target_points_qry->pluck("id")); @endphp {{number_format( $target_query->sum("amount") ,2) }}
@else @foreach ($allCats as $cat)
{{$cat->name}}
@php $target_query = \App\Models\Target::query(); $target_query->where("active",1); $target_query->whereDate("created_at" ,">=" , $from); $target_query->whereDate("created_at" ,"<=" , $to); $monthly_target_points_qry = \App\Models\MonthlyTargetPoint::query(); $monthly_target_points_qry->where("category_id" ,$cat->id); $target_query->whereIn("monthly_target_point_id" ,$monthly_target_points_qry->pluck("id")); @endphp {{ number_format ($target_query->sum("amount"),2) }}
@endforeach @endif
{{__('messages.Total Achieved Points')}}
@if ($from ==$to) {{$from}} @else {{$from}} - {{$to}} @endif
{{ number_format( $targets,2) }}