File: /home/asjudine/public_html/cartera_cargar_manual_deb_c.php
<?php
require_once("mainfile.php");
include ("config.php");
global $dbi;
require_once("Conectarse.php");
$sql5 = mysql_query('SELECT * FROM causales_rechazo_debitos order by codigo ');
if (!$sql5) {
die('Invalid query: ' . mysql_error());
}
$row_sql = mysql_fetch_assoc($sql5);
$totalRows_sql = mysql_num_rows($sql5);
if(isset($_POST["guardar"]))
{
$fecha_act=date ( "Y-n-j" );
$cuotap = $_POST[cuo] - ($_POST[cuotad]+1);
$cuotad = $_POST[cuotad] + 1;
// $sal = $_POST[nue];
// $nue = $_POST[nue] - $_POST[valcuo] ;
$control5 = mysql_query('SELECT codigo, unidad FROM descuentos WHERE id = "' . $_POST[unidt] . '" ');
if (!$control5) {
die('Invalid query: ' . mysql_error());
}
list($codcd, $unidt) = mysql_fetch_row($control5);
$guardar = mysql_query("INSERT INTO debitos_estado_contable (cedula, nombre, cuota, valor_cuota, usuarios, fecha_registro, codigo_descuento, unidad_descuento) VALUES ('" .$_GET[ced2]. "', '" . $_POST["ape"] . "', '" . $_POST["cuono"] . "', '" . $_POST["valcuo"] . "', '" . $_POST["usua"] . "', '" . $_POST["fechanom"] . "', '" . $codcd . "','" .$unidt. "')");
if (!$guardar) {
die('Invalid query 1 guardar: ' . mysql_error());
}
$mssql13 = mysql_query("UPDATE debitos set cuotas_pend = '".$cuotap."',cuotas_desc = '".$cuotad."' WHERE cedula = '".$_GET[ced2]."' ");
if (!$mssql13) {
die('Invalid query cartera_serviasjudinet MODIFICAR: ' . mysql_error());
}
echo "<script>alert('La informacion fue grabada correctamente');</script>";
}
$control = mysql_query('SELECT cedula, nombres, dirrecion , telefono, celular, ciudad , email,entidad_laboral, cuenta, banco,tipo_debito, unidad_desc, codigo_desc, valor_credito,cuotas, valor_debitar,fecha_registro, cuotas_pend, cuotas_desc,fecha_debito,usuarios,situacion FROM debitos WHERE cedula = "' . $_GET["ced2"] . '" ');
if (!$control) {
die('Invalid query 1: ' . mysql_error());
}
$num=mysql_num_rows($control);
list($cedula, $apes, $dire, $tele, $celul, $ciud, $email,$entidad, $cue, $ban,$tipo_debito, $unides, $codides, $valcon, $numcuo, $valcuo,$fechaul,$cupen, $cudesc,$diadebito,$usuarios,$situacion) = mysql_fetch_row($control);
$inipag = $anoini.'-'.$mesini;
if ($plan > 0)
{
$cont10 = mysql_query('SELECT codigo_contrato FROM planes_contratos WHERE codigo = "'."$plan".'" ');
if (!$cont10) {
die('Invalid query 42: ' . mysql_error());
}
list($plan) = mysql_fetch_row($cont10);
}
$contable = mysql_query('SELECT MAX(id) FROM cartera_estado_contable WHERE cedula = "'.$_GET["ced2"].'" and contrato = "'.$_GET["numcon"]. '" ORDER BY cuota ASC ');
if (!$contable) {
die('Invalid query: ' . mysql_error());
}
list($idcontable) = mysql_fetch_row($contable);
$contable = mysql_query('SELECT mescuota,anocuota FROM cartera_estado_contable WHERE id = "'.$idcontable.'" ORDER BY cuota ASC ');
if (!$contable) {
die('Invalid query: ' . mysql_error());
}
list($mesapli, $anoapli) = mysql_fetch_row($contable);
$mesplaicado = $mesapli;
$sql2 = mysql_query('SELECT * FROM descuentos WHERE estado = "1" and tipo= "VIGENTE" || tipo= "MIXTO" order by unidad');
if (!$sql2) {
die('Invalid query: ' . mysql_error());
}
$cont18 = mysql_query('SELECT concepto FROM causales_rechazo_debitos WHERE codigo = "'.$causal_rechazo.'" ');
if (!$cont18) {
die('Invalid query 42: ' . mysql_error());
}
list($causal_rechazo) = mysql_fetch_row($cont18);
$row_sql2 = mysql_fetch_assoc($sql2);
$totalRows_sql2 = mysql_num_rows($sql2);
?>
<!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>
<script languaje="JavaScript">
document.onkeydown = function(){
if(window.event && window.event.keyCode == 116){
window.event.keyCode = 505;
}
if(window.event && window.event.keyCode == 505){
return false;
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Estado Contable - Coomanufacturas</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: #000000;
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;
}
.Estilo4 {
color: #2A1FFF;
font-size: 18px;
font-family: Georgia, "Times New Roman", Times, serif;
}
.Estilo55 {font-weight: bold; font-family: "Arial Narrow";}
.Estilo56 {color: #003366; }
.Estilo57 {color: #000099}
.Estilo58 {color: #000000}
.Estilo59 {color: #FF0000}
.Estilo60 {color: #000099; font-weight: bold; }
.Estilo62 {color: #003366; font-weight: bold; }
-->
body {
background-image: url(ELEMENTOS/azul1.jpg);
}
</style>
</head>
<body>
<center> <img src="ELEMENTOS\CABEZOTE SERVIASJUDINET.jpg" WIDTH=50% > </center>
<form action="" method="post" name="formulario" onSubmit="return Valida_Fecha(this)">
<div align="center">
<br>
<div align="center" class="Estilo4">CARGUE MANUAL DEBITOS POSITIVOS</div>
<p>
<input name="menu2" type="button" class="Estilo50" id="menu2" onclick="window.location.href='menu_cartera_debito.php'" value="IR AL MENU" />
</p>
<div align="left"></div>
<div align="left"></div>
<div align="right"></div>
<table width="700" border="5" cellpadding="1" cellspacing="1">
<tr>
<th width="116" height="23" bgcolor="#FFFFFF"><span class="Estilo57">Cedula :</span></th>
<th width="124" bgcolor="#DFDFDF"><div align="left" class="Estilo56">
<input name="ced" type="text" class="Estilo55" id="ced" value="<?php echo $cedula ?>" size="22" maxlength="22" readonly="" />
</div></th>
<th width="119" bgcolor="#FFFFFF"><span class="Estilo57"> Nombres :</span></th>
<th colspan="3" bgcolor="#DFDFDF"><div align="left">
<input name="ape" type="text" class="Estilo55" id="ape" value="<?php echo $apes ?>" size="60" maxlength="60" readonly="" />
</div></th>
</tr>
<tr>
<th bgcolor="#FFFFFF"><span class="Estilo57">Banco :</span></th>
<th bgcolor="#CCCCCC"><div align="left" class="Estilo56">
<input name="ban" type="text" class="Estilo55" id="ban" value="<?php echo $ban ?>" size="22" maxlength="22" readonly="" />
</div></th>
<th bgcolor="#FFFFFF"><span class="Estilo57">No Cuenta :</span></th>
<th width="71" bgcolor="#DFDFDF"><div align="left" class="Estilo57">
<input name="nocuen" type="text" class="Estilo55" id="nocuen" value="<?php echo $cue ?>" size="13" maxlength="13" readonly="" />
</div></th>
<th width="134" bgcolor="#FFFFFF"><span class="Estilo57">Fecha Afiliacion :</span></th>
<th width="101" bgcolor="#DFDFDF" class="Estilo55"><div align="left" class="Estilo58">
<input name="fec" type="text" class="Estilo55" id="fec" value="<?php echo $fechafil ?>" size="10" maxlength="10" readonly="" />
</div></th>
</tr>
<tr>
<th bgcolor="#FFFFFF"><span class="Estilo57">Valor A Debitar:</span></th>
<th bgcolor="#DFDFDF"><div align="left" class="Estilo56">
<input name="val" type="text" class="Estilo55" id="val" value="<?php echo $valcuo ?>" size="22" maxlength="22" readonly="" />
</div></th>
<th bgcolor="#FFFFFF"><span class="Estilo57">No Cuotas :</span></th>
<th bgcolor="#DFDFDF"><div align="left" class="Estilo57">
<input name="cuo" type="text" class="Estilo55" id="cuo" value="<?php echo $numcuo ?>" size="3" maxlength="2" readonly="" />
</div></th>
<th bgcolor="#FFFFFF"><span class="Estilo57">Valor Cuota :</span></th>
<th bgcolor="#DFDFDF" class="Estilo55"><div align="left" class="Estilo58">
<input name="valcuo2" type="text" class="Estilo55" id="valcuo2" value="<?php echo $valcuo ?>" size="18" maxlength="18" readonly="" />
</div></th>
</tr>
<tr>
<th bgcolor="#FFFFFF"><span class="Estilo57">Entidad Laboral :</span></th>
<th bgcolor="#DFDFDF"><div align="left" class="Estilo56">
<input name="sal" type="text" class="Estilo55" id="sal" value="<?php echo $entidad ?>" size="22" maxlength="22" readonly="" />
</div></th>
<th bgcolor="#FFFFFF"><span class="Estilo57">Cuotas Pendientes :</span></th>
<th bgcolor="#DFDFDF"><div align="left" class="Estilo57">
<input name="cuotap" type="text" class="Estilo55" id="cuotap" value="<?php echo $cupen ?>" size="3" maxlength="2" readonly="" />
</div></th>
<th bgcolor="#FFFFFF"><span class="Estilo57">Tipo Debito :</span></th>
<th bgcolor="#DFDFDF" class="Estilo55"><div align="left" class="Estilo58">
<input name="nue" type="text" class="Estilo55" id="nue" value="<?php echo $tipo_debito ?>" size="18" maxlength="18" readonly="" />
</div></th>
</tr>
<tr>
<th bgcolor="#FFFFFF"><span class="Estilo57">Usuario :</span></th>
<th bgcolor="#DFDFDF"><div align="left" class="Estilo56">
<input name="fecini" type="text" class="Estilo55" id="fecini" value="<?php echo $usuarios ?>" size="15" maxlength="15" readonly="" />
</div></th>
<th bgcolor="#FFFFFF"><span class="Estilo57">Cuotas Descontadas :</span></th>
<th bgcolor="#DFDFDF"><div align="left" class="Estilo57">
<input name="cuotad" type="text" class="Estilo55" id="cuotad" value="<?php echo $cudesc ?>" size="3" maxlength="2" readonly="" />
</div></th>
<th bgcolor="#FFFFFF"><span class="Estilo57">Fecha Registro:</span></th>
<th bgcolor="#DFDFDF" class="Estilo55"><div align="left" class="Estilo58">
<input name="fecult" type="text" class="Estilo55" id="fecult" value="<?php echo $fechaul ?>" size="10" maxlength="10" readonly="" />
</div></th>
</tr>
<tr>
<th bgcolor="#FFFFFF" ><span class="Estilo57">Situacion</span></th>
<th bgcolor="#DFDFDF"><div align="left" class="Estilo57">
<input name="numcont" type="text" class="Estilo55" id="numcont" value="<?php echo $situacion ?>" size="10" maxlength="10" readonly="" />
</div></th>
<th bgcolor="#FFFFFF" ><span class="Estilo57">Dia Debito :</span></th>
<th bgcolor="#DFDFDF"><div align="left" class="Estilo57">
<input name="plan" type="text" class="Estilo55" id="plan" value="<?php echo $diadebito?>" size="5" maxlength="5" readonly="" />
</div></th>
<th bgcolor="#FFFFFF" ><span class="Estilo57">Mes Aplicado :</span></th>
<th bgcolor="#DFDFDF" colspan="4"><div align="left" class="Estilo57">
<input name="mesplaicado" type="text" class="Estilo55" id="mesplaicado" value="<?php echo $mesplaicado ?>" size="10" maxlength="10" readonly="" />
</div></th>
</tr>
<tr>
<th bgcolor="#FFFFFF" ><span class="Estilo57">Unidad :</span></th>
<th bgcolor="#DFDFDF" colspan="5"><div align="left" class="Estilo57">
<input name="unida" type="text" class="Estilo55" id="unida" value="<?php echo $unides ?>" size="10" maxlength="10" readonly="" />
</div></th>
</tr>
</table>
<p><span class="Estilo62">INGRESAR PAGO</span></p>
<table width="424" border="5" class="est_cont1">
<tr>
<th width="84" height="19" bgcolor="#CCFFFF" scope="col"><div align="right" class="Estilo57 Estilo52"><strong>Valor :</strong></div></th>
<th width="79" bgcolor="#CCFFFF" scope="col"><div align="left">
<input name="valcuo" type="text" class="Estilo55" id="valcuo" value="<?php echo $valor ?>" size="13" maxlength="13"/>
</div></th>
<th width="119" bgcolor="#CCFFFF" scope="col"><div align="right" class="Estilo57 Estilo52"><strong>Cuota :</strong></div></th>
<th width="112" bgcolor="#CCFFFF" scope="col"><div align="left">
<input name="cuono" type="text" class="Estilo55" id="cuono" value="<?php echo $cuota ?>" size="13" maxlength="13"/>
</div></th>
</tr>
<tr>
<td bgcolor="#CCFFFF"><div align="right" class="Estilo57 Estilo52"><strong>Fecha Pago :</strong></div></td>
<td bgcolor="#CCFFFF"><div align="left">
<input name="fechanom" type="text" class="Estilo55" id="fechanom" value="<?php echo $fechanom ?>" size="13" maxlength="13"/>
</div></td>
<td bgcolor="#CCFFFF"><div align="right" class="Estilo57 Estilo52"><strong>Unidad y Codigo:</strong></div></td>
<td colspan="2" bgcolor="#CCFFFF"><select name="unidt" class="Estilo55" id="unidt">
<option>--SELECIONE UNIDAD Y CODIGO--</option>
<?php
do {
?>
<option value="<?php echo $row_sql2['id'];?>"><?php echo $row_sql2['unidad'].'-'.$row_sql2['codigo']?></option>
<?php
} while ($row_sql2 = mysql_fetch_assoc($sql2));
$rows2 = mysql_num_rows($sql2);
if($rows2 > 0) {
mysql_data_seek($sql2, 0);
$row_sql2 = mysql_fetch_assoc($sql2);
}
?>
</select></td>
</tr>
<tr>
<td bgcolor="#CCFFFF"><div align="right" class="Estilo57 Estilo52"><strong>Usuario :</strong></div></td>
<td bgcolor="#CCFFFF" colspan="5"><div align="left">
<input name="usua" type="text" class="Estilo55" id="usua" value="<?php echo $usuarios ?>" size="13" maxlength="13"/>
</div></td>
</tr>
</table>
<p>
<input name="guardar" type="submit" class="Estilo60" id="guardar" value="Guardar" />
</p>
</div>
</form>
</body>
</html>
<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>")
}
///////////////////// ACA FUNCIONA LA VALIDACION/////////////////
function Valida_Fecha(formulario)
{
if (formulario.valcuo.value == "")
{
alert("Falta Digitar Valor");
formulario.valcuo.focus();
return (false);
}
if (formulario.cuono.value == "")
{
alert("Falta Digitar Cuota");
formulario.cuono.focus();
return (false);
}
if (formulario.fechanom.value == "")
{
alert("Falta digitar Fecha De Pago");
formulario.fechanom.focus();
return (false);
}
if (formulario.unidt.value == "")
{
alert("Falta Seleccionar Unidad Y Codigo");
formulario.unidt.focus();
return (false);
}
if (formulario.usua.value == "")
{
alert("Escriba el Usuario");
formulario.usua.focus();
return (false);
}
if (confirm("Es correcta está información "))
{
return (true);
}
else
{
return (false);
}
return (true);
}
var timerID = null;
var timerRunning = false;
var id,pause=0,position=0;
function stopclock ()
{
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function showtime ()
{
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timeValue = "" + ((hours >12) ? hours -12 :hours)
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
timeValue += (hours >= 12) ? " pm" : " am"
document.formulario.Hora_Envio.value = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
function startclock ()
{
stopclock ();
showtime ();
}
</SCRIPT>
<?
echo'<table width="650" border="0" cellspacing="2" cellpadding="2" align = "center">
<tr align="center">
<td colspan="7"><font face="Georgia, Times New Roman, Times, serif" color="#006600"><b align = "center">PAGOS EFECTUADOS</b></font></td>
</tr>
<tr align="center" bgcolor="#DDDDDD">
<td width="90" align="center"><font face="Geneva, Arial, Helvetica, san-serif" size="2" color="#000099">Valor cuota</font></td>
<td bgcolor="#DDDDDD" width="55" ><font face="Geneva, Arial, Helvetica, san-serif" size="2" color="#000099"># cuotas</font></td>
<td width="300" ><font face="Geneva, Arial, Helvetica, san-serif" size="2" color="#000099">Causal</font></td>
<td width="300" ><font face="Geneva, Arial, Helvetica, san-serif" size="2" color="#000099">Usuarios</font></td>
<td width="300" ><font face="Geneva, Arial, Helvetica, san-serif" size="2" color="#000099">Entidad</font></td>
<td width="140"><font face="Geneva, Arial, Helvetica, san-serif" size="2" color="#000099">Fecha registro</font></td>
</tr>';
$control = mysql_query('SELECT * FROM debitos_estado_contable WHERE cedula = "' . $_GET["ced2"] . '" ORDER BY fecha_registro ');
if (!$control) {
die('Invalid query debitos: ' . mysql_error());
}
while(list($id, $cedula, $nombre, $cuota, $valorcuota,$usuarios, $fecha_registro, $codesc, $unidesc, $causal_rechazo) = mysql_fetch_row($control))
{
if($codesc == 0)
{
$concepto = $unidesc;
}else
{
$control5 = mysql_query('SELECT * FROM debitos_unidad WHERE codigo = "' ."$codesc". '" and unidad = "' ."$unidesc". '" ');
if (!$control5) {
die('Invalid query descunetps: ' . mysql_error());
}
list($idr, $codigo, $unidad, $concepto) = mysql_fetch_row($control5);
}
printf ("<tr align='center' bgcolor='#f4f4f4'>
<td width='100'><font face='Geneva, Arial, Helvetica, san-serif' size='2' color=#993300'><a window.location.href=\"cartera_modificar_estado.php?id=$id\">$valorcuota</a></td>
<td width='100'> <font face='Geneva, Arial, Helvetica, san-serif' size='2' color=#993300'><a window.location.href=\"cartera_modificar_estado.php?id=$id\" top=50,left=100,toolbar=no,scrollbars=no,width=790,height=521,status=yes>$cuota</a></td>
<td width='100'> <font face='Geneva, Arial, Helvetica, san-serif' size='2' color=#993300'><a window.location.href=\"cartera_modificar_estado.php?id=$id\" top=50,left=100,toolbar=no,scrollbars=no,width=790,height=521,status=yes>$causal_rechazo</a></td>
<td width='100'> <font face='Geneva, Arial, Helvetica, san-serif' size='2' color=#993300'><a window.location.href=\"cartera_modificar_estado.php?id=$id\" top=50,left=100,toolbar=no,scrollbars=no,width=790,height=521,status=yes>$usuarios</a></td>
<td width='750'><font face='Geneva, Arial, Helvetica, san-serif' size='2' color=#993300'><a window.location.href=\"cartera_modificar_estado.php?id=$id\" top=50,left=250,toolbar=no,scrollbars=no,width=790,height=521,status=yes>$concepto</a></td>
<td width='100'><font face='Geneva, Arial, Helvetica, san-serif' size='2' color=#993300'><a window.location.href=\"cartera_modificar_estado.php?id=$id\" top=50,left=100,toolbar=no,scrollbars=no,width=790,height=521,status=yes>$fecha_registro</a></td></tr>");
}
echo "</table>";
?>