 <link href="<?php echo base_url(); ?>assets/vendors/select2/dist/css/select2.min.css" rel="stylesheet">
  <link rel="stylesheet" href="<?php echo base_url()?>assets/css/bootstrapValidator.css"/>
 <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
            <div class="page-title">
                <div class="title_left">
                    <h3></h3>
                </div>
            </div>
            <div class="clearfix"></div>
<?php if ($this->session->flashdata('errmsg')): ?>
<div class="alert alert-success">
<?php echo $this->session->flashdata('errmsg'); ?>
</div>
<?php endif ?>
            <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>Add Chart Of Accounts</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">

                    <form id="add_defn" class="form-horizontal form-label-left" action="<?php echo base_url()?>Account/save_heads_n" method="post">
            <input type="hidden" name="last_val" id="last_val">
            <input type="hidden" name="first_val" id="first_val">
            
            <!--<div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Code<span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="code" class="form-control col-md-7 col-xs-12" name="code" placeholder="Code" required="required" type="text">
                        </div>
                      </div>-->
                      
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Name <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="fname" class="form-control col-md-7 col-xs-12" onkeypress="return maskAlphaWithSp(this,event);" name="fname" placeholder="Name" required="required" type="text">
                        </div>
                      </div>

                    <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="des">Description<span class="required"></span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <textarea id="description" class="form-control col-md-7 col-xs-12" name="description"></textarea>
                        </div>
                      </div>


                         <div class="item form-group">
                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-left:260px">
                         <div id="keyword_wrapper">
                             <select class="form-control" id="head" name="head[]" required>
                                  <option value="">Select Head</option>    
                                          <?php 
                                      
                              foreach ($heads as $value) {
                                              ?>
                    <option value="<?php echo $value->id; ?>"><?php echo $value->name?></option>

                  <?php } ?>
                                       
                                        </select>
                                         
                                        </div>
                             
               </div>
              </div>     
                      
                      <div class="ln_solid"></div>
                      <div class="form-group">
                        <div class="col-md-6 col-md-offset-3">
                          <button id="send" type="submit" class="btn btn-success pull-right">Add</button>
                        </div>
                      </div>
                    </form>
                  </div>
                </div>
              </div>
            </div>
            
           
            <!--View-->
             
                <div class="row">
             <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>View Chart Of Accounts</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">
                    <div class="col-md-6">
                      <label class="control-label col-md-3 col-sm-2 col-xs-12" for="name"><span class="required"></span>
                      </label>
                      <div class="col-md-8 col-sm-8 col-xs-8">
                      <select name="bank" id="bank" class="form-control" required>
                      <option value="">Select Head</option>
                      <?php
                      foreach ($heads as $value) {
                      ?>
                      <option value="<?php echo $value->id;?>"><?php echo $value->name;?></option>
                      <?php
                      }  
                      ?>
                      </select>

                      </div>
                        </div>
                   
                     <div class="clearfix"></div>
                <br><br>
                      
                      <table id='myDataTable' class='table table-striped table-bordered nowrap' style='width:100%;'>
                      <thead>
                        <tr>
                          <th width="15%">Code</th>
                          
                          <th width="25%">Title</th>
                          <th width="15%">Nature</th>
                         <th width="15%">Action</th>
                        </tr>
                      </thead>
                     <tbody id="center">
                    </tbody>
                    </table>
                  </div>
                </div>
              </div>
              </div>
            </div> 
                
                <!--End view -->
            
          </div>
        </div>
        <!-- /page content -->

        <script src="<?php echo base_url(); ?>assets/vendors/jquery/dist/jquery.min.js"></script>
       <script src="<?php echo base_url(); ?>assets/js/bootstrapValidator.js"></script>
        <script src="<?php echo base_url(); ?>assets/vendors/select2/dist/js/select2.full.min.js"></script>
            <!-- Datatables -->
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net/js/jquery.dataTables.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
    
    <script src="<?php echo base_url(); ?>assets/vendors/jszip/dist/jszip.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/pdfmake/build/pdfmake.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/pdfmake/build/vfs_fonts.js"></script>
    <script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/commonFormValidator.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-scroller/js/datatables.scroller.min.js"></script>
    <script>
