<?php
require("../connection.php");
include("../user.php");
$user_id=$_SESSION['user'];
$username=$_SESSION['user_name'];
$id=$_REQUEST['issue_id'];
/*$check=mysqli_query("SELECT * from new_item_issue1 where issue_id='$issue_id'");
$cnt=mssql_num_rows($check);
if($cnt=1)
{*/
$cus=mysqli_query($con,"select  *,r.employee_name as f_name,t.employee_name as s_name,lm.location as loc,n.id as id_no from issue_master n left join employee_master t  ON n.secondary_emp_name = t.emp_no  left join  employee_master r  ON n.emp_name = r.emp_no left join location_master lm on lm.id=n.location where n.id='$id' ORDER BY n.id  DESC limit 1");
/* echo "SELECT top 1 * FROM  [asset].[dbo].[new_item_issue1] tab1 left JOIN [asset].[dbo].[thosiba_employee_master]  tab2   
    ON tab1.employee_code = tab2.thosiba_emp_code where tab1.issue_id='$issue_id' ORDER BY tab1.issue_id  DESC"; */
	$s=1;
		while($item1=mysqli_fetch_array($cus))
		{
			$emm=$item1['f_name'];
			$emm1=$item1['s_name'];
				
	if ($item1['s_name']== NULL or $item1['s_name']==" ")
			{
				$na=$item1['f_name'];
				$na1=$item1['emp_no'];
				$na2=$item1['emp_dept'];
				$share="NON - SHARING";
			}
			else
			{
				$na=$item1['f_name']." / ".$item1['s_name'];
				$na1=$item1['emp_code']." / ".$item1['secondary_emp_code'];
				$na2=$item1['emp_dept']." / ".$item1['secondary_emp_dept'];
				$share="SHARING";
			}

//$name="Desktop";
?>
<style>
	#xx
	{
		float:right;
	}
	.box-header a
	{
		padding: 5px 5px 5px 0px;
		background: #fff;
		color: #444;
		border-radius: 5px;
	}
	.box-header a.red
	{
		border:1px solid #dd4b39;
	}
	.box-header a.yellow
	{
		border:1px solid #f39c12;
	}
	.box-header a i
	{
		color:#fff;
	}
	.box-header .pencil
	{
		padding: 5px;
		background: #f39c12;
		margin-right: 5px;
	}
	.box-header .pencil1 
	{
		padding: 5px;
		background: #dd4b39;
		margin-right: 5px;
	}
	#dark
	{
		background:#a9a9a9;
	}
	.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th {
    padding: 4px;
	}
	#dark{
		background-color:#a9a9a9!important;
	}
	ul{
	list-style-type: disc!important;
	}
	p{
		    text-align: justify;
	}
