<style>
p{
    padding-top:8px;
}
.row-first {
  height:70px;
  overflow: hidden;
}
#confirmBox
{
    display: none;
    background-color: #eee;
    border-radius: 5px;
    border: 1px solid #aaa;
    position: fixed;
    width: 300px;
    left: 50%;
    margin-left: -150px;
    padding: 6px 8px 8px;
    box-sizing: border-box;
    text-align: center;
}
#confirmBox .button {
    background-color: #ccc;
    display: inline-block;
    border-radius: 3px;
    border: 1px solid #aaa;
    padding: 2px;
    text-align: center;
    width: 80px;
    cursor: pointer;
}
#confirmBox .button:hover
{
    background-color: #ddd;
}
#confirmBox .message
{
    text-align: left;
    margin-bottom: 8px;
}
</style>
<?php 
$total_tus_fee=0;
?>
        <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
            <div class="page-title">
                <div class="title_left">
                </div>
            </div>
            <div class="clearfix"></div>

            <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>View Voucher</h2>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
                    </ul>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                    <div class="row row-first">
                        <div class="col-md-3 col-sm-7 col-xs-12">
                            <h3>Fee Voucher</h3>
                            <h2>Challan # <?php echo $invoice['id']; ?></h2>
                        </div>
                        <div class="col-md-7 col-sm-3 col-xs-8 form-horizontal">
                            <h3 class="control-label"><?php echo $branch['name']; ?></h3>
                            
                        </div>
                        <div class="col-md-1 col-sm-1 col-xs-12">
                            <img src="<?php echo base_url().$branch['b_logo']; ?>" width="100" height="70" alt="">
                        </div>
                    </div>
                    <div class="ln_solid"></div>
                    <div class="row">
                        <div class="col-md-6">
                        <div class="row">
                            <div class="col-md-6">
                               <strong>S.ID</strong>
                            </div>
                             <div class="col-md-6">
                               <?php echo $student['sid']; ?>&nbsp;&nbsp;
                               <a target="_blank" href="<?php echo base_url();?>voucher/create_history_voucher/<?php echo $student['sid']; ?>"><span style="color:red">(History)</span></a>
                            </div>
                        </div>
                        
                           <div class="row">
                            <div class="col-md-6">
                               <strong>Student</strong>
                            </div>
                             <div class="col-md-6">
                               <?php echo $student['student_name']; ?>
                            </div>
                        </div>
                        
                        <div class="row">
                            <div class="col-md-6">
                               <strong>Father</strong>
                            </div>
                             <div class="col-md-6">
                               <?php echo $student['father_name']; ?>
                            </div>
                        </div>
                        
                         <div class="row">
                            <div class="col-md-6">
                               <strong>Class</strong>
                            </div>
                             <div class="col-md-6">
                               <?php echo $student['class_name']; ?>
                            </div>
                        </div>
                        
                           <div class="row">
                            <div class="col-md-6">
                               <strong>Voucher Date</strong>
                            </div>
                             <div class="col-md-6">
                              <?php echo date("d-m-Y",strtotime($invoice['date'])); ?>
                            </div>
                        </div>
                        
                           <div class="row">
                            <div class="col-md-6">
                               <strong>Due Date</strong>
                            </div>
                             <div class="col-md-6">
                               <?php echo date("d-m-Y",strtotime($invoice['date_expire']." -1 day")); ?>
                            </div>
                        </div>
                        
                     
                       <table style="width:80%" class="table table-bordered table-striped ">
                        <thead>
                            <tr>
                                <th >#</th>
                                <th>Fee</th>
                                <th >Amount</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td >1</td>
                                <td >Tution Fee</td>
                                <td ><?php echo '+ '.$invoice['fee_pack'];$total_tus_fee+=$invoice['fee_pack']; ?></td>
                            </tr>
                            <?php $i=2; foreach($fee as $k=>$v){ ?>
                            <tr>
                                <td><?php echo $i++; ?></td>
                                <td><?php echo $v['name'] ?></td>
                                <td><?php echo '+ '.$v['amount']; ?></td>
                            </tr>
                            <?php } foreach($add_months as $k=>$v){ ?>
                            <tr>
                                <td><?php echo $i++; ?></td>
                                <td><?php echo "Tuition fee for ".date('F Y',strtotime($v['month'])); ?></td>
                                <td><?php echo '+ '.$v['fee'];$total_tus_fee+=$v['fee']; ?></td>
                            </tr>
                            <?php } if(!empty($lastadv)){?>
                            <tr>
                                <td><?php echo $i++; ?></td>
                                <td> Advance </td>
                                <td><?php echo '- '.$lastadv; ?></td><?php $total = $total - $lastadv; ?>
                            </tr>
                            <?php } if($invoice['is_admitted']==1){?>
                            <tr>
                                <td><?php echo $i++; ?></td>
                                <td>Admission Fee</td>
                                <td><?php echo '+ '.$invoice['admin_fee']; ?></td><?php $total = $total + $invoice['admin_fee']; ?>
                            </tr>
                            <?php } if($invoice['status']==0 || $lastadv > 0){
                                $a_arrears = $lastrem;
                                if($a_arrears < 0)$a_arrears=0;
                            //    echo "<pre>";print_r($a_arrears);exit;
                            ?>
                            <tr>
                                <td class="text-danger"><?php echo $i++; ?></td>
                                <td class="text-danger">Actual Arrears</td>
                                <td class="text-danger"><?php echo '+ '.$a_arrears; ?></td>
                            </tr>
                            <?php }else if($invoice['status']==1 && $lastadv <= 0){
                              
                                $a_arrears = ($invoice['recieved'] + $invoice['discount'] + $lastrem) - $total - $invoice['advance'];
                                if($a_arrears < 0)$a_arrears=0;
                            ?>
                            <tr>
                                <td class="text-danger"><?php echo $i++; ?></td>
                                <td class="text-danger">Actual Arrears</td>
                                <td class="text-danger"><?php echo '+ '.$a_arrears; ?></td>
                            </tr>
                            <?php } ?>
                        </tbody>
                    </table>
                     <!--<button type="button" class="btn btn-warning btn-lg modal_btn" data-toggle="modal" data-target="#myModal" data-backdrop="static" data-keyboard="false">Click to create Fee Installment <span class="fa fa-print"></span></button>-->
                    </div>
                    <div class="col-md-6">
                          <form class="form-horizontal form-label-left" id="theform" action="<?php echo $base_url; ?>voucher/edit_submit" method="post" >
                        <input type="hidden" name="id" id="inv_id" value="<?php echo $invoice['id']; ?>">
                        <input type="hidden" name="encrpt" id="encrpt" value="<?php echo $encrpt; ?>">
                        <div class="row">
                            <div class=" col-sm-6 col-xs-10 col-md-offset-1">
                                <div class="col-md-4 col-sm-5 col-xs-12" >
                               
                                </div>
                            </div>
                            <div class="col-md-10 col-sm-4 col-xs-12 col-md-offset-1">
                                <div class="ln-solid"></div>
                                <div class="row">
                                    <div class="col-md-5 col-sm-5 col-xs-12">
                                        <h2>Deposit Type</h2>
                                    </div>
                                    <div class="col-md-7 col-sm-7 col-xs-12">
                                       <?php if($invoice['status']==1){ ?>
                                        <p><input id="bank_cash" type="radio" name="bank" value="bank" <?php if(@$invoice['fee_deposit_type']=="bank"){?> checked="true"<?php }else{?> disabled <?php } ?>> Bank 
                                            <input id="bank_cash" type="radio" name="bank" value="cash" <?php if(@$invoice['fee_deposit_type']=="cash"){?> checked="true"<?php }else{?> disabled <?php } ?>> Cash</p>
                                        <?php }else{ ?>
                                        <p><input id="bank_cash" type="radio" name="bank" value="bank" <?php if(@$branch['fee_deposit_type']=="bank"){?> checked="true"<?php }?>> Bank 
                                            <input id="bank_cash" type="radio" name="bank" value="cash" <?php if(@$branch['fee_deposit_type']=="cash"){?> checked="true"<?php }?>> Cash</p>
                                        <?php } ?>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-5 col-sm-5 col-xs-12">
                                        <h2 style="margin-bottom:0px;padding-bottom:0px;">Grand Total</h2><span class="text-danger" style="font-size:10px;">Fee & Actual Arrears</span>
                                    </div>
                                    <div class="col-md-7 col-sm-7 col-xs-12">
                                        <input id="total" type="hidden" value="<?php echo $total; ?>">
                                        <p><input id="g_total" type="number" name="g_total" class="form-control" readonly="readonly" value="<?php $g_total = $total + $a_arrears;  echo $g_total; ?>"></p>
                                    </div>
                                </div>
