<!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="<?php echo base_url('assets/global/plugins/font-awesome/css/font-awesome.min.css'); ?>" rel="stylesheet">
  <link href="<?php echo base_url('assets/global/plugins/bootstrap/css/bootstrap.min.css'); ?>" rel="stylesheet">
  <!-- Global styles END -->

  <!-- Page level plugin styles START -->
  <link href="<?php echo base_url('assets/global/plugins/fancybox/source/jquery.fancybox.css'); ?>" rel="stylesheet">
  <link href="<?php echo base_url('assets/global/plugins/uniform/css/uniform.default.css'); ?>" rel="stylesheet" type="text/css">
  <!-- Page level plugin styles END -->

  <!-- Theme styles START -->
  <link href="<?php echo base_url('assets/global/css/components.css'); ?>" rel="stylesheet">
  <link href="<?php echo base_url('assets/global/css/plugins.css'); ?>" rel="stylesheet">
  <link href="<?php echo base_url('assets/frontend/layout/css/style.css'); ?>" rel="stylesheet">
  <link href="<?php echo base_url('assets/frontend/layout/css/style-responsive.css'); ?>" rel="stylesheet">
  <link href="<?php echo base_url('assets/frontend/layout/css/themes/red.css'); ?>" rel="stylesheet" id="style-color">
  <link href="<?php echo base_url('assets/frontend/layout/css/custom.css'); ?>" rel="stylesheet">
  <script src="<?php echo base_url('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><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
				$kodeabsen=$this->input->get('absen');
				//echo $kodeabsen;
				$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>
					<tr><td>NAMA SISWA</td><td> :</td><td>
						<select name="kodeabsen" onChange="MM_jumpMenu('parent',this,0)">
						<?php if (!$kodeabsen=='') {
								$jurusan1=$this->db->query("SELECT * FROM web_siswa WHERE absen='".$kodeabsen."'");
								foreach ($jurusan1->result() as $row1) {
								$nama1=$row1->NM_PEGAWAI;
								}
							?>

							<option><?php echo $nama1;?></option>
						<?php }
						$jurusan=$this->db->query("SELECT * FROM web_siswa");
										foreach ($jurusan->result() as $row) {
										$kode=$row->absen;
										$nama=$row->NM_PEGAWAI;
										echo "<option value='?yy=$yy&mm=$mm&absen=$kode'>$nama</option>";
						?>
						<?php } ?>

						</select>
						</td></tr>
					</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 Detail
					  </div>

					</div>
					<div class="portlet-body">
						<div class="row">
							<div class="col-md-12 ">
									<table class="table table-bordered table-striped">
									<tr>
									 <th width=4%>TGL</th>
									 <th width=18%>HARI</th>
									 <th width=11%>STATUS</th>
									 <th width=11%>DATANG</th>
									 <th width=11%>PULANG</th>
									 <th width=35%>KETERANGAN</th>
									</tr>
									<?php
									$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 "$aa-$mm-$yy";?></a></td>
									<td><a href="../index.php?<?php echo "dd=$aa&mm=$mm&yy=$yy";?>"><?php echo hari($i,$mm,$yy);?></a></td>
									<?php
									$skrg="$yy-$mm-$aa";
                  $cek1=$this->db->query("SELECT status,jam,ket FROM web_absen WHERE tgl='$skrg' AND nip='$kodeabsen' AND status=1");
    							$hasilcek1=$cek1->num_rows();
    							$jamcek1='';
    							$jamcek2='';
    							$ketcek1='';
    							$harike3=substr(hari($aa,$mm,$yy),0,3);
    							$siswa = $this->db->query("SELECT * FROM web_siswa WHERE absen='$kodeabsen' ORDER BY NM_PEGAWAI asc");
    							foreach ($siswa->result() as $rssis) {
    								$cekhari=$rssis->$harike3;
    							}
    							//cekliburan
    							$cekijin=$this->db->query("SELECT * FROM web_ijin WHERE tgl='$skrg' AND absen='$kodeabsen'");
    							$hasilijin=$cekijin->num_rows();
    							$ceklibur=$this->db->query("SELECT * FROM web_libur WHERE tgl='$skrg'");
    							$hasillibur=$ceklibur->num_rows();
    							if ($hasillibur ==0) {
    								if ($cekhari==6){
    									$kehadiran='LIBUR SEKOLAH';
    								} elseif ($hasilijin != 0){
    									foreach ($cekijin->result() as $rsijin) {
    										$hijin=$rsijin->status;
    										$ketcek1=$rsijin->ket;
    										$cekst=$this->db->query("SELECT * FROM web_status WHERE kd_jenis='".$hijin."'");
    										foreach ($cekst->result() as $rsst) {
    											$kehadiran=$rsst->status;
    										}
    									}
    								} else {
    									if ($hasilcek1 !=0) {

    										$kehadiran='<b>HADIR</b>';
    										$cek2=$this->db->query("SELECT status,jam,ket FROM web_absen WHERE tgl='$skrg' AND nip='$kodeabsen' AND status=2");
    										foreach ($cek2->result() as $rscek2) {
    											$jamcek2=$rscek2->jam;
    										}
    										foreach ($cek1->result() as $rscek1) {
    											$jamcek1=$rscek1->jam;
    											$ketcek1=$rscek1->ket;
    										}
    									} else {
    										$cek3=$this->db->query("SELECT status,jam,ket FROM web_absen WHERE tgl='$skrg' AND nip='$kodeabsen' AND status>=3");
    										$hasilcek3=$cek3->num_rows();
    										//echo "SELECT status,jam,ket FROM web_absen WHERE tgl='$skrg' AND nip='$kodeabsen' AND status>=3"."<br>";
    										if ($hasilcek3 !=0) {
    											foreach ($cek3->result() as $rscek3) {
    											$status3=$rscek3->status;
    											$ketcek1=$rscek3->ket;
    											}
    											$cekst=$this->db->query("SELECT * FROM web_status WHERE kd_jenis='".$status3."'");
    											foreach ($cekst->result() as $rsst) {
    												$statusku=$rsst->status;
    											}
    											$kehadiran='<b>'.strtoupper($statusku).'</b>';
    										} else {
    											$kehadiran='TIDAK HADIR';
    										}
    									}
    								}
    							} else {
    								$kehadiran='LIBUR NASIONAL';
    								foreach ($ceklibur->result() as $rslibur) {
    									$ketcek1=$rslibur->ket;
    								}
    							}
									?>
									<td><?php echo strtoupper($kehadiran);?></td>
									<td><?php echo $jamcek1;?></td>
									<td><?php echo $jamcek2;?></td>
									<td><?php echo $ketcek1;?></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="<?php echo base_url('assets/global/plugins/respond.min.js'); ?>"></script>
    <![endif]-->
    <script src="<?php echo base_url('assets/global/plugins/jquery.min.js'); ?>" type="text/javascript"></script>
    <script src="<?php echo base_url('assets/global/plugins/jquery-migrate.min.js'); ?>" type="text/javascript"></script>
    <script src="<?php echo base_url('assets/global/plugins/bootstrap/js/bootstrap.min.js'); ?>" type="text/javascript"></script>
    <script src="<?php echo base_url('assets/frontend/layout/scripts/back-to-top.js'); ?>" type="text/javascript"></script>
	<script src="<?php echo base_url('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="<?php echo base_url('assets/global/plugins/fancybox/source/jquery.fancybox.pack.js'); ?>" type="text/javascript"></script><!-- pop up -->
    <script src="<?php echo base_url('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>
