<!DOCTYPE html>
<?php
$tiga=$this->db->query("SELECT * from web_setting where id='1'");
foreach ($tiga->result() as $rt) {
$namsek=$rt->nama;
$logo=$rt->logo;
}
?>
<html lang="en">
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<head>
  <meta charset="utf-8">
  <title>Absensi <?php echo $namsek;?></title>
  <meta content="width=device-width, initial-scale=1.0" name="viewport">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

  <meta content="Metronic Shop UI description" name="description">
  <meta content="Metronic Shop UI keywords" name="keywords">
  <meta content="keenthemes" name="author">

  <meta property="og:site_name" content="Presensi Online">
  <meta property="og:title" content="Chung Chin">
  <meta property="og:description" content="Software, jaringan, Linux, Windows">
  <meta property="og:type" content="website">
  <meta property="og:image" content="-CUSTOMER VALUE-"><!-- link to image for socio -->
  <meta property="og:url" content="xwaja.my.id">
  <link rel="shortcut icon" href="favicon.ico">

   <!-- Global styles START -->          
  <link href="assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet">
  <link href="assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <!-- Global styles END --> 
   
  <!-- Page level plugin styles START -->
  <link href="assets/global/plugins/fancybox/source/jquery.fancybox.css" rel="stylesheet">
  <link href="assets/global/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css">
  <!-- Page level plugin styles END -->

  <!-- Theme styles START -->
  <link href="assets/global/css/components.css" rel="stylesheet">
  <link href="assets/global/css/plugins.css" rel="stylesheet">
  <link href="assets/frontend/layout/css/style.css" rel="stylesheet">
  <link href="assets/frontend/layout/css/style-responsive.css" rel="stylesheet">
  <link href="assets/frontend/layout/css/themes/red.css" rel="stylesheet" id="style-color">
  <link href="assets/frontend/layout/css/custom.css" rel="stylesheet">
  <script src="assets/js/fungsi.js" type="text/javascript"></script>
    <link rel="stylesheet" href="<?php echo base_url('assets/js/plugins/datatables/dataTables.bootstrap.css'); ?>">
	<script language="JavaScript" type="text/JavaScript">
	function MM_jumpMenu(targ,selObj,restore){ //v3.0
	  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	  if (restore) selObj.selectedIndex=0;
	}
	</script>
  <!-- Theme styles END -->
</head>
<!-- Head END -->

