function rapor_peringkatkelas_siswa($kls,$siswa){ $db=siswa_db_bykelas($kls); $db->field("aka_komenrapor:komen"); $db->join_cust("aka_komenrapor ON aka_komenrapor.siswa=aka_siswa.replid AND aka_komenrapor.tahunajaran=aka_tahunajaran.replid"); $sna=""; $phn=array(); $SSKM=array(); $npeni=0; $t0=dbQSql("SELECT * FROM aka_sks WHERE kelas='$kls' GROUP BY pelajaran"); while($r0=dbFA($t0)){ $pelid=$r0['pelajaran']; $pel=$r0['pelajaran']; $gid=$r0['guru']; $SKM=pelajaran_skm($pel); $SSKM[$pelid]=$SKM; $db->field($SKM." as SKM_".$pelid); $t1=dbQSql("SELECT * FROM aka_penilaian WHERE guru='$gid' AND pelajaran='$pel' AND kelas='$kls'"); //echo '<span style="color:red">'."SELECT * FROM aka_penilaian WHERE guru='$gid' AND pelajaran='$pel' AND kelas='$kls'".'</span>'; if(dbNRow($t1)>0){ $phn[$pelid]='@'; $sk=""; $tbobot=0; $sb=""; while($r1=dbFA($t1)){ $db->field("@".$r1['kode']."_".$pelid." := IFNULL((SELECT aka_daftarnilai.nilai FROM aka_daftarnilai WHERE aka_daftarnilai.siswa=aka_siswa.replid AND aka_daftarnilai.penilaian='".$r1['replid']."'),0) as T".$r1['kode']."_".$pelid); $db->field($r1['bobot']." as B".$r1['kode']."_".$pelid); $tbobot+=$r1['bobot']; if($r1['bobot']>0){ if($sk!="")$sk.=" + "; $sk.="@".$r1['kode']."_".$pelid; if($sb!="")$sb.=" + "; $sb.="@".$r1['kode']."_".$pelid." * ".$r1['bobot']; } } if($sk!="") $db->field("(".$sk.") as JMLNILAI_".$pelid); else $db->field("0 as JMLNILAI_".$pelid); if($tbobot>0){ if($sb!="") $db->field("@TN_".$pelid." := ((".$sb.")/ ".$tbobot.") as TNILAI_".$pelid); else $db->field("@TN_".$pelid." := 0 as TNILAI_".$pelid); } else { $db->field("@TN_".$pelid." := 0 as TNILAI_".$pelid); } $db->field("IF( @TN_".$pelid." < ".$SKM.",0,1) as TLULUS_".$pelid); if($sna!="")$sna.=" + "; $sna.="@TN_".$pelid; $npeni++; } else { $phn[$pelid]=''; } } if($sna!="") $db->field("(".$sna.") as TNRAPOR"); else $db->field("0 as TNRAPOR"); if($npeni>0) $db->field("((".$sna.")/".$npeni.") as AVGRAPOR"); else $db->field("0 as AVGRAPOR"); $db->order("TNRAPOR DESC"); $s=$db->query(); $rank=array(); $rk=1; while($v=dbFA($s)){ $rank[$v['replid']]=$rk++; } return $rank[$siswa]; }
$PSBar->pass=false; } if(count($kelas)>0){ $PSBar->selection('Kelas',iSelect('ff2_kelas',$kelas,$kls,$PSBar->selws,$fmod."_get(1)")); } else { $PSBar->end(); hiddenval('ff2_kelas',$kls); kelas_warn(0); $PSBar->pass=false; } $PSBar->end(); if($PSBar->pass){ $xtable->search_box('nis atau nama siswa'); $db=siswa_db_bykelas($kls,$tingk); $db->where_and($xtable->search_sql_get()); $t=$db->query(); $xtable->ndata=mysql_num_rows($t); $t=$db->query($xtable->pageorder_sql('aka_siswa.nis','aka_siswa.nama')); if($xtable->ndata>0){ echo '<div style="width:100%;height:300px;max-height:300px;overflow:auto;float:left">'; $xtable->head('@nis','@nama','{44px}'); while($r=mysql_fetch_array($t)){$xtable->row_begin($r['replid']); $xtable->td($r['nis'],100); $xtable->td($r['nama']); if(admin_isoperator()) $s='<button class="btn" onclick="sirkulasi_peminjaman_form_member_set(1,'.$r['replid'].')">Pilih</button>~40px'; else $s='<div style="height:23px;width:40px"></div>';
} if ($PSBar->pass) { if (count($kelas) > 0) { $PSBar->selection('Kelas', iSelect('kelas', $kelas, $kls, $PSBar->selws, $fmod . "_get()")); } else { $PSBar->end(); hiddenval('kelas', $kls); hiddenval('penilaian', $peni); echo '<div class="warnbox" style="float:left">Tidak ada kelas yang diajar.</div>'; $PSBar->pass = false; } } $PSBar->end(); if ($PSBar->pass) { // Query $db = siswa_db_bykelas($kls); $SKM = pelajaran_skm($pel); $db->field("aka_komennilai:komen"); $db->join_cust("aka_komennilai ON aka_komennilai.siswa=aka_siswa.replid AND aka_komennilai.pelajaran='{$pel}'"); $t1 = dbQSql("SELECT * FROM aka_penilaian WHERE guru='{$gid}' AND pelajaran='{$pel}' AND kelas='{$kls}'"); $sk = ""; $tbobot = 0; $sb = ""; $rpemb = ""; $npemb = ""; $tnpemb = ""; $absama = 1; $lbobot = -1; while ($r1 = dbFA($t1)) { $db->field("@" . $r1['kode'] . " := IFNULL((SELECT aka_daftarnilai.nilai FROM aka_daftarnilai WHERE aka_daftarnilai.siswa=aka_siswa.replid AND aka_daftarnilai.penilaian='" . $r1['replid'] . "'),0) as T" . $r1['kode']); $db->field($r1['bobot'] . " as B" . $r1['kode']);
$gid = guru_pegawaiId(); $fmod = 'penilaian'; $xtable = new xtable($fmod); $dept = gpost('departemen'); $departemen = departemen_r($dept); if (count($departemen) > 0) { $tajar = gpost('tahunajaran'); $tahunajaran = tahunajaran_r($tajar, $dept); $ting = gpost('tingkat'); $tingkat = tingkat_r($ting, $dept); $kel = gpost('kelas'); $kelas = kelas_r($kel, $ting); $pel = gpost('pelajaran'); $pelajaran = pelajaran_r_pegawai($pel, $gid); // Query $db = siswa_db_bykelas($kel); $t = $db->query(); // echo "SELECT aka_guru.*,hrd_pegawai.nip,hrd_pegawai.nama FROM aka_guru LEFT JOIN hrd_pegawai ON aka_guru.pegawai=hrd_pegawai.replid WHERE aka_guru.pelajaran='$pel' ORDER BY hrd_pegawai.nama"; $xtable->ndata = mysql_num_rows($t); // Page Selection Bar $PSBar = new PSBar_2(); $PSBar->begin(); $PSBar->selection_departemen($fmod, $dept); if (count($tahunajaran) > 0) { $PSBar->selection('Tahun ajaran', iSelect('tahunajaran', $tahunajaran, $tajar, $PSBar->selws, $fmod . "_get()")); } else { $PSBar->end(); hiddenval('tahunajaran', $tajar); hiddenval('tingkat', $ting); hiddenval('kelas', $kls); hiddenval('pelajaran', $pel);
tingkat_warn(1); $PSBar->pass = false; } } if ($PSBar->pass) { if (count($kelas) > 0) { $PSBar->selection('Kelas', iSelect('pskelas', $kelas, $kls, $PSBar->selws, $fmod . '_get()')); } else { $PSBar->end(); hiddenval('pskelas', $kls); kelas_warn(1); $PSBar->pass = false; } } $PSBar->end(); $db = siswa_db_bykelas($kls, $ting, "tgllahir"); $db->where_and($xtable->search_sql_get()); $t = $db->query(); $xtable->ndata = mysql_num_rows($t); $xtable->search_box(); $xtable->search_info('data siswa dengan {keyon} "<b>{keyw}</b>"' . ($kls == 0 ? '' : 'pada kelas ' . $kelas[$kls]) . '.'); if ($xtable->ndata > 0) { $xtable->head('NIS', 'Nama'); while ($r = mysql_fetch_array($t)) { $xtable->row_begin(); $xtable->td($r['nis'], 120); $xtable->td($r['nama']); if (admin_isoperator()) { $s = '<button class="btn" title="Lihat detil" onclick="pendataan_saudara_detil(\'' . $r['replid'] . '\')"><div class="bi_srcb"> </div></button> <button class="btn" onclick="pendataan_saudara_set(\'' . $r['nama'] . '\',\'' . $r['ndepartemen'] . '\',\'' . $r['tgllahir'] . '\')">Pilih</button>~72px'; } else { $s = '<div style="height:23px;width:40px"></div>';
$PSBar->pass = false; } } $PSBar->end(); // view if ($PSBar->pass) { if ($opt == 'af' || $opt == 'uf') { //form :: add n edit require_once VWDIR . 'siswa_form.php'; } else { // tabel :: view $xtable = new xtable($fmod, 'siswa'); $xtable->search_keyon('nis=>aka_siswa.nis:EQ', 'nama=>aka_siswa.nama:LIKE'); $xtable->docname = "Data Siswa Kelas " . kelas_name($kls) . " T.A. " . tahunajaran_name($tajar); $xtable->printparams = array('kelas' => kelas_name($kls), 'tahunajaran' => tahunajaran_name($tajar)); $db = siswa_db_bykelas($kls, $ting, "nisn,tmplahir,tgllahir"); $db->where_and($xtable->search_sql_get()); $t = $xtable->use_db($db, $xtable->pageorder_sql('nis', 'nisn', 'nama')); $xtable->btnbar_f('add', 'print', 'srcbox'); if ($xtable->ndata > 0) { $xtable->head('@!NIS', '@!NISN', '@nama', 'Tempat Tanggal lahir'); while ($r = mysql_fetch_array($t)) { $xtable->row_begin(); $xtable->td($r['nis'], 80); $xtable->td($r['nisn'], 200); $xtable->td($r['nama']); $xtable->td($r['tmplahir'] . ', ' . fftgl($r['tgllahir']), 100); $s = '<button class="btn" title="Keluarkan siswa dari kelas ini." onclick="siswa_pendataan_kelas_form(\'df\',\'' . $r['replid'] . '\')"><div class="bi_canb"> </div></button>'; $xtable->opt($r['replid'], 'v', $s); $xtable->row_end(); }