@php $total_salary = 0; $total_paid = 0; $total_deducted = 0; $total_due = 0; @endphp @foreach($employees as $employee) @php $payment_amount = $employee->salaryPayment->where('month',$monthName)->sum('payment_amount'); $deducted_amount = $employee->salaryPayment->where('month',$monthName)->sum('deducted_amount'); @endphp @endforeach {{-- --}}
Sl Employee Id Employee Name Department Designation Month Salary Total Paid Total Deducted Due
# {{$employee->id }} {{$employee->name }} {{$employee->department }} {{$employee->designation }} {{ $monthName }} {{$employee->salary_range }} {{$payment_amount}} {{ $deducted_amount }} {{ $employee->salary_range - $payment_amount }} @php $total_salary = $total_salary + $employee->salary_range; $total_paid = $total_paid + $payment_amount; $total_deducted = $total_deducted + $deducted_amount; $total_due = $total_due + ($employee->salary_range - $payment_amount); @endphp
Total {{$total_salary}} {{$total_paid}} {{$total_deducted}} {{$total_due}}{{$calculateData['total']}}