Advertisement
Roy_Iwan_Pasaribu

laporan

Dec 7th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.01 KB | None | 0 0
  1. <?php
  2.  
  3. include ('fpdf181/fpdf.php');
  4. include ('konek.php');
  5. $nik=$_POST["nik"];
  6. $bobot_administrasi=$_POST["bobot_administrasi"];
  7. $bobot_atitut=$_POST["bobot_atitut"];
  8. $bobot_loyalitas=$_POST["bobot_loyalitas"];
  9. $bobot_kesehatan=$_POST["bobot_kesehatan"];
  10. $bobot_skil=$_POST["bobot_skil"];
  11.  
  12. $no=0;
  13.  
  14. $pdf = new FPDF('L','cm','Legal');
  15. $pdf->AddPage();
  16. $pdf->SetFont('Helvetica','',15);
  17. $pdf->Write(0.5, "PT. MEDION FARMA JAYA");$pdf->Ln();
  18. $pdf->SetFontSize(10);
  19. $pdf->Write(0.5, 'Laporan Nilai Karyawan');$pdf->Ln();
  20. $pdf->Write(0.5, "Jl. Babakan Ciparay No.282 Bandung");$pdf->Ln();
  21. $pdf->SetFont('Helvetica','B',12);
  22. $pdf->cell(33.5,2, 'Laporan Nilai Karyawan',1,0,'C');
  23. $pdf->Ln();
  24.  
  25.  
  26. $crMax = mysql_query("SELECT max(administrasi) as maxK1,
  27. max(wawancara) as maxK2,
  28. max(kepribadian) as maxK3,
  29. max(kesehatan) as maxK4
  30. FROM nilai");
  31. $max = mysql_fetch_array($crMax);
  32.  
  33. $sql2 = mysql_query("SELECT * FROM nilai");
  34.  
  35.  
  36. $pdf->cell(1,2, 'No',1,0,'C');
  37. $pdf->cell(11,2, 'Nama Karyawan',1,0,C);
  38. $pdf->cell(10.5,2, 'Nilai SPK',1,0,C);
  39. $pdf->cell(11,2, 'Keterangan',1,0,C);
  40.  
  41. $pdf->Ln();
  42. $sql3 = mysql_query("SELECT * FROM nilai");
  43. function getNama($nik){
  44. $q =mysql_query("SELECT * FROm nilai where nik = '$nik'");
  45. $d = mysql_fetch_array($q);
  46. return $d['nama'];
  47. }
  48. $bobot = array(0.30,0.30,0.20,0.20);
  49. while ($dt3 = mysql_fetch_array($sql3)) {
  50. $jumlah= ($dt3['administrasi'])+($dt3['wawancara'])+($dt3['kepribadian'])+($dt3['kesehatan']);
  51. $poin= round(
  52. (($dt3['administrasi']/$max['maxK1'])*$bobot[0])+
  53. (($dt3['wawancara']/$max['maxK2'])*$bobot[1])+
  54. (($dt3['kepribadian']/$max['maxK3'])*$bobot[2])+
  55. (($dt3['kesehatan']/$max['maxK4'])*$bobot[3]),3);
  56.  
  57. $data[]=array('nama'=>getNama($dt3['nik']),
  58. 'jumlah'=>$jumlah,
  59. 'poin'=>$poin);
  60.  
  61. }
  62.  
  63. foreach ($data as $key => $isi) {
  64. $nama[$key]=$isi['nama'];
  65. $jlh[$key]=$isi['jumlah'];
  66. $poin1[$key]=$isi['poin'];
  67. }
  68. array_multisort($poin1,SORT_DESC,$jlh,SORT_DESC,$data);
  69. $no=1;
  70. $h="Juara";
  71. $Juara=1;
  72. $hr=1;
  73.  
  74.  
  75. foreach ($data as $item) {
  76. $nama[$key]=$isi['nama'];
  77. $jlh[$key]=$isi['jumlah'];
  78. $poin1[$key]=$isi['poin'];
  79. }
  80.  
  81.  
  82. foreach ($data as $item) {
  83. $pdf->SetFont('Helvetica','',10);
  84. $pdf->cell(1,1, $no.'.',1,0,'C');
  85. $pdf->cell(11,1,$item['nama'],1, '.','C');
  86. $pdf->cell(10.5,1, $item['poin'],1, '.','C');
  87. $pdf->cell(11,1,"$h $Juara" ,1,'.', 'C');
  88. $no++;
  89. if ($no>=4) {
  90. $h=" ";
  91. $Juara=" ";
  92. }else{
  93. $Juara++;
  94. }
  95.  
  96. $pdf->Ln();
  97. }
  98.  
  99.  
  100. $pdf->Ln();
  101. $pdf->Ln();
  102. $pdf->SetFont('Helvetica','',12);
  103. $pdf->cell(0.5,0.5, 'Pimpinan');$pdf->cell(7);
  104. $pdf->cell(0.5,0.5, '');$pdf->cell(7);
  105. $pdf->cell(0.5,0.5, '');$pdf->cell(5);$pdf->Ln(1.5);$pdf->Ln(1.5);
  106. $pdf->cell(0.5,0.5, nama_pimpinan);$pdf->cell(7);
  107. $pdf->SetFont('Helvetica','BU',12);
  108. $pdf->Output();
  109. exit;
  110.  
  111. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement