IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/resources/views/students/transportfees/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/resources/views/students/transportfees/sudarshanfeedetails.blade.php

@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 is successful download the receipt from below') 
                    <div class="alert alert-success">
                        {{ session('status') }}
                    </div>
                    @else

                    <div class="alert alert-warning">
                        {{ session('status') }}
                    </div>
                    @endif
                    @endif
                </div>
            </div>
            <div class="mt-40"></div>
            <div class="row">

                <div class="col-md-7">
                    <div class="table-responsive">
                        <form action="{{url('gateway/busdesk.php')}}" method="post" id="feesubmission">
                            <input type="hidden" name="_token" id="token" value="{{ csrf_token() }}">
                            <?php
                            $transactionID = "B" . Carbon\Carbon::now()->timestamp . "ON" . $student->idStudent;
                            ?>
                            <input type="hidden" name="TypeField1" value="R">
                            <input type="hidden" name="TypeField2" value="F">
                            <input type="hidden" name="Message" value="NA">
                            <input type="hidden" name="CustomerID" value="{{$transactionID}}"/>
                            <input type="hidden" name="SecurityID" value="aspcstfee"/>
                            <input type="hidden" name="CurrencyType" value="INR"/>
                            <input type="hidden" name="RU" value='{{url('student/busfeesreturn')}}'/>
                            <input type="hidden" name="txtadditional1" value="{{$student->idStudent}}">
                            <input type="hidden" name="txtadditional2" value="{{$student->idFinancialYear}}">
                            <input type="hidden" name="txtadditional3" value="NA">
                            <input type="hidden" name="txtadditional4" value="NA">
                            <input type="hidden" name="txtadditional5" value="NA">
                            <input type="hidden" name="txtadditional6" value="NA">
                            <input type="hidden" name="txtadditional7" value="NA">
                            <input type="hidden" name="idStudent" value="{{$student->idStudent}}">
                            <input type="hidden" name="idFinancialYear" value="{{$student->idFinancialYear}}">
                            <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>Status</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php $totalFine=0;$totalFee=0;$totalDis=0;?>
                               <?php 
                                    $flatfine=0;
                                     $perDay=array();
                                     foreach($fineheads as $fine){
                                         if($fine->isFlat==1)
                                          $flatfine=$fine->amount;
                                         else{
                                            array_push($perDay,$fine); 
                                         } 
                                     }
                                     
                                     $chqbounce = \App\BusTransaction::where('idStudent', '=', $student->idStudent)
                                    ->where('idFinancialYear', '=', $student->idFinancialYear)
                                    ->where('status', '=', 'Bounced')
                                    ->where('chqFineStatus', '=', '0')
                                    ->get();
                            
                                    if (isset($chqbounce)) {
                                        foreach ($chqbounce as $chqFine)
                                            $totalFine=$totalFine+$chqFine->chequeBounceCharge;
                                    }
                               ?>
                               
                               @foreach($feeheads as $fee)
                               <tr>
                                   <?php
                                    $k=0;
                                    $feedetails = \App\NorthFeeHead::where('isParent','=',$fee->idFeehead)->get();
                                    
                                    $date = Carbon\Carbon::parse($fee->toDate);
                                    $startDate = Carbon\Carbon::parse($fee->fromDate);
                                    $now = Carbon\Carbon::now();
                                    
                                    $diff = $date->diffInDays($now,false);
                                    
                                    $std_trdet = \App\BusTransactionDetail::where('idStudent','=',$student->idStudent)
                                               ->whereIn('idBusFeehead',$feedetails->pluck('idFeehead'))->where(function($query) {
                                                    $query->whereNull('status');
                                                  $query->orWhere('status', '=', 'Cleared');
                                                    $query->orWhere('status', '=', 'In-Process');
                                                    $query->orWhere('status', '=', 'Success');
                                                })
                                               ->select(DB::raw('amountPaid as amount'),DB::raw('discount as discount'),DB::raw('fine as fine'),'status')->latest()->first();
                                    
                                    $std_ledet=DB::table('bus_lesser_transaction_details')
                                    ->where('idStudent','=',$student->idStudent)
                                               ->whereIn('idBusFeehead',$feedetails->pluck('idFeehead'))
                                        ->where(function($query) {
                                                    $query->whereNull('status');
                                                  $query->orWhere('status', '=', 'Cleared');
                                                    $query->orWhere('status', '=', 'In-Process');
                                                    $query->orWhere('status', '=', 'Success');
                                                })       
                                               ->select(DB::raw('SUM(amountPaid) as amount'),DB::raw('SUM(discount) as discount'),DB::raw('fine as fine'),'status')->latest()->first();
                                    
                                   ?>
                                   <td>
                                       @if(isset($std_ledet->amount))
                                        <div></div>
                                       @elseif($std_trdet['amount'] != null && ($std_trdet['status'] == null || $std_trdet['status'] == 'Cleared'))
                                       <div></div>
                                       @elseif(isset($std_ledet->amount))
                                           @if( ($std_ledet->amount+$std_ledet->discount) == $fee->amount && ($std_ledet->status == null || $std_ledet->status == 'Cleared'))
                                           <div></div>
                                           @else
                                           <div class="checkbox-inline" style="padding-left:10px;"><input type="checkbox" name="selectedHeaders[]" value="{{$fee->idFeehead}}" class="feeclass" checked="checked" onclick="return false;"></div>
                                           @endif
                                       @else
                                        <div class="checkbox-inline" style="padding-left:10px;"><input type="checkbox" name="selectedHeaders[]" value="{{$fee->idFeehead}}" class="feeclass" checked="checked" onclick="return false;"></div>
                                        @endif
                                        
                                    </td>
                                   <td>{{ Carbon\Carbon::parse($fee->toDate)->format('d-m-Y') }}</td>
                                   <td>
                                       {{$fee->demandName}}
                                       <i class="zmdi zmdi-chevron-down" style="padding-right: 10px;
