function Daftar()
{
    $arrTrm = array(0 => 'Lulus', 1 => 'Konfirmasi NIM');
    // Data gelombang
    $arrGel = GetArrGelombang($_SESSION['tahun']);
    $arrPrd = GetArrPrd();
    $arrStat = GetArrStatus();
    $hdrgel = '';
    for ($i = 0; $i < sizeof($arrGel); $i++) {
        $hdrgel .= "<th class=ttl>" . $arrGel[$i] . "</th>";
    }
    $s = "select ProdiID, PMBPeriodID, NIM as MhswID, count(PMBID) as JML, LulusUjian, StatusAwalID\r\n    from pmb\r\n    where LEFT(pmb.PMBPeriodID, 4)='{$_SESSION['tahun']}' and pmb.LulusUjian = 'Y'\r\n    group by left(pmb.NIM, 6), pmb.ProdiID, pmb.PMBPeriodID";
    $r = _query($s);
    //echo "<pre>$s</pre>";
    // Ambil data
    $arr = array();
    while ($w = _fetch_array($r)) {
        $key = $w['ProdiID'];
        $keyg = $w['PMBPeriodID'];
        $keys = $w['StatusAwalID'];
        $trm = empty($w['MhswID']) ? 0 : 1;
        $arr[$key][$trm][$keyg] = $w['JML'];
        //echo "$w[MhswID]: $w[ProdiID]: $w[PMBPeriodID] : $w[JML]<br>";
    }
    //print_r(array_values($arr));
    echo "<p><table class=box cellspacing=1 cellpadding=4>\r\n    <tr><th class=ttl colspan=2>Program Studi</th>\r\n      <th class=ttl>Lulus/Konf. NIM</th>\r\n    {$hdrgel}\r\n    <th class=ttl>Jumlah</th></tr>";
    //$arrp = array_keys($arr);
    $tot = 0;
    for ($i = 0; $i < sizeof($arrPrd); $i++) {
        $prd = $arrPrd[$i];
        $nmprd = GetaField('prodi', 'ProdiID', $arrPrd[$i], 'Nama');
        for ($x = 0; $x <= 1; $x++) {
            $sub = 0;
            $trm = $arrTrm[$x];
            if ($x == 0) {
                $_prd = $prd;
                $_nmprd = $nmprd;
            } else {
                $_prd = '&nbsp;';
                $_nmprd = '&nbsp;';
            }
            $isigel = '';
            for ($j = 0; $j < sizeof($arrGel); $j++) {
                $jmlgel = $arr[$arrPrd[$i]][$x][$arrGel[$j]] + 0;
                $totgel = $arr[$arrPrd[$i]][1][$arrGel[$j]] + $arr[$arrPrd[$i]][0][$arrGel[$j]] + 0;
                //$tot10 += $arr[$arrPrd[$i]][0][$arrGel[$j]]+0;
                $tot += $jmlgel;
                $sub += $jmlgel;
                $sub2 += $sub;
                if ($x == 0) {
                    $isigel .= "<td class=ul align=right>{$totgel}</td>";
                } else {
                    $isigel .= "<td class=ul align=right>{$jmlgel}</td>";
                }
            }
            //var_dump($tot10);
            echo "<tr>\r\n      <td class=inp1><b>{$_prd}</b></td>\r\n      <td class=ul>{$_nmprd}</td>\r\n      <td class=ul>{$trm}</td>\r\n      {$isigel}\r\n      <td class=inp>{$sub}</td>\r\n      </tr>";
        }
    }
    $kol = 3 + sizeof($arrGel);
    //$jmlLulus = GetaField('pmb', "LulusUjian = 'Y' and left(PMBPeriodID, 4)", $_SESSION['tahun'], 'count(PMBID)');
    //$jmlNIM   = GetaField('pmb', "NIM is not null and left(PMBPeriodID, 4)", $_SESSION['tahun'], 'count(PMBID)');
    echo "<tr><td class=ul colspan={$kol} align=right>Total :</td><td class=inp><b>{$tot}</b></td></tr>";
    echo "</table></p>";
}
Exemplo n.º 2
0
function Daftar()
{
    $arrGel = GetArrGelombang($_SESSION['tahun']);
    $arrPrd = GetArrPrd();
    $arrSts = GetArrStatus();
    $col = sizeof($arrGel) * sizeof($arrSts);
    $n = 0;
    $JumTes = array();
    $s = "SELECT StatusAwalID, PMBPeriodID, count( PMBID ) as JML , ProdiID\r\n        FROM pmb\r\n        WHERE left( PMBPeriodID, 4 ) = '{$_SESSION['tahun']}'\r\n        GROUP BY PMBPeriodID, ProdiID, StatusAwalID\r\n        ORDER BY PMBPeriodID, ProdiID";
    $r = _query($s);
    while ($w = _fetch_array($r)) {
        $Thn = $w['PMBPeriodID'];
        $Prd = $w['ProdiID'];
        $StA = $w['StatusAwalID'];
        $JumTes[$Prd][$Thn][$StA] = $w['JML'] + 0;
    }
    $s1 = "SELECT StatusAwalID, PMBPeriodID, count( PMBID ) as JML , ProdiID\r\n        FROM pmb\r\n        WHERE left( PMBPeriodID, 4 ) = '{$_SESSION['tahun']}'\r\n              AND LulusUjian = 'Y'\r\n        GROUP BY PMBPeriodID, ProdiID, StatusAwalID\r\n        ORDER BY PMBPeriodID, ProdiID";
    $r1 = _query($s1);
    while ($w1 = _fetch_array($r1)) {
        $Thn = $w1['PMBPeriodID'];
        $Prd = $w1['ProdiID'];
        $StA = $w1['StatusAwalID'];
        $JumLLS[$Prd][$Thn][$StA] = $w1['JML'] + 0;
    }
    $s2 = "SELECT StatusAwalID, PMBPeriodID, count( PMBID ) as JML , ProdiID\r\n        FROM pmb\r\n        WHERE left( PMBPeriodID, 4 ) = '{$_SESSION['tahun']}'\r\n              AND NIM is Not NULL\r\n        GROUP BY PMBPeriodID, ProdiID, StatusAwalID\r\n        ORDER BY PMBPeriodID, ProdiID";
    $r2 = _query($s2);
    while ($w2 = _fetch_array($r2)) {
        $Thn = $w2['PMBPeriodID'];
        $Prd = $w2['ProdiID'];
        $StA = $w2['StatusAwalID'];
        $JumKFS[$Prd][$Thn][$StA] = $w2['JML'] + 0;
    }
    for ($l = 0; $l < sizeof($arrGel); $l++) {
        $hdr .= "<th class=ttl colspan=3>{$arrGel[$l]}</th>";
        $hdrst .= "<th class=ttl>B</th><th class=ttl>P</th><th class=ttl>S</th>";
    }
    echo "<p><table class=box cellpadding=4 cellspacing=1>";
    echo "<tr><th class=ttl rowspan=2>PRODI</th><th class=ttl rowspan=2>KETERANGAN</th>{$hdr}<th rowspan=2 class=ttl>TOTAL</th></tr>";
    echo "<tr>{$hdrst}</tr>";
    for ($i = 0; $i < sizeof($arrPrd); $i++) {
        for ($j = 0; $j < sizeof($arrGel); $j++) {
            for ($k = 0; $k < sizeof($arrSts); $k++) {
                $n++;
                if ($n == 1) {
                    $t = array();
                    $GTES = 0;
                    $GLLS = 0;
                    $GKFS = 0;
                }
                $TOTTES = $JumTes[$arrPrd[$i]][$arrGel[$j]][$arrSts[$k]] + 0;
                $TOTLLS = $JumLLS[$arrPrd[$i]][$arrGel[$j]][$arrSts[$k]] + 0;
                $TOTKFS = $JumKFS[$arrPrd[$i]][$arrGel[$j]][$arrSts[$k]] + 0;
                $GTES += $TOTTES;
                $GLLS += $TOTLLS;
                $GKFS += $TOTKFS;
                $t[1] .= "<td class=ul>{$TOTTES}&nbsp;</td>";
                $t[2] .= "<td class=inp3>{$TOTLLS}&nbsp;</td>";
                $t[3] .= "<td class=inp4>{$TOTKFS}&nbsp;</td>";
                if ($n >= $col) {
                    TuliskanData($t, $arrPrd[$i], $GTES, $GLLS, $GKFS);
                    $n = 0;
                }
            }
        }
    }
    // var_dump($jt);
    echo "</table>";
}