@extends('../layout/' . $layout) @section('subhead') Atarud MIS - Charts of Accounts @endsection @section('subcontent') @php $total = 0; $payment =0; @endphp

Payables Reports

@include('../pages/account/reports/sidebar')
@csrf @method('get')

Report Content

@if(isset($startofmonth) && isset($endofmonth))
@endif
@if(isset($data['employees']))

Employees Payables

@php $totalEmpSalary = 0; @endphp @foreach($data['employees'] as $row) @php $completeSalary = App\Models\Salary::where('emp_id', $row->id)-> where('payment_status', 'complete')-> whereBetween('date', [ $data['startofmonth'], $data['endofmonth']])->first(); if($completeSalary != null) continue; $half = App\Models\Salary::where('emp_id', $row->id)-> where('payment_status', 'half')-> whereBetween('date', [ $data['startofmonth'], $data['endofmonth']])->first(); if($half != null ){ $paid = $half->payable_amount - $half->payment; $totalEmpSalary += $paid; }else{ $paid = $row->emp_salary_amount; $totalEmpSalary += $paid; } // $total += $row->payable_amount; @endphp @endforeach
# Name Salary Payment Remaining
{{++$loop->index}} {{$row->emp_fname}} {{$row->emp_salary_amount}} {{$half != null ? $half->payment : 0}} {{$paid}}
'; @php $total += $totalEmpSalary; @endphp
Remaining {{$totalEmpSalary }}
@endif
@if(isset($data))

Teachers Payables

@php $totalTeaSalary = 0; @endphp @foreach($data['teachers'] as $row) @php $completeSalary = App\Models\Salary::where('teacher_id', $row->id)-> where('payment_status', 'complete')-> whereBetween('date', [ $data['startofmonth'], $data['endofmonth']])->first(); if($completeSalary != null) continue; $half = App\Models\Salary::where('teacher_id', $row->id)-> where('payment_status', 'half')-> whereBetween('date', [ $data['startofmonth'], $data['endofmonth']])->first(); // $startMonth = $data['startofmonth']; $endMonth=$data['endofmonth']; $paid = ''; if($half != null ){ $payment = $half->payable_amount; $paid = $half->payable_amount - $half->payment; $totalTeaSalary += $paid; }else{ $contract = getTeacherSalary($row, $data['startofmonth'], $data['endofmonth']); if($contract[0] == null) continue; $paid = $contract[0]->salary_type == 'fixed' ? $contract[0]->salary : $contract[2]; $paid = $contract[0]->salary_type == 'fixed' ? $payment = $contract[0]->salary :$payment = $contract[2]; $totalTeaSalary += $paid; } // $total += $row->payable_amount; @endphp @endforeach
# Name Salary Payment Remaining
{{++$loop->index}} {{$row->name}} {{round($payment)}} {{$half != null ? round($half->payment) : 0}} {{round($paid)}}
'; @php $total += $totalTeaSalary; @endphp
Remaining {{round($totalTeaSalary) }}
@endif
@if(isset($vouchers))

Voucher Payables

@php $totalVoucher = 0; @endphp @foreach($vouchers as $row) @php $account = App\Models\ChartofAccount::where('id', $row->account_id)->first(); $totalAmount = 0; $totalPayment = 0; $totalAmount += $row->v_amount; $totalPayment += $row->v_paid; $totalVoucher += $row->v_amount - $row->v_paid; @endphp @endforeach
# Name Account Amount Payment Remaining
{{++$loop->index}} {{$row->v_title}} {{$account->name}} {{$row->v_amount}} {{$row->v_paid}} {{$row->v_amount - $row->v_paid}}
@php $total += $totalVoucher; @endphp ';
Remaining {{$totalVoucher }}
@endif
@if(isset($transactions))

Other Payables

@php $totalOther = 0; @endphp @foreach($transactions as $row) @php $account = App\Models\ChartofAccount::where('id', $row->account_id)->first(); $totalAmount = 0; $totalPayment = 0; $totalAmount += $row->amount; $totalPayment += $row->payment; $totalOther += $row->amount - $row->payment; @endphp @endforeach
# Name Account Amount Payment Remaining
{{++$loop->index}} {{$row->title}} {{$account->name}} {{$row->amount}} {{$row->payment}} {{$row->amount - $row->payment}}
@php $total += $totalOther; @endphp ';
Remaining {{$totalOther }}

';
Total Remaining {{round($total) }}
@endif
@endsection @section('script') @endsection