function BuatIsinya($TahunID, $ProdiID, $p)
{
    $whr_prodi = $ProdiID == '' ? '' : "and h.ProdiID = '{$ProdiID}' ";
    $s = "select h.MhswID, m.Nama, h.ProdiID,\r\n      h.Biaya, h.Potongan, h.Tarik, h.Bayar,\r\n      format(h.Biaya, 0) as _Biaya,\r\n      format(h.Potongan, 0) as _Potongan,\r\n      format(h.Tarik, 0) as _Tarik,\r\n      format(h.Bayar, 0) as _Bayar,\r\n      (h.Biaya + h.Tarik - h.Potongan - h.Bayar) as TTL, \r\n      format((h.Biaya + h.Tarik - h.Potongan - h.Bayar), 0) as _TTL\r\n    from khs h\r\n      left outer join mhsw m on m.MhswID = h.MhswID and m.KodeID = '" . KodeID . "'\r\n    where h.TahunID = '{$TahunID}'\r\n      {$whr_prodi}\r\n    order by h.ProdiID, h.MhswID";
    $r = _query($s);
    $n = 0;
    $t = 5;
    $ttl = 0;
    $_prd = ';alskdjfa;lsdhguairgsofjhjg9e8rgjpsofjg';
    while ($w = _fetch_array($r)) {
        if ($_prd != $w['ProdiID']) {
            if ($n > 0) {
                $_ttl = number_format($ttl + 0);
                $p->SetFont('Helvetica', 'B', 10);
                $p->Cell($lbr, 1, ' ', 1, 1);
                $p->Cell(158, $t, 'TOTAL :', 0, 0, 'R');
                $p->Cell(32, $t, $_ttl, 0, 0, 'R');
                $p->Ln($t + 2);
            }
            $_prd = $w['ProdiID'];
            BuatHeaderTable($TahunID, $_prd, $p);
            $ttl = 0;
            $n = 0;
        }
        $n++;
        $ttl += $w['TTL'];
        $p->SetFont('Helvetica', '', 8);
        $p->Cell(8, $t, $n, 1, 0);
        $p->Cell(24, $t, $w['MhswID'], 1, 0);
        $p->Cell(58, $t, $w['Nama'], 1, 0);
        $p->Cell(20, $t, $w['_Biaya'], 1, 0, 'R');
        $p->Cell(20, $t, $w['_Potongan'], 1, 0, 'R');
        $p->Cell(20, $t, $w['_Tarik'], 1, 0, 'R');
        $p->Cell(20, $t, $w['_Bayar'], 1, 0, 'R');
        $p->Cell(20, $t, $w['_TTL'], 1, 0, 'R');
        $p->Ln($t);
    }
    $_ttl = number_format($ttl + 0);
    $p->SetFont('Helvetica', 'B', 10);
    $p->Cell($lbr, 1, ' ', 1, 1);
    $p->Cell(158, $t, 'TOTAL :', 0, 0, 'R');
    $p->Cell(32, $t, $_ttl, 0, 0, 'R');
    $p->Ln($t + 2);
}
function BuatIsinya($TahunID, $ProdiID, $p)
{
    global $lbr;
    $t = 6;
    $whr_prodi = $ProdiID == '' ? '' : "and k.ProdiID = '{$ProdiID}' ";
    $s = "select m.Nama as _nama, k.MhswID as _MhswID, date_format(bm.Tanggal,'%d-%m-%Y') as _tgl, k.Biaya as _biaya, k.Bayar as _bayar, bm.Keterangan as _ket\r\n  \t\tfrom khs k left outer join bayarmhsw bm on k.TahunID = bm.TahunID and bm.MhswID = k.MhswID\r\n  \t\tleft outer join mhsw m on k.MhswID = m.MhswID\r\n  \t\twhere k.TahunID = '{$TahunID}' and  k.Sesi = '1' {$whr_prodi} group by k.MhswID order by m.Nama";
    $q = _query($s);
    BuatHeaderTable($TahunID, $ProdiID, $p);
    $n = 0;
    $rec = 0;
    $totalJum = 0;
    $totalSisa = 0;
    while ($w = _fetch_array($q)) {
        $n++;
        $rec++;
        if ($rec >= 20) {
            $rec = 1;
            BuatHeaderTable($TahunID, $ProdiID, $p);
        }
        //$s2 = "select date_format(bm.Tanggal,'%d-%m-%Y') as _tgl, k.Biaya as _biaya, k.Bayar as _bayar from khs k left outer join bayarmhsw bm on k.TahunID = bm.TahunID and bm.MhswID = k.MhswID
        //		where k.MhswID = '$w[MhswID]' and k.Sesi = '1'";
        //$q2 = _query($s2);
        //$w2 = _fetch_array($q2);
        $sisa = $w[_biaya] - $w[_bayar] == 0 ? 'Lunas' : number_format($w[_biaya] - $w[_bayar], 0, '.', ',');
        $p->SetFont('Helvetica', '', 9);
        $p->Cell(8, $t, $n, 1, 0, 'C');
        $p->Cell(80, $t, $w[_nama], 1, 0, 'C');
        $p->Cell(30, $t, $w[_MhswID], 1, 0, 'C');
        $p->Cell(30, $t, $w[_tgl], 1, 0, 'C');
        $p->Cell(30, $t, number_format($w[_bayar], 0, '.', ','), 1, 0, 'C');
        $p->Cell(30, $t, number_format($w[_bayar], 0, '.', ','), 1, 0, 'C');
        $p->Cell(30, $t, $sisa, 1, 0, 'C');
        $p->Cell(40, $t, $w[_ket], 1, 1, 'C');
        $totalJum += $w[_bayar];
        $totalSisa += $w[_biaya] - $w[_bayar];
    }
    // buat jumlah
    $p->SetFont('Helvetica', 'B', 9);
    $p->Cell(178, $t, '', 0, 0, 'C');
    $p->Cell(30, $t, number_format($totalJum, 0, '.', ','), 1, 0, 'C');
    $p->Cell(30, $t, number_format($totalSisa, 0, '.', ','), 1, 1, 'C');
    // buat footer
    BuatFooter($p);
}
Example #3
0
include_once "../db.mysql.php";
include_once "../connectdb.php";
include_once "../parameter.php";
include_once "../cekparam.php";
include_once "../fpdf.php";
// *** Parameters ***
$TahunID = GetSetVar('TahunID');
$ProdiID = GetSetVar('ProdiID');
// *** Init PDF
$pdf = new FPDF();
$pdf->SetTitle("Rekap Beasiswa Mahasiswa");
$pdf->SetAutoPageBreak(true, 5);
$pdf->AddPage();
$tahunstring = empty($TahunID) ? '' : "Tahun {$TahunID}";
HeaderLogo("Mahasiswa Yang Mendapatkan Beasiswa {$tahunstring}", $pdf, 'P');
BuatHeaderTable($TahunID, $ProdiID, $pdf);
$lbr = 190;
BuatIsinya($TahunID, $ProdiID, $pdf);
$pdf->Output();
// *** Functions ***
function BuatIsinya($TahunID, $ProdiID, $p)
{
    $whr_prodi = $ProdiID == '' ? '' : "and h.ProdiID = '{$ProdiID}' ";
    $whr_tahun = empty($TahunID) ? '' : "and h.TahunID = '{$TahunID}'";
    $s = "select h.MhswID, m.Nama, h.ProdiID, h.IP, h.SKS, h.TotalSKS, \r\n      h.Potongan,\r\n      format(h.Potongan, 0) as _Potongan\r\n    from khs h\r\n      left outer join mhsw m on m.MhswID = h.MhswID and m.KodeID = '" . KodeID . "'\r\n    where h.KodeID='" . KodeID . "'\r\n\t  {$whr_tahun}\r\n      {$whr_prodi}\r\n\t  and h.Potongan > 0\r\n    order by h.MhswID, h.Sesi";
    $r = _query($s);
    $n = 0;
    $t = 5;
    $ttl = 0;
    $_mhsw = ';alskdjfa;lsdhguairgsofjhjg9e8rgjpsofjg';
    while ($w = _fetch_array($r)) {
include_once "../connectdb.php";
include_once "../parameter.php";
include_once "../cekparam.php";
include_once "../fpdf.php";
// *** Parameters ***
$_DosenID = $_REQUEST['_detDosenID'];
$_Tahun = $_REQUEST['_detTahun'];
$_Bulan = $_REQUEST['_detBulan'];
$_id = $_REQUEST['_detid'];
// *** Init PDF
$pdf = new FPDF();
$pdf->SetTitle("Honor Dosen");
$pdf->SetAutoPageBreak(true, 5);
$pdf->AddPage();
HeaderLogo("Kwitansi Pembayaran Honor Dosen", $pdf, 'P', (empty($_id) ? "" : "Minggu Ke-" . substr(GetaField('honordosen', 'HonorDosenID', $_id, 'Minggu'), 1, 1)) . " Bulan " . UbahKeBulanIndonesia($_Bulan) . " {$_Tahun}");
BuatHeaderTable($_DosenID, $_Tahun, $_Bulan, $_id, $pdf);
$lbr = 190;
BuatIsinya($_DosenID, $_Tahun, $_Bulan, $_id, $pdf);
BuatPrintedOn('', $pdf);
$pdf->Output();
// *** Functions ***
function BuatIsinya($_DosenID, $_Tahun, $_Bulan, $_id, $p)
{
    $whr_id = empty($_id) ? "" : "and p.HonorDosenID = '{$_id}'";
    $s = "select h.*, m.Nama as Mgg \r\n        from honordosen h\r\n        left outer join minggu m on h.Minggu=m.MingguID\r\n        where h.DosenID = '{$_DosenID}'\r\n\t      and h.Bulan = '{$_Bulan}'\r\n        and h.Tahun = '{$_Tahun}'";
    /*
      $s = "select DISTINCT(j.MKKode), j.SKS,
      p.SKSHonor,
      j.Nama, 
    	  sum(p.TunjanganSKS) as _TunjanganSKS,
    	  sum(p.TunjanganTetap) as _TunjanganTetap,