2 error_reporting(E_STRICT | E_ALL
);
3 date_default_timezone_set ('America/El_Salvador');
4 require_once('../include/const.php');
5 require_once('../include/sesion.php');
6 require_once('../include/fecha.php');
7 require_once('sub.php');
9 if ( isset($_GET['completo']) ) CONTENIDO__usuarios_completos();
10 if ( isset($_GET['resumen']) && isset($_GET['catorcena']) ) CONTENIDO__usuarios_resumen();
12 function CONTENIDO__usuarios_completos(){
13 global $session, $database, $form;
15 if ( !$session->isAdmin() ) {
16 $where .= " AND userlevel = ".CLIENT_LEVEL
;
18 if ( isset($_GET['nivel']) ) {
20 $where .= " AND userlevel='".mysql_real_escape_string($_GET['nivel'])."'";
24 if ( isset($_GET['catorcena']) ) {
25 if ($_GET['catorcena']) {
26 $where .= " AND codigo IN (SELECT codigo FROM ".TBL_MUPI_ORDERS
." WHERE codigo_pedido IN (SELECT codigo_pedido FROM ".TBL_MUPI_FACES
." WHERE catorcena='".mysql_real_escape_string($_GET['catorcena'])."'))";
30 $q = "SELECT * FROM ".TBL_USERS
." WHERE 1=1 $where ORDER BY userlevel DESC;";
32 $result = $database->query($q);
33 /* Error occurred, return given name by default */
34 $num_rows = mysql_numrows($result);
35 if(!$result ||
($num_rows < 0)){
36 $html .= "Error mostrando la información";
40 /*Esto nunca deberia de pasar realmente...*/
41 $html .= Mensaje ("¡No hay clientes/usuarios ingresados que coincidan con los criterios del filtro!", _M_INFO
);
45 echo '<table border="0">';
46 if ( $session->isAdmin() ) {
47 echo "<tr><th>Código</th><th>Nombre</th><th>Nivel</th><th>Email</th><th>Última actividad</th><th>Acciones</th></tr>";
49 echo "<tr><th>Nombre</th><th>Código</th><th>Acciones</th></tr>";
51 for($i=0; $i<$num_rows; $i++
){
53 $uname = mysql_result($result,$i,"codigo");
54 $logotipo = CargarImagenDesdeBD(mysql_result($result,$i,"logotipo"));
55 $nombre = mysql_result($result,$i,"nombre");
56 if ($session->isAdmin()) $ulevel = mysql_result($result,$i,"userlevel");
57 if ($session->isAdmin()) $email = mysql_result($result,$i,"email");
58 if ($session->isAdmin()) $time = date("d-m-y\nh:ia", mysql_result($result,$i,"timestamp"));
59 if ($session->isAdmin()) $acciones .= CREAR_LINK_GET("gestionar+pedidos:$uname", "Pedidos", "Le mostrara los pedidos realizados por este cliente y le dará la opción de agregar más.")."<br />";
60 if ($session->isAdmin()) $acciones .= CREAR_LINK_GET("gestionar+pantallas:$uname", "Pantallas", "Le mostrara las pantallas en las cuales se encuentran colocados los pedidos.")."<br />";
61 $acciones .= CREAR_LINK_GET("ver+ubicaciones:$uname", "Ubicaciones", "Le mostrara las ubicaciones de los MUPIS de este cliente.")."<br />";
62 $acciones .= CREAR_LINK_GET("ver+estadisticas:$uname", "Estadísticas", "Le mostrara las estadísticas de este cliente.")."<br />";
63 if ($session->isAdmin()) $acciones .= "<hr />".CREAR_LINK_GET("ver+reportes:$uname", "Reporte", "Le generará un reporte sobre este cliente.");
64 if ($session->isAdmin()) $uname = CREAR_LINK_GET("ver+cliente:".$uname, $uname, "Ver datos de este cliente");
65 if ($session->isAdmin()) {
66 $html .= "<tr><td style='text-align:center;'>$logotipo<br />$uname</td><td>$nombre</td><td>$ulevel</td><td>$email</td><td>$time</td><td>$acciones</td></tr>";
68 $html .= "<tr><td style='text-align:center;'>$logotipo<br />$nombre</td><td>$uname</td><td>$acciones</td></tr>";
72 if ( $session->isAdmin() ) {
73 $html .= "<td colspan='5'>Total de registros encontrados para el filtro seleccionado</td><td>$num_rows</td>";
75 $html .= "<td colspan='2'>Total de registros encontrados para el filtro seleccionado</td><td>$num_rows</td>";
78 $html .= "</table><br />";
82 function CONTENIDO__usuarios_resumen(){
83 global $session, $database, $form;
85 $catorcena = mysql_real_escape_string($_GET['catorcena']);
86 $q_nPantalas = "(SELECT COUNT(*) as cuenta FROM ". TBL_MUPI_FACES
." AS c WHERE catorcena=".$catorcena." AND codigo_pedido IN (SELECT codigo_pedido from ".TBL_MUPI_ORDERS
." AS b WHERE b.codigo = a.codigo)) AS npantallas";
87 $q_nPantalas_Veh = "(SELECT COUNT(*) as cuenta FROM ". TBL_MUPI_FACES
." AS c WHERE tipo_pantalla='0' AND catorcena=".$catorcena." AND codigo_pedido IN (SELECT codigo_pedido from ".TBL_MUPI_ORDERS
." AS b WHERE b.codigo = a.codigo)) AS npantallasv";
88 $q_nPantalas_Pea = "(SELECT COUNT(*) as cuenta FROM ". TBL_MUPI_FACES
." AS c WHERE tipo_pantalla='1' AND catorcena=".$catorcena." AND codigo_pedido IN (SELECT codigo_pedido from ".TBL_MUPI_ORDERS
." AS b WHERE b.codigo = a.codigo)) AS npantallasp";
89 $q = "SELECT nombre, $q_nPantalas, $q_nPantalas_Veh , $q_nPantalas_Pea FROM ".TBL_USERS
." AS a WHERE codigo IN (SELECT codigo FROM ".TBL_MUPI_ORDERS
." WHERE codigo_pedido IN (SELECT codigo_pedido FROM ".TBL_MUPI_FACES
." WHERE catorcena='".$catorcena."'));";
91 $result = $database->query($q);
92 /* Error occurred, return given name by default */
93 $num_rows = mysql_numrows($result);
94 if(!$result ||
($num_rows < 0)){
95 $html .= "Error mostrando la información";
99 /*Esto nunca deberia de pasar realmente...*/
100 $html .= Mensaje ("¡No hay clientes/usuarios ingresados que coincidan con los criterios del filtro!", _M_INFO
);
104 echo '<table border="0">';
105 echo "<tr><th>Nombre</th><th>Número de pantallas</th><th>Vehiculares</th><th>Peatonales</th></tr>";
106 for($i=0; $i<$num_rows; $i++
){
107 $nombre = mysql_result($result,$i,"nombre");
108 $npantallas = mysql_result($result,$i,"npantallas");
109 $npantallasv = mysql_result($result,$i,"npantallasv");
110 $npantallasp = mysql_result($result,$i,"npantallasp");
111 $html .= "<tr><td style='text-align:center;'>$nombre</td><td>$npantallas</td><td>$npantallasv</td><td>$npantallasp</td></tr>";
114 $html .= "<td colspan='3'>Total de registros encontrados para el filtro seleccionado</td><td>$num_rows</td>";
116 $html .= "</table><br />";