<?php
ob_start();
session_name('CAKEPHP'); session_start();
error_reporting(FALSE);
$PageSecurity = 3;
include('config.php');
include('includes/ConnectDB.inc');
include ('includes/session.inc');
include ('includes/function_lib.php');
include('includes/fun-php.php');
include('includes/fun-HRClass.php');
global $db;


?>

<!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' />

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

@media print{
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;}
p{ text-align:left;}

h1{
  font-size: 20px;
  font-weight:normal;
  font-family:Arial, Helvetica, sans-serif !important;
  color:#006699;  
}
h2{
  font-size: 18px;
  font-weight:normal;
  font-family:Arial, Helvetica, sans-serif !important;
}
.wrapper{width:800px; height: auto; float:left; border:#000000 1px solid; border-bottom:#000000 1px solid;}
.div_first{
  width: 798px; 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_first .left{
  width: 120px;
  float:left;
  text-align:center;
  padding-top:10px;
  padding-bottom:10px;
}
.div_first .right{
  width:677px;
  float:left; 
  padding-top:10px;
  padding-bottom:10px;
  text-align:center;
  border-left:#000 1px solid;
}
.div_second, .div_third, .div_forth{
  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, .div_second table tr 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;}
.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:14px; width:86%;}
.border_top{border-top:#000 1px solid;}
.border_bottom{border-bottom:#000 1px solid;}
}

@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;}
p{ text-align:left;}

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

h1{
  font-size: 20px; line-height: 30px;
  font-weight:normal;
  font-family:Arial, Helvetica, sans-serif !important;
  color:#006699;  
}
h2{
  font-size: 18px; line-height: 24px;
  font-weight:normal;
  font-family:Arial, Helvetica, sans-serif !important;  
}
.div_first{
  width: 1200px; 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_first .left{
  width: 179px;
  float:left;
  text-align:center;
  padding-top:10px;
  padding-bottom:10px;
}
.div_first .right{
  width:1018px;
  float:left; 
  padding-top:10px;
  padding-bottom:10px;
  text-align:center;
  border-left:#000 1px solid;
}
.div_second, .div_third, .div_forth{
  width: 1200px; 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_forth{border-bottom:#000 1px solid;}

.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:86%;}
.border_top{border-top:#000 1px solid;}
.border_bottom{border-bottom:#000 1px solid;}
}
</style>

<title>Issue Slip</title>

 </head>
 <body>
<div id="foo">
  <p style="text-align:right;"><input type="button" onclick="javascript:toggle_visibility('foo');" value="Print" /></p>
</div>

<div class="wrapper">

<div class="div_first">
  <?php
      $set = DB_fetch_array(DB_query("SELECT * FROM companies where  CompanyId='".$_SESSION['ACGCompanyId']."'",$db));
      $logoImage=($set['CompanyLogo']=='')?'cocoon_logo.png':$set['CompanyLogo'];
   ?>
<div class="left"><img src="Setup/CompanyLogo/<?php echo $logoImage;  ?>" class="mt26" /></div>
<div class="right">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
  <tr>
    <td align="center">
      <?php echo "<h1>".$set['CompanyName']."</h1>".$set['Address1'].$set['Address2'].$set['Address3']."<br>".$set['City'].",".$set['State'].",".$set['Country'].",".$set['Zipcode']; ?>
      <h2>Issue Slip</h2></td>
    </tr>
</table>
</div>
</div>
<div class="div_second">
<?php 
$req_sql=DB_query("Select * from asset_issue where id='".$_REQUEST['rid']."'",$db);
$req_row=DB_fetch_array($req_sql);
?>

<table width="100%" border="0" cellspacing="0" cellpadding="3">
  <tr>
    <td class="f12" width="10%">Branch </td>
    <td class="f11" width="24%"><?php echo $s->GetFieldValue('locations',"loccode='".$req_row['site']."'",'locationname'); ?></td>
    <td class="f12" width="17%">Issue Slipno No.</td>
    <td class="f11" width="14%"><?php echo $req_row['issue_slipno']?></td>
    <td class="f12" width="18%"> Issue Date</td>
    <td class="f11"><?php echo ConvertSQLDate($req_row['issuedate'])?></td>
  </tr>
  <tr>
    <?php 
      if($req_row['issueto'] !="" && $req_row['issueto'] !=0){ ?>
    <td class="f12">Contractor Name</td>
    <td class="f11"><?php  echo $s->GetFieldValue('suppliers',"id='".$req_row['issueto']."'",'vendor_name'); ?></td>
    <?php } 

      if($req_row['received_by'] !="" && $req_row['received_by'] !=0 ) { ?>
    
    <td class="f12">Employee Name</td>
    <td class="f11"><?php echo $s->GetFieldValue('empmaster',"id='".$req_row['received_by']."'",'emp_name'); ?></td>
    <?php }?>
    <td class="f12">&nbsp;</td>
    <td class="f11">&nbsp;</td>
  </tr>
</table>


</div>
<div class="div_third">
<table width="100%" border="0" cellspacing="0" cellpadding="3" style="border-collapse:collapse;" align="left">
  <tr>
    <th width="5%">S. No.</th>
    <th width="14%">Asset Code </th>
    <th>Asset Name</th>
    <th width="12%">UOM</th>
    <th width="12%">Quantity</th>
    <th width="12%">Remarks</th>
    <th width="12%">Return Date</th>
  </tr>
  <?php 
   $p=1;

   $AssetRec=DB_query("SELECT * FROM asset_issue_details WHERE issue_id='".$_REQUEST['rid']."'",$db);
   while($Issues=DB_fetch_assoc($AssetRec)){
   
   
    //echo $itemRow['detailsID'];
    $itemCode=$s->GetFieldValue('machine_center','id="'.$Issues['mst_itemid'].'"','code'); 
    $itemName=$s->GetFieldValue('machine_center','id="'.$Issues['mst_itemid'].'"','name'); 
    $UNITid=$s->GetFieldValue('machine_center','id="'.$Issues['mst_itemid'].'"','unit'); 
    $unitName=$s->GetFieldValue('unitsofmeasure','unitid="'.$UNITid.'"','unitname');
      ?>
  <tr>
    <td><?php echo $p.'. '; ?></td>
    <td><?php echo $itemCode; ?></td>
    <td><?php echo $itemName; ?></td>
    <td><?php echo $unitName; ?></td>
    <td style="text-align:right;">1</td>   
    <td style="text-align:right;"><?php echo $Issues['remarks'];?></td>         
    <td style="text-align:center;"><?php echo ConvertSQLDate($Issues['return_date']);?></td>         
   </tr>
   <?php $p++;} ?>
</table>
</div>
<div class="div_forth">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
  <tr>
    <td width="10%" class="f12" align="right">Remarks :</td>
    <td class="f11"><?php echo $req_row['remarks'];?></td>

    <td width="10%" class="f12" align="right">Created By :</td>
    <td width="45%" class="f11"><?php echo $s->GetFieldValue('www_users'," id='".$req_row['createdby']."' " ,'realname');?></td>
    
  </tr>
</table>

</div>
</div>
<script type="text/javascript" language="javascript">

function toggle_visibility(id)
{
  //var msg=confirm("Please Use Mozilla Firefox And Print In Landscape Mode");
  if(msg)
  {
       var e = document.getElementById(id);
	      e.style.display = 'none';
		       //alert(e.style.display);
			   window.print();
  }
}
</script>

</body>
</html>