1.Input Nilai
2.Cek Nilai yang dimasukkan
3.Pencarian Nilai Max dan Min di setiap kriterianya
4.Hitung nilai bobotnya berdasarkan rumus SMART
5.Pengurutan Nilai.....Secara Descending
Dan Ini adalah kodenya:
<?php
$pro="simpan";
$tanggal=WKT(date("Y-m-d"));
?>
<link type="text/css" href="<?php echo "$PATH/base/";?>ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="<?php echo "$PATH/";?>jquery-1.3.2.js"></script>
<script type="text/javascript" src="<?php echo "$PATH/";?>ui/ui.core.js"></script>
<script type="text/javascript" src="<?php echo "$PATH/";?>ui/ui.datepicker.js"></script>
<script type="text/javascript" src="<?php echo "$PATH/";?>ui/i18n/ui.datepicker-id.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#tanggal").datepicker({
dateFormat : "dd MM yy",
changeMonth : true,
changeYear : true
});
});
</script>
<style>
#table {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#table td, #table th {
border: 1px solid #ddd;
padding: 8px;
}
#table tr:nth-child(even){background-color: #f2f2f2;}
#table tr:hover {background-color: #ddd;}
#table th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #000;
color: white;
}
</style>
<script type="text/javascript">
function PRINT(id_penilaian,id_ta){
win=window.open('detail/print.php?id_penilaian='+id_penilaian+'&id_ta='+id_ta,'win','width=1000, height=400, menubar=0, scrollbars=1, resizable=0, location=0, toolbar=0, kriteria3=0'); }
</script>
<script language="JavaScript">
function buka(url) {window.open(url, 'window_baru', 'width=800,height=600,left=320,top=100,resizable=1,scrollbars=1');}
</script>
<br><br>
<?php
$sql="select * from `$tb_penilaian` order by `id_penilaian` desc";
if(isset($_GET["id"])){
$id_penilaian=$_GET["id"];
$sql="select * from `$tb_penilaian` where `id_penilaian`='$id_penilaian' order by `id_penilaian` desc";
}
$ada=getJum($conn,$sql);
if($ada<1){
echo"<h1>Belum Ada Data Penilaian</h1>";
}
else{
$d=getField($conn,$sql);
$id_penilaian=$d["id_penilaian"];
$nama_penilaian=$d["nama_penilaian"];
$id_ta=$d["id_ta"];
$bobot_kriteria1=$d["bobot_kriteria1"];
$bobot_kriteria2=$d["bobot_kriteria2"];
$bobot_kriteria3=$d["bobot_kriteria3"];
$bobot_kriteria4=$d["bobot_kriteria4"];
$bobot_kriteria5=$d["bobot_kriteria5"];
$total=$bobot_kriteria1+$bobot_kriteria2+$bobot_kriteria3+$bobot_kriteria4+$bobot_kriteria5;
$sbobot1="$bobot_kriteria1/$total";
$sbobot2="$bobot_kriteria1/$total";
$sbobot3="$bobot_kriteria1/$total";
$sbobot4="$bobot_kriteria1/$total";
$sbobot5="$bobot_kriteria1/$total";
$nbobot1=$bobot_kriteria1/$total;
$nbobot2=$bobot_kriteria1/$total;
$nbobot3=$bobot_kriteria1/$total;
$nbobot4=$bobot_kriteria1/$total;
$nbobot5=$bobot_kriteria1/$total;
$kuota=$gkuota;
$status=$d["status"];
$keterangan=$d["keterangan"];
?>
<link rel="stylesheet" href="js/jquery-ui.css">
<link rel="stylesheet" href="resources/demos/style.css">
<script src="js/jquery-1.12.4.js"></script>
<script src="js/jquery-ui.js"></script>
<script>
$( function() {
$( "#accordion" ).accordion({
collapsible: true
});
} );
</script>
<div id="accordion">
<h4>Info Penilaian <?php echo $id_penilaian;?></h4>
<div>
<h1>Definisi SMART</h1>
Adalah singkatan dari Simple Multi Attribute Rating Technique,
yang digunakan untuk mendukung
pembuat keputusan dalam memilih diantara beberapa alternatif. <br>
Setiap alternatif terdiri dari sekumpulan
atribut dan setiap atribut mempunyai nilai-nilai.<br>
Nilai ini dirata-rata dengan skala tertentu.
Setiap atribut mempunyai bobot yang menggambarkan
seberapa penting dibandingkan dengan atribut lain.<br>
Pembobotan dan pemberian peringkat ini digunakan untuk menilai
setiap alternatif agar diperoleh alternatif terbaik. <br><br>
Pembobotan pada SMART menggunakan skala antara 0 sampai 1,
sehingga mempermudah perhitungan dan perbandingan nilai pada masing-masing alternatif. <br>
Model yang digunakan dalam SMART yaitu :<br>
<img src='ypathfile/smart1.png' title='Analisa SPK Menggunakan SMART'><br>
<pre>
Keterangan:
wj = nilai pembobotan kriteria ke-j dan k kriteria
u(ai) = nilai utility kriteria ke-i untuk kriteria ke-i
Pemilihan keputusan adalah mengidentifikasi mana dari n alternatif yang mempunyai nilai fungsi terbesar.
</pre><br>
<b>Teknik Motode SMART :</b><br>
1. Langkah 1: menentukan jumlah kriteria<br>
2. Langkah 2: sistem secara default memberikan skala 0-100 berdasarkan prioritas yang telah diinputkan kemudian dilakukan normalisasi.<br>
Rumus Normalisasi = <br>
<img src='ypathfile/smart2.png' title='Analisa SPK Menggunakan SMART'><br>
<pre>
Keterangan : wj =bobot suatu kriteria
</pre><br>
3. Langkah 3: memberikan nilai kriteria untuk setiap alternatif.<br>
4. Langkah 4: hitung nilai utility untuk setiap kriteria masing-masing.<br>
<img src='ypathfile/smart3.png' title='Analisa SPK Menggunakan SMART'><br>
<pre>
Keterangan :
ui(ai) : nilai utility kriteria ke-1 untuk kriteria ke-i
Cmax : nilai kriteria maksimal
Cmin : nilai kriteria minimal
Cout i : nilai kriteria ke-i
</pre><br>
5. Langkah 5: hitung nilai akhir masing-masing.<br>
6. Langkah 6: mengurutkan hasil penilaian.<br>
7. Langkah 7: menyimpan hasil ke arsip.<br>
<h1>Lebih Detail Proses-Prosesnya adalah sbb</h1>
<table id="table">
<tr>
<th width="312"><label for="id_penilaian">ID Penilaian</label>
<th width="30">:
<th width="736" colspan="2"><b><?php echo $id_penilaian;?></b>
</tr>
<tr>
<td><label for="nama_penilaian">Nama Penilaian</label>
<td>:
<td colspan="2"><?php echo $nama_penilaian;?></td>
</tr>
<tr>
<td><label for="id_ta">Tahun Ajaran</label>
<td>:
<td colspan="2"><?php echo getTa($conn,$id_ta);?></td>
</tr>
<tr>
<td><label for="id_ta">Kuota Penerimaan</label>
<td>:
<td colspan="2"><?php echo $kuota;?> Orang</td>
</tr>
<tr>
<td valign='top'><label for="id_ta">Pembobotan dan Normalisasi</label>
<td valign='top'>:
<td colspan="2" valign='top'>
<?php
$gab="<table width='100%'>
<tr bgcolor='#dddddd'><th>Utility<th>Kriteria<th>Bobot<th>Formula<th>Normalisasi</tr>
<tr><td>Bobot $kr1<td>$bobot_kriteria1<td>$skr1<td>$sbobot1<td>$nbobot1</tr>
<tr><td>Bobot $kr2<td>$bobot_kriteria2<td>$skr2<td>$sbobot2<td>$nbobot2</tr>
<tr><td>Bobot $kr3<td>$bobot_kriteria3<td>$skr3<td>$sbobot3<td>$nbobot3</tr>
<tr><td>Bobot $kr4<td>$bobot_kriteria4<td>$skr4<td>$sbobot4<td>$nbobot4</tr>
<tr><td>Bobot $kr5<td>$bobot_kriteria5<td>$skr5<td>$sbobot5<td>$nbobot5</tr>
</table>
";
echo $gab;
?>
</tr>
<tr>
<td height="24"><label for="status">Status</label>
<td>:<td colspan="2"><?php echo $status;?>
</td>
</tr>
<tr>
<td><label for="keterangan">Keterangan</label>
<td>:<td colspan="2"><?php echo $keterangan;?></td></tr>
</table>
<hr>
<table id="table">
<tr bgcolor="#036">
<th width="3%"><center>No</th>
<th width="3%"><center>NIS</th>
<th width="25%"><center>Nama Siswa</th>
<th width="5%"><center><?php echo $kr1;?></th>
<th width="5%"><center><?php echo $kr2;?></th>
<th width="5%"><center><?php echo $kr3;?></th>
<th width="5%"><center><?php echo $kr4;?></th>
<th width="5%"><center><?php echo $kr5;?></th>
<th width="20%"><center>Catatan</th>
</tr>
<?php
$sql="select * from `$tb_detail` where `id_penilaian`='$id_penilaian' order by `id` asc";
$jum=getJum($conn,$sql);
if($jum > 0){
$no=1;
$arr=getData($conn,$sql);
foreach($arr as $d) {
$id=$d["id"];
$id_penilaian=$d["id_penilaian"];
$nis=$d["nis"];
$nama=strtoupper(getSiswa($conn,$d["nis"]));
$kriteria1=$d["kriteria1"];
$kriteria2=$d["kriteria2"];
$kriteria3=$d["kriteria3"];
$kriteria4=$d["kriteria4"];
$kriteria5=$d["kriteria5"];
$catatan=$d["catatan"];
$i=$no-1;
$arID[$i]=$id;
$arNis[$i]=$nis;
$arNama[$i]=$nama;
$arKr1[$i]=$kriteria1;
$arKr2[$i]=$kriteria2;
$arKr3[$i]=$kriteria3;
$arKr4[$i]=$kriteria4;
$arKr5[$i]=$kriteria5;
$color="#dddddd";
if($no %2==0){$color="#eeeeee";}
echo"<tr bgcolor='$color'>
<td>$no</td>
<td>$nis</td>
<td><b>$nama</b></td>
<td>$kriteria1
<td>$kriteria2
<td>$kriteria3
<td>$kriteria4
<td>$kriteria5
<td>$catatan</td>
</tr>";
$no++;
}//while
$max1=max($arKr1);
$max2=max($arKr2);
$max3=max($arKr3);
$max4=max($arKr4);
$max5=max($arKr5);
$min1=min($arKr1);
$min2=min($arKr2);
$min3=min($arKr3);
$min4=min($arKr4);
$min5=min($arKr5);
echo"<tr bgcolor='#000000'>
<th><font color='#ffffff'>#</th>
<th colspan='2'><font color='#ffffff'>Nilai Maksimum</th>
<th><font color='#ffffff'>$max1
<th><font color='#ffffff'>$max2
<th><font color='#ffffff'>$max3
<th><font color='#ffffff'>$max4
<th><font color='#ffffff'>$max5
<th><font color='#ffffff'>-</font></th>
</tr>";
echo"<tr bgcolor='#000000'>
<th><font color='#ffffff'>#</th>
<th colspan='2'><font color='#ffffff'>Nilai Minimum</th>
<th><font color='#ffffff'>$min1
<th><font color='#ffffff'>$min2
<th><font color='#ffffff'>$min3
<th><font color='#ffffff'>$min4
<th><font color='#ffffff'>$min5
<th><font color='#ffffff'>-</font></th>
</tr>";
}//if
else{echo"<tr><td colspan='10'><blink>Maaf, List Siswa pada Penilaian $id_penilaian belum tersedia...</blink></td></tr>";}
?>
</table>
</div>
<?php
$jd=$i;
$gab="<h4>Menghitung Nilai Utility Tiap Kriteria </h4><div> ";
$gab.="<table width='90%' border='1'>
<tr bgcolor='#cccccc'><th>No<th>NIS<th>Nama<th>$kr1<th>$kr2<th>$kr3<th>$kr4<th>$kr5</tr>";
for($i=0;$i<$jd;$i++){
$v1=getBenefit($arKr1[$i],$max1,$min1);
$v2=getBenefit($arKr2[$i],$max2,$min2);
$v3=getCost($arKr3[$i],$max3,$min3);
$v4=getBenefit($arKr4[$i],$max4,$min4);
$v5=getBenefit($arKr5[$i],$max5,$min5);
$arV1[$i]=$v1[0];
$arV2[$i]=$v2[0];
$arV3[$i]=$v3[0];
$arV4[$i]=$v4[0];
$arV5[$i]=$v5[0];
$arS1[$i]=$v1[1];
$arS2[$i]=$v2[1];
$arS3[$i]=$v3[1];
$arS4[$i]=$v4[1];
$arS5[$i]=$v5[1];
$no=$i+1;
$gab.="<tr><td>$no<td>$arNis[$i]<td>$arNama[$i]
<td><label title='$v1[1]'>$v1[0]</label></td>
<td><label title='$v2[1]'>$v2[0]</label></td>
<td><label title='$v3[1]'>$v3[0]</label></td>
<td><label title='$v4[1]'>$v4[0]</label></td>
<td><label title='$v5[1]'>$v5[0]</label></td>
";
}
$gab.="</table><br><br>";
$gab.="<b>Menghitung Pembobotan Tiap Alternatif </b><br>";
$gab.="<table width='90%' border='1'>
<tr bgcolor='#cccccc'><th>No<th>NIS<th>Nama<th>Formula<th>Bobot</tr>";
for($i=0;$i<$jd;$i++){
$no=$i+1;
$vbbt=($arV1[$i] * $nbobot1) + ($arV2[$i] * $nbobot2) + ($arV3[$i] * $nbobot3) + ($arV4[$i] * $nbobot4) + ($arV5[$i] * $nbobot5);
$sbbt="($arV1[$i] * $nbobot1) + ($arV2[$i] * $nbobot2) + ($arV3[$i] * $nbobot3) + ($arV4[$i] * $nbobot4) + ($arV5[$i] * $nbobot5)";
$arH[$i]=$vbbt;
$arS[$i]=$sbbt;
$gab.="<tr><td>$no<td>$arNis[$i]<td>$arNama[$i]
<td><label title='$sbbt'>$sbbt</label></td>
<td><label title='$sbbt'>$vbbt</label></td>
";
}
$gab.="</table><br><br>";
$array_count = $jd;
for($x = 0; $x < $array_count; $x++){
for($a = 0 ; $a < $array_count - 1 ; $a++){
if($a < $array_count ){
if($arH[$a] < $arH[$a + 1] ){
swap($arH, $a, $a+1);
swap($arS, $a, $a+1);
swap($arID, $a, $a+1);
swap($arNis, $a, $a+1);
swap($arNama, $a, $a+1);
}
}
}
}
$sql="delete from `$tb_hasil` where `id_penilaian`='$id_penilaian'";
$hapus=process($conn,$sql);
$gab.="<b>Pengurutan Hasil Pembobotan Tiap Alternatif </b><br>";
$gab.="<table width='90%' border='1'>
<tr bgcolor='#cccccc'><th>No<th>NIS<th>Nama<th>Formula<th>Bobot<th>Status</tr>";
for($i=0;$i<$jd;$i++){
$no=$i+1;
$st="Gagal";
if($no<=$kuota){$st="Diterima";}
$gab.="<tr><td>$no<td>$arNis[$i]<td>$arNama[$i]
<td><label title='$arS[$i]'>$arS[$i]</label></td>
<td><label title='$arS[$i]'>$arH[$i]</label></td>
<td><label title='Penerimaan Beasiswa Kuota $kuota Orang'>$st</label>
";
$sql=" INSERT INTO `$tb_hasil` (
`id_hasil` ,
`id` ,
`id_penilaian` ,
`nis` ,
`rekapitulasi` ,
`bobot` ,
`ranking` ,
`keterangan`
) VALUES (
'',
'$arID[$i]',
'$id_penilaian',
'$arNis[$i]',
'$arS[$i]',
'$arH[$i]',
'$no',
'$st'
)";
$simpan=process($conn,$sql);
}
$gab.="</table>";
$gab.="</div>";
echo $gab;
?>
</div>
<?php
}//else
if($_GET["pro"]=="hapus"){
$id=$_GET["kode"];
$id_penilaian=$_GET["id"];
$sql="delete from `$tb_detail` where `id`='$id'";
$hapus=process($conn,$sql);
if($hapus) {echo "<script>alert('Data detail $id berhasil dihapus !');document.location.href='?mnu=detail&id=$id_penilaian';</script>";}
else{echo"<script>alert('Data detail $id gagal dihapus...');document.location.href='?mnu=detail&id=$id_penilaian';</script>";}
}
function swap(&$arr, $a, $b) {
$tmp = $arr[$a];
$arr[$a] = $arr[$b];
$arr[$b] = $tmp;
}
function getBenefit($out,$max,$min){
$x1=($max-$out)/($max-$min);
$x2="Benefit = (max-out)/(max-min) =($max-$out)/($max-$min)";
$ar[0]=$x1;
$ar[1]=$x2;
return $ar;
}
function getCost($out,$max,$min){
$x1=($out-$min)/($max-$min);
$x2="Cost = (out-min)/(max-min) = ($out-$min)/($max-$min)";
$ar[0]=$x1;
$ar[1]=$x2;
return $ar;
}
?>
Tidak ada komentar:
Posting Komentar