Advertisement
cdsatrian

print laporan

Jul 13th, 2017
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.03 KB | None | 0 0
  1. <?php
  2. $tanggal_awal = isset($_GET['tanggal_awal'])?$_GET['tanggal_awal']:date('Y-m-d');
  3. $tanggal_akhir = isset($_GET['tanggal_akhir'])?$_GET['tanggal_akhir']:date('Y-m-d');
  4. include 'koneksi.php';
  5. $sql="SELECT * FROM pemakaian WHERE `tanggal_pemakaian` BETWEEN '{$tanggal_awal}' AND '{$tanggal_akhir}'";
  6. $data = mysqli_query($link,$sql);
  7. $row_cnt = mysqli_num_rows($data);
  8. if($row_cnt==0) die("tidak ada data ditemukan dengan query [{$sql}]");
  9. require('laporan/fpdf.php');
  10. $pdf = new FPDF("L","cm","A4");
  11. $pdf->SetMargins(2,1,1);
  12. $pdf->AliasNbPages();
  13. $pdf->AddPage();
  14. $pdf->SetFont('Times','B',11);
  15. //$pdf->Image('../logo/tk.png',1,1,2,2);
  16. $pdf->SetX(4);
  17. $pdf->MultiCell(19.5,0.5,'TK (TOKO TEUNGKU)',0,'L');
  18. $pdf->SetX(4);
  19. $pdf->MultiCell(19.5,0.5,'Telpon : 0812XXXXXXX',0,'L');
  20. $pdf->SetFont('Arial','B',10);
  21. $pdf->SetX(4);
  22. $pdf->MultiCell(19.5,0.5,'JL. Sp.Dodik',0,'L');
  23. $pdf->SetX(4);
  24. $pdf->MultiCell(19.5,0.5,'Website : | Email : ',0,'L');
  25. $pdf->Line(1,3.1,28.5,3.1);
  26. $pdf->SetLineWidth(0.1);
  27. $pdf->Line(1,3.2,28.5,3.2);
  28. $pdf->SetLineWidth(0);
  29. $pdf->ln(1);
  30. $pdf->SetFont('Arial','B',14);
  31. $pdf->Cell(0,0.7,'Laporan Data pemakaian pertanggal',0,0,'C');
  32. $pdf->ln(1);
  33. $pdf->SetFont('Arial','B',10);
  34. $pdf->Cell(5,0.7,"Di cetak pada : ".date("D-d/m/Y"),0,0,'C');
  35. $pdf->ln(1);
  36. $pdf->Cell(6,0.7,"tanggal_awal : {$tanggal_awal} tanggal_akhir {$tanggal_akhir}",0,0,'C');
  37.  
  38. $pdf->ln(1);
  39. $pdf->Cell(1, 0.8, 'NO', 1, 0, 'C');
  40. $pdf->Cell(3, 0.8, 'nik', 1, 0, 'C');
  41. $pdf->Cell(3, 0.8, 'no_polisi', 1, 0, 'C');
  42. $pdf->Cell(3, 0.8, 'id_sopir', 1, 0, 'C');
  43. $pdf->Cell(3, 0.8, 'tanggal_pemakaian', 1, 0, 'C');
  44. $pdf->Cell(3, 0.8, 'tanggal_pengembalian', 1, 0, 'C');
  45. $pdf->Cell(3, 0.8, 'tanggal_pemakaian', 1, 0, 'C');
  46. $pdf->Cell(3, 0.8, 'tujuan', 1, 0, 'C');
  47. $pdf->Cell(3, 0.8, 'keperluan', 1, 0, 'C');
  48. $no=1;
  49. // $pdf->Cell(1, 0.8, date($dari), 1, 0, 'C');
  50. while ($r = mysqli_fetch_array($data)){
  51. $pdf->Cell(1, 0.8, $no , 1, 0, 'C');
  52. $pdf->Cell(3, 0.8, $r['tanggal_pemakaian'],1, 0, 'C'); 
  53. $no++;
  54. }
  55. $pdf->Output("laporan_pemakaian.pdf","I");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement