<?php 
$where 	= " WHERE 1=1 ";
$query_string = "";

$next_page_condition 	= "";

if($_REQUEST['hide_top']){
	$next_page_condition.="&hide_top=1";
}
if($_REQUEST['hide_left']){
	$next_page_condition.="&hide_left=1";
}

		

?>
<style>
body{
	font-size:12px;
}
.equip_table {
    width: 100%;
    border-collapse: collapse;
}

.equip_table th, 
.equip_table td {
    border-top: 1px solid black;
    border-bottom: 1px solid black;
    padding: 8px;
    text-align: center;
}

.equip_table th {
    background-color: #f2f2f2;
    font-weight: bold;
}


.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
	float: left;
}
.col-sm-12 {
	width: 100%;
}
.col-sm-11 {
	width: 91.66666667%;
}
.col-sm-10 {
	width: 83.33333333%;
}
.col-sm-9 {
	width: 75%;
}
.col-sm-8 {
	width: 66.66666667%;
}
.col-sm-7 {
	width: 58.33333333%;
}
.col-sm-6 {
	width: 50%;
}
.col-sm-5 {
	width: 41.66666667%;
}
.col-sm-4 {
	width: 33.33333333%;
}
.col-sm-3 {
	width: 25%;
}
.col-sm-2 {
	width: 16.66666667%;
}
.col-sm-1 {
	width: 8.33333333%;
}

@page {
	size: A4;
   margin: 0;
   /* size: portrait; */
}

@media print{

   .equip_table {
    width: 100%;
    border-collapse: collapse;
}

.equip_table th, 
.equip_table td {
    border: 1px solid black;
    padding: 8px;
    text-align: center;
}

.equip_table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

   .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
        float: left;
   }
   .col-sm-12 {
        width: 100%;
   }
   .col-sm-11 {
        width: 91.66666667%;
   }
   .col-sm-10 {
        width: 83.33333333%;
   }
   .col-sm-9 {
        width: 75%;
   }
   .col-sm-8 {
        width: 66.66666667%;
   }
   .col-sm-7 {
        width: 58.33333333%;
   }
   .col-sm-6 {
        width: 50%;
   }
   .col-sm-5 {
        width: 41.66666667%;
   }
   .col-sm-4 {
        width: 33.33333333%;
   }
   .col-sm-3 {
        width: 25%;
   }
   .col-sm-2 {
        width: 16.66666667%;
   }
   .col-sm-1 {
        width: 8.33333333%;
   }
}
</style>
<section class="content" id="print_section">
	<div class="row">
		<div class="col-lg-12">
              <div class="card box-primary" style="box-shadow: none;">
                <form class="form-horizontal" method="post" name="form1" id="form1" action="#" onsubmit="return validateForm(this)" enctype="multipart/form-data">
                  <div class="card-body" style="padding:0;">
					<div class="form-group">
					    <div class="row mt-5">
							<div class="col-sm-5">
								<h3>Who's In / Out Report</h3>
							</div>
							<div class="col-sm-5">
								<h6>Printed: <?echo (date('d-m-Y H:i:s'));?><h6>
						    </div>
							<div class="col-sm-2">
								Page 1
						   </div>
						</div>
						<div class="col-sm-12 no-padding">

							<?	 
                                

								$sql = mysqli_query($conn, $query);
								$result = mysqli_num_rows($sql);

							?>
							
							<div class="row mb-4">
								<div class="col-sm-12 col-12">
									<table class="equip_table table  ">
										<thead>
										  <tr>
											<th style="text-align:center;">Name</th>
											<th style="text-align:center;">Department</th>
											<th style="width:30%;">Last Time </th>
											<th style="">Status</th>
											<th style="">Punch Type</th>
											<th style="text-align:center;">Checked</th>
										  </tr>
										</thead>
										<tbody>
										<? 
										
										
										if($result>0){
										while($row = mysqli_fetch_array($sql)){
								
										
										?>
										  <tr>
										    <td><?php echo $row['uname'],'.'; ?></td>
											<td style="text-align:center;"><?php echo Admin::getGroupById($row['group_id']);?></td>
										
											<td><?php if ($row['status'] == 'OUT') {
														echo stripslashes($row['end_time']);
													} else{echo stripslashes($row['last_time']);} ?></td>
											<td><?php echo $row['status'];?></td>
											<td style="">
												<?php 
													if ($row['status'] == 'IN') {
														echo 'SWIPE IN';
													} elseif ($row['status'] == 'OUT') {
														echo 'SWIPE OUT';
													} else {
														echo 'NONE';
													}
												?>
											</td>
											<td style="border:1px solid black;">
											</td>
										  </tr>
										  <?
										 
										
										
										}
										}?> 
										</tbody>
									</table>
								</div>
							</div>
							 </div>
                </form>
              </div>
		</div>
	</div>
</section>
