File: /home/asjudine/public_html/red_ingresar.php
<?php
require_once("mainfile.php");
include ("config.php");
global $dbi;
$espacio = ' ';
$linea = '-';
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();
$subir = mysql_query('SELECT cedula, nombre, grado, unidad FROM datos_credito WHERE cedula = "' . $HTTP_GET_VARS["ced2"] . '"');
if (!$subir) {
die('Invalid query 2: ' . mysql_error());
}
if ((mysql_num_rows($subir)==0))
{
$subir = mysql_query('SELECT cedula, nombre, grado, unidad_descuento, codigo_militar FROM cartera_serviasjudinet WHERE cedula = "' . $HTTP_GET_VARS["ced2"] . '"');
if (!$subir) {
die('Invalid query 2: ' . mysql_error());
}
}
list($cedula, $apes, $grado, $unidad, $codigo) = mysql_fetch_row($subir);
if(isset($_POST["guardar"]))
{
$resu = mysql_query('SELECT cedula FROM red_comunicaciones WHERE cedula = "' . $_POST["ced"] . '" and numero_sim = "' . $_POST["numsim"] . '"');
if (!$resu) {
die('Invalid query: ' . mysql_error());
}
list($cedulatt) = mysql_fetch_row($resu);
if ((mysql_num_rows($resu)==0))
{
$dia = date("d");
$mes = date("m");
$ano = date("Y");
$fecha = $ano.'-'.$mes.'-'.$dia;
mysql_query("INSERT INTO red_comunicaciones (cedula, codigo, nombre, grado, direccion, ciudad, telefono, celular, email, unidad, minutos, cuenta, banco, numero_sim, fecha_pago, fecha_activacion, fecha_vencimiento, sucursal, numlibranza, estado) VALUES ('" . $_POST["ced"] . "', '" . $_POST["codigo"] . "', '" . $_POST["ape"] . "', '" . $_POST["gra"] . "', '" . $_POST["dir"] . "', '" . $_POST["ciu"] . "', '" . $_POST["tel"] . "', '" . $_POST["cel"] . "', '" . $_POST["email"] . "', '" . $_POST["uni"] . "', '" . $_POST["minutos"] . "', '" . $_POST["cue"] . "', '" . $_POST["ban"] . "', '" . $_POST["numsim"] . "', '" . $_POST["fechapa"] . "','" . $_POST["fechaact"] . "', '" . $_POST["fechaven"] . "', '" . $_POST["sucursal"] . "', '" . $_POST["numlib"] . "', '1')");
echo "<script>alert('Solicitud Guardada Satisfactoriamente');</script>";
echo "<SCRIPT LANGUAGE='javascript'>window.location.href='menu_control.php?ced2=$ced2&numcon=$numcont'</SCRIPT>";
}else
{
echo "<script>alert('Solicitud Ya esta asignada');</script>";
}
}
$sql2 = mysql_query('SELECT * FROM descuentos order by codigo ');
if (!$sql2) {
die('Invalid query m2: ' . mysql_error());
}
$row_sql2 = mysql_fetch_assoc($sql2);
$totalRows_sql2 = mysql_num_rows($sql2);
$sql3 = mysql_query('SELECT * FROM descuentos order by codigo ');
if (!$sql3) {
die('Invalid query 3: ' . mysql_error());
}
$row_sql3 = mysql_fetch_assoc($sql3);
$totalRows_sql3 = mysql_num_rows($sql3);
$sql4 = mysql_query('SELECT * FROM vendedores WHERE (tipo = "AC" || tipo = "AE") and estado = "1" order by vendedor ');
if (!$sql4) {
die('Invalid query: ' . mysql_error());
}
$row_sql4 = mysql_fetch_assoc($sql4);
$totalRows_sql4 = mysql_num_rows($sql4);
$sql5 = mysql_query('SELECT * FROM sucursal order by nombre ');
if (!$sql5) {
die('Invalid query: ' . mysql_error());
}
$row_sql5 = mysql_fetch_assoc($sql5);
$totalRows_sql5 = mysql_num_rows($sql5);
$sql7 = mysql_query('SELECT * FROM planes_contratos WHERE estado = "1" order by codigo ');
if (!$sql7) {
die('Invalid query: ' . mysql_error());
}
$row_sql7 = mysql_fetch_assoc($sql7);
$totalRows_sql7 = mysql_num_rows($sql7);
$sql8 = mysql_query('SELECT * FROM director_ventas order by nombre ');
if (!$sql8) {
die('Invalid query: ' . mysql_error());
}
$row_sql8 = mysql_fetch_assoc($sql8);
$totalRows_sql8 = mysql_num_rows($sql8);
$sql8 = mysql_query('SELECT * FROM sucursal 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>Ingresar Solicitud Red de Comunicación</title>
<style type="text/css">
<!--
.est_cont5 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9px;
font-style: normal;
font-weight: normal;
background-color: #EDFAF4;
margin: 2px;
padding: 2px;
height: auto;
width: auto;
border: thin groove #E9AAF0;
color: #C72350;
}
.color_fondo_sc {
background-color: #DCE0E4;
}
.Estilo1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 16px;
font-style: normal;
font-weight: bold;
background-color: #D6ECFE;
margin: 2px;
padding: 2px;
height: auto;
width: auto;
border: thin groove #E9AAF0;
color: #C72350;
}
.Estilo2 {
font-size: 14px;
font-weight: bold;
}
.est_cont2 {
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;
}
.est_cont6 {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 11px;
font-style: normal;
font-weight: normal;
color: #006262;
background-color: #EDFED3;
margin: 1px;
padding: 1px;
height: auto;
width: auto;
border: thin solid #D9B6F8;
}
.sol_cre1 {
font-family: "Times New Roman", Times, serif;
font-size: 12px;
font-style: normal;
font-weight: normal;
color: #0B3495;
background-color: #E6FAFF;
margin: 1px;
padding: 1px;
height: 18px;
width: auto;
border: thin outset #56AD95;
}
.col_cre2 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
font-weight: bold;
color: #F92F0B;
background-color: #B3D9F0;
height: auto;
width: auto;
border: medium groove #FC9227;
}
.Estilo50 {color: #CC3333;
font-family: "Arial Narrow";
font-weight: bold;
}
.Estilo53 {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;
}
.campo1 {background-color: #B7FFFF;
border: thin dashed #B6B6B6;
}
.campo1 {font-family: "Courier New", Courier, monospace;
font-size: 16px;
font-style: normal;
font-weight: bold;
background-color: #E1EFFD;
border: thin doble #009999;
}
.campo1 { font-family: "Courier New", Courier, monospace;
font-size: 11px;
color: #5151FF;
background-color: #C4E4FD;
border: thin solid #009999;
height: 18px;
width: auto;
}
.datos1 {font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 16px;
font-style: normal;
text-decoration: blink;
background-color: #CCFFCC;
margin: 5px;
padding: 7px;
height: auto;
width: auto;
border: thin solid #0099FF;
}
.datos1 {font-family: Georgia, "Times New Roman", Times, serif;
font-size: 16px;
background-color: #FDE0C1;
margin: 2px;
padding: 3px;
border: medium doble #DBAED7;
}
.datos1 { font-family: Georgia, "Times New Roman", Times, serif;
font-size: 11px;
font-weight: normal;
background-color: #B8F5E8;
margin: 4px;
padding: 5px;
border: thin outset #009999;
}
.datos2 { font-family: "Courier New", Courier, monospace;
font-size: 10px;
font-style: normal;
font-weight: normal;
color: #0033FF;
background-color: #FFE2C6;
margin: 2px;
padding: 3px;
border: medium doble #EEBFEB;
}
.datos3 { font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-style: normal;
font-weight: normal;
color: #FF3300;
background-color: #A6ECD7;
margin: 4px;
padding: 4px;
border: medium groove #CCCCFF;
}
.go { font-family: "Times New Roman", Times, serif;
font-size: 9px;
font-style: normal;
color: #FF6633;
background-color: #FBDCBD;
padding: 1px;
height: auto;
width: auto;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
}
.label {background-color: #FFFFCC; font-size: 16px; font-family: Arial; color:#0000CC; display: block;}
.Estilo67 {
color: #000099;
font-weight: bold;
font-size: 12px;
}
.Estilo71 {font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-weight: normal; color: #000099; background-color: #F0F5CF; height: 18px; width: auto; border: thin solid #FABF85; }
.Estilo72 {color: #000099; font-size: 12px; }
.Estilo73 {font-weight: normal; background-color: #F0F5CF; height: 18px; width: auto; border: thin solid #FABF85; font-family: Geneva, Arial, Helvetica, sans-serif; font-style: normal;}
-->
</style>
<script Language="JavaScript">
function validarEntero(valor){
//intento convertir a entero.
//si era un entero no le afecta, si no lo era lo intenta convertir
valor = parseInt(valor)
//Compruebo si es un valor numérico
if (isNaN(valor)) {
//entonces (no es numero) devuelvo el valor cadena vacia
return ""
}else{
//En caso contrario (Si era un número) devuelvo el valor
return valor
}
}
function valida_envia(){
//valido la fecha solicitud
//valido LOS APELLIDOS
if (document.form1.ape.value==""){
alert("Tiene que escribir sus apellidos")
document.form1.ape.focus()
return (false);
}
//valido la cedula
if (document.form1.ced.value==""){
alert("Tiene que escribir el numero de cedula")
document.form1.ced.focus()
return (false);
}
if (document.form1.ciu.value==""){
alert("Falta digitar Ciudad")
document.form1.ciu.focus()
return (false);
}
if (document.form1.dir.value==""){
alert("Falta digitar Direccion")
document.form1.dir.focus()
return (false);
}
//valido la fecha grado
if (document.form1.gra.value==""){
alert("Tiene que escribir el Grado")
document.form1.gra.focus()
return (false);
}
if (document.form1.minutos.value==""){
alert("Falta Cantidad de Minutos")
document.form1.minutos.focus()
return (false);
}
//valido la fecha plan
if (document.form1.numsim.value==""){
alert("Falta digitar Número Sim")
document.form1.numsim.focus()
return (false);
}
//valido la fecha dia de nacimiento
if (document.form1.fechaven.value=="0000-00-00"){
alert("FECHA DE VENCIMIENTO")
document.form1.fechaven.focus()
return (false);
}
//valido VENDEDOR
if (document.form1.ase.value==""){
alert("Falta seleccionar vendedor")
document.form1.ase.focus()
return (false);
}
return (true);
}
</script>
</head>
<body >
<form action="" method="post" onsubmit="return valida_envia()" enctype="multipart/form-data" name="form1" class="" id="form1">
<div align="center">
<div class="Estilo1">RED COMUNICACIONES MOVISTAR</div>
<table border="2" cellpadding="1" cellspacing="1" class="est_cont5">
<caption>
<div align="center"><br />
<span class="Estilo2">INGRESAR DATOS BASICOS </span><br />
</div>
</caption>
<tr>
<td width="145"><div align="right" class="Estilo67">Apellidos y Nombres:</div></td>
<td colspan="3"><div align="left" class="Estilo72">
<input name="ape" type="text" class="Estilo73" id="ape" value="<?php echo $apes ?>" size="66" maxlength="65" />
</div></td>
<td width="126"><div align="right" class="Estilo72"><strong>Cogido Militar :</strong></div></td>
<td colspan="2"><div align="left" class="Estilo72">
<input name="codigo" type="text" class="Estilo73" id="codigo" value="<?php echo $codigo ?>" size="20" maxlength="20" />
</div></td>
</tr>
<tr>
<td height="21"><div align="right" class="Estilo72"><strong>Cedula No:</strong></div></td>
<td width="123"><div align="left" class="Estilo72">
<input name="ced" type="text" class="Estilo73" id="ced" value="<?php echo $cedula ?>" size="20" maxlength="20" />
</div></td>
<td><div align="right" class="Estilo72"><strong>Unidad :</strong></div></td>
<td><div align="left" class="Estilo72">
<input name="uni" type="text" class="Estilo73" id="uni" value="<?php echo $unidad ?>" size="10" maxlength="10" />
</div></td>
<td width="119"><div align="right" class="Estilo72"><strong>Grado :</strong></div></td>
<td width="150"><div align="left" class="Estilo72">
<input name="gra" type="text" class="Estilo73" id="gra" value="<?php echo $grado ?>" size="12" maxlength="10" />
</div></td>
</tr>
<tr>
<td><div align="right" class="Estilo72"><strong>Cuidad :</strong></div></td>
<td><div align="left" class="Estilo72">
<input name="ciu" type="text" class="Estilo73" id="ciu" value="<?php echo $ciudad ?>" size="20" maxlength="20" />
</div></td>
<td><div align="right" class="Estilo72"><strong>Direccion :</strong></div></td>
<td colspan="2"><div align="left" class="Estilo72">
<input name="dir" type="text" class="Estilo73" id="dir" value="<?php echo $direccion ?>" size="50" maxlength="50" />
</div></td>
</tr>
<tr>
<td><div align="right" class="Estilo72"><strong>Telefono :</strong></div></td>
<td><div align="left" class="Estilo72">
<input name="tel" type="text" class="Estilo73" id="tel" value="<?php echo $telefono ?>" size="20" maxlength="20" />
</div></td>
<td><div align="right" class="Estilo72"><strong>Celular :</strong></div></td>
<td>
<div align="left" class="Estilo72">
<input name="cel" type="text" class="Estilo73" id="cel" value="<?php echo $celular ?>" size="20" maxlength="20" />
</div></td>
<td><div align="right" class="Estilo72"><strong>E-mail :</strong></div></td>
<td colspan="2"><div align="left" class="Estilo72">
<input name="email" type="text" class="Estilo73" id="email" value="<?php echo $email ?>" size="35" maxlength="35" />
</div></td>
</tr>
<tr>
<td><div align="right" class="Estilo72"><strong>Minutos :</strong></div></td>
<td><div align="left" class="Estilo72">
<input name="minutos" type="text" class="Estilo73" id="minutos" value="<?php echo $minutos ?>" size="10" maxlength="10" />
</div></td>
<td><div align="right" class="Estilo72"><strong>Cuenta No :</strong></div></td>
<td><div align="left" class="Estilo72">
<input name="cue" type="text" class="Estilo73" id="cue" value="<?php echo $numero_cuenta ?>" size="20" maxlength="20" />
</div></td>
<td><div align="right" class="Estilo72"><strong>Banco :</strong></div></td>
<td colspan="2"><div align="left" class="Estilo72">
<input name="ban" type="text" class="Estilo73" id="ban" value="<?php echo $banco ?>" size="20" maxlength="20" />
</div></td>
</tr>
<tr>
<td height="28"><div align="right" class="Estilo72"><strong>Numero Sim Card :</strong></div></td>
<td><div align="left" class="Estilo72">
<input name="numsim" type="text" class="Estilo73" id="numsim" value="<?php echo $numsim ?>" size="12" maxlength="10" />
</div></td>
<td><div align="right" class="Estilo72"><strong>Numero libranza:</strong></div></td>
<td ><div align="left" class="Estilo72">
<input name="numlib" type="text" class="Estilo73" id="numlib" value="<?php echo $numero_libranza ?>" size="12" maxlength="12" />
</div></td>
<th scope="col"><div align="right" class="Estilo72"><strong>Sucursal :</strong></div></th>
<th scope="col">
<div align="left">
<select name="sucursal" class="Estilo71">
<option value="">--SELECCIONE SUCURSAL--</option>
<?php
do {
?>
<option value="<?php echo $row_sql8['nombre'];?>"><?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></th>
</tr>
<tr>
<td><div align="right" class="Estilo72"><strong>Fecha Pago :</strong></div></td>
<td><div align="left" class="Estilo72">
<input name="fechapa" type="text" class="Estilo73" id="fechapa" value="0000-00-00" size="12" maxlength="12" />
</div></td>
<td><div align="right" class="Estilo72"><strong>Fecha Activacion :</strong></div></td>
<td><div align="left" class="Estilo72">
<input name="fechaact" type="text" class="Estilo73" id="fechaact" value="0000-00-00" size="12" maxlength="12" />
</div></td>
<td><div align="right" class="Estilo72"><strong>Fecha Vencimiento :</strong></div></td>
<td><div align="left" class="Estilo72">
<input name="fechaven" type="text" class="Estilo73" id="fechaven" value="0000-00-00" size="12" maxlength="12" />
</div></td>
</tr>
</table>
<p>
<label>
<input name="guardar" type="submit" class="Estilo53" id="guardar" value="GUARDAR" />
<input name="menu2" type="button" class="Estilo50" id="menu2" onClick="window.location.href='menu_control.php'" value="IR AL MENU">
</label>
</p>
</div>
</form>
</body>
</html>