<?php 
			$due = date("Y-m-d",strtotime($invoice['date_expire']));
			$date = date("Y-m-d");
			if ($due<=$date && $invoice['status']==0) {
				$per = ($branch['fine_type']=='0') ? (($total * $branch['late_fine']) / 100) : $branch['late_fine'];
				$net = $total + $per;
				$fine = $per;
			} else {
				$net = $total;
				$fine = 0;
			}
?>
                                <div class="row">
                                    <div class="col-md-5 col-sm-5 col-xs-12">
                                        <h2 style="margin-bottom:0px;padding-bottom:0px;">Late Fee Fine</h2>
                                        <p class="text-danger" style="font-size:10px;margin-top:0px;padding-top:0px;">Check to include Fine  <span><input type="checkbox" id="fine_chk" name="fine_chk" checked value="1"/></span></p>
                                    
                                    </div>
                                    <div class="col-md-7 col-sm-7 col-xs-12">
                                        <p><input id="fine" type="number" name="fine" class="form-control" readonly="readonly" value="<?php echo $fine; ?>"></p>
                                    </div>
                                    
                                </div>
                              
                                        <input id="arrears" type="hidden" name="arrears" value="<?php echo $lastrem?$lastrem:0; ?>">
                                <!--    </div>-->
                                <!--</div>-->
                                <div class="row">
                                    <div class="col-md-5 col-sm-5 col-xs-12">
                                        <h2>Total Payable</h2>
                                    </div>
                                    <div class="col-md-7 col-sm-7 col-xs-12">
                                        <p><input id="net" type="number" name="net" class="form-control" readonly="readonly" value="<?php $net = ($total + $a_arrears+$fine); echo $net; ?><?php //$g_total = $total + $a_arrears;  echo $g_total; ?>"></p>
                                    </div>
                                </div>
                                <?php if($invoice['status']==1){ ?>
                                    <div class="row">
                                    <div class="col-md-5 col-sm-5 col-xs-12">
                                        <h2 style="margin-bottom:0px;padding-bottom:0px;">Pre-Received</h2><span class="text-danger" style="font-size:10px;">Fee & Discount</span>
                                    </div>
                                    <div class="col-md-7 col-sm-7 col-xs-12">
                                        <p style="font-size:10px;margin-top:0px;padding-top:0px;"><input type="number"  class="form-control" value="0" readonly="readonly" min="0"></p>
                                    </div>
                                </div>
                                <?php } ?>
                                <div class="row">
                                    <div class="col-md-5 col-sm-5 col-xs-12">
                                        <h2>Received</h2>
                                    </div>
                                    <div class="col-md-7 col-sm-7 col-xs-12">
                                        <p><input id="recieved" type="number" name="recieved" class="form-control" value="<?php echo $invoice['recieved']; ?>" min="0"></p>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-5 col-sm-5 col-xs-12">
                                        <h2>Discount <span style="font-size:10px" class="text-warning">(in Ksh)</span></h2>
                                    </div>
                                    <div class="col-md-7 col-sm-7 col-xs-12">
                                        <span>20%:<?php echo round(($total_tus_fee/100)*20);?> &nbsp;&nbsp; </span>  
                                        <span>40%:<?php echo round(($total_tus_fee/100)*40);?> &nbsp;&nbsp;</span>
                                    <span>60%:<?php echo round(($total_tus_fee/100)*60);?>    &nbsp;&nbsp;</span>
                                    <span>80%:<?php echo round(($total_tus_fee/100)*80);?> &nbsp;&nbsp;</span>
                                        <p><input required="required" id="discount" type="number" name="discount" class="form-control" min="0" <?php if($net < 0) ?> max="<?php echo $net; ?>" <?php if(($invoice['remaining']!=0 || $invoice['status']==0) && $net >= 0){ ?>value="0"<?php }else{ ?>value="<?php echo $invoice['discount']; ?>" readonly="readonly" <?php } ?></p>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-5 col-sm-5 col-xs-12">
                                        <h2>Remaining</h2>
                                    </div>
                                    <div class="col-md-7 col-sm-7 col-xs-12">
                                        <p><input id="remaining" type="number" name="remaining" class="form-control" readonly="readonly" min="0" max="<?php echo $net; ?>" value="<?php if($invoice['status']=='0'){ echo $net; }else{ echo $invoice['remaining']; } ?>"></p>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-5 col-sm-5 col-xs-12">
                                        <h2>Advance</h2>
                                    </div>
                                    <div class="col-md-7 col-sm-7 col-xs-12">
                                        <p><input id="advance" type="number" name="advance" class="form-control" readonly="readonly" value="<?php echo $invoice['advance']; ?>" min="0"></p>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-5 col-sm-5 col-xs-12">
                                        <h2>Submit Date</h2>
                                    </div>
                                    <div class="col-md-7 col-sm-7 col-xs-12">
                                        <?php
                                        
                                        

                                         ?>
                                        <p><input id="submitted_at" type="text" name="submitted_at" class="form-control" 
                                        <?php 
                                          if($invoice['remaining']!='0' || $invoice['status']==0){
                                              $c_dat=date("Y-m-d");
                                               if($c_dat<$invoice['date']){
                                                       $dat =date("d-m-Y",strtotime($invoice['date']));
                                                    }else{
                                                       $dat =date("d-m-Y"); 
                                                    }
                                               
                                             }else{ 
                                               $dat = $invoice['submitted_at'];} 
                                        ?> value="<?php echo $dat; ?>" min="0" readonly></p>
                                    </div>
                                </div>
                                <div class="row">
                                    
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <input class='btn btn-success' type="submit" value="Submit Voucher" id='btnsubmit' />   
                                    </div>
                                   
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <a target="_blank" id="print_btn" href="<?php echo base_url(); ?>voucher/doprint/<?php echo $invoice['id']; ?>"><button class="btn btn-primary" type="button">Print</button></a>
                                
                                        <a target="_blank" id="print_btn" href="<?php echo base_url(); ?>voucher/doprint1/<?php echo $invoice['id']; ?>"><button class="btn btn-info" type="button">Print Receipt</button></a>
                                    </div>
                                    
                                </div>
                            </div>
                        </div>
                    </form>
                    </div>
                    
                    </div>
           
                 
                  
                    <!-- Modal -->
            
                <form class="form-horizontal form-label-left" target="_blank" action="<?php echo $base_url; ?>voucher/print_install" method="post">
                <input type="hidden" name="id" value="<?php echo $invoice['id']; ?>">
                <div class="modal fade" id="myModal" role="dialog">
                    <div class="modal-dialog">
                    <!-- Modal content-->
                      <div class="modal-content">
                        <div class="modal-header">
                          <button type="button" class="close" data-dismiss="modal">&times;</button>
                          <h4 class="modal-title">Create Fee Installment</h4>
                        </div>
                        <div class="modal-body">
                          <div class="row">
                            <div class="col-md-11 col-sm-11 col-xs-12 col-md-offset-1">
                                <div class="col-md-10 col-sm-10 col-xs-12">
                                
                                <div class="row">
                                    <div class="col-md-5 col-sm-5 col-xs-12">
                                        <h4>Fee Title <span class="text-danger">*</span></h4>
                                    </div>
                                    <div class="col-md-7 col-sm-7 col-xs-12">
                                        <p><input id="title" type="text" name="title" class="form-control" required="required" placeholder="e.g.,First Installment" title-"e.g., First Installment"></p>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-5 col-sm-5 col-xs-12">
                                        <h4>Installment Amount <span class="text-danger">*</span></h4>
                                    </div>
                                    <div class="col-md-7 col-sm-7 col-xs-12">
                                        <p><input id="install_amt" type="number" min = "0" name="install_amt" required="required" class="form-control num" ></p>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-5 col-sm-5 col-xs-12">
                                        <h4>Due Date <span class="text-danger">*</span></h4>
                                    </div>
                                    <div class="col-md-7 col-sm-7 col-xs-12">
                                        <p><input id="install_date" type="date" name="install_date" class="form-control" required="required" value="<?php echo date("Y-m-d"); ?>"></p>
                                    </div>
                                </div>
                                </div>
                            </div>
                        </div>    
                        </div>
                        <div class="modal-footer">
                            <button class="btn btn-success" type="submit">Print<span class="fa fa-print"></span></button></a>
                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                            
                        </div>
                      </div>
                    </div>
                </div>
                </form>
                 
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
<!--        <div id="confirmBox">-->
<!--    <div class="message"></div>-->
<!--    <span class="button yes">Yes</span>-->
<!--    <span class="button no">No</span>-->
<!--</div>-->
        <!-- /page content -->

        <!-- footer content -->
        <footer>
          <div class="pull-right">
            EduSolutions
          </div>
          <div class="clearfix"></div>
        </footer>
        <!-- /footer content -->
      </div>
    </div>

    <!-- jQuery -->
    <script src="<?php echo base_url(); ?>assets/vendors/jquery/dist/jquery.min.js"></script>
    <!-- Custom JS -->
    <script src="<?php echo base_url(); ?>assets/js/main.js"></script>
    <!-- Bootstrap -->
    <script src="<?php echo base_url(); ?>assets/vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="<?php echo base_url(); ?>assets/vendors/fastclick/lib/fastclick.js"></script>
    <!-- NProgress -->
    <script src="<?php echo base_url(); ?>assets/vendors/nprogress/nprogress.js"></script>
    <!-- Chart.js -->
    <script src="<?php echo base_url(); ?>assets/vendors/Chart.js/dist/Chart.min.js"></script>
    <!-- gauge.js -->
    <script src="<?php echo base_url(); ?>assets/vendors/gauge.js/dist/gauge.min.js"></script>
    <!-- bootstrap-progressbar -->
    <script src="<?php echo base_url(); ?>assets/vendors/bootstrap-progressbar/bootstrap-progressbar.min.js"></script>
    <!-- iCheck -->
    <script src="<?php echo base_url(); ?>assets/vendors/iCheck/icheck.min.js"></script>
    <!-- Skycons -->
    <script src="<?php echo base_url(); ?>assets/vendors/skycons/skycons.js"></script>
    <!-- Flot -->
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.pie.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.time.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.stack.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.resize.js"></script>
    <!-- Flot plugins -->
    <script src="<?php echo base_url(); ?>assets/js/flot/jquery.flot.orderBars.js"></script>
    <script src="<?php echo base_url(); ?>assets/js/flot/date.js"></script>
    <script src="<?php echo base_url(); ?>assets/js/flot/jquery.flot.spline.js"></script>
    <script src="<?php echo base_url(); ?>assets/js/flot/curvedLines.js"></script>
    <!-- jVectorMap -->
    <script src="<?php echo base_url(); ?>assets/js/maps/jquery-jvectormap-2.0.3.min.js"></script>
    <!-- bootstrap-daterangepicker -->
    <script src="<?php echo base_url(); ?>assets/js/moment/moment.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/js/datepicker/daterangepicker.js"></script>
 <!-- Jquery UI-daterangepicker -->
    <script src="<?php echo base_url(); ?>assets/vendors/datepicker/jquery-ui.min.js"></script>
    <!-- Custom Theme Scripts -->
    <script src="<?php echo base_url(); ?>assets/build/js/custom.min.js"></script>

    <script>
    
     $(document).ready(function(){
             $('.DMY').daterangepicker({
      	format: 'DD-MM-YYYY',
        singleDatePicker: true,
        showDropdowns: true
    	});
        // $("#myModal").modal({
            // backdrop: 'static',
            // keyboard: false
    // });
        });
    //     $(document).ready(function(){
    //     // $("#myModal").modal({
    //         // backdrop: 'static',
    //         // keyboard: false
    // // });
    //     });
    
        $(function(){
            var total = $("#total").val();
            var net = $("#net").val();
            <?php if($invoice['status']==0){ ?>
            if(net <= 0 && total <= 0)
            {
                $("#total").val(0);
                $("#net").val(0);
                $("#remaining").val(0);
                $("#recieved").val(0);
                $("#advance").val(Math.abs(net));
            }else{
                $("#remaining").val(net);
            }
            <?php } ?>
        });    
            $(document).on("keyup","#recieved",function(){
                var val = parseInt($(this).val());
                var disc = parseInt($("#discount").val());
                var ret = parseInt($("#net").val()) - (val + disc);
                if(ret <= 0)
                {
                $("#remaining").val('0');
                $("#advance").val(Math.abs(ret));
                }else{
                $("#remaining").val(ret);
                $("#advance").val('0');
                }
            });
            $(document).on("keyup","#discount",function(){
                var val = parseInt($("#recieved").val());
                var disc = parseInt($("#discount").val());
                var ret = parseInt($("#net").val()) - (val + disc);
                if(ret == 0)
                {
                $("#remaining").val('0');
                $("#advance").val(Math.abs(ret));
                }else if(ret < 0){
                    alert('(Remaining + Discount) can not be greater than Net Total.');
                    $("#remaining").val(parseInt($("#net").val()) - (val));
                    $("#discount").val('0');
                }
                else{
                $("#remaining").val(ret);
                $("#advance").val('0');
                }
            });
            
    //     $('#pdf').change(function() {
    //   var newurl = $('#pdf').val();
    //   $('a.target').attr('href', newurl);
    // });
    
        $(document).on("click","#fine_chk",function(){
            inv = $('#inv_id').val();
           if(this.checked){
            //   alert("<?php echo base_url(); ?>voucher/doprint/");
               var newurl = "<?php echo base_url(); ?>voucher/doprint/" + inv + '/' + 1;
               var net = parseInt($("#net").val()) + parseInt($("#fine").val());
                var ret = parseInt($("#remaining").val()) + parseInt($("#fine").val());
                $("#net").val(net);
                $("#remaining").val(ret);
           } 
           else{
                //  alert("<?php echo base_url(); ?>voucher/doprint/");
               var newurl = "<?php echo base_url(); ?>voucher/doprint/" + inv;
            //  document.$('print_btn').href = "<?php echo base_url(); ?>voucher/doprint/" + inv + 5;
               var net = parseInt($("#net").val()) - parseInt($("#fine").val());
                var ret = parseInt($("#remaining").val()) - parseInt($("#fine").val());
               $("#net").val(net);
                $("#remaining").val(ret);
           }
           $('#print_btn').attr('href', newurl);
        });
        </script>
        <script type="text/javascript">

  $(function()
{
  $('#theform').submit(function(e){
      var ans= confirm("Changes are irreversible.Do you want to submit voucher?\n");
      if(ans==true)
      {
        $("input[type='submit']", this)
          .val("Please Wait...")
          .attr('disabled', 'disabled');
        return true;
      
 
      }
      else{
           e.preventDefault();
      }
     
    
  });
  
});

</script>
<script>
  $( function() {
    $( ".datepicker" ).datepicker({ dateFormat: 'd-m-yy' }).val();
  } );
  </script>
<!--<script>-->
<!--    function doConfirm(msg, yesFn, noFn) {-->
<!--    var confirmBox = $("#confirmBox");-->
<!--    confirmBox.find(".message").text(msg);-->
<!--    confirmBox.find(".yes,.no").unbind().click(function () {-->
<!--        confirmBox.hide();-->
<!--    });-->
<!--    confirmBox.find(".yes").click(yesFn);-->
<!--    confirmBox.find(".no").click(noFn);-->
<!--    confirmBox.show();-->
<!--}-->

<!--$(function () {-->
<!--    $("#theform").submit(function (e) {-->
<!--        e.preventDefault();-->
<!--        var form = this;-->
<!--        doConfirm("Are you sure?", function yes() {-->
<!--            $('#print_btn')[0].click();-->
<!--            location.reload();-->
<!--        }, function no() {-->
<!--             $("input[type='submit']", this)-->
<!--          .val("Please Wait...")-->
<!--          .attr('disabled', 'disabled');-->
<!--        return true;-->
<!--        });-->
<!--    });-->
<!--});-->
<!--</script>-->

  </body>
</html>