Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require './fpdf.php';
- require './core/database/database.php';
- class myPDF extends FPDF
- {
- function header()
- {
- $this->SetFont('Times', 'B', 14);
- $this->Cell(276, 5, 'Wykaz Lekow', 0, 0, 'C');
- $this->Ln(10);
- // $this->SetFont('Times', '', 12);
- // $this->Cell(276, 10, 'Street Address of Employee Office', 0, 0, 'C');
- // $this->Ln(20);
- }
- function footer()
- {
- // $this->SetY(-15);
- // $this->SetFont('Arial', '', 0);
- // $this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C');
- }
- function headerTable()
- {
- $this->SetFont('Times','B', 12);
- $this->Cell(60,10,idLeku,1,0,'C');
- $this->Cell(60,10,nazwa,1,0,'C');
- $this->Cell(60,10,ilosc,1,0,'C');
- $this->Cell(60,10,terminPrzydatnosci,1,0,'C');
- $this->Ln();
- }
- function viewTable($db)
- {
- $this->SetFont('Times', '', 12);
- $stmt = $db->query('select * from lek');
- while ($data = $stmt->fetch(PDO::FETCH_OBJ)) {
- $this->Cell(60,10,$data->idLeku,1,0,'C');
- $this->Cell(60,10,$data->nazwa,1,0,'L');
- $this->Cell(60,10,$data->ilosc,1,0,'L');
- $this->Cell(60,10,$data->terminPrzydatnosci,1,0,'L');
- $this->Ln();
- }
- }
- }
- $pdf = new myPDF();
- $pdf->AliasNbPages();
- $pdf->AddPage('L','A4',0);
- $pdf->headerTable();
- $pdf->viewTable($db);
- $pdf->Output();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement