GLOBAL $LINENUMBERS;
GLOBAL $TABLEBGCOLOUR;

$LINENUMBERS=0;
$TABLEBGCOLOUR="#0080C0";

$CaseId=$_SESSION[`CaseId`];

$sel=$_REQUEST[`RenterSelect`];
if ($sel!="")
{
   $_SESSION[`Instance`]=ShowQueryResultScalar("select rInstance from Responses where rUnique=`$sel` and isDeleted=0");
   SetForm(`RE_Renter_Detail`);
}

echo "<input type=hidden name=RenterSelect>";

echo "<br><h4><u>$CaseId</u> Renters</h4> ";

ExecuteSQL("create temporary table a as (select rUnique,rValue as Name,rInstance from Responses where qID=`RE_RenterName` and CaseID=`$CaseId` and isDeleted=0) ");
ExecuteSQL("create temporary table b as (select rUnique,rValue as Phone,rInstance from Responses where qID=`RE_RenterPhone` and CaseID=`$CaseId` and isDeleted=0) ");
ExecuteSQL("create temporary table c as (select rUnique,rValue as DateIn,rInstance from Responses where qID=`RE_RenterDateIn` and CaseID=`$CaseId` and isDeleted=0) ");
ExecuteSQL("create temporary table d as (select rUnique,rValue as DateOut,rInstance from Responses where qID=`RE_RenterDateOut` and CaseID=`$CaseId` and isDeleted=0) ");

echo `<div style="height:275; overflow: scroll;">`;
ShowQueryResult("select distinct concat(`<input type=button value=`,substring(replace(cast(100000+cast(a.rInstance as unsigned) as char(6)),` `,`0`),2,5),` onclick=javascript:Xsel(`,a.rUnique,`);>`) as Detail, Name,Phone,DateIn,DateOut from a,b,c,d where b.rInstance=a.rInstance and c.rInstance=a.rInstance and d.rInstance=a.rInstance order by DateIn DESC ");
echo "</div>";

echo "<p>";
