File: /home/asjudine/public_html/listar_devolucion1.php
<?php
// Connect to SQL database
require_once("mainfile.php");
include ("config.php");
global $dbi;
// First query to find out how many records we have
$sql = "Select * from devolucion_carpeta";
$result = mysql_query($sql, $dbi);
// Number of records found
$num_record = mysql_num_rows($result);
// Number of records you want to displayper page
$display = 20;
// Message when no records found
// If there are no records then startrow is 0
if (empty($startrow))
{
$startrow=0;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Listado general Devolucion Juridica </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-image: url();
}
.Estilo21 {
font-weight: bold;
font-family: "Arial Narrow";
}
.texto {font-size: 11px; font-family: Arial; color:#990000; display: block;}
.titulos {font-size: 11px; font-family: Arial; color: blue; font-weight:bold }
-->
</style>
<script languaje="JavaScript">
function Mostrar_Fecha()
{
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado")
var montharray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre")
document.write("<b><font face='Arial, Helvetica, sans-serif'>"+dayarray[day]+" "+daym+" de "+montharray[month]+" de "+year+"</font></b>")
}
</script>
<table width="950" border="0" align="center" cellpadding="3" cellspacing="3">
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="8" align="right" nowrap><div align="center" class="Estilo21">LISTADO TOTAL DE DEVOLUCIONES </div></td>
</tr>
<tr valign="baseline" bgcolor="#0099FF">
<td colspan="8" align="right" nowrap bgcolor="#FFFFCC"><div align="center">
<script languaje="JavaScript">Mostrar_Fecha()</script>
</div></td>
</tr>
</table>
<table width="850" border="0" align="center" cellpadding="3" cellspacing="3">
<tr bgcolor="#3399FF">
<td width="30" align="right" nowrap><div align="center"><span class="titulos">#Reg.</span></div></td>
<td width="55" align="right" nowrap><div align="center"><span class="titulos">Cédula</span></div></td>
<td width="187" align="right" nowrap><div align="center"><span class="titulos">Apellidos y Nombres</span></div></td>
<td width="50" align="right" nowrap><div align="center"><span class="titulos"># carpeta</span></div></td>
<td width="74" align="right" nowrap><div align="center"><span class="titulos">Cuenta cobro</span></div></td>
<td width="157" align="right" nowrap><div align="center"><span class="titulos">Motivo</span></div></td>
<td width="106" align="right" nowrap><div align="center"><span class="titulos">Capital Recuperado</span></div></td>
<td width="47"><div align="center"><span class="titulos">Número Oficio</span></div></td>
<td width="60" colspan="2"><div align="center"><span class="titulos">Fecha devolución</span></div></td>
<?php
function Conectarse()
{
if (!($link=@mysql_connect("localhost","asjudine","as2006")))
{
echo "Error conectando con el servidor.";
exit();
}
$dbname = "asjudinet";
if (!@mysql_select_db($dbname,$link))
{
echo "Error seleccionando la base de datos.";
exit();
}
return $link;
}
Conectarse();
$result = mysql_query('SELECT cedula , nombre_completo FROM cobranzas WHERE cedula_funcionario = "52910677" ');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
if($result)
{
$n=0;
while(list($cedy , $nom) = mysql_fetch_row($result))
{
$resu = mysql_query('SELECT cuenta_cobro, numero_carpeta , cedula, motivo, capital_recuperado, oficio_dev_num, fecha FROM devolucion_carpeta WHERE cedula = "' ."$cedy". '" ');
if (!$resu) {
die('Invalid query: ' . mysql_error());
}
list($cc, $nc, $ced, $mov, $cr, $odn, $fecha) = mysql_fetch_row($resu);
if ($ced == $cedy)
{
//$mssql = "select nombre_completo from cobranzas where cedula = $ced";
//$con = mysql_query($mssql, $dbi);
$resul = mysql_query('SELECT nombre_completo FROM cobranzas WHERE cedula = "' ."$ced". '" ');
if (!$resul) {
die('Invalid query: ' . mysql_error());
}
if($resul)
{
list($nom) = mysql_fetch_row($resul);
}
$tres=substr($fecha, 0, 4);
$dos=substr($fecha, 5, 2);
$uno=substr($fecha, 8, 2);
$fecha = ($uno."-".$dos."-".$tres);
$startrow = $startrow + 1;
printf("<tr>
<td bgcolor='#ECE9D8'><div align='center' class='texto'><em>".$startrow."</a></span></em></div></td>
<td bgcolor='#C5D6FC'><div align='center' class='texto'>".$cedy."</span></div></td>
<td bgcolor='#C5D6FC'><div align='left' class='texto'>".$nom."</span></div></td>
<td bgcolor='#ECE9D8'><div align='center' class='texto'><a href=\"consultar_cobranzas.php?id=$ced&carpeta=$nc\" target='_blank'>".$nc."</a></span></div></td>
<td bgcolor='#ECE9D8'><div align='center' class='texto'>".$cc."</span></div></td>
<td bgcolor='#C5D6FC'><div align='left' class='texto'>".$mov."</span></div></td>
<td bgcolor='#C5D6FC'><div align='center' class='texto'>".$cr."</span></div></td>
<td bgcolor='#C5D6FC'><div align='center' class='texto'>".$odn."</span></div></td>
<td bgcolor='#C5D6FC'><div align='center' class='texto'>".$fecha."</span></div></td>");
}
} //Terminación del ciclo while
echo "</tr></table>";
if ($startrow != 0)
{
$prevrow = $startrow - $display;
print("<a href=\"$PHP_SELF?startrow=$prevrow\">Anterior</a> ");
}
$pages = intval($num_record / $display);
if ($num_record % $display)
{
$pages++;
}
if ($pages > 1)
{
for ($i=1; $i <= $pages; $i++)
{
$nextrow = $display * ($i - 1);
print("<a href=\"$PHP_SELF?startrow=$nextrow\">$i</a> ");
}
}
if (!(($startrow / $display) == $pages) && $pages != 1)
{
$nextrow = $startrow + $display;
print("<a href=\"$PHP_SELF?startrow=$nextrow\">Siguiente</a>");
}
if ($num_record < 1)
{
print("<table border=0 width=795><tr><td>$XX</td></tr></table>");
}
} // cierra la condición
?>
<table width="675" align="center">
<tr>
<td width="667" bgcolor="#ECE9D8"><div align="center">
<input name="button" type="button" style="font-family: Verdana; font-size: 8 pt; color: #000080; background-color: #C0C0C0; border-style: solid" onclick="window.location.href='menu_cobranzas_jur1.php'" value="Volver al Menú">
</div></td>
</tr>
</table>