<?
session_start();
include("opendb.php");
include("test.php");
?>
<title>PSN Telcon</title>
<script type="text/javascript" src="scripts/jquery-latest.js"></script>
<link type="text/css" href="includes/style1.css" rel="stylesheet" />
<link rel="stylesheet" href="css/form.css" type="text/css" />
<script type="text/javascript">
        $(function() {
          if ($.browser.msie && $.browser.version.substr(0,1)<7)
          {
			$('li').has('ul').mouseover(function(){
				$(this).children('ul').show();
				}).mouseout(function(){
				$(this).children('ul').hide();
				})
          }
        });        
    </script>

<body background="back_ground.jpg">
<?php include('logo2.php'); ?>
<?php include('includes/top.php'); ?>

<script>
 function serv(a,b)
 {
   document.location='serv.php?code='+a+'&tp='+b;
 }
 function sms(a,b)
 {
   window.open('sendsms.php?code='+a+'&tp='+b);
 }

</script>

<br>
<table class="container"><tr><td>
<font style="font-family: 'Trebuchet MS',Verdana,Helvetica,sans-serif; font-size:15px;">  &nbsp;&nbsp;Master >> <a href="mach_menu.php" style="text-decoration:none;">Machine</a> >> Vehicle Received Report</font>
<br>
<center>

<form action='<?print $PHP_SELF?>' method='post'>
<table bgcolor=aliceblue class='form'>
<tr bgcolor='green'><th colspan='4'><font color='white'>VEHICLE RECEIVED REPORT</font></th></tr>
<tr><td>From </td><td>DD <input type=text name=d1 size=2 value='<?print date("d")?>'></td>
		<td>MM <input type=text name=m1 size=2 value='<?print date("m")?>'></td>
		<td>YY <input type=text name=y1 size=4 value='<?print date("Y")?>'></td>
</tr>

<tr><td>To </td><td>DD <input type=text name=d2 size=2 value='<?print date("d")?>'></td>
		<td>MM <input type=text name=m2 size=2 value='<?print date("m")?>'></td>
		<td>YY <input type=text name=y2 size=4 value='<?print date("Y")?>'></td>
</tr>
<!--
<tr><td colspan=4 align=center><input type=radio name='chk' value='m' checked>by Month/date
			       <input type=radio name='chk' value='h' >by Hour </td>
</tr>
-->
<tr ><td colspan=4 align=center><input type=submit name='show' value='Show'></td></tr>
</table>
</form>

<?
if($show)
{
 $df=$y1.'-'.$m1.'-'.$d1;
 $dt=$y2.'-'.$m2.'-'.$d2;
PRINT "Daily Received Vehicles Report for Accident/Repair Cars ".datetohtml($df)." to ".datetohtml($dt);
}
else
{
 $df=date("Y-m-d");
 $dt=date("Y-m-d");
PRINT "Daily Received Vehicles Report for Accident/Repair Cars ".datetohtml($df)." to ".datetohtml($dt);
}
?>
</center>
<br>
<center>
<?

   $sql="select * from gateentry where (entrydate>='$df' and entrydate<='$dt')";
 $re=mysqli_query($db,$sql) or die(mysqli_error($db));
 if(mysqli_num_rows($re)>0)
 {
 print "<table border=1 width=100% class='report'> <tr><td colspan=16 align=center ><b><font size=3> S0</td></tr>";
 PRINT "<th>No <th>Vehicle Name <TH>Model  <TH>Reg.No. <TH>Job Card <TH>P/Report<th>Insu./Pvt<th>L/Charge <th>D/date <th>Received by<TH> Remarks";
  $i=1;
 while($row=mysqli_fetch_array($re))
 {

print "<tr><td align=center>".$i++."</td><td>$row[vehiclename]</td><td><center>$row[model]</td><td>$row[regno]</td><td>$row[jcno]</td><td>$row[policereport]</td><td>$row[instype]</td><td>$row[labour]</td>";
print "<td>$row[duedate]</td><td>$row[receivedby]</td><td>$row[remarks]</td></tr>";
 }
 print "</table>";

 }
//************1
 
function getengnr($ecode)
{
$sq="select engineer from minput where msno='$ecode'";
  $re=mysqli_query($db,$sq);
  $enrow=mysqli_fetch_row($re);
 $en_res=mysqli_query($db,"select empname from empmaster where empcode='$enrow[0]'");
  $en_row=mysqli_fetch_row($en_res);
  return $en_row[0];
}
function getbr($ecode)
{
$sq="select brcode from minput where msno='$ecode'";
  $re=mysqli_query($db,$sq);
  $enrow=mysqli_fetch_row($re);
 $en_res=mysqli_query($db,"select brname from branch where brcode='$enrow[0]'");
  $en_row=mysqli_fetch_row($en_res);
  if(strlen($en_row[0])>0)
   return $en_row[0];
  else
   return '-';
}

?>
<br>&nbsp;

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