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/ingresar_relacion_pago_manual.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"]))
{
	$fecha_act=date ( "Y-n-j" );
	
	//$sqlnom5 = "select codigo, unidad from descuentos where id = '$unidt'";
	//$control5 = mysql_query($sqlnom5, $dbi) or die(mysql_error());
	
		$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);

  mysql_query("INSERT INTO relacion_pagos(codigo, valor, cuota, mes_inicio, ano_inicio, cod_descuento, unidad_descuento, fecha_registro, numero_libranza,  tipo_pago) VALUES ('" . $_POST["ced"] . "', '" . $_POST["valcuo"] . "', '" . $_POST["cuono"] . "', '" . $_POST["mi"] . "', '" . $_POST["ai"] . "', '" ."$codcd". "', '" ."$unidt". "', '" ."$fecha_act". "', '" . $_POST["libranza"] . "', 'CRE')");

   //('$ced', '$valcuo', '$cuono', '$mi', '$ai', '$codcd', '$unidt', '$fecha_act', 'CRE')";
     //mysql_query($sql, $dbi) or die(mysql_error());
	 echo "<script>alert('Relacion de pago guardada satisfactoriamente');</script>";
}


	
		$control2 = mysql_query('SELECT fecha, nombres, cedula, monto_solicitado, numero_cuotas, valor_mensual, cuenta_ahorros, banco_cuenta, numero_libranza, mes_inicio, ano_inicio, empresa FROM creditos WHERE cedula = "' . $HTTP_GET_VARS["ced2"] . '" and numero_libranza  = "' . $HTTP_GET_VARS["libranza"] . '" ');
			if (!$control2) {
				die('Invalid query: ' . mysql_error());
			}	 
	list($fecha, $apellidos_noms, $cedula, $monto_solicitado, $cuotas, $valor_cuota, $cuenta_ahorros, $banco_cuenta, $libranza, $mi, $ai, $empresa) = mysql_fetch_row($control2);


	$control3 = mysql_query('SELECT saldo_ant, cuotas_pend, nuevo_saldo, cuotas_desc, fecha_udesc, proveedor FROM estado_contable WHERE codigo = "' . $HTTP_GET_VARS["ced2"] . '" and numero_libranza  = "' . $HTTP_GET_VARS["libranza"] . '"  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);

	$control4 = mysql_query('SELECT nombre FROM proveedores WHERE codigo = "' . $_POST[proveedor] . '" ');
			if (!$control4) {
				die('Invalid query: ' . mysql_error());
			}	 
	list($proveedor) = mysql_fetch_row($control4);
		


$sql2 = mysql_query('SELECT * FROM descuentos order by codigo');
			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>Estado Contable - Coomanufacturas</title>
<style type="text/css">
<!--
.Estilo2 {color: #FF6633;
	font-size: 16px;
}
.Estilo3 {color: #2492FF;
	font-weight: bold;
}
.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;
}
.Estilo4 {
	color: #D94B3C;
	font-size: 24px;
}
.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;
}
.Estilo51 {
	font-size: 22px
}
.est_cont21 {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;
}
.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;
}
.Estilo1 {	color: #FF0000;
	font-weight: bold;
	font-size: 14px;
}
-->
</style>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
  <div align="center">
      <div align="center" class="Estilo4 Estilo51">ESTADO CONTABLE 
      CREDITOS</div>
    <p>
      <input name="menu2" type="button" class="Estilo50" id="menu2" onclick="window.location.href='proveedor_desc.php'" value="IR AL MENU" />
    </p>
    <div align="left"></div>
    <div align="left"></div>
    <div align="right"></div>
    <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" readonly="" />
        </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" readonly="" />
        </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" readonly="" />
        </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" readonly="" />
        </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" readonly="" />
        </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" readonly="" />
        </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" readonly="" />
        </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" readonly="" />
        </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" readonly="" />
        </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" readonly="" />
        </div></td>
      </tr>
      <tr>
        <td>Fecha Inicio :</td>
        <td><div align="left">
            <input name="fecini" type="text" class="est_cont2" id="fecini" value="<?php echo $mi.' - '.$ai ?>" size="10" maxlength="10" readonly="" />
        </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" readonly="" />
        </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" readonly="" />
        </div></td>
      </tr>
      <tr>
        <td>Proveedor :</td>
        <td colspan="2"><input name="prov" type="text" class="est_cont2" id="prov" value="<?php echo $proveedor ?>" size="40" maxlength="40" readonly="" /></td>
        <td>&nbsp;</td>
          <td>Numero de Libranza  :</td>
          <td><div align="left">
            <input name="libranza" type="text" class="est_cont2" id="libranza" value="<?php echo $libranza ?>" size="10" maxlength="10" readonly="" />
        </div></td>
      </tr>
    </table>
    <p>&nbsp;</p>
    <p><span class="Estilo1">INGRESAR RELACION PAGO</span></p>
    <table width="350" 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="valcuo" type="text" class="est_cont21" id="valcuo" 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="86" scope="col"><div align="left">
            <input name="cuono" type="text" class="est_cont21" id="cuono" 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_cont21" 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_cont21" id="ai" value="<?php echo $ano_inicio ?>" size="13" maxlength="13"/>
        </div></td>
      </tr>
      
      <tr>
        <td>&nbsp;</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" />
    </p>
  </div>
</form>
</body>
</html>
<?php

echo "<form id='form2' name='form2' method='post' action=''>";


require_once("mainfile.php");
include ("config.php");
global $dbi;

   //$mssql = mysql_query("select * from relacion_pagos",$dbi);
   $mssql = mysql_query('SELECT * FROM relacion_pagos');
			if (!$mssql) {
				die('Invalid query: ' . mysql_error());
			}
   if($mssql)
   {
         $filas = mysql_num_rows($mssql);
         if ($filas > 0)
         {

	 $control = mysql_query('SELECT valor, cuota, mes_inicio, ano_inicio, cod_descuento, unidad_descuento, fecha_registro FROM relacion_pagos WHERE codigo = "' . $HTTP_GET_VARS["ced2"] . '" and numero_libranza  = "' . $HTTP_GET_VARS["libranza"] . '"   and tipo_pago = "CRE" order by cuota ASC');
			if (!$control) {
				die('Invalid query: ' . mysql_error());
			}	 
                      if ((mysql_num_rows($control)!=0)) 

	                    {	 
                               
							
						echo "<table width='716' border='2' align='center' cellpadding='1' cellspacing='1' class='est_cont5'>
                        <tr>
        					<td width='103'><div align='center'><strong>VALOR</strong></div></td>
        					<td width='47'><div align='center'><strong>CUOTA</strong></div></td>
        					<td width='59'><div align='center'><strong>MES</strong></div></td>
							<td width='59'><div align='center'><strong>AÑO</strong></div></td>
       						<td width='344'><div align='center'><strong>ENTIDAD RECAUDO</strong></div></td>
        					<td width='133'><div align='center'><strong>FECHA REGISTRO</strong></div></td>
      					</tr>";		  
                           							  
                        

                             while(list($valor, $cuota, $mes_inicio, $año_inicio, $cod_descuento, $unidad_descuento, $fecha_registro) = mysql_fetch_row($control)) 
                              {  					   


									$control5 = mysql_query('SELECT * FROM descuentos WHERE codigo = "' . "$cod_descuento" . '"');
									if (!$control5) {
										die('Error de Consulta : ' . mysql_error());
									}	 
									if ($control5) {
										list($id, $codigo, $unidad, $concepto) = mysql_fetch_row($control5);
										//$row = mysql_fetch_row($control5);
										
										   printf("<TR>
										   <TD bgcolor='#C5D6FC'><div align='center' class='lista'>".$valor."</span></div></TD>
										   <TD bgcolor='#C5D6FC'><div align='center' class='lista'>".$cuota."</span></div></TD>
										   <TD bgcolor='#C5D6FC'><div align='center' class='lista'>".$mes_inicio."</span></div></TD>
										   <TD bgcolor='#C5D6FC'><div align='center' class='lista'>".$año_inicio."</span></div></TD>
										   <TD bgcolor='#C5D6FC'><div align='center' class='lista'>".$concepto."</span></div></TD>						   
										   <TD bgcolor='#C5D6FC'><div align='center' class='lista'>".$fecha_registro."</span></div></TD>	</TR>");              								   
										}
									}
			                        echo "</table>";		  
                        }
	      }
     }
    

echo "</form>";


?>