<a href='Datos_origen_llamada.php'>Exportar</a><?header("Content-Type: application/vnd.ms-excel");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("content-disposition: attachment;filename=Reportes.xls");?>
Código HTML:
<html> <head> <title>Informes</title> <meta http-equiv="Content-Type" content=""> <!-- --> <style type="text/css"> .estilo1 { font-family: Trebuchet MS; font-size: 14px; color: #000000; font-weight: bold; } .estilo2 { font-family:Trebuchet MS; font-size: 18px; color: #B40404; font-weight: bold; } </style> </head> <table width="520" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="13"></td> <td><img src="http://www.forosdelweb.com/f18/images/informe.jpg" width="128" height="90" align="center"></td> </tr> <? /*header('Content-type: application/vnd.ms-excel'); header("Content-Disposition: attachment; filename=archivo.xls"); header("Pragma: no-cache"); header("Expires: 0");*/ include ("conexion.php"); $Link=conexion(); $Fecha_Inicio=isset($_POST["Fecha_i"])? $_POST["Fecha_i"]: ''; $Nombre=isset($_POST["Nombre"]) ? $_POST["Nombre"]: ''; $Fecha_Fin=isset($_POST["Fecha_f"]) ? $_POST["Fecha_f"]: ''; //$Hora_Inicio=$_POST['Hora_i']; //$Hora_Fin=$_POST['Hora_f']; $Codigo_llamada=isset($_POST["Codigo_llamada"]) ? $_POST["Codigo_llamada"]: ''; $Origen_llamada=isset($_POST["Origen_llamada"])? $_POST["Origen_llamada"]: ''; $Destino_llamada=isset($_POST["Destino_llamada"])? $_POST["Destino_llamada"]: ''; $Cod_autorizacion=isset($_POST["Cod_autorizacion"])? $_POST["Cod_autorizacion"]: ''; //echo $Origen_llamada; $Grupos=isset($_POST["Grupos"])? $_POST["Grupos"]: ''; $Dia=substr($Fecha_Inicio,0,2); $Mes=substr($Fecha_Inicio,3,2); $Año=substr($Fecha_Inicio,8,9); $Fecha_i=$Dia.$Mes.$Año; $Dia=substr($Fecha_Fin,1,1); $Mes=substr($Fecha_Fin,3,2); $Año=substr($Fecha_Fin,8,9); $Fecha_f=$Dia.$Mes.$Año; /*echo $Fecha_Fin; echo "<br>"; echo $Codigo_llamada; echo "<br>"; echo $Origen_llamada; echo "<br>"; echo $Destino_llamada; echo "<br>"; echo $Cod_autorizacion; echo "<br>"; echo $Grupos;*/ ///////////////////////////////////////////////////////////////// echo "<table border='2' align='center'>"; echo "<tr><td class='estilo2'>Informacion general </td></tr>"; echo "</table>"; echo "<table border='2' align='center'>"; echo "<tr>"; echo "<td>Date</td><td>Time</td><td>Calling_num</td><td>Nombre</td><td>Apellido</td><td>Dialed_num</td><td>Llamada</td><td>Sec_dur</td><td>Cond_code</td>"; echo "</tr>"; $a=0;//Celular $b=0;//Internacional $c=0;//Nacionales $d=0;//Local /*$sql=mysql_query("select Date,Calling_num,Dialed_num,Sec_dur,Cond_code from principal where Date>='$Fecha_i' and Date<='$Fecha_f' and Calling_num in (select Extension from usuarios where id_Grupo='$Grupos')") or die ("problemas en el insert".mysql_error()); $num=mysql_num_rows($sql); echo $num;*/ $sql=mysql_query("select Date,Time,Calling_num,Dialed_num,Sec_dur,Cond_code from principal where Date>='$Fecha_i' and Date<='$Fecha_f' and Calling_num like '%$Origen_llamada%' order by Sec_dur Desc") or die("problemas en el insert".mysql_error()); while ($row=mysql_fetch_array($sql)) { $Date=$row['Date']; $Time=$row['Time']; $Origen_llamada=$row['Calling_num']; $Destino_llamada=$row['Dialed_num']; $Duracion_llamada=$row['Sec_dur']; $Codigo_llamada=$row['Cond_code']; $ssql=mysql_query("select Nombre,Apellido from usuarios where Extension='$Origen_llamada'"); $row=mysql_fetch_array($ssql); $Nombre=$row['Nombre']; $Apellido=$row['Apellido']; $ssql=mysql_query("select Descripcion from grupos where id_Grupo in (select id_Grupo from usuarios where Extension='$Destino_llamada')"); $arreglo=mysql_fetch_array($ssql); $Grupo=$arreglo['Descripcion']; $Celular=strlen($Destino_llamada); if ($Celular==11) { $Grupo='Celular'; } $Nacional=strlen($Destino_llamada); if ($Nacional==9) { $Grupo='Nacional'; } $Local=strlen($Destino_llamada); if ($Local==7) { $Grupo='Local'; } if ($Celular==33) { $Grupo='Celular'; } $Atencion=substr($Destino_llamada,0,2) ; if ($Atencion==18) { $Grupo='Atencion al usuario'; } if($Nombre=="") { $Nombre='Login'; $Apellido='id'; } echo "<tr>"; echo "<td>".$Date."</td>"; echo "<td>".$Time."</td>"; echo "<td>".$Origen_llamada."</td>"; echo "<td>".$Nombre."</td>"; echo "<td>".$Apellido."</td>"; echo "<td>".$Destino_llamada."</td>"; echo "<td>".$Grupo."</td>"; echo "<td>".$Duracion_llamada."</td>"; echo "<td>".$Codigo_llamada."</td>"; echo "</tr>"; //////////////////////////////////////////////// $Destino_llamada=substr($Destino_llamada,0,2); if($Destino_llamada==33) { $a=$a+1;//hacer solo un if para celular echo $Destino_llamada } elseif($Destino_llamada==18) { $b=$b+1; } elseif(substr($Destino_llamada,0,1)==5) { $c=$c+1; } else { $d=$d+1; } ///// } echo "</table>"; ?> <p align="center"> <form action="/principal/tarificador/consulta/Celular_origen_llamada.php" method="post" > <input type="hidden" name="Fecha_i" value="<?php echo $Fecha_Inicio; ?>"> <input type="hidden" name="Fecha_f" value="<?php echo $Fecha_Fin; ?>"> <input type="hidden" name="Hora_i" value="<?php echo $Hora_Inicio; ?>"> <input type="hidden" name="Hora_f" value="<?php echo $Hora_Fin; ?>"> <input type="hidden" name="Codigo_llamada" value="<?php echo $Codigo_llamada; ?>"> <input type="hidden" name="Origen_llamada" value="<?php echo $Origen_llamada; ?>"> <input type="hidden" name="Destino_llamada" value="<?php echo $Destino_llamada; ?>"> <input type="hidden" name="Cod_autorizacion" value="<?php echo $Cod_autorizacion; ?>"> <input type="hidden" name="Grupos" value="<?php echo $Grupos; ?>"> <!--<input type="submit" name="submit" class="btn" alt="submit" value="Celular"> --> </form> </p> <p align="center"> <form action="/principal/tarificador/consulta/Local_origen_llamada.php" method="post" > <input type="hidden" name="Fecha_i" value="<?php echo $Fecha_Inicio; ?>"> <input type="hidden" name="Fecha_f" value="<?php echo $Fecha_Fin; ?>"> <input type="hidden" name="Hora_i" value="<?php echo $Hora_Inicio; ?>"> <input type="hidden" name="Hora_f" value="<?php echo $Hora_Fin; ?>"> <input type="hidden" name="Codigo_llamada" value="<?php echo $Codigo_llamada; ?>"> <input type="hidden" name="Origen_llamada" value="<?php echo $Origen_llamada; ?>"> <input type="hidden" name="Destino_llamada" value="<?php echo $Destino_llamada; ?>"> <input type="hidden" name="Cod_autorizacion" value="<?php echo $Cod_autorizacion; ?>"> <input type="hidden" name="Grupos" value="<?php echo $Grupos; ?>"> <!--<input type="submit" name="submit" class="btn" alt="submit" value="Local"> --> </form> </p> <p align="center"> <form action="/principal/tarificador/consulta/Nacional_origen_llamada.php" method="post" > <input type="hidden" name="Fecha_i" value="<?php echo $Fecha_Inicio; ?>"> <input type="hidden" name="Fecha_f" value="<?php echo $Fecha_Fin; ?>"> <input type="hidden" name="Hora_i" value="<?php echo $Hora_Inicio; ?>"> <input type="hidden" name="Hora_f" value="<?php echo $Hora_Fin; ?>"> <input type="hidden" name="Codigo_llamada" value="<?php echo $Codigo_llamada; ?>"> <input type="hidden" name="Origen_llamada" value="<?php echo $Origen_llamada; ?>"> <input type="hidden" name="Destino_llamada" value="<?php echo $Destino_llamada; ?>"> <input type="hidden" name="Cod_autorizacion" value="<?php echo $Cod_autorizacion; ?>"> <input type="hidden" name="Grupos" value="<?php echo $Grupos; ?>"> <!-- <input type="submit" name="submit" class="btn" alt="submit" value="Nacional"> --> </form> </p> <p align="center"> <form action="/principal/tarificador/consulta/Atencion_origen_llamada.php" method="post" > <input type="hidden" name="Fecha_i" value="<?php echo $Fecha_Inicio; ?>"> <input type="hidden" name="Fecha_f" value="<?php echo $Fecha_Fin; ?>"> <input type="hidden" name="Hora_i" value="<?php echo $Hora_Inicio; ?>"> <input type="hidden" name="Hora_f" value="<?php echo $Hora_Fin; ?>"> <input type="hidden" name="Codigo_llamada" value="<?php echo $Codigo_llamada; ?>"> <input type="hidden" name="Origen_llamada" value="<?php echo $Origen_llamada; ?>"> <input type="hidden" name="Destino_llamada" value="<?php echo $Destino_llamada; ?>"> <input type="hidden" name="Cod_autorizacion" value="<?php echo $Cod_autorizacion; ?>"> <input type="hidden" name="Grupos" value="<?php echo $Grupos; ?>"> <!--<input type="submit" name="submit" class="btn" alt="submit" value="Atencion al usuario"> --> </form> </p> [COLOR="Red"]<a href='Datos_origen_llamada.php'>Exportar</a><?header("Content-Type: application/vnd.ms-excel"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("content-disposition: attachment;filename=Reportes.xls");?>[/COLOR] <p><a href="/principal/Tarificador/reportes.php"><img src="http://www.forosdelweb.com/f18/images/anterior.jpg" width="50" height="50" align="left" /></a></p> <td> <img src="http://www.forosdelweb.com/f18/images/informe1.jpg" width="1258" height="150"align="right"> </td>