File: /home/asjudine/public_html/modificar_datos_estadoc.php
<?php
require_once("mainfile.php");
include ("config.php");
global $dbi;
function Conectarse()
{
if (!($link=@mysql_connect("localhost","asjudine","as2006")))
{
echo "Error conectando con el servidor.";
exit();
}
$dbname = "asjudinet";
if (!@mysql_select_db($dbname,$link))
{
echo "Error seleccionando la base de datos.";
exit();
}
return $link;
}
Conectarse();
if(isset($guardar))
{
//$mssql3 = mysql_query("select * from estado_contable where codigo = '$ced' and tipo_pago = 'CRE'",$dbi);
$mssql3 = mysql_query('SELECT * FROM estado_contable WHERE codigo = "' . $HTTP_GET_VARS["cedu"] . '" and tipo_pago = "CRE" ');
if (!$mssql3) {
die('Invalid query: ' . mysql_error());
}
$num3=mysql_num_rows($mssql3);
if($num3>0)
{
if($cod_prov=='0')
{
//$sqlnom4 = "select codigo from proveedores where nombre = '$prov'";
//$control4 = mysql_query($sqlnom4, $dbi) or die(mysql_error());
$control4 = mysql_query('SELECT codigo FROM proveedores WHERE nombre = "' . $_POST[prov] . '" ');
if (!$control4) {
die('Invalid query: ' . mysql_error());
}
list($proveedor2) = mysql_fetch_row($control4);
$cod_prov=$proveedor2;
}
//$mssql = "update estado_contable set saldo_ant='$sal', cuotas_pend='$cuotap', nuevo_saldo='$nue', cuotas_desc='$cuotad', fecha_udesc='$fecult', proveedor='$cod_prov' where codigo = '$ced' and tipo_pago = 'CRE'";
//mysql_query($mssql, $dbi) or die(mysql_error());
$mssql = mysql_query("UPDATE estado_contable set saldo_ant = '" . $_POST[sal] . "', cuotas_pend = '" . $_POST[cuotap] . "', nuevo_saldo = '" . $_POST[nue] . "', cuotas_desc = '" . $_POST[cuotad] . "', fecha_udesc = '" . $_POST[fecult] . "', proveedor = '" . $_POST[cod_prov] . "' WHERE codigo = '" . $HTTP_GET_VARS["cedu"] . "' and tipo_pago = 'CRE' ");
if (!$mssql) {
die('Invalid query primer update: ' . mysql_error());
}
}else{
echo "<script>alert('No existe estado contable');</script>";
}
//$mssql2 = "update creditos set fecha='$fec', nombres='$ape', monto_solicitado='$val', numero_cuotas='$cuo', valor_mensual='$cuomes', cuenta_ahorros='$nocuen', banco_cuenta='$ban', mes_inicio='$mesini',ano_inicio='$anoini' where cedula = '$ced' ";
//mysql_query($mssql2, $dbi) or die(mysql_error());
$mssql2 = mysql_query("UPDATE creditos set fecha = '" . $_POST[fec] . "', nombres = '" . $_POST[ape] . "', monto_solicitado = '" . $_POST[val] . "', numero_cuotas = '" . $_POST[cuo] . "', valor_mensual = '" . $_POST[cuomes] . "', cuenta_ahorros = '" . $_POST[nocuen] . "', banco_cuenta = '" . $_POST[ban] . "', mes_inicio = '" . $_POST[mesini] . "', ano_inicio = '" . $_POST[anoini] . "' WHERE cedula = '" . $HTTP_GET_VARS["cedu"] . "' ");
if (!$mssql2) {
die('Invalid query primer update: ' . mysql_error());
}
echo "<script>alert('Los datos fueron modificados correctamente');</script>";
}
/*$sqlnom2 = "select fecha, nombres, cedula, monto_solicitado, numero_cuotas, valor_mensual, cuenta_ahorros, banco_cuenta, mes_inicio, ano_inicio, empresa from creditos where codigo = '$cedu' or cedula = '$cedu'";
$control2 = mysql_query($sqlnom2, $dbi) or die(mysql_error()); */
$control2 = mysql_query('SELECT fecha, nombres, cedula, monto_solicitado, numero_cuotas, valor_mensual, cuenta_ahorros, banco_cuenta, mes_inicio, ano_inicio, empresa FROM creditos WHERE codigo = "' . $HTTP_GET_VARS["cedu"] . '" or cedula = "' . $HTTP_GET_VARS["carpeta"] . '"');
if (!$control2) {
die('Invalid query: ' . mysql_error());
}
list($fecha, $apellidos_noms, $cedula, $monto_solicitado, $cuotas, $valor_cuota, $cuenta_ahorros, $banco_cuenta, $mi, $ai, $empresa) = mysql_fetch_row($control2);
/*$sqlnom3 = "select saldo_ant, cuotas_pend, nuevo_saldo, cuotas_desc, fecha_udesc, proveedor from estado_contable where codigo = '$cedu' and tipo_pago = 'CRE'";
$control3 = mysql_query($sqlnom3, $dbi) or die(mysql_error()); */
$control3 = mysql_query('SELECT saldo_ant, cuotas_pend, nuevo_saldo, cuotas_desc, fecha_udesc, proveedor FROM estado_contable WHERE codigo = "' . $HTTP_GET_VARS["cedu"] . '" and tipo_pago = "CRE"');
if (!$control3) {
die('Invalid query: ' . mysql_error());
}
list($saldo_ant, $cuotas_pend, $nuevo_saldo, $cuotas_desc, $fecha_udesc, $proveedor) = mysql_fetch_row($control3);
/*$sqlnom5 = "select nombre from proveedores where codigo = '$proveedor'";
$control5 = mysql_query($sqlnom5, $dbi) or die(mysql_error());*/
$control5 = mysql_query('SELECT nombre FROM proveedores WHERE codigo = "' . $_POST[proveedor] . '" ');
if (!$control5) {
die('Invalid query: ' . mysql_error());
}
list($proveedor) = mysql_fetch_row($control5);
/*$query_sql8 = "SELECT * FROM proveedores order by nombre";
$sql8 = mysql_query($query_sql8, $dbi) or die(mysql_error());*/
$sql8 = mysql_query('SELECT * FROM proveedores order by nombre ');
if (!$sql8) {
die('Invalid query: ' . mysql_error());
}
$row_sql8 = mysql_fetch_assoc($sql8);
$totalRows_sql8 = mysql_num_rows($sql8);
?>
<!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>Documento sin tí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;
}
.Estilo3 {color: #2492FF;
font-weight: bold;
}
.Estilo4 {
color: #CC3300;
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;
}
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<div align="center">
<p class="Estilo4">INFORMACION ESTADO CONTABLE</p>
<table width="630" border="2" cellpadding="1" cellspacing="1" class="est_cont1">
<tr>
<td width="83" height="23">Cedula :</td>
<td width="99"><div align="left">
<input name="ced" type="text" class="est_cont2" id="ced" value="<?php echo $cedula ?>" size="18" maxlength="18" readonly="" />
</div></td>
<td width="111">Apellidos y Nombres :</td>
<td colspan="3"><div align="left">
<input name="ape" type="text" class="est_cont2" id="ape" value="<?php echo $apellidos_noms ?>" size="60" maxlength="60"/>
</div></td>
</tr>
<tr>
<td>Banco :</td>
<td><div align="left">
<input name="ban" type="text" class="est_cont2" id="ban" value="<?php echo $banco_cuenta ?>" size="18" maxlength="18" />
</div></td>
<td>No Cuenta :</td>
<td width="69"><div align="left">
<input name="nocuen" type="text" class="est_cont2" id="nocuen" value="<?php echo $cuenta_ahorros ?>" size="13" maxlength="13" />
</div></td>
<td width="134">Fecha Credito :</td>
<td width="99"><div align="left">
<input name="fec" type="text" class="est_cont2" id="fec" value="<?php echo $fecha ?>" size="10" maxlength="10" />
</div></td>
</tr>
<tr>
<td>Valor Credito:</td>
<td><div align="left">
<input name="val" type="text" class="est_cont2" id="val" value="<?php echo $monto_solicitado ?>" size="18" maxlength="18"/>
</div></td>
<td>No Cuotas :</td>
<td><div align="left">
<input name="cuo" type="text" class="est_cont2" id="cuo" value="<?php echo $cuotas ?>" size="3" maxlength="2" />
</div></td>
<td>Cuota Mes :</td>
<td><div align="left">
<input name="cuomes" type="text" class="est_cont2" id="cuomes" value="<?php echo $valor_cuota ?>" size="18" maxlength="18"/>
</div></td>
</tr>
<tr>
<td>Saldo Anterior :</td>
<td><div align="left">
<input name="sal" type="text" class="est_cont2" id="sal" value="<?php echo $saldo_ant ?>" size="18" maxlength="18" />
</div></td>
<td>Cuotas Pendientes :</td>
<td><div align="left">
<input name="cuotap" type="text" class="est_cont2" id="cuotap" value="<?php echo $cuotas_pend ?>" size="3" maxlength="2"/>
</div></td>
<td>Nuevo Saldo :</td>
<td><div align="left">
<input name="nue" type="text" class="est_cont2" id="nue" value="<?php echo $nuevo_saldo ?>" size="18" maxlength="18" />
</div></td>
</tr>
<tr>
<td>Fecha Inicio :</td>
<td><div align="left">
<input name="mesini" type="text" class="est_cont2" id="mesini" value="<?php echo $mi ?>" size="2" maxlength="2" />
-
<input name="anoini" type="text" class="est_cont2" id="anoini" value="<?php echo $ai ?>" size="4" maxlength="4" />
</div></td>
<td>Cuotas Descontadas :</td>
<td><div align="left">
<input name="cuotad" type="text" class="est_cont2" id="cuotad" value="<?php echo $cuotas_desc ?>" size="3" maxlength="2" />
</div></td>
<td>Fecha Ultimo Descuento :</td>
<td><div align="left">
<input name="fecult" type="text" class="est_cont2" id="fecult" value="<?php echo $fecha_udesc ?>" size="10" maxlength="10" />
</div></td>
</tr>
<tr>
<td>Proveedor :</td>
<td colspan="2"><div align="left">
<input name="prov" type="text" class="est_cont2" id="prov" value="<?php echo $proveedor ?>" size="40" maxlength="40" readonly="" />
</div></td>
<td colspan="3"><div align="left">
<select name="cod_prov" class="est_cont21" id="cod_prov">
<option value="0">--SELECCIONE PROVEEDOR--</option>
<?php
do {
?>
<option value="<?php echo $row_sql8['codigo'];?>"><?php echo $row_sql8['nombre']?></option>
<?php
} while ($row_sql8 = mysql_fetch_assoc($sql8));
$rows = mysql_num_rows($sql8);
if($rows8 > 0) {
mysql_data_seek($sql8, 0);
$row_sql8 = mysql_fetch_assoc($sql8);
}
?>
</select>
</div></td>
</tr>
</table>
<p>
<input name="guardar" type="submit" class="Estilo3" id="guardar" value="Guardar" />
</p>
</div>
</form>
</body>
</html>