<?php
//ini_set('session.bug_compat_warn', 0);
//ini_set('session.bug_compat_42', 0);
session_name('CAKEPHP'); session_start();
ob_start();
$PageSecurity = 1;
include('config.php');
include('includes/ConnectDB.inc');
include('includes/function_lib.php');
include('includes/LanguageSetup.php');
include('includes/DateFunctions.inc');
include('./includes/fun-php.php');
include('./includes/fun-HRClass.php');
$Compamies=DB_query("select * from companies",$db);
$CompamiesRow=DB_fetch_array($Compamies);
//global $s;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
  <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<title>Forgot/Late Coming Report</title>

<style type="text/css"> 
@print {size:A4; margin:20px 20px;}

@media print{
body{ margin:0px; padding:0px;  font-size:12px; line-height: 18px; font-family: Arial, Helvetica, sans-serif; color:#000; font-weight:normal;}

h1,h2,h3,h4,h5,p{ margin:0px; padding:0px;}
p{ text-align:left;}

h1{
  font-size: 20px; line-height: 24px;
  font-weight:normal;
  font-family:Arial, Helvetica, sans-serif !important;
  color:#006699;  
}
h2{
  font-size: 18px; line-height: 22px;
  font-weight:normal;
  font-family:Arial, Helvetica, sans-serif !important;
}
thead{display: table-header-group;}
.wrapper{width:99%; height: auto; float:left; border:#000000 1px solid; border-bottom:#000000 1px solid;}
.div_first, .div_first .full{
  width: 100%; height: auto;
  /*border-bottom: #000000 1px solid;
  border-top: #000000 1px solid;*/
  /*border-left: #000000 1px solid;
  border-right: #000000 1px solid;*/
  float: left; position: relative;
}
 .div_first .left
        {
          width:10%; text-align:left; height:auto; vertical-align:middle; height:auto; padding: 10px; position: absolute; left: 0; top: 0;
        }
        .div_first .middle
        {
          width:60%; text-align:center; padding: 10px; margin:0 auto; position: relative;
        }
        .div_first .right
        {
          width:20%;text-align:right; padding: 10px; position: absolute; right: 0; top: 0;
        }

.div_first .full{text-align: center; border: 0;}
.div_second, .div_third{
  width: 100%;
  height:auto;
  /*border-top: #000000 1px solid;*/
  /*border-bottom: #000000 1px solid;*/
  /*border-left: #000000 1px solid;
  border-right: #000000 1px solid;*/
  float: left;
}
.div_second table tr th, .div_second table tr td{border-right:#000000 1px solid; border-bottom:#000000 1px solid;}
.div_second table tr th{text-align: left; border-top:#000000 1px solid;}
.div_second table tr th:last-child, .div_second table tr td:last-child{border-right:0;}
.div_second table tr:last-child td{border-bottom:0;}
.div_second table tr td > table tr td{border-right:#000000 1px solid; border-bottom:#000000 1px solid;}
.div_second table tr td > table tr td:last-child{border-right:0;}
.div_second table tr td > table tr:last-child td{border-bottom:0;}

.div_third table tr th, .div_third table tr td{ border-bottom:#000 1px solid; border-right:#000 1px solid;}
.div_third table tr th{background-color:transparent; text-align: left;}
.div_third table tr th:last-child, .div_third table tr td:last-child{border-right:none;}
.div_third table tr:last-child td{border-bottom:none;}

.f12{ font-weight: bold; color:#000; font-size:12px;}
.f11{color:#000; font-size:12px; line-height:18px;}
.f14{color:#000; font-size:18px;}
.mt26{margin-top:4px; width:90%;}
.mt27{margin-top:0px; width:90%;}
.mt28{margin-top:0px; width:100%;}
.border_top{border-top:#000 1px solid;}
.border_bottom{border-bottom:#000 1px solid;}
.wdt1{width:8%;}
.wdt2{width:100px;}
.wdt3{width: 66px;}
.wdt4{width: 80px;}
.wdt5{width: 52px;}
.wdt6{width: 60px;}
}

@media screen{
/* CSS Document */
body{ margin:0px; padding:0px; background-color:#fff; font-size:12px; font-family: Arial, Helvetica, sans-serif; color:#000; font-weight:normal;}
h1,h2,h3,h4,h5,p{ margin:0px; padding:0px;}

#foo{width:1070px; height: auto; margin:0px auto;}
.wrapper{width:1070px; height: auto; margin:10px auto; border-top:#000000 1px solid;}

h1{
  font-size: 24px; line-height: 28px;
  font-weight:bold;
  font-family:Arial, Helvetica, sans-serif !important;
  color:#006699;  
}
h2{
  font-size: 18px; line-height: 22px;
  font-weight:normal;
  font-family:Arial, Helvetica, sans-serif !important;  
}
.div_first, .div_first .full{
  width: 100%; height: auto;
  /*border-bottom: #000000 1px solid;
  border-top: #000000 1px solid;*/
  border-left: #000000 1px solid;
  border-right: #000000 1px solid;
  float: left; position: relative; display: table;
}
.div_first .full{text-align: center; border: 0; margin:10px 0 0;}
.div_first .left, .div_first .middle, .div_first .right{float: left; display: table-cell; vertical-align: middle;}
.div_first .left
        {
          width:8%; text-align:center; height:auto; vertical-align:middle; padding: 1%; 
        }
        .div_first .middle
        {
          width:78%; text-align:center; padding: 1%; position: relative; margin:0 auto;
        }
        .div_first .right
        {
          width:8%; text-align:center; padding:1%; 
        }
.div_second, .div_third, .div_forth{
  width: 100%; height: auto;
  /*border-bottom: #000000 1px solid;*/
  border-top: #000000 1px solid;
  border-left: #000000 1px solid;
  border-right: #000000 1px solid;
  float: left;
}
.div_second table tr th, .div_second table tr td{border-right:#000000 1px solid; border-bottom:#000000 1px solid;}
.div_second table tr th{background-color: #ccc; text-align: left;}
.div_second table tr th:last-child, .div_second table tr td:last-child{border-right:0;}
/*.div_second table tr:last-child td{border-bottom:0;}*/
.div_second table tr td > table tr td{border-right:#000000 1px solid; border-bottom:#000000 1px solid;}
.div_second table tr td > table tr td:last-child{border-right:0;}
.div_second table tr td > table tr:last-child td{border-bottom:0;}

.div_third table tr th, .div_third table tr td{ border-bottom:#000 1px solid; border-right:#000 1px solid;}
.div_third table tr th{background-color: #ccc; text-align: left;}
.div_third table tr th:last-child, .div_third table tr td:last-child{border-right:none;}
/*.div_third table tr:last-child td{border-bottom:none;}*/

.f12{font-weight: bold; color:#000; font-size:12px;}
.f11{ color:#000; font-size:12px; line-height:18px;}
.f14{ color:#000; font-size:18px;}
.mt26{margin-top:4px; width:90%;}
.mt27{margin-top:0px; width:100%;}
.mt28{margin-top:0px; width:90%;}
.border_top{border-top:#000 1px solid;}
.border_bottom{border-bottom:#000 1px solid;}
.wdt1{width:10%;}
.wdt2{width:180px;}
.wdt3{width: 66px;}
.wdt4{width: 120px;}
.wdt5{width: 52px;}
.wdt6{width: 70px;}
}
</style>
</head>
<body>
 
<div id="foo"><p align="right">
  <a href="#" onclick="javascript:toggle_visibility('foo');"><input type="button" value="Print" class="search" /></a></p>
</div>
<div class="wrapper">
<div class="div_first">
<?php 
    $sql1 = "SELECT * FROM companies where CompanyId='".$_SESSION['ACGCompanyId']."'";
	$sqlres = DB_query($sql1,$db);
	$companyRow = DB_fetch_array($sqlres);
  $companylogo=$companyRow['CompanyLogo'];
    $path="Setup/CompanyLogo/".$companylogo;
	
  ?>
  
    <div class="left"><img src="<?php echo $path;  ?>" class="mt26" /></div>
      <div class="middle"><h1>Ayodhya Eye Hospital</h1>
      <span class="f12">A Unit of Mani Mandir Sewa Nyas Samiti</span> <br>
       <span class="f12">Tulsibari, Praikrma Marg, Ayodhya - 224123, Dist. - Faizabad</span>
       <div class="full"><h2>Forgot/Late Coming Report</h2>
       <span class="f11"><?php echo "<span class='f12'>Phone No.:</span> ".$CompamiesRow['Phone'].", <span class='f12'>Fax No.:</span> ".$CompamiesRow['fax'].", <span class='f12'>Email ID.:</span> ".$CompamiesRow['email'].", <span class='f12'>Website:</span> ".$CompamiesRow['website']; ?><br>
        <?php 
		$site = $_REQUEST['site'];
		if(isset($site))
		{
			$branch = $s->getField('locations','loccode',$_REQUEST['site'],'locationname');
			if(isset($branch)){
				echo "<span class='f12'>Branch:</span> "." ".$branch.", ";
			}
		}
		$type = $_REQUEST['type'];
		
		if(isset($type))
		{
			
			if($type == 'fp'){
			
				echo "<span class='f12'>Type:</span> "." Forgot Punch, ";
			} else if($type == 'lc'){
			
				echo "<span class='f12'>Type:</span> "." Late Coming, ";
			} else 	if($type == 'ed'){
			
				echo "<span class='f12'>Type:</span> "." Early departure, ";
			} else {
				echo '';
			}
		}
		
		$from_date = $_REQUEST['from_date'];
		if(isset($from_date) && $from_date != '')
		{
			echo "<span class='f12'>From Date:</span> "." ".$from_date.", ";
		}
		
		$to_date = $_REQUEST['to_date'];
		if(isset($to_date) && $to_date != '')
		{
			echo "<span class='f12'>To Date:</span> "." ".$to_date.", ";
		}
		
		
		?>
        </span></div>
      </div>
      <div class="right"><img src="images/eye-logo-blue.png" vspace="10" class="mt27" /></div>
</div>
 <div class="div_second">
	<table width="100%" cellpadding="3" cellspacing="0" border="1" style="border:#808080 1px solid: border-collapse:collapse;">
	<tr>
    	 <th><strong>Sr No.</strong></th>
		 <th><strong>Emp. Code</strong></th>
		<th><strong>Emp. Name</strong></th>
		<th><strong>Department</strong></th>
		<th ><strong>Request Date</strong></th>
		<th ><strong>Approve Date</strong></th>
		<th ><strong>Type</strong></th>
        <th ><strong>Date</strong></th>
		<th ><strong>Punch(IN/OUT)</strong></th>
		<th ><strong>Time</strong></th>
		<th ><strong>Reason</strong></th>
		<th ><strong>Remarks</strong></th>
		<th>Status</th>
		
    </tr>
    <?php 
	
	$whr = 1;
	 //if(isset($_POST['Search'])){
		$site		= $_REQUEST['site'];
		$from_date	= $_REQUEST['from_date'];
		$to_date	= $_REQUEST['to_date'];
		$type		= $_REQUEST['type'];
		$status		= $_REQUEST['status'];
		
	
		 if($site != ''){
			 $whr .= " AND site = '".$site."' "; 
		 }
		 
		 if($status != ''){
			 $whr .= " AND approve_status = '".$status."' "; 
		 }
		 
		 if($from_date != '' && $to_date != ''){
			 $whr .= " AND DATE(punch_date) BETWEEN '".date('Y-m-d', strtotime(strtr($_REQUEST['from_date'],'/','-')))."' AND '".date('Y-m-d', strtotime(strtr($_REQUEST['to_date'],'/','-')))."' "; 
		 } else if($to_date != ''){
			 $whr .= " AND DATE(punch_date) = '".date('Y-m-d', strtotime(strtr($_REQUEST['to_date'],'/','-')))."' "; 
		 } else if($from_date) {
			 $whr .= " AND DATE(punch_date) = '".date('Y-m-d', strtotime(strtr($_REQUEST['from_date'],'/','-')))."' "; 
		 } else {
			 
		 }
		 
		 if($type != ''){
			 $whr .= " AND punchtype = '".$type."' "; 
		 }
		 
	 //}
		$GetProcess = "Select * from hr_forgot_punch WHERE $whr";
		
		$ResultProcess_SalData = DB_query($GetProcess,$db);
	   if(DB_num_rows($ResultProcess_SalData)){
	
   	   while($RowData = DB_fetch_array($ResultProcess_SalData))
	   {
  ?>
				 <tr bgcolor="#fff">
				 <td><?php echo $i+1; ?></td>
		<td>
			<?php  
				$empCode = "Select emp_code from empmaster WHERE id='".$RowData['emp_id']."'";
				$empCodeData = DB_query($empCode,$db);
				$code = DB_fetch_array($empCodeData);
				echo $code['emp_code'];
				
			?>
		</td>
		<td>
			<?php  
				$empName = "Select emp_name from empmaster WHERE id='".$RowData['emp_id']."'";
				$empNameData = DB_query($empName,$db);
				$name = DB_fetch_array($empNameData);
				echo $name['emp_name'];
			
			?>
		</td>
		<td>
			<?php  
				$depName = "Select deptname from deptmaster WHERE id='".$RowData['department']."'";
				$depNameData = DB_query($depName,$db);
				$dep = DB_fetch_array($depNameData);
				echo $dep['deptname'];
			
			?>
		</td>
		<td><?php  echo ConvertSQLDate($RowData['punch_request_date']); ?></td>
		<td><?php  if($RowData['approve_date']!='') { echo ConvertSQLDate($RowData['approve_date']); }  ?></td>
		<td>
			<?php  
				if($RowData['punchtype'] == 'fp'){
					echo 'Forgot Punch';
				} else if($RowData['punchtype'] == 'lc'){
					echo 'Late Coming';
				} else 	if($RowData['punchtype'] == 'ed'){
					echo 'Early departure';
				} else {
					echo '';
				}
			?>
		</td>
        <td><?php  echo $RowData['punch_date']?></td>
        <td>
		
			<?php  
				if($RowData['punch_time'] == 'in'){
					echo 'IN';
				} else if($RowData['punch_time'] == 'out'){
					echo 'OUT';
				} else {
					echo '';
				}
			?>
		</td>
		
		<td><?php  echo $RowData['time']  ?></td>	
		<td>
			
			<?php  
				if($RowData['reason'] == 'md'){
					echo 'Machine Down';
				} else if($RowData['reason'] == 'fp'){
					echo 'Forgot Punch';
				} else 	if($RowData['reason'] == 'lc'){
					echo 'Late Coming';
				} else 	if($RowData['reason'] == 'ed'){
					echo 'Early Dep.';
				} else 	if($RowData['reason'] == 'o'){
					echo 'Other';
				} else {
					echo '';
				}
			?>
		</td>	
		<td><?php  echo $RowData['remarks'];  ?></td>	
		<td>
				
				<?php 
					if($RowData['approve_status'] == 1){ 
						echo 'Approved';
					
					} else if($RowData['approve_status'] == 2) { 
						echo 'Declined';
					
					} else if($RowData['approve_status'] == 0){ 
						echo 'Requested';
					
					} else { 
					
					} 
				?>
		</td>
		<!--td style="text-align:center;">
			<a href="<?php //echo $target.'&id='.$RowData['id'].'&emp_id='.$RowData['emp_id'].'&action=Edit' ; ?>">
				<img src="images/icon-edit.png" height="13" width="13" title="Edit Document" />
			</a>
		</td-->	
		<!--td style="text-align:center;"><a href="#" onclick='popup("LoanPaymentDetails.php?id=<?php  //echo $RowData['id'].$rurl?>",600,400)' class="search">Details</a></td-->		
	 </tr>
	<?php $i++;}?>
	
   <?php } else{
		echo "<tr bgcolor='#fff'><td colspan='11' align='center'>No Record Found</td></tr>";
	}   
?>
    </table>	
</div>
</div>       


<script type="text/javascript" language="javascript">
  function toggle_visibility(id) 
  {
    var e = document.getElementById(id);
	e.style.display = 'none';
	window.print();
  }
</script>

</body>
</html>	