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>
@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>
<div class="mt-40"></div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<form action="{{url('gateway/techprocess.php')}}" method="post" id="feesubmission">
<input type="hidden" name="_token" id="token" value="{{ csrf_token() }}">
<input type="hidden" name="reqType" value="T">
<input type="hidden" name="mrctCode" value="T302515"/>
<?php
$transactionID = "T" . Carbon\Carbon::now()->timestamp . "ON" . $student->idStudent;
?>
<input type="hidden" name="mrctTxtID" value="{{$transactionID}}"/>
<input type="hidden" name="currencyType" value="INR"/>
<input type="hidden" name="itc" value="NIC~TXN0001~122333~rt14154~3 apr 2019~Payment~forpayment"/>
<input type="hidden" name="reqDetail" value="FIRST_10.00_0.0"/>
<input type="hidden" name="txnDate" value="{{today_date()}}"/>
<input type="hidden" name="locatorURL" value="https://payments.paynimo.com/PaynimoProxy/services/TransactionLiveDetails?wsdl">
<input type="hidden" name="key" value="6600681084OHFNJU"/>
<input type="hidden" name="iv" value="7536264808NGVHQW"/>
<input type="hidden" name="returnURL" value='{{url('student/feesuccessful')}}'/>
<?php
$custID = $student->idStudent . "F" . $student->idFinancialYear;
$tpsl_txn_id = Carbon\Carbon::now()->timestamp . "T" . rand(1, 10000);
?>
<input type="hidden" name="custID" value="{{$custID}}">
<input type="hidden" name="tpsl_txn_id" value="{{$tpsl_txn_id}}">
<?php $logo = \App\School::where('idSchool', '=', $student->idSchool)->first();
?>
<input type="hidden" name="logo" value="{{$logo->idSchool.'/'.$logo->schoolLogo}}">
<input type="hidden" name="custname" value="{{$student->firstName}}">
<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>
<?php $totalFine = 0; ?>
@foreach($feeheads as $fee)
<tr>
<?php
$feepaid = \App\StudentTransactionDetail::where('idStudent', '=', $student->idStudent)
->where('idFeehead', '=', $fee->idFeehead)->first();
$stepFine = 0;
$sdiscount = \App\StudentDiscount::where('idStudent', '=', $student->idStudent)
->where('idFeehead', '=', $fee->idFeehead)->where('isActive', 'Y')->get();
$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);
$headerObject = \App\FeeHead::where('idFeehead', '=', $fee->idFeehead)->first()->toArray();
$date = Carbon\Carbon::parse($headerObject['toDate']);
$startDate = Carbon\Carbon::parse($headerObject['fromDate']);
$now = Carbon\Carbon::now();
$diff = $date->diffInDays($now, false);
$dueDiff = $startDate->diffInDays($now, false);
if ($diff > 0) {
if ($headerObject['fine'] != null && $headerObject['fine'] != 0.00) {
$stepFine = $headerObject['fine'] * $diff;
$totalFine = $totalFine + ( $headerObject['fine'] * $diff);
} else
if ($headerObject['flatFine'] != null) {
$stepFine = $stepFine + $headerObject['flatFine'];
$totalFine = $totalFine + $headerObject['flatFine'];
}
}
$stepDiscount = 0;
if ($sdiscount != null) {
foreach ($sdiscount as $discounts) {
$stepDiscount = $stepDiscount + $discounts->amount;
}
$tootalfeeamt = $fee->amount - $stepDiscount + $totalFine;
} else {
$tootalfeeamt = $fee->amount + $totalFine;
}
$std_trdet = \App\StudentTransactionDetail::where('idStudent', '=', $student->idStudent)
->where('idFeehead', '=', $fee->idFeehead)
->select(DB::raw('amountPaid as amount'), DB::raw('discount as discount'), DB::raw('fine as fine'), 'status')->latest()->first();
$ft = $std_trdet['amount'] + $std_trdet['fine'] - $std_trdet['discount'];
$fromDate = strtotime($fee->fromDate);
$todayDate = strtotime(today_date());
?>
<td>
@if($std_trdet==null)
<div class="checkbox-inline" style="padding-left:10px;"><input type="checkbox" name="selectedHeaders[]" value="{{$fee->idFeehead}}" class="feeclass"></div>
@elseif( $std_trdet['status'] != null
&& $std_trdet['status'] != 'Cleared' && $std_trdet['status'] != 'In-Process' && $std_trdet['status'] != 'Success')
<div class="checkbox-inline" style="padding-left:10px;"><input type="checkbox" name="selectedHeaders[]" value="{{$fee->idFeehead}}" class="feeclass"></div>
@endif
</td>
<td>{{ Carbon\Carbon::parse($fee->toDate)->format('d-m-Y') }}</td>
<td>
{{$fee->feeheadName}}
{{$fee->description}}
@if(isset($lesser_fees->totalPaid))
@if($lesser_fees->totalPaid < $tootalfeeamt)
<br>
<label id="lesser_note"><b> Amount Paid: </b>{{$lesser_fees->totalPaid}} </label>
@endif
@endif
<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">
@if(isset($std_trdet->discount))
<p>{{$std_trdet->discount}}</p>
@elseif(isset($sdiscount))
<span>
@if(isset($feepaid_date))
{{$stepDiscount}}{{$feepaid_date}}
@else
{{$stepDiscount}}
@endif
<input type="hidden" name='feeheads[{{$fee->idFeehead}}][discount]' value="{{$stepDiscount}}">
</span>
@else
<input type="hidden" name='feeheads[{{$fee->idFeehead}}][discount]' value="0.00">
@endif
</td>
<td class="fine">
@if(isset($stepFine))
<p>{{$stepFine}}</p>
@elseif(isset($std_trdet->fine))
<p>{{$std_trdet->fine}}</p>
@elseif($feepaid!=null)
<input type="hidden" name='feeheads[{{$fee->idFeehead}}][fine]' value="{{$feepaid->fine}} ">
@elseif($curdate > $lastfeedate && $fee->fine > 0)
{{$fee->fine * $days_afterduedate}}
<input type="hidden" name='feeheads[{{$fee->idFeehead}}][fine]' value="{{$fee->fine * $days_afterduedate}} ">
@elseif(($curdate > $lastfeedate && $fee->flatFine > 0))
{{$fee->flatFine}}
<input type="hidden" name='feeheads[{{$fee->idFeehead}}][fine]' value="{{$fee->flatFine}}">
@else
<input type="hidden" name='feeheads[{{$fee->idFeehead}}][fine]' value="0.00">
@endif
</td>
<td>
@if($std_trdet['amount'] != null && ($std_trdet['status'] == null || $std_trdet['status'] == 'Cleared'))
<span class="badge badge-success">Paid </span>
@elseif( $std_trdet['status'] == 'In-Process')
<span class="badge badge-info">In-Process </span>
@elseif($dueDiff > 0)
<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('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>Amount</th>
<!--<th>Balance</th>-->
<th>Payment Mode</th>
<th>Print</th>
</tr>
</thead>
<tbody>
@foreach($lesserfees as $var)
<tr>
<td>{{$var->paymentDate}}</td>
<td>{{$var->totalPaid}}</td>
<!--<td></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">
<div class="col-md-5">
<div class="row clearfix">
<div class="col-sm-5 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 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="amount" class="form-control" required="required" onkeypress = 'return onlyNumbersandSpecialChar(event)'>
@if ($errors->has('amount'))
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong>{{ $errors->first('amount') }}</strong>
</label>
@endif
<span id='totalerror'></span>
</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}}
@else
<span>0.00</span>
@endif
</p>
<?php $totalAmount = ($feetotal + $totalFine + $chqPenaltyAmount - $paidfees_tot->discount); ?>
<p class="m-b-0"><b>Total Amount : </b>
{{$totalAmount}}
</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>Balance Amount: </b>
@if($paidfees_tot->totalPaid !=null)
<?php $b = $totalAmount - ($paidfees_tot->totalPaid); ?>
{{$b}}
@else
{{$totalAmount}}
@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="payable" value="Submit" id="submit-btn"/>
</form>
</div>
</div>
</div>
</div>
@stop
@section('script')
<script>
// Saving form data
var isValid=0;
$('#feesubmission').on('submit',function(e){
if( parseInt($('input[name="payableAmount"]').val()) == 0
&&
parseInt($('input[name="amount"]').val()) == 0 )
{
var formData = new FormData($('#feesubmission')[0]);
$("#submit-btn").prop('disabled', true);
$.ajax({
type:"POST",
"_token": "{{ csrf_token() }}",
url: "{{url('student/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('student/payfees')}}";
}
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;
}else
if( parseInt($('input[name="amount"]').val()) < parseInt($('input[name="payableAmount"]').val()) )
{
alert("Amount cannot be less than payable amount");
return false;
}else{
var formData = new FormData($('#feesubmission')[0]);
$.ajaxSetup({
header:$('meta[name="_token"]').attr('content')
});
if(isValid==0){
$.ajax({
type:"POST",
url: "{{url('student/transaction') }}",
processData: false,
contentType: false,
"_token": "{{ csrf_token() }}",
data:formData,
dataType: 'json',
success:function(data){
if(data[Object.keys(data)[0]] === 'SUCCESS')
{
isValid=1;
$('#feesubmission').submit();
}
else{
$("#submit-btn").prop('disabled', true);
alert("Online payment not available this moment try again later");
return false;
}
},
error: function(data){
$("#submit-btn").prop('disabled', true);
alert("Online payment not available this moment try again later");
return false;
}}
);
}
if(isValid==1) return true;
else 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();
}
});
});
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>
@stop
Copyright © 2021 -