File: /home/asjudine/www/confirmacion_cita.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();
$dia = date("d");
$mes = date("m");
$ano = date("Y");
$res = mysql_query('SELECT razon, cedula, sigla, direccion, telefono, email , representante, veedor, descripcion_actividad, zona, fecha_gestion, gestion, fecha_cita, hora_cita, sucursal FROM telemaprueba WHERE cedula = "' . $HTTP_GET_VARS["cedula"] . '" and zona = "' . $HTTP_GET_VARS["zona"] . '" and estado = "12" ');
if (!$res) {
die('Invalid query: ' . mysql_error());
}
list($razon, $cedula, $sigla, $direc, $tel, $email , $repre, $veedor1, $descri, $zona, $fecha_gest, $gestion, $fecha_cita, $hora_cita, $sucursal) = mysql_fetch_row($res);
if(isset($_POST["atras"]))
{
echo "<SCRIPT LANGUAGE='javascript'>window.location.href='listado_combrovacion_visita.php?zona=$zona'</SCRIPT>";
}
if(isset($_POST["rechazar"]))
{
$modificarcob = mysql_query("UPDATE telemaprueba set estado = '5' WHERE cedula = '" . $_POST["cedul"] . "'");
if (! $modificarcob) {
die('Invalid query: ' . mysql_error());
}
$modificar = mysql_query("UPDATE veeduria set estado = '4' WHERE cedula = '" . $_POST["cedul"] . "'");
if (! $modificar) {
die('Invalid query: ' . mysql_error());
}
echo "<script>alert('Visita rechazada Correctamente');</script>";
echo "<SCRIPT LANGUAGE='javascript'>window.location.href='listado_combrovacion_visita.php?zona=$zona'</SCRIPT>";
}
if(isset($_POST["guardar"]))
{
$modificarcob = mysql_query("UPDATE telemaprueba set fecha_cita = '" . $_POST["fechavis"] . "', hora_cita = '" . $_POST["horavis"] . "', sigla = '" . $_POST["sigla"] . "', direccion= '" . $_POST["direc"] . "', telefono = '" . $_POST["tel"] . "', email = '" . $_POST["email"] . "', gestion = '" . $_POST["gestion"] . "' WHERE cedula = '" . $_POST["cedul"] . "'");
if (! $modificarcob) {
die('Invalid query 40ff: ' . mysql_error());
}
echo "<script>alert('Informacion Guardada Correctamente');</script>";
echo "<SCRIPT LANGUAGE='javascript'>window.location.href='listado_combrovacion_visita.php?zona=$zona'</SCRIPT>";
}
if(isset($_POST["concretado"]))
{
$mssql = mysql_query('SELECT cedula FROM telemaprueba WHERE cedula = "' . $_POST["cedul"] . '" ');
if (!$mssql) {
die('Invalid query: ' . mysql_error());
}
list($ceduli) = mysql_fetch_row($mssql);
if ($cedul != $ceduli)
{
$inser2= mysql_query("INSERT INTO telemaprueba (cedula, razon, sigla, direccion, telefono, email, representante, veedor, descripcion_actividad, zona, fecha_gestion, gestion, fecha_cita, hora_cita, sucursal, estado) VALUES ('" . $HTTP_GET_VARS["cedula"] . "', '" . $_POST["razon"] . "', '" . $_POST["sigla"] . "', '" . $_POST["direc"] . "' , '" . $_POST["tel"] . "', '" . $_POST["email"] . "', '" . $_POST["repre"] . "', '" . $_POST["veedor"] . "', '" . $_POST["descri"] . "', '" . $_POST["zona"] . "', '" . $_POST["fecha"] . "', '" . $_POST["gestion"] . "', '" . $_POST["fechavis"] . "', '" . $_POST["horavis"] . "', '" . $_POST["sucu"] . "', '13')");
if (! $inser2) {
die('Invalid inser2 : ' . mysql_error());
}
}
else
{
if($veedor == ""){$veedor= $_POST["veedor1"] ; }else{$veedor = $_POST["veedor"] ; }
if($sucu == ""){$sucu= $_POST["sucu1"] ; }else{$sucu = $_POST["sucu"] ; }
$modificarcob = mysql_query("UPDATE telemaprueba set sigla = '" . $_POST["sigla"] . "', direccion= '" . $_POST["direc"] . "', telefono = '" . $_POST["tel"] . "', email = '" . $_POST["email"] . "', veedor = '" ."$veedor". "', fecha_gestion = '" . $_POST["fecha"] . "', gestion = '" . $_POST["gestion"] . "', fecha_cita = '" . $_POST["fechavis"] . "', hora_cita = '" . $_POST["horavis"] . "', sucursal = '" ."$sucu". "', estado = '13' WHERE cedula = '" . $_POST["cedul"] . "'");
if (! $modificarcob) {
die('Invalid query: ' . mysql_error());
}
}
$msy = mysql_query('SELECT cedula FROM veeduria WHERE cedula = "' . $_POST["cedul"] . '" ');
if (!$msy) {
die('Invalid query: ' . mysql_error());
}
list($cedulita) = mysql_fetch_row($msy);
if ($cedul != $cedulita)
{
if($_POST["veedor"] == ""){$veedor= $_POST["veedor1"] ; }else{$veedor = $_POST["veedor"] ; }
if($_POST["sucu"] == ""){$sucu= $_POST["sucu1"] ; }else{$sucu = $_POST["sucu"] ; }
$inser2= mysql_query("INSERT INTO veeduria (cedula, razon, sigla, direccion, telefono, email, representante, veedor, descripcion_actividad, zona, fecha_asignacion, gestion, fecha_visita, hora_visita, sucursal, estado) VALUES ('" . $HTTP_GET_VARS["cedula"] . "', '" . $_POST["razon"] . "', '" . $_POST["sigla"] . "', '" . $_POST["direc"] . "' , '" . $_POST["tel"] . "', '" . $_POST["email"] . "', '" . $_POST["repre"] . "', '" ."$veedor". "', '" . $_POST["descri"] . "', '" . $_POST["zona"] . "', '" . $_POST["fecha"] . "', '" . $_POST["gestion"] . "', '" . $_POST["fechavis"] . "', '" . $_POST["horavis"] . "', '" ."$sucu". "', '1')");
if (! $inser2) {
die('Invalid inser2 : ' . mysql_error());
}
}
else
{
if($_POST["veedor"] == ""){$veedor= $_POST["veedor1"] ; }else{$veedor = $_POST["veedor"] ; }
if($_POST["sucu"] == ""){$sucu= $_POST["sucu1"] ; }else{$sucu = $_POST["sucu"] ; }
$modificarcob = mysql_query("UPDATE veeduria set sigla = '" . $_POST["sigla"] . "', direccion= '" . $_POST["direc"] . "', telefono = '" . $_POST["tel"] . "', email = '" . $_POST["email"] . "', veedor = '" ."$veedor". "', fecha_asignacion = '" . $_POST["fecha"] . "', gestion = '" . $_POST["gestion"] . "', fecha_visita = '" . $_POST["fechavis"] . "', hora_visita = '" . $_POST["horavis"] . "', sucursal = '" ."$sucu". "', estado = '1' WHERE cedula = '" . $_POST["cedul"] . "'");
if (! $modificarcob) {
die('Invalid query: ' . mysql_error());
}
}
echo "<script>alert('Visita Asignada Correctamente');</script>";
echo "<SCRIPT LANGUAGE='javascript'>window.location.href='listado_combrovacion_visita.php?zona=$zona'</SCRIPT>";
}
$sql = mysql_query('SELECT * FROM sucursal order by nombre ');
if (!$sql) {
die('Invalid query 12: ' . mysql_error());
}
$row_sql = mysql_fetch_assoc($sql);
$totalRows_sql = mysql_num_rows($sql);
$sql2 = mysql_query('SELECT * FROM veedores_ciudadanos order by codigo ');
if (!$sql2) {
die('Invalid query 12: ' . mysql_error());
}
$row_sql2 = mysql_fetch_assoc($sql2);
$totalRows_sql2 = mysql_num_rows($sql2);
?>
<html>
<head>
<title>Aprobacion Telemercadeo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.titulos {font: 16px; color: red; font-family:Arial; font-weight:bold}
.boton { background-color: #FFCCCC; color:#FFFFFF; width:150px; border: 4px solid #0000CC; font-family:Arial; color:#990000;}
.texto {background-color: #FFFFCC; font-size: 13px; font-family: Arial; color:#0000CC; display: block;}
.fecha {background-color: #CCFFCC; font-size: 12px; font-family: Arial; color: #000099; width:10px display: block;}
.campo {background-color: #99FFCC; border:1px solid #990000;}
.lista { background-color:#99FFFF; font-family: Arial; font-size: 11px; color: #990000;}
.label {background-color: #CCFFFF ; font-size: 14px; font-family: Arial; color:#0000CC; display: block;}
.labe2 {background-color: #CCFFFF ; font-size: 14px; font-family: Arial; color:#0000CC; }
.area {background-color: #CCFFCC; font-size: 13px; width:40px font-family: Arial; color:#0000CC; display: block;}
.variables {background-color: #CCFFCC; font-size: 12px; font-family: Arial; color: #003333 ; width:10px display: block; border: 2px solid #006633;}
.sel { background-color:#DDFFFF; width:400px; border: 1px solid #0099FF; font-family:Arial; font-style:italic; color:#990000 }
.seleccion { background-color: #CCFFCC; width:340px; border: 1px solid #0099FF; font-family:Arial; color:#990000;}
.boton2 {font-family: Verdana; font-size: 8 pt; color: #000080; background-color: #C0C0C0; border-style: solid; }
body {
background-image: url(fondo_argollado.gif);
}
.boton1 {background-color: #FFCCCC; color:#FFFFFF; width:90px; height:25; border: 3px solid #0000CC; font-family:Arial; color:#990000;}
.Estilo1 {color: #00CCFF}
.Estilo2 {color: red}
.Estilo3 {color: #0000CC}
.Estilo8 {background-color: #CCFFFF; font-size: 14px; font-family: Arial; color: #003366; display: block; }
.Estilo10 {background-color: #FFFFCC; font-size: 13px; font-family: Arial; color: #990066; display: block; }
.Estilo11 {
color: #000066;
font-weight: bold;
}
-->
</style>
<script languaje="JavaScript">
function Mostrar_Fecha()
{
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado")
var montharray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre")
document.write("<b><font face='Arial, Helvetica, sans-serif'>"+dayarray[day]+" "+daym+" de "+montharray[month]+" de "+year+"</font></b>")
}
</script>
<script Language="JavaScript">
<!--
function validar(formulario)
{
if (formulario.fecha.value == "0000-00-00")
{
alert("Falta digitar Fecha Asesor");
formulario.fecha.focus();
return (false);
}
if (formulario.visitacon.value == "")
{
alert("Falta seleccionar informe de visita");
formulario.visitacon.focus();
return (false);
}
return (true);
}
//--></script>
<SCRIPT LANGUAGE='JavaScript'>
var default1 = "VENTANA PARA LA MODIFICACION DE REVISTAS PREJURIDICAS"; // only shown once at page load
var text1 = "El primer encabezado muestra en detalle los datos del proceso seleccionado";
var text2 = "la segunda parte muestra el record de actuaciones";
var text3 = "Revise bien las actuaciones y los número de folios";
var changeRate = 3000; // 1000 = 1 second
var messageNumber = 0;
function changeStatus()
{
if (messageNumber == 0) {
window.status=default1;
document.title=default1;
}
else if (messageNumber == 1) {
window.status=text1;
}
else if (messageNumber == 2) {
window.status=text2;
}
else if (messageNumber == 3) {
window.status=text3;
messageNumber = 0;
}
messageNumber++;
setTimeout("changeStatus();",changeRate);
}
changeStatus(); // leave here to run right away
// -->
</SCRIPT>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="document.formulario.folio1.focus()">
<form name="consulta" method="post" action="<?php echo $editFormAction; ?>" onSubmit="return validar(this)">
<table width="780" border="0" align="center" cellpadding="2" cellspacing="2">
<tr bgcolor="#CCFFFF">
<td width="772" class="titulos"><div align="center">CONFIRMACION CITA </div></td>
</tr>
<tr bgcolor="#FFCC99">
<td height="19" class="fecha"><span class="Estilo1"></span>
<div align="center">
<script languaje="JavaScript">Mostrar_Fecha()</script>
</div></td>
</tr>
<tr bgcolor="#FFCC99">
<td height="20" bgcolor="#FFFFFF"><fieldset>
<legend><span class="Estilo10">Datos del Empresario:</span></legend>
<table width="741" border="0" cellspacing="1" cellpadding="0">
<tr bgcolor="#FFFFFF">
<th width="109" colspan="1" align="left"><span class="Estilo8">Nit</span></th>
<td width="305" align="left"><input name="cedul" type="text" class="campo" id="cedul" value="<?php echo $cedula; ?>" size="15" maxlength="15" readonly="" > </td>
<th width="143" align="left"><span class="Estilo8" > Sigla:</span></th>
<td width="152" ><span class="Estilo2"></span>
<input name="sigla" type="text" class="campo" id="sigla" value="<?php echo $sigla; ?>" size="25" maxlength="25" ></td>
</tr>
<tr bgcolor="#FFFFFF">
<th align="left"><span class="Estilo8">Razon Social:</span></th>
<td ><input name="razon" type="text" class="campo" id="razon" value="<?php echo $razon; ?>" size="50" maxlength="50" readonly="" ></td>
<th align="left" bordercolor="#E2E2E2"><span class="Estilo8">Zona:</span></th>
<td><input name="zona" type="text" class="campo" id="zona" value="<?php echo $zona; ?>" size="10" maxlength="10" ></td>
</tr>
<tr bgcolor="#FFFFFF">
<th align="left"><span class="Estilo8">Dirección:</span></th>
<td colspan="1"><input name="direc" type="text" class="campo" id="direc" value="<?php echo $direc; ?>" size="50" maxlength="50"></td>
<th align="left" bordercolor="#E2E2E2"><span class="Estilo8">Telefono:</span></th>
<td><input name="tel" type="text" class="campo" id="tel" value="<?php echo $tel; ?>" size="10" maxlength="10" ></td>
</tr>
<tr bgcolor="#FFFFFF">
<th align="left" bgcolor="#FFFFFF"><span class="Estilo8">Representante Legal:</span></th>
<td colspan="1"><input name="repre" type="text" class="campo" id="repre" value="<?php echo $repre; ?>" size="50" maxlength="50" ></td>
<th align="left" bordercolor="#E2E2E2" bgcolor="#FFFFFF"><span class="Estilo8">Fecha Visita: </span></th>
<td ><input name="fechavis" type="text" class="campo" id="fechavis" value="<?php echo $fecha_cita; ?>" size="12" maxlength="14" > </td>
</tr>
<tr bgcolor="#FFFFFF">
<th align="left"><span class="Estilo8">Email:</span></th>
<td colspan="1"><input name="email" type="text" class="campo" id="email" value="<?php echo $email; ?>" size="50" maxlength="50" ></td>
<th align="left" bordercolor="#E2E2E2"><span class="Estilo8">Hora Visita: </span></th>
<td ><input name="horavis" type="text" class="campo" id="horavis" value="<?php echo $hora_cita; ?>" size="12" maxlength="14" > </td>
</tr> <tr bgcolor="#FFFFFF">
<th align="left"><span class="Estilo8">Representante Legal:</span></th>
<td colspan="1"><input name="repre" type="text" class="campo" id="repre" value="<?php echo $repre; ?>" size="50" maxlength="50" ></td>
<th width="166"><span class="Estilo8">Sucursal : </span></th>
<td width="186">
<input name="sucu1" type="text" class="campo" id="sucu1" value="<?php echo $sucursal; ?>" size="20" maxlength="20" >
<select name="sucu">
<option value = "">SELECCIONE SUCURSAL</option>
<?php
do {
?>
<option value="<?php echo $row_sql['nombre'];?>"><?php echo $row_sql['nombre']?></option>
<?php
} while ($row_sql = mysql_fetch_assoc($sql));
$rows = mysql_num_rows($sql);
if($rows > 0) {
mysql_data_seek($sql, 0);
$row_sql = mysql_fetch_assoc($sql);
}
?>
</select> </td>
</tr>
<tr>
<th align="left" ><span class="Estilo8">Objeto Social:</span></th>
<td colspan="3" align="left"><input name="descri" cols="70" rows="5" type="text" class="campo" id="descri" value="<?php echo $descri; ?>" size="100" maxlength="90" ></td>
</tr>
<tr>
<th align="left" ><span class="Estilo8">Fecha Gestion:</span></th>
<td><input name="fecha" type="text" class="campo" id="fecha" value="<?php echo $fecha_gest; ?>" size="14" maxlength="14" ></td>
<th width="166"><span class="Estilo8">Nombre Veedor: : </span></th>
<td width="186">
<input name="veedor1" type="text" class="campo" id="veedor1" value="<?php echo $veedor1 ?>" size="30" maxlength="30" >
<select name="veedor">
<option value = "">SELECCIONE VEEDOR</option>
<?php
do {
?>
<option value="<?php echo $row_sql2['nombre'];?>"><?php echo $row_sql2['nombre']?></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>
</tr>
<tr >
<th align="center"><span class="Estilo8">Gestion:</span></th>
<td align="center" nowrap colspan="4"><textarea name="gestion" cols="90" rows="5" id="gestion" >-<?php echo $gestion ?></textarea></td>
</tr>
</table>
</fieldset></td>
</tr>
</table>
<tr bgcolor="#FFCC99">
<td height="20" bgcolor="#99CCFF"><div align="center">
<input name="concretado" type="submit" class="Estilo2" value ="CONFIRMACION VISITA" >
<input name="rechazar" type="submit" class="Estilo2" value ="RECHAZAR" >
<input name="menu" type="button" class="Estilo11" id="menu" onClick=window.open("http://webmail.cooveeduria.org.co/imp/login.php") value="Enviar Email" />
<input name="guardar" type="submit" class="Estilo2" value ="PENDIENTE" >
</div></td>
</tr>
<br>
<br>
</table>
</form>
</body>
<p align="center">
<input name="menu" type="button" class="Estilo3" id="menu" onClick="window.location.href='listado_combrovacion_visita.php?zona=<?php echo $zona; ?>'" value="LISTADO CONFIRMACION VISITA " />
<input name="menu" type="button" class="Estilo3" id="menu" onClick="window.location.href='menu_telemercadeo.php'" value="MENU TELEMERCADEO" />
</p>