File: /home/asjudine/www/consulta_procesos_registros.php
<?php
require_once("mainfile.php");
include ("config.php");
global $dbi;
require_once("Conectarse.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=utf-8" />
<title>Consulta Procesos Cartera Nomina</title>
<style type="text/css">
<!--
.recaudo {font-family: "Courier New", Courier, monospace;
font-size: 12px;
font-style: normal;
font-weight: bold;
font-variant: normal;
color: #000000;
background-color: #B6CBDC;
margin: 4px;
padding: 8px;
width: auto;
border: medium outset #339966;
}
.est_cont1 {
font-family: "Times New Roman", Times, serif;
font-size: 12px;
font-style: normal;
font-weight: normal;
color: #4068F4;
background-color: #E6FFF1;
margin: 1px;
padding: 1px;
height: auto;
width: auto;
border: thin double #33CC66;
}
.est_cont2 {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
font-weight: normal;
color: #418BAF;
background-color: #F0F5CF;
height: 15px;
width: auto;
border: thin solid #FABF85;
}
.est_cont3 {
font-family: "Courier New", Courier, monospace;
font-size: 12px;
font-style: normal;
font-weight: normal;
color: #EA261C;
background-color: #DEDDE8;
height: auto;
width: auto;
border: thin outset #FC9F67;
}
.est_cont5 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
font-weight: normal;
background-color: #D6ECFE;
margin: 2px;
padding: 2px;
height: auto;
width: auto;
border: thin groove #E9AAF0;
color: #C72350;
}
.Estilo50 {color: #CC3333;
font-family: "Arial Narrow";
font-weight: bold;
}
.fecha {font-size: 12px; font-family: Arial; color:#990000; display: block; }
.titulos {font: 16px; color: red; font-family:Arial; font-weight:bold}
.Estilo51 {
font-size: 14px;
font-weight: bold;
}
.col_cre2 { font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
font-weight: bold;
color: #F92F0B;
background-color: #B3D9F0;
height: auto;
width: auto;
border: medium groove #FC9227;
}
.est_cont21 { font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
font-weight: normal;
color: #2B39EC;
background-color: #F0F5CF;
height: 18px;
width: auto;
border: thin solid #FABF85;
}
.Estilo2 {font-family: Arial; font-size: 16px; color: #990000;}
.campo {
background-color:#FFFFAA;
width: 80px;
border:2px solid #990000;
height: 17px;
}
.Estilo53 {font-family: Arial; font-size: 12px; color: #990000; }
.Estilo54 {
color: #0066FF;
font-weight: bold;
}
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="720" border="0" align="center" cellpadding="2" cellspacing="2">
<tr bgcolor="#FFFFCC">
<td colspan="4" class="titulos"><div align="center">CONSULTA PROCESOS DE CARTERA NOMINA</div></td>
</tr>
<tr bgcolor="#ECE9D8">
<tr bgcolor="#FFCC99">
<td width="200" align="right" bgcolor="#0066FF" class="Estilo53"><strong>FECHA DE REGISTRO:</strong>
<input name="fecha1" type="text" id="fecha1" size="12" maxlength="14" value="0000-00-00" /></td>
</tr>
<tr bgcolor="#FFCC99">
<td colspan="4" bgcolor="#FFFFFF"><div align="center">
<input name="consultar" type="submit" class="stilo53" id="consultar" value="Consultar" />
</div></td>
</tr>
<tr bgcolor="#FFCC99">
<td colspan="4" bgcolor="#CCCCCC"><div align="center">
<input name="menu2" type="button" class="Estilo50" id="menu2" onclick="window.location.href='menu_comisiones.php'" value="IR AL MENU" />
<label></label>
</div></td>
</tr>
</table>
<div align="left"></div>
<div align="left"></div>
<div align="right"></div>
</div>
</form>
</body>
</html>
<?php
if(isset($_POST["consultar"]))
{
$cont = mysql_query('SELECT cedula,nombre,contrato,unidad_descuento,valor_cuota ,fecha_registro ,contratotipo,codigo_descuento FROM cartera_estado_contable WHERE fecha_registro = "' .$_POST[fecha1]. '" and unidad_descuento="CPRN"order by nombre');
if (!$cont) {
die('Invalid query aaaa ' . mysql_error());
}
if ((mysql_num_rows($cont)!=0))
{
echo "<table width='400' border='3' align='center' cellpadding='2' cellspacing='2' class='est_cont5'>
<tr>
<td width='70'><div align='center'><strong>CEDULA</strong></div></td>
<td width='70'><div align='center'><strong>CEDULA</strong></div></td>
<td width='140'><div align='center'><strong>NOMBRE</strong></div></td>
<td width='70'><div align='center'><strong>PROCESOS</strong></div></td>
<td width='70'><div align='center'><strong>NUMERO CONTRATO</strong></div></td>
<td width='50'><div align='center'><strong>FECHA ULTIMO REGISTRO</strong></div></td>
<td width='70'><div align='center'><strong>UNIDAD</strong></div></td>
<td width='70'><div align='center'><strong>VALOR CUOTA</strong></div></td>
<td width='70'><div align='center'><strong>TIPO DE CONTRATO</strong></div></td>
<td width='70'><div align='center'><strong>CODIGO</strong></div></td>
</tr>";
while(list($cedt, $nombre, $numcon,$tipo,$valorcuota,$fecha_ultimo_registro, $cuotaspendientes, $cuotasdescontadas , $saldonuevo) = mysql_fetch_row($cont))
{
$con = mysql_query('SELECT numero_proceso FROM procesos WHERE cedula = "' .$cedt.'" and numero_contrato = "' .$numcon.'" ');
if (!$con) {
die('Invalid query 2: ' . mysql_error());
}
if ((mysql_num_rows($con)!=0))
{
list($numpro) = mysql_fetch_row($con);
}
else {
$numpro="SIN-PROCESO";
}
$tota = $tota + $val;
$nuer = $nuer + 1 ;
printf("<TR>
<TD bgcolor='#CCCCCC'><div align='center' class='lista'><input type='button' value=$cedt name='cedu' class=Estilo51 onClick =window.location.href='procesos_consulta_cartera_nomina.php?ced2=$cedt&numcon=$numcon&tipo=$tipo'></a></span></div></TD>
<TD bgcolor='#CCCCCC'><div align='center' class='lista'>".$cedt."</span></div></TD>
<TD bgcolor='#CCCCCC'><div align='center' class='lista'>".$nombre."</span></div></TD>
<td bgcolor='#CCCCCC'><div align='center' class='lista'><input type='button' value=$numpro name='numpro' class=Estilo51 onClick =window.open('visualizar_procesos.php?ced2=$ceduben&proceso=$numpro','','top=50,left=100,toolbar=no,scrollbars=yes,width=950,height=550,status=yes')></a></span></div></td>
<TD bgcolor='#CCCCCC'><div align='center' class='lista'>".$numcon."</span></div></TD>
<TD bgcolor='#CCCCCC'><div align='center' class='lista'>".$fecha_ultimo_registro."</span></div></TD>
<TD bgcolor='#CCCCCC'><div align='center' class='lista'>".$tipo."</span></div></TD>
<TD bgcolor='#CCCCCC'><div align='center' class='lista'>".$valorcuota."</span></div></TD>
<TD bgcolor='#CCCCCC'><div align='center' class='lista'>".$cuotaspendientes."</span></div></TD>
<TD bgcolor='#CCCCCC'><div align='center' class='lista'>".$cuotasdescontadas."</span></div></TD> <TD bgcolor='#CCCCCC'><div align='center' class='lista'>".$saldonuevo."</span></div></TD>
</TR>");
}
echo "</table>";
echo "<width='400' border='2' align='center' cellpadding='1' cellspacing='1' class='est_cont5' >
<tr>
<td width='70'><div align='center'><strong>TOTAL REGISTROS</strong></div></td>
</tr>";
printf("<TR>
<TD bgcolor='#CCCCCC'><div align='center' class='lista'>".$nuer."</span></div></TD> </TR>");
}
else
{
echo "NO HAY REGISTROS";
}
echo "</form>";
}
if(isset($_POST["eliminar"]))
{
$cont = mysql_query('SELECT cedula,nombre,numerocontrato,unidad_descuento,valorcuota,fecha_ultimo_registro,cuotaspendientes,cuotasdescontadas,
saldonuevo, saldoanteior FROM cartera_serviasjudinet WHERE fecha_ultimo_registro = "' .$_POST[fecha1]. '" and unidad_descuento="NNEE" and grado="SLP"
order by nombre');
if (!$cont) {
die('Invalid query aaaa ' . mysql_error());
}
if ((mysql_num_rows($cont)!=0))
{
while(list($cedt, $nombre, $numerocontrato,$unidad_descuento,$valorcuota,$fecha_ultimo_registro, $cuotaspendientes, $cuotasdescontadas , $saldonuevo,$saldoanteior ) = mysql_fetch_row($cont))
{
$result = mysql_query('DELETE FROM cartera_estado_contable WHERE cedula = "' .$cedt. '" and nombre= "' . $nombre . '" and contrato= "' . $numerocontrato . '" and fecha_nomina = "' . $_POST[fecha1] . '" ');
if (!$result) {
die('Invalid delete 1: ' . mysql_error());
}
$cuotaspendientes=$cuotaspendientes + 1;
$cuotasdescontadas=$cuotasdescontadas-1;
$saldonuevo=$saldonuevo+$valorcuota;
$saldoanteior=$saldoanteior+$valorcuota;
$cont3 = mysql_query('SELECT MAX(fecha_nomina) FROM cartera_estado_contable WHERE cedula = "'.$cedt.'" and contrato = "'.$numerocontrato.'" ');
if (!$cont3) {
die('Invalid query aaaa ' . mysql_error());
}
list($ultimfecha) = mysql_fetch_row($cont3);
echo $ultimfecha;
$modificar = mysql_query("UPDATE cartera_serviasjudinet set fecha_ultimo_registro='" .$ultimfecha. "', saldoanteior = '" .$saldoanteior. "', cuotaspendientes = '" . $cuotaspendientes . "', cuotasdescontadas = '" . $cuotasdescontadas . "',saldonuevo= '" .$saldonuevo . "' WHERE cedula = '" . $cedt . "' and numerocontrato = '" . $numerocontrato . "' ");
if (!$modificar) {
die('Invalid query cartera_serviasjudinet MODIFICAR: ' . mysql_error());
}
}
}
echo "<script>alert('El proceso se ha eliminado');</script>";
}
?>