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/www/credito_rotativo_modificar_estado_cuota.php
<?php 
require_once("mainfile.php");
include ("config.php");
global $dbi;

require_once("Conectarse.php");


if(isset($_POST["guardar"]))
{
	$ced2 = $_GET["ced2"];
	$numlib = $_GET["numlib"];
	$cred = $_GET["cred"];
	if($_POST[unidt]  != 0)
	{
		$control3 = mysql_query('SELECT codigo, unidad FROM descuentos WHERE id = "' . $_POST[unidt] . '"  ');
		if (!$control3) {
			die('Invalid query: ' . mysql_error());
		} 	 
		list($codcd, $unidt) = mysql_fetch_row($control3);
	}
	else
	{
		$codcd= $_POST[ds];
		$unidt= $_POST[ud];
	}

		
	$mssql = mysql_query("UPDATE credito_rotativo_estado_contable set valor_cuota = '" . $_POST[val] . "', numero_cuota = '" . $_POST[cuo] . "', mes_cuota = '" . $_POST[mi] . "', ano_cuota = '" . $_POST[ai] . "', codigo_descuento   = '" .$codcd. "', unidad_descuento    = '" .$unidt. "', fecha_registro = '" . $_POST[fr] . "', fecha_nomina = '" . $_POST[fenom] . "' WHERE id = '" . $_GET["id"]  . "' ");	
	if (!$mssql) {
		die('Invalid query primer UPDATE: ' . mysql_error());
	}
			
	$control = mysql_query('SELECT * FROM  credito_rotativo_estado_contable  WHERE id = "' . $_GET["id"] . '" ORDER BY numero_cuota ASC ');
	if (!$control) {
		die('Invalid query: ' . mysql_error());
	}
	list($idr, $codigo, $nombre, $numlib, $cred, $cuota, $mes_inicio, $ano_inicio, $valor, $fecha_nomina, $fecha_registro,  $formapago) = mysql_fetch_row($control);
				
	$result2 = mysql_query('SELECT codigo, unidad  FROM descuentos WHERE codigo = "' ."$formapago". '" and unidad = "' ."$uni". '" ');
	if (!$result2) {
		die('Invalid query 2: ' . mysql_error());
	}

	list($cod_descuento, $unidad_descuento) = mysql_fetch_row($result2);		

	echo "<script>alert('Los datos fueron modificados correctamente');</script>";

	echo "<SCRIPT LANGUAGE='javascript'>window.location.href='credito_rotativo_modificar_estado_mc.php?ced2=$ced2&numlib=$numlib&cred=$cred'</SCRIPT>";
}
		
		
		
		
if(isset($_POST["elimanar"]))
{
	$ced2 = $_GET["ced2"];
	$numlib = $_GET["numlib"];
	$cred=$_GET["cred"];
	
	$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"].'" ');
	if (!$control) {
		die('Invalid query 1: ' . mysql_error());
	}
	$num=mysql_num_rows($control); 
	list($cedula, $codi, $apes, $grad, $num_lib, $cred, $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);
		
		
	$salnue  = $salnue + $_POST[val] ;
	$cupen = $cupen + 1;
	$cudesc = $cudesc  - 1;
		
	$mssql = mysql_query("UPDATE  credito_rotativo_inter  set saldo_nuevo = '" .$salnue. "', cuotas_pendientes = '" .$cupen. "', cuotas_descontadas = '" .$cudesc. "' WHERE  cedula =  '".$_GET[ced2]."' and numero_libranza =  '".$_GET[numlib]."' and credito_libranza = '".$_GET[cred]."' ");	
	if (!$mssql) {
		die('Invalid query primer UPDATE: ' . mysql_error());
	}

	
	$modificarcob = mysql_query("DELETE  FROM credito_rotativo_estado_contable  WHERE id = '" . $_GET[id] . "' ");
	if (! $modificarcob) {
		die('Invalid query: ' . mysql_error());
	}
			
	echo "<script>alert('Cuota eliminada Correctamente');</script>";

	echo "<SCRIPT LANGUAGE='javascript'>window.location.href='credito_rotativo_modificar_estado_mc.php?ced2=$ced2&numlib=$numlib&cred=$cred'</SCRIPT>";
		
}
		


$control = mysql_query('SELECT * FROM  credito_rotativo_estado_contable  WHERE id = "' . $_GET["id"] . '" ORDER BY numero_cuota ASC ');
if (!$control) {
	die('Invalid query: ' . mysql_error());
}
list($idr, $codigo, $nombre, $numlib, $cred, $cuota, $mes_inicio, $ano_inicio, $valor, $fecha_nomina,  $fecha_registro, $formapago, $uni) = mysql_fetch_row($control);
				

$result2 = mysql_query('SELECT codigo, unidad  FROM descuentos WHERE codigo = "' ."$formapago". '" and unidad = "' ."$uni". '" ');
if (!$result2) {
	die('Invalid query 2: ' . mysql_error());
}

list($cod_descuento, $unidad_descuento) = mysql_fetch_row($result2);		



$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>Documento sin t&iacute;tulo</title>
<style type="text/css">
<!--
.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: 18px;
	width: auto;
	border: thin solid #FABF85;


}
.Estilo1 {	color: #FF6600;
	font-weight: bold;
}
.Estilo3 {color: #2492FF;
	font-weight: bold;
}
.Estilo50 {color: #CC3333;
	font-family: "Arial Narrow";
	font-weight: bold;
}
.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;
}
.Estilo51 {color: #000000; font-family: "Arial Narrow"; font-weight: bold; }
-->
</style>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
  <div align="center">
    <p><span class="Estilo1">RELACION DE PAGOS</span></p>
    <table width="335" border="1" class="est_cont1">
      <tr>
        <th width="62" height="19" bgcolor="#ECFFFB" scope="col"><div align="right"><strong>Valor :</strong></div></th>
        <th width="73" bgcolor="#ECFFFB" class="Estilo1" scope="col"><div align="left">
            <input name="val" type="text" class="Estilo51" id="val" value="<?php echo $valor ?>" size="13" maxlength="13"/>
        </div></th>
        <th width="99" bgcolor="#ECFFFB" scope="col"><div align="right"><strong>Cuota :</strong></div></th>
        <th width="71" bgcolor="#ECFFFB" class="Estilo50" scope="col"><div align="left">
            <input name="cuo" type="text" class="Estilo51" id="cuo" value="<?php echo $cuota ?>" size="13" maxlength="13"/>
        </div></th>
      </tr>
      <tr>
        <td bgcolor="#ECFFFB"><div align="right"><strong>Mes Inicio :</strong></div></td>
        <td bgcolor="#ECFFFB" class="Estilo50"><div align="left">
            <input name="mi" type="text" class="Estilo51" id="mi" value="<?php echo $mes_inicio ?>" size="13" maxlength="13"/>
        </div></td>
        <td bgcolor="#ECFFFB"><div align="right"><strong>Año Inicio :</strong></div></td>
        <td bgcolor="#ECFFFB" class="Estilo50"><div align="left">
            <input name="ai" type="text" class="Estilo51" id="ai" value="<?php echo $ano_inicio ?>" size="13" maxlength="13"/>
        </div></td>
      </tr>
      <tr>
       <td bgcolor="#ECFFFB"><div align="right"><strong>Fecha Nomina :</strong></div></td>
        <td bgcolor="#ECFFFB" class="Estilo50"><div align="left">
            <input name="fenom" type="text" class="Estilo51" id="fenom" value="<?php echo $fecha_nomina ?>" size="13" maxlength="13"  />
        </div></td>

        <td bgcolor="#ECFFFB"><div align="right"><strong>Fecha Registro :</strong></div></td>
        <td bgcolor="#ECFFFB" class="Estilo50"><div align="left">
            <input name="fr" type="text" class="Estilo51" id="fr" value="<?php echo $fecha_registro ?>" size="13" maxlength="13"  />
        </div></td>
      </tr>
      <tr>
        <td bgcolor="#ECFFFB"><div align="right"><strong>Descuento :</strong></div></td>
        <td bgcolor="#ECFFFB" class="Estilo50"><div align="left">
          <input name="ds" type="text" class="Estilo51" id="ds" value="<?php echo $cod_descuento?>" size="13" maxlength="13" readonly="" />
        </div></td>
        <td bgcolor="#ECFFFB"><div align="right" class="Estilo3">Unidad :</div></td>
        <td bgcolor="#ECFFFB" class="Estilo50"><input name="ud" type="text" class="Estilo51" id="ud" value="<?php echo $unidad_descuento?>" size="13" maxlength="13" readonly="" /></td>
      </tr>
      <tr>
        <td bgcolor="#ECFFFB">&nbsp;</td>
        <td colspan="3" bgcolor="#ECFFFB"><select name="unidt" class="Estilo51" id="unidt">
          <option value="0">--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 class="Estilo50">&nbsp;</p>
    <p>
   <input name="guardar" type="submit" class="Estilo3" id="guardar" value="Guardar" />
<input name="elimanar" type="submit" class="Estilo3" id="elimanar" value="Eliminar" />
    </p>
    <p>
      <input name="menu2" type="button" class="Estilo50" id="menu2" onclick="window.location.href='menu_creditos_serviasjudinet.php'" value="IR AL MENU" />
	  
			<?php
			 $ced2 = $_GET["ced2"];
$numlib = $_GET["numlib"];
			 echo "<input type='button' value='Volver al Estado' name=boton class=estilo1 onClick =window.location.href='credito_rotativo_modificar_estado_mc.php?ced2=$ced2&numlib=$numlib&cred=$cred','','top=50,left=100,toolbar=no,scrollbars=yes,width=790,height=280,status=yes'></a>"; ?>
	</p>
 
  </div>
</form>
</body>
</html>