<? 
require_once "include/application.php"; 
require_once "include/function.php";

if(!$_SESSION["egoUser"])
	print("<script type='text/javascript'>location.href='index.php'</script>");

if(!$user)$user=$_SESSION["egoUser"];


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Reservation List Report</title>
<link rel="stylesheet" type="text/css" href="style.css" >
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	background-color: #FFFFFF;
}

-->
</style>
</head>

<body>
<table width="900" border="0" align="center" cellpadding="0" cellspacing="0" >
  <tr>
    <td width="1024" height="30" colspan="2" class="TextH2"><strong>      Reservation List Report </strong></td>
  </tr>
  
  
  <tr>
    <td colspan="2" class="TextH1"><p>User : <? echo $user; ?><br />
      Reservation Date  : <? echo $fdate." - ".$tdate; ?><br />
      Date Printed : <? echo date("d/m/Y") ?><br />
        <br />
        <br />
      </p>
    </td>
  </tr>
  <tr>
    <td colspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="box">
      
      <tr>
        <td height="25" colspan="2" bgcolor="#D0E3F6" class="TextH1"><div align="center">Reservation Date </div></td>
        <td width="14%" bgcolor="#D0E3F6" class="TextH1"><div align="center">Membership No </div></td>
        <td width="17%" bgcolor="#D0E3F6" class="TextH1"><div align="center">Membership Name </div></td>
        <td width="13%" bgcolor="#D0E3F6" class="TextH1"><div align="center">NRIC/Passport</div></td>
        <td width="17%" bgcolor="#D0E3F6" class="TextH1"><div align="center">Type of Product </div></td>
        <td width="23%" bgcolor="#D0E3F6" class="TextH1">For guest use </td>
      </tr>
      <tr>
        <td width="8%" height="25" bgcolor="#D0E3F6" class="TextH1"><div align="center">No of Adults</div></td>
        <td width="8%" bgcolor="#D0E3F6" class="TextH1"><div align="center">No of Childrens</div></td>
        <td height="25" bgcolor="#D0E3F6" class="TextH1"><div align="center">No of Room</div></td>
        <td bgcolor="#D0E3F6" class="TextH1"><div align="center">Check In Date</div>          <div align="center"></div></td>
        <td bgcolor="#D0E3F6" class="TextH1"><div align="center">Check Out Date</div></td>
        <td colspan="2" bgcolor="#D0E3F6" class="TextH1">Remark</td>
        </tr>
      
    

    <?
	$sql="select * from ivc_reservation left join ivc_members on irs_memberno = im_cardno left join 
	ivc_products on im_scheme=ip_id ";
 	$sql.="where irs_status='$sStatus' and irs_created >= '".system_date($fdate)."' and irs_created <= '".system_date($tdate)."' ";

	if($sReferral){
		if($sType=="Name")$sql.=" and im_name like '%$sReferral%'";			
		else if($sType=="FormNo")$sql.=" and im_formno like '%$sReferral%'";				
		else if($sType=="CardNo")$sql.=" and im_cardno like '%$sReferral%'";				
		else if($sType=="CardName")$sql.=" and im_cardname like '%$sReferral%'";				
		else if($sType=="NRIC")$sql.=" and im_ic like '%$sReferral%'";				
	}	

	$result=mysql_query($sql) or die(mysql_error());
	while($myrow=MySQL_fetch_array($result,MYSQL_ASSOC))
	{  
		if($myrow["irs_confirm_choice"]=="1"){
			$cin=window_date($myrow["irs_checkin1"]);
			$cout=window_date($myrow["irs_checkout1"]);
		}else if($myrow["irs_confirm_choice"]=="2"){
			$cin=window_date($myrow["irs_checkin2"]);
			$cout=window_date($myrow["irs_checkout2"]);
		}else if($myrow["irs_confirm_choice"]=="3"){
			$cin=window_date($myrow["irs_checkin3"]);
			$cout=window_date($myrow["irs_checkout3"]);
		}

		
     echo '
	  <tr>
        <td height="25" colspan="2" class="TextH1"><div align="center">'.window_date($myrow["irs_created"]).'</div></td>
        <td class="TextH1"><div align="center">'.$myrow["irs_memberno"].'</div></td>
        <td class="TextH1"><div align="center">'.$myrow["im_name"].'</div></td>
        <td class="TextH1"><div align="center">'.$myrow["im_ic"].'</div></td>
        <td class="TextH1"><div align="center">'.$myrow["ip_code"]." - ".$myrow["ip_name"].'</div></td>';
		
	if($myrow["irs_guestname"])echo '<td class="TextH1"><div align="left">Name : '.$myrow["irs_guestname"].'<br>NRIC/Passport : '.$myrow["irs_guestic"].'
	<br>Contact : '.$myrow["irs_guestcontact"].'<br>Email : '.$myrow["irs_guestemail"].'</div></td>';
	else echo '<td class="TextH1">&nbsp;</td>';

	echo '        
      </tr>
      <tr>
        <td height="25" class="TextH1"><div align="center">'.$myrow["irs_adult1"].'</div></td>
        <td class="TextH1"><div align="center">'.$myrow["irs_child1"].'</div></td>
        <td class="TextH1"><div align="center">'.$myrow["irs_room1"].'</div></td>

        <td class="TextH1"><div align="center">'.$cin.'</div>  </td>
        <td class="TextH1"><div align="center">'.$cout.'</div></td>';
	if($myrow["irs_remark"])echo '<td class="TextH1" colspan="2"><div align="center">'.$myrow["irs_remark"].'</div></td>';
	else echo '<td class="TextH1" colspan="2">&nbsp;</td>';
	
	echo '
        </tr>
      		';

	}
	?>


    </table>  </td>
  </tr>

</table>
</body>
</html>
