Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include ('fpdf181/fpdf.php');
- include ('konek.php');
- $nik=$_POST["nik"];
- $bobot_administrasi=$_POST["bobot_administrasi"];
- $bobot_atitut=$_POST["bobot_atitut"];
- $bobot_loyalitas=$_POST["bobot_loyalitas"];
- $bobot_kesehatan=$_POST["bobot_kesehatan"];
- $bobot_skil=$_POST["bobot_skil"];
- $no=0;
- $pdf = new FPDF('L','cm','Legal');
- $pdf->AddPage();
- $pdf->SetFont('Helvetica','',15);
- $pdf->Write(0.5, "PT. MEDION FARMA JAYA");$pdf->Ln();
- $pdf->SetFontSize(10);
- $pdf->Write(0.5, 'Laporan Nilai Karyawan');$pdf->Ln();
- $pdf->Write(0.5, "Jl. Babakan Ciparay No.282 Bandung");$pdf->Ln();
- $pdf->SetFont('Helvetica','B',12);
- $pdf->cell(33.5,2, 'Laporan Nilai Karyawan',1,0,'C');
- $pdf->Ln();
- $crMax = mysql_query("SELECT max(administrasi) as maxK1,
- max(wawancara) as maxK2,
- max(kepribadian) as maxK3,
- max(kesehatan) as maxK4
- FROM nilai");
- $max = mysql_fetch_array($crMax);
- $sql2 = mysql_query("SELECT * FROM nilai");
- $pdf->cell(1,2, 'No',1,0,'C');
- $pdf->cell(11,2, 'Nama Karyawan',1,0,C);
- $pdf->cell(10.5,2, 'Nilai SPK',1,0,C);
- $pdf->cell(11,2, 'Keterangan',1,0,C);
- $pdf->Ln();
- $sql3 = mysql_query("SELECT * FROM nilai");
- function getNama($nik){
- $q =mysql_query("SELECT * FROm nilai where nik = '$nik'");
- $d = mysql_fetch_array($q);
- return $d['nama'];
- }
- $bobot = array(0.30,0.30,0.20,0.20);
- while ($dt3 = mysql_fetch_array($sql3)) {
- $jumlah= ($dt3['administrasi'])+($dt3['wawancara'])+($dt3['kepribadian'])+($dt3['kesehatan']);
- $poin= round(
- (($dt3['administrasi']/$max['maxK1'])*$bobot[0])+
- (($dt3['wawancara']/$max['maxK2'])*$bobot[1])+
- (($dt3['kepribadian']/$max['maxK3'])*$bobot[2])+
- (($dt3['kesehatan']/$max['maxK4'])*$bobot[3]),3);
- $data[]=array('nama'=>getNama($dt3['nik']),
- 'jumlah'=>$jumlah,
- 'poin'=>$poin);
- }
- foreach ($data as $key => $isi) {
- $nama[$key]=$isi['nama'];
- $jlh[$key]=$isi['jumlah'];
- $poin1[$key]=$isi['poin'];
- }
- array_multisort($poin1,SORT_DESC,$jlh,SORT_DESC,$data);
- $no=1;
- $h="Juara";
- $Juara=1;
- $hr=1;
- foreach ($data as $item) {
- $nama[$key]=$isi['nama'];
- $jlh[$key]=$isi['jumlah'];
- $poin1[$key]=$isi['poin'];
- }
- foreach ($data as $item) {
- $pdf->SetFont('Helvetica','',10);
- $pdf->cell(1,1, $no.'.',1,0,'C');
- $pdf->cell(11,1,$item['nama'],1, '.','C');
- $pdf->cell(10.5,1, $item['poin'],1, '.','C');
- $pdf->cell(11,1,"$h $Juara" ,1,'.', 'C');
- $no++;
- if ($no>=4) {
- $h=" ";
- $Juara=" ";
- }else{
- $Juara++;
- }
- $pdf->Ln();
- }
- $pdf->Ln();
- $pdf->Ln();
- $pdf->SetFont('Helvetica','',12);
- $pdf->cell(0.5,0.5, 'Pimpinan');$pdf->cell(7);
- $pdf->cell(0.5,0.5, '');$pdf->cell(7);
- $pdf->cell(0.5,0.5, '');$pdf->cell(5);$pdf->Ln(1.5);$pdf->Ln(1.5);
- $pdf->cell(0.5,0.5, nama_pimpinan);$pdf->cell(7);
- $pdf->SetFont('Helvetica','BU',12);
- $pdf->Output();
- exit;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement