<link href="wstyle.css" rel="stylesheet" type="text/css" />
<? if ($_GET['stat'] == '' ) { ?>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<p align="center" class="link">Technician Report</p>
<form action="index.php?page=52&stat=print" method="post" name="form1" target="_blank" id="form1">
  <table width="80%" border="0" align="center">
    <tr>
      <td class="td1">From Date</td>
      <td class="td2"><span id="sprytextfield1">
      <label>
      <input type="text" name="from_date" id="from_date" />
      </label>
      <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">*</span></span>  YYYY-MM-DD</td>
    </tr>
    <tr>
      <td class="td1">To Date</td>
      <td class="td2"><span id="sprytextfield2">
      <label>
      <input type="text" name="to_date" id="to_date" />
      </label>
      <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">*</span></span>  YYYY-MM-DD</td>
    </tr>
  </table>
  <p align="center">
    <input name="Submit" type="submit" class="Submit" id="Submit" value="   Show   " />
  </p>
</form>
<? } if ($_GET['stat'] == 'print' ) { 

    		?>
						<p align="center" class="link">Technician Report</p>
<table width="60%" border="1" align="center" bordercolor="#000000">
                          <tr>
                            
                            <td class="td_print1">Technitian</td>
                            <td class="td_print1">Total</td>
                          </tr>
                       
                        <?
							$from_date = $_POST['from_date']. " 00:00:00";
							$to_date = $_POST['to_date']. " 23:59:59"; 

							$result = mysql_query("SELECT tid, Count(outid) AS total FROM p1_out_order where stop1 = 1 and status3_dt between '".$from_date."' and '".$to_date."' group by tid order by total"); 
							while($row = mysql_fetch_array($result)){ 
						?>
                          <tr>
                            <td class="td_print2"><? 
							
							$query = mysql_query("SELECT * FROM p1_technitian where tid = ".$row['tid']); 
							echo mysql_result($query,0,"technitian");
							
							
							?></td>
                            <td class="td_print2"><? echo $row['total']?></td>
                          </tr>
						<? 
						
								$total = $total + $row['total'];
						
							}
						?>
                          <tr>
                            <td class="td_print1">Total</td>
                            <td class="td_print1"><? echo $total ?></td>
                          </tr>
</table>

<? } ?>

<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "date", {format:"yyyy-mm-dd", useCharacterMasking:true});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "date", {useCharacterMasking:true, format:"yyyy-mm-dd"});
//-->
</script>
