nasoa

contoh

Nov 16th, 2013
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. <?php
  2. include "fpdf.php";
  3. include "../conn.php";
  4.  
  5. $pdf = new FPDF();
  6. $pdf->AddPage();
  7.  
  8. //untuk judul
  9. $pdf->setFont('Arial','B',12);
  10. $pdf->setXY(75,5);
  11. $pdf->cell(30,6,'Laporan Nilai Siswa');
  12.  
  13. //untuk data pendukung
  14. $semester=$_GET['semester'];
  15. $nama_siswa=$_GET['nama_siswa'];
  16. $nis=$_GET['nis'];
  17. $tanggal=date('D,d-M-Y');
  18. $photo="../logo/".$_GET['photo'];
  19.  
  20. //untuk data siswa
  21. $pdf->setFont('Arial','B',8);
  22. $pdf->setXY(24,20);$pdf->cell(24,6,'Nama Siswa : '.$nama_siswa);
  23. $pdf->setXY(24,25);$pdf->cell(24,6,'NIS : '.$nis);
  24. $pdf->setXY(24,30);$pdf->cell(24,6,'Semester : '.$semester);
  25.  
  26. $pdf->Image($photo,150,10,20,20);
  27.  
  28. $pdf->setFont('Arial','I',8);
  29. $pdf->setXY(140,35);$pdf->cell(24,6,'Tanggal Cetak : '.$tanggal);
  30.  
  31. //untuk header
  32. $pdf->setFont('Arial','',8);
  33. $pdf->setFillColor(233,233,233);
  34. $y_axis1 = 40;
  35. $pdf->setY($y_axis1);
  36.  
  37. //untuk ontaint
  38. $y_initial = 46;
  39. $pdf->setX(25);
  40.  
  41. //header
  42. $pdf->cell(10,6,'No',1,0,'C',1);
  43. $pdf->cell(50,6,'Nama Pelajaran',1,0,'C',1);
  44. $pdf->cell(20,6,'Nilai Tugas',1,0,'C',1);
  45. $pdf->cell(20,6,'Nilai UTS',1,0,'C',1);
  46. $pdf->cell(20,6,'Nilai UAS',1,0,'C',1);
  47. $pdf->cell(20,6,'TOTAL NILAI',1,0,'C',1);
  48. $pdf->cell(20,6,'GRADE NILAI',1,0,'C',1);
  49. $y = $y_initial + $row;
  50.  
  51. $id_siswa=$_GET['id_siswa'];
  52. $id_periode=$_GET['id_periode'];
  53.  
  54. $nilai = mysql_query("SELECT nama_matapelajaran, nilai_tugas, nilai_uts, nilai_uas FROM tbl_nilai nilai, setup_matapelajaran matapelajaran WHERE nilai.id_siswa='$id_siswa' and nilai.id_periode='$id_periode' and nilai.id_matapelajaran=matapelajaran.id_matapelajaran order by matapelajaran.nama_matapelajaran asc");
  55.  
  56. $no = 0;
  57. $row = 6;
  58. while ($daftar = mysql_fetch_array($nilai)){
  59. $tugas=$daftar['nilai_tugas'];
  60. $uts=$daftar['nilai_uts'];
  61. $uas=$daftar['nilai_uas'];
  62. $total=round(($tugas+$uts+$uas)/3);
  63.  
  64. if($total>=80 && $total<=100){
  65. $grade="A";
  66. }
  67.  
  68. if($total>=68 && $total<=79){
  69. $grade="B";
  70. }
  71.  
  72. if($total>=50 && $total<=67){
  73. $grade="C";
  74. }
  75.  
  76. if($total>=38 && $total<=49){
  77. $grade="D";
  78. }
  79.  
  80. if($total>=0 && $total<=37){
  81.  
  82. $grade="E";
  83. }
  84.  
  85. $no++;
  86. $pdf->setY($y);
  87. $pdf->setX(25);
  88. $pdf->cell(10,6,$no,1,0,'C');
  89. $pdf->cell(50,6,$daftar['nama_matapelajaran'],1,0,'L');
  90. $pdf->cell(20,6,$tugas,1,0,'L');
  91. $pdf->cell(20,6,$uts,1,0,'C');
  92. $pdf->cell(20,6,$uas,1,0,'R');
  93. $pdf->cell(20,6,$total,1,0,'R');
  94. $pdf->cell(20,6,$grade,1,0,'R');
  95. $y = $y + $row;
  96. }
  97.  
  98.  
  99. $pdf->Output();
  100. ?>
Advertisement
Add Comment
Please, Sign In to add comment