<?php
if (isset($_SESSION['usuario'])){
$user=$_SESSION['usuario'];
}
else{
?>
<script>
location.href="index.php?errorusuario=3";
</script>
<?php }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>

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

<body>
<table width="950" border="0" align="center">
  <tr>
    <td><p class="style4"><span class="style10">DESCUENTOS</span><br />
    </p>
    </td>
  </tr>
  <tr>
    <td><table width="100%" height="0" border="0" cellpadding="0" cellspacing="5">
      <tr>
        <td width="10%" valign="top">
          <form id="form2" name="form2" method="post" action="main.php?a=95">
            <input name="Submit" type="submit" class="boton2" value="Nuevo descuento">
                    </form>          </td>
        <td width="90%" valign="top"><form id="form1" name="form1" method="post" action="main.php?a=941">
          <input name="button" type="submit" class="boton2" id="button" value="Asignaci&oacute;n de descuento a tipo de paciente" />
        </form>        </td>
      </tr>
      <tr>
        <td colspan="2" valign="top"><hr width="100%" size="1" noshade="noshade" color="#0D3356"></td>
        </tr>
    </table></td>
  </tr>
</table>
<table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
		  <table width="95%" border="0" align="center" cellpadding="0" cellspacing="10">
            <tr>
              <td width="51%" valign="top"><p class="style4">Lista de descuentos:</p>
                <div>
	              <?php
echo "<table align='center' cellpadding='2' class='tablaBordes' width='100%'>";
echo "<tr class='tablaCabecera' align='center'>";

echo "<td>";
echo " Id ";
echo "</td>";

echo "<td>";
echo "Descripci&oacute;n";
echo "</td>";

echo "<td>";
echo "&nbsp;&nbsp;%&nbsp;&nbsp;";
echo "</td>";

echo "<td>";
echo "Modificar";
echo "</td>";

/*
echo "<td>";
echo "Eliminar";
echo "</td>";
*/

echo "</tr>";
include ("conexion.php");
$cons="SELECT idDescuento,descripcion,cifra FROM descuentos" ;
$res=mysql_query($cons,$conex) or die ("No se realizo con exito la consulta de presentaciones");
$numero_filas=mysql_num_rows($res);
$numero_campos= mysql_num_fields($res);
    while ($fila=mysql_fetch_row($res)){				  
         
echo "<tr>";

echo "<td class='style1' align='center'>";
echo $fila[0];
echo "</td>";

echo "<td class='style1'>";
echo $fila[1];
echo "</td>";

echo "<td class='style1' align='center'>";
echo $fila[2];
echo "</td>";

//Editar
echo "<td class='style4' align='center'>";
echo "<a href='main.php?a=96&idDescuento="; echo $fila[0]; echo "'> <img src='img/icon_edit.jpg' border='0' ALT='Editar descuento'> </a>";
echo "</td>";

/*
//Eliminar
echo "<td class='style4'>";
echo "<a href='deletedescuento.php?idDescuento="; echo $fila[0]; echo "'> <img src='img/icon_delete.jpg' border='0' ALT='Eliminar descuento'> </a>";
echo "</td>";
*/
echo "</tr>";
}
echo "</table>";
mysql_free_result($res);

?>
                </div>
                <p></p></td>
              <td width="49%" valign="top"><p class="style4">Lista de asignaci&oacute;n de descuentos:</p>
                <div>
                  <?php
echo "<table align='center' cellpadding='2' class='tablaBordes' width='300'>";
echo "<tr class='tablaCabecera' align='center'>";

echo "<td>";
echo "ID Descuento";
echo "</td>";

echo "<td>";
echo "Tipo de paciente";
echo "</td>";

/*
echo "<td>";
echo "Modificar";
echo "</td>";

echo "<td>";
echo "Eliminar";
echo "</td>";
*/

echo "</tr>";
include ("conexion.php");
$cons="SELECT idAsignacion,idDescuento,idTipo FROM asignacion_descuentos" ;
$res=mysql_query($cons,$conex) or die ("No se realizo con exito la consulta de presentaciones");
$numero_filas=mysql_num_rows($res);
$numero_campos= mysql_num_fields($res);
    while ($fila=mysql_fetch_row($res)){				  
         
echo "<tr>";

echo "<td class='style1' align='center'>";
echo $fila[1];
echo "</td>";

$cons1="SELECT tipo FROM tipo_pacientes WHERE idTipo='$fila[2]'";
$res1=mysql_query($cons1,$conex);
$tipopac=mysql_result($res1,0,'tipo');
echo "<td class='style1'>";
echo $tipopac;
echo "</td>";

//Editar
/*
echo "<td class='style4' align='center'>";
echo "<a href='main.php?a=941'> <img src='img/icon_edit.jpg' border='0' ALT='Modificar asignación'> </a>";
echo "</td>";
*/

/*
//Eliminar
echo "<td class='style4'>";
echo "<a href='deletedescuento.php?idDescuento="; echo $fila[0]; echo "'> <img src='img/icon_delete.jpg' border='0' ALT='Eliminar descuento'> </a>";
echo "</td>";
*/
echo "</tr>";
}
echo "</table>";
mysql_free_result($res);

?>
                </div></td>
            </tr>
          </table>
</td>
  </tr>
</table>

</body>
</html>
