Exemple #1
0
function reporte_por_areas($division, $proyecto)
{
    $div = get_division_name($division);
    $pry = get_proyecto_name($proyecto);
    ?>
<table align="center" border="1">
<caption><b>Catálogos de Áreas</b></caption>
<thead>
	<tr bgcolor="#E6E6E6" height="20">
		<td align="center" width="180" bgcolor="#FFCC00"><b>División</b></td>
        <td align="center" width="180" bgcolor="#FFCC00"><b>Proyecto</b></td>
        <td align="center" width="180" bgcolor="#FFCC00"><b>Área</b></td>
		<td align="center" width="150" bgcolor="#FFCC00"><b>Tecnología</b></td>
		<td align="center" width="90" bgcolor="#FFCC00"><b>Línea</b></td>
		<td align="center" width="90" bgcolor="#FFCC00"><b>Dfecto</b></td>
		<td align="center" width="90" bgcolor="#FFCC00"><b>Relacionado a</b></td>
		<td align="center" width="90" bgcolor="#FFCC00"><b>Código Scrap</b></td>
		<td align="center" width="90" bgcolor="#FFCC00"><b>Orden Interna</b></td>
</thead>
<tbody>
<?php 
    $r_1 = mysql_query($_SESSION['CONSULTA']);
    while ($d_1 = mysql_fetch_array($r_1)) {
        ?>
<tr bgcolor="#F7F7F7" height="20">
	<td align="left"><?php 
        echo $div;
        ?>
</td>
	<td align="left"><?php 
        echo $pry;
        ?>
</td>
	<td align="left"><?php 
        echo $d_1['area'];
        ?>
</td>
	<td align="left"><?php 
        echo $d_1['estacion'];
        ?>
</td>
	<td align="left"><?php 
        echo $d_1['linea'];
        ?>
</td>
	<td align="left"><?php 
        echo $d_1['defecto'];
        ?>
</td>
	<td align="left"><?php 
        echo $d_1['causa'];
        ?>
</td>
	<td align="left"><?php 
        echo $d_1['codigo'];
        ?>
</td>
	<td align="left"><?php 
        echo $d_1['orden'];
        ?>
</td>
</tr>
<?php 
    }
    ?>
</tbody>
</table>
<?php 
}
function reporte_por_areas($division, $proyecto, $area, $tecnologia, $linea, $codigo, $causa, $defecto)
{
    $div = get_division_name($division);
    $pry = get_proyecto_name($proyecto);
    $s_1 = "select areas.nombre as area, estaciones.nombre as estacion, lineas.nombre as linea, defectos.nombre as defecto, ";
    $s_1 .= "causas.nombre as causa, codigo_scrap.codigo as codigo, codigo_scrap.orden_interna as orden from areas, estaciones, ";
    $s_1 .= "lineas, defectos, defecto_causa, causas, causa_codigo, codigo_scrap, def_proyecto, est_proyecto, lineas_proy where ";
    $s_1 .= "estaciones.id_area = areas.id and lineas.id_estacion = estaciones.id and defectos.id_estacion = estaciones.id and ";
    $s_1 .= "defecto_causa.id_defecto = defectos.id and defecto_causa.id_causa = causas.id and causa_codigo.id_causa = causas.id and ";
    $s_1 .= "causa_codigo.id_codigo = codigo_scrap.id and defectos.id = def_proyecto.id_defecto and est_proyecto.id_tecnologia = ";
    $s_1 .= "estaciones.id and lineas_proy.id_linea = lineas.id and areas.activo='1' and estaciones.activo='1' and lineas.activo='1' ";
    $s_1 .= "and defectos.activo='1' and causas.activo='1' and codigo_scrap.activo='1' and areas.id like '{$area}%' and estaciones.id ";
    $s_1 .= "like '{$tecnologia}%' and lineas.id like '{$linea}%' and codigo_scrap.id like '{$codigo}%' and causas.id like '{$causa}%' and ";
    $s_1 .= "defectos.id like '{$defecto}%' and def_proyecto.id_proyecto = '{$proyecto}' and est_proyecto.id_proyecto = '{$proyecto}' and ";
    $s_1 .= "lineas_proy.id_proyecto like '{$proyecto}' order by areas.nombre, estaciones.nombre, lineas.nombre, defectos.nombre, ";
    $s_1 .= "causas.nombre, codigo_scrap.codigo";
    $_SESSION['CONSULTA'] = $s_1;
    $r_1 = mysql_query($s_1);
    $n_1 = mysql_num_rows($r_1);
    ?>
    
<div align="center" class="texto"><b><?php 
    echo $n_1;
    ?>
 Registros Encontrados</b></div>    
<table align="center" class="tabla">
<thead>
	<tr bgcolor="#E6E6E6" height="20">
		<td align="center" width="50">No.</td>
        <td align="center" width="100">División</td>
        <td align="center" width="100">Proyecto</td>
        <td align="center" width="180">Área</td>
		<td align="center" width="150">Tecnología</td>
		<td align="center" width="90">Línea</td>
		<td align="center" width="90">Defecto</td>
		<td align="center" width="90">Relacionado a</td>
		<td align="center" width="90">Código Scrap</td>
        <td align="center" width="90">Orden Interna</td>
	</tr>
</thead>
<tbody>
<?php 
    $r_1 = mysql_query($s_1);
    $i = 1;
    while ($d_1 = mysql_fetch_array($r_1)) {
        ?>
<tr bgcolor="#F7F7F7" height="20">
	<td align="center"><?php 
        echo $i;
        ?>
</td>
	<td align="left"><?php 
        echo $div;
        ?>
</td>
	<td align="left"><?php 
        echo $pry;
        ?>
</td>
	<td align="left"><?php 
        echo $d_1['area'];
        ?>
</td>
	<td align="left"><?php 
        echo $d_1['estacion'];
        ?>
</td>
	<td align="left"><?php 
        echo $d_1['linea'];
        ?>
</td>
	<td align="left"><?php 
        echo $d_1['defecto'];
        ?>
</td>
	<td align="left"><?php 
        echo $d_1['causa'];
        ?>
</td>
	<td align="center"><?php 
        echo $d_1['codigo'];
        ?>
</td>
	<td align="center"><?php 
        echo $d_1['orden'];
        ?>
</td>
</tr>
<?php 
        $i++;
    }
    ?>
</tbody>
</table>
<?php 
}