MOON
Server: Apache/2.2.34 (Unix) mod_ssl/2.2.34 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 FrontPage/5.0.2.2635
System: Linux server.asjudinet.com 2.6.32-042stab141.3 #1 SMP Fri Nov 15 22:45:34 MSK 2019 i686
User: asjudine (504)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: /home/asjudine/public_html/credito_rotativo_cargar_manual.php
<?php 
require_once("mainfile.php");
include ("config.php");
global $dbi;

require_once("Conectarse.php");


if(isset($_POST["guardar"]))
{
	$fecha_act=date ( "Y-n-j" );
	
	$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 credito_rotativo_estado_contable  (cedula, nombre, numero_libranza, credito_libranza, numero_cuota,  mes_cuota, ano_cuota, valor_cuota, fecha_registro, fecha_nomina, codigo_descuento, unidad_descuento) VALUES ('" . $_POST["ced"] . "', '" . $_POST["ape"] . "', '" . $_POST["numlib"] . "', '" . $_POST["libranza_credito"] . "', '" . $_POST["cuono"] . "', '" . $_POST["mi"] . "', '" . $_POST["ai"] . "','" . $_POST["valcuo"] . "', '" ."$fecha_act". "','" . $_POST["fechanom"] . "', '" ."$codcd". "', '" ."$unidt". "')");
  	if (!$guardar) {
		die('Invalid query 1 guardar: ' . mysql_error());
	}
			
	$cuotap = $_POST[cuotap] - 1;
	$cuotad = $_POST[cuotad] + 1;
	$sal = $_POST[nue];
	$nue =  $_POST[nue] - $_POST[valcuo] ;

	if($unidt  == 'YYY0' && $codcd  == '550')
    {
        $mssql = mysql_query("UPDATE  credito_rotativo_inter set saldo_anterior = saldo_nuevo, saldo_nuevo = saldo_nuevo + '" .$_POST["valcuo"]. "', cuotas_pendientes = cuotas_pendientes + 1 , cuotas_descontadas = cuotas_descontadas - 1,  WHERE  cedula =  '" . $_GET[ced2] . "' and numero_libranza = '".$_GET["numlib"]."' and credito_libranza =  '" . $_GET[cred] . "' ");	
        if (!$mssql) {
            die('Invalid query primer UPDATE: ' . mysql_error());
        }
    }
    else{
        $mssql = mysql_query("UPDATE  credito_rotativo_inter set fecha_ultimo_descuento = '" . $_POST[fechanom] . "', saldo_anterior = '" .$sal. "',  saldo_nuevo = '" .$nue. "', cuotas_pendientes = '" .$cuotap. "', cuotas_descontadas = '" .$cuotad. "', mes_aplicado = '" .$_POST[mi]. "',  ano_aplicado = '" .$_POST[ai]. "' WHERE  cedula =  '" . $_GET[ced2] . "' and numero_libranza = '".$_GET["numlib"]."' and credito_libranza =  '" . $_GET[cred] . "' ");	
        if (!$mssql) {
            die('Invalid query primer UPDATE: ' . mysql_error());
        }
    }
	
	
        
  	
	echo "<script>alert('Cuota Cargada Satisfatoriamente');</script>";
}






$control = mysql_query('SELECT cedula, codigo, nombre, grado, numero_libranza, credito_libranza,  sucursal, direccion , telefono, celular, ciudad , email, cuenta_ahorros, banco, unidad_descuento, codigo_descuento, fecha_credito, valor_credito, cuotas_credito, valor_cuota,  fecha_ultimo_descuento, mes_inicio, ano_inicio,  saldo_anterior , cuotas_pendientes, cuotas_descontadas, saldo_nuevo FROM credito_rotativo_inter WHERE  cedula = "' . $_GET[ced2] . '" and numero_libranza = "'.$_GET["numlib"].'" and credito_libranza = "' . $_GET[cred] . '"');

if (!$control) {
	die('Invalid query 188: ' . mysql_error());
}

$num=mysql_num_rows($control); 
list($cedula, $codi, $apes, $grad, $numlib, $libranza_credito,  $codigosu, $dire, $tele, $celul, $ciud, $email, $cue, $ban,  $unides, $codides, $fechafil, $valcon, $numcuo, $valcuo, $fechaul, $mesini, $anoini,  $salant, $cupen, $cudesc, $salnue) = mysql_fetch_row($control);


$fechaini = $mesini.'-'.$anoini ;

$sql2 = mysql_query('SELECT * FROM descuentos WHERE estado = "1" order by unidad');
if (!$sql2) {
	die('Invalid query: ' . mysql_error());
}
$row_sql2 = mysql_fetch_assoc($sql2);
$totalRows_sql2 = mysql_num_rows($sql2); 
?>

    
<!DOCTYPE html>
<html>
<head>
<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;
}
.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; }
-->
</style>
</head>


<script Language="JavaScript">


