File: /home/asjudine/www/cartera_modificar_estado_prov.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($_POST["guardar"]))
{
if($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=$ds;
$unidt=$ud;
}
$mssql = mysql_query("UPDATE cartera_estado_contable set valor_cuota = '" . $_POST[val] . "', cuota = '" . $_POST[cuo] . "', mescuota = '" . $_POST[mi] . "', anocuota = '" . $_POST[ai] . "', codigo_descuento = '" .$codcd. "', unidad_descuento = '" .$unidt. "', fecha_registro = '" . $_POST[fr] . "', fecha_nomina = '" . $_POST[fenom] . "' WHERE id = '" . $HTTP_GET_VARS["id"] . "' ");
if (!$mssql) {
die('Invalid query primer UPDATE: ' . mysql_error());
}
$control = mysql_query('SELECT * FROM cartera_estado_contable WHERE id = "' . $HTTP_GET_VARS["id"] . '" ORDER BY cuota ASC ');
if (!$control) {
die('Invalid query: ' . mysql_error());
}
list($idr, $codigo, $nombre, $contrato, $tipo, $cuota, $mes_inicio, $ano_inicio, $valor, $fecha_registro, $fecha_nomina, $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>";
}
if(isset($_POST["elimanar"]))
{
$modificarcob = mysql_query("DELETE FROM cartera_estado_contable WHERE id = '" . $HTTP_GET_VARS[id] . "' ");
if (! $modificarcob) {
die('Invalid query: ' . mysql_error());
}
echo "<script>alert('Cuota eliminada Correctamente');</script>";
}
$control = mysql_query('SELECT * FROM cartera_estado_contable WHERE id = "' . $HTTP_GET_VARS["id"] . '" ORDER BY cuota ASC ');
if (!$control) {
die('Invalid query: ' . mysql_error());
}
list($idr, $codigo, $nombre, $contrato, $tipo, $cuota, $mes_inicio, $ano_inicio, $valor, $fecha_registro, $fecha_nomina, $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 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;
}
.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;
}
-->
</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" scope="col"><div align="right"><strong>Valor :</strong></div></th>
<th width="73" scope="col"><div align="left">
<input name="val" type="text" class="est_cont2" id="val" value="<?php echo $valor ?>" size="13" maxlength="13"/>
</div></th>
<th width="99" scope="col"><div align="right"><strong>Cuota :</strong></div></th>
<th width="71" scope="col"><div align="left">
<input name="cuo" type="text" class="est_cont2" id="cuo" value="<?php echo $cuota ?>" size="13" maxlength="13"/>
</div></th>
</tr>
<tr>
<td><div align="right"><strong>Mes Inicio :</strong></div></td>
<td><div align="left">
<input name="mi" type="text" class="est_cont2" id="mi" value="<?php echo $mes_inicio ?>" size="13" maxlength="13"/>
</div></td>
<td><div align="right"><strong>Año Inicio :</strong></div></td>
<td><div align="left">
<input name="ai" type="text" class="est_cont2" id="ai" value="<?php echo $ano_inicio ?>" size="13" maxlength="13"/>
</div></td>
</tr>
<tr>
<td><div align="right"><strong>Fecha Nomina :</strong></div></td>
<td><div align="left">
<input name="fenom" type="text" class="est_cont2" id="fenom" value="<?php echo $fecha_nomina ?>" size="13" maxlength="13" />
</div></td>
<td><div align="right"><strong>Fecha Registro :</strong></div></td>
<td><div align="left">
<input name="fr" type="text" class="est_cont2" id="fr" value="<?php echo $fecha_registro ?>" size="13" maxlength="13" />
</div></td>
</tr>
<tr>
<td><div align="right"><strong>Descuento :</strong></div></td>
<td><div align="left">
<input name="ds" type="text" class="est_cont2" id="ds" value="<?php echo $cod_descuento?>" size="13" maxlength="13" readonly="" />
</div></td>
<td><div align="right"><strong>Unidad :</strong></div></td>
<td><input name="ud" type="text" class="est_cont2" id="ud" value="<?php echo $unidad_descuento?>" size="13" maxlength="13" readonly="" /></td>
</tr>
<tr>
<td> </td>
<td colspan="3"><select name="unidt" class="est_cont21" 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>
<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_prov.php'" value="IR AL MENU" />
<?php echo "<input type='button' value='Volver al Estado' name=boton class=estilo1 onClick =window.location.href='estado_contable_servi_prov.php?ced2=$ced2&numcon=$numcon','','top=50,left=100,toolbar=no,scrollbars=yes,width=790,height=280,status=yes'></a>"; ?>
</p>
</div>
</form>
</body>
</html>