function maskAlphaWithSp(obj, e) {
  var code = e.charCode ? e.charCode : e.keyCode;
  if (!isAlphaCharCodeWithSpaces(code) ||  code == 38 || code == 35 || code == 36 || code == 37 || code == 39 || code == 40 || code == 46) {
    return false;
    }
    return true;
  
}
</script>
<script type="text/javascript">
         var jq = jQuery.noConflict();
jq(document).ready(function() {
 jq('#add_defn').bootstrapValidator({
       feedbackIcons: {
              valid: 'glyphicon glyphicon-ok',
              invalid: 'glyphicon glyphicon-remove',
              validating: 'glyphicon glyphicon-refresh'
                   },
        fields: {
                  fname: {
                        trigger:'change keyup',
                        validators: {
                            notEmpty: {
                                message: 'Name is required'
                            }
                           
                        }
                    },
                    
                     head: {
                        trigger:'change keyup',
                        validators: {
                            notEmpty: {
                                message: 'Parent is required'
                            }
                        }
                    },
                
                    
                
                    
        }
    });
    
});
</script>
    
       <script>
        var jq = jQuery.noConflict();
       var child=0;
        jq(document).ready(function(){
           var type_id = new Array();
            jq(document).on("change","#head",function(){
                var value = jq(this).val();
                if(value >0)
                {
                jq('#head2').remove();
                 jq('#head3').remove();
                  jq('#head4').remove();
                   jq('#head5').remove();
                    jq('#head6').remove();
                     jq('#head7').remove();
                if(value==5 || value==6 ||value==7)
                {
                  alert("This is last level head cannot add more head");
                 //  jq(this).remove();
                    jq("#send").prop("disabled",true);
                  return false;
                
                }else
                {
                  jq("#send").prop("disabled",false);
                  jq("#last_val").val(value);
                  jq("#first_val").val(value);
                  child++;
                  jq.get("<?php echo base_url(); ?>account/fetch_child_old/"+value+"/"+child,{},function(d){
                   jq("#keyword_wrapper").append(d);
                    });
                }
               
               }else
               {
                jq('#head2').remove();
                 jq('#head3').remove();
                  jq('#head4').remove();
                   jq('#head5').remove();
                    jq('#head6').remove();
                     jq('#head7').remove();
               }
            });
            
        });
   
        jq(document).ready(function(){
         jq(document).on("change","#head2",function(){
           // jq('#head').attr("disabled", true); 
            jq('#head3').remove();
            jq('#head4').remove();
            jq('#head5').remove();
            jq('#head6').remove();
             jq('#head7').remove();
                var value = jq(this).val();
                if(value >0)
                {
                 jq.get("<?php echo base_url(); ?>account/check_last/"+value,{},function(d){
                   if(d==0)
                   {
                       if(value==5 || value==6 ||value==7)
                {
                  alert("This is last level head can't add more head");
                    jq("#send").prop("disabled",true);
                  return false;
                
                }else
                {
                  jq("#send").prop("disabled",false);
                  jq("#last_val").val(value);
                  child++;
                  jq.get("<?php echo base_url(); ?>account/fetch_child_old_2/"+value+"/"+child,{},function(d){
                   jq("#keyword_wrapper").append(d);
                    });
                }
                   }else
                   {
                     alert("This Head is defined at last level so you can't add more head");
                    jq("#send").prop("disabled",true);
                    return false;
                   }
                    });
               
              
                
                }
            });
        });
        
           jq(document).ready(function(){
         jq(document).on("change","#head3",function(){
           // jq('#head2').attr("disabled", true); 
            jq('#head4').remove();
             jq('#head5').remove();
            jq('#head6').remove();
             jq('#head7').remove();
                var value = jq(this).val();
                if(value > 0)
                {
                jq.get("<?php echo base_url(); ?>account/check_last/"+value,{},function(d){
                   if(d==0)
                   {
                if(value==5 || value==6 ||value==7)
                {
                  alert("This is last level head cannot add more head");
                  // jq(this).remove();
                    jq("#send").prop("disabled",true);
                  return false;
                
                }else
                {
                  jq("#send").prop("disabled",false);
                  jq("#last_val").val(value);
                  child++;
                  jq.get("<?php echo base_url(); ?>account/fetch_child_old_3/"+value+"/"+child,{},function(d){
                   jq("#keyword_wrapper").append(d);
                    });
                }
                 }else
                   {
                     alert("This Head is defined at last level so you can't add more head");
                    jq("#send").prop("disabled",true);
                    return false;
                   }
                    });
                    
                    
                }
            });
        });
        
           jq(document).ready(function(){
         jq(document).on("change","#head4",function(){
           // jq('#head3').attr("disabled", true); 
            jq('#head5').remove();
            jq('#head6').remove();
             jq('#head7').remove();
                var value = jq(this).val();
                 if(value > 0)
                {
                 jq.get("<?php echo base_url(); ?>account/check_last/"+value,{},function(d){
                   if(d==0)
                   {
                if(value==5 || value==6 ||value==7)
                {
                  alert("This is last level head cannot add more head");
                  // jq(this).remove();
                    jq("#send").prop("disabled",true);
                  return false;
                
                }else
                {
                  jq("#send").prop("disabled",false);
                  jq("#last_val").val(value);
                  child++;
                  jq.get("<?php echo base_url(); ?>account/fetch_child_old_4/"+value+"/"+child,{},function(d){
                   jq("#keyword_wrapper").append(d);
                    });
                }
                 }else
                   {
                     alert("This Head is defined at last level so you can't add more head");
                    jq("#send").prop("disabled",true);
                    return false;
                   }
                    });
                    
                    
                }
            });
        });
        
            jq(document).ready(function(){
         jq(document).on("change","#head5",function(){
           // jq('#head4').attr("disabled", true); 
            jq('#head6').remove();
             jq('#head7').remove();
                var value = jq(this).val();
                 if(value > 0)
                {
                  jq.get("<?php echo base_url(); ?>account/check_last/"+value,{},function(d){
                   if(d==0)
                   {
                if(value==5 || value==6 ||value==7)
                {
                  alert("This is last level head cannot add more head");
                  // jq(this).remove();
                    jq("#send").prop("disabled",true);
                  return false;
                
                }else
                {
                  jq("#send").prop("disabled",false);
                  jq("#last_val").val(value);
                  child++;
                  jq.get("<?php echo base_url(); ?>account/fetch_child_old_5/"+value+"/"+child,{},function(d){
                   jq("#keyword_wrapper").append(d);
                    });
                }
                 }else
                   {
                     alert("This Head is defined at last level so you can't add more head");
                    jq("#send").prop("disabled",true);
                    return false;
                   }
                    });
                    
                    
                }
            });
        });
        
         jq(document).ready(function(){
         jq(document).on("change","#head6",function(){
           // jq('#head5').attr("disabled", true); 
            jq('#head7').remove();
                var value = jq(this).val();
                 if(value > 0)
                {
                 jq.get("<?php echo base_url(); ?>account/check_last/"+value,{},function(d){
                 if(d==0)
                 {
                if(value==5 || value==6 ||value==7)
                {
                  alert("This is last level head cannot add more head");
                  // jq(this).remove();
                    jq("#send").prop("disabled",true);
                  return false;
                
                }else
                {
                  jq("#send").prop("disabled",false);
                  jq("#last_val").val(value);
                  child++;
                  jq.get("<?php echo base_url(); ?>account/fetch_child_old_6/"+value+"/"+child,{},function(d){
                   jq("#keyword_wrapper").append(d);
                    });
                }
                 }else
                   {
                     alert("This Head is defined at last level so you can't add more head");
                    jq("#send").prop("disabled",true);
                    return false;
                   }
                    });
                    
                    
                }
            });
        });
        
    </script>
      <script>
         var jq = jQuery.noConflict();
      jq(document).ready(function(){

        jq.ajax({
         url: "<?php echo base_url(); ?>account/fetch_heads_all/",data: {},
                     success: function( d ) {
                 jq("#myDataTable").dataTable().fnDestroy(); 
                  setTimeout(function(){ 
                jq( "tbody#center" ).html(d);
                jq('#myDataTable').DataTable({
                "bPaginate":true,
                "paging":   true,
                "bFilter":true,
                "pageLength": 100,
                "bInfo":false,
                "ordering":false,
                "scrollX":true,
            dom: 'Bfrtip',
             buttons: [
                {
              extend:'csv',
              },
              {
                 extend: 'pdf',
                 exportOptions:{columns:[0,1,2]},
             },
            {text:'Print',action:function() { var win = window.open('<?php echo base_url(); ?>'+'report/print_custom_chart/'+"<?php echo 0; ?>", '_blank');
  win.focus(); }},
            {extend:'excel',text:'Excel',exportOptions:{columns:[0,1,2]}}  ]
            });
            },500); 
                
          
  }
   
});

         jq('#bank').change(function(){
          var id=jq(this).val();
          if(id>0)
          {
          jq.ajax({
         url: "<?php echo base_url(); ?>account/fetch_heads/"+id,data: {},
                 success: function( d ) {
                 jq("#myDataTable").dataTable().fnDestroy(); 
                  setTimeout(function(){ 
                jq( "tbody#center" ).html(d);
                jq('#myDataTable').DataTable({
            "bPaginate":true,
            "paging":   true,
            "bFilter":true,
            "pageLength": 100,
            "bInfo":false,
            "ordering":false,
            "scrollX":true,
            dom: 'Bfrtip',
            buttons: [
                {
              extend:'csv',
              },
              {
                 extend: 'pdf',
                 exportOptions:{columns:[0,1,2]},
             },
            {text:'Print',action:function() { var win = window.open('<?php echo base_url(); ?>'+'report/print_custom_chart/'+id, '_blank');
  win.focus(); }},
            {extend:'excel',text:'Excel',exportOptions:{columns:[0,1,2]}}  ]
            });
            },500);  
                
          
  }
   
});
}else
{
      jq.ajax({
         url: "<?php echo base_url(); ?>account/fetch_heads_all/",data: {},
                   success: function( d ) {
                 jq("#myDataTable").dataTable().fnDestroy(); 
                  setTimeout(function(){ 
                jq( "tbody#center" ).html(d);
                jq('#myDataTable').DataTable({
            "bPaginate":true,
                  "bLengthChange": true,
            "paging":   true,
            "bFilter":true,
            "pageLength": 100,
            "bInfo":false,
            "ordering":false,
            "scrollX":true,
            dom: 'Bfrtip',
             buttons: [
                {
              extend:'csv',
              },
              {
                 extend: 'pdf',
                 exportOptions:{columns:[0,1,2]},
             },
             {
                 extend:'print',
                 exportOptions:{columns:[0,1,2]},
            },
            {extend:'excel',text:'Excel',exportOptions:{columns:[0,1,2]}}  ]
            });
            },500);  
                
          
  }
   
});
}

        });
 });

         </script>
              <script>
 var jq = jQuery.noConflict();
     jq(document).ready(function() {
    jq('#myDataTable').DataTable(
      {
            "bPaginate":true,
            "pageLength": 100,
             "bLengthChange": true,
            "bFilter":true,
            "bInfo":false,
            "ordering":false,
            "scrollX":true,
            dom: 'Bfrtip',
            buttons: [
            'pdf',{extend:'excel',text:'Excel',exportOptions:{columns:[0,1,2,3]}}            ]
            }
    );
           });
 </script>
            <script>
             var jq = jQuery.noConflict();
