<?
session_start();
include("opendmsdb.php");
include("../test.php");
?>
<head>
<TITLE>MECHANIC WISE REPORT</TITLE>
<style>
tr{font-family:arial;font-size:13;background-color:white}
TH{COLOR:WHITE;BACKGROUND-COLOR:STEELBLUE}
</style>

<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<CENTER>

<?
$df=$y.'-'.$m.'-'.$d;
$dt=$y1.'-'.$m1.'-'.$d1;
print "<FONT FACE='ARIAL BLACK' color='steelblue'>
MECHANIC WISE REPORT FROM ".datetohtml($f).' TO '.datetohtml($t)."
</FONT>";


$sql="select distinct empname from timecard where  empname='$exec' and brcode='$brcod' order by empname";


$re=mysqli_query($db,$sql);

//$s1="select sum(labamt) from timecard where dat>='$df' and dat<='$dt' and brcode='$brcod'";
//$r=mysqli_query($db,$s1);
//$row5=mysqli_fetch_array($r);


$i=1;
$gtot2=0;
while($row=mysqli_fetch_array($re))

{
$gtot1=0;
 print "<fieldset><legend><b>$row[0]</b></legend>";
 print "<table cellspacing=1 cellpadding=2 bgcolor='lightsteelblue' width=100%>";
 print "<th>No <th>Date<th>Jobno<th>JobAmt<th>Time Frm <th>Time To<th>CardNo";
 $re2=mysqli_query($db,"select * from timecard where empname='$row[0]' and brcode='$brcod'  and dat>='$f' and dat<='$t' order by dat");
 while($row1=mysqli_fetch_array($re2))

{
//$re22=mysqli_query($db,"select timediff($row1[etime],$row1[stime]) from timecard where empname='$row1[5]' and sno='$row1[sno]' and tcno='$row1[tcno]'");
//$row2=mysqli_fetch_array($re22);
  print "\n<form action='$PHP_SELF'> <input type=hidden name='jcno' value='$row1[0]'><input type=hidden name='sno' value='$row1[sno]'><input type=hidden name='tcno' value='$row1[tcno]'><tr><td>";
  print "\n".$i++."</td>";
  print "<td align=center>".datetohtml($row1[dat])."</td>";
  print "<td align=center>$row1[0]</td>";
  print "<td align=right >$row1[1]</td>";
  print "<td align=center>$row1[2]</td>";
  print "<td align=center>$row1[3]</td>";
//print "<td align=center>$row2[0]</td>";

  print "<td align=center>$row1[6]</td>";
  print "<td align=center>$row1[sno]</td>";

 

$gtot1+=$row1[labamt];
$gtot2+=$row1[labamt];
 }
//$per=0;
//$per=($gtot1/$row5[0])*100;
//$per=round($per,2);
//$gper+=$per;
print "<tr><td colspan=3><center><b>Total</td><td align=right>".putComa($gtot1)."</td><td></td><td>$per</td><td></td></tr>";

print "</table></fieldset><br>&nbsp;";
}
print "<table cellspacing=1 cellpadding=2 bgcolor='lightsteelblue' width=100%>";
print "<tr><td colspan=3><center><b>Grand Total</td><td align=right>".putComa($gtot2)."</td><td></td><td></td><td></td></tr>";
print "</table><br>&nbsp;";
?>

<input type=button value='<- Back' onClick='history.back(1)'>
<?
return;
// end if
?>

<p>&nbsp;<p>&nbsp;<p>&nbsp;
<form action='<?print $PHP_SELF?>'>
<table>
<tr><td bgcolor='steelblue'>
<img src='exec.jpg'>
</td><td>
<table border=0 width=250>
<th colspan=2 height=23><FONT FACE='ARIAL' color='white'>
MECHANIC WISE REPORT
</FONT>

<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>Mechanic</td><td>
<select name='exec'>
<option>All</option>
<?
$sql="select distinct empname from timecard where brcode='$brcod' order by empname";
$exres=mysqli_query($db,$sql);
while($exrow=mysqli_fetch_array($exres))
{
 print "<option>$exrow[0]</option>";
}

?>
</select></td></tr>
<tr><td>Password</td><td><input type=password name='pswd'></td></tr>
<?

?>
<tr><td colspan=2 align=center bgcolor='steelblue'><input type=submit value="Show" name='show'></td></tr>
</table>
</td></tr>
</table>
<input type=button value='<- Back' onClick='history.back(1)'>
</form>

