This repository was archived by the owner on Jun 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpdf.php
More file actions
64 lines (60 loc) · 1.8 KB
/
pdf.php
File metadata and controls
64 lines (60 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
require('reports/fpdf.php');
require('src/database/db.php');
class pdf extends FPDF
{
// Cabecera de página
function Header()
{
$this->Image('assets/kid.png', 10, 8, 20);
// Arial bold 15
$this->SetFont('Arial', 'B', 18);
// Movernos a la derecha
$this->Cell(65);
// Título
$this->Cell(60, 10, utf8_decode('Reporte de Empleados "Pequeños Traviesos"'), 0, 0, 'C');
// Salto de línea
$this->Ln(20);
}
// Pie de página
function Footer()
{
// Posición: a 1,5 cm del final
$this->SetY(-15);
// Arial italic 8
$this->SetFont('Arial', 'I', 8);
// Número de página
$this->Cell(0, 10, utf8_decode('Página') . $this->PageNo() . '/{nb}', 0, 0, 'C');
}
}
$query = "SELECT tbl_empleado.emp_nombre,tbl_empleado.emp_apellido,tbl_empleado.emp_cedula,
tbl_cargo.crg_descripcion, tbl_departamento.dpt_nombre
FROM tbl_empleado JOIN tbl_cargo ON tbl_cargo.crg_id= tbl_empleado.id_crg
JOIN tbl_departamento ON tbl_departamento.dpt_id= tbl_empleado.id_dpt ORDER BY emp_apellido ASC";
$db = new db;
$showEmp = $db->getInfo($query);
$pdf = new pdf();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetTextColor(231, 73, 39);
$pdf->SetFont('Arial', 'B', 13);
$pdf->Cell(37, 12, 'Nombre', 1);
$pdf->Cell(37, 12, 'Apellido', 1);
$pdf->Cell(37, 12, 'Cedula', 1);
$pdf->Cell(37, 12, 'Cargo Ocupado', 1);
$pdf->Cell(37, 12, 'Departamento', 1);
foreach ($showEmp as $row) {
$counter = 1;
$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(43, 102, 168);
$pdf->Ln();
foreach ($row as $column) {
if ($counter > 3) {
$pdf->Cell(37, 10, $column, 1);
} else {
$pdf->Cell(37, 10, $column, 1);
}
++$counter;
}
}
$pdf->Output();