function CetakKSS1($tahun, $mhsw, $khs)
{
    global $_HeaderPrn, $_lf;
    $stm = GetFields('statusmhsw', 'StatusMhswID', $khs['StatusMhswID'], '*');
    if ($stm['Nilai'] == 0) {
    }
    // Buat file
    $nmf = HOME_FOLDER . DS . "tmp/{$_SESSION['_Login']}.dwoprn";
    $f = fopen($nmf, 'w');
    fwrite($f, chr(18) . chr(27) . chr(15) . chr(27) . chr(67) . chr(18));
    //.chr(27).chr(67).chr(18)
    fwrite($f, $_lf . $_lf);
    // Isinya
    $brs = 15;
    $arr = array();
    $div = str_pad('', 154, '-') . $_lf;
    for ($i = 0; $i <= $brs; $i++) {
        $arr[$i] = '';
    }
    TuliskanDataUtama($mhsw, $khs, $arr);
    if ($stm['Nilai'] == 0) {
        TuliskanStatusMhsw($mhsw, $khs, $arr, $stm);
    } else {
        TuliskanIsiKRS($mhsw, $khs, $arr);
    }
    TuliskanKanan($mhsw, $khs, $arr);
    for ($i = 0; $i <= $brs; $i++) {
        fwrite($f, $arr[$i] . $_lf);
    }
    fwrite($f, chr(27) . chr(18) . chr(67) . chr(66));
    //fwrite($f, chr(12));
    fclose($f);
    include "dwoprn.php";
    DownloadDWOPRN($nmf);
}
Example #2
0
function CetakKSS1($tahun, $mhsw, $khs)
{
    global $_HeaderPrn, $_lf;
    // Cek Status
    $stm = GetFields('statusmhsw', 'StatusMhswID', $khs['StatusMhswID'], '*');
    if ($stm['Nilai'] == 0) {
        //delete KRS mahasiswa di krstemp
        HapusKRSTemp($tahun, $mhsw, $khs);
        //Apakah Mahasiswa sudah punya kewajiban???
        $bipot = GetFields('bipotmhsw', "TrxID = 1 and TahunID = '{$tahun}' and MhswID", $mhsw['MhswID'], '*');
        //echo "$bipot[MhswID]"; exit;
        if (!empty($bipot['MhswID'])) {
            //Delete Keuangan Mahasiswa kecuali hutang, dan Biaya yang sudah dibayar
            $s = "delete \n\t\t\t\t\t\tfrom bipotmhsw \n\t\t\t\t\t\twhere MhswID = '{$mhsw['MhswID']}' and\n\t\t\t\t\t\t\t\t\tTahunID = '{$tahun}' and \n\t\t\t\t\t\t\t\t\tTrxID = 1 and \n\t\t\t\t\t\t\t\t\tBipotNamaID <> 30 and\n\t\t\t\t\t\t\t\t\tDibayar = 0";
            $r = _query($s);
        }
        //Apakah BPS sudah dibayar???
        $BPSbyr = GetaField('bipotmhsw', "TrxID = 1 and TahunID = '{$tahun}' and MhswID", $mhsw['MhswID'], 'Dibayar');
        if ($BPSbyr <= 0) {
            //Ambil Jumlah BPS dari Bipot
            $BPS = GetFields('bipot2', "BipotID = {$mhsw['BIPOTID']} and BipotNamaID", 11, '*');
            //Masukkan Jumlah BPS ke Bipotmhsw
            $s1 = "insert into bipotmhsw(MhswID, TahunID, BIPOT2ID, BIPOTNamaID,\n\t\t\t\tPMBMhswID, TrxID, Jumlah, Besar, Catatan,\n\t\t\t\tLoginBuat, TanggalBuat)\n\t\t\t\tvalues('{$mhsw['MhswID']}', '{$tahun}', '{$BPS['BIPOT2ID']}', '{$BPS['BIPOTNamaID']}',\n\t\t\t\t'1', '{$BPS['TrxID']}', 1, '{$BPS['Jumlah']}', 'Cuti atau Tunggu Ujian',\n\t\t\t\t'{$_SESSION['_Login']}', now())";
            $r1 = _query($s1);
            //update jumlah MK dan SKS di KHS
            $upkhs = "update khs set JumlahMK='0', TotalSKS='0' where KHSID = '{$khs['KHSID']}'";
            $up = _query($upkhs);
            //Hitung ulang Biaya di KHS
            HitungBiaya($mhsw, $khs);
        }
    } else {
        // Jika belum aktif, maka set status menjadi aktif
        $status = $khs['StatusMhswID'] != 'A' ? ", StatusMhswID='A' " : '';
        // Set kalau sudah dicetak
        $s = "update khs set Cetak='Y', KaliCetak=KaliCetak+1 {$status}\n      where KHSID='{$khs['KHSID']}' ";
        $r = _query($s);
    }
    // Update biaya2
    $sb = "update bipotmhsw set Draft='N' \n    where MhswID='{$mhsw['MhswID']}' and TahunID='{$khs['TahunID']}' and Draft='Y' ";
    $rb = _query($sb);
    // Buat file
    $nmf = "tmp/{$_SESSION['_Login']}.dwoprn";
    $f = fopen($nmf, 'w');
    fwrite($f, chr(18) . chr(27) . chr(15));
    //.chr(27).chr(67).chr(18)
    fwrite($f, $_lf . $_lf);
    // Isinya
    $brs = 15;
    $arr = array();
    $div = str_pad('', 154, '-') . $_lf;
    for ($i = 0; $i <= $brs; $i++) {
        $arr[$i] = '';
    }
    TuliskanDataUtama($mhsw, $khs, $arr);
    if ($stm['Nilai'] == 0) {
        TuliskanStatusMhsw($mhsw, $khs, $arr, $stm);
    } else {
        TuliskanIsiKRS($mhsw, $khs, $arr);
    }
    TuliskanKanan($mhsw, $khs, $arr);
    for ($i = 0; $i <= $brs; $i++) {
        fwrite($f, $arr[$i] . $_lf);
    }
    fwrite($f, chr(27) . chr(18) . chr(67) . chr(66));
    //fwrite($f, chr(12));
    fclose($f);
    include "dwoprn.php";
    DownloadDWOPRN($nmf);
}