loreng

[SETTING] Report File

Feb 5th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.61 KB | None | 0 0
  1. <?php
  2.  
  3. require('../../plugin/fpdf/fpdf.php');
  4. include('../../system/class.php');
  5.  
  6. $mimin = new Admin();
  7. $data = $mimin->getDataPeminjam();
  8. $name = "Mohammad Entol Rizky Muslimin";
  9. $npk = "171810195";
  10.  
  11. class myPDF extends FPDF
  12. {
  13.     function Header()
  14.     {
  15.         $this->Image("../../assets/icon/logo.png",15,6,20,20);
  16.         $this->SetFont('Arial','B',10);
  17.         $this->Cell(200,4,"PERPUSTAKAAN SMK TELEKOMUNIKASI TELESANDI BEKASI",0,0,"C");
  18.         $this->Ln();
  19.         $this->setFont('Times','',10);
  20.         $this->cell(200,4,'Mekarsari Raya Jl. KH.Mochammad, Tambun Selatan, Bekasi, Indonesia.',0,0,"C");
  21.         $this->Ln();
  22.         $this->cell(200,4,'(+62)21 88332404 (Telp) | (021) 88323429 (Fax) | (+62)821-1978-8898 (Whatsapp)',0,0,"C");
  23.         $this->SetDash();
  24.         $this->Line(5, 30, 205, 30);
  25.         $this->Ln(10);
  26.     }
  27.     function Footer()
  28.     {  
  29.         $this->SetY(-15);
  30.         $this->Line(5,280,205,280);
  31.         $this->Ln();
  32.         $this->setFont('Arial','',8);
  33.         $this->Cell(0,10,'Bagian Perpustakaan '.realDate(),0,0,'L');
  34.         $this->Cell(0,10,'Halaman '.$this->PageNo().'/{nb}',0,0,'R');
  35.     }
  36.     function judul()
  37.     {
  38.         $this->Ln();
  39.         $this->SetFont("Times","B",14);
  40.         $this->Cell(200,5,'LAPORAN  REKAPITULASI DATA PEMINJAM',0,0,'C');
  41.         $this->Ln(10);
  42.     }
  43.     function headerTable()
  44.     {
  45.         $this->SetFont("Times","B",8);
  46.         $this->Cell(25,10,"NIS",1,0,"C");
  47.         $this->Cell(40,10,"NAMA",1,0,"C");
  48.         $this->Cell(30,10,"KELAS",1,0,"C");
  49.         $this->Cell(30,10,"ALAMAT",1,0,"C");
  50.         $this->Cell(30,10,"NO HANPHONE",1,0,"C");
  51.         $this->Cell(35,10,"EMAIL",1,0,"C");
  52.         $this->Ln();
  53.  
  54.         // $this->SetWidths(array(25,40,30,30,30,35));
  55.         // $this->Row(array(
  56.         //  'NIS',
  57.         //  'Nama',
  58.         //  'Kelas',
  59.         //  'Alamat',
  60.         //  'No Handphone',
  61.         //  'Email'
  62.         // ));
  63.     }
  64.     function viewTable($data)
  65.     {
  66.         $this->SetFont('Times','',8);
  67.         foreach ($data as $key => $value) {
  68.             $this->SetWidths(array(25,40,30,30,30,35));
  69.             $this->Row(array(
  70.                 $value['nis'],
  71.                 $value['nama'],
  72.                 $value['kelas'],
  73.                 $value['alamat'],
  74.                 $value['no_hp'],
  75.                 $value['email']
  76.             ));
  77.         }
  78.     }
  79.     function knowby($name,$npk)
  80.     {
  81.         $this->SetFont("Times","B",12);
  82.         $this->Ln(10);
  83.         $this->Cell(162,10,"Mengetahui",0,0,'R');
  84.         $this->Ln(5);
  85.         $this->SetFont("Times","",10);
  86.         $this->Cell(170,10,"Kepala Perpustakaan",0,0,'R');
  87.         $this->Ln(20);
  88.         $this->SetFont("Times","U",10);
  89.         $this->Cell(190,30,$name,0,0,'R');
  90.         $this->Ln(20);
  91.         $this->SetFont("Times","",9);
  92.         $this->Cell(164,0,"NPK : ". $npk,0,0,'R');
  93.     }
  94. }
  95.  
  96. $pdf = new myPDF();
  97. $pdf->AliasNbPages();  
  98. $pdf->AddPage('P','A4',0);
  99. $pdf->judul();
  100. $pdf->headerTable();
  101. $pdf->viewTable($data);
  102. $pdf->knowby($name,$npk);
  103. ob_end_clean();
  104. $pdf->output();
  105. ?>
Advertisement
Add Comment
Please, Sign In to add comment