Foros del Web » Programando para Internet » PHP »

PHP OO El error de php con dompdf

Estas en el tema de El error de php con dompdf en el foro de PHP en Foros del Web. hola buenas tardes tengo un problema con un reporte cuando genero el reporte de un año me arroja el siguiente mensaje Notice: Undefined offset: 1 ...
  #1 (permalink)  
Antiguo 04/09/2012, 10:55
 
Fecha de Ingreso: noviembre-2008
Mensajes: 48
Antigüedad: 15 años, 5 meses
Puntos: 0
El error de php con dompdf

hola buenas tardes tengo un problema con un reporte cuando genero el reporte de un año me arroja el siguiente mensaje

Notice: Undefined offset: 1 in C:\AppServ\www\sigesp\include\cellmap.cls.php on line 559

Fatal error: Call to a member function get_id() on a non-object in C:\AppServ\www\sigesp\include\cellmap.cls.php on line 560


pero si coloco de un mes o 6 meses me genera el reporte sastifactoriamente espero que me puedan ayudar es urgente.
  #2 (permalink)  
Antiguo 04/09/2012, 11:26
Avatar de ipraetoriux  
Fecha de Ingreso: abril-2010
Ubicación: ipraetoriux.com
Mensajes: 1.125
Antigüedad: 14 años
Puntos: 155
Respuesta: El error de php con dompdf

..porque no pones como generas los reportes, sino es medio complicado ayudarte...
  #3 (permalink)  
Antiguo 04/09/2012, 11:32
Colaborador
 
Fecha de Ingreso: mayo-2008
Ubicación: $MX['VZ']['Xalapa']
Mensajes: 3.005
Antigüedad: 15 años, 11 meses
Puntos: 528
Respuesta: El error de php con dompdf

La palabra urgente suele producir el efecto contrario....

Si buscas el error en google, verás que más que un error es un fallo en tu codificación html. Dompdf a diferencia de los navegadores, necesita que el html esté bien formado y todas las etiquetas bien cerradas. Verifica que tu html esté completo, lo puedes pasar por un validador de html.
  #4 (permalink)  
Antiguo 04/09/2012, 17:51
 
Fecha de Ingreso: noviembre-2008
Mensajes: 48
Antigüedad: 15 años, 5 meses
Puntos: 0
Respuesta: El error de php con dompdf

buenas noches aqui le inserto el codigo

<?
ob_start();
require("verifica.php"); // incluir motor de autentificación.
$nivel_acceso=0; // definir nivel de acceso para esta página.
if ($nivel_acceso <> $_SESSION['usuario_nivel']){
header ("Location: $redir?error_login=5");
exit;
}
function convertir_fecha($fecha)
{
$fecha_convertida=$fecha[6].$fecha[7].$fecha[8].$fecha[9]."-".$fecha[3].$fecha[4]."-".$fecha[0].$fecha[1];
return($fecha_convertida);

}

function reconvertir_fecha($fecha)
{
$fecha_convertida=$fecha[8].$fecha[9]."/".$fecha[5].$fecha[6]."/".$fecha[0].$fecha[1].$fecha[2].$fecha[3];
return($fecha_convertida);

}

function hourdiff($hour_1 , $hour_2 , $formated=false){

$h1_explode = explode(":" , $hour_1);
$h2_explode = explode(":" , $hour_2);

$h1_explode[0] = (int) $h1_explode[0];
$h1_explode[1] = (int) $h1_explode[1];
$h2_explode[0] = (int) $h2_explode[0];
$h2_explode[1] = (int) $h2_explode[1];


$h1_to_minutes = ($h1_explode[0] * 60) + $h1_explode[1];
$h2_to_minutes = ($h2_explode[0] * 60) + $h2_explode[1];


if($h1_to_minutes > $h2_to_minutes){
$subtraction = $h1_to_minutes - $h2_to_minutes;
}
else
{
$subtraction = $h2_to_minutes - $h1_to_minutes;
}

$result = $subtraction / 60;

if(is_float($result) && $formated){

$result = (string) $result;

$result_explode = explode(".",$result);

return $result_explode[0].":".(substr(($result_explode[1]*60)/10,0,2));
}
else
{
return $result;
}
}

$pag=$_SERVER['PHP_SELF']; // el nombre y ruta de esta misma página.
ini_set("memory_limit","200M");

$fechainicio=convertir_fecha($_POST["fecha_inicio"]);
$fechafin=convertir_fecha($_POST["fecha_fin"]);
require_once('dompdf_config.inc.php');

include 'conex.php';

$j=0;
$sql = "SELECT tr.fecha FROM trabhist_hora tr WHERE tr.fecha BETWEEN '$fechainicio' and '$fechafin' GROUP BY tr.fecha ORDER BY tr.fecha ASC";
$resultado = mysql_query($sql, $conex);
$num_rows=mysql_num_rows($resultado);
if($num_rows>0)
{
while ($datos = mysql_fetch_object($resultado)){

$pfecha[$j]=reconvertir_fecha($datos->fecha);
$pfecha1[$j]=$datos->fecha;
$j++;
}
if($num_rows>0)
{
$html="<html>";
$html="<h1>$_SESSION[nom_empresa]</h1>";
$html.="<br><br><table width='500' class='tabla_borde_fino' cellspacing='15' cellpadding='0' >";
for($i=0;$i<$j;$i++)
{
$html.="<tr class='texto_normal'>
<td class='texto_normal' width='200'><b>Fecha:</b> $pfecha[$i]</td>
</tr>";
$sql1="SELECT t.ced_emp, t.nom_emp, t.ape_emp, tr.hora_trab_ent1, tr.hora_trab_sal1, tr.hora_trab_ent2, tr.hora_trab_sal2 FROM trabajador t INNER JOIN trabhist_hora tr ON t.ced_emp=tr.ced_emp WHERE tr.fecha='$pfecha1[$i]' GROUP BY tr.fecha ORDER BY tr.fecha ASC";
$resultado1 = mysql_query($sql1, $conex);
echo mysql_error();
$num_rows_result=mysql_num_rows($resultado1);
if ($num_rows_result>0)
{
$html.="<tr class='texto_normal'>
<td class='texto_normal' width='200'><b>ASISTENCIA</td>
</tr>";
$html.="<tr>
<td colspan='6'>
<table width='730' border=1 >
<tr align='center' >
<td width='230'> <b>Nombre y Apellido</td>
<td width='100'> <b>Hora Entrada #1</td>
<td width='100'><b>Hora Salida #1</td>
<td width='100'> <b>Hora Entrada #2</td>
<td width='100'><b>Hora Salida #2</td>
<td width='100'><b>Total Horas</td>
</tr>";
$sql1="SELECT t.ced_emp, t.nom_emp, t.ape_emp, tr.hora_trab_ent1, tr.hora_trab_sal1, tr.hora_trab_ent2, tr.hora_trab_sal2 FROM trabajador t INNER JOIN trabhist_hora tr ON t.ced_emp=tr.ced_emp WHERE tr.fecha='$pfecha1[$i]'";
$k=0;
$resultado = mysql_query($sql1, $conex);
echo mysql_error();
while ($datos = mysql_fetch_array($resultado)){

$horaentrada1=$datos['hora_trab_ent1'];
$horasalida1=$datos['hora_trab_sal1'];
$horaentrada2=$datos['hora_trab_ent2'];
$horasalida2=$datos['hora_trab_sal2'];
$totalacumam=hourdiff($horaentrada1 , $horasalida1 , true);
$totalacumpm=hourdiff($horaentrada2 , $horasalida2 , true);
$horaacumam=substr($totalacumam,0,2);
$minacumam=substr($totalacumam,2,5);
$horaacumpm=substr($totalacumpm,0,2);
$minacumpm=substr($totalacumpm,2,5);
$totalminutos=$minacumpm+$minacumam;
$totalhoras=$horaacumam+$horaacumpm;
if($totalminutos>60)
{
$num=substr(($totalminutos/60),0,1);
$totalhoras=$totalhoras+$num;
$totalminutos=$totalminutos-(60*$num);
if($totalhoras<10) $thor='0'.$totalhoras; else $thor=$totalhoras;
if($totalminutos<10) $tmin='0'.$totalminutos; else $tmin=$totalminutos;
$totalhorasacumuladas=$thor.':'.$tmin;
}
else
{
if($totalhoras<10) $thor='0'.$totalhoras; else $thor=$totalhoras;
if($totalminutos<10) $tmin='0'.$totalminutos; else $tmin=$totalminutos;
$totalhorasacumuladas=$thor.':'.$tmin;
}
$html.="<tr align='center'>
<td width='230' align='justify'>$datos[nom_emp] $datos[ape_emp]</td>";

$html.="<td width='100' >$datos[hora_trab_ent1]</td>";

$html.="<td width='100' >$datos[hora_trab_sal1]</td>";

$html.="<td width='100' >$datos[hora_trab_ent2]</td>";

$html.="<td width='100' >$datos[hora_trab_sal2]</td>";

$html.="<td width='100' >$totalhorasacumuladas</td>";

$html.=" </tr>";

}
$html.="</table>
</td>
</tr>";
}
$sql1="select t.ced_emp, t.nom_emp,t.ape_emp FROM trabajador t WHERE NOT EXISTS (SELECT * FROM trabhist_hora tr WHERE tr.ced_emp=t.ced_emp AND tr.fecha='$pfecha1[$i]' and t.est_emp='activo')";
$resultado2 = mysql_query($sql1, $conex);
echo mysql_error();
$num_rows_result1=mysql_num_rows($resultado2);
if ($num_rows_result1>0)
{
$html.="<tr class='texto_normal'>
<td class='texto_normal' width='200'><b>INASISTENCIA</td>
</tr>";
$html.="<tr>
<td colspan='6'>
<table width='730' border=1 >
<tr align='center' >
<td width='230'> <b>Nombre y Apellido</td>
<td width='100'> <b>Hora Entrada #1</td>
<td width='100'><b>Hora Salida #1</td>
<td width='100'> <b>Hora Entrada #2</td>
<td width='100'><b>Hora Salida #2</td>
<td width='100'><b>Total Horas</td>
</tr>";
while ($datos1 = mysql_fetch_array($resultado2)){
$html.="<tr align='center'>
<td width='230' align='justify'>$datos1[nom_emp] $datos1[ape_emp]</td>";

$html.="<td width='100' >00:00</td>";

$html.="<td width='100' >00:00</td>";

$html.="<td width='100' >00:00</td>";

$html.="<td width='100' >00:00</td>";

$html.="<td width='100' >00:00</td>";

$html.=" </tr>";
}
$html.="</table>
</td>
</tr>";
}
}/*aqui termina el for*/
$html.="</table>";
$html.="<br><table style='page-break-after:always;'></br></table><br>";
}
//echo $html;
$dompdf = new DOMPDF();
$dompdf->set_paper('tabloid','portrait');
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream('listadoasistenciageneral.pdf');
}
else
{
header ("Location: $redir?mensaje=Datos no existente");
exit();
}
?>

Etiquetas: dompdf
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 14:49.