File: /home/asjudine/www/credito_rotativo_consulta_todos_creditos.php
<?php
global $dbi;
$espacio = ' ';
$linea = '-';
require_once('Conectarse.php')
?>
<!DOCTYPE html>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Listado Credito Rotativo</title>
<meta http-equiv="X-UA-Compatible" content="IE=8; IE=9; IE=edge" />
<style type="text/css">
*{margin: 0;padding: 0;}
body{background-color:#EAEAEA;font-family:Geneva, Arial, Helvetica, sans-serif;}
header {background-color: #B7271F; text-align: center;}
.cerrarsesion{width: auto;background-color: #DBD8C9;color: #000;font-size: 13px;position:absolute;top: 15px;right:10px;z-index:0;padding: 10px;border-radius: 10px;cursor: pointer;}
.cerrarsesion:hover{background-color: #ffffff;color: #000;}
.titulo{width: 100%;text-align: center;background-color: #dbd8c9;color: #b20606;padding: 6px 0;font-size: 18px;}
table{margin: 0 auto;border: 2px solid #bebebe; text-align: center;}
.divirmenu{text-align: center;}
.irmenu{width: 150px;background-color: #1c4fa0;color: #fff; padding: 4px;border-radius: 6px;}
.irmenu:hover{background-color: #67a0d9; color: #000;}
.fecha{background-color: #d6e08b; padding: 2px;color: #000;font-size: 15px; text-align: center;}
td{border: #969696 solid 1px;}
.tdizq{background-color: #EEE; padding: 1px 10px;color: #00135F;font-size: 13px;font-weight: 600; text-align: left;}
.tdcen{background-color: #EEE; padding: 1px 10px;color: #00135F;font-size: 13px;font-weight: 600; text-align: center;}
.tdder{background-color: #EEE; padding: 1px 10px;color: #00135F;font-size: 13px;font-weight: 600; text-align: right;}
.exp{color:#8A0000; font-size:12px;}
.boton1{width:150px;background-color: #ffffff;color: #000;padding: 2px;border:2px solid #580000;border-radius:4px;}
.boton1:hover{background-color: #6f0000;color: #fff;cursor: pointer;}
input[type=text]{border-radius: 5px;padding:3px; width: 80%; background-color: #FFFEF4;}
.tdtitulo{background-color: #e3dec0; color: #b20606; padding: 1px; text-align: center; font-size: 11px; font-weight: 700}
.tdfull{background-color: #fff; color: #000; padding: 1px; text-align: center; font-size: 12px;}
.botonnew{width: 90px; background-color: #e3dec0;color: #b20606;padding: 1px;}
.botonnew:hover{width: 90px; background-color: #cbbd6a;color: #000;padding: 1px;}
</style>
<script type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body>
<header>
<img src="../ELEMENTS/bannerInterasjudinet.png" alt="" width=" 700" height="70">
</header>
<h3 class="titulo">LISTADO DE SOLICITUDES GENERAL - CREDITO ROTATIVO</h3>
<form action="" method="post" name="form1" class="provd" id="form1">
<!--<div align="center">
<table width="566" border="3" cellpadding="3" cellspacing="3" bgcolor="#CCFFFF">
<tr>
<td width="583" colspan="3"><div align="center" class="Estilo50">LISTADO UNIDAD NDFC</div></td>
</tr>
</table>-->
<p align="center">
<input name="menu2" type="button" class="irmenu" id="menu2" onclick="window.location.href='menu_creditos_serviasjudinet.php'" value="IR AL MENU" />
<br>
</p>
<p style="padding-left: 50px;"><br>
<input type="text" placeholder="Buscador:" onkeyup="doSearch()" id="searchTerm" >
</p>
<br>
</form>
</body>
<script type="text/javascript">
function doSearch()
{
var tableReg = document.getElementById('Tabla');
var searchText = document.getElementById('searchTerm').value.toLowerCase();
var cellsOfRow="";
var found=false;
var compareWith="";
for (var i = 1; i < tableReg.rows.length; i++)
{
cellsOfRow = tableReg.rows[i].getElementsByTagName('td');
found = false;
for (var j = 0; j < cellsOfRow.length && !found; j++)
{
compareWith = cellsOfRow[j].innerHTML.toLowerCase();
if (searchText.length == 0 || (compareWith.indexOf(searchText) > -1))
{
found = true;
}
}
if(found)
{
tableReg.rows[i].style.display = '';
} else {
tableReg.rows[i].style.display = 'none';
}
}
}
</script>
</html>
<?php
$control = mysql_query("SELECT DISTINCT(credito_rotativo_inter.numero_libranza), credito_rotativo_inter.cedula, credito_rotativo.apellidos,credito_rotativo.nombres, credito_rotativo.grado, credito_rotativo.rango,credito_rotativo.permanencia, credito_rotativo_inter.cuotas_pendientes, credito_rotativo_inter.cuotas_descontadas, credito_rotativo_inter.saldo_nuevo, credito_rotativo_inter.valor_cuota,credito_rotativo_inter.proveedor,libranza_credito,credito_rotativo_inter.estado,credito_rotativo_inter.causal,credito_rotativo.monto_solicitado,credito_rotativo.valor_anticipo,credito_rotativo.valor_anticipo2,credito_rotativo.valor_anticipo3,credito_rotativo.valor_anticipo4, credito_rotativo_inter.credito_libranza FROM credito_rotativo_inter
LEFT JOIN credito_rotativo ON
credito_rotativo_inter.cedula = credito_rotativo.cedula AND
(credito_rotativo.libranza_credito = credito_rotativo_inter.numero_libranza OR credito_rotativo.libranza_credito = credito_rotativo_inter.credito_libranza)
ORDER BY credito_rotativo.cedula DESC");
if (!$control) {
die('Invalid query 2: ' . mysql_error());
}
if ((mysql_num_rows($control)!=0))
{
echo "<TABLE width='2500' border='2' align='center' cellpadding='2' cellspacing='1' id='Tabla'>
<TR>
<TD class='tdtitulo'>#</TD>
<TD class='tdtitulo'>CEDULA</TD>
<TD class='tdtitulo'>LIBRANZA</TD>
<TD class='tdtitulo'>APELLIDOS</TD>
<TD class='tdtitulo'>NOMBRES</TD>
<TD class='tdtitulo'>GRADO</TD>
<TD class='tdtitulo'>ENTIDAD</TD>
<TD class='tdtitulo'>CUOTAS TOTAL</TD>
<TD class='tdtitulo'>CUOTAS PENDIENTES</TD>
<TD class='tdtitulo'>CUOTAS DESCONTADAS</TD>
<TD class='tdtitulo'>NUEVO SALDO</TD>
<TD class='tdtitulo'>VALOR CUOTA</TD>
<TD class='tdtitulo'>MES</TD>
<TD class='tdtitulo'>AŅO</TD>
<TD class='tdtitulo'>FECHA PAGO</TD>
<TD class='tdtitulo'>NUMERO CUOTA</TD>
<TD class='tdtitulo'>ENTIDAD</TD>
<TD class='tdtitulo'>HISTORICO / VIGENTE</TD>
<TD class='tdtitulo'>CAUSAL TERMINACION</TD>
<TD class='tdtitulo'>TOTAL PAGADO</TD>
<TD class='tdtitulo'>MONTO SOLICITADO</TD>
<TR>";
while(list($numero_libranza,$CEDULA,$APELLIDOS,$NOMBRES,$GRADO,$ENTIDAD,$CUOTAS_TOTAL,$CUOTAS_PENDIENTES, $CUOTAS_DESCONTADAS, $NUEVO_SALDO, $VALOR_CUOTA,$ENTIDAD,$cred,$ESTADO,$causal,$monto_solicitado,$valor_anticipo, $valor_anticipo2, $valor_anticipo3,$valor_anticipo4,$credito_libranza) = mysql_fetch_row($control))
{
$totalAnticipos = ($valor_anticipo + $valor_anticipo2 + $valor_anticipo3 + $valor_anticipo4);
if($totalAnticipos != '0')
{
$monto_solicitado = $totalAnticipos;
}
$sum++;
$control3 = mysql_query("SELECT valor_cuota FROM credito_rotativo_estado_contable WHERE cedula ='".$CEDULA."'");
if (!$control3)
{
die('Invalid query 2: VALOR_CUOTA' . mysql_error());
}
if ((mysql_num_rows($control3)!=0))
{
$VALOR_PAGADO=0;
while(list($valor_cuota) = mysql_fetch_row($control3))
{
$VALOR_PAGADO=($VALOR_PAGADO+$valor_cuota);
//echo "<script>alert('//".$VALOR_PAGADO."');</script>";
}
}else
{
$VALOR_PAGADO=0;
}
$VALOR_PAGADO=round($VALOR_PAGADO);
$control2 = mysql_query("SELECT mes_cuota, ano_cuota, fecha_nomina, credito_rotativo_estado_contable.numero_cuota, descuentos.concepto FROM credito_rotativo_estado_contable LEFT JOIN descuentos ON descuentos.unidad = credito_rotativo_estado_contable.unidad_descuento WHERE cedula =".$CEDULA." AND codigo_descuento = descuentos.codigo ORDER BY numero_cuota DESC LIMIT 1 ");
if (!$control2) {
die('Invalid query 2: ' . mysql_error());
}
if ((mysql_num_rows($control2)!=0))
{
while($consulta = mysql_fetch_assoc($control2))
{
if($ESTADO == 0 || $ESTADO == '0' )
{
$HISTORICO = "HISTORICO";
printf("<tr>
<td class='tdfull'><input type='button' value=$CEDULA name='cedu' class=botonnew onClick =window.open('credito_rotativo_formulario_consulta_estado.php?ced2=$CEDULA&cred=".trim($cred)."','','top=30,left=50,toolbar=yes,scrollbars=yes,width=900,height=630,status=yes')></a></td>
<td style = 'background-color:#FF9393'>".$CEDULA."</td>
<td style = 'background-color:#FF9393'>".$credito_libranza."</td>
<td style = 'background-color:#FF9393'>".$APELLIDOS."</td>
<td style = 'background-color:#FF9393'>".$NOMBRES."</td>
<td style = 'background-color:#FF9393'>".$GRADO."</td>
<td style = 'background-color:#FF9393'>".$ENTIDAD."</td>
<td style = 'background-color:#FF9393'>".$CUOTAS_TOTAL."</td>
<td style = 'background-color:#FF9393'>".$CUOTAS_PENDIENTES."</td>
<td style = 'background-color:#FF9393'>".$CUOTAS_DESCONTADAS."</td>
<td style = 'background-color:#FF9393'>".$NUEVO_SALDO."</td>
<td style = 'background-color:#FF9393'>".$VALOR_CUOTA."</td>
<td style = 'background-color:#FF9393'>".$consulta['mes_cuota']."</td>
<td style = 'background-color:#FF9393'>".$consulta['ano_cuota']."</td>
<td style = 'background-color:#FF9393'>".$consulta['fecha_nomina']."</td>
<td style = 'background-color:#FF9393'>".$consulta['numero_cuota']."</td>
<td style = 'background-color:#FF9393'>".$consulta['concepto']."</td>
<td style = 'background-color:#FF9393'>".$HISTORICO."</td>
<td style = 'background-color:#FF9393'>".$causal."</td>
<td style = 'background-color:#FF9393'>".$VALOR_PAGADO."</td>
<td style = 'background-color:#FF9393'>".$monto_solicitado."</td>
");
}
else
{
$HISTORICO = "VIGENTE";
printf("<tr>
<td class='tdfull'><input type='button' value=$CEDULA name='cedu' class=botonnew onClick =window.open('credito_rotativo_formulario_consulta_estado.php?ced2=$CEDULA&cred=".trim($cred)."','','top=30,left=50,toolbar=yes,scrollbars=yes,width=900,height=630,status=yes')></a></td>
<td >".$CEDULA."</td>
<td>".$credito_libranza."</td>
<td >".$APELLIDOS."</td>
<td >".$NOMBRES."</td>
<td >".$GRADO."</td>
<td >".$ENTIDAD."</td>
<td >".$CUOTAS_TOTAL."</td>
<td >".$CUOTAS_PENDIENTES."</td>
<td >".$CUOTAS_DESCONTADAS."</td>
<td >".$NUEVO_SALDO."</td>
<td >".$VALOR_CUOTA."</td>
<td >".$consulta['mes_cuota']."</td>
<td >".$consulta['ano_cuota']."</td>
<td >".$consulta['fecha_nomina']."</td>
<td >".$consulta['numero_cuota']."</td>
<td >".$consulta['concepto']."</td>
<td >".$HISTORICO."</td>
<td >".$causal."</td>
<td >".$VALOR_PAGADO."</td>
<td >".$monto_solicitado."</td>
");
}
}
}
else
{
if($ESTADO == 0 || $ESTADO == '0' )
{
$HISTORICO = "HISTORICO";
printf("<tr>
<td class='tdfull'><input type='button' value=$CEDULA name='cedu' class=botonnew onClick =window.open('credito_rotativo_formulario_consulta_estado.php?ced2=$CEDULA&cred=".trim($cred)."','','top=30,left=50,toolbar=yes,scrollbars=yes,width=900,height=630,status=yes')></a></td>
<td style = 'background-color:#FF9393'>".$CEDULA."</td>
<td style = 'background-color:#FF9393'>".$credito_libranza."</td>
<td style = 'background-color:#FF9393'>".$APELLIDOS."</td>
<td style = 'background-color:#FF9393'>".$NOMBRES."</td>
<td style = 'background-color:#FF9393'>".$GRADO."</td>
<td style = 'background-color:#FF9393'>".$ENTIDAD."</td>
<td style = 'background-color:#FF9393'>".$CUOTAS_TOTAL."</td>
<td style = 'background-color:#FF9393'>".$CUOTAS_PENDIENTES."</td>
<td style = 'background-color:#FF9393'>".$CUOTAS_DESCONTADAS."</td>
<td style = 'background-color:#FF9393'>".$NUEVO_SALDO."</td>
<td style = 'background-color:#FF9393'>".$VALOR_CUOTA."</td>
<td style = 'background-color:#FF9393'></td>
<td style = 'background-color:#FF9393'></td>
<td style = 'background-color:#FF9393'></td>
<td style = 'background-color:#FF9393'></td>
<td style = 'background-color:#FF9393'></td>
<td style = 'background-color:#FF9393'>".$HISTORICO."</td>
<td style = 'background-color:#FF9393'>".$causal."</td>
<td style = 'background-color:#FF9393'>".$VALOR_PAGADO."</td>
<td style = 'background-color:#FF9393'>".$monto_solicitado."</td>
");
}
else
{
$HISTORICO = "VIGENTE";
printf("<tr>
<td class='tdfull'><input type='button' value=$CEDULA name='cedu' class=botonnew onClick =window.open('credito_rotativo_formulario_consulta_estado.php?ced2=$CEDULA&cred=".trim($cred)."','','top=30,left=50,toolbar=yes,scrollbars=yes,width=900,height=630,status=yes')></a></td>
<td >".$CEDULA."</td>
<td>".$credito_libranza."</td>
<td >".$APELLIDOS."</td>
<td >".$NOMBRES."</td>
<td >".$GRADO."</td>
<td >".$ENTIDAD."</td>
<td >".$CUOTAS_TOTAL."</td>
<td >".$CUOTAS_PENDIENTES."</td>
<td >".$CUOTAS_DESCONTADAS."</td>
<td >".$NUEVO_SALDO."</td>
<td >".$VALOR_CUOTA."</td>
<td ></td>
<td ></td>
<td ></td>
<td ></td>
<td ></td>
<td >".$HISTORICO."</td>
<td >".$causal."</td>
<td >".$VALOR_PAGADO."</td>
<td >".$monto_solicitado."</td>
");
}
}
}
$VALOR_PAGADO=0;
echo "</table>";
echo "<TABLE width='200' border='0' align='center' cellpadding='0' cellspacing='1'>
<TR>
<TD class='tdtitulo'>TOTAL REGISTROS</TD></TD>";
printf("<tr>
<td class='tdfull'>".$sum."</td></td>");
echo "</table>";
}
echo "</form>";
?>