Good afternoon colleagues I need your help in this problem, I'm working with CodeIgniter
which I'm doing a report PDF
using the library fpdf
, but the problem is that when I generate the report does not show me the first row of the table if not of the second record down.
This is the code of my controller of the report function
public function reporte(){
$this->load->model('registros_model');
$this->load->library('pdf');
$registros= $this->registros_model->lvarios();
$this->pdf = new Pdf();
// Agregamos una página
$this->fpdf->AddPage();
$this->fpdf->AliasNbPages();
// Define el alias para el número de página que se imprimirá en el pie
$this->fpdf->SetTitle("reportes");
$this->fpdf->SetLeftMargin(15);
$this->fpdf->SetRightMargin(15);
$this->fpdf->SetFillColor(200,200,200);
$this->fpdf->SetFont('Arial','B', 8);
$this->fpdf->Cell(40,10,'Descripcion');
$this->fpdf->Cell(40,10,'Marca');
$this->fpdf->Cell(40,10,'N_Inventario');
$this->fpdf->Cell(40,10,'Serial');
$this->fpdf->Cell(40,10,'Fecha');
//$this->fpdf->Cell(40,10,'Observaciones');
//$this->fpdf->Cell(40,10, 'Usuario');
foreach ($registros as $registro) {
$this->fpdf->SetFont('Arial','B', 8);
$this->fpdf->Cell(40,5,$registro->descripcion,0);
$this->fpdf->Cell(40,5,$registro->marca,0);
$this->fpdf->Cell(40,5,$registro->n_inventario,0);
$this->fpdf->Cell(40,5,$registro->serial,0);
$this->fpdf->Cell(40,5,$registro->fecha,0);
//$this->fpdf->Cell(40,5,$registro->observaciones,0);
//$this->fpdf->Cell(40,5,$registro->usuario,0);
//Se agrega un salto de linea
$this->fpdf->Ln(7);
}
echo $this->fpdf->Output('Repotre.pdf','I');
}
And this is my model
public function lvarios()
{
$this->db->select('*');
$q= $this->db->from('varios');
$q = $this->db->get();
return $q->result();
$q->db2_free_result();
}