Clase ControlTelefónico.php :
Código:
Código HTML:
Ver original<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//ES" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <meta name="keywords" content="" /> <meta name="description" content="" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="JavaScript" type="text/JavaScript" src="Recursos/plantilla.js"> </script> <link href="Recursos/plantilla.css" rel="stylesheet" type="text/css"> <link rel="shortcut icon" href="Recursos/telmex_ico.ico"> <script src="mootools-core-1.3.2-full-compat-yc.js" type="text/javascript"></script> <script language="javascript">
timer=setTimeout("verseleccion();verseleccion_concepto()",0);;
function verseleccion()
{
window.addEvent('domready', function(){
var valor_mes="";
var valor_annio="";
var valor_sub="";
var valor="";
var sub=document.getElementById("cb_subdireccion");
var valor_sub=sub.value;
var mes=document.getElementById("cb_mes");
var valor_mes=mes.value;
var annio=document.getElementById("cb_anio");
var valor_annio=annio.value;
var valor="";
var mis_datos = [
[
valor_mes,
],
[
valor_annio,
],
[
valor_sub,
],
[
valor,
],
];
//convierto ese array en un JSON con Mootools
var miJSON = JSON.encode(mis_datos);
//pondríamos esto para ver el JSON generado en la capa con id=resultado
//$('resultado').set("html", "
<pre>" + miJSON + "
</pre>");
//creo una conexión
var miAjax = new Request({
url: "recibo-json.php",
data: "datos=" + miJSON,
onSuccess: function(textoRespuesta){
$('resultado').set("html", textoRespuesta);
},
onFailure: function(){
$('resultado').set("html", "fallo en la conexión Ajax");
}
})
miAjax.send();
});
}
function verseleccion_concepto()
{
window.addEvent('domready', function(){
var valor_mes="";
var valor_annio="";
var valor_sub="";
var valor="";
var sub=document.getElementById("cb_subdireccion");
var valor_sub=sub.value;
var mes=document.getElementById("cb_mes");
var valor_mes=mes.value;
var annio=document.getElementById("cb_anio");
var valor_annio=annio.value;
var valor=window.location.hash;
var mis_datos = [
[
valor_mes,
],
[
valor_annio,
],
[
valor_sub,
],
[
valor,
],
];
//convierto ese array en un JSON con Mootools
var miJSON = JSON.encode(mis_datos);
//pondríamos esto para ver el JSON generado en la capa con id=resultado
//$('resultado').set("html", "
<pre>" + miJSON + "
</pre>");
//creo una conexión
var miAjax = new Request({
url: "recibo-json.php",
data: "datos=" + miJSON,
onSuccess: function(textoRespuesta){
$('resultado').set("html", textoRespuesta);
},
onFailure: function(){
$('resultado').set("html", "fallo en la conexión Ajax");
}
})
miAjax.send();
});
}
<title>TELMEX - Control Telef
ónico</title>
<?php
header("Content-Type: text/html;charset=utf-8");//para manejar acéntos
session_start();
include_once 'Conexion.php';
if($_SESSION['usuario'])
{
$usuario=$_SESSION['usuario'];
include_once 'Conexion.php';
$consulta="SELECT nombre_usuario, a_paterno, a_materno FROM usuario WHERE usuario='".$usuario."'";
mysql_query("SET NAMES 'utf8'");
$res=mysql_query($consulta);
mysql_connect("localhost","control_tel","admin");
mysql_select_db("control_telefonico");
while ($row = mysql_fetch_row($res))
{
?>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload=tiempo()>
<table width="100%" height="80%" border="0"> <td height="10"><table width="100%" border="0" cellspacing="0" cellpadding="0" VALIGN="top">
<td width="100%" height="46" valign="bottom">
<h1><font color="#2E73C8"> Control Telef
ónico</font></h1></td>
<td width="10%"><center><img align= "center" src="Recursos/logo_telmex.jpg" width="226" height="45"></center></td>
</tr>
<tr>
<td colspan="2" bgColor="#2E73C8" height="25" valign="bottom">
<h2><font color="#F7F8E0">
<?php
$fecha =time();
if(date("a")=="am")
{
echo "Buenos días";
}
else
{
echo "Buenas tardes";
}
header("Content-Type: text/html;charset=utf-8");
echo " ";
echo "$row[0]";
echo " ";
echo "$row[1]";
echo " ";
echo "$row[2]";
}
}
else
{
echo 'No has iniciado sesion';
}
?>
<td height="22" valign="top"> <center>
<h2><font>Generar Reporte:
</font></h2>
<table width="100%" height="100%"> <td width="38%" height="49"> <center>
<?php
$SQL="SELECT DISTINCT mes_text FROM cuenta order by mes DESC";
$result=mysql_query($SQL);
echo '<select name="cb_mes" id="cb_mes" size=1 style="width:120px" onchange="verseleccion(); verseleccion_concepto()">';
// DESPLIEGA
while ($row=mysql_fetch_array($result))
{
echo '
<option value="'.$row["mes_text"].'">'.$row["mes_text"];
}
//mysql_free_result($result);
?>
<strong> A
ño:</strong>
<?php
$SSQL="SELECT DISTINCT anio FROM cuenta order by anio";
$resultado=mysql_query($SSQL);
echo '
<select name="cb_anio" id="cb_anio" size=1 style="width:80px" onchange="verseleccion(); verseleccion_concepto()">';
// DESPLIEGA
while ($row=mysql_fetch_array($resultado))
{
echo '
<option value="'.$row["anio"].'">'.$row["anio"];
}
//mysql_free_result($resultado);
?>
</center>
<form name="subdireccion" method="post">
<?php
$SQL="SELECT DISTINCT area FROM cuenta order by area DESC";
$result=mysql_query($SQL);
echo '<select name="cb_subdireccion" id="cb_subdireccion" size=1 style="width:430px" onchange="verseleccion(); verseleccion_concepto()">';
// DESPLIEGA
while ($row=mysql_fetch_array($result))
{
echo '
<option value="'.$row["area"].'">'.$row["area"];
}
//mysql_free_result($result);
?>
</center>
<td colspan="2" bgColor="#2E73C8" height="5" valign="bottom">
<td valign="top"><center>
<?php
function dameURL()
{
$url="http://".$_SERVER['HTTP_HOST'].":".$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI'];
return $url;
}
echo 'Valor URL: ';
echo dameURL();
?>