<?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/>-->
			<?php include("namasyarikat_ssmno.html");?>
			<div class="div1"><small>RESIT RASMI</small><small STYLE="float:right">NO. SIRI :  <?php echo $receiptNoPayment_water ?></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 strtoupper($tenant_name) ?>
			</font>
		</td>
	</tr>
	<tr>
		<td>NO. UNIT</td>
		<td>: 
			<font face="Courier New, Courier, monospace">
				<?php echo strtoupper($unit_no) ?> : <?php echo strtoupper($location_name) ?>  
			</font>
		</td>
	</tr>
	<tr>
		<td>KETERANGAN</td>
		<td>: 
			<font face="Courier New, Courier, monospace">
				Bill Air Rumah (<?php echo date("m/Y", strtotime($issue_date_water))?>)
			</font>
		</td>
	</tr>
	<tr>
		<td>JUMLAH</td>
		<td>: 
			<font face="Courier New, Courier, monospace">
				
				
				RM <?php echo number_format($water_amount_paid,2,".",","); 
				if($water_payment_type > 1 )	{
					echo "(". $payment_type_desc." - Ref. No. : ". $refNo_water.")";
				}
				
				?>
			</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 ucfirst($staff_name)?>
			</font>
		</td>
	</tr>
</table>