IMMREX7
@extends('students.student_layout')
@section('content')
<div role="tabpanel" class="tab-pane in active" id="details" aria-expanded="true">
<div class="card" id="details">
<div class="body">
<div class="row">
<div class="col-sm-6 col-sm-offset-1">
<address>
<strong> Student Name : </strong>{{$student->firstName}} {{$student->middleName}} {{$student->lastName}}<br>
<strong> Father Name : </strong>{{$student->father_fname}} {{$student->father_lname or ''}}<br>
<strong> Mobile : </strong>{{$student->father_mobile}}<br>
<strong> Class : </strong>{{$student->classM->className}}<br>
<strong> Section : </strong>{{$student->section->sectionName}}<br>
<strong> Ec No. : </strong>{{$student->ecNo}}<br>
@if($sessionPending > 0)
<p style="color:red"><u>Note</u>: You have an outstanding amount of Rs. {{$sessionPending}} in previous session.</p>
@endif
</address>
@if (session('status'))
@if(session('status') == 'Payment Error')
<div class="alert alert-warning">
{{ session('status') }}
</div>
@else
<div class="alert alert-success">
{{ session('status') }}
</div>
@endif
@endif
</div>
</div>
<form action="{{url('/student/payfees')}}" method= "get">
<div class="col-md-12">
<div class="col-sm-4 form-control-label">
<label for="classname"><strong>Choose a session</strong></label>
</div>
<div class="col-sm-6">
<div class="form-group">
@php $k =0 ; @endphp
@foreach($fy as $sessions)
<input type="radio" id="session{{$k}}" name="session" value="{{$sessions['id']}}" <?php if($sessions['id'] == Session::get('idStudent')) echo 'checked';?>>
<label for="session{{$k}}">Session </label> <strong>({{$sessions['yearName']}})</strong> <br>
@endforeach
</div>
</div>
<div class="col-sm-2">
<input class="btn btn-primary btn-round" type="submit" value="Switch" style="background-color:black;color:white;"/>
</div>
</div>
</form>
@if($plan == '')
<form action="{{url('/student/payfees')}}" method= "get" id="feesubmission">
<div class="col-md-12">
<div class="col-sm-4 form-control-label">
<label for="classname"><strong>Choose a payment method and press view button</strong></label>
</div>
<div class="col-sm-6">
<div class="form-group">
<input type="radio" id="paymode1" name="paymode" value="Plan A" <?php if($type == "Plan A") echo 'checked';?>>
@php
$plana_class_feeheads = \DB::table('feeheads')->where('idClass', '=', $student->idClass)
->where('idSection', '=', $student->idSection)
->where('idFinancialYear', '=', $student->idFinancialYear)
->where('studentCategory', '=', $student->studentType)
->where('feeheadLabel', 'LIKE', 'Plan A%')
->whereNull('idStudent');
// ->get();
$plana_allcat_feeheads = \DB::table('feeheads')->where('idClass', '=', $student->idClass)
->where('idSection', '=', $student->idSection)
->where('studentCategory', '=', 'All')
->where('idFinancialYear', '=', $student->idFinancialYear)
->where('feeheadLabel', 'LIKE', 'Plan A%')
->whereNull('idStudent');
// ->get();
$plana_feeheads = \DB::table('feeheads')->where('idStudent', '=', $student->idStudent)
->where('idFinancialYear', '=', $student->idFinancialYear)
->where('feeheadLabel', 'LIKE', 'Plan A%')
->union($plana_class_feeheads)
->union($plana_allcat_feeheads)
->orderBy('toDate')
->get();
$afeetotal = $plana_feeheads->sum('amount');
@endphp
<label for="paymode1">Fees in Full Payment</label> of <strong>₹{{$afeetotal}}</strong> <br>
<input type="radio" id="paymode2" name="paymode" value="Plan B" <?php if($type == "Plan B") echo 'checked';?>>
@php
$planb_class_feeheads = \DB::table('feeheads')->where('idClass', '=', $student->idClass)
->where('idSection', '=', $student->idSection)
->where('idFinancialYear', '=', $student->idFinancialYear)
->where('studentCategory', '=', $student->studentType)
->where('feeheadLabel', 'LIKE', 'Plan B%')
->whereNull('idStudent');
// ->get();
$planb_allcat_feeheads = \DB::table('feeheads')->where('idClass', '=', $student->idClass)
->where('idSection', '=', $student->idSection)
->where('studentCategory', '=', 'All')
->where('idFinancialYear', '=', $student->idFinancialYear)
->where('feeheadLabel', 'LIKE', 'Plan B%')
->whereNull('idStudent');
// ->get();
$planb_feeheads = \DB::table('feeheads')->where('idStudent', '=', $student->idStudent)
->where('idFinancialYear', '=', $student->idFinancialYear)
->where('feeheadLabel', 'LIKE', 'Plan B%')
->union($planb_class_feeheads)
->union($planb_allcat_feeheads)
->orderBy('toDate')
->get();
$bfeetotal = $planb_feeheads->sum('amount');
@endphp
<label for="paymode2">Fees in Terms</label> of <strong>₹{{$bfeetotal}}</strong> <br>
<input type="radio" id="paymode3" name="paymode" value="Plan C" <?php if($type == "Plan C") echo 'checked';?>>
@php
$planc_class_feeheads = \DB::table('feeheads')->where('idClass', '=', $student->idClass)
->where('idSection', '=', $student->idSection)
->where('idFinancialYear', '=', $student->idFinancialYear)
->where('studentCategory', '=', $student->studentType)
->where('feeheadLabel', 'LIKE', 'Plan C%')
->whereNull('idStudent');
// ->get();
$planc_allcat_feeheads = \DB::table('feeheads')->where('idClass', '=', $student->idClass)
->where('idSection', '=', $student->idSection)
->where('studentCategory', '=', 'All')
->where('idFinancialYear', '=', $student->idFinancialYear)
->where('feeheadLabel', 'LIKE', 'Plan C%')
->whereNull('idStudent');
// ->get();
$planc_feeheads = \DB::table('feeheads')->where('idStudent', '=', $student->idStudent)
->where('idFinancialYear', '=', $student->idFinancialYear)
->where('feeheadLabel', 'LIKE', 'Plan C%')
->union($planc_class_feeheads)
->union($planc_allcat_feeheads)
->orderBy('toDate')
->get();
$cfeetotal = $planc_feeheads->sum('amount');
@endphp
<label for="paymode3">Fees in Installments</label> of <strong>₹{{$cfeetotal}}</strong> <br>
</div>
</div>
<div class="col-sm-2">
<input class="btn btn-primary btn-round" type="submit" value="View" style="background-color:black;color:white;"/>
</div>
</div>
</form>
@endif
<div class="mt-40"></div>
<div class="row">
<div class="col-md-12" style="margin:10px;">
<div class="table-responsive col-md-12">
<?php
$custID = $student->idStudent . "F" . $student->idFinancialYear;
$logo = \App\School::where('idSchool', '=', $student->idSchool)->first();
?>
<table class="table table-hover">
<thead>
<tr>
<th></th>
<th style="width:60px;">Due Date</th>
<th>Particular</th>
<th>Amount</th>
<th>Discount</th>
<th>Fine</th>
<th>Fine Collected</th>
<th>Amount Collected</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php $paidFine=0; $disableHeader = true; $totalPaid = 0;$totalAmount = 0; $accessAmount = 0;$balance = 0;?>
@foreach($feeData as $var)
@php
$paidFine = $paidFine + $var['transaction']['paid_fine'];
$totalPaid = $totalPaid + $var['transaction']['paid'];
$balance = $balance + $var['balance'];
$accessAmount = $accessAmount + $var['extra_amount'];
$totalAmount = $totalAmount + $var['total_amount'];
@endphp
<tr>
<td>
@if($var['isEnabled'] == true && $var['isPaid'] != "Paid")
<div class="checkbox-inline" style="padding-left:10px;">
@if($disableHeader)
<input type="checkbox" name="selectedHeaders[]" value="{{$var['idFeehead']}}" class="feeclass">
<?php $disableHeader = false; ?>
@endif
</div>
@endif
</td>
<td>{{ Carbon\Carbon::parse($var['toDate'])->format('d-m-Y') }}</td>
<td>
{{$var['feeheadName']}}
<input type="hidden" name='feeheads[{{$var['idFeehead']}}][idFeehead]' value="{{$var['idFeehead']}}">
</td>
<td class='amt'>
{{$var['amount']}}
<input type="hidden" name='feeheads[{{$var['idFeehead']}}][famount]' value="{{$var['amount']}}">
</td>
<td class="discount">
{{$var['discount']}}
<input type="hidden" name='feeheads[{{$var['idFeehead']}}][discount]' value="{{$var['discount']}}">
</td>
<td class="fine">
{{$var['fine']}}
<input type="hidden" name='feeheads[{{$var['idFeehead']}}][fine]' value="{{$var['fine']}} ">
</td>
<td>{{$var['transaction']['paid_fine']}}</td>
<td>{{$var['transaction']['paid']}}</td>
<td>
@if($var['isPaid'] == "Upcoming")
<span class="badge badge-info">UPCOMING</span>
@else
@if($var['isPaid'] == "Paid")
<span class="badge badge-success">Paid </span>
@else
@if($var['isPaid'] == "Due")
<span class="badge badge-danger">DUE</span>
@else
<span class="badge badge-info">Partial-Paid</span>
@endif
@endif
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<div class="col-sm-12">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Date</th>
<th>Header</th>
<th>Amount</th>
<!--<th>Balance</th>-->
<th>Fine</th>
<th>Payment Mode</th>
<th>Print</th>
</tr>
</thead>
<tbody>
@foreach($paidfees as $var)
<tr>
<td>{{$var->paymentDate}}</td>
@php
$headers = \App\StudentTransactionDetail::where('idTransaction', $var->idTransaction)->where(function($query) {
$query->whereNull('status');
$query->orWhere('status', '=', 'In-Process');
$query->orWhere('status', '=', 'Cleared');
$query->orWhere('status', '=', 'Success');
})->pluck('idFeehead')->toArray();
$headerName = \DB::table('feeheads')->whereIn('idFeehead',$headers)->pluck('feeheadName')->toArray();
@endphp
<td>
@foreach( $headerName as $key =>$value)
{{$value}}<br>
@endforeach
</td>
<td>{{$var->totalPaid}}</td>
<td>{{$var->fine}}</td>
<td>{{$var->paymentMode}}</td>
<td><a href="{{url('student/stdtransaction/'.$var->idTransaction.'/print')}}" target="_blank" class="btn btn-sm btn-info">Print</a></td>
</tr>
@endforeach
</tbody>
</table>
</div>
<h5>Lesser Paid Receipt</h5>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Date</th>
<th>Header</th>
<th>Amount</th>
<!--<th>Balance</th>-->
<th>Fine</th>
<th>Payment Mode</th>
<th>Print</th>
</tr>
</thead>
<tbody>
@foreach($lesserfees as $var)
@php $details = DB::table('lesser_transaction_details')->selectRaw('SUM(lesser_transaction_details.fine) as fine')->where('idLesserTransaction',$var->idLesserTransaction)->first(); @endphp
<tr>
<td>{{$var->paymentDate}}</td>
@php
$headers = \App\LesserTransactionDetail::where('idLesserTransaction', $var->idLesserTransaction)->where(function($query) {
$query->whereNull('status');
$query->orWhere('status', '=', 'In-Process');
$query->orWhere('status', '=', 'Cleared');
$query->orWhere('status', '=', 'Success');
})->pluck('idFeehead')->toArray();
$headerName = \DB::table('feeheads')->whereIn('idFeehead',$headers)->pluck('feeheadName')->toArray();
@endphp
<td>
@foreach( $headerName as $key =>$value)
{{$value}}<br>
@endforeach
</td>
<td>{{$var->totalPaid}}</td>
<td><?php if(isset($details->fine))
{
echo $details->fine;
}?></td>
<td>{{$var->paymentMode}}</td>
@if($var->status == 'Cleared' || $var->status == null)
<td><a href="{{url('student/stdtransaction/lessamt/'.$var->idLesserTransaction.'/print')}}" target="_blank" class="btn btn-sm btn-info">Print</a></td>
@endif
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<hr>
<div class="row col-md-12">
<div class="col-md-5">
<div class="row clearfix">
<div class="col-sm-6 form-control-label">
<label for="classname">Payable Amount</label>
</div>
<div class="col-sm-6">
<div class="form-group">
@if(isset($prevaccess_fee->excessAmount))
@if($prevaccess_fee->excessAmount > 0)
<label id="access_note"><b>Excess Amount Available: </b>{{$prevaccess_fee->excessAmount}} </label>
@endif
@endif
<input type="text" name="payableAmount" class="form-control" readonly="readonly" style="color: black;font-size: 1.2em;">
</div>
</div>
</div>
</div>
<div class="col-md-6 text-right">
<p class="m-b-0"><b>Fee Total: </b><span id='total_fee'></span>
<input type="hidden" name="feeTotal" id="feetotal">
</p>
<p class="m-b-0">
<b>Discount: </b>
<span id='total_discount'></span>
<input type="hidden" name="discount" id="discounttotal">
</p>
<p class="m-b-0">
<b>Fine: </b>
<span id='total_fine'></span>
<input type="hidden" name="fine" id="finetotal">
</p>
<p class="m-b-0">
<b>Cheque Bounce Penalty: </b>
<span id="penaltyAmt"></span>
<?php
$chqbounce = \App\StudentTransaction::where('idStudent', '=', $student->idStudent)
->where('idFinancialYear', '=', $student->idFinancialYear)
->where('status', '=', 'Bounced')
->get();
$chqPenaltyAmount = 0;
$chqPenaltyPaid = 0;
$chqPenaltyUnPaid = 0;
if (isset($chqbounce)) {
foreach ($chqbounce as $chqFine) {
if ($chqFine->chqFineStatus == 1)
$chqPenaltyPaid = $chqPenaltyPaid + $chqFine->chequeBounceCharge;
else
$chqPenaltyUnPaid = $chqPenaltyUnPaid + $chqFine->chequeBounceCharge;
$chqPenaltyAmount = $chqPenaltyAmount + $chqFine->chequeBounceCharge;
}
}
?>
@if(isset($chqbounce))
{{$chqPenaltyAmount}}
@if($chqPenaltyAmount==0)
<span></span>
@elseif($chqPenaltyAmount > $chqPenaltyPaid)
<span style="color:red"> | {{$chqPenaltyUnPaid}}(Unpaid)</span>
@else
<span style="color:green">(Paid)</span>
@endif
@else
<span>0.00</span>
@endif
</p>
<p class="m-b-0"><b>Excess Amount : </b>
@if(isset($prevaccess_fee->excessAmount))
{{$prevaccess_fee->excessAmount + $accessAmount}}
@else
<span>{{$accessAmount}}</span>
@endif
</p>
<p class="m-b-0"><b>Fine Amount : </b>
{{$paidFine}}
</p>
<p class="m-b-0"><b>Total Amount : </b>
{{$totalAmount}}
</p>
<p class="m-b-0"><b>Total Paid: </b>
<span id='total_paid'>
{{$totalPaid}}
</span>
</p>
<p class="m-b-0"><b>Balance Amount: </b>
{{$balance}}
</p>
</div>
</div>
<!--<hr>-->
<div id="juspayDiv"></div>
<hr>
<div class="hidden-print col-md-12 text-right">
@if($sessionPending == 0)
<button class="btn btn-primary btn-round" id="submit-btn">Pay Now</button>
@endif
</div>
</div>
</div>
</div>
@stop
@section('script')
<script src="https://ebz-static.s3.ap-south-1.amazonaws.com/easecheckout/easebuzz-checkout.js"></script>
<script>
// Saving form data
$(document).ready(function(){
$('.otherpaymode').hide();
$('#paymode').change(function() {
var val = $(this).val();
if((val == 'Cheque')){
$('.otherpaymode').show();
}else if(val == 'DD'){
$('.otherpaymode').show();
}else{
$('.otherpaymode').hide();
}
});
});
var feeheaderIds = [];
$('.feeclass').change(function() {
feeheaderIds = [];
$("input:checkbox[name='selectedHeaders[]']:checked").each(function () {
feeheaderIds.push($(this).val());
});
if(feeheaderIds.length>0)
$.ajax({
url: "{{url('/student/feeheaders') }}"+'/' +feeheaderIds + "/students/"+{{$student->idStudent}},
type: "GET",
dataType: "json",
success:function(data) {
$('input[name="payableAmount"]').val(data);
}
});
else $('input[name="payableAmount"]').val(" ");
});
function calculatePenalty(){
var penaltyAmt = parseFloat($('#penalty').val());
console.log(penaltyAmt);
$('#penaltyAmt').text(penaltyAmt.toFixed(2));
}
var sum = 0;
var discount = 0;
var fine = 0;
// iterate through each td based on class and add the values
$(".amt").each(function() {
var value = $(this).text();
// add only if the value is number
if(!isNaN(value) && value.length != 0) {
sum += parseFloat(value);
}
$('#total_fee').text(sum.toFixed(2));
});
$(".discount").each(function() {
var value = Number($(this).text());
// add only if the value is number
if(!isNaN(value) && value.length != 0) {
discount += parseFloat(value);
}
$('#total_discount').text(discount.toFixed(2));
});
$(".fine").each(function() {
var value = Number($(this).text());
// add only if the value is number
if(!isNaN(value) && value.length != 0) {
fine += parseFloat(value);
}
$('#total_fine').text(fine.toFixed(2));
});
var ftotal = parseFloat($('#total_fee').text());
var tdiscount = parseFloat($('#total_discount').text());
var tfine = parseFloat($('#total_fine').text());
var paidtot = parseFloat($('#total_paid').text());
var fbalance = parseFloat(ftotal+paidtot);
$('#total_balance').text(fbalance.toFixed(2));
var feetotal = parseFloat(ftotal);
$('#feetotal').val(feetotal.toFixed(2));
var distotal = parseFloat($('#total_discount').text());
$('#discounttotal').val(distotal.toFixed(2));
var tf = parseFloat($('#total_fine').text());
$('#finetotal').val(tf.toFixed(2));
var baltotal = parseFloat(ftotal+tfine-tdiscount);
$('#balance_total').text(baltotal.toFixed(2));
</script>
<script>
document.getElementById('submit-btn').onclick = function (e) {
e.preventDefault();
var requestPayload = JSON.stringify({
amount: $('input[name="payableAmount"]').val(),
idStudent: {{$student->idStudent}},
idFinancialYear: {{$student->idFinancialYear}},
selectedHeaders : feeheaderIds,
});
$("#submit-btn").prop('disabled', true);
var requestOptions = {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-CSRF-TOKEN": "{{ csrf_token() }}",
},
body: requestPayload,
};
fetch("https://online-login.online/student/makePayment", requestOptions)
.then((response) => response.json())
.then((result) => {
// console.log(result);
$('#paymentModal').modal('show')
var easebuzzCheckout = new EasebuzzCheckout(result.key, 'prod')
var options = {
access_key: result.token, // access key received via Initiate Payment
onResponse: (response) => {
if (response.status == "success") {
window.location.href = "{{url('student/payfees')}}";
}
},
theme: "#11385b" // color hex
}
$('#submit-btn').hide();
easebuzzCheckout.initiatePayment(options);
})
.catch((error) => console.log("error", error));
return false;
}
</script>
@stop
Copyright © 2021 -