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>
</address>
</div>
</div>
<div class="mt-40"></div>
<div class="row">
<div class="col-md-7">
<div class="table-responsive">
{!! Form::open(['url' => 'student/feesubmission', 'class' => 'form-horizontal']) !!}
<!-- Hidden input for online fee submission -->
<input type="hidden" name="MerchantID" value="ASPCS">
<input type="hidden" name="CustomerID" value="{{$student->idStudent}}"/>
<input type="hidden" name="currencyType" value="INR"/>
<input type="hidden" name="TypeField1" value="R"/>
<input type="hidden" name="TypeField2" value="F"/>
<input type="hidden" name="SecurityID" value="aspcs"/>
<input type="hidden" name="RU" value='{{url('student/feesuccessful')}}'/>
<!-- Additional Parameter-->
<input type="hidden" name="idStudent" value="{{$student->idStudent}}">
<input type="hidden" name="idFinancialYear" value="{{$student->idFinancialYear}}">
<table class="table table-hover">
<thead>
<tr>
<th style="width:60px;">Due Date</th>
<th>Particular</th>
<th>Amount</th>
<th>Discount</th>
<th>Fine</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@foreach($feeheads as $fee)
<tr>
<td>{{ Carbon\Carbon::parse($fee->toDate)->format('d-m-Y') }}</td>
<td>
{{$fee->feeheadName}}
<input type="hidden" name='feeheads[{{$fee->idFeehead}}][idFeehead]' value="{{$fee->idFeehead}}">
</td>
<td class='amt'>
{{$fee->amount}}
<input type="hidden" name='feeheads[{{$fee->idFeehead}}][famount]' value="{{$fee->amount}}">
</td>
<td class="discount">
<?php $sdiscount = \App\StudentDiscount::where('idStudent','=',$student->idStudent)
->where('idFeehead','=',$fee->idFeehead)->first();?>
@if($sdiscount)
<span>
{{$sdiscount->amount}}
<input type="hidden" name='feeheads[{{$fee->idFeehead}}][discount]' value="{{$sdiscount->amount}}">
</span>
@else
<input type="hidden" name='feeheads[{{$fee->idFeehead}}][discount]' value="0.00">
@endif
</td>
<td class="fine">
<?php $todate = Carbon\Carbon::parse($fee->toDate);
$today_date = Carbon\Carbon::parse(today_date());
$days_afterduedate = $todate->diffInDays($today_date);
$curdate=strtotime(today_date());
$lastfeedate=strtotime($fee->toDate);
?>
@if($lastfeedate < $curdate)
{{$fee->fine * $days_afterduedate}}
<input type="hidden" name='feeheads[{{$fee->idFeehead}}][fine]' value="{{$fee->fine * $days_afterduedate}} ">
@else
<input type="hidden" name='feeheads[{{$fee->idFeehead}}][fine]' value="0.00">
@endif
</td>
<td>
<?php $std_trdet = \App\StudentTransactionDetail::where('idStudent','=',$student->idStudent)
->where('idFeehead','=',$fee->idFeehead)
->select(DB::raw('SUM(amountPaid) as amount'),DB::raw('SUM(discount) as discount'),DB::raw('SUM(fine) as fine'))->first();?>
<?php
$ft = $std_trdet->amount + $std_trdet->fine - $std_trdet->discount;
$fromDate = strtotime($fee->fromDate);
$todayDate = strtotime(today_date());
?>
@if($ft >= $fee->amount)
<span class="badge badge-success">Paid </span>
@elseif($ft < $fee->amount && $ft >0)
<span class="badge badge-info">Partial Paid</span>
@elseif($fromDate < $todayDate)
<span class="badge badge-danger">DUE</span>
@else
<span class="badge badge-info">UPCOMING</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<div class="col-sm-5">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Date</th>
<th>Amount</th>
<!--<th>Balance</th>-->
<th>Payment Mode</th>
<th>Print</th>
</tr>
</thead>
<tbody>
@foreach($paidfees as $var)
<tr>
<td>{{$var->paymentDate}}</td>
<td>{{$var->totalPaid}}</td>
<!--<td></td>-->
<td>{{$var->paymentMode}}</td>
<td><a href="{{url('school/stdtransaction/'.$var->idTransaction.'/print')}}" target="_blank" class="btn btn-sm btn-info">Print</a></td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-5">
<!-- <div class="row clearfix">
<div class="col-sm-5 form-control-label">
<label for="classname">Add Penalty</label>
</div>
<div class="col-sm-6">
<div class="form-group">
<input type="text" id="penalty" onkeyup="calculatePenalty()" name="penaltyAmount" class="form-control" onkeypress = 'return onlyNumbersandSpecialChar(event)'>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-5 form-control-label">
<label for="classname">Reason for Penalty</label>
</div>
<div class="col-sm-6">
<div class="form-group">
<input type="text" name="penaltyRemarks" class="form-control">
</div>
</div>
</div>-->
<div class="row clearfix">
<div class="col-sm-5 form-control-label required">
<label for="classname">Pay Amount</label>
</div>
<div class="col-sm-6">
<div class="form-group">
<input type="text" name="TxnAmount" class="form-control" required="required" onkeypress = 'return onlyNumbersandSpecialChar(event)'>
</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>Total Paid: </b>
<span id='total_paid'>
@if($paidfees_tot)
{{$paidfees_tot->totalPaid}}
@else
0.00
@endif
</span>
</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>Penalty: </b>
<span id="penaltyAmt"></span>
<?php $chqbounce = \App\StudentTransaction::where('idStudent','=',$student->idStudent)
->where('idFinancialYear','=',$student->idFinancialYear)
->where('status','=','Bounced')
->first();?>
@if($chqbounce)
{{$chqbounce->chequeBounceCharge}} <span>(Cheque Bounce Charge)</span>
@else @if($paidfees_tot)
{{$paidfees_tot->penaltyAmount}}
@else
0.00
@endif
@endif
</p>
<p class="m-b-0"><b>Excess Amount : </b>
@if($paidfees_tot)
{{$paidfees_tot->excessAmount}}
@else
0.00
@endif
</p>
<p class="m-b-0"><b>Balance Amount : </b>
@if($paidfees_tot)
<?php $b = ($feetotal + $paidfees_tot->fine + $paidfees_tot->penaltyAmount) -($paidfees_tot->totalPaid + $paidfees_tot->discount); ?>
{{$b}}
@else
<span id='balance_total'></span>
@endif
</p>
</div>
</div>
<!--<hr>-->
<hr>
<div class="hidden-print col-md-12 text-right">
<input class="btn btn-primary btn-round" type="submit" name="submit" value="Submit" />
{!! Form::close() !!}
</div>
</div>
</div>
</div>
@stop
@section('script')
<script>
// Saving form data
$('#feesubmission').on('submit',function(e){
$.ajaxSetup({
header:$('meta[name="_token"]').attr('content')
});
var formData = new FormData($('#feesubmission')[0]);
$("#submit-btn").prop('disabled', true);
$.ajax({
type:"POST",
url: "{{url('school/stdtransaction') }}",
processData: false,
contentType: false,
data:formData,
dataType: 'json',
success:function(data){
if( data[Object.keys(data)[0]] === 'SUCCESS' ){
$("#submit-btn").prop('disabled', true);
window.location = "{{url('school/stdfees')}}";
}
else { //False Case: With error msg
$("#msg").html(data); //$msg is the id of empty msg
}
},
error: function(data){
if( data.status === 422 ) {
$("#submit-btn").prop('disabled', false);
var errors = data.responseJSON.errors;
var errorHtml = '<div class="alert alert-danger"><ul>';
$('#formerrors').html(errorHtml);
if(errors['totalPaid']=== undefined){
$( '#totalerror' ).empty();
}else{
errorname = '<span class="help-block"><strong>'+errors['totalPaid']+'</strong></span>';
$( '#totalerror' ).html( errorname );
}
if(errors['idBank']=== undefined){
$( '#bankerror' ).empty();
}else{
errorname = '<span class="help-block"><strong>'+errors['idBank']+'</strong></span>';
$( '#bankerror' ).html( errorname );
}
if(errors['chequeNo']=== undefined){
$( '#chequenoerror' ).empty();
}else{
errorname = '<span class="help-block"><strong>'+errors['chequeNo']+'</strong></span>';
$( '#chequenoerror' ).html( errorname );
}
if(errors['chequeDate']=== undefined){
$( '#chequedateerror' ).empty();
}else{
errorname = '<span class="help-block"><strong>'+errors['chequeDate']+'</strong></span>';
$( '#chequedateerror' ).html( errorname );
}
if(errors['chequeDate']=== undefined){
$( '#chequedateerror' ).empty();
}else{
errorname = '<span class="help-block"><strong>'+errors['chequeDate']+'</strong></span>';
$( '#chequedateerror' ).html( errorname );
}
if(errors['amount']=== undefined){
$( '#amounterror' ).empty();
}else{
errorname = '<span class="help-block"><strong>'+errors['amount']+'</strong></span>';
$( '#amounterror' ).html( errorname );
}
}
}
});
return false;
});
$(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();
}
});
});
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>
@stop
Copyright © 2021 -