window.setTimeout(function() {
jq(".alert").fadeTo(500, 0).slideUp(500, function(){
    jq(this).remove(); 
});
}, 3000);
        </script>
        <script>
  // jq("#head").select2({
     //       placeholder: "Select Head",
      //      allowClear: false
       //  });
        </script>
        
          <footer>
          <div class="pull-right">
            Prudmac
          </div>
          <div class="clearfix"></div>
        </footer>
        <div id='ajaxload' style='position:fixed;top:0;left:0;bottom:0; width:100%;height:100%;z-index:1000;background:rgba(2,132,130,0.5);display:none;'>
            <i class='fa fa-spinner fa-spin fa-4x' style='position: relative;top: 50%;left: 50%;margin-top: -50px;margin-left: -50px;'></i>
        </div>
        <!-- /footer content -->
      </div>
    </div>

    <!-- jQuery -->
    
    <!-- Custom JS -->
    <script src="<?php echo base_url(); ?>assets/js/main2.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>

    <!-- Custom Theme Scripts -->
    <script src="<?php echo base_url(); ?>assets/build/js/custom.min2.js"></script>
          <script src="<?php echo base_url(); ?>assets/js/bootstrap-datepicker.js"></script>
          
        <!-- Datatables -->
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net/js/jquery.dataTables.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-scroller/js/datatables.scroller.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/jszip/dist/jszip.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/pdfmake/build/pdfmake.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/pdfmake/build/vfs_fonts.js"></script>

     
<script>
var jq = jQuery.noConflict();
 jq ( function() {
    jq ( ".datepicker" ).datepicker({ dateFormat: 'dd/mm/yyyy' }).val();
  } );
