function Cetak()
{
    // *** Init PDF
    $pdf = new PDF();
    $pdf->SetTitle("Penjualan Formulir");
    $pdf->AddPage();
    $lbr = 190;
    BuatJudulLaporan($_SESSION['_PMBPeriodID'], $pdf);
    BuatIsinya($_SESSION['_PMBPeriodID'], $pdf);
    $pdf->Output();
}
$whr = array();
if (!empty($_SESSION['dsnkeycr']) && !empty($_SESSION['dsncr'])) {
    if ($_SESSION['dsnkeycr'] == 'Login') {
        $whr[] = "d.{$_SESSION['dsnkeycr']} like '{$_SESSION['dsncr']}%'";
    } else {
        $whr[] = "d.{$_SESSION['dsnkeycr']} like '%{$_SESSION['dsncr']}%'";
    }
}
$where = implode(' and ', $whr);
$where = empty($where) ? '' : "and {$where}";
$hom = empty($_SESSION['prodi']) ? '' : "and Homebase = '{$_SESSION['prodi']}'";
$s = "select d.Nama as _Namadosen, d.Login as _NIP, d.LulusanPT as _Lulus, d.Keilmuan as _Ilmu, d.Homebase as _Homebase,  \r\n\ts.Nama as _Namastatus,\r\n\tkl.Nama as _Kelamin,\r\n\tjj.keterangan as _Ket,\r\n\tp.Nama as _Namaprodi,\r\n\tj.Nama as _Namajab,\r\n\td.TempatLahir as _TempatL, date_format(d.TanggalLahir,'%d %b %Y') as _TglLahir\r\n\tfrom dosen d \r\n\tleft outer join statusdosen s on d.StatusDosenID = s.StatusDosenID\r\n\tleft outer join kelamin kl on d.KelaminID = kl.Kelamin\r\n\tleft outer join jenjang jj on d.JenjangID = jj.JenjangID\r\n\tleft outer join prodi p on d.Homebase = p.ProdiID\r\n\tleft outer join jabatan j on d.JabatanID = j.JabatanID\r\n\twhere d.KodeID = '" . KodeID . "' {$where} {$hom}\r\n\torder by d.Login";
$r = _query($s);
while ($w = _fetch_array($r)) {
    $pdf->AddPage();
    BuatJudulLaporan($prodi, $pdf);
    BuatDaftarDosen($w, $prodi, $pdf);
}
$pdf->Output();
// *** Functions ***
function BuatJudulLaporan($prodi, $p)
{
    global $lbr;
    $p->SetFont('Helvetica', 'B', 14);
    $p->Ln(3);
    $p->Cell($lbr, 5, "Daftar Riwayat Hidup Dosen", 0, 1, 'C');
    $p->Ln(10);
}
function BuatDaftarDosen($w, $prodi, $p)
{
    global $lbr;
// Start   : 08/01/2009
session_start();
include_once "../dwo.lib.php";
include_once "../db.mysql.php";
include_once "../connectdb.php";
include_once "../parameter.php";
include_once "../cekparam.php";
include_once "../header_pdf.php";
// *** Parameters ***
$gel = sqling($_REQUEST['gel']);
$presenterid = $_SESSION['_curPres'];
$lbr = 190;
$pdf = new PDF();
$pdf->SetTitle("Daftar Aplikan - {$gel}");
$pdf->AddPage();
BuatJudulLaporan($presenterid, $gel, $pdf);
BuatDaftarAplikan($presenterid, $gel, $pdf);
$pdf->Output();
// *** Functions ***
function BuatJudulLaporan($id, $gel, $p)
{
    global $lbr;
    $p->SetFont('Helvetica', 'B', 14);
    $p->Ln(3);
    $p->Cell($lbr, 5, "Daftar Aplikan yang Datang pada Tanggal " . date('Y-m-d'), 0, 1, 'C');
    $presenter = GetaField('presenter', "KodeID='" . KodeID . "' and PresenterID", $id, 'Nama');
    if (!empty($id)) {
        $p->SetFont('Helvetica', 'BI', 12);
        $p->Ln(3);
        $p->Cell($lbr, 5, "Presenter: " . $id . " - {$presenter}", 0, 1);
    }