padding-left: 10px;" onclick="openDemand({{$fee->idFeehead}})"></i><br>
                                        
                                        @if(isset($std_ledet->amount))
                                        @if(($std_ledet->amount+ $std_ledet->discount ) != $fee->amount && ($std_ledet->status == null || $std_ledet->status == 'Cleared'))
                                        <span  class="badge badge-info" style="font-size:12px;"> Paid :  {{$std_ledet->amount}}</span>
                                        @endif
                                        @endif
                                    </td>
                                   <td class='amt'>
                                       {{$fee->amount}}
                                       <?php $totalFee=$totalFee+$fee->amount; ?>
                                       <input type="hidden" name='feeheads[{{$fee->idFeehead}}][famount]' value="{{$fee->amount}}">
                                   </td>
                                   <?
                                   $discounts = \App\NorthFeeHead::where('isParent','=',$fee->idFeehead)->select(DB::raw('SUM(discount) as total_discount'))->first();
                                   $fineAmount=0;
                                   ?>
                                   <td class="discount">
                                         {{$discounts->total_discount}}
                                         <?php $totalDis=$totalDis+$discounts->total_discount;?>
                                   </td>
                                   <td class="fine">
                                       @if(isset($std_ledet->amount))
                                       {{$fineAmount}}
                                       @elseif($fee->fine == 'flat' && $diff > 0)
                                       {{$flatfine}}
                                       <?php $fineAmount=$flatfine;?>
                                       @elseif($fee->fine == 'per' && $diff > 0)
                                       <?php
                                         if($diff > 0){
                                             foreach($perDay as $per){
                                                if($per->days <= $diff){
                                                    $fineAmount=$per->amount;
                                                    break;
                                                } 
                                             }
                                         }
                                         
                                       ?>
                                       {{$fineAmount}}
                                       @else
                                       {{$fineAmount}}
                                       @endif
                                       <input type="hidden" id="fine_{{$fee->idFeehead}}" value=" {{$fineAmount}}"/>
                                   </td>
                                   <td>
                                       
                                       @if(isset($std_ledet->amount))
                                        @if(($std_ledet->amount+ $std_ledet->discount ) == $fee->amount && ($std_ledet->status == null || $std_ledet->status == 'Cleared'))
                                         <span class="badge badge-success">Paid </span>
                                        @else
                                        <span class="badge badge-info">Partial-Paid</span>
                                        @endif
                                        @elseif($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( ($startDate->diffInDays($now,false)) > 0)
                                            <span class="badge badge-danger">DUE</span>
                                            @else
                                            <span class="badge badge-info">UPCOMING</span>
                                            @endif
                                   </td>
                               </tr>
                               <tr class="header_table_{{$fee->idFeehead}}" style="display:none;">
                                <td></td>   
                                <td></td>   
                                <td colspan="5">
                                    <table class="table"  style=" border: none;">
                                        <tbody  id="optional_list">
                                            
                                          @foreach($feedetails as $headers)
                                            <tr>
                                                <th style="border:0;">{{$headers->header->headerName}}
                                        <input type="hidden" name="subhead[{{$fee->idFeehead}}][{{$k}}][id]" value="{{$headers->idFeehead}}" form="feesubmission"/>         </th>
                                                <th style="border:0;"><input class="form-control" type="number" name="subhead[{{$fee->idFeehead}}][{{$k}}][headerAmount]" required="required" id="amount_{{$k}}" value="{{$headers->amount}}" readonly></th>
                                                <th style="border:0;"><input class="form-control" type="number" name="subhead[{{$fee->idFeehead}}][{{$k}}][headerDiscount]" required="required" id="discount_{{$k}}" value="{{$headers->discount}}" readonly><span id="amounterror{{$k}}"></span></th>
                                                <th style="border:0;"><input class="form-control" type="number" name="subhead[{{$fee->idFeehead}}][{{$k}}][headeraid]" required="required" id="paidamount_{{$fee->idFeehead.$k}}" value="{{$headers->amount - $headers->discount }}" onkeyup="calculateAmt({{$fee->idFeehead}}) " readonly><span id="amounterror{{$k}}"></span></th>
                                      
                                            </tr>
                                        <?php $k++; ?>    
                                         @endforeach  
                                         <input type="hidden" id="total_row_{{$fee->idFeehead}}" value="{{$k}}"/>
                                        </tbody>
                                    </table>      
                                </td>
                               </tr>
                               <?php $totalFine=$totalFine+$fineAmount;?>
                               @endforeach
                                <input name="fineAmount" type="hidden" value="{{$totalFine}}"/>
                           </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>
                                       @if($var->status == 'Cleared' || $var->status == null || $var->status == 'Success')
                                       <td><td><a href="{{url('student/north/stdfees/bus/'.$var->idBusTransaction.'/print')}}" target="_blank" class="btn btn-sm btn-info">Print</a></td>
                               
                                       @endif
                                   </tr>
                                   @endforeach
                                </tbody>
                        </table>
                    </div>
                    <br>
                    <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/north/lessamt/bus/'.$var->idBusLesserTransaction.'/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">
                                    <input type="text" name="payableAmount" class="form-control payableAmount" readonly="readonly"  style="color: black;font-size: 1.2em;">
                                    <input type="hidden" name="TxnAmount"/>
                                    <span id="payableerror"></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'>{{$totalFee}}</span>
                        <input type="hidden" name="feeTotal" id="feetotal">
                    </p>
                    <p class="m-b-0">
                        <b>Discount: </b>
                        <span  id='total_discount'>{{$totalDis}}</span>
                        <input type="hidden" name="discount" id="discounttotal">
                    </p>     
                    <?php 
                    
                    $std_tr = \App\BusTransaction::where('idStudent','=',$student->idStudent)->where(function($query) {
                            $query->whereNull('status');
                          $query->orWhere('status', '=', 'Cleared');
                            $query->orWhere('status', '=', 'In-Process');
                            $query->orWhere('status', '=', 'Success');
                        })->select(DB::raw('SUM(totalPaid) as amount'),DB::raw('SUM(discount) as discount'),DB::raw('SUM(fine) as fine'))->latest()->first();
                                    
                    $std_le=DB::table('bus_lesser_transaction')
                                    ->where('idStudent','=',$student->idStudent)
                                     ->where(function($query) {
                                                $query->whereNull('bus_lesser_transaction.status');
                                                $query->orWhere('bus_lesser_transaction.status', '=', 'Cleared');
                                                $query->orWhere('bus_lesser_transaction.status', '=', 'In-Process');
                                                $query->orWhere('bus_lesser_transaction.status', '=', 'Success');
                                            })
                                               ->select(DB::raw('SUM(totalPaid) as amount'),DB::raw('SUM(discount) as discount'),DB::raw('SUM(fine) as fine'))->latest()->first();
                    $totalFinePaid=0;
                    $totalAmountPaid=0;
                    
                    if(isset($std_le->fine))
                    $totalFinePaid=$totalFinePaid+$std_le->fine;
                    if(isset($std_tr->fine))
                    $totalFinePaid=$totalFinePaid+$std_tr->fine;
                    
                    if(isset($std_le->amount))
                    $totalAmountPaid=$totalAmountPaid+$std_le->amount;
                    if(isset($std_tr->amount))
                    $totalAmountPaid=$totalAmountPaid+$std_tr->amount;
                    
                    
                    
                    
                    ?>
                    <p class="m-b-0">
                        <b>Fine: </b>
                        <span id='total_fine'>{{$totalFinePaid}}</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\BusTransaction::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>
                    <span>0.00</span>
                    </p>
                   
                    <p class="m-b-0"><b>Total Amount : </b>
                    <?php
                        $totalAmount=$totalFee+$totalFinePaid-$totalDis;
                        echo'<span>'.$totalAmount.'<span>';
                    ?>
                    </p> 
                    <p class="m-b-0"><b>Total Paid: </b>
                    <span>{{$totalAmountPaid}}</span>
                    </p>
                    <p class="m-b-0"><b>Balance Amount: </b>
                     <?php
                        $totalBalance= ( $totalFee+$totalFinePaid-$totalDis ) - $totalAmountPaid;
                        echo'<span>'.$totalBalance.'<span>';
                    ?>     
                    </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){
    $('input[name="TxnAmount"]').val($('input[name="payableAmount"]').val());
    
    {
     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("Please select any fee header");
                return false;
           }
        },
        error: function(data){
            //$("#submit-btn").prop('disabled', true);
            alert("Please select any fee header");
            return false;
        }}
      );
      }
      if(isValid==1) return true;
      else return false;
     
    }
});
$(document).ready(function(){
 $('.otherpaymode').hide(); 
 var feeheaderIds = [];
        $("input:checkbox[name='selectedHeaders[]']:checked").each(function () {
                feeheaderIds.push($(this).val());
        });
        var totalPayable=0;
        
        if(feeheaderIds.length>0)
        {
            $.each(feeheaderIds, function( index, value ) {
              var i;
                for (i = 0; i < $('#total_row_'+value).val(); i++) { 
                    var amount=$('#paidamount_'+value+i).val();
                    if( amount!='NaN')    
                     totalPayable = totalPayable+parseInt(amount);
                     
                }
            });
            totalPayable=totalPayable+<?php echo $totalFine?>;
            $('input[type=text].payableAmount').val(totalPayable);    
            
        }
    else    $('input[name="payableAmount"]').val(" ");     
});
function openDemand(id){
     $('.header_table_'+id).toggle();
}
</script>
@stop

Copyright © 2021 - 2025 IMMREX7