function valida_envia(){
	if (document.form1.valcuo.value == ""){
		alert("Falta Digitar el valor de la Cuota")
		document.form1.valcuo.focus()
		return (false);
	}
	
	if (document.form1.cuono.value == ""){
		alert("Falta Digitar número de cuota")
		document.form1.cuono.focus()
		return (false);
	}
	
		if (document.form1.mi.value == ""){
		alert("Falta Digitar mes aplicado")
		document.form1.mi.focus()
		return (false);
	}

		
	if (document.form1.ai.value == ""){
		alert("Falta Digitar año aplicado")
		document.form1.ai.focus()
		return (false);
	}
	
		if (document.form1.fechanom.value == ""){
		alert("Falta Digitar la fecha de nomina")
		document.form1.fechanom.focus()
		return (false);
	}
	
	if (document.form1.unidt.value == ""){
		alert("Falta Seleccionar unidad de descuento")
		document.form1.unidt.focus()
		return (false);
	}



	return (true);
}
</script>

<body>

<form action=""  method="post" onsubmit="return valida_envia()" enctype="multipart/form-data" name="form1"  id="form1">
  <div align="center">
    
    
      <div align="center" class="Estilo50">ESTADO CONTABLE CREDITO </div>
     

    <p>
      <input name="menu2" type="button" class="Estilo50" id="menu2" onclick="window.location.href='menu_creditos_serviasjudinet.php'" value="IR AL MENU" />
    </p>
    <div align="left"></div>
    <div align="left"></div>
    <div align="right"></div>
    <table width="655" border="2" cellpadding="1" cellspacing="1" class="est_cont5">
      <tr>
        <th width="91" height="23" bgcolor="#CCFFCC"><span class="Estilo57">Cedula :</span></th>
        <th width="90" bgcolor="#CCFFCC"><div align="left" class="Estilo56">
            <input name="ced" type="text" class="Estilo55" id="ced" value="<?php echo $cedula ?>" size="18" maxlength="18" readonly="" />
        </div></th>
        <th width="144" bgcolor="#CCFFCC"><span class="Estilo57"> Nombres :</span></th>
        <th colspan="3" bgcolor="#CCFFCC"><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="#CCFFCC"><span class="Estilo57">Banco :</span></th>
        <th bgcolor="#CCFFCC"><div align="left" class="Estilo56">
            <input name="ban" type="text" class="Estilo55" id="ban" value="<?php echo $ban ?>" size="18" maxlength="18" readonly="" />
        </div></th>
        <th bgcolor="#CCFFCC"><span class="Estilo57">No Cuenta :</span></th>
        <th width="69" bgcolor="#CCFFCC"><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="130" bgcolor="#CCFFCC"><span class="Estilo57">Fecha Afiliacion :</span></th>
        <th width="96" bgcolor="#CCFFCC" 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="#CCFFCC"><span class="Estilo57">Valor Credito:</span></th>
        <th bgcolor="#CCFFCC"><div align="left" class="Estilo56">
            <input name="val" type="text" class="Estilo55" id="val" value="<?php echo $valcon ?>" size="18" maxlength="18" readonly="" />
        </div></th>
        <th bgcolor="#CCFFCC"><span class="Estilo57">No Cuotas :</span></th>
        <th bgcolor="#CCFFCC"><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="#CCFFCC"><span class="Estilo57">Valor Cuota :</span></th>
        <th bgcolor="#CCFFCC" class="Estilo55"><div align="left" class="Estilo58">
            <input name="cuomes" type="text" class="Estilo55" id="cuomes" value="<?php echo $valcuo ?>" size="18" maxlength="18" readonly="" />
        </div></th>
      </tr>
      <tr>
        <th bgcolor="#CCFFCC"><span class="Estilo57">Saldo Anterior :</span></th>
        <th bgcolor="#CCFFCC"><div align="left" class="Estilo56">
            <input name="sal" type="text" class="Estilo55" id="sal" value="<?php echo $salant ?>" size="18" maxlength="18" readonly="" />
        </div></th>
        <th bgcolor="#CCFFCC"><span class="Estilo57">Cuotas Pendientes :</span></th>
        <th bgcolor="#CCFFCC"><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="#CCFFCC"><span class="Estilo57">Nuevo Saldo :</span></th>
        <th bgcolor="#CCFFCC" class="Estilo55"><div align="left" class="Estilo58">
            <input name="nue" type="text" class="Estilo55" id="nue" value="<?php echo $salnue ?>" size="18" maxlength="18" readonly="" />
        </div></th>
      </tr>
      <tr>
        <th bgcolor="#CCFFCC"><span class="Estilo57">Fecha Inicio :</span></th>
        <th bgcolor="#CCFFCC"><div align="left" class="Estilo56">
            <input name="fechaini" type="text" class="Estilo55" id="fechaini" value="<?php echo $fechaini ?>" size="10" maxlength="10" readonly="" />
        </div></th>
        <th bgcolor="#CCFFCC"><span class="Estilo57">Cuotas Descontadas :</span></th>
        <th bgcolor="#CCFFCC"><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="#CCFFCC"><span class="Estilo57">Fecha Ultimo Descuento :</span></th>
        <th bgcolor="#CCFFCC" 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="#CCFFCC"><span class="Estilo57">Número de Libranza</span></th>
        <th bgcolor="#CCFFCC"><div align="left" class="Estilo57">
            <input name="numlib" type="text" class="Estilo55" id="numlib" value="<?php echo $numlib ?>" size="6" maxlength="6" readonly="" />
        </div></th>
        
        <th bgcolor="#CCFFCC" ><span class="Estilo57">Número de Libranza CREDITO</span></th>
        <th bgcolor="#CCFFCC" colspan="4"><div align="left" class="Estilo57">
            <input name="libranza_credito" type="text" class="Estilo55" id="libranza_credito" value="<?php echo $libranza_credito ?>" size="6" maxlength="6" readonly="" />
        </div></th>

	
	  </tr>
	  
    </table>
    <p><span class="Estilo62">INGRESAR PAGO</span></p>
    <table width="424" border="1" 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>Mes Aplicado :</strong></div></td>
        <td bgcolor="#CCFFFF"><div align="left">
          <input name="mi" type="text" class="Estilo55" id="mi" value="<?php echo $mes_inicio ?>" size="13" maxlength="13"/>
        </div></td>
        <td bgcolor="#CCFFFF"><div align="right" class="Estilo57 Estilo52"><strong>Año Aplicado :</strong></div></td>
        <td bgcolor="#CCFFFF"><div align="left">
            <input name="ai" type="text" class="Estilo55" id="ai" value="<?php echo $ano_inicio ?>" size="13" maxlength="13"/>
        </div></td>
      </tr>
       <tr>
        <td bgcolor="#CCFFFF"><div align="right" class="Estilo57 Estilo52"><strong>Fecha Nomina :</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 colspan="2" bgcolor="#CCFFFF"><select name="unidt" class="Estilo55" id="unidt">
            <option value="">--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>
    </table>
    <p>
      <input name="guardar" type="submit" class="Estilo60" id="guardar" value="Guardar" />
    </p>
  </div>
