<?php require_once('Connections/conn.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];

$maxRows_tblMatriculas = 20;
$pageNum_tblMatriculas = 0;
if (isset($_GET['pageNum_tblMatriculas'])) {
  $pageNum_tblMatriculas = $_GET['pageNum_tblMatriculas'];
}
$startRow_tblMatriculas = $pageNum_tblMatriculas * $maxRows_tblMatriculas;

mysql_select_db($database_conn, $conn);
mysql_query ("SET NAMES 'utf8'");
$query_tblMatriculas = "SELECT * FROM carreras where status='ACTIVA' ORDER BY carreras.nombre_carrera";
$query_limit_tblMatriculas = sprintf("%s LIMIT %d, %d", $query_tblMatriculas, $startRow_tblMatriculas, $maxRows_tblMatriculas);
$tblMatriculas = mysql_query($query_limit_tblMatriculas, $conn) or die(mysql_error());
$row_tblMatriculas = mysql_fetch_assoc($tblMatriculas);

if (isset($_GET['totalRows_tblMatriculas'])) {
  $totalRows_tblMatriculas = $_GET['totalRows_tblMatriculas'];
} else {
  $all_tblMatriculas = mysql_query($query_tblMatriculas);
  $totalRows_tblMatriculas = mysql_num_rows($all_tblMatriculas);
}
$totalPages_tblMatriculas = ceil($totalRows_tblMatriculas/$maxRows_tblMatriculas)-1;

$queryString_tblMatriculas = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_tblMatriculas") == false && 
        stristr($param, "totalRows_tblMatriculas") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_tblMatriculas = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_tblMatriculas = sprintf("&totalRows_tblMatriculas=%d%s", $totalRows_tblMatriculas, $queryString_tblMatriculas);
?><!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=utf-8" />
<title>sadce -- matriculas</title>
<link href="css/main.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
	font-size: 16px;
	font-weight: bold;
	color: #CCFF00;
}
.style0 {color: #FFFF00}
.style2 {font-size: 10px}
.style3 {font-size: 10; font-weight: bold; }
.style4 {font-size: 10}
.style5 {
	font-size: 12px;
	font-weight: bold;
	color: #004980;
}
.style6 {font-size: 12px}
.style7 {font-size: 12px; font-weight: bold; color: #004080; }
.style8 {color: #004080}
.style9 {font-size: 10; font-weight: bold; color: #004080; }
-->
</style>
</head>

<body>
<table width="100%" border="1" align="center" cellpadding="0" cellspacing="0">
  <tr id="titulo1">
      <td colspan="6"><div align="center" class="hr style1 style0">COSTO DE LAS MATRICULAS </div></td>
    </tr>
  <tr id="titulo1">
    <td align="center">Código</td>
    <td align="center">Nombre del Programa</td>
    <td align=""><div align="center">Participantes Nuevo Ingreso (Bs.)</div></td>
    <td align="center">Participantes Regulares (Bs.)</td>
  </tr>
  <?php do { ?>
    <tr>
      <td><div align="center"><?php echo $row_tblMatriculas['id_carrera']; ?></div></td>
	 
      <td><?php echo $row_tblMatriculas['nombre_carrera']; ?></td>
      <td><div align="right"><?php echo number_format($row_tblMatriculas['costo_inscripcion'],2, ",", "."); ?></div></td>
      <td><div align="right"><?php echo number_format($row_tblMatriculas['costo_regular'],2, ",", "."); ?></div></td>
    </tr>
    <?php } while ($row_tblMatriculas = mysql_fetch_assoc($tblMatriculas)); ?>
</table>
&nbsp;
&nbsp;



<table border="0" width="100%" align="center">
  <tr>
    <td width="23%" align="center"><?php if ($pageNum_tblMatriculas > 0) { // Show if not first page ?>
          <a href="<?php printf("%s?pageNum_tblMatriculas=%d%s", $currentPage, 0, $queryString_tblMatriculas); ?>"><img src="imagenes/resultset_first.png" border=0></a>
          <?php } // Show if not first page ?>
    </td>
    <td width="31%" align="center"><?php if ($pageNum_tblMatriculas > 0) { // Show if not first page ?>
          <a href="<?php printf("%s?pageNum_tblMatriculas=%d%s", $currentPage, max(0, $pageNum_tblMatriculas - 1), $queryString_tblMatriculas); ?>"><img src="imagenes/resultset_previous.png" border=0></a>
          <?php } // Show if not first page ?>
    </td>
    <td width="23%" align="center"><?php if ($pageNum_tblMatriculas < $totalPages_tblMatriculas) { // Show if not last page ?>
          <a href="<?php printf("%s?pageNum_tblMatriculas=%d%s", $currentPage, min($totalPages_tblMatriculas, $pageNum_tblMatriculas + 1), $queryString_tblMatriculas); ?>"><img src="imagenes/resultset_next.png" border=0></a>
          <?php } // Show if not last page ?>
    </td>
    <td width="23%" align="center"><?php if ($pageNum_tblMatriculas < $totalPages_tblMatriculas) { // Show if not last page ?>
          <a href="<?php printf("%s?pageNum_tblMatriculas=%d%s", $currentPage, $totalPages_tblMatriculas, $queryString_tblMatriculas); ?>"><img src="imagenes/resultset_last.png" border=0></a>
          <?php } // Show if not last page ?>
    </td>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result($tblMatriculas);
?>
