@extends('backEnd.master')
@section('title')
@lang('fees.pay_fees')
@endsection
@section('mainContent')
@php
$grand_total = 0;
$total_fine = 0;
$total_discount = 0;
$total_paid = 0;
$total_grand_paid = 0;
$total_balance = 0;
$count = 0;
@endphp
@foreach ($record->fees as $fees_assigned)
@php
$count++;
$grand_total += $fees_assigned->feesGroupMaster->amount;
@endphp
@php
$discount_amount = $fees_assigned->applied_discount;
$total_discount += $discount_amount;
$student_id = $fees_assigned->student_id;
@endphp
@php
$paid = App\SmFeesAssign::discountSum($fees_assigned->student_id, $fees_assigned->feesGroupMaster->feesTypes->id, 'amount', $fees_assigned->record_id);
$total_grand_paid += $paid;
@endphp
@php
$fine = App\SmFeesAssign::discountSum($fees_assigned->student_id, $fees_assigned->feesGroupMaster->feesTypes->id, 'fine', $fees_assigned->record_id);
$total_fine += $fine;
@endphp
@php
$total_paid = $discount_amount + $paid;
@endphp
@lang('fees.fees_group')
@lang('fees.due_date')
@lang('common.status')
@lang('fees.amount') ({{ generalSetting()->currency_symbol }})
@lang('fees.payment_id')
@lang('fees.mode')
@lang('common.date')
@lang('fees.discount') ({{ generalSetting()->currency_symbol }})
@lang('fees.fine') ({{ generalSetting()->currency_symbol }})
@lang('fees.paid') ({{ generalSetting()->currency_symbol }})
@lang('fees.balance') ({{ generalSetting()->currency_symbol }})
@lang('fees.payment')
@php
$payments = App\SmFeesAssign::feesPayment($fees_assigned->feesGroupMaster->feesTypes->id, $fees_assigned->student_id, $fees_assigned->record_id);
$i = 0;
@endphp
@foreach ($payments as $payment)
{{ @$fees_assigned->feesGroupMaster->feesGroups->name }}
/ {{ @$fees_assigned->feesGroupMaster->feesTypes->name }}
{{ @$fees_assigned->feesGroupMaster->date != '' ? dateConvert(@$fees_assigned->feesGroupMaster->date) : '' }}
@php
$total_payable_amount = number_format($fees_assigned->feesGroupMaster->amount, 2, '.', '');
@endphp
@php
$rest_amount = $fees_assigned->fees_amount;
$total_balance += $rest_amount;
$balance_amount = number_format($rest_amount, 2, '.', '');
@endphp
@if ($total_paid == $total_payable_amount)
@elseif($paid != 0)
@elseif($paid == 0)
@endif
@php
echo $total_payable_amount;
@endphp
{{ number_format($discount_amount, 2, '.', '') }}
{{ number_format($fine, 2, '.', '') }}
{{ number_format($paid, 2, '.', '') }}
@php
$rest_amount = $fees_assigned->fees_amount;
// $total_balance += $rest_amount;
echo number_format($fees_assigned->fees_amount, 2, '.', '');
@endphp
@if ($total_paid == $total_payable_amount)
@endif
@if ($rest_amount = !0)
@php
$already_add = App\SmBankPaymentSlip::where('student_id', $fees_assigned->student_id)
->where('fees_type_id', $fees_assigned->feesGroupMaster->fees_type_id)
->first();
@endphp
@if ($total_paid != $total_payable_amount)
@endforeach
@endforeach
@foreach ($record->feesDiscounts as $fees_discount)
@php
$created_by = App\User::find($payment->created_by);
@endphp
@if ($created_by != '')
{{ $payment->fees_type_id . '/' . $payment->id }}
@endif
{{ $payment->payment_mode }}
{{ $payment->payment_date != '' ? dateConvert($payment->payment_date) : '' }}
{{ number_format($payment->discount_amount, 2, '.', '') }}
{{ number_format($payment->fine, 2, '.', '') }}
@if ($payment->fine != 0)
@if (strlen($payment->fine_title) > 14)
{{ number_format($payment->amount, 2, '.', '') }}
@endforeach
@lang('fees.discount')
{{ $fees_discount->feesDiscount != '' ? $fees_discount->feesDiscount->name : '' }}
@if (in_array($fees_discount->id, $applied_discount))
@php
$createdBy = App\SmFeesAssign::createdBy($student_id, $fees_discount->id, $fees_discount->record_id);
@endphp
@if ($createdBy != '')
@php
$created_by = App\User::find($createdBy->created_by);
@endphp
@if (!empty($created_by))
@lang('fees.discount_of')
{{ currency_format($fees_discount->feesDiscount->amount) }}
@lang('fees.applied')
:
{{ $createdBy->id . '/' . $createdBy->created_by }}
@endif
@endif
@else
@lang('fees.discount_of')
{{ $fees_discount->feesDiscount != '' ? currency_format($fees_discount->feesDiscount->amount) : '' }}
@lang('fees.assigned')
@endif
{{ $fees_discount->name }}
@lang('fees.grand_total') ({{ generalSetting()->currency_symbol }})
{{-- {{ number_format($grand_total+$total_fine, 2, '.', '') }} --}}
{{ currency_format($grand_total) }}
{{ currency_format($total_discount) }}
{{ currency_format($total_fine) }}
{{ currency_format($total_grand_paid) }}
{{ currency_format($total_balance) }}