I need to print the sales of the operators of each day, we do not take into account the holidays on weekends. I get the following error
Notice (8): Undefined offset: 1 [APP / View / Reports / getventas_asistencia.ctp, line 63]
Notice (8): Undefined offset: 6 [APP / View / Reports / getventas_asistencia.ctp, line 63]
Notice (8): Undefined offset: 7 [APP / View / Reports / getventas_asistencia.ctp, line 63]
Notice (8): Undefined offset: 13 [APP / View / Reports / getventas_asistencia.ctp, line 63]
Notice (8): Undefined offset: 14 [APP / View / Reports / getventas_asistencia.ctp, line 63]
Notice (8): Undefined offset: 16 [APP / View / Reports / getventas_asistencia.ctp, line 63]
My code is as follows:
<div style="width: 100%; ">
<legend style="color:grey" ><?php echo __('Resultados');?></legend>
</div>
<div class="table table-bordered" style="width=100%;" >
<table width="100%" border="1" style="text-align:center;">
<?php
// $i=0;
// $j=0;
$columnas = count($AsistenciaVentas[0]);
//echo $columnas;
$filas = count($AsistenciaVentas);
//echo "<br>".$filas."<br>";
//Añadimos los titulos
for($i=0;$i<count($AsistenciaVentas[0]);$i=$i+1){
next($AsistenciaVentas[0]);
echo "<th><b>".key($AsistenciaVentas[0])."</b></th>";
// next($AsistenciaVentas[0]);
}
for($i=0;$i<$filas;$i++){
echo "<tbody><tr>";
for($j=1;$j<$columnas;$j++){
echo "<td>".$AsistenciaVentas[$i][$j]."</td>";
}
echo "</tr></tbody> ";
}
?>
</table>
</div>
The result of the array looks like this:
Array
(
[0] => Array
(
[usuario_id] => 1055
[nombre_usuario] => Alejandro Espinoza Salinas
[2] => 2
[3] => 2
[4] => 2
[5] => 3
[8] => 3
[9] =>
[10] => 2
[11] =>
[12] =>
[15] =>
[17] =>
[18] =>
[19] =>
[22] =>
[23] =>
[24] =>
[25] =>
[26] =>
[29] =>
[30] =>
[31] =>
)
[1] => Array
(
[usuario_id] => 1248
[nombre_usuario] => Alex Rodrigo Azocar Bernal
[2] =>
[3] =>
[4] =>
[5] =>
[8] =>
[9] =>
[10] =>
[11] =>
[12] =>
[15] => 0
[17] =>
[18] =>
[19] =>
[22] =>
[23] =>
[24] =>
[25] =>
[26] =>
[29] =>
[30] =>
[31] =>
)
[2] => Array
(
[usuario_id] => 377
[nombre_usuario] => Alicia Escobar Cuadra
[2] => 5
[3] =>
[4] => 9
[5] => 5
[8] => 7
[9] =>
[10] => 6
[11] => 4
[12] => 4
[15] => 2
[17] =>
[18] =>
[19] =>
[22] =>
[23] =>
[24] =>
[25] =>
[26] =>
[29] =>
[30] =>
[31] =>
)
[3] => Array
(
[usuario_id] => 1243
[nombre_usuario] => Barbara Andrea Soto Ramos
[2] =>
[3] =>
[4] =>
[5] =>
[8] =>
[9] =>
[10] =>
[11] => 3
[12] =>
[15] => 1
[17] =>
[18] =>
[19] =>
[22] =>
[23] =>
[24] =>
[25] =>
[26] =>
[29] =>
[30] =>
[31] =>
)
[4] => Array
(
[usuario_id] => 1200
[nombre_usuario] => Claudio Esteban Nunez Gajardo
[2] =>
[3] =>
[4] =>
[5] => 3
[8] => 6
[9] => 6
[10] => 6
[11] =>
[12] => 3
[15] =>
[17] =>
[18] =>
[19] =>
[22] =>
[23] =>
[24] =>
[25] =>
[26] =>
[29] =>
[30] =>
[31] =>
)
I do not know what to do to delete the messages and to print the user names and id
Thank you very much Jorge, I tried in the following way:
if (array_key_exists(0, $AsistenciaVentas)) {for($i=0;$i<count($AsistenciaVentas[0]);$i=$i+1){
if(!empty($AsistenciaVentas[0]))
{
next($AsistenciaVentas[0]);
echo "<th><b>".key($AsistenciaVentas[0])."</b></th>";
// next($AsistenciaVentas[0]);
}
}
and it did not work for me.
what my pag shows including the offset