<!-- Body BEGIN -->
<body class="corporate">
    <!-- BEGIN HEADER -->
    <div class="header">
      <div class="container">
        <a class="site-logo" href="index"><img src="<?php echo base_url('assets/back/'.$logo.'');?>" height="38" alt="<?php echo $namsek;?>"><?php echo $namsek;?></a>

        <a href="javascript:void(0);" class="mobi-toggler"><i class="fa fa-bars"></i></a>

        <!-- BEGIN NAVIGATION -->
        <div class="header-navigation pull-right font-transform-inherit">
          <ul>
            <li>
              <a href="index.php">Home </a>

            </li>
            <li class="active"><a href="bulanan">Rekap Bulanan</a></li>
            <li><a href="rekapindividu">Rekap Individu</a></li>
            <li><a href="login">Login</a></li>

          </ul>
        </div>
        <!-- END NAVIGATION -->
      </div>
    </div>
    <!-- Header END -->

    <div class="main">
      <div class="container">
        <ul class="breadcrumb">
            <li><a href="index.php">Home</a></li>
            <li class="active">Rekap Absensi Perbulan</li>
        </ul>
        <!-- BEGIN SIDEBAR & CONTENT -->
        <div class="row margin-bottom-20">
          <!-- BEGIN CONTENT -->
          <div class="col-md-12 col-sm-12">
            <div class="content-page">
			  <div class="row">
				<div class="col-md-12 ">
				<?php
				$jenis=$this->input->get('jenis');
				$mm=$this->input->get('mm');
				$yy=$this->input->get('yy');
				if (!$mm) $mm=date('m');
				if (!$yy) $yy=date('Y');
				?>
				<center>
				<table><tr><td>BULAN</td><td>:</td><td>
					<select  name="mm" onChange="MM_jumpMenu('parent',this,0)">
						<?php if (!$mm=='') { ?>
							<option><?php echo bulan($mm);?></option>
						<?php } else {?>
						<?php }
							for ($i=1;$i<=12;$i++) {
										echo "<option value='?yy=$yy&mm=$i'>".bulan($i)."</option>";
						   } ?>
						  
					</select>
					<select  name="yy" onChange="MM_jumpMenu('parent',this,0)">
						<?php if (!$yy=='') { ?>
							<option><?php echo $yy;?></option>
						<?php } 
							for ($i=date("Y");$i>date('Y')-10;$i-=1){
										echo "<option value='?yy=$i&mm=$mm'>$i</option>";
						   } ?>
						  
					</select>
					</td>
					
					</table>
					</center><br>
				  <!-- BEGIN SAMPLE FORM PORTLET-->
				  <div class="portlet box blue">
					<div class="portlet-title">
					  <div class="caption">
						<i class="fa fa-gift"></i> Daftar Rekap Absensi
					  </div>
					  
					</div>
					<div class="portlet-body">
						<div class="row">
							<div class="col-md-12 ">
									<table class="table table-bordered table-striped">
									<tr>
									 <th width=8%>TGL</th>
									 <th width=18%>HARI</th>
									 <th width=13%>TEPAT WAKTU</th>
									 <th width=13%>TERLAMBAT</th>
									 <th width=13%>TIDAK HADIR</th>
									 <th width=13%>JAM HADIR RATA-RATA</th>
									 <th width=13%>JAM PULANG RATA-RATA</th>
									</tr>
									<?php
									$j=$this->db->query("SELECT COUNT(*) as tes FROM web_siswa WHERE 1");
									foreach ($j->result() as $rsj) {
									$jml_peg=$rsj->tes;
									}
									$jam_masuk=jam_to_dec('07:00:00');
									$tot_hari=jml_hari($mm,$yy);
									for ($i=1;$i<=$tot_hari;$i++) {
									$aa=str_pad($i,2,'0',STR_PAD_LEFT);
									?>
									<tr>
									<td><a href="index.php?<?php echo "dd=$aa&mm=$mm&yy=$yy"?>"><?php echo $tg="$aa-$mm-$yy";?></a></td>
									<td><a href="index.php?<?php echo "dd=$aa&mm=$mm&yy=$yy"?>"><?php echo $hari=hari($i,$mm,$yy);?></a></td>
									<td> <?php
									$jam_tepat=array();
									$jam_terlambat=array();
									$jam_pulang=array();

									$res=$this->db->query("SELECT jam,status FROM web_absen WHERE tgl='$yy-$mm-$aa'");
									  foreach ($res->result() as $ros) {
										 if ($ros->status==1) {
											$cek=jam_to_dec($ros->jam);
											  if ($cek>$jam_masuk){ 
												  $jam_terlambat[]=jam_to_dec($ros->jam);
											  }	else {
												  $jam_tepat[]=jam_to_dec($ros->jam);    
											  }
										 } else {
											 $jam_pulang[]=jam_to_dec($ros->jam);  
										 }											 
									  }
									  echo $tepat=sizeof($jam_tepat);
									  $jml_masuk=sizeof($jam_tepat)+sizeof($jam_terlambat);
									?> </td>
									<td><?php echo $telat=sizeof($jam_terlambat)?></td>
									<td><?php echo $tidak=(!$jml_masuk) ? "-": $jml_peg-$jml_masuk;?></td>
									<td> <?php
									if ($jml_masuk) {
									  $a=@ceil((array_sum($jam_tepat)+array_sum($jam_terlambat))/(sizeof($jam_tepat)+sizeof($jam_terlambat)));
									  echo $jam1=dec_to_jam($a);
									} else {
										echo $jam1='-';
									}
									?></td>
									<td><?php
									if ($jml_masuk) {
									  $a=@ceil(array_sum($jam_pulang)/sizeof($jam_pulang));
									  if ($a) echo $jam2=dec_to_jam($a); else echo $jam2="-";
									} else {
										echo $jam2='-';
									}
									?></td>
									</tr>
									<?php }?>
									</table>
							</div>
						</div>
					</div>
				  </div>
				  <!-- END SAMPLE FORM PORTLET-->
				</div>
			  </div>
          </div>
          <!-- END CONTENT -->
        </div>
        <!-- END SIDEBAR & CONTENT -->
      </div>
    </div>
    <!-- BEGIN FOOTER -->
    <div class="footer">
      <div class="container">
        <div class="row">
          <!-- BEGIN COPYRIGHT -->
          <div class="col-md-6 col-sm-6 padding-top-10">
             2019 © <?php echo $namsek;?>. ALL Rights Reserved. <a href="#">Privacy Policy</a> | <a href="#">Terms of Service</a>
          </div>
          <!-- END COPYRIGHT -->
          <!-- BEGIN PAYMENTS -->
          <div class="col-md-6 col-sm-6">
            <ul class="social-footer list-unstyled list-inline pull-right">
              <li><a href="#"><i class="fa fa-facebook"></i></a></li>
              <li><a href="#"><i class="fa fa-google-plus"></i></a></li>
              <li><a href="#"><i class="fa fa-dribbble"></i></a></li>
              <li><a href="#"><i class="fa fa-linkedin"></i></a></li>
              <li><a href="#"><i class="fa fa-twitter"></i></a></li>
              <li><a href="#"><i class="fa fa-skype"></i></a></li>
              <li><a href="#"><i class="fa fa-github"></i></a></li>
              <li><a href="#"><i class="fa fa-youtube"></i></a></li>
              <li><a href="#"><i class="fa fa-dropbox"></i></a></li>
            </ul>  
          </div>
          <!-- END PAYMENTS -->
        </div>
      </div>
    </div>
    <!-- END FOOTER -->

    <!-- Load javascripts at bottom, this will reduce page load time -->
    <!-- BEGIN CORE PLUGINS (REQUIRED FOR ALL PAGES) -->
    <!--[if lt IE 9]>
    <script src="assets/global/plugins/respond.min.js"></script>
    <![endif]-->
    <script src="assets/global/plugins/jquery.min.js" type="text/javascript"></script>
    <script src="assets/global/plugins/jquery-migrate.min.js" type="text/javascript"></script>
    <script src="assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>      
    <script src="assets/frontend/layout/scripts/back-to-top.js" type="text/javascript"></script>
	<script src="assets/frontend/layout/scripts/layout.js" type="text/javascript"></script>
	<script src="<?php echo base_url('assets/js/plugins/datatables/jquery.dataTables.min.js'); ?>"></script>
    <script src="<?php echo base_url('assets/js/plugins/datatables/dataTables.bootstrap.min.js'); ?>"></script>
	<script>
		  $(function () {
			$('#example1').DataTable();
			
		  });
		</script>
    <!-- END CORE PLUGINS -->

    <!-- BEGIN PAGE LEVEL JAVASCRIPTS (REQUIRED ONLY FOR CURRENT PAGE) -->
    <script src="assets/global/plugins/fancybox/source/jquery.fancybox.pack.js" type="text/javascript"></script><!-- pop up -->
    <script src="assets/global/plugins/uniform/jquery.uniform.min.js" type="text/javascript" ></script>
	 <script type="text/javascript">
        jQuery(document).ready(function() {
            Layout.init();    
            Layout.initOWL();
            Layout.initTwitter();
            Layout.initFixHeaderWithPreHeader(); /* Switch On Header Fixing (only if you have pre-header) */
            Layout.initNavScrolling();
        });
    </script>
    
    <!-- END PAGE LEVEL JAVASCRIPTS -->
</body>
</html>