</form>
</body>
</html>

<?
echo'<table width="800" border="1" cellspacing="2" cellpadding="2" align = "center">
  <tr align="center"> 
    <td colspan="7"><font face="Georgia, Times New Roman, Times, serif" color="#000066"><b align = "center">PAGOS EFECTUADOS</b></font></td>
  </tr>
  <tr align="center" bgcolor="#FFFFCC"> 
    <td width="260" align="center"><font face="Geneva, Arial, Helvetica, san-serif" size="2" color="#000066">Valor cuota</font></td>
    <td bgcolor="#FFFFCC" width="55" ><font face="Geneva, Arial, Helvetica, san-serif" size="2" color="#000066"># cuotas</font></td>
    <td width="100"><font face="Geneva, Arial, Helvetica, san-serif" size="2" color="#000066"  align="center">Mes</font></td>
	 <td width="100"><font face="Geneva, Arial, Helvetica, san-serif" size="2" color="#000066"  align="center">Año</font></td>
    <td width="260"><font face="Geneva, Arial, Helvetica, san-serif" size="2" color="#000066">Fecha pago</font></td>
    <td width="400" ><font face="Geneva, Arial, Helvetica, san-serif" size="2" color="#000066">Entidad</font></td>
    <td width="260"><font face="Geneva, Arial, Helvetica, san-serif" size="2" color="#000066">Fecha registro</font></td>
  </tr>';				  


	$control = mysql_query('SELECT id, cedula, nombre, numero_libranza, credito_libranza, numero_cuota, mes_cuota, ano_cuota, valor_cuota, fecha_nomina, fecha_registro, codigo_descuento, unidad_descuento FROM  credito_rotativo_estado_contable   WHERE cedula = "' . $_GET["ced2"] . '"  and credito_libranza  =  "' . $_GET["cred"] . '" ORDER BY numero_cuota ASC  ');
			if (!$control) {
				die('Invalid query: ' . mysql_error());
			}

		while(list($id, $cedula, $nombre, $numlib, $libranza_credito, $cuota, $mescuota, $anocuota, $valorcuota,  $fecha_nomina, $fecha_registro, $codesc, $unidesc) = mysql_fetch_row($control)) 
		{
	

			$control5 = mysql_query('SELECT * FROM descuentos WHERE codigo = "' ."$codesc". '" and unidad = "' ."$unidesc". '" ');
			if (!$control5) {
				die('Invalid query: ' . 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>$mescuota</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>$anocuota</a></td>
<td width='120'><font face='Geneva, Arial, Helvetica, san-serif' size='2' color=#993300'><a window.location.href=\"cartera_modificar_estado.php?id=$id\" top=50,left=120,toolbar=no,scrollbars=no,width=790,height=521,status=yes>$fecha_nomina</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=350,toolbar=no,scrollbars=no,width=790,height=521,status=yes>$concepto</a></td>
<td width='120'><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>";		
?>