</style>
<div id="rav" style="margin:5px;">
					
                <div id="rs">
				<table class="table table-hover table-bordered" style="font-family:'Times New Roman', Times, serif">
					<tbody>
						<tr id="dark">
							<td id="dark" style="text-align:center;" colspan="5">ASSET HANDOVER FORM</td>
						</tr>
						<tr>
							<th>ISSUE ID</th>
							<td style="text-align:left;"><?php echo $item1['id_no']; ?></td>
							<th>TYPE</th>
							<td style="text-align:left;"><?php echo $item1['type']; ?></td>
						</tr>
						<tr>
							<th>Employee Location</th>
							<td style="text-align:left;"><?php echo $item1['loc']; ?> </td>
							<th>Sharing / Non Sharing</th>
							<td style="text-align:left;"><?php echo $share; ?></td>
						</tr>
						<tr>
							<th>Primary Emp Code</th>
							<td style="text-align:left;"><?php echo $item1['emp_code']; ?></td>
							
							<th>Primary Emp Name</th>
							<td style="text-align:left;"><?php echo $item1['f_name']; ?></td>
						</tr>
						<tr>
							<th>Secondary Emp Code</th>
							<td style="text-align:left;"><?php echo $item1['secondary_emp_code']; ?></td>
							
							<th>Secondary Emp Name</th>
							<td style="text-align:left;"><?php echo $item1['s_name']; ?></td>
						</tr>
						<tr>
							<th>Primary Emp Dept</th>
							<td style="text-align:left;"><?php echo $item1['emp_dept']; ?></td>
							
							<th>Secondary Emp Dept</th>
							<td style="text-align:left;"><?php echo $item1['secondary_emp_dept']; ?></td>
						</tr>
						
						
					</tbody>
				</table>
			<?php    
			$rs=$item1['id_no'];
			}
			?>
			<table class="table table-hover table-bordered" style="font-family:'Times New Roman', Times, serif">

			<?php
			$cus1=mysqli_query($con,"SELECT im.created_by,cm.category,imt.item_code,itm.value FROM issue_master im left join issue_master_table imt on im.id=imt.issue_master_id left join category_master cm on cm.id=imt.category left join item_master itm on itm.asset_id=imt.item_code  where im.id='$rs' order by im.id desc");
			
			
			 $s=1;
			while($item2=mysqli_fetch_array($cus1))
			{
				
				$creae=$item2['created_by'];
				
			$get_user=mysqli_fetch_array(mysqli_query($con,"SELECT * FROM `user_master` where user_id='$creae'"));
			$crea=$get_user['user_name'];
				$Value=$item2['value'];
			$ssr = explode(",",$Value);
		
			$cntr=count($ssr);
			$rs1=$item2['item_code'];

			?>
			<thead style="color:#0033FF">
			<tr id="dark">	
			<th rowspan="1" id="dark">#</th>	
			<th rowspan="1" id="dark">Category Name</th>
			<th rowspan="1" id="dark">Item Code</th>
			<?php $ravi1=mysqli_fetch_array(mysqli_query($con,"SELECT header FROM item_master where asset_id='$rs1'"));
			
			
			 $name1=$ravi1['header'];
			 $sss = explode(",",$name1);
			//print_r($sss);
			$cntt=count($sss);
			for($r=0;$r<$cntt;$r++)
			{
			$header_query=mysqli_fetch_array(mysqli_query($con,"select configuration from configuration_master where id=$sss[$r]"));
			
			?>
			<th rowspan="1" id="dark"><?php echo $header_query['configuration']; ?></th>
			<?php }   ?>
			</tr>
			</thead>
			<tr>
			<td><?php echo $s; ?></td>
			<td><?php echo $item2['category']; ?></td>
			<td><?php echo $item2['item_code']; ?></td>
			<?php for($a=0;$a<$cntr;$a++)
			{
			?>
		
			<td><?php echo $ssr[$a]; ?></td>
			<?php }   ?>
			</tr>


			<?php  $s++;
			
			?>
        <?php 
		}?>
			</table>
			
			<h3 style="font-size: 15px;font-weight: bold;">General Rules For IS usage</h3>
			
			<p style="margin: 0px 10px 10px;"> 
			&emsp;&emsp;&emsp;&emsp;&emsp;As a result of technological advances Information systems are becoming more and more important within the Toshiba group. To
			run these systems, workstations attached to local area networks and to the internet are increasingly common. Although this development can give lots of advantages it can also pose considerable risks with respect to IT security.For this reason each employee has to handle all data processing equipment (e.g PC's, notebooks, workstations, servers, printers etc), information
			systems and data with care. Everybody must be committed to proecting the equipment, the systems and the data against damage, misuse and lose. All working practices have to strictly followthe rules listed below:
			</p>
			<ul>
			<li>Product your PC against theft and unauthorized use, like lock your room when leaving. Prevent any unauthorized persons from working with your software and date by producting with password.
			</li>
			<li>Protect your data against loss and unauthorized read or write access by strong them on a server if available.
			</li>
			<li>E-mail is an imortant information resource to rapid exchange information. Toshiba uses outlook system to optimize colaboration. All employees need to understand how to use E-mail efficiently while being aware of the associated risks.
			</li>
			<li>Only use licensed software and do not use either private hardware or software or private disk ettes at your working place, Do not install programs on your PC by yourself.
			</li>
			<li>Use Toshiba standard antivirus software-epo without changing the prescrib
			</li>
			<li>Please protect your official documents for your cabin and strictly not allow keeping the documents lying in printer or user place.
			</li>
			<li>Endusers must lock your phone and system before leaving from your cabin.
			</li>
			</ul>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			
			<h3 style="font-size: 15px;font-weight: bold;">Forbidden</h3>
			<ul>
			<li>
				You cannot change any default settings in IE browser
			</li>
			<li> 
				You are not allowed to use company PC to browse any "Dangerous" websites, like games or nasty websites.
			</li>
			<li>
				Don't leave company E-mail address on public internet as contact infrmation, except business need.
			</li>
			<li>
				End users are not allowed installed or changing software configuration without IT knowledge.
			</li>
			<li>
				For ant special software for business usage, user must apply it via supervisor and approved by IT department. 
			</li>
			</ul>
			<p style="text-align:center;">If you have questions the way of work with your PC and you have experience any unusual occurrences with it that you don't understand, Please contact IT or helpdesk for support.			
			</p><br><br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			</br>
			<textarea style="width:100%;height:100px;" placeholder="Remarks:"><?php echo $remark;?></textarea>
			<p style="margin: 0px 10px 10px;">Received the assets from IT in Good Condition and understand the usage policy.<br><br><br><br>
			</p><div style="width:100%;padding: 50px 0px 50px 0px;">
			<?php
			if($share=="NON - SHARING")
			{	
			?>
			<div style="text-align:left;float: left;width: 33%;margin-left: 20px;">Signature of the Issuer<br> <?php echo $crea;?></div>
			<div style="text-align:center;width: 33%;float: left;">Signature of the IT Manager <br> <?php echo "";?></div>
			<div style="text-align:right;margin-right:20px;">Signature of the Receiver <br> <?php echo $emm;?></div>
			<?php 
			}
			else
			{
			?>
			<div style="text-align:left;float: left;width: 33%;">Signature of the Issuer<br> <?php echo $crea;?></div>
			<div style="text-align:center;float: left;width: 33%;">Signature of the Primary Name <br> <?php echo $emm;?></div>
			<div style="text-align:right;float: left;width: 33%;">Signature of the Secondary Name <br> <?php echo $emm1;?></div>
			<div style="text-align: center;width: 100%;margin: 140px 0 0px 0px;">Signature of the IT Manager <br> <?php echo "";?></div>
			<?php
			}
	
			?>
			</div>
			
    </div>
    </div>
			<?php 
	/*			
}
else
{
	echo "test";
}*/
?>