<?php
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');
setlocale(LC_MONETARY, 'en_IN');

?>

<!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>ESIC Report</title>
<style> 
/* ----------------- Print -------------------- */
@page {
    size: A4;
    margin:30px 20px 30px;
}
@media print{
    * { margin: 0; padding-top: 0; padding-bottom: 0; }
body{ margin:0px; padding:0px; font-size:12px; font-family: Arial, Helvetica, sans-serif; color:#000; font-weight:normal;}
h1,h2,h3,h4,h5,p{ margin:0px; padding:0px;}
.wrapper{ width:800px; border:1px solid #000; margin:0 auto; float: left; }

thead{display: table-header-group; border-top:#000000 1px solid !important;}

.div_first{
  width:800px; height: auto; float: left;
  border-top: #000000 1px solid !important;
  /*border-bottom: #000000 1px solid;*/
}
.div_first .left
{
  width:96px; float:left; text-align:center; height:auto; vertical-align:middle; padding: 10px;
}
.div_first .right
{
  width:681px; height: auto; float:left; text-align:center; border-left:#000000 1px solid !important; padding: 5px 0;
}
.div_second{
  width: 800px;
  height:100%; 
  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, td{border-right:#000000 1px solid; border-bottom:#000000 1px solid;}
.div_second table tr th{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;}

h2{
  font-size: 18px;
  font-weight:normal;
  margin:0px;
  padding:0px;
  color:#000;  
}
h3{
    font-size: 17px;
    text-align: center;
    text-decoration: none;
  }
.f10{color:#000; font-size:12px; line-height: 18px;}
.f11{ color:#000; font-size:12px; line-height:18px;}
.f12{ font-weight: bold; color:#000; font-size:12px; line-height: 18px;}
.mt26{margin-top:10%; width: 90%;}
.clr{clear:both;}
.ht{height:36px;}
.h60{height: 40px;}
.pagebreak { page-break-before: always; }
}
@media screen{
/* CSS Document */
body{ margin:0px; padding:0px; font-size:12px; font-family: Arial, Helvetica, sans-serif;  font-weight:normal;}
h1,h2,h3,h4,h5{ margin:0px; padding:0px;}
#foo{width:1200px; height: auto; margin:0px auto;}
.wrapper{
  width: 1200px;
  /* [disabled]height:1220px; */
  background-color: #FFF;
  /*border: 1px solid #000;*/
  margin:0 auto;
}
.clr{clear:both;}
.div_first{
  width: 1198px; height: auto; float: left;
  border-left: #000000 1px solid; border-right: #000000 1px solid;
  border-top: #000000 1px solid;
}
.div_first .left{
  width: 165px;
  float:left;
  text-align:center;
  padding-top:10px;
  padding-bottom:10px;
}
.div_first .right{
  width:1032px;
  float:left;
  padding-top:10px;
  padding-bottom:10px;
  text-align:center;
    border-left:#000 1px solid;
}
h2{
  font-size: 20px;
  font-weight:normal;
  margin:0px;
  padding:0px;
  color:#000;
  
}
h3{color: #003399;
    font-size: 18px;
    text-align: center;
    text-decoration: none;
  }
.div_second{
  width:1198px; height: auto; float: left;
  border-bottom: #000000 1px solid; border-left: #000000 1px solid; border-right: #000000 1px solid;
}
.div_second table tr th, td{border-right:#000000 1px solid; border-bottom:#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 th{background-color:#b7b7b7; border-top:#000000 1px solid; text-align: left;}
.f12{ font-family:Arial, Helvetica, sans-serif; font-weight: bold; color:#000; font-size:12px; line-height:16px;}
.f11{ font-family:Arial, Helvetica, sans-serif; color:#000; font-size:12px; line-height:16px;}
.f14{ font-family:Arial, Helvetica, sans-serif; color:#000; font-size:13px; line-height:24px;}
.mt26{margin-top:8px; width:90%;}
.border_top{border-top:#000 1px solid;}
.border_bottom{border-bottom:#000 1px solid;}
}
</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">
<?php 
   $sql1 = "SELECT * FROM companies where CompanyId='".$_SESSION['ACGCompanyId']."'";
  $sqlres = DB_query($sql1,$db);
  $companyRow = DB_fetch_array($sqlres);
  
// order Details
 $arr=array(1=>"Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec");
  
?>  
  <div class="div_first">
  <?php
   $logoImage=($companyRow['CompanyLogo']=='')?'index11.jpeg':$companyRow['CompanyLogo'];

   ?>
      <div class="left"><img src="Setup/CompanyLogo/<?php echo $logoImage;  ?>" class="mt26" /></div>
        <div class="right">     
        <?php     
    if($companyRow['CompanyName']!="") {echo "<h2>".$companyRow['CompanyName']."</h2>"; } else { echo "";}
    if($companyRow['Address1']!="") {echo "<span class='f11'>".$companyRow['Address1']."</span> "; } else { echo "";}
    if($companyRow['Address2']!="") {echo "<span class='f11'>". $companyRow['Address2']."</span> "; } else { echo "";}
    if($companyRow['Address3']!="") {echo ",<span class='f11'>". $companyRow['Address3']."</span> "; } else { echo "";}
    if($companyRow['City']!="") {echo ",<span class='f11'>". $companyRow['City']."</span> "; } else { echo "";}
    if($companyRow['State']!="") {echo ",<span class='f11'>". $companyRow['State']."</span> "; } else { echo "";}
    if($companyRow['Country']!="") {echo ",<span class='f11'>".  $companyRow['Country']."</span> ";
    if($companyRow['Zipcode']!="") {echo " - <span class='f11'>".$companyRow['Zipcode']."</span>"; } else { echo "";}

     } else { echo "";}
    echo "<br><span class='f11'>"."<strong>Phone No.:</strong> ".$companyRow['Phone'].", <strong>Fax No.:</strong> ".$companyRow['fax'].", <strong>Email ID.:</strong> ".$companyRow['email'].", <strong>Website:</strong> ".$companyRow['website']."</span>"; 
  ?>
  <br/><span class='f11'><strong>Branch:</strong> <?php if($_SESSION['site']!='All') { echo $s->getField('locations','loccode',$_SESSION['site'],'locationname'); } else { echo "All"; } ?>, <strong>Month:</strong> <?php echo $arr[$_SESSION['month']]; ?>, <strong>Year:</strong> <?php echo $_SESSION['payyear'];?></span>
  <h3>ESIC Report</h3>
        </div>
    </div>

<?php 
 $employer_esi=DB_fetch_array(DB_query("select * from esi_master where site='".$_REQUEST['site']."' and salto<='15000'",$db));
	  $Employee_per=$employer_esi['esiper']; 
	  $Employer_per=$employer_esi['employerper'];
?>
	<div class="div_second">
	<table width="100%" cellpadding="3" align="center" cellspacing="0" border="0" >	
  <thead>
	  <tr>
    <th width="4%" align="left" class="f12">S.No.</th>
		<th width="10%" align="left" class="f12">E.S.I.C. No.</th>
		<th width="12%" align="left" class="f12">Emp. Code</th>
		<th class="f12" align="left">Employee Name</th>
		<th width="7%" align="left" class="f12">Wages</th>	
		<th width="10%" align="left" class="f12">Employee's ESIC(<?php echo $Employee_per; ?>%)</th>	
		<th width="10%" align="left" class="f12">Employer's ESIC(<?php echo $Employer_per; ?>%)</th>		
		<th width="10%" align="left" class="f12">Total ESIC</th>			
		<th width="10%" align="left" class="f12">Work Days</th>
	</tr>
  </thead>
	<?php
	if(!empty($_SESSION['Esi_Emp_details']))
	{
      $i=1;
	    $GetProcess = $_SESSION['Esi_Emp_details'];	 	   
       foreach($GetProcess as $key=>$value)
       {

	  ?> 
		<tr>
    <td class="f11"><?php  echo $i; ?></td>
		<td class="f11"><?php  echo $value[Esi_no] ?></td>
		<td class="f11"><?php  echo $value[Emp_code] ?></td>
		<td class="f11"><?php  echo $value[Emp_name] ?></td>
		<td class="f11" style="text-align:right"><?php  echo money_format('%!i',$value[gross]); ?></td>
		<td class="f11" style="text-align:right"><?php  echo money_format('%!i',$value[esi_amt1]); ?></td>
		<td class="f11" style="text-align:right"><?php  echo money_format('%!i',$value[esi_amt2]); ?></td>
		<td class="f11" style="text-align:right"><?php  echo money_format('%!i',$value[TotalEsi]); ?></td>
		<td class="f11" style="text-align:right"><?php  echo $value[working_days] ?></td>	
		</tr>
		
		
	<?php  $grand_esi=$grand_esi+$value[TotalEsi]; $i++; }?>
   <tr>
     <td colspan="7" style="text-align:right" class="f12"><strong>Grand Total</strong></td>
    <td style="text-align:right" class="f12"><strong><?php echo money_format('%!i',$grand_esi);?></strong></td>
    <td>&nbsp;</td> 
    </tr>

   <?php } else { ?>
<tr><td colspan="9" align="center" class="f11">No Records Found</td></tr>
	<?php } ?>		
		
    </table>
    </div>
	</div>
       

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

</body>
</html>
	