157 lines
5.4 KiB
PHP
157 lines
5.4 KiB
PHP
<?php
|
|
session_start();
|
|
require "../../conexion.php";
|
|
$impresoras = [];
|
|
$info = [];
|
|
$inv=[];
|
|
$imp1 =0;
|
|
$imp2 =0;
|
|
$i=0;
|
|
$n=0;
|
|
$c=0;
|
|
$m=0;
|
|
$a=0;
|
|
$cant=0;
|
|
$salida = "";
|
|
$x=0;
|
|
|
|
$query = "SELECT impresora from cat_impresora";
|
|
$resultado = $conexion->query($query);
|
|
|
|
if($resultado->rowCount() > 0){
|
|
$salida.="<table class='tabla_datos table' >
|
|
<thead class='table-primary'>
|
|
<tr>
|
|
<td style=\"text-align:center;\">Impresora</td>
|
|
<td style=\"text-align:center;\">Color</td>
|
|
<td style=\"text-align:center;\">Existencia</td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>";
|
|
|
|
|
|
while($row = $resultado->fetch(PDO::FETCH_ASSOC)){
|
|
$impresoras[$i] =$row;
|
|
$i++;
|
|
}
|
|
|
|
|
|
foreach ($impresoras as $impresora) {
|
|
$salida.="<tr>
|
|
<td style=\"text-align:center;\">".$impresora['impresora']."</td>";
|
|
|
|
$i=0;
|
|
|
|
$busq=$impresora['impresora'];
|
|
$query = "CALL st_totales('$busq');";
|
|
$resultado = $conexion->query($query);
|
|
while($fila = $resultado->fetch(PDO::FETCH_ASSOC)){
|
|
$info[$i]=$fila;
|
|
|
|
if($info[$i]['impresora'] == 'HP Laserjet P3015' or $info[$i]['impresora'] == 'HP Color Laserjet CP1515N' or $info[$i]['impresora'] == 'HP Laserjet 1320') {
|
|
if ($info[$i]['impresora'] == 'HP Laserjet P3015') {
|
|
$imp1 += $info[$i]['existencia'];
|
|
} if ($info[$i]['impresora'] == 'HP Laserjet P3015' and $i>1) {
|
|
$salida .= "
|
|
|
|
<td style=\"text-align:center;\">Negro</td>
|
|
<td style=\"text-align:center;\">" . $imp1 . "</td>
|
|
</tr>";
|
|
}
|
|
|
|
|
|
if ($info[$i]['impresora'] == 'HP Color Laserjet CP1515N') {
|
|
if ($info[$i]['color'] == 'Negro') {
|
|
$n += $info[$i]['existencia'];
|
|
}
|
|
if ($info[$i]['color'] == 'Cyan') {
|
|
$c += $info[$i]['existencia'];
|
|
}
|
|
if ($info[$i]['color'] == 'Magenta') {
|
|
$m += $info[$i]['existencia'];
|
|
}
|
|
if ($info[$i]['color'] == 'Amarillo') {
|
|
$a += $info[$i]['existencia'];
|
|
}
|
|
|
|
}
|
|
|
|
if ($x== 1 and $impresora['impresora'] == 'HP Color Laserjet CP1515N') {
|
|
$salida .= "
|
|
<td style=\"text-align:center;\"><br></td>
|
|
<td style=\"text-align:center;\">Negro</td>
|
|
<td style=\"text-align:center;\">" . $n . "</td></tr>
|
|
";
|
|
$salida .= "
|
|
<tr>
|
|
<td style=\"text-align:center;\"><br></td>
|
|
<td style=\"text-align:center;\">Cyan</td>
|
|
<td style=\"text-align:center;\">" . $c . "</td></tr>
|
|
";
|
|
$salida .= "
|
|
<tr>
|
|
<td style=\"text-align:center;\"><br></td>
|
|
<td style=\"text-align:center;\">Magenta</td>
|
|
<td style=\"text-align:center;\">" . $a . "</td></tr>
|
|
";
|
|
$salida .= "
|
|
<tr>
|
|
<td style=\"text-align:center;\"><br></td>
|
|
<td style=\"text-align:center;\">Amarillo</td>
|
|
<td style=\"text-align:center;\">" . $a . "</td>
|
|
</tr>
|
|
";
|
|
$x++;
|
|
}
|
|
|
|
|
|
if ($info[$i]['impresora'] == 'HP Laserjet 1320') {
|
|
$imp2 += $info[$i]['existencia'];
|
|
}
|
|
if ($i >1 and $info[$i]['impresora'] == 'HP Laserjet 1320') {
|
|
$salida .= "
|
|
|
|
<td style=\"text-align:center;\">Negro</td>
|
|
<td style=\"text-align:center;\">" . $imp2 . "</td>
|
|
</tr>";
|
|
}
|
|
|
|
}else{
|
|
if($info[$i]['color']== 'Negro' or $info[$i]['color']== 'Negro mate'){
|
|
$salida.="
|
|
|
|
<td style=\"text-align:center;\">".$info[$i]['color']."</td>
|
|
<td style=\"text-align:center;\">".$info[$i]['existencia']."</td>
|
|
</tr>";
|
|
}else{
|
|
$salida.="
|
|
<td style=\"text-align:center;\"><br></td>
|
|
<td style=\"text-align:center;\">".$info[$i]['color']."</td>
|
|
<td style=\"text-align:center;\">".$info[$i]['existencia']."</td>
|
|
</tr>";
|
|
}}
|
|
|
|
|
|
|
|
$i++;
|
|
}
|
|
}
|
|
|
|
}
|
|
$cant=0;
|
|
//print_r($info);
|
|
|
|
//print_r($inv);
|
|
$salida.="</tbody></table>";
|
|
|
|
|
|
//echo'<br><br>';echo'<br><br>';echo'<br><br>';echo'<br><br>';echo'<br><br>';
|
|
//print_r($info[0])
|
|
echo $salida;
|
|
echo $n. ' .';
|
|
echo $c. ' .';
|
|
echo $m. ' .';
|
|
echo $a. ' .';
|
|
$conexion = null;
|
|
?>
|