Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. <?php
  2. require './fpdf.php';
  3. require './core/database/database.php';
  4.  
  5. class myPDF extends FPDF
  6. {
  7. function header()
  8. {
  9. $this->SetFont('Times', 'B', 14);
  10. $this->Cell(276, 5, 'Wykaz Lekow', 0, 0, 'C');
  11. $this->Ln(10);
  12. // $this->SetFont('Times', '', 12);
  13. // $this->Cell(276, 10, 'Street Address of Employee Office', 0, 0, 'C');
  14. // $this->Ln(20);
  15. }
  16.  
  17. function footer()
  18. {
  19. // $this->SetY(-15);
  20. // $this->SetFont('Arial', '', 0);
  21. // $this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C');
  22. }
  23.  
  24. function headerTable()
  25. {
  26. $this->SetFont('Times','B', 12);
  27. $this->Cell(60,10,idLeku,1,0,'C');
  28. $this->Cell(60,10,nazwa,1,0,'C');
  29. $this->Cell(60,10,ilosc,1,0,'C');
  30. $this->Cell(60,10,terminPrzydatnosci,1,0,'C');
  31. $this->Ln();
  32. }
  33.  
  34. function viewTable($db)
  35. {
  36. $this->SetFont('Times', '', 12);
  37. $stmt = $db->query('select * from lek');
  38. while ($data = $stmt->fetch(PDO::FETCH_OBJ)) {
  39. $this->Cell(60,10,$data->idLeku,1,0,'C');
  40. $this->Cell(60,10,$data->nazwa,1,0,'L');
  41. $this->Cell(60,10,$data->ilosc,1,0,'L');
  42. $this->Cell(60,10,$data->terminPrzydatnosci,1,0,'L');
  43. $this->Ln();
  44. }
  45. }
  46.  
  47. }
  48. $pdf = new myPDF();
  49. $pdf->AliasNbPages();
  50. $pdf->AddPage('L','A4',0);
  51. $pdf->headerTable();
  52. $pdf->viewTable($db);
  53. $pdf->Output();
  54. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement