IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/storage/framework/views/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/storage/framework/views/7d3e86464a5101449bbc24f6396f31581fcfd1de.php

<?php $__env->startSection('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><?php echo e($student->firstName); ?> <?php echo e($student->middleName); ?> <?php echo e($student->lastName); ?><br>
                        <strong> Father Name : </strong><?php echo e($student->father_fname); ?> <?php echo e(isset($student->father_lname) ? $student->father_lname : ''); ?><br>
                        <strong> Mobile : </strong><?php echo e($student->father_mobile); ?><br>
                        <strong> Class : </strong><?php echo e($student->classM->className); ?><br>
                        <strong> Section : </strong><?php echo e($student->section->sectionName); ?><br>
                        <strong> Ec No. : </strong><?php echo e($student->ecNo); ?><br>
                    </address>
                </div>
            </div>
            <div class="mt-40"></div>
            <div class="row">
                
               <div class="col-md-7">
                   <div class="table-responsive">
                       <?php echo Form::open(['url' => 'school/stdtransaction', 'class' => 'form-horizontal','id'=>'feesubmission']); ?>

                       <input type="hidden" name="idStudent" value="<?php echo e($student->idStudent); ?>">
                       <input type="hidden" name="idFinancialYear" value="<?php echo e($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;?>
                               <?php $__currentLoopData = $feeheads; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $fee): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                               
                               <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 + $stepFine;
                                        
                                        }else{
                                             $tootalfeeamt = $fee->amount + $stepFine;
                                        }
                                        
                                        
                                        
            
                                        
                                        $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')->where(function($query) {
                                                $query->whereNull('student_transaction_details.status');
                                                $query->orWhere('student_transaction_details.status', '=', 'Cleared');
                                                $query->orWhere('student_transaction_details.status', '=', 'In-Process');
                                                $query->orWhere('student_transaction_details.status', '=', 'Success');
                                            })->first();
                                       
                                       $std_ledet = \App\LesserTransactionDetail::join('lesser_transaction','lesser_transaction_details.idLesserTransaction','=','lesser_transaction.idLesserTransaction')->where('lesser_transaction_details.idStudent','=',$student->idStudent)
                                               ->where('lesser_transaction_details.idFeehead','=',$fee->idFeehead)
                                               ->select(DB::raw('SUM(lesser_transaction_details.amountPaid) as amount'),DB::raw('SUM(lesser_transaction_details.discount) as discount'),DB::raw('SUM(lesser_transaction_details.fine) as fine'),'lesser_transaction_details.status')->where(function($query) {
                                                $query->whereNull('lesser_transaction.status');
                                                $query->orWhere('lesser_transaction.status', '=', 'Cleared');
                                                $query->orWhere('lesser_transaction.status', '=', 'In-Process');
                                                $query->orWhere('lesser_transaction.status', '=', 'Success');
                                            })->first();
                                        if($std_trdet != null)
                                        $ft  = $std_trdet['amount'] + $std_trdet['fine'] - $std_trdet['discount'];
                                        else{
                                            $std_trdet['status'] = null;
                                            $std_trdet['amount'] = null;
                                        }
                                    
                                        
                                        $fromDate = strtotime($fee->fromDate);
                                        $todayDate = strtotime(today_date()); 
                                        $lesser_fees = DB::table('lesser_transaction')
                                            ->join('lesser_transaction_details','lesser_transaction_details.idLesserTransaction','=','lesser_transaction.idLesserTransaction')
                                            ->where('lesser_transaction.idStudent', '=', $student->idStudent)
                                            ->where('lesser_transaction.idFinancialYear', '=', $student->idFinancialYear)
                                            ->where('idFeehead','=',$fee->idFeehead)
                                            ->where(function($query) {
                                                $query->whereNull('lesser_transaction.status');
                                                $query->orWhere('lesser_transaction.status', '=', 'Cleared');
                                                $query->orWhere('lesser_transaction.status', '=', 'In-Process');
                                                $query->orWhere('lesser_transaction.status', '=', 'Success');
                                            })
                                            ->select(DB::raw('SUM(totalPaid) as totalPaid'))
                                            ->first();
                                     ?>
                                   <td>
                                    <input type="hidden" value="<?php echo e($fee->idFeehead); ?>"/>
                                        <?php if($std_trdet['amount']==null && ($lesser_fees->totalPaid == null || $lesser_fees->totalPaid < $tootalfeeamt)): ?>
                                         <div class="checkbox-inline" style="padding-left:10px;"><input type="checkbox" name="selectedHeaders[]" value="<?php echo e($fee->idFeehead); ?>" class="feeclass"></div>
                                        <?php 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="<?php echo e($fee->idFeehead); ?>" class="feeclass"></div>
                                       <?php endif; ?>
                                    </td>
                                   <td><?php echo e(Carbon\Carbon::parse($fee->toDate)->format('d-m-Y')); ?></td>
                                   <td>
                                       <?php echo e($fee->feeheadName); ?>

                                       <br>
                                       <?php 
                                       if(isset($fee->description)){
                                           $details=explode(",",$fee->description);
                                           foreach($details as $description)
                                                echo'<span>'.$description.'</span></br>';
                                       }
                                       ?>
                                        <?php if(isset($lesser_fees->totalPaid)): ?>
                                        <?php if($lesser_fees->totalPaid < $tootalfeeamt): ?>
                                        <br>
                                        <label id="lesser_note"><b> Amount Paid: </b><?php echo e($lesser_fees->totalPaid); ?> </label>
                                        <?php endif; ?>
                                        <?php endif; ?>
                                       <input type="hidden" name='feeheads[<?php echo e($fee->idFeehead); ?>][idFeehead]' value="<?php echo e($fee->idFeehead); ?>">
                                   </td>
                                   <td class='amt'>
                                       <?php echo e($fee->amount); ?>

                                       <input type="hidden" name='feeheads[<?php echo e($fee->idFeehead); ?>][famount]' value="<?php echo e($fee->amount); ?>">
                                   </td>
                                   <td class="discount">
                                         <?php if(isset($std_trdet->discount)): ?>
                                        <p><?php echo e($std_trdet->discount); ?></p>
                                        <?php elseif(isset($sdiscount)): ?>
                                        <span>
                                            <?php if(isset($feepaid_date)): ?>
                                            <?php echo e($stepDiscount); ?><?php echo e($feepaid_date); ?>

                                            <?php else: ?>
                                            <?php echo e($stepDiscount); ?>

                                            <?php endif; ?>
                                            <input type="hidden" name='feeheads[<?php echo e($fee->idFeehead); ?>][discount]' value="<?php echo e($stepDiscount); ?>">
                                        </span>
                                        <?php else: ?>
                                        <input type="hidden" name='feeheads[<?php echo e($fee->idFeehead); ?>][discount]' value="0.00">
                                        <?php endif; ?>
                                        
                                    
                                   </td>
                                   <td class="fine">
                                        <?php if(isset($std_ledet->amount)): ?>
                                        <?php if(($std_ledet->amount+ $std_ledet->discount) == $fee->amount && ($std_ledet->status == null || $std_ledet->status == 'Cleared')): ?>
                                        0.00
                                        <?php endif; ?>

                                        <?php if($std_trdet['amount'] != null && ($std_trdet['status'] == null || $std_trdet['status'] == 'Cleared')): ?>
                                        0.00
                                        <?php elseif(isset($stepFine)): ?>
                                        <p><?php echo e($stepFine); ?></p>
                                        <?php elseif(isset($std_trdet->fine)): ?>
                                        <p><?php echo e($std_trdet->fine); ?></p>
                                        <?php elseif($feepaid!=null): ?>
                                        <input type="hidden" name='feeheads[<?php echo e($fee->idFeehead); ?>][fine]' value="<?php echo e($feepaid->fine); ?> ">
                                        <?php elseif($curdate > $lastfeedate   && $fee->fine > 0): ?>
                                        <?php echo e($fee->fine * $days_afterduedate); ?>

                                        <input type="hidden" name='feeheads[<?php echo e($fee->idFeehead); ?>][fine]' value="<?php echo e($fee->fine * $days_afterduedate); ?> ">
                                        <?php elseif(($curdate > $lastfeedate   && $fee->flatFine > 0)): ?>
                                        <?php echo e($fee->flatFine); ?>

                                        <input type="hidden" name='feeheads[<?php echo e($fee->idFeehead); ?>][fine]' value="<?php echo e($fee->flatFine); ?>">
                                        <?php else: ?>
                                        <input type="hidden" name='feeheads[<?php echo e($fee->idFeehead); ?>][fine]' value="0.00">
                                        <?php endif; ?>
                                        <?php else: ?>
                                        <?php if($diff > 0 && $headerObject['fine'] != 0.00 && $headerObject['fine'] != null): ?>
                                        <?php if(($std_ledet->amount+ $std_ledet->discount) == $fee->amount && ($std_ledet->status == null || $std_ledet->status == 'Cleared')): ?>
                                        <p></p>
                                        <?php elseif($std_trdet['amount'] != null && ($std_trdet['status'] == null || $std_trdet['status'] == 'Cleared')): ?>
                                        <p></p>
                                        <?php else: ?>
                                        <p><?php echo e($headerObject['fine']); ?>/day</p>
                                        <?php endif; ?>
                                        <?php endif; ?>
                                        <?php if($diff > 0 && $headerObject['flatFine'] != 0.00 && $headerObject['flatFine'] != null): ?>
                                        <p><?php echo e($headerObject['flatFine']); ?></p>
                                        <?php endif; ?>
                                        <?php endif; ?>
                                   </td>
                                   <td>
                                       
                                            <?php if(isset($std_ledet->amount)): ?>
                                                <?php if(($std_ledet->amount+ $std_ledet->discount) == $fee->amount && ($std_ledet->status == null || $std_ledet->status == 'Cleared')): ?>
                                                 <span class="badge badge-success">Paid </span>
                                                <?php else: ?>
                                                <span class="badge badge-info">Partial-Paid</span>
                                                <?php endif; ?>
                                                <?php elseif($std_trdet['amount'] != null && ($std_trdet['status'] == null || $std_trdet['status'] == 'Cleared')): ?>
                                                    <span class="badge badge-success">Paid </span>
                                                    <?php elseif( $std_trdet['status'] == 'In-Process'): ?>
                                                    <span class="badge badge-info">In-Process </span>
                                                    <?php elseif( ($startDate->diffInDays($now,false)) > 0): ?>
                                                    <span class="badge badge-danger">DUE</span>
                                                    <?php else: ?>
                                                    <span class="badge badge-info">UPCOMING</span>
                                                    <?php endif; ?>
                                    </td>
                               </tr>
                               <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                           </tbody>
                       </table>
                   </div>
                </div>
                <div class="col-sm-5">
                    <div class="table-responsive">
                        <table class="table table-hover">
                               <thead>
                                   <tr>
                                       <th>Date</th>
                                       <th>Total Paid</th>
                                       <th>Fine</th>
                                       <th>Receipt No & Mode</th>
                                       <th>Print</th>
                                   </tr>
                               </thead>
                               <tbody>
                                   <?php $__currentLoopData = $paidfees; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $var): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                       <td><?php echo e($var->paymentDate); ?></td>
                                       <td><?php echo e($var->totalPaid); ?></td>
                                       <td><?php echo e($var->fine); ?></td>
                                       <td><?php echo e($var->receiptNo); ?> - <?php echo e($var->paymentMode); ?></td>
                                       <?php if($var->status == 'Cleared' || $var->status == null || $var->status == 'Success'): ?>
                                       <td><a href="<?php echo e(url('school/stdtransaction/'.$var->idTransaction.'/print')); ?>" target="_blank" class="btn btn-sm btn-info">Print</a></td>
                                       <?php endif; ?>
                                   </tr>
                                   <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                        </table>
                    </div>
                    <br>
                    <h5>Lesser Paid Receipt</h5>
                    <div class="table-responsive">
                        <p><u>Note</u> : Fine is included in total paid</p>
                        <table class="table table-hover">
                               <thead>
                                   <tr>
                                       <th>Date</th>
                                       <th>Total Paid</th>
                                       <th>Fine</th>
                                       <th>Payment Mode</th>
                                       <th>Print</th>
                                   </tr>
                               </thead>
                               <tbody>
                                   <?php $__currentLoopData = $lesserfees; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $var): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                       <td><?php echo e($var->paymentDate); ?></td>
                                       <td><?php echo e($var->totalPaid); ?></td>
                                       <td></td>
                                       <td><?php echo e($var->paymentMode); ?></td>
                                       <?php if($var->status == 'Cleared' || $var->status == null ): ?>
                                       <td><a href="<?php echo e(url('school/stdtransaction/lessamt/'.$var->idLesserTransaction.'/print')); ?>" target="_blank" class="btn btn-sm btn-info">Print</a></td>
                                       <?php endif; ?>
                                   </tr>
                                   <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                        </table>
                    </div>

                    <h5>Reversal Receipt</h5>
                    <div class="table-responsive">
                        <table class="table table-hover">
                               <thead>
                                   <tr>
                                       <th>Date</th>
                                       <th>Total Paid</th>
                                       <th>Fine</th>
                                       <th>Payment Mode</th>
                                       <th>Print</th>
                                   </tr>
                               </thead>
                               <tbody>
                                   <?php
                                        $reversal = DB::table('student_rollback_transaction')
                                        ->where('student_rollback_transaction.idStudent', '=', $student->idStudent)
                                        ->where('student_rollback_transaction.idFinancialYear', '=', Session::get('idFinancialYear'))
                                        ->get();
                                   ?>
                                   <?php $__currentLoopData = $reversal; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $var): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                       <td><?php echo e($var->paymentDate); ?></td>
                                       <td><?php echo e($var->totalPaid); ?></td>
                                       <td><?php echo e($var->fine); ?></td>
                                       <td><?php echo e($var->paymentMode); ?></td>
                                       <td><span class="badge badge-danger">Cancelled</span></td>
                                   </tr>
                                   <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </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">Payment Date</label>
                            </div>
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <input type="text"  name="paymentDate" class="form-control datepicker" id="payment_date">
                                </div>
                            </div>
                        </div>
                        <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">
                            <?php if(isset($prevaccess_fee->excessAmount)): ?>
                            <?php if($prevaccess_fee->excessAmount > 0): ?>
                            <label id="access_note"><b>Excess Amount Available: </b><?php echo e($prevaccess_fee->excessAmount); ?> </label>
                            <?php endif; ?>
                            <?php endif; ?>
                            
                            
                                    <input type="text" name="payable" class="form-control payableAmount" readonly="readonly"  style="color: black;font-size: 1.2em;">
                                </div>
                            </div>
                        </div>
                        <div class="row clearfix">
                            <div class="col-sm-5 form-control-label">
                                <label for="classname">Pay Amount</label>
                            </div>
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <input type="text" name="totalPaid" class="form-control" onkeypress = 'return onlyNumbersandSpecialChar(event)'>
                                    <?php if($errors->has('totalPaid')): ?>
                                    <label id="minmaxlength-error" class="error" for="minmaxlength">
                                        <strong><?php echo e($errors->first('totalPaid')); ?></strong>
                                    </label>
                                    <?php endif; ?>
                                    <span id='totalerror'></span>
                                </div>
                            </div>
                        </div>
                        <div class="row clearfix">
                            <div class="col-sm-5 form-control-label">
                                <label for="classname">Select Payment Mode</label>
                            </div>
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <?php echo Form::select('paymentMode',payMode(),null,['class' => 'form-control show-tick ms paymentMode','id'=>'paymode']); ?>

                                </div>
                            </div>
                        </div>
                        <div class="row clearfix cardpayment">
                            <div class="col-sm-5 form-control-label">
                                <label for="classname">CardNo./Trans ID</label>
                            </div>
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <input type="text" name="cardNo" class="form-control">
                                    <span id='cardnoerror'></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;
                                    }
                                }
                            ?>
                            <?php if(isset($chqbounce)): ?>
                            <?php echo e($chqPenaltyAmount); ?>

                            <?php if($chqPenaltyAmount==0): ?>
                            <span></span>
                            <?php elseif($chqPenaltyAmount > $chqPenaltyPaid): ?>
                            <span style="color:red"> | <?php echo e($chqPenaltyUnPaid); ?>(Unpaid)</span>
                            <?php else: ?>
                            <span style="color:green">(Paid)</span>
                            <?php endif; ?>
                            <?php else: ?>
                            <span>0.00</span>
                            <?php endif; ?>
                    </p>
                    <p class="m-b-0"><b>Excess Amount : </b>
                            <?php if(isset($prevaccess_fee->excessAmount)): ?>
                            <?php echo e($prevaccess_fee->excessAmount); ?>

                            <?php else: ?>
                             <span>0.00</span>
                            <?php endif; ?>
                    </p>
                    <?php 
                         $totalAmount=($feetotal + $totalFine + $chqPenaltyAmount - $paidfees_tot->discount- $lesser_transaction->discount);?>
                    <p class="m-b-0"><b>Total Amount : </b>
                            <?php echo e($totalAmount); ?>

                    </p> 
                    <p class="m-b-0"><b>Total Paid: </b>
                        <span id='total_paid'>
                            <?php if($paidfees_tot && $lesser_transaction): ?>
                            <?php echo e($paidfees_tot->totalPaid + $lesser_transaction->totalPaid); ?>

                            <?php elseif($paidfees_tot): ?>
                            <?php echo e($paidfees_tot->totalPaid); ?>

                            <?php else: ?>
                            0.00
                            <?php endif; ?>
                        </span>
                    </p>
                    <p class="m-b-0"><b>Balance Amount: </b>
                        
                            <?php if($paidfees_tot  && $lesser_transaction): ?>
                            <?php 
                            $b = $totalAmount - ($paidfees_tot->totalPaid + $lesser_transaction->totalPaid);  ?>
                            <input type="hidden" name="totalBalance" id="totalBalance" value="<?php echo e($b); ?>">
                            <?php echo e($b); ?>

                            
                            <?php else: ?>
                            <input type="hidden" name="totalBalance" id="totalBalance" value="<?php echo e($totalAmount); ?>">
                            <?php echo e($totalAmount); ?>

                            <?php endif; ?>
                             
                    </p>
                </div>
            </div>
            <!--<hr>-->
            <div class="row otherpaymode">
                <div class="col-sm-12">
                    <hr>
                    
                   <div class="row clearfix">
                        <div class="col-sm-3 form-control-label required">
                            <label for="classname">Bank</label>
                        </div>
                        <div class="col-sm-3">
                            <div class="form-group">
                                <?php echo Form::select('idBank',banks(),null,['class' => 'form-control show-tick ms select2']); ?>

                                <span id='bankerror'></span>
                            </div>
                        </div>
                        <div class="col-sm-3 form-control-label required">
                            <label for="classname">Cheque No. / DD No.</label>
                        </div>
                        <div class="col-sm-3">
                            <div class="form-group">
                                <input type="text" name="chequeNo" class="form-control">
                                    <span id='chequenoerror'></span>
                            </div>
                        </div>
                    </div>
                    <div class="row clearfix">
                        
                        <div class="col-sm-3 form-control-label required">
                            <label for="classname">Cheque / DD Date</label>
                        </div>
                        <div class="col-sm-3">
                            <div class="form-group">
                                <input type="text" name="chequeDate" class="form-control datepicker">
                                   <span id='chequedateerror'></span>
                            </div>
                        </div>
                        <div class="col-sm-3 form-control-label required">
                            <label for="classname">Amount</label>
                        </div>
                        <div class="col-sm-3">
                            <div class="form-group">
                                <input type="text" name="amount" class="form-control" onkeypress = 'return onlyNumbersandSpecialChar(event)'>
                                <span id='amounterror'></span>
                            </div>
                        </div>
                    </div>
              
<!--                    <h5>Note</h5>
                    <p>Etsy doostang zoodles disqus groupon greplin oooj voxy zoodles, weebly ning heekya handango imeem plugg dopplr jibjab, movity jajah plickers sifteo edmodo ifttt zimbra.</p>-->
                </div>
                
            </div>
            <hr>
            <div class="hidden-print col-md-12 text-right">
                <?php if(auth()->user()->isSchool == 'N' || auth()->user()->idSchool == 156 || auth()->user()->idSchool == 163): ?>
                <button class="btn btn-primary btn-round" id='submit-btn'>Submit</button>
                <?php else: ?> 
                <p style="color:red"><u>Note</u>: You cannot collect fee as administrator user please make user and use that user login for payment collection.</p>
                <?php endif; ?>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>
    // Saving form data
    <?php if(auth()->user()->isSchool == 'N' || auth()->user()->idSchool == 163): ?>    
$('#feesubmission').on('submit',function(e){
    var isCash="Cash";
    $.each($(".paymentMode option:selected"), function(){  
            isCash=$(this).val();
            if($(this).val()=='Cheque' || $(this).val() =='DD')
            {
                $('input[name="totalPaid"]').val(parseInt($('input[name="amount"]').val()));
                if(parseInt($('input[name="totalPaid"]').val()) != parseInt($('input[name="amount"]').val()))
                {
                    alert("Amount cannot be less or more than payable amount");
                }
            }
        });
        
    feeheaders = [];
    $("input:checkbox[name='selectedHeaders[]']:checked").each(function () {
            feeheaders.push($(this).val());
    });
    if(feeheaders.length>1 && parseInt($('input[name="totalPaid"]').val()) < parseInt($('input[type=text].payableAmount').val()) && isCash=="Cash")
    {
        alert("Amount cannot be less than payable amount");
    }else{
        
    $.ajaxSetup({
        header:$('meta[name="_token"]').attr('content')
    });
 var formData =  new FormData($('#feesubmission')[0]);
 $("#submit-btn").prop('disabled', true);
    $.ajax({
        type:"POST",
        url: "<?php echo e(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 = "<?php echo e(url('school/stdfees/')); ?>" + '/'+ <?php echo e($student->idStudent); ?> +'/details';
            }
            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 );
                                }
                                if(errors['cardNo']=== undefined){
                                    $( '#cardnoerror' ).empty();
                                }else{
                                   errorname = '<span class="help-block"><strong>'+errors['cardNo']+'</strong></span>';
                                   $( '#cardnoerror' ).html( errorname );
                                }
                                
                    }
            }
    });
  }
    return false;
});
<?php endif; ?>
$(document).ready(function(){
 $('.otherpaymode').hide(); 
 $('.cardpayment').hide();
 $('#paymode').change(function() {
        var val = $(this).val();
        if((val == 'Cheque')){
           $('.cardpayment').hide();
           $('.otherpaymode').show();
        }else if(val == 'DD'){
           $('.cardpayment').hide();
           $('.otherpaymode').show();
        }else if(val == 'Card'){
           $('.cardpayment').show();
           $('.otherpaymode').hide();
        }else{
            $('.otherpaymode').hide();
            $('.cardpayment').hide();
        }
    });
});
var feeheaderIds = [];
$('.feeclass').change(function() {
    feeheaderIds = [];
    $("input:checkbox[name='selectedHeaders[]']:checked").each(function () {
            feeheaderIds.push($(this).val());
    });
    if(feeheaderIds.length>0)
    $.ajax({
            url: "<?php echo e(url('/school/feeheaders')); ?>"+'/' +feeheaderIds + "/students/"+<?php echo e($student->idStudent); ?>+"?payday="+$("#payment_date").val(),
            type: "GET",
            dataType: "json",
                success:function(data) {
                     $('input[type=text].payableAmount').val(data);
                }
            });
    else    $('input[type=text].payableAmount').val(" ");      
});
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));
 
 function calculatePenalty(){
        var penaltyAmt = parseFloat($('#penalty').val());
        console.log(penaltyAmt);
        $('#penaltyAmt').text(penaltyAmt.toFixed(2));
       
        var tb = parseFloat($('#balance_total').text());
        var ptb = parseFloat(tb+penaltyAmt);
        console.log(ptb);
        $('#balance_total').text(ptb.toFixed(2));
}
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

Copyright © 2021 - 2025 IMMREX7