function ProsesSekarang()
{
    $s = "select *\r\n    from _mhswlulus\r\n    where Sudah=0";
    $r = _query($s);
    echo "<ol>";
    while ($w = _fetch_array($r)) {
        $ada = GetFields("ta", "MhswID", $w['NIMHSMSMHS'], '*');
        if (empty($ada)) {
            $mhsw = GetFields('mhsw', "MhswID", $w['NIMHSMSMHS'], '*');
            // 1. Tambahkan data di tabel TA
            $s1 = "insert into ta (MhswID, Judul, StatusLulusID, NA)\r\n        values ('{$w['NIMHSMSMHS']}', '{$w['JUDU1MSMHS']} {$w['JUDU2MSMHS']} {$w['JUDU3MSMHS']} {$w['JUDU4MSMHS']} {$w['JUDU5MSMHS']}', '{$w['STLLSMSMHS']}', 'N')";
            $r1 = _query($s1);
            $TAID = GetLastID();
            // 2. Update tabel mhsw (masukkan ID TA di tabel MHSW, update data kelulusan, dll
            $TanggalLahir = FormatTglDB($w['TGLHRMSMHS']);
            $TglSKKeluar = FormatTglDB($w['TGLLSMSMHS']);
            $TglSKMasuk = FormatTglDB($w['TGLREMSMHS']);
            $TglIjazah = FormatTglDB($w['TGIJSMSMHS']);
            $s2 = "update mhsw set TAID={$TAID}, \r\n        TempatLahir='{$w['TPLHRMSMHS']}',\r\n        TanggalLahir='{$TanggalLahir}',\r\n        Alamat='{$w['ALJA1MSMHS']} {$w['ALJA2MSMHS']}',\r\n        Kota='{$w['KOJAKMSMHS']}',\r\n        KodePos='{$w['KPJAKMSMHS']}',\r\n        Telepon='{$w['TELJAMSMHS']}', Telephone='{$w['TELJAMSMHS']}',\r\n        Agama='{$w['KDAGMMSMHS']}', WargaNegara='{$w['KDWNGMSMHS']}',\r\n        TglSKKeluar='{$TglSKKeluar}',\r\n        NoIdentitas='{$w['NILUNMSMHS']}',\r\n        NoProdi='{$w['NILJRMSMHS']}',\r\n        IPK='{$w['NLIPKMSMHS']}',\r\n        TotalSKS='{$w['SKSTTMSMHS']}',\r\n        TahunLulus='{$w['LTSMAMSMHS']}',\r\n        IjazahSekolah='{$w['NOIJAMSMHS']}',\r\n        SKMasuk='{$w['NOSKRMSMHS']}',\r\n        TglSKMasuk='{$TglSKMasuk}',\r\n        AsalSekolah='{$w['KDSMAMSMHS']}',\r\n        JurusanSekolah='{$w['KJSMAMSMHS']}',\r\n        NoIjazah='{$w['NOIJSMSMHS']}',\r\n        TglIjazah='{$TglIjazah}'\r\n        where MhswID='{$w['NIMHSMSMHS']}' ";
            $r2 = _query($s2);
            $str = "<font color=red>Dibuat</font><ol><li>{$s1}</li><li>{$s2}</li></ol>";
            // Set flag
            $s3 = "update _mhswlulus set Sudah=1 where NIMHSMSMHS='{$w['NIMHSMSMHS']}' ";
            $r3 = _query($s3);
        } else {
            $str = "<font color=gray>Sudah ada</font>";
        }
        echo "<li>{$w['NIMHSMSMHS']} &raquo; {$str}\r\n    </li>";
    }
    echo "</ol>";
}
Example #2
0
function KurSav()
{
    $md = $_REQUEST['md'] + 0;
    $KurikulumID = $_REQUEST['KurikulumID'];
    $KurikulumKode = $_REQUEST['KurikulumKode'];
    $Nama = sqling($_REQUEST['Nama']);
    $Sesi = sqling($_REQUEST['Sesi']);
    $JmlSesi = $_REQUEST['JmlSesi'] + 0;
    $NA = empty($_REQUEST['NA']) ? 'N' : $_REQUEST['NA'];
    // simpan
    if ($md == 0) {
        $s = "update kurikulum set KurikulumKode='{$KurikulumKode}',\r\n      Nama='{$Nama}', Sesi='{$Sesi}', JmlSesi='{$JmlSesi}', NA='{$NA}', TglEdit=now(), LoginEdit='{$_SESSION['_Login']}'\r\n      where KurikulumID='{$_REQUEST['KurikulumID']}' ";
        $r = _query($s);
        // update jika jadi aktif
    } else {
        $s = "insert into kurikulum (KurikulumKode, KodeID, ProdiID, Nama, Sesi, JmlSesi, NA, TglBuat, LoginBuat)\r\n      values('{$KurikulumKode}', '{$_REQUEST['KodeID']}', '{$_SESSION['prodi']}', '{$Nama}', '{$Sesi}', '{$JmlSesi}', '{$NA}', now(), '{$_SESSION['_Login']}')";
        $r = _query($s);
        $KurikulumID = GetLastID();
    }
    // Non aktifkan yg lain
    /* ~~~ 03/11/2008 --> supaya bisa banyak kurikulum aktif
      if ($NA == 'N') {
        $s1 = "update kurikulum set NA='Y'
          where ProdiID='$_SESSION[prodi]' and KurikulumID<>$KurikulumID";
        $r1 = _query($s1);
      }
      */
    BerhasilSimpan("?mnux={$_SESSION['mnux']}", 100);
}
function KurSav()
{
    $md = $_REQUEST['md'] + 0;
    $KurikulumID = $_REQUEST['KurikulumID'];
    $KurikulumKode = $_REQUEST['KurikulumKode'];
    $Nama = sqling($_REQUEST['Nama']);
    $Sesi = sqling($_REQUEST['Sesi']);
    $JmlSesi = $_REQUEST['JmlSesi'] + 0;
    $NA = empty($_REQUEST['NA']) ? 'N' : $_REQUEST['NA'];
    // simpan
    if ($md == 0) {
        $s = "update kurikulum set KurikulumKode='{$KurikulumKode}',\r\n      Nama='{$Nama}', Sesi='{$Sesi}', JmlSesi='{$JmlSesi}', NA='{$NA}', TglEdit=now(), LoginEdit='{$_SESSION['_Login']}'\r\n      where KurikulumID='{$_REQUEST['KurikulumID']}' ";
        $r = _query($s);
        // update jika jadi aktif
    } else {
        $s = "insert into kurikulum (KurikulumKode, KodeID, ProdiID, Nama, Sesi, JmlSesi, NA, TglBuat, LoginBuat)\r\n      values('{$KurikulumKode}', '{$_REQUEST['KodeID']}', '{$_SESSION['prodi']}', '{$Nama}', '{$Sesi}', '{$JmlSesi}', '{$NA}', now(), '{$_SESSION['_Login']}')";
        $r = _query($s);
        $KurikulumID = GetLastID();
    }
    // Non aktifkan yg lain
    if ($NA == 'N') {
        $s1 = "update kurikulum set NA='Y'\r\n      where ProdiID='{$_SESSION['prodi']}' and KurikulumID<>{$KurikulumID}";
        $r1 = _query($s1);
    }
    DefKur();
}
function prckhs()
{
    $prodi = $_SESSION['prodi'];
    $_SESSION['PRC-POS-' . $prodi]++;
    $pos = $_SESSION['PRC-POS-' . $prodi];
    $max = $_SESSION['PRC-Max-' . $prodi];
    $MhswID = $_SESSION['PRC-MhswID-' . $prodi . $pos];
    $ProgramID = $_SESSION['PRC-ProgramID-' . $prodi . $pos];
    $ProdiID = $_SESSION['PRC-ProdiID-' . $prodi . $pos];
    $persen = $max == 0 ? 0 : number_format($pos / $max * 100);
    if (!empty($MhswID)) {
        echo "<p>Processing: <b>{$MhswID}</b></p>\r\n    <p>Position: <b>{$pos}/{$max}</b> &raquo; <font size=+2>{$persen} %</font></p>";
        // Buat KHS
        $s = "select TahunID, sum(SKS) as TotalSKS, count(*) as JumlahMK \r\n      from krs \r\n      where MhswID='{$MhswID}' and StatusKRSID='A'\r\n      group by TahunID";
        $r = _query($s);
        $n = 0;
        while ($w = _fetch_array($r)) {
            $n++;
            $ada = GetaField('khs', "MhswID='{$MhswID}' and TahunID", $w['TahunID'], "KHSID");
            $TotalSKS = $w['TotalSKS'] + 0;
            $JumlahMK = $w['JumlahMK'] + 0;
            $StatusMhswID = $JumlahMK > 0 ? 'A' : 'P';
            if (empty($ada)) {
                $s0 = "insert into khs\r\n          (TahunID, KodeID, ProgramID, ProdiID, MhswID, Sesi,\r\n          StatusMhswID, JumlahMK, TotalSKS,\r\n          LoginBuat, TanggalBuat)\r\n          values\r\n          ('{$w['TahunID']}', 'UKRIDA', '{$ProgramID}', '{$ProdiID}', '{$MhswID}', {$n},\r\n          '{$StatusMhswID}', {$JumlahMK}, {$TotalSKS},\r\n          'BATCH PROCESSING', now())";
                $r0 = _query($s0);
                $ada['KHSID'] = GetLastID();
                $str = "<font size=+1>DIBUAT <font size=+1>{$n}</font></font>";
            } else {
                $s0 = "update khs set Sesi={$n}, StatusMhswID='{$StatusMhswID}' where KHSID={$ada}";
                $r0 = _query($s0);
                $str = "<font color=red>Updated <font size=+1>{$n}</font></font>";
            }
            // Perbaiki KRS
            $skrs = "update krs set KHSID={$ada['KHSID']} where MhswID='{$MhswID}' and TahunID='{$w['TahunID']}' and KHSID=0";
            $rkrs = _query($skrs);
            $jkrs = _affected_rows($rkrs);
            echo "{$w['TahunID']} &raquo; {$str} &raquo; {$jkrs}<br />";
            // Jika Semester 1, maka buat data keuangan dummy:
            //if ($n == 1) BuatKeuDummy($MhswID, $w['TahunID']);
        }
    }
    if ($pos < $max) {
        echo "<script type='text/javascript'>window.onload=setTimeout('window.location.reload()', 2);</script>";
    } else {
        echo "<hr><p>Proses Selesai</p>";
    }
    $_SESSION['ADPOS']++;
}
Example #5
0
function wPeriodeSav()
{
    $md = $_REQUEST['md'] + 0;
    $WisudaID = $_REQUEST['WisudaID'];
    $Nama = sqling($_REQUEST['Nama']);
    $TM = "{$_REQUEST['TM_y']}-{$_REQUEST['TM_m']}-{$_REQUEST['TM_d']}";
    $TS = "{$_REQUEST['TS_y']}-{$_REQUEST['TS_m']}-{$_REQUEST['TS_d']}";
    $TW = "{$_REQUEST['TW_y']}-{$_REQUEST['TW_m']}-{$_REQUEST['TW_d']}";
    $na = empty($_REQUEST['NA']) ? 'N' : $_REQUEST['NA'];
    // Simpan
    if ($md == 0) {
        $s = "update wisuda set Nama='{$Nama}', TglMulai='{$TM}', TglSelesai='{$TS}', \r\n      TglWisuda='{$TW}', NA='{$na}'\r\n      where WisudaID='{$WisudaID}'";
        $r = _query($s);
    } else {
        $s = "insert into wisuda (KodeID, Nama, TglMulai, TglSelesai, TglWisuda, NA)\r\n      values ('{$_SESSION['KodeID']}', '{$Nama}', '{$TM}', '{$TS}', '{$TW}', '{$na}') ";
        $r = _query($s);
        $WisudaID = GetLastID();
    }
    if ($na == 'N') {
        $sn = "update wisuda set NA='Y' where WisudaID<>{$WisudaID} and NA='N' ";
        $rn = _query($sn);
    }
    wPeriodeDftr();
}
function fnSimpan($KRSID, $MhswID)
{
    $TahunID = sqling($_REQUEST['TahunID']);
    $MKID = $_REQUEST['MKID'] + 0;
    $SKS = $_REQUEST['SKS'] + 0;
    $NilaiID = $_REQUEST['NilaiID'];
    $nilai = GetFields('nilai', 'NilaiID', $NilaiID, '*');
    $KRSID = $_REQUEST['KRSID'];
    $oldkrs = GetFields('krs', 'KRSID', $KRSID, '*');
    $mhsw = GetFields('mhsw', "MhswID='{$MhswID}' and KodeID", KodeID, "*");
    $mk = GetFields('mk', 'MKID', $MKID, '*');
    // Ambil KHS
    $khs = GetFields('khs', "MhswID='{$MhswID}' and TahunID='{$TahunID}' and KodeID", KodeID, '*');
    if (empty($khs)) {
        $sesi = GetaField('khs', "MhswID='{$MhswID}' and KodeID", KodeID, "max(Sesi)");
        $sesi += 1;
        $s = "insert into khs\r\n      (TahunID, KodeID, \r\n      ProgramID, ProdiID, MhswID,\r\n      StatusMhswID, Sesi,\r\n      LoginBuat, TanggalBuat)\r\n      values\r\n      ('{$TahunID}', '" . KodeID . "',\r\n      '{$mhsw['ProgramID']}', '{$mhsw['ProdiID']}', '{$MhswID}',\r\n      'A', {$sesi},\r\n      '{$_SESSION['_Login']}', now())";
        $r = _query($s);
        $KHSID = GetLastID();
    } else {
        $KHSID = $khs['KHSID'];
    }
    // Insert di KRS
    $s = "insert into krs\r\n    (KodeID, KHSID, MhswID, TahunID,\r\n    MKID, MKKode, Nama, SKS,\r\n    GradeNilai, BobotNilai, StatusKRSID,\r\n    Setara, SetaraKode, SetaraGrade, SetaraNama,\r\n    LoginBuat, TanggalBuat)\r\n    values\r\n    ('" . KodeID . "', {$KHSID}, '{$MhswID}', '{$TahunID}',\r\n    {$MKID}, '{$mk['MKKode']}', '{$mk['Nama']}', {$SKS},\r\n    '{$nilai['Nama']}', '{$nilai['Bobot']}', 'A',\r\n    'Y', '{$oldkrs['MKKode']}', '{$oldkrs['GradeNilai']}', '{$oldkrs['Nama']}',\r\n    '{$_SESSION['_Login']}', now())";
    $r = _query($s);
    // Non-aktifkan yg lama
    $s1 = "update krs\r\n     set StatusKRSID = 'K'\r\n     where KRSID='{$KRSID}' ";
    $r1 = _query($s1);
    // Kembalikan
    echo <<<ESD
   <script>
   opener.RefreshParent();
   window.close();
   </script>
ESD;
}
function CekKHS($mhsw, $m, $thn)
{
    $ada = GetaField('khs', "MhswID='{$mhsw}' and TahunID='{$thn}' and KodeID", KodeID, 'KHSID') + 0;
    if ($ada == 0) {
        $Sesi = GetaField('khs', "MhswID='{$mhsw}' and TahunID<'{$thn}' and KodeID", KodeID, "Sesi") + 1;
        $s = "insert into khs (TahunID, KodeID, ProgramID, ProdiID, MhswID, StatusMhswID, Sesi, LoginBuat, TanggalBuat)\r\n      values ('{$thn}', '" . KodeID . "', '{$m['ProgramID']}', '{$m['ProdiID']}', '{$mhsw}', 'A', '{$Sesi}', '{$_SESSION['_Login']}', now())";
        $r = _query($s);
        $ada = GetLastID();
    }
    return $ada;
}
function TambahkanBeasiswaMahasiswa()
{
    $MhswID = $_REQUEST['beaMhswID'];
    $mhsw = GetFields("mhsw m\r\n    left outer join program prg on m.ProgramID=prg.ProgramID\r\n    left outer join prodi prd on m.ProdiID=prd.ProdiID\r\n    left outer join bipot bpt on m.BIPOTID=bpt.BIPOTID", 'm.MhswID', $MhswID, "m.*, prg.Nama as PRG, prd.Nama as PRD, bpt.Nama as BPT");
    $sdh = GetFields('beasiswamhsw', "TahunID='{$_SESSION['tahun']}' and MhswID", $MhswID, "BeasiswaMhswID, BeasiswaID");
    // Apakah sudah terdaftar?
    $beas = GetFields('beasiswa', "BeasiswaID", $_SESSION['BeasiswaID'], "*");
    if (!empty($sdh)) {
        echo ErrorMsg("Tidak Dapat Ditambahkan", "Mahasiswa <b>{$mhsw['Nama']} ({$MhswID})</b> tidak dapat ditambahkan karena sudah terdaftar di beasiswa:\r\n      <font size=+1>{$beas['Nama']}</font>.\r\n      <hr size=1 color=silver>\r\n      Pilihan: <input type=submit name='Kembali' value='Kembali' onClick=\"location='?mnux=beasiswa'\">");
    } else {
        // Apakah IPS sudah memenuhi?
        $s_khs = "select * from khs where MhswID='{$mhsw['MhswID']}' and TahunID < '{$_SESSION['tahun']}' order by TahunID desc limit 1";
        $r_khs = _query($s_khs);
        $w_khs = _fetch_array($r_khs);
        if ($w_khs['IPS'] >= $beas['IPSMin']) {
            $AccountHutangSmtLalu = 30;
            $Htg = GetaField("bipotmhsw", "BIPOTNamaID={$AccountHutangSmtLalu} and MhswID='{$MhswID}' and TahunID", $_SESSION['tahun'], "sum(Jumlah * Besar)") + 0;
            $s = "insert into beasiswamhsw (TahunID, KodeID, BeasiswaID, IPS, IPK, Hutang, MhswID, Besar, LoginBuat, TanggalBuat)\r\n        values ('{$_SESSION['tahun']}', '{$_SESSION['KodeID']}', '{$_SESSION['BeasiswaID']}', '{$w_khs['IPS']}', '{$mhsw['IPK']}', {$Htg}, '{$MhswID}', 0, '{$_SESSION['_Login']}', now())";
            $r = _query($s);
            //DftrBea();
            $_REQUEST['beaBMID'] = GetLastID();
            EditDetailBeasiswaMhsw();
        } else {
            echo ErrorMsg("Tidak Dapat Ditambahkan", "Mahasiswa <b>{$mhsw['Nama']} ({$MhswID})</b> tidak dapat ditambahkan karena IPS hanya <b>{$w_khs['IPS']}</b>, <br />\r\n      Sedangkan beasiswa <b>{$beas['Nama']}</b> mensyaratkan IPS minimal: <b>{$beas['IPSMin']}</b>\r\n      <hr size=1 color=silver>\r\n      Pilihan: <input type=submit name='Kembali' value='Kembali' onClick=\"location='?mnux=beasiswa'\">");
        }
    }
}
Example #9
0
function SaveAll($MhswID, $mhsw)
{
    /*$si = "select k.*
        from krs k
          left outer join khs h on h.KHSID = k.KHSID and h.KodeID = '".KodeID."'
        where k.MhswID = '$MhswID'
        order by k.TahunID, k.MKKode";
    	$ri = _query($si); 
    	$ni = _num_rows($ri);
    	
    	while($wi=_fetch_array($ri))
    	{	$tempNum = substr($wi[MKKode],6,1);
    		
    		if($tempNum==1)	$theYear = $InputTahun1.$tempNum;
    		else if($tempNum==2) $theYear = $InputTahun1.$tempNum;
    		else if($tempNum==3) $theYear = ($InputTahun1+1).($tempNum-2);
    		else if($tempNum==4) $theYear = ($InputTahun1+1).($tempNum-2);
    		else if($tempNum==5) $theYear = ($InputTahun1+2).($tempNum-4);
    		else if($tempNum==6) $theYear = ($InputTahun1+2).($tempNum-4);
    		else if($tempNum==7) $theYear = ($InputTahun1+3).($tempNum-6);
    		else if($tempNum==8) $theYear = ($InputTahun1+3).($tempNum-6);
    		else $theYear = '';
    		
    		//echo "$wi[MKKode]: $theYear<br>";
    		
    		$ss = "update `krs` set 
    					TahunID='$theYear', 
    					Setara = 'Y',
    					SetaraKode = 'a',
    					SetaraNama = 'a',
    					SetaraGrade = 'a',
    					Sah = 'Y',
    					Final = 'Y',
    					LoginEdit = '$_SESSION[_Login]',
    					TanggalEdit = now()  
    				where KRSID = '$wi[KRSID]'";
    		$rr = _query($ss);
    	}*/
    $Siska = array($_REQUEST['Select1'], $_REQUEST['Select2'], $_REQUEST['Select3'], $_REQUEST['Select4'], $_REQUEST['Select5'], $_REQUEST['Select6'], $_REQUEST['Select7'], $_REQUEST['Select8'], $_REQUEST['Select9'], $_REQUEST['Select10'], $_REQUEST['Select11'], $_REQUEST['Select12'], $_REQUEST['Select13'], $_REQUEST['Select14'], $_REQUEST['Select15'], $_REQUEST['Select16'], $_REQUEST['Select17'], $_REQUEST['Select18'], $_REQUEST['Select19'], $_REQUEST['Select20'], $_REQUEST['Select21'], $_REQUEST['Select22'], $_REQUEST['Select23'], $_REQUEST['Select24'], $_REQUEST['Select25'], $_REQUEST['Select26'], $_REQUEST['Select27'], $_REQUEST['Select28'], $_REQUEST['Select29'], $_REQUEST['Select30'], $_REQUEST['Select31'], $_REQUEST['Select32'], $_REQUEST['Select33'], $_REQUEST['Select34'], $_REQUEST['Select35'], $_REQUEST['Select36'], $_REQUEST['Select37'], $_REQUEST['Select38'], $_REQUEST['Select39'], $_REQUEST['Select40'], $_REQUEST['Select41'], $_REQUEST['Select42'], $_REQUEST['Select43'], $_REQUEST['Select44'], $_REQUEST['Select45'], $_REQUEST['Select46'], $_REQUEST['Select47'], $_REQUEST['Select48'], $_REQUEST['Select49'], $_REQUEST['Select50'], $_REQUEST['Select51'], $_REQUEST['Select52'], $_REQUEST['Select53'], $_REQUEST['Select54'], $_REQUEST['Select55'], $_REQUEST['Select56'], $_REQUEST['Select57'], $_REQUEST['Select58'], $_REQUEST['Select59'], $_REQUEST['Select60'], $_REQUEST['Select61'], $_REQUEST['Select62'], $_REQUEST['Select63'], $_REQUEST['Select64'], $_REQUEST['Select65'], $_REQUEST['Select66'], $_REQUEST['Select67'], $_REQUEST['Select68'], $_REQUEST['Select69'], $_REQUEST['Select70']);
    $Siska2 = array($_REQUEST['Hidden1'], $_REQUEST['Hidden2'], $_REQUEST['Hidden3'], $_REQUEST['Hidden4'], $_REQUEST['Hidden5'], $_REQUEST['Hidden6'], $_REQUEST['Hidden7'], $_REQUEST['Hidden8'], $_REQUEST['Hidden9'], $_REQUEST['Hidden10'], $_REQUEST['Hidden11'], $_REQUEST['Hidden12'], $_REQUEST['Hidden13'], $_REQUEST['Hidden14'], $_REQUEST['Hidden15'], $_REQUEST['Hidden16'], $_REQUEST['Hidden17'], $_REQUEST['Hidden18'], $_REQUEST['Hidden19'], $_REQUEST['Hidden20'], $_REQUEST['Hidden21'], $_REQUEST['Hidden22'], $_REQUEST['Hidden23'], $_REQUEST['Hidden24'], $_REQUEST['Hidden25'], $_REQUEST['Hidden26'], $_REQUEST['Hidden27'], $_REQUEST['Hidden28'], $_REQUEST['Hidden29'], $_REQUEST['Hidden30'], $_REQUEST['Hidden31'], $_REQUEST['Hidden32'], $_REQUEST['Hidden33'], $_REQUEST['Hidden34'], $_REQUEST['Hidden35'], $_REQUEST['Hidden36'], $_REQUEST['Hidden37'], $_REQUEST['Hidden38'], $_REQUEST['Hidden39'], $_REQUEST['Hidden40'], $_REQUEST['Hidden41'], $_REQUEST['Hidden42'], $_REQUEST['Hidden43'], $_REQUEST['Hidden44'], $_REQUEST['Hidden45'], $_REQUEST['Hidden46'], $_REQUEST['Hidden47'], $_REQUEST['Hidden48'], $_REQUEST['Hidden49'], $_REQUEST['Hidden50'], $_REQUEST['Hidden51'], $_REQUEST['Hidden52'], $_REQUEST['Hidden53'], $_REQUEST['Hidden54'], $_REQUEST['Hidden55'], $_REQUEST['Hidden56'], $_REQUEST['Hidden57'], $_REQUEST['Hidden58'], $_REQUEST['Hidden59'], $_REQUEST['Hidden60'], $_REQUEST['Hidden61'], $_REQUEST['Hidden62'], $_REQUEST['Hidden63'], $_REQUEST['Hidden64'], $_REQUEST['Hidden65'], $_REQUEST['Hidden66'], $_REQUEST['Hidden67'], $_REQUEST['Hidden68'], $_REQUEST['Hidden69'], $_REQUEST['Hidden70']);
    $x = 0;
    while (!empty($Siska[$x])) {
        //echo "Select: $Siska[$x], KRSID: $Siska2[$x]<br>";
        /*$ss = "update `krs` set 
        		TahunID='$Siska[$x]', 
        		Setara ='Y', 
        		SetaraKode = 'a',
        		SetaraNama = 'a',
        		SetaraGrade = 'a',
        		Sah = 'Y',
        		Final = 'Y',
        		LoginEdit = '$_SESSION[_Login]',
        		TanggalEdit = now()  
        		where KRSID='$Siska2[$x]'";*/
        // cek khs
        $adakhs = GetaField('khs', "MhswID='{$MhswID}' and TahunID='{$Siska[$x]}' and KodeID", KodeID, 'KHSID') + 0;
        if ($adakhs == 0) {
            // create new TahunID
            $Sesi = GetaField('khs', "MhswID='{$MhswID}' and TahunID < '{$Siska[$x]}' and KodeID", KodeID, "Sesi") + 1;
            $s = "insert into khs\r\n        (TahunID, KodeID, ProgramID, \r\n        ProdiID, MhswID, StatusMhswID,\r\n        Sesi, LoginBuat, TanggalBuat)\r\n        values\r\n        ('{$Siska[$x]}', '" . KodeID . "', '{$mhsw['ProgramID']}',\r\n        '{$mhsw['ProdiID']}', '{$MhswID}', 'A',\r\n        '{$Sesi}', '{$_SESSION['_Login']}', now())";
            $r = _query($s);
            $adakhs = GetLastID();
        }
        // update krs
        $ss = "update `krs` set TahunID='{$Siska[$x]}', KHSID='{$adakhs}' where KRSID='{$Siska2[$x]}'";
        $rr = _query($ss);
        $x++;
    }
    UrutSesi($MhswID, $mhsw);
    BerhasilSimpan("?mnux={$_SESSION['mnux']}", 1000);
}
Example #10
0
function Simpan()
{
    $md = $_REQUEST['md'] + 0;
    $id = $_REQUEST['id'] + 0;
    $TahunID = sqling($_REQUEST['TahunID']);
    $Nama = sqling($_REQUEST['Nama']);
    $TglMulai = "{$_REQUEST['TglMulai_y']}-{$_REQUEST['TglMulai_m']}-{$_REQUEST['TglMulai_d']}";
    $TglSelesai = "{$_REQUEST['TglSelesai_y']}-{$_REQUEST['TglSelesai_m']}-{$_REQUEST['TglSelesai_d']}";
    $TglWisuda = "{$_REQUEST['TglWisuda_y']}-{$_REQUEST['TglWisuda_m']}-{$_REQUEST['TglWisuda_d']}";
    $NA = empty($_REQUEST['NA']) ? 'N' : $_REQUEST['NA'];
    if ($md == 0) {
        $sdh = GetFields('wisuda', "KodeID='" . KodeID . "' and WisudaID <> {$id} and TahunID", $TahunID, '*');
        if (empty($sdh)) {
            $s = "update wisuda\r\n        set TahunID = '{$TahunID}',\r\n            Nama = '{$Nama}',\r\n            TglMulai = '{$TglMulai}',\r\n            TglSelesai = '{$TglSelesai}',\r\n            TglWisuda = '{$TglWisuda}',\r\n            LoginEdit = '{$_SESSION['_Login']}',\r\n            TglEdit = now()\r\n        where WisudaID = '{$id}' ";
            $r = _query($s);
            if ($NA == 'N') {
                Hanya($id);
            }
            TutupScript();
        } else {
            die(ErrorMsg('Error', "Anda tidak boleh mengganti kode Tahun dengan <b>{$TahunID}</b> karena sudah dipakai.<br />\r\n      Gunakan kode Tahun yang lain.\r\n      <hr size=1 color=silver />\r\n      <input type=button name='Tutup' value='Tutup' onClick='window.close()' />"));
        }
    } elseif ($md == 1) {
        $sdh = GetFields('wisuda', "KodeID='" . KodeID . "' and TahunID", $TahunID, '*');
        if (empty($sdh)) {
            $s = "insert into wisuda\r\n        (KodeID, TahunID, Nama,\r\n        TglMulai, TglSelesai, TglWisuda, Jumlah,\r\n        LoginBuat, TglBuat, NA)\r\n        values\r\n        ('" . KodeID . "', '{$TahunID}', '{$Nama}',\r\n        '{$TglMulai}', '{$TglSelesai}', '{$TglWisuda}', 0,\r\n        '{$_SESSION['_LoginBuat']}', now(), '{$NA}')";
            $r = _query($s);
            $id = GetLastID();
            if ($NA == 'N') {
                Hanya($id);
            }
            TutupScript();
        } else {
            die(ErrorMsg('Error', "Kode tahun <b>{$TahunID}</b> sudah dipakai.<br />\r\n      Anda tidak boleh menggunakan kode ini lagi.<br />\r\n      Hubungi Sysadmin untuk informasi lebih lanjut.\r\n      <hr size=1 color=silver />\r\n      <input type=button name='Tutup' value='Tutup' onClick='window.close()' />"));
        }
    } else {
        die(ErrorMsg('Error', "Mode edit <b>{$md}</b> tidak dikenali.<br />\r\n    Hubungi Sysadmin untuk informasi lebih lanjut.\r\n    <hr size=1 color=silver />\r\n    <input type=button name='Tutup' value='Tutup' onClick='window.close()' />"));
    }
}
Example #11
0
function SimpanRemedial($md, $jid, $pid)
{
    $Pertemuan = $_REQUEST['Pertemuan'] + 0;
    $Tanggal = "{$_REQUEST['Tanggal']}";
    $DosenID = $_REQUEST['DosenID'];
    $w['JamMulai'] = "{$_REQUEST['JamMulai_h']}:{$_REQUEST['JamMulai_n']}";
    $w['JamSelesai'] = "{$_REQUEST['JamSelesai_h']}:{$_REQUEST['JamSelesai_n']}";
    $Catatan = sqling($_REQUEST['Catatan']);
    // Simpan
    if ($md == 0) {
        $s = "update presensi\r\n      set Pertemuan = '{$Pertemuan}',\r\n          Tanggal = '{$Tanggal}',\r\n          JamMulai = '{$JamMulai}', JamSelesai = '{$JamSelesai}',\r\n          Catatan = '{$Catatan}',\r\n          LoginEdit = '{$_SESSION['_Login']}', TanggalEdit = now()\r\n      where PresensiID = '{$pid}' ";
        $r = _query($s);
        HitungPresensi($jid);
        TutupScript($jid);
    } elseif ($md == 1) {
        $jdwl = GetFields('jadwalremedial', 'JadwalRemedialID', $jid, '*');
        $s = "insert into presensi\r\n      (TahunID, JadwalRemedialID, Pertemuan, DosenID,\r\n      Tanggal, JamMulai, JamSelesai, Catatan,\r\n      LoginBuat, TanggalBuat)\r\n      values\r\n      ('{$jdwl['TahunID']}', {$jid}, {$Pertemuan}, '{$DosenID}',\r\n      '{$Tanggal}', '{$JamMulai}', '{$JamSelesai}', '{$Catatan}',\r\n      '{$_SESSION['_Login']}', now())";
        $r = _query($s);
        $pid = GetLastID();
        HitungPresensiRem($jid);
        TutupScriptRem($jid);
    } else {
        die(ErrorMsg('Error', "Ada kesalahan. Mode edit tidak dikenali."));
    }
}
Example #12
0
function fnSimpanHondok()
{
    $_honTahunID = sqling($_REQUEST['_honTahunID']);
    $_honTahun = sqling($_REQUEST['_honTahun']);
    $_honBulan = sqling($_REQUEST['_honBulan']);
    $_honDosenID = sqling($_REQUEST['_honDosenID']);
    $_honID = $_REQUEST['_honID'];
    $_honPajak = $_REQUEST['_honPajak'] + 0;
    $_honMinggu = $_REQUEST['_honMinggu'];
    $_honJml = $_REQUEST['_honJml'] + 0;
    $md = $_REQUEST['md'] + 0;
    $dsn = GetFields('dosen', "Login='******' and KodeID", KodeID, '*');
    // Simpan
    if ($md == 0) {
        $s = "update honordosen\r\n      set Pajak = '{$_honPajak}',\r\n          Minggu = '{$_honMinggu}'\r\n      where HonorDosenID = '{$_honID}' ";
        $r = _query($s);
    } elseif ($md == 1) {
        // Buat Header
        $s = "insert into honordosen\r\n      (TahunID, Minggu, Bulan, Tahun, Tanggal,\r\n      DosenID, ProdiID, Pajak,\r\n      LoginBuat, TanggalBuat)\r\n      values\r\n      ('{$_honTahunID}', '{$_honMinggu}', '{$_honBulan}', '{$_honTahun}', now(),\r\n      '{$_honDosenID}', '{$dsn['Homebase']}', {$_honPajak},\r\n      '{$_SESSION['_Login']}', now()) ";
        $r = _query($s);
        $_honID = GetLastID();
    } else {
        die(ErrorMsg('Error', "Terjadi kesalahan, mode edit: <b>{$md}</b> tidak dikenali.<br />\r\n    Hubungi Sysadmin untuk informasi lebih detail.\r\n    <hr size=1 color=silver />\r\n    <input type=button name='btnTutup' value='Tutup' onClick='window.close()' />"));
    }
    // Simpan detailnya
    $_honJml = $_REQUEST['_honJml'];
    for ($i = 1; $i <= $_honJml; $i++) {
        $_id = $_REQUEST['_hon_' . $i] + 0;
        $_SKS = $_REQUEST['_honSKS_' . $i] + 0;
        $_TunjanganSKS = $_REQUEST['_honTunjanganSKS_' . $i] + 0;
        $_TunjanganTransport = $_REQUEST['_honTunjanganTransport_' . $i] + 0;
        $_TunjanganTetap = $_REQUEST['_honTunjanganTetap_' . $i] + 0;
        // Tambahkan presensi ke honor dosen
        $s_add = "update presensi\r\n        set HonorDosenID = '{$_honID}',\r\n            SKSHonor = '{$_SKS}',\r\n            TunjanganSKS = '{$_TunjanganSKS}',\r\n            TunjanganTransport = '{$_TunjanganTransport}',\r\n            TunjanganTetap = '{$_TunjanganTetap}',\r\n            LoginEdit = '{$_SESSION['_Login']}', TanggalEdit = now()\r\n        where PresensiID = '{$_id}' ";
        $r_add = _query($s_add);
    }
    HitungUlangHondok($_honID);
    RefreshTutup();
}
Example #13
0
function TASav($mhsw)
{
    $md = $_REQUEST['md'] + 0;
    $TahunID = $_REQUEST['TahunID'];
    $TglMulai = "{$_REQUEST['TM_y']}-{$_REQUEST['TM_m']}-{$_REQUEST['TM_d']}";
    $TglSelesai = "{$_REQUEST['TS_y']}-{$_REQUEST['TS_m']}-{$_REQUEST['TS_d']}";
    $Judul = sqling($_REQUEST['Judul']);
    $Judul = strtoupper($Judul);
    $Keterangan = sqling($_REQUEST['Keterangan']);
    $Pembimbing = $_REQUEST['Pembimbing'];
    $NA = empty($_REQUEST['NA']) ? 'N' : $_REQUEST['NA'];
    // Simpan
    if ($md == 0) {
        $taid = $_REQUEST['taid'];
        $s = "update ta set TahunID='{$TahunID}', TglMulai='{$TglMulai}', TglSelesai='{$TglSelesai}',\n      Judul='{$Judul}', Keterangan='{$Keterangan}', Pembimbing='{$Pembimbing}', NA='{$NA}',\n      LoginEdit='{$_SESSION['_Login']}', TanggalEdit=now()\n      where TAID='{$taid}' ";
        $r = _query($s);
    } else {
        $s = "insert into ta (TahunID, TglDaftar, TglMulai, TglSelesai, MhswID,\n      Judul, Keterangan, Pembimbing, NA,\n      LoginBuat, TanggalBuat)\n      values ('{$TahunID}', now(), '{$TglMulai}', '{$TglSelesai}', '{$mhsw['MhswID']}',\n      '{$Judul}', '{$Keterangan}', '{$Pembimbing}', '{$NA}',\n      '{$_SESSION['_Login']}', now())";
        $r = _query($s);
        $taid = GetLastID();
    }
    // update yang lain menjadi tidak aktif
    if ($NA == 'N') {
        $s1 = "update ta set NA='Y' where MhswID='{$mhsw['MhswID']}' and TAID<>{$taid}";
        $r1 = _query($s1);
        // update data mshw
        $s2 = "update mhsw set TAID='{$taid}' where MhswID='{$mhsw['MhswID']}' ";
        $r2 = _query($s2);
    }
    DftrTA($mhsw);
}
Example #14
0
function KRSOK()
{
    $KRSID = $_REQUEST['KRSID'];
    $JadwalID = $_REQUEST['JadwalID'];
    if (!empty($_REQUEST['OKE'])) {
        $k = GetFields('krspra', 'KRSID', $KRSID, '*');
        // Update KRSPRA
        $s = "update krspra set OKE='Y' where KRSID='{$KRSID}' ";
        $r = _query($s);
        // insert KRS
        $s = "insert into krs (KHSID, MhswID, TahunID,\r\n      JadwalID, MKID, MKKode, SKS, HargaStandar, Harga,\r\n      LoginBuat, TanggalBuat)\r\n      values ('{$k['KHSID']}', '{$k['MhswID']}', '{$k['TahunID']}',\r\n      '{$k['JadwalID']}', '{$k['MKID']}', '{$k['MKKode']}', {$k['SKS']}, '{$k['HargaStandar']}', '{$k['Harga']}',\r\n      '{$_SESSION['_Login']}', now())";
        $r = _query($s);
        $KRS = GetLastID();
        // insert bipotmhsw
        $s1 = "insert into bipotmhsw (BIPOTMhswRef, PMBMhswID, MhswID, TahunID,\r\n      Nama, TrxID, Jumlah, Besar, Catatan,\r\n      LoginBuat, TanggalBuat)\r\n      values ({$KRS}, 1, '{$k['MhswID']}', '{$k['TahunID']}',\r\n      '{$k['MKKode']}', 1, 1, '{$k['Harga']}', 'KLINIK',\r\n      '{$_SESSION['_Login']}', now())";
        $r1 = _query($s1);
        // Jumlah mhsw
        $jml = GetaField('krs', "JadwalID", $JadwalID, "count(KRSID)") + 0;
        $sx = "update jadwal set JumlahMhsw={$jml} where JadwalID='{$JadwalID}' ";
        $rx = _query($sx);
        // Update jumlah mhsw
        UpdateJumlahMhsw($JadwalID);
    }
    PraKRS();
}
Example #15
0
function JalankanProses($_upJumlah, $_upProses)
{
    $arr = $_SESSION['_up_' . $_upProses];
    $dat = explode('|', $arr);
    // persentase
    $_sudah = $_upJumlah > 0 ? $_upProses / $_upJumlah * 100 : 0;
    $_sisa = 100 - $_sudah;
    // Parameter
    $BayarMhswID = 'BTN-' . $dat[23];
    $NamaTahun = $dat[0];
    $MhswID = $dat[3];
    $NamaMhsw = $dat[4];
    $ProdiID = $dat[6];
    $NamaProdi = $dat[7];
    $Angkatan = $dat[8];
    $RekeningID = "4201390002572";
    $Jumlah = $dat[10] + 0;
    $NamaBIPOT = $dat[11];
    $BuktiSetoran = $dat[23] . '|' . $dat[24];
    $Catatan = $dat[27];
    // Cek data mahasiswa
    $ketemu = false;
    $mhsw = GetFields('mhsw', "KodeID='" . KodeID . "' and MhswID", $MhswID, '*');
    if (!empty($mhsw)) {
        // *** Berarti account Mhsw
        $_MhswID = $MhswID;
        $_PMBID = $mhsw['PMBID'];
        $_PMBMhswID = 1;
        $ketemu = true;
    } else {
        // Cek apakah account PMB?
        $mhsw = GetFields('pmb', "KodeID='" . KodeID . "' and PMBID", $MhswID, '*');
        if (!empty($mhsw)) {
            // *** Account-nya PMB
            $_MhswID = '';
            $_PMBID = $mhsw['PMBID'];
            $_PMBMhswID = 0;
            $ketemu = true;
        } else {
            $ketemu = false;
        }
        // Tidak ketemu account-nya siapa
    }
    // Jika ketemu
    if ($ketemu) {
        // Prosesnya
        $thn = explode('-', $NamaTahun);
        $Tahun = $thn[0];
        $Semester = substr($thn[1], 0, 2) == 'GA' ? 1 : 2;
        $TahunID = $Tahun . $Semester;
        // Cek KHS
        $khs = GetFields('khs', "KodeID='" . KodeID . "' and MhswID='{$MhswID}' and TahunID", $TahunID, "*");
        if (empty($khs)) {
            // Jika tidak ketemu, maka insert KHS
            // Ambil Total SKS
            if ($khs['Sesi'] <= 1) {
                $MaxSKS = GetaField('prodi', "ProdiID='{$mhsw['ProdiID']}' and KodeID", KodeID, 'DefSKS') + 0;
            } else {
                $MaxSKS = GetaField('maxsks', "KodeID='" . KodeID . "' and NA = 'N'\r\n          and DariIP <= {$khs['IPS']} and {$khs['IPS']} <= SampaiIP and ProdiID", $khs['ProdiID'], 'SKS') + 0;
            }
            $_sesi = GetaField('khs', "MhswID='{$MhswID}' and KodeID", KodeID, "max(Sesi)") + 1;
            $s0 = "insert into khs\r\n        (TahunID, KodeID, ProgramID, ProdiID, MhswID,\r\n        StatusMhswID, Sesi, SKS,\r\n        MaxSKS, LoginBuat, TanggalBuat)\r\n        values\r\n        ('{$TahunID}', '" . KodeID . "', '{$mhsw['ProgramID']}', '{$mhsw['ProdiID']}', '{$MhswID}',\r\n        'A', {$_sesi}, 0,\r\n        {$MaxSKS}, '{$_SESSION['_Login']}', now())";
            $r0 = _query($s0);
            $KHSID = GetLastID();
            $khs = GetFields('khs', 'KHSID', $KHSID, '*');
        }
        // end KHS
        // Cek, apakah sudah dibayarkan sebelumnya atau belum?
        $ada = GetaField('bayarmhsw', "KodeID='" . KodeID . "' and BayarMhswID", $BayarMhswID, "count(BayarMhswID)") + 0;
        if ($ada > 0) {
            echo "<p style='text-align:center;background:red;color:yellow'><b>Sudah pernah dibayarkan.</b></p>";
            // Set status
            if ($khs['StatusMhswID'] == 'P') {
                $sa = "update khs \r\n          set StatusMhswID = 'A'\r\n          where KHSID = '{$khs['KHSID']}' ";
                $ra = _query($sa);
            }
        } else {
            include_once "../keu/bayarmhsw.lib.php";
            // Tambahkan di catatan pembayaran
            $s = "insert into bayarmhsw\r\n        (BayarMhswID, KodeID, TahunID, RekeningID, MhswID, PMBID, TrxID, PMBMhswID,\r\n        Bank, BuktiSetoran, Tanggal, Jumlah,\r\n        Keterangan, LoginBuat, TanggalBuat, NA)\r\n        values\r\n        ('{$BayarMhswID}', '" . KodeID . "', '{$TahunID}', '{$RekeningID}', '{$_MhswID}', '{$_PMBID}', 1, '{$_PMBMhswID}',\r\n        'BTN', '{$BuktiSetoran}', now(), {$Jumlah},\r\n        '{$Catatan}', '{$_SESSION['_Login']}', now(), 'N')";
            $r = _query($s);
            // Update summary
            $_StatusMhswID = $khs['StatusMhswID'] == 'P' ? 'A' : $khs['StatusMhswID'];
            HitungUlangBIPOTMhsw($MhswID, $TahunID);
        }
    } else {
        $_ketemu = "<div style='text-align:center; background: red; color: yellow'><b>Account tidak ditemukan...</b></div><br />";
    }
    // Tampilan proses
    $_Jumlah = number_format($Jumlah);
    echo "\r\n  <p align=center>\r\n  <font size=+1>{$_upProses}</font> <sup>~{$_upJumlah}</sup><br />\r\n    <img src='../img/B1.jpg' height=20 width=1 /><img src='../img/B2.jpg' height=20 width={$_sudah} /><img src='../img/B3.jpg' height=20 width={$_sisa} /><img src='../img/B1.jpg' height=20 width=1 />\r\n    <br />\r\n    {$_ketemu}\r\n    Tahun Akd: {$TahunID}<br />\r\n    NIM: {$MhswID} <br />\r\n    Nama: <b>{$NamaMhsw}</b><br />\r\n    Prodi: <b>{$NamaProdi}</b> <sup>{$ProdiID}</sup><br />\r\n    Rekening: <b>{$RekeningID}</b><br />\r\n    Jumlah: <b>{$_Jumlah}</b><br />\r\n    Catatan: <b>{$Catatan}</b><br />\r\n  </p>";
    // Next...
    $tmr = 10;
    $_SESSION['_upProses']++;
    echo <<<SCR
    <script>
    window.onload=setTimeout("window.location='../{$_SESSION['mnux']}.upload.php'", {$tmr});
    </script>
SCR;
}
Example #16
0
function JdwlSav()
{
    $w = array();
    $w['md'] = $_REQUEST['md'];
    $w['JadwalID'] = $_REQUEST['JadwalID'];
    $w['JadwalPar'] = $_REQUEST['JadwalPar'];
    $w['JadwalSer'] = $_REQUEST['JadwalSer'];
    $w['KodeID'] = $_SESSION['KodeID'];
    $w['TahunID'] = $_REQUEST['TahunID'];
    // array prodi
    $arrProdiID = $_REQUEST['ProdiID'];
    $w['ProdiID'] = empty($arrProdiID) ? '' : '.' . implode('.', $arrProdiID) . '.';
    // array program
    $arrProgramID = $_REQUEST['ProgramID'];
    $w['ProgramID'] = empty($arrProgramID) ? '' : '.' . implode('.', $arrProgramID) . '.';
    $w['NamaKelas'] = strtoupper($_REQUEST['NamaKelas']);
    $w['JenisJadwalID'] = $_REQUEST['JenisJadwalID'];
    $w['MKID'] = $_REQUEST['MKID'];
    $matakuliah = GetFields('mk', 'MKID', $w['MKID'], '*');
    $w['JadwalJenisID'] = $_REQUEST['JadwalJenisID'];
    $w['MKKode'] = $matakuliah['MKKode'];
    $w['Nama'] = $matakuliah['Nama'];
    $w['HariID'] = $_REQUEST['HariID'];
    $w['JamMulai'] = $_REQUEST['JamMulai'];
    $w['JamSelesai'] = $_REQUEST['JamSelesai'];
    $w['SKSAsli'] = $matakuliah['SKS'];
    $w['SKS'] = $_REQUEST['SKS'] == -1 ? $w['SKSAsli'] : $_REQUEST['SKS'] + 0;
    $w['SKSHonor'] = $_REQUEST['SKSHonor'] == -1 ? $w['SKSAsli'] : $_REQUEST['SKSHonor'] + 0;
    $w['DosenID'] = $_REQUEST['DosenID'];
    $w['RencanaKehadiran'] = $_REQUEST['RencanaKehadiran'] + 0;
    $w['Kehadiran'] = $_REQUEST['Kehadiran'] + 0;
    $w['KehadiranMin'] = $_REQUEST['KehadiranMin'] + 0;
    $w['JumlahMhsw'] = $_REQUEST['JumlahMhsw'];
    $w['RuangID'] = $_REQUEST['RuangID'];
    $w['Kapasitas'] = $_REQUEST['Kapasitas'] + 0;
    $w['Kapasitas'] = $w['Kapasitas'] == -1 ? GetaField('ruang', 'RuangID', $w['RuangID'], 'Kapasitas') : $w['Kapasitas'];
    $w['HargaStandar'] = empty($_REQUEST['HargaStandar']) ? 'N' : $_REQUEST['HargaStandar'];
    $w['Harga'] = $_REQUEST['Harga'];
    $w['NA'] = empty($_REQUEST['NA']) ? 'N' : $_REQUEST['NA'];
    // Cek semua kondisi
    $bp = $_REQUEST['bypass'] + 0;
    if ($bp == 0) {
        $GAGAL = CekSemuaJadwal($w);
    } else {
        $GAGAL = 0;
    }
    if ($GAGAL > 0) {
        // Jika Gagal
        $_REQUEST['GAGAL'] = 1;
        echo ErrorMsg("Gagal", "Matakuliah gagal dijadwalkan karena ada kesalahan. <hr size=1 color=silver>\r\n      Pilihan: <a href='javascript:gabungkan()'>Gabungkan Jadwal / Jadwalkan Paksa</a>");
        JdwlEdt();
    } else {
        $w['JamMulai'] = str_replace('.', ':', $w['JamMulai']);
        $w['JamSelesai'] = str_replace('.', ':', $w['JamSelesai']);
        // Jika Berhasil, maka Simpan!
        if ($w['md'] == 0) {
            $s = "update jadwal set JadwalPar='{$w['JadwalPar']}', JadwalSer='{$w['JadwalSer']}',\r\n      ProdiID='{$w['ProdiID']}', ProgramID='{$w['ProgramID']}', NamaKelas='{$w['NamaKelas']}', \r\n      JenisJadwalID='{$w['JenisJadwalID']}', MKID='{$w['MKID']}',\r\n      MKKode='{$matakuliah['MKKode']}', Nama='{$matakuliah['Nama']}',\r\n      HariID='{$w['HariID']}', JamMulai='{$w['JamMulai']}', JamSelesai='{$w['JamSelesai']}',\r\n      SKSAsli='{$w['SKSAsli']}', SKS='{$w['SKS']}', SKSHonor='{$w['SKSHonor']}', DosenID='{$w['DosenID']}',\r\n      RencanaKehadiran='{$w['RencanaKehadiran']}', KehadiranMin='{$w['KehadiranMin']}', \r\n      RuangID='{$w['RuangID']}', Kapasitas='{$w['Kapasitas']}',\r\n      HargaStandar='{$w['HargaStandar']}', Harga='{$w['Harga']}', NA='{$w['NA']}',\r\n      LoginEdit='{$_SESSION['_Login']}', TglEdit=now()\r\n      where JadwalID='{$w['JadwalID']}' ";
            $r = _query($s);
            // Jika ada perubahan SKS, maka update semua KRS
            $s1 = "update krstemp set SKS={$w['SKS']} where JadwalID={$w['JadwalID']}";
            $r1 = _query($s1);
            // Update juga KRS
            $s2 = "update krs set SKS={$w['SKS']} where JadwalID={$w['JadwalID']}";
            $r2 = _query($s2);
            echo "<script>window.location = '?mnux=jadwal#{$w['JadwalID']}';</script>";
        } else {
            $s = "insert into jadwal (JadwalPar, JadwalSer,\r\n      ProdiID, ProgramID, KodeID, TahunID,\r\n      NamaKelas, JenisJadwalID, \r\n      MKID, MKKode, Nama,\r\n      HariID, JamMulai, JamSelesai,\r\n      SKSAsli, SKS, SKSHonor, DosenID,\r\n      RencanaKehadiran, KehadiranMin, RuangID, Kapasitas,\r\n      HargaStandar, Harga, NA,\r\n      LoginBuat, TglBuat\r\n      )\r\n      values ('{$w['JadwalPar']}', '{$w['JadwalSer']}',\r\n      '{$w['ProdiID']}', '{$w['ProgramID']}', '{$w['KodeID']}', '{$w['TahunID']}',\r\n      '{$w['NamaKelas']}', '{$w['JenisJadwalID']}',\r\n      '{$w['MKID']}', '{$w['MKKode']}', '{$w['Nama']}',\r\n      '{$w['HariID']}', '{$w['JamMulai']}', '{$w['JamSelesai']}',\r\n      '{$w['SKSAsli']}', '{$w['SKS']}', '{$w['SKSHonor']}', '{$w['DosenID']}',\r\n      '{$w['RencanaKehadiran']}', '{$w['KehadiranMin']}', '{$w['RuangID']}', '{$w['Kapasitas']}',\r\n      '{$w['HargaStandar']}', '{$w['Harga']}', '{$w['NA']}',\r\n      '{$w['_Login']}', now()) ";
            $r = _query($s);
            $w['JadwalID'] = GetLastID();
            // Hitung kelas Serial
            if ($w['JadwalSer'] > 0) {
                $jmlser = GetaField('jadwal', "JadwalSer", $w['JadwalSer'], "count(JadwalID)") + 0;
                $sser = "update jadwal set JumlahKelasSerial={$jmlser} where JadwalID={$w['JadwalSer']} ";
                $rser = _query($sser);
            }
            //DftrJdwl();
            echo "<script>window.location = '?mnux=jadwal#{$w['JadwalID']}';</script>";
        }
    }
}