コード例 #1
0
        $_t = str_replace('~PMBID~', $pmb['PMBID'], $_t);
        $_t = str_replace('~Nama~', $pmb['Nama'], $_t);
        $_t = str_replace('~AsalSekolah~', $pmb['AsalSekolah'], $_t);
        $_t = str_replace('~FAK~', $pmb['FAK'], $_t);
        $_t = str_replace('~PRD~', $pmb['PRD'], $_t);
        $_t = str_replace('~PRG~', $pmb['PRG'], $_t);
        $_t = str_replace('~TglMulai~', FormatTanggal($period['BayarMulai']), $_t);
        $_t = str_replace('~TglSelesai~', FormatTanggal($period['BayarSelesai']), $_t);
        $_t = str_replace('~BayarSelesai~', FormatTanggal($period['BayarSelesai']), $_t);
        $_t = str_replace('~Tanggal~', date('d/m/Y'), $_t);
        // BIPOT
        $tot = 0;
        $bipot2 = GetBipot2($pmb, $pmb['BIPOTID'], $tot);
        $_t = str_replace('~BIPOT~', $bipot2, $_t);
        // Catatan diskon
        $cttDiskon = $pmb['Diskon'] > 0 ? GetDiskon($pmb, $bipotid, $pmb['Diskon']) : '';
        $_t = str_replace('~DISKON~', $cttDiskon, $_t);
        $_t = str_replace('~TOTALBIAYA~', number_format($tot), $_t);
        // Tuliskan ke file
        //fwrite($f, chr(27).chr(108).chr(0));
        fwrite($f, $_t);
    }
    fclose($f);
    if (empty($_REQUEST['prn'])) {
        TampilkanFileDWOPRN($nmf, '');
    } else {
        include_once "dwoprn.php";
        DownloadDWOPRN($nmf);
    }
}
function GetDiskon($pmb, $bipotid, $Diskon)
コード例 #2
0
function CetakSurat()
{
    global $_HeaderPrn, $_lf;
    // data periode
    $TM = FormatTanggal($_REQUEST['TglDUMulai']);
    $TS = FormatTanggal($_REQUEST['TglDUSelesai']);
    $BY = FormatTanggal($_REQUEST['TglBayar']);
    $TT = FormatTanggal($_REQUEST['TglTangan']);
    // Ambil template
    $namatemplate = "template/{$_REQUEST['tahunpssb']}.PSSB.txt";
    $ft = fopen($namatemplate, 'r');
    $tpl = fread($ft, filesize($namatemplate));
    fclose($ft);
    $nmf = HOME_FOLDER . DS . "tmp/{$_SESSION['_Login']}.dwoprn";
    // Ambil semua parameter
    $pssbid = array();
    $pssbid = $_REQUEST['pssbid'];
    if (!empty($pssbid)) {
        $f = fopen($nmf, 'w');
        /*fwrite($f, 
          chr(27) . chr(38) . chr(107) . chr(50) . chr(83). // condensed
          chr(27) . chr(38) . chr(108) . chr(54) . chr(68). // 6 lines per inches
          chr(27) . chr(40) . chr(115) . chr(51) . chr(66)); // bold & 66 baris*/
        fwrite($f, chr(27) . chr(15));
        fwrite($f, chr(27) . chr(108) . chr(5));
        // Buat surat beberapa sekaligus
        for ($i = 0; $i < sizeof($pssbid); $i++) {
            $pssb = GetFields("pssb p\r\n        left outer join program prg on p.ProgramID=prg.ProgramID\r\n        left outer join prodi prd on p.ProdiID=prd.ProdiID\r\n        left outer join fakultas f on prd.FakultasID=f.FakultasID\r\n        left outer join asalsekolah a on p.AsalSekolah=a.SekolahID", 'PSSBID', $pssbid[$i], "p.*, prd.Nama as PRD, prg.Nama as PRG, f.Nama as FAK,\r\n        a.Nama as AsalSekolah, a.JenisSekolahID as jensek");
            // Ambil template
            $_t = $tpl . chr(12);
            $_t = str_replace('~PSSBID~', $pssb['PSSBID'], $_t);
            $_t = str_replace('~Nama~', $pssb['Nama'], $_t);
            $_t = str_replace('~AsalSekolah~', $pssb['AsalSekolah'], $_t);
            $_t = str_replace('~FAK~', $pssb['FAK'], $_t);
            $_t = str_replace('~PRD~', $pssb['PRD'], $_t);
            $_t = str_replace('~TglMulai~', $TM, $_t);
            $_t = str_replace('~TglSelesai~', $TS, $_t);
            $_t = str_replace('~BayarSelesai~', $BY, $_t);
            $_t = str_replace('~Tanggal~', $TT, $_t);
            // Ambil BIPOT default untuk program studi ybs
            $bipotid = GetaField('bipot', "Def='Y' and ProgramID='{$pssb['ProgramID']}' and ProdiID", $pssb['ProdiID'], 'BIPOTID');
            // BIPOT
            $tot = 0;
            $bipot2 = GetBipot2($bipotid, $tot);
            //$jensek = Getafield('asalsekolah', "sekolahID", $pssb['sekolahID'], 'JenisSekolahID');
            $_t = str_replace('~BIPOT~', $bipot2, $_t);
            // Diskon
            $cttDiskon = $pssb['Diskon'] > 0 ? GetDiskon($bipotid, $pssb['Diskon'], $tot, $satu, $dua, $tiga) : Nodiskon($bipotid, $tot, $satu, $dua, $tiga);
            if ($pssb['jensek'] == 'PENABUR') {
                $catat = "Jika Anda membayar lunas s.d. " . $BY . " akan mendapat rabat 5% dari SPP yang wajib dibayar, asal sekolah anda dari " . $_lf . "   BPK Penabur sehingga mendapat tambahan rabat sebesar 5% lagi";
            } elseif ($pssb['jensek'] == 'WAKIL') {
                $catat = "Jika Anda membayar lunas s.d. " . $BY . " akan mendapat rabat 10% dari SPP yang wajib dibayar, asal sekolah anda dari" . $_lf . "   Perwakilan sehingga mendapat tambahan rabat sebesar 5% lagi";
            } else {
                $catat = "Jika Anda membayar lunas s.d. " . $BY . " akan mendapat rabat 5% dari SPP yang wajib dibayar";
            }
            $_t = str_replace('~LUNAS~', $catat, $_t);
            $_t = str_replace('~DISKON~', $cttDiskon, $_t);
            // Total
            $_t = str_replace('~TOTALBIAYA~', number_format($tot), $_t);
            //50% SPP
            $_t = str_replace('~TAHAP1~', number_format($satu), $_t);
            //30% SPP
            $_t = str_replace('~TAHAP2~', number_format($dua), $_t);
            //20% SPP
            $_t = str_replace('~TAHAP3~', number_format($tiga), $_t);
            // Tuliskan ke file
            fwrite($f, $_t);
        }
        fclose($f);
        if (empty($_REQUEST['prn'])) {
            TampilkanFileDWOPRN($nmf, '');
        } else {
            include_once "dwoprn.php";
            DownloadDWOPRN($nmf);
        }
    }
}