Ejemplo n.º 1
0
function aut_prod($f_division, $f_area, $f_proyecto)
{
    if (!$f_division) {
        $f_division = '%';
    }
    if (!$f_area) {
        $f_area = '%';
    }
    if (!$f_proyecto) {
        $f_proyecto = '%';
    }
    ?>
<table align="center" border="1">
<thead>
	<tr>
		<td align="center" bgcolor="#FFCC00"><b>División</b></td>
        <td align="center" bgcolor="#FFCC00"><b>Área</b></td>
        <td align="center" bgcolor="#FFCC00"><b>Proyecto</b></td>
        <td align="center" bgcolor="#FFCC00"><b>User ID</b></td>
        <td align="center" bgcolor="#FFCC00"><b>Empleado</b></td>
	</tr>
</thead>
<tbody>
<?php 
    $s_1 = "select autorizadores.*, empleados.nombre, empleados.apellidos, empleados.usuario, divisiones.nombre as division from autorizadores, empleados, divisiones ";
    $s_1 .= "where autorizadores.id_emp = empleados.id and autorizadores.id_division = divisiones.id and id_division like '{$f_division}' and id_area like '{$f_area}' and ";
    $s_1 .= "id_proyecto like '{$f_proyecto}' and tipo='prod' order by division, tipo, apellidos";
    $r_1 = mysql_query($s_1);
    while ($d_1 = mysql_fetch_array($r_1)) {
        ?>
<tr>
    <td align="left"><?php 
        echo $d_1['division'];
        ?>
</td>
    <td align="left"><?php 
        echo nombre_area($d_1['id_area']);
        ?>
</td>
    <td align="left"><?php 
        echo nombre_proy($d_1['id_proyecto']);
        ?>
</td>
    <td align="left"><?php 
        echo $d_1['usuario'];
        ?>
</td>
    <td align="left"><?php 
        echo trim($d_1['apellidos'] . " " . $d_1['nombre']);
        ?>
</td>
</tr>
<?php 
    }
    ?>
</tbody>   
<?php 
}
Ejemplo n.º 2
0
function listado($f_division, $f_area, $f_proyecto, $division, $area, $pagina)
{
    //Revisar si es administrador o super administrador del sistema
    $s_ = "select super_admin, administrador from empleados where id='{$_SESSION['IDEMP']}'";
    $r_ = mysql_query($s_);
    $d_ = mysql_fetch_array($r_);
    if ($d_['super_admin'] == '1') {
        $admin = 2;
    }
    if ($d_['administrador'] == '1') {
        $admin = 1;
    }
    $ruta = "&f_division={$f_division}&f_area={$f_area}&f_proyecto={$f_proyecto}";
    if (!$pagina) {
        $pagina = '1';
    }
    if (!$f_division) {
        $f_division = '%';
    }
    if (!$f_area) {
        $f_area = '%';
    }
    if (!$f_proyecto) {
        $f_proyecto = '%';
    }
    ?>
<div align="center" class="aviso">Los filtros son únicamente con fines de restricción, no de permisos. Si no agrega al autorizador en esta lista, no podrá autorizar scrap.</div><br>

<?php 
    if ($admin == '2') {
        ?>
<form action="?op=listado" method="post" name="form1">
<input type="hidden" name="f_division" value="<?php 
        echo $f_division;
        ?>
">
<input type="hidden" name="f_area" value="<?php 
        echo $f_area;
        ?>
">
<input type="hidden" name="f_proyecto" value="<?php 
        echo $f_proyecto;
        ?>
">
<table align="center" class="tabla" cellpadding="0" cellspacing="5">
<tr>	
	<td width="60">División:</td>
	<td><select name="division" style="width:300px;" class="texto" onchange="submit();">
      <option value=""></option>
	  <?php 
        $s_ = "select * from divisiones where activo='1' order by nombre";
        $r_ = mysql_query($s_);
        while ($d_ = mysql_fetch_array($r_)) {
            ?>
	  <option value="<?php 
            echo $d_['id'];
            ?>
" <?php 
            if ($division == $d_['id']) {
                ?>
 selected="selected"<?php 
            }
            ?>
>
	  <?php 
            echo $d_['nombre'];
            ?>
</option>
	  <?php 
        }
        ?>
	</select></td>
</tr>
<tr>		
	<td>Área:</td>
	<td><select name="area" style="width:300px;" class="texto" onchange="submit();">
      <option value=""></option>
	  <option value="%" <?php 
        if ($area == "%") {
            ?>
 selected="selected"<?php 
        }
        ?>
>TODAS</option> 
	  <?php 
        $s_ = "select * from areas where activo='1' order by nombre";
        $r_ = mysql_query($s_);
        while ($d_ = mysql_fetch_array($r_)) {
            ?>
	  <option value="<?php 
            echo $d_['id'];
            ?>
" <?php 
            if ($area == $d_['id']) {
                ?>
 selected="selected"<?php 
            }
            ?>
>
	  <?php 
            echo $d_['nombre'];
            ?>
</option>
	  <?php 
        }
        ?>
	</select></td>
</tr>
<tr>		
	<td>Proyecto:</td>
	<td><select name="proyecto" style="width:300px;" class="texto">
      <option value=""></option>
	  <option value="%" <?php 
        if ($proyecto == "%") {
            ?>
 selected="selected"<?php 
        }
        ?>
>TODOS</option>  
	  <?php 
        $s_ = "select * from proyectos where id_division='{$division}' and activo='1' order by nombre";
        $r_ = mysql_query($s_);
        while ($d_ = mysql_fetch_array($r_)) {
            ?>
	  <option value="<?php 
            echo $d_['id'];
            ?>
" <?php 
            if ($proyecto == $d_['id']) {
                ?>
 selected="selected"<?php 
            }
            ?>
>
	  <?php 
            echo $d_['nombre'];
            ?>
</option>
	  <?php 
        }
        ?>
	</select></td>
</tr>
<tr>		
	<td>Usuario:</td>
	<td><select name="usuario" style="width:300px;" class="texto">
      <option value=""></option>
	  <?php 
        $s_ = "select * from empleados where autorizador='prod' and activo='1' order by apellidos, usuario";
        $r_ = mysql_query($s_);
        while ($d_ = mysql_fetch_array($r_)) {
            ?>
	  <option value="<?php 
            echo $d_['id'];
            ?>
" <?php 
            if ($usuario == $d_['id']) {
                ?>
 selected="selected"<?php 
            }
            ?>
>
	  	<?php 
            if ($d_['apellidos'] != '') {
                echo $d_['apellidos'] . " " . $d_['nombre'];
            } else {
                echo $d_['usuario'];
            }
            ?>
</option>
	  <?php 
        }
        ?>
	</select></td>
</tr>
</table>
</div>
<br><div align="center">
	<input type="button" value="Agregar" onclick="validar();" class="submit">
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" class="submit" value="Exportar" onclick="exportar();">
</div>
</form>

<?php 
    }
    $s_ = "select autorizadores.*, empleados.nombre, empleados.apellidos, empleados.usuario, divisiones.nombre as division from autorizadores, empleados, divisiones where ";
    $s_ .= "autorizadores.id_emp = empleados.id and autorizadores.id_division = divisiones.id and id_division like '{$f_division}' and id_area like '{$f_area}' and id_proyecto ";
    $s_ .= "like '{$f_proyecto}' and tipo='prod' order by division, tipo, apellidos";
    $r_ = mysql_query($s_);
    $n_ = mysql_num_rows($r_);
    $pags = ceil($n_ / 50);
    $ini_ = ($pagina - 1) * 50;
    $fin_ = 50;
    $i = 1;
    if ($pags > 0) {
        echo "<table align='center' border='0' cellpadding='0' cellspacing='0' class='texto'>";
        echo "<tr height='25'>";
        echo "<td width='120' align='center' bgcolor='#D8D8D8' style='border:#CCCCCB solid 1px;'>{$n_}&nbsp;Registros</td>";
        echo "<td width='3'></td>";
        while ($i <= $pags) {
            if ($pagina == $i) {
                $bg_img = '../imagenes/pag_on.jpg';
            } else {
                $bg_img = '../imagenes/pag_off.jpg';
            }
            echo "<td width='25' align='center' background='{$bg_img}' style='border:#CCCCCB solid 1px;'>";
            echo "<a href='?op=listado{$ruta}&pagina={$i}' class='link_paginas'>{$i}</a></td>";
            echo "<td width='3'></td>";
            $i++;
            $j++;
        }
        echo "</tr>";
        echo "</table><br>";
    }
    ?>

<form action="?op=listado" method="post" name="form2">
<table align="center" border="0" cellpadding="0" cellspacing="0" class="texto">
<tr>
	<td><b><?php 
    echo $div[$i]['nom'];
    ?>
</b></td>
</tr>
<tr>
	<td>
	<table align="center" class="tabla" >
	<thead>
	<tr bgcolor="#E6E6E6" height="20">
		<td width="40" align="center">No.</td>
        <td width="120" align="center">
		<select name="f_division" class="texto" style="width:120px;" onchange="submit();">
		<option value="">División</option>
		<?php 
    $s_1 = "select * from divisiones where activo='1' order by nombre";
    $r_1 = mysql_query($s_1);
    while ($d_1 = mysql_fetch_array($r_1)) {
        ?>
		   <option value="<?php 
        echo $d_1['id'];
        ?>
" <?php 
        if ($f_division == $d_1['id']) {
            ?>
 selected="selected"<?php 
        }
        ?>
>
		   <?php 
        echo $d_1['nombre'];
        ?>
</option>
		   <?php 
    }
    ?>
		</select></td>
		<td width="200" align="center">
		<select name="f_area" class="texto" style="width:200px;" onchange="submit();">
		<option value="">Área</option>
		<?php 
    $s_1 = "select * from areas where activo='1' order by nombre";
    $r_1 = mysql_query($s_1);
    while ($d_1 = mysql_fetch_array($r_1)) {
        ?>
		   <option value="<?php 
        echo $d_1['id'];
        ?>
" <?php 
        if ($f_area == $d_1['id']) {
            ?>
 selected="selected"<?php 
        }
        ?>
>
		   <?php 
        echo $d_1['nombre'];
        ?>
</option>
		   <?php 
    }
    ?>
		</select></td>
		<td width="170" align="center">
		<select name="f_proyecto" class="texto" style="width:170px;" onchange="submit();">
		<option value="">Proyecto</option>
		<?php 
    $s_1 = "select * from proyectos where activo='1' and id_division like '{$f_division}' order by nombre";
    $r_1 = mysql_query($s_1);
    while ($d_1 = mysql_fetch_array($r_1)) {
        ?>
		   <option value="<?php 
        echo $d_1['id'];
        ?>
" <?php 
        if ($f_proyecto == $d_1['id']) {
            ?>
 selected="selected"<?php 
        }
        ?>
>
		   <?php 
        echo $d_1['nombre'];
        ?>
</option>
		   <?php 
    }
    ?>
		</select></td>		
		<td width="150" align="center">User ID</td>
		<td width="300" align="center">Empleado</td>
		<td width="40" align="center">Borrar</td>
	</tr>	
	</thead>
	<tbody>
	<?php 
    $s_ .= " limit {$ini_},{$fin_}";
    $i = $ini_ + 1;
    $r_ = mysql_query($s_);
    while ($d_ = mysql_fetch_array($r_)) {
        ?>
	<tr onMouseOut="this.style.background='#F7F7F7'" onMouseOver="this.style.background='#FFDD99'" bgcolor="#F7F7F7" height="20">
		<td align="center"><?php 
        echo $i;
        ?>
</td>
        <td align="left">&nbsp;&nbsp;<?php 
        echo $d_['division'];
        ?>
</td>
		<td align="left">&nbsp;&nbsp;<?php 
        echo nombre_area($d_['id_area']);
        ?>
</td>
		<td align="left">&nbsp;&nbsp;<?php 
        echo nombre_proy($d_['id_proyecto']);
        ?>
</td>
		<td align="left">&nbsp;&nbsp;<?php 
        echo $d_['usuario'];
        ?>
</td>
		<td align="left">&nbsp;&nbsp;<?php 
        echo trim($d_['apellidos'] . " " . $d_['nombre']);
        ?>
</td>
		<td align="center">
			<?php 
        if ($admin == '2') {
            ?>
            <a href="?op=borrar&id_=<?php 
            echo $d_['id'];
            echo $ruta;
            ?>
"><img src="../imagenes/delete.gif" border="0"></a><?php 
        } else {
            ?>
            <img src="../imagenes/delete_gris.gif" border="0"><?php 
        }
        ?>
</td>
	</tr><?php 
        $i++;
    }
    ?>
	
	</tbody>	
	</table>
	</td>
</tr>		
</table><br>
<?php 
    echo "<br><br><br>";
}
Ejemplo n.º 3
0
function de_produccion($f_division, $f_area, $f_proyecto, $division, $area)
{
    ?>
<div align="center" class="aviso">Los filtros son únicamente con fines de restricción, no de permisos. Si no agrega al capturista en esta lista, podrá ver todas las divisiones.</div>
<form action="?op=de_produccion" method="post" name="form1">
<input type="hidden" name="f_division" value="<?php 
    echo $f_division;
    ?>
">
<input type="hidden" name="f_area" value="<?php 
    echo $f_area;
    ?>
">
<input type="hidden" name="f_proyecto" value="<?php 
    echo $f_proyecto;
    ?>
">
<table align="center" class="tabla" cellpadding="0" cellspacing="5">
<tr>	
	<td width="60">División:</td>
	<td><select name="division" style="width:300px;" class="texto" onchange="submit();">
      <option value=""></option>
	  <?php 
    $s_ = "select * from divisiones where activo='1' order by nombre";
    $r_ = mysql_query($s_);
    while ($d_ = mysql_fetch_array($r_)) {
        ?>
	  <option value="<?php 
        echo $d_['id'];
        ?>
" <?php 
        if ($division == $d_['id']) {
            ?>
 selected="selected"<?php 
        }
        ?>
>
	  <?php 
        echo $d_['nombre'];
        ?>
</option>
	  <?php 
    }
    ?>
	</select></td>
</tr>
<tr>		
	<td>Área:</td>
	<td><select name="area" style="width:300px;" class="texto" onchange="submit();">
      <option value=""></option>
	  <option value="%" <?php 
    if ($area == "%") {
        ?>
 selected="selected"<?php 
    }
    ?>
>TODAS</option> 
	  <?php 
    $s_ = "select * from areas where activo='1' order by nombre";
    $r_ = mysql_query($s_);
    while ($d_ = mysql_fetch_array($r_)) {
        ?>
	  <option value="<?php 
        echo $d_['id'];
        ?>
" <?php 
        if ($area == $d_['id']) {
            ?>
 selected="selected"<?php 
        }
        ?>
>
	  <?php 
        echo $d_['nombre'];
        ?>
</option>
	  <?php 
    }
    ?>
	</select></td>
</tr>
<tr>		
	<td>Proyecto:</td>
	<td><select name="proyecto" style="width:300px;" class="texto">
      <option value=""></option>
	  <option value="%" <?php 
    if ($proyecto == "%") {
        ?>
 selected="selected"<?php 
    }
    ?>
>TODOS</option>  
	  <?php 
    $s_ = "select * from proyectos where id_division='{$division}' and activo='1' order by nombre";
    $r_ = mysql_query($s_);
    while ($d_ = mysql_fetch_array($r_)) {
        ?>
	  <option value="<?php 
        echo $d_['id'];
        ?>
" <?php 
        if ($proyecto == $d_['id']) {
            ?>
 selected="selected"<?php 
        }
        ?>
>
	  <?php 
        echo $d_['nombre'];
        ?>
</option>
	  <?php 
    }
    ?>
	</select></td>
</tr>
<tr>		
	<td>Usuario:</td>
	<td><select name="usuario" style="width:300px;" class="texto">
      <option value=""></option>
	  <?php 
    $s_ = "select * from empleados where autorizador='prod' and activo='1' order by apellidos, usuario";
    $r_ = mysql_query($s_);
    while ($d_ = mysql_fetch_array($r_)) {
        ?>
	  <option value="<?php 
        echo $d_['id'];
        ?>
" <?php 
        if ($usuario == $d_['id']) {
            ?>
 selected="selected"<?php 
        }
        ?>
>
	  	<?php 
        if ($d_['apellidos'] != '') {
            echo $d_['apellidos'] . " " . $d_['nombre'];
        } else {
            echo $d_['usuario'];
        }
        ?>
</option>
	  <?php 
    }
    ?>
	</select></td>
</tr>
</table>
</div>
<br><div align="center">
<input type="button" value="Agregar" onclick="validar_produccion();" class="submit">
</div>
</form>

<form action="?op=de_produccion" method="post">
<table align="center" border="0" cellpadding="0" cellspacing="0" class="texto">
<tr>
	<td><b><?php 
    echo $div[$i]['nom'];
    ?>
</b></td>
</tr>
<tr>
	<td>
	<table align="center" class="tabla" >
	<thead>
	<tr bgcolor="#E6E6E6" height="20">
		<td width="120" align="center">
		<select name="f_division" class="texto" style="width:120px;" onchange="submit();">
		<option value="">División</option>
		<?php 
    $s_1 = "select * from divisiones where activo='1' order by nombre";
    $r_1 = mysql_query($s_1);
    while ($d_1 = mysql_fetch_array($r_1)) {
        ?>
		   <option value="<?php 
        echo $d_1['id'];
        ?>
" <?php 
        if ($f_division == $d_1['id']) {
            ?>
 selected="selected"<?php 
        }
        ?>
>
		   <?php 
        echo $d_1['nombre'];
        ?>
</option>
		   <?php 
    }
    ?>
		</select></td>
		<td width="200" align="center">
		<select name="f_area" class="texto" style="width:200px;" onchange="submit();">
		<option value="">Área</option>
		<?php 
    $s_1 = "select * from areas where activo='1' order by nombre";
    $r_1 = mysql_query($s_1);
    while ($d_1 = mysql_fetch_array($r_1)) {
        ?>
		   <option value="<?php 
        echo $d_1['id'];
        ?>
" <?php 
        if ($f_area == $d_1['id']) {
            ?>
 selected="selected"<?php 
        }
        ?>
>
		   <?php 
        echo $d_1['nombre'];
        ?>
</option>
		   <?php 
    }
    ?>
		</select></td>
		<td width="120" align="center">
		<select name="f_proyecto" class="texto" style="width:120px;" onchange="submit();">
		<option value="">Proyecto</option>
		<?php 
    $s_1 = "select * from proyectos where activo='1' and id_division='{$f_division}' order by nombre";
    $r_1 = mysql_query($s_1);
    while ($d_1 = mysql_fetch_array($r_1)) {
        ?>
		   <option value="<?php 
        echo $d_1['id'];
        ?>
" <?php 
        if ($f_proyecto == $d_1['id']) {
            ?>
 selected="selected"<?php 
        }
        ?>
>
		   <?php 
        echo $d_1['nombre'];
        ?>
</option>
		   <?php 
    }
    ?>
		</select></td>		
		<td width="150" align="center">User ID</td>
		<td width="300" align="center">Empleado</td>
		<td width="40" align="center">Borrar</td>
	</tr>	
	</thead>
	<tbody>
	<?php 
    $ruta = "&f_division={$f_division}&f_area={$f_area}";
    $s_ = "select divisiones.nombre as division, empleados.usuario, empleados.nombre, empleados.apellidos, autorizadores.* from ";
    $s_ .= "divisiones, autorizadores, empleados where autorizadores.id_division = divisiones.id and empleados.id = ";
    $s_ .= "autorizadores.id_emp and autorizadores.id_division like '{$f_division}%' and autorizadores.id_area like '{$f_area}%' and ";
    $s_ .= "autorizadores.id_proyecto like '{$f_proyecto}%' and autorizadores.tipo='prod' order by division, tipo, apellidos";
    $r_ = mysql_query($s_);
    while ($d_ = mysql_fetch_array($r_)) {
        ?>
	<tr onMouseOut="this.style.background='#F7F7F7'" onMouseOver="this.style.background='#FFDD99'" bgcolor="#F7F7F7" height="20">
		<td align="left">&nbsp;&nbsp;<?php 
        echo $d_['division'];
        ?>
</td>
		<td align="left">&nbsp;&nbsp;<?php 
        echo nombre_area($d_['id_area']);
        ?>
</td>
		<td align="left">&nbsp;&nbsp;<?php 
        echo nombre_proy($d_['id_proyecto']);
        ?>
</td>
		<td align="left">&nbsp;&nbsp;<?php 
        echo $d_['usuario'];
        ?>
</td>
		<td align="left">&nbsp;&nbsp;<?php 
        echo trim($d_['apellidos'] . " " . $d_['nombre']);
        ?>
</td>
		<td align="center">
		<?php 
        if (tiene_registros($d_['id_emp']) <= 0) {
            ?>
			<a href="?op=del_produccion&id_=<?php 
            echo $d_['id'];
            echo $ruta;
            ?>
"><img src="../imagenes/delete.gif" border="0"></a><?php 
        } else {
            ?>
<img src="../imagenes/delete_gris.gif" alt="No puede borrar este registro. Aún tiene autorizaciones pendientes" border="0"><?php 
        }
        ?>
</td>
	</tr><?php 
    }
    ?>
	
	</tbody>	
	</table>
	</td>
</tr>		
</table><br>
<?php 
    echo "<br><br><br>";
}