<?php
$opendate = new DateTime($activities[0]['opendate']);
$opendate = $opendate->format('Y-m-d H:i');
$closedate = new DateTime($activities[0]['closedate']);
$closedate = $closedate->format('Y-m-d H:i');
$subject = $activities[0]['subject'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="description" content="">
	<meta name="author" content="">
	<link rel="icon" type="image/png" sizes="16x16" href="<?=base_url();?>/assets/favicon.png">
	<title>Summit CRM</title>
	<link href="<?=base_url();?>/assets/font-awesome-640/css/all.min.css" rel="stylesheet">
	<link href="<?=base_url();?>/assets/style.css" rel="stylesheet">
	<style>
	body { width:210mm; height:296mm; padding:5mm; font-size:11pt; background-color:#fff;}
	main { height:260mm; }
	th,td { padding:0.5mm; }
	th {text-align:center;} 
	table {width:100%; margin-top:5mm; }
	ul,p,ol { margin:0; }
	.no-overflow { white-space:nowrap; }
	</style>
</head>
<body class='A4'>
	<main>
		<div class='row'>
			<div class='col'>
				<img src='<?=base_url();?>/assets/images/logo.png'>
			</div>
			<div class='col text-end'>
				<h3>SERVICE REPORT</h3>
				Report# <?=$actid;?>
			</div>
		</div>
		<!-- Act Info -->
		<table>
			<tr> 
				<td>Customer </td> <td> : </td> <td><?=$activities[0]['sitename'];?></td>
				<td>Service requested by </td> <td> : </td> <td><?=$activities[0]['reportfrom'];?></td>
			</tr>
			<tr>
				<td>Model</td> <td> : </td> <td><?=$activities[0]['productname'];?></td>
				<td>Service Open </td> <td> : </td> <td><?=$opendate;?></td> 
			</tr>
			<tr>
				<td>Sw. Version</td> <td> : </td> <td><?=$activities[0]['swversion'];?></td>
				<td>Service Close </td> <td> : </td> <td><?=$closedate;?></td> 
			</tr>
			<tr>
				<td>Serial#</td> <td> : </td> <td><?=$activities[0]['productnumber'];?></td>
			</tr>
		</table>
		<br />
		<!-- Act Detail -->
		<table>
			<tr>
				<td>Subject</td> <td> : </td> <td><?=$subject;?></td>
			</tr>
			<?php 
			foreach($actdetails as $data) {
				$acttextname = $data['acttextname'];
				$textvalue = $data['textvalue'];
				echo "<tr> <td class='align-top'>$acttextname</td> <td class='align-top'> : </td> <td>$textvalue</td> </tr>";
			}
			?>
		</table>
		<!-- Spare Part TRX -->	
		<p>Spare Part Usage :</p>
		<table class='table-bordered' style='margin:0;'>
			<colgroup>
				<col style='width:15%'> 
				<col style='width:30%'> 
				<col style='width:10%'> 
				<col style='width:5%'> 
				<col style='width:10%'> 
				<col style='width:20%'> 
			</colgroup>
			<tr> <th>Catalog#</th> <th>Product</th> <th>Lot#</th> <th>Qty.</th> <th>Unit</th> <th>Purpose</th> </tr>
			<?php
			foreach($invtrans as $data) {
				$catalognumber = $data['catalognumber'];
				$productname = $data['productname'];
				$lotnumber = $data['lotnumber'];
				$qty = $data['qty'];
				$unit = $data['unit'];
				$purpose = $purposes[$data['purpose']];
				echo "<tr> <td>$catalognumber</td> <td>$productname</td> <td>$lotnumber</td> <td>$qty</td> <td>$unit</td> <td>$purpose</td> </tr>";
			}
			?>
		</table>
	</main>
	<footer>
	<div class='row mb-3'>
		<div class='col text-center' style='text-decoration:overline;'>
			Technical Support
		</div>
		<div class='col text-center' style='text-decoration:overline;'>
			Customer
		</div>
	</div>
	<p class='text-center'>
		PT. SUMBERMITRA AGUNGJAYA<br/>
		Gading Bukit Indah Blok H/3, Kelapa Gading Permai, Jakarta 14240<br/>
		Telp : 62-21-4516728, Fax : 62-21-45840240
	</p>
	</footer>
</body>
</html>