<?php
$sqlStaffName = "select name from users where id = ". $_SESSION["staff_id"];
$runStaffName = mysqli_query($link, $sqlStaffName);
if($runStaffName === FALSE){
	die(mysqli_error($link));
}	
$resultStaffName = mysqli_fetch_assoc($runStaffName);
$staff_name = $resultStaffName["name"];


//tenant info
$sqlTenantInfo = "select tenants.tenant_name, properties.unit_no, locations.location_name, tenants.rental_rate from tenants 
					inner join properties on tenants.property_id = properties.id
					inner join locations on properties.location_id = locations.id
					inner join projects on locations.project_id = projects.id
					where tenants.id = $tenant_id 
					";
$runTenantInfo = mysqli_query($link, $sqlTenantInfo);
if($runTenantInfo === FALSE){
	die(mysqli_error($link));
}
$resultTenantInfo = mysqli_fetch_assoc($runTenantInfo);
$tenant_name = $resultTenantInfo["tenant_name"];
$unit_no = $resultTenantInfo["unit_no"];
$location_name = $resultTenantInfo["location_name"];
$rental_rate = $resultTenantInfo["rental_rate"];



		?>

<style type="text/css">
.receipt
{
font-size:9px;
font-family:"Times New Roman", Times, serif;
}
.div1 {
    resize: both;
    overflow: auto;
    border: 3px solid BLACK;
}
</style>


<table style="border-color:#FFFFFF;font-family:Times New Roman" align="center" width="600">
	<tr>
		<td align="center">
			<img width="130px" height="70px" src="images/logo phssb.png" />
		</td>
		<td >
			<b>
			PERUMAHAN DAN HARTANAH SELANGOR SDN BHD</b>
			<BR/>
			<div class="div1"><small>RESIT RASMI</small><small STYLE="float:right">NO. SIRI :  <?php echo $new_serialNo ?></small></div></b>
			</center>
		</td>
	</tr>
</table>

<table class="receipt" align="center" style="border:none;border-color:#999999;font-size:12px;" background="images/phssbwatermark.png" width="550" cellpadding="2">
	<tr>
		<td width="100">NAMA</td>
		<td>: 
			<font face="Courier New, Courier, monospace">
			<?php echo $tenant_name ?>
			</font>
		</td>
	</tr>
	<tr>
		<td>NO. UNIT</td>
		<td>: 
			<font face="Courier New, Courier, monospace">
				<?php echo $unit_no ?> : <?php echo $location_name ?>  
			</font>
		</td>
	</tr>
	<tr>
		<td>KADAR SEWA</td>
		<td>: 
			<font face="Courier New, Courier, monospace">
				RM<?php echo number_format($rental_rate,2) ?>  
			</font>
		</td>
	</tr>
	<tr>
		<td>KETERANGAN</td>
		<td>: 
			<font face="Courier New, Courier, monospace">
				Sewa Bulanan Rumah (<?php echo date("M Y", strtotime($list_monthYear_issuedate))?>)
			</font>
		</td>
	</tr>
	<tr>
		<td>JUMLAH</td>
		<td>: 
			<font face="Courier New, Courier, monospace">
				RM <?php echo number_format($list_amount_paid,2,".",","); ?>
			</font>
		</td>
	</tr>
	<tr>
		<td>TARIKH</td>
		<td>: 
			<font face="Courier New, Courier, monospace">
				<?php echo date("d/m/Y H:i A") ?>
			</font>
		</td>
	</tr>
	
	<tr>
		<td>PIC</td>
		<td>: 
			<font face="Courier New, Courier, monospace">
				 <?php echo $staff_name?>
			</font>
		</td>
	</tr>
</table>