<?php require_once('Connections/cn.php'); ?>
<?php
session_start();
if (!isset($_SESSION['MM_Username'])) {
      header ("Location: modulos/inicio/index.php");
	  }  
 // Captura la c�dula del usuario inici� sesi�n.	  
$cedula_usuario=$_SESSION['CEDULA_USUARIO'];

$currentPage = $_SERVER["PHP_SELF"];

$maxRows_rs_pagos = 10;
$pageNum_rs_pagos = 0;
if (isset($_GET['pageNum_rs_pagos'])) {
  $pageNum_rs_pagos = $_GET['pageNum_rs_pagos'];
}
$startRow_rs_pagos = $pageNum_rs_pagos * $maxRows_rs_pagos;

mysql_select_db($database_cn, $cn);
mysql_query ("SET NAMES 'utf8'");
$query_rs_pagos = "SELECT pagos.nro_comprobante, pagos.concepto_pago,pagos.fecha_registro, pagos.nombre_sede, pagos.nombre_alumno, pagos.carrera, pagos.monto, carreras.nombre_carrera 
FROM pagos, carreras
WHERE pagos.carrera = carreras.id_carrera and pagos.conformado='N'
ORDER BY pagos.fecha_registro
";
$query_limit_rs_pagos = sprintf("%s LIMIT %d, %d", $query_rs_pagos, $startRow_rs_pagos, $maxRows_rs_pagos);
$rs_pagos = mysql_query($query_limit_rs_pagos, $cn) or die(mysql_error());
$row_rs_pagos = mysql_fetch_assoc($rs_pagos);

if (isset($_GET['totalRows_rs_pagos'])) {
  $totalRows_rs_pagos = $_GET['totalRows_rs_pagos'];
} else {
  $all_rs_pagos = mysql_query($query_rs_pagos);
  $totalRows_rs_pagos = mysql_num_rows($all_rs_pagos);
}
$totalPages_rs_pagos = ceil($totalRows_rs_pagos/$maxRows_rs_pagos)-1;

$queryString_rs_pagos = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_rs_pagos") == false && 
        stristr($param, "totalRows_rs_pagos") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_rs_pagos = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_rs_pagos = sprintf("&totalRows_rs_pagos=%d%s", $totalRows_rs_pagos, $queryString_rs_pagos);
?>
<!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>Untitled Document</title>
<link href="css/main.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
	font-size: 16px;
	color: #ff0;
	background-color:#336699;
	font-weight:bold;
	height:20px;
}
.style2 {font-size: 10px}
.style3 {font-size: 10; font-weight: bold; }
.style4 {font-size: 10}
.style5 {
	font-size: 12px;
	color: #000000;
}
.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"  cellpadding="0" cellspacing="0">
  <tr valign="baseline">
      <td colspan="7" align="right" nowrap><div align="center" class="style1" >PAGOS POR CONFORMAR</div></td>
  </tr>
  <tr>
   
    <td><div align="center" class="style7">&nbsp;Comprobante&nbsp;</div></td>
	<td><div align="center" class="style7">&nbsp;Monto&nbsp;</div></td>
    <td><div align="center" class="style7">Concepto</div></td>
    <td><div align="center" class="style7">Fecha Registro</div></td>
    <td><div align="center" class="style7">Programa</div></td>
    <td><div align="center" class="style3 style6 style8">Participante</div></td>
    <td colspan="2"><div align="center" class="style9">Acci&oacute;n</div></td>
  </tr>
  <?php 

  do { ?>
    <tr>
      <td><div align="right" class="style5"><?php echo $row_rs_pagos['nro_comprobante']; ?>&nbsp;&nbsp;</div></td>
	  <td><div align="right" class="style2"><?php echo $row_rs_pagos['monto']; ?>&nbsp;</div></td>
      <td><div align="left" class="style2"><?php echo $row_rs_pagos['concepto_pago']; ?></div></td>
      <td><div align="center" class="style2"><?php echo join ("-",(array_reverse(split("-",$row_rs_pagos['fecha_registro'])))); ?></div></td>
      <td><div align="center" class="style2"><?php echo $row_rs_pagos['nombre_carrera']; ?></div></td>
      <td><div align="center" class="style2"><?php echo $row_rs_pagos['nombre_alumno']; ?></div></td>
      <td><div align="center"><span class="style2"><span class="style4"></span></span><img src="imagenes/accept.png" alt="Conformar" title="Conformar" width="16" height="16" onclick="conformar('<?php echo $row_rs_pagos['nro_comprobante']; ?>',<?php echo $cedula_usuario ?>)"/></div></td>

    </tr>
	<iframe name="frameConformar" id="frameConformar" with="0" height="0" frameborder="0"></iframe>
    <?php } while ($row_rs_pagos = mysql_fetch_assoc($rs_pagos)); ?>
</table>
<br>
<table border="0" width="50%" align="center">
  <tr>
    <td width="23%" align="center"><?php if ($pageNum_rs_pagos > 0) { // Show if not first page ?>
          <a href="<?php printf("%s?pageNum_rs_pagos=%d%s", $currentPage, 0, $queryString_rs_pagos); ?>"><img src="imagenes/resultset_first.png" width="16" height="16" border=0></a>
          <?php } // Show if not first page ?>
    </td>
    <td width="31%" align="center"><?php if ($pageNum_rs_pagos > 0) { // Show if not first page ?>
          <a href="<?php printf("%s?pageNum_rs_pagos=%d%s", $currentPage, max(0, $pageNum_rs_pagos - 1), $queryString_rs_pagos); ?>"><img src="imagenes/resultset_previous.png" width="16" height="16" border=0></a>
          <?php } // Show if not first page ?>
    </td>
    <td width="23%" align="center"><?php if ($pageNum_rs_pagos < $totalPages_rs_pagos) { // Show if not last page ?>
          <a href="<?php printf("%s?pageNum_rs_pagos=%d%s", $currentPage, min($totalPages_rs_pagos, $pageNum_rs_pagos + 1), $queryString_rs_pagos); ?>"><img src="imagenes/resultset_next.png" width="16" height="16" border=0></a>
          <?php } // Show if not last page ?>
    </td>
    <td width="23%" align="center"><?php if ($pageNum_rs_pagos < $totalPages_rs_pagos) { // Show if not last page ?>
          <a href="<?php printf("%s?pageNum_rs_pagos=%d%s", $currentPage, $totalPages_rs_pagos, $queryString_rs_pagos); ?>"><img src="imagenes/resultset_last.png" width="16" height="16" border=0></a>
          <?php } // Show if not last page ?>
    </td>
  </tr>
</table>

</body>
</html>
<?php
mysql_free_result($rs_pagos);
?>
<script type="text/javascript">
function conformar(nro_comprobante,cedula) {
    alert(cedula);
	url="conformar_pago.php?nro_comprobante="+nro_comprobante+"&cedula="+cedula;
	frameConformar.location=url;		
}

</script>