<?php


require_once "config.php";

	$paymentid = $_GET["paymentid"];
	
	//if (isset($_REQUEST['tenant_id'])){
	if ($_GET['paymentid'] != null || $_GET['paymentid'] != ''){
		//$tenant_id = ($_REQUEST['tenant_id']);
		$paymentid = ($_GET['paymentid']);
		
		$query = "SELECT * FROM payment WHERE payment_id = '$paymentid'";
		$data = mysqli_query($link, $query);
		$row = mysqli_fetch_assoc($data);
		
		
		$payment_id = $row['payment_id'];
		$unit = $row['unit'];
		$amount = $row['amount'];
		$pay_amount = $row['pay_amount'];
		$pay_type = $row['pay_type'];
		$rental_month = $row['rental_month'];
		$date_created = $row['date_created'];
		$tenant_id = $row['tenant_id'];
		//$staff_id = $row['staff_id'];
		$status_payment = $row['status_payment'];
		$bill_id = $row['bill_id'];
		$pay_desc = $row['pay_desc'];
		
		$list = "SELECT * FROM tenant WHERE tenant_id = '$tenant_id'";
		$listout = mysqli_query($link, $list);
		$list = mysqli_fetch_assoc($listout);
	
		$tenant_id = $list['tenant_id'];
		$name = $list['name'];
		$unit = $list['unit'];$staff_id = $list['staff_id'];
		
		if($_SESSION["username"] != 'admin')
			$staff_id = $_SESSION["staff_id"];
		
		//$staff_id = $_SESSION["staff_id"];
		$pic = "SELECT * FROM staff WHERE staff_id = '$staff_id'";
		$listpic = mysqli_query($link, $pic);
		$pic = mysqli_fetch_assoc($listpic);
	
		$staff_id = $pic['staff_id'];
		$staff_name = $pic['staff_name'];
		
	}
		?>

<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="img/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 :  RCP/<?php echo $bill_id?>/<?php echo $payment_id?></small></div></b>
			</center>
		</td>
	</tr>
</table>

<table class="receipt" align="center" style="border:none;border-color:#000000;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 $name ?>
			</font>
		</td>
	</tr>
	<tr>
		<td>NO. UNIT</td>
		<td>: 
			<font face="Courier New, Courier, monospace">
				<?php echo $unit ?>
			</font>
		</td>
	</tr>
	<tr>
		<td>KETERANGAN</td>
		<td>: 
			<font face="Courier New, Courier, monospace">
				<?php echo $rental_month ?> - <?php echo $pay_type ?>  
			</font>
		</td>
	</tr>
	<tr>
		<td>JUMLAH</td>
		<td>: 
			<font face="Courier New, Courier, monospace">
				RM <?php echo number_format($row['pay_amount'],2,".",","); ?> 
			</font>
		</td>
	</tr>
	<tr>
		<td>TARIKH</td>
		<td>: 
			<font face="Courier New, Courier, monospace">
				<?php echo date("d/m/Y H:i A",strtotime($date_created)) ?>
			</font>
		</td>
	</tr>
	<tr>
		<td>NO. RUJUKAN</td>
		<td>: 
			<font face="Courier New, Courier, monospace">
			<?php echo "INV".$bill_id ?>
			</font>
		</td>
	</tr>
	<tr>
		<td>PIC</td>
		<td>: 
			<font face="Courier New, Courier, monospace">
				 <?php echo $staff_name?>
			</font>
		</td>
	</tr>
</table>