function GetBipot2($pmb, $bipotid, &$total)
{
    global $_lf;
    $s0 = "select b2.*, bn.Nama, bn.DefJumlah, bn.DefBesar, bn.Diskon\r\n    from bipot2 b2\r\n    left outer join bipotnama bn on b2.BIPOTNamaID=bn.BIPOTNamaID\r\n    where b2.BIPOTID='{$bipotid}' and b2.SaatID=1\r\n      and INSTR(b2.StatusAwalID, '.{$pmb['StatusAwalID']}.')>0\r\n    order by b2.Prioritas";
    $r0 = _query($s0);
    $thn = substr($w['PMBID'], 0, 4);
    $a = '';
    $n = 0;
    $total = 0;
    while ($w0 = _fetch_array($r0)) {
        if ($w0['Jumlah'] == 0) {
        } elseif ($w0['GunakanGradeNilai'] == 'Y') {
            if (strpos($w0['GradeNilai'], ".{$pmb['GradeNilai']}.") === false) {
            } else {
                $n++;
                $a .= InsertBIPOT($n, $w0, $tot, $bipotid, $pmb);
                $total += $tot;
            }
        } else {
            $n++;
            $a .= InsertBIPOT($n, $w0, $tot, $bipotid, $pmb);
            $total += $tot;
        }
    }
    $strtotal = str_pad(' ', 57, ' ') . str_pad('-', 15, '-') . $_lf;
    $strtotal .= str_pad('Total :', 57, ' ', STR_PAD_LEFT) . str_pad(number_format($total), 15, ' ', STR_PAD_LEFT);
    return number_format($total);
}
function GetBipot2($bipotid, &$total)
{
    global $_lf;
    $s0 = "select b2.*, bn.Nama, bn.DefJumlah, bn.DefBesar, bn.Diskon\r\n    from bipot2 b2\r\n    left outer join bipotnama bn on b2.BIPOTNamaID=bn.BIPOTNamaID\r\n    where b2.BIPOTID='{$bipotid}' and b2.SaatID=1\r\n      and INSTR(b2.StatusAwalID, '.S.')>0\r\n      and b2.NA='N'\r\n    order by b2.Prioritas";
    $r0 = _query($s0);
    $thn = substr($w['PMBID'], 0, 4);
    $a = '';
    $n = 0;
    $total = 0;
    while ($w0 = _fetch_array($r0)) {
        $n++;
        $a .= InsertBIPOT($n, $w0, $tot, $bipotid);
        $total += $tot;
    }
    $strtotal = str_pad(' ', 57, ' ') . str_pad('-', 15, '-') . $_lf;
    $strtotal .= str_pad('Total :', 57, ' ', STR_PAD_LEFT) . str_pad(number_format($total), 15, ' ', STR_PAD_LEFT);
    return $a . $strtotal;
}
Beispiel #3
0
function CekBIPOT($w)
{
    $s0 = "select b2.*, bn.Nama\r\n    from bipot2 b2\r\n    left outer join bipotnama bn on b2.BIPOTNamaID=bn.BIPOTNamaID\r\n    where b2.BIPOTID='{$w['BIPOTID']}' and b2.SaatID=1 \r\n    and b2.NA='N' and b2.Otomatis='Y'\r\n      and INSTR(b2.StatusAwalID, '.{$w['StatusAwalID']}.')>0\r\n    order by b2.Prioritas";
    $r0 = _query($s0);
    $thn = $w['PMBPeriodID'];
    while ($w0 = _fetch_array($r0)) {
        $sdh = GetFields('bipotmhsw', "PMBMhswID=0 and TahunID='{$thn}' and PMBID='{$w['PMBID']}' and BIPOT2ID", $w0['BIPOT2ID'], "*");
        if ($w0['GunakanScript'] == 'Y') {
            $khs = array();
            $khs['TahunID'] = $thn;
            $khs['Sesi'] = 1;
            InsertBIPOTScript1($w, $khs, $w0, $sdh);
        } else {
            if (empty($sdh)) {
                $ada = GetFields('bipotmhsw', "PMBID = '{$w['PMBID']}' and BipotNamaID", $w0['BipotNamaID'], '*');
                if (empty($ada)) {
                    if ($w0['GunakanGradeNilai'] == 'Y') {
                        if (strpos($w0['GradeNilai'], ".{$w['GradeNilai']}.") === false) {
                        } else {
                            InsertBIPOT($w, $w0);
                        }
                    } else {
                        InsertBIPOT($w, $w0);
                    }
                } else {
                    $s1 = "update bipotmhsw set Besar='{$w0['Jumlah']}', Bipot2ID = '{$w0['BIPOT2ID']}', LoginEdit='{$_SESSION['_Login']}', TanggalEdit=now() where BIPOTMhswID='{$ada['BIPOTMhswID']}'";
                    $r1 = _query($s1);
                }
            }
        }
    }
    $byr = GetaField('bayarmhsw', "TrxID=1 and TahunID='{$thn}' and PMBID", $w['PMBID'], "sum(Jumlah)") + 0;
    if ($byr != 0) {
        //ProsesBipotMhswPMB($byr, $w['PMBID'], $thn);
    }
    // update total biaya
    $TOTBIA = GetaField('bipotmhsw', "PMBMhswID=0 and TahunID='0' and PMBID", $w['PMBID'], "sum(Jumlah*Besar)") + 0;
    $sbi = "update pmb set TotalBiayaMhsw={$TOTBIA} where PMBID='{$w['PMBID']}' ";
    $rbi = _query($sbi);
}