Ver Mensaje Individual
  #3 (permalink)  
Antiguo 16/06/2011, 13:13
estebadido
 
Fecha de Ingreso: junio-2011
Mensajes: 3
Antigüedad: 12 años, 10 meses
Puntos: 0
Información Respuesta: Problemas para presentar reportes

Los reportes que tengo que presentar deben, poder guardarse de tal forma que no puedan ser modificados, teniendo en cuenta esto, la mejor manera de presentarlos, es con pdf.

Para hacer los reportesm he utilizado dos clases para hacer pdf, que son:
  • Tcpdf
  • pdfClassesAndFonts

en este momento estoy probando con reportlist pero no cumple exacta mente con los requisitos, ya que no permite exportarlos como pdf.
El código usado para Tcpdf es:

session_start ();
set_time_limit(0);

$nro=$_POST['Nro_proceso'];
include_once ('../scripts/conexion.php');
$obj_conexion = new conexion_mysql ();
$obj_conexion -> abrir_conexion ();
$sql_procesos = "
select
*
from proceso where nro_proceso=".$nro."
";
$consulta_procesos = $obj_conexion -> consulta_mysql ($sql_procesos);
$j=0;
if ($fila = mysql_fetch_array ($consulta_procesos))
{

$m_pro[0]=htmlentities($fila['id_proceso']);
$m_pro[1]=htmlentities($fila['nro_proceso']);

$sql_integrantes ="select d.cedula,d.nombre1,d.nombre2,d.apellido1,d.apellid o2,d.lugar,i.folio,i.poder
from
demandante d,
integrantes i
where
i.id_demandante=d.id_demandante and
i.id_proceso=".$m_pro[0]." and
(d.apellido1 LIKE '%a' or d.apellido1 LIKE '%A') order by apellido1 LIMIT 0,450";

$consulta_integrantes = $obj_conexion -> consulta_mysql ($sql_integrantes);
while ($fila_int = mysql_fetch_array ($consulta_integrantes))
{
$matriz[$j][0]=$fila_int['cedula'];
if($fila_int['nombre1']!="Sin asignar")
{
$matriz[$j][1]=htmlentities($fila_int['nombre1']." ".$fila_int['nombre2']);
}
else
{
$matriz[$j][1]=htmlentities($fila_int['nombre1']);
}
if($fila_int['apellido1']!="Sin asignar")
{
$matriz[$j][2]=htmlentities($fila_int['apellido1']." ".$fila_int['apellido1']);
}
else
{
$matriz[$j][2]=htmlentities($fila_int['apellido1']);
}
$matriz[$j][3]=$fila_int['poder'];
$matriz[$j][4]=$fila_int['folio'];
$j++;
}
}
$obj_conexion -> cerrar_conexion ();

require_once ('../clases/eng.php');
require_once ('../clases/tcpdf.php');

// creamos el nuevo documento PDF
$pdf = new TCPDF (PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// Instanciamos la informacion del documento
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Pablo Perez'); // autor
$pdf->SetTitle('ejemplo1'); // titulo
$pdf->SetSubject('PPD'); // asunto
$pdf->SetKeywords('PPD, informe, final'); //palabras clave

// Instanciamos la informacion que aparecera por defecto en la cabecera.
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);

// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

//set some language-dependent strings
$pdf->setLanguageArray($l);

// ---------------------------------------------------------

// set font
$pdf->SetFont('helvetica', 'B', 20);

// add a page
$pdf->AddPage();

//$pdf->Write(0, 'ACTA DE REUNION', '', 0, 'C', true, 0, false, false, 0);

$pdf->SetFont('helvetica', '', 8);

// -----------------------------------------------------------------------------

$tabla = '
<table cellspacing="0" cellpadding="5px" border="0" width = "638" >
<tr>
<td colspan="4" align = "center" style = "height: 40px; font-size: 40px; font-weight: bold;">Reporte Integrantes Proceso</td>
</tr>
<tr>
<td colspan="4" align = "center" style = "height: 40px; font-size: 40px; font-weight: bold">'.$m_pro[1]
.'</td>
</tr>';

$tabla.='
<tr>
<td align = "center" style = "height: 25px; font-size: 30px; font-weight: bold" border="1">
Documento identidad
</td>
<td align = "center" style = "height: 25px; font-size: 30px; font-weight: bold" border="1" width="400">
Nombre
</td>
<td align = "center" style = "height: 25px; font-size: 30px; font-weight: bold" border="1" width="50">
Poder
</td>
<td align = "center" style = "height: 25px; font-size: 30px; font-weight: bold" border="1" width="50">
Folio
</td>
</tr>';

$doom=0;

for($doom=0; $doom < $j; $doom++)
{
$tabla.='
<tr>
<td align = "center" style = "height: 20px; font-size: 20px;" border="1">'.$matriz[$doom][0]
.'</td>
<td align = "center" style = "height: 20px; font-size: 20px;" border="1">'.$matriz[$doom][1].' '.$matriz[$doom][2]
.'</td>
<td align = "center" style = "height: 20px; font-size: 20px;" border="1">'.$matriz[$doom][3]
.'</td>
<td align = "center" style = "height: 20px; font-size: 20px;" border="1">'.$matriz[$doom][4]
.'</td>
</tr>
';
}
$tabla.='
</table>';

$tbl = <<<EOD
$tabla
EOD;

$pdf -> writeHTML ($tbl, true, false, false, false, '');

// -----------------------------------------------------------------------------

//Close and output PDF document
$pdf -> Output('nro.pdf', 'I');

//================================================== ==========+
// END OF FILE
//================================================== ==========+