<?php include "layouts/menu.php"; ?>
		<script type="text/javascript">
	  $(function() {
   $("#datepicker").datepicker({ dateFormat: 'dd-mm-yy' });
  });
</script>
<script type="text/javascript">
function zp(n){
return n<10?("0"+n):n;
}
function insertDate(t,format){
var now=new Date();
var DD=zp(now.getDate());
var MM=zp(now.getMonth()+1);
var YYYY=now.getFullYear();
format=format.replace(/DD/,DD);
format=format.replace(/MM/,MM);
format=format.replace(/YYYY/,YYYY);
t.value=format;
}
</script>
    <script>
  $(function() {
   $("#datepicker1").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
    <script>
  $(function() {
   $("#datepicker2").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
      <script>
  $(function() {
   $("#datepicker8").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
    <script>
  $(function() {
   $("#datepicker9").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
   <script>
function add()
{
var x = document.getElementById("txt1").value;
var y = document.getElementById("txt2").value;
document.getElementById("bal").value =(x*1)-(y*1);
}
</script>
     
  <?php include "layouts/menu1.php"; ?>
            <!-- Right side column. Contains the navbar and content of the page -->
           <div class="right_col" role="main">
                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>
                       Staff Attendance
                      
                    </h1>
                   
                </section>
                   <div class="panel-body">
                            <div class="row">

    <form name="form155" class="form-horizontal" method="post" action="" enctype="multipart/form-data">

 <div class="form-group has-success has-feedback">
    <label for="inputPassword3" class="col-sm-2 control-label">Start Date</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="inputPassword3" name="fdate" value="<?php echo date("d-m-Y"); ?>" placeholder="dd-mm-yyyy" data-inputmask="'mask': '99-99-9999'" required>
	  <span class="glyphicon glyphicon-chevron-left form-control-feedback"></span>
    </div>
  </div>
   <div class="form-group has-success has-feedback">
    <label for="inputPassword3" class="col-sm-2 control-label">End Date</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="inputPassword3" name="tdate" value="<?php echo date("d-m-Y"); ?>" placeholder="dd-mm-yyyy" data-inputmask="'mask': '99-99-9999'" required>
	  <span class="glyphicon glyphicon-chevron-right form-control-feedback"></span>
    </div>
  </div>

  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-primary" name="s288">Search It</button>
    </div>
  </div>
      <div>
      <?php
								if(isset($_POST['s288']))
								{
								extract($_POST); 						
								$qry=mysqli_query($conn, "select * from customer");
				$row=mysqli_fetch_array($qry);
                $n=mysqli_num_rows($qry);
			$a = 0; $h = 0; $p = 0; $pp = 0; $tot = 0; $dde = 0;	?></p>
					<div class="table-responsive">
<table class="table table-striped table-bordered"> <thead>
  <tr class="info">  
<th>S.No</th>  <th>Date</th>
  <?php 
  $qry=mysqli_query($conn, "select * from customer");
while($row=mysqli_fetch_array($qry))
						{?>
						<th><?php echo $row['name']; ?></th>
						<?php  } ?>
						<?php  if($postt == 'MD') { ?> 	<th>#Cancel</th> <?php } ?>
					</tr></thead>
					<?php $i=1; $ij = 0;
							while (strtotime($fdate) <= strtotime($tdate)) 
								{
                                   $paydate = $fdate;
					$qryy=mysqli_query($conn, "select * from attt where date='$fdate'");
			//	$roww=mysqli_fetch_array($qryy);
					?>
					<tbody>
		
								<?php		while($roww=mysqli_fetch_array($qryy))
						{ $ij++; ?><tr class="warning">
						    <td><?php echo $ij;?></td>
					<td><?php echo $roww['date'];?></td>
					<?php while($i<=$n) {
                           $as = "as".$i.""; 
						$ax1 = $roww[$as];
						if($ax1 == 'p')
						{ $p = $p + 1; ?>
						<td><font color="green"><?php echo $roww[$as];?></font></td> <?php }
						
						elseif($ax1 == 'a')
						{ $a = $a + 1; ?>
						<td><font color="red"><?php echo $roww[$as];?></font></td> <?php }
						 
						  elseif($ax1 == 'h')
						{ $h = $h + 1; ?>
						<td><font color="blue"><?php echo $roww[$as];?></font></td> <?php }
						else
						{ $pp = $pp + 1; ?>
						<td><font color="black"><?php echo $roww[$as];?></font></td> <?php }
						
						
							$i++; }
						  ?>
						  <?php  if($postt == 'MD') { ?>     
				<td><b>

</br><a href="cancelatt.php?id=<?php echo $roww['id'];?>" class="btn btn-primary btn-xs" onclick="return confirm('Are you sure WANT TO CANCEL?');">Cancel</a></b></td>	
					<?php } ?>
					</tr> <?php $i=1;} $fdate = date ("d-m-Y", strtotime("+1 day", strtotime($fdate)));
								} ?>
					</tbody>					
					</table><?php $tot = $p + ($h / 2) ; ?> Total Days Prensent = <?php echo $tot; ?> For <?php echo $dde; ?> Days                         </div><!-- /.box-body -->
								<?php 	 } ?>     </div><!-- /.box -->
                        </div>
                    </div>

                </section><!-- /.content -->
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->
     <!-- footer content --> 
        <footer>
          <div class="pull-right">
             <a href="https://infossel.com">Infossel Soft Solution</a>
          </div>
          <div class="clearfix"></div>
        </footer>
        <!-- /footer content -->
      </div>
    </div>

    <!-- jQuery -->
    <script src="vendors/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="vendors/fastclick/lib/fastclick.js"></script>
    <!-- NProgress -->
    <script src="vendors/nprogress/nprogress.js"></script>
    <!-- iCheck -->
    <script src="vendors/iCheck/icheck.min.js"></script>
    <!-- Datatables -->
    <script src="vendors/datatables.net/js/jquery.dataTables.min.js"></script>
    <script src="vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
    <script src="vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
    <script src="vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
    <script src="vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
    <script src="vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
    <script src="vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
    <script src="vendors/datatables.net-scroller/js/dataTables.scroller.min.js"></script>
    <script src="vendors/jszip/dist/jszip.min.js"></script>
    <script src="vendors/pdfmake/build/pdfmake.min.js"></script>
    <script src="vendors/pdfmake/build/vfs_fonts.js"></script>

    <!-- Custom Theme Scripts -->
    <script src="build/js/custom.min.js"></script>

  </body>
</html>