<?
session_start();
if(strlen($brcode)<=0)
{
 print "<script> alert('Invalid Login'); parent.document.location='ind.php' </script>";
 return;
}
include("../opendb.php");
include("../test.php");
?>
<title>TCR Reminder</title>
<link rel="stylesheet" href="../style.css" type="text/css" />
<style>
body,td{font-family:arial narrow;font-size:14}
</style>
<center>
<table width=100%>
<tr><td bgcolor='gray'><CENTER><font color=white font size=4>REMINDER</TD></TR>
</TABLE>

<form action='<?print $PHP_SELF?>'>
<table border=1 width=250>
<tr><td>From</td><td>
<input type=text name=d value='<?print date("d",time());?>' size=1>
<input type=text name=m value='<?print date("m",time());?>' size=1>
<input type=text name=y value='<?print date("Y",time());?>' size=3>
</td></tr>
<tr><td>To</td><td>
<input type=text name=d1 value='<?print date("d",time());?>' size=1>
<input type=text name=m1 value='<?print date("m",time());?>' size=1>
<input type=text name=y1 value='<?print date("Y",time());?>' size=3>
</td></tr>
<tr><td colspan=2 align=center><input type=submit value="Show" NAME='show'></td></tr>
</table>
</form>

<?
if($show)
{
$df=$y.'-'.$m.'-'.$d;
$dto=$y1.'-'.$m1.'-'.$d1;
print "From ".datetohtml($df)." to ".datetohtml($dto);
$x="select * from tcrmast where brcode='$brcode' and (rendate>='$df' and rendate<='$dto') or(insudt>='$df' and insudt<='$dto')order by rendate";

$re=mysqli_query($db,$x)or die('err'.mysqli_error($db));

if(mysqli_num_rows($re)<=0)
{
 print "Record does not exist for the period";
}
else
{
print "<center><table border=1><th colspan=14>TCR </th><tr>";
print "<th>TCR NO <th>Desc <th>Veh Class <th>Ren Date <th>Location <th>Ins Co.<th>Pol <th>Ins Dt.";
while($row=mysqli_fetch_array($re))
{
 print "<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>".datetohtml($row[3])."</td><td>$row[4]</td><td>$row[5]</td><td>$row[6]</td><td>".datetohtml($row[7])."</td>";
}
print "</table>";
} // END ELSE
$x="select * from asset where brcode='$brcode' and (vehtxduedt>='$df' and vehtxduedt<='$dto') or(vehfitduedt>='$df' and vehfitduedt<='$dto')  or(vehpermdt>='$df' and vehpermdt<='$dto')
 or(polludt>='$df' and polludt<='$dto')
 or(vehpermdt>='$df' and vehpermdt<='$dto')
 or(advtdt>='$df' and advtdt<='$dto')
 order by vehtxduedt";

$re1=mysqli_query($db,$x)or die('err'.mysqli_error($db));

if(mysqli_num_rows($re1)<=0)
{
 print "Record does not exist for the period";
}
else
{
print "<center><table border=1><th colspan=14>VEHICLE </th><tr>";
print "<th>Regno <th>Veh Model<th>Tax Due dt <th>Fit<th>Permit<th>Pollution <th>Advt<th>Insu";
while($row=mysqli_fetch_array($re1))
{
 print "<tr><td>$row[regno]</td><td>$row[vehmodel]</td><td>$row[vehtxduedt]</td><td>".datetohtml($row[vehfitduedt])."</td><td>$row[vehpermdt]</td><td>$row[polludt]</td><td>$row[advtdt]</td><td>".$row[insuco]."</td>";
}
print "</table>";

} // else num rows

}// end if
?>