</script>
    <!-- Datatables -->
    
<script>
var jq = jQuery.noConflict();
 jq(document).ready(function() {
    jq('#datatable').DataTable();
} );
jq(document).ajaxStart(function() {
          jq('#ajaxload').show();
      });
      jq(document).ajaxStop(function() {
           jq('#ajaxload').hide();
      });
 jq(function () {
    jq(".date").datepicker({
    format: 'dd/mm/yyyy'
    });
    date(".now");
    jq(".date").focusout(function () {
        if (jq (this).val().trim() == "") {
            date(".date");
        }
    });

    function date(selector) {
        var dNow = new Date();
        var localdate = dNow.getFullYear()+'/' +(dNow.getMonth() + 1)+'/' + dNow.getDate();
       
    }

});
</script>
    <script>
    var jq = jQuery.noConflict();
    jq (".abc").on("keypress", function (event) {

            var englishAlphabetAndWhiteSpace = /[A-Za-z ]/g;


            var key = String.fromCharCode(event.which);


            if (event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 37 || event.keyCode == 39 || englishAlphabetAndWhiteSpace.test(key)) {
                return true;
            }
            return false;
        });

         
        jq (".abc1").on("keypress", function (event) {

            var englishAlphabetAndWhiteSpace = /[A-Za-z0-9|-]/g;


            var key = String.fromCharCode(event.which);


            if (event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 32 || event.keyCode == 37 || event.keyCode == 39 || englishAlphabetAndWhiteSpace.test(key)) {
                return true;
            }


            return false;
        });
        
        jq (document).bind("contextmenu", function (e) {
            e.preventDefault();
        });
         //form only numbers
        jq (".num").on("keypress", function (e) {
          
            var evt = (e) ? e : window.event;
            var charCode = (evt.keyCode) ? evt.keyCode : evt.which;
            if (charCode > 31 && (charCode < 48 || charCode > 57)) {
                return false;
            }
            return true;
        });
    </script>
  </body>
</html> 