
<html>

<?php
$serverName = "LAPTOP-80M0Q8MU\SQLEXPRESS"; //serverName\instanceName
$connectionInfo = array( "Database"=>"data_hmi","UID"=>"sa", "PWD"=>"root");
$conn = sqlsrv_connect( $serverName, $connectionInfo);


///////////////////////// VALIDACION//////////////////////////////////
if( $conn ) {
     echo "Conexión establecida.<br />";
}
else{
     echo "Conexión no se pudo establecer.<br />";
     die( print_r( sqlsrv_errors(), true));
}




$query="select * from rollizos";
$registros=sqlsrv_query($conn,$query);



while($row=sqlsrv_fetch_array($registros)){
	$contador++;
	if($row["categoria"]=='rechazado'){$can_rechazados++;}
	if($row["categoria"]!=='rechazado'){$can_aceptados++;}
	if($row["categoria"]=='categoria1'){$can_cat1++;}
	if($row["categoria"]=='categoria2'){$can_cat2++;}
	if($row["categoria"]=='categoria3'){$can_cat3++;}

	$volument=$row["volumen"]+$volument;
	if($row["categoria"]=='rechazado'){$vol_rech=$row["volumen"]+$vol_rech;}
	if($row["categoria"]!=='rechazado'){$vol_acep=$row["volumen"]+$vol_acep;}
	if($row["categoria"]=='categoria1'){$vol_cat1=$row["volumen"]+$vol_cat1;}
	if($row["categoria"]=='categoria2'){$vol_cat2=$row["volumen"]+$vol_cat2;}
	if($row["categoria"]=='categoria3'){$vol_cat3=$row["volumen"]+$vol_cat3;}
}
?>




<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SELECCION Y CLASIFICACIÓN DE ROLLIZOS-UNIVERSIDAD DEL BIOBIO</title>
<style type="text/css">
body {
	background-color: #000;
}
body,td,th {
	color: #FFF;
	.inputcentrado {
   text-align: center
   }
}
</style>
<link href="estilos.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="cabeza">


 <center> <img src="images/logo_ubb.png" width="329" height="205" /> </center> 
</div>
<div id="cuerpo">
  <div id="superior">
    <p> </p>
  </div>
  <div id="centro">
  <form action="" >
    <table width="200" border="1">
      <tr>
        <th scope="col">&nbsp;</th>
        <th scope="col"  style="color:#000">UNIDADES</th>
                <th scope="col"  style="color:#000">VOLUMEN<br>[m3]</th>
      </tr>
      <tr>
        <th scope="col"  style="color:#000"><em><strong>ROLLIZOS OBSERVADOS</strong></em></th>
        <th width="61" scope="col"><input type="text" size="5" style="text-align:center" value="<?php echo $contador;?>" ></th>
        <th width="60" scope="col"><input type="text" size="10" style="text-align:center" value="<?php echo $volument/1000;?>" ></th>
      </tr>
      <tr>
        <th scope="col"  style="color:#000"><em><strong>ROLLIZOS RECHAZADOS</strong></em></th>
        <th width="61" scope="col"><input type="text" size="5" style="text-align:center"  value="<?php echo $can_rechazados;?>" ></th>
        <th width="60" scope="col"><input type="text" size="10" style="text-align:center"  value="<?php echo $vol_rech/1000;?>" ></th>
      </tr>
      <tr>
       <th scope="col"  style="color:#000"><em><strong>ROLLIZOS ACEPTADOS</strong></em></th>
        <th width="61" scope="col"><input type="text" size="5" style="text-align:center"  value="<?php echo $can_aceptados;?>" ></th>
        <th width="60" scope="col"><input type="text" size="10" style="text-align:center"  value="<?php echo $vol_acep/1000;?>" ></th>
      </tr>
      <tr style="text-align:rigth">
        <th  style="color: #000; text-align: right;" scope="col"><em><strong>ROLLIZOS CAT1</strong></em></th>
        <th width="61" scope="col"><input type="text" size="5" style="text-align:center"  value="<?php echo $can_cat1;?>" ></th>
        <th width="60" scope="col"><input type="text" size="10" style="text-align:center"  value="<?php echo $vol_cat1/1000;?>" ></th>
      </tr>
      <tr>
          <th scope="col"  style="color: #000; text-align: right;"><em><strong>ROLLIZOS CAT2</strong></em></th>
        <th width="61" scope="col"><input type="text" size="5" style="text-align:center"  value="<?php echo $can_cat2;?>" ></th>
        <th width="60" scope="col"><input type="text" size="10" style="text-align:center"  value="<?php echo $vol_cat2/1000;?>" ></th>
      </tr>
      <tr>
          <th scope="col"  style="color: #000; text-align: right;"><em><strong>ROLLIZOS CAT3</strong></em></th>
        <th width="61" scope="col"><input type="text" size="5" style="text-align:center"  value="<?php echo $can_cat3;?>" ></th>
        <th width="60" scope="col"><input type="text" size="10" style="text-align:center"  value="<?php echo $vol_cat3/1000;?>" ></th>
      </tr>
    </table>
    </form>
    <p>&nbsp;</p>
  </div>
  <div id="inferior">
    <p></p>
  </div>
</div>
</body>
</html>
