示例#1
0
function TampilkanDetailBiaya($MhswID, $mhsw, $khs, $md)
{
    //22 juli 2013
    $s = "select bm.*, s.Nama as _saat,\r\n      format(bm.Jumlah, 0) as JML,\r\n      format(bm.Besar, 0) as BSR,\r\n      (bm.Jumlah * bm.Besar) as SubTTL,\r\n      ((bm.Jumlah * bm.Besar) - bm.Dibayar) as SISA,\r\n      bn.DipotongBeasiswa, b2.PerMataKuliah, b2.PerSKS, b2.PerLab\r\n    from bipotmhsw bm\r\n      left outer join bipot2 b2 on b2.BIPOT2ID = bm.BIPOT2ID\r\n      left outer join saat s on b2.SaatID = s.SaatID\r\n\t  left outer join bipotnama bn on bn.BIPOTNamaID = bm.BIPOTNamaID\r\n\twhere bm.MhswID = '{$MhswID}'\r\n      and bm.PMBMhswID = 1\r\n      and bm.TahunID = '{$khs['TahunID']}'\r\n      and bm.KodeID = '" . KodeID . "'\r\n      and bm.NA = 'N'\r\n      order by bm.TagihanID, b2.Prioritas, bm.TrxID DESC, bm.BIPOTMhswID";
    //order by bm.TrxID, bm.BIPOTMhswID
    $r = _query($s);
    $r2 = _query($s);
    $n = 0;
    $sisa = 0;
    $potongan = 0;
    $arrPotongan = array();
    echo "<table class=box cellspacing=1 width=100%>";
    echo "<tr><th class=ttl colspan=7>Detail Biaya</th></tr>";
    echo "<tr>\r\n      <th class=ttl>#</th>\r\n      <th class=ttl>Nama Biaya<hr size=1 color=silver />Saat Bayar</th>\r\n      <th class=ttl width=100>Jumlah\r\n        <hr size=1 color=silver />\r\n        Besar Biaya</th>\r\n      <th class=ttl width=100>Sub Total</th>\r\n      <th class=ttl width=100>Sdh Dibayar</th>\r\n      <th class=ttl width=100>Dibayarkan</th>\r\n      </tr>";
    $grpTagihanID = "xxxyyyxzzzss121";
    $jmlarrPotongan = array();
    $jmlPotongan = array();
    while ($wx = _fetch_array($r)) {
        //22 juli 2013
        if ($wx['TagihanID'] != $grpTagihanID) {
            $grpTagihanID = $wx['TagihanID'];
            $arrPotongan[$wx['TambahanNama']] = 0;
            //$testx = 0;
            $potongan = 0;
        }
        if ($wx['TrxID'] < 1) {
            // hitung potongan
            //potongan
            //if ($wx['PerMataKuliah'] == 'Y' or $wx['PerSKS'] == 'Y' or $wx['PerLab'] == 'Y') {
            $arrPotongan[$wx['TambahanNama']] += $wx['Jumlah'] * $wx['Besar'];
            //$testx += $wx['Jumlah'] * $wx['Besar'];
            $jmlarrPotongan[$wx['TagihanID']] = $arrPotongan[$wx['TambahanNama']];
            //} else {
            $potongan += $wx['Jumlah'] * $wx['Besar'];
            $jmlPotongan[$wx['TagihanID']] = $potongan;
            //}
            //echo 'test='.$grpTagihanID.' = '.$testx.'<br>';
        }
    }
    // while
    // tampilkan
    while ($w = _fetch_array($r2)) {
        /* if ($w['TrxID'] < 1) { // hitung potongan            
           //potongan
           if ($w['PerMataKuliah'] == 'Y' or $w['PerSKS'] == 'Y' or $w['PerLab'] == 'Y') {
           $arrPotongan[$w['TambahanNama']] += $w['Jumlah'] * $w['Besar'];
           } else {
           $potongan += $w['Jumlah'] * $w['Besar'];
           }
           } else { */
        // hitung tagihan
        if ($w['TrxID'] >= 1) {
            $arrPotongan[$w['TambahanNama']] = $jmlarrPotongan[$w['TagihanID']];
            $potongan = $jmlPotongan[$w['TagihanID']];
            //tagihan
            $n++;
            if ($w['PerMataKuliah'] == 'Y' or $w['PerSKS'] == 'Y' or $w['PerLab'] == 'Y') {
                $potonganpartial = $arrPotongan[$w['TambahanNama']];
                if ($potonganpartial > 0 and $w['DipotongBeasiswa'] == 'Y') {
                    if ($potonganpartial >= $w['SISA']) {
                        $Dibayar = $w['SubTTL'];
                        $selisih = 0;
                        $sisa += $selisih;
                        $arrPotongan[$w['TambahanNama']] -= $w['SISA'];
                    } else {
                        $selisih = $w['SISA'] - $potonganpartial;
                        $Dibayar = $w['Dibayar'] + $potonganpartial;
                        $sisa += $selisih;
                        $arrPotongan[$w['TambahanNama']] = 0;
                    }
                } else {
                    $Dibayar = $w['Dibayar'];
                    $selisih = $w['SISA'];
                    $sisa += $selisih;
                }
            } else {
                // bukan Per matakuliah, per sks atau per lab
                if ($potongan > 0 and $w['DipotongBeasiswa'] == 'Y') {
                    if ($potongan >= $w['SISA']) {
                        $Dibayar = $w['SubTTL'];
                        $selisih = 0;
                        $sisa += $selisih;
                        $potongan -= $w['SISA'];
                    } else {
                        $selisih = $w['SISA'] - $potongan;
                        $Dibayar = $w['Dibayar'] + $potongan;
                        $sisa += $selisih;
                        $potongan = 0;
                    }
                } else {
                    $Dibayar = $w['Dibayar'];
                    $selisih = $w['SISA'];
                    $sisa += $selisih;
                }
            }
            if ($Dibayar >= $w['Jumlah'] * $w['Besar']) {
                $ro = 'readonly=TRUE';
                $c = "class=nac";
            } else {
                $ro = '';
                $c = "class=ul";
            }
            $SubTTL = number_format($w['SubTTL'], 2, ',', '.');
            $Dibayar = number_format($Dibayar, 2, ',', '.');
            echo "<tr>\r\n            <td class=inp>{$n}</td>\r\n            <td {$c}><b>{$w['Nama']}</b><br /><sup>{$w['TambahanNama']}</sup><div align=right><sub>{$w['_saat']}</sub></div></td>\r\n            <td {$c}><sup>{$w['JML']} &times;</sup><br /><div align=right>{$w['BSR']}</div></td>\r\n            <td {$c} align=right><a href='#' onClick=\"javascript:SetBayar({$n}, {$selisih}); HitungUlang();\">{$SubTTL} &raquo;</a> <input type=hidden name='SUBTTL_{$n}' value='{$w['SubTTL']}' /></td>\r\n            <td {$c} align=right>{$Dibayar}</td>\r\n            <td {$c}><input type=hidden name='BYRID_{$n}' value='{$w['BIPOTMhswID']}' /><input type=text name='BYR_{$n}' value='0' size=10 maxlength=20 style='text-align:right' onChange='HitungUlang()' {$ro} /></td>\r\n            </tr>";
        }
        // if
    }
    // while
    $_sisa = number_format($sisa);
    echo "<input type=hidden name='CNT' value='{$n}' />";
    echo "<tr><td bgcolor=silver colspan=10 height=1></td></tr>";
    echo "<tr>\r\n    <td class=ul1 colspan=4 align=right>Total Yg Harus Dibayar:</td>\r\n    <td class=ul1 align=right><font size=+1>{$_sisa}</font></td>\r\n    <td class=ul1><input type=text name='TTLBYR' size=10 maxlength=50 readonly=TRUE style='text-align:right' /></td>\r\n    </tr>";
    echo "<tr>\r\n    <td class=ul1 colspan=10 align=center>\r\n    <input type=submit  name='Simpan' value='Simpan' />\r\n    <input type=button name='Batal' value='Batal' onClick=\"window.close()\" />\r\n    </td></tr>";
    echo "</form>";
    echo "</table></p>";
    echo <<<ESD
  <script>
  function SetBayar(n, jml) {
    //alert("frmBayar.BYR_" + n + ".value = 'test';");
    eval("frmBayar.BYR_" + n + ".value = '" + jml +"';");
  }
  </script>
ESD;
    HitungUlang($n);
}
示例#2
0
function TampilkanDetailBiaya($MhswID, $mhsw, $khs, $md)
{
    //  $s = "select bm.*, s.Nama as _saat,
    //      format(bm.Jumlah, 0) as JML,
    //      format(bm.Besar, 0) as BSR,
    //      (bm.Jumlah * bm.Besar) as SubTTL,
    //      ((bm.TrxID * bm.Jumlah * bm.Besar) - bm.Dibayar) as SISA,
    //	  bn.DipotongBeasiswa, b2.PerMataKuliah, b2.PerSKS, b2.PerLab
    //    from bipotmhsw bm
    //      left outer join bipot2 b2 on b2.BIPOT2ID = bm.BIPOT2ID
    //      left outer join saat s on b2.SaatID = s.SaatID
    //	  left outer join bipotnama bn on bn.BIPOTNamaID = bm.BIPOTNamaID
    //	where bm.MhswID = '$MhswID'
    //      and bm.PMBMhswID = 1
    //      and bm.TahunID = '$khs[TahunID]'
    //      and bm.KodeID = '".KodeID."'
    //      and bm.NA = 'N'
    //	  and (bm.Dibayar - (bm.TrxID * bm.Jumlah * bm.Besar) > 0)
    //    order by bm.TrxID, bm.BIPOTMhswID";
    $s = "select bm.*, s.Nama as _saat,\r\n      format(bm.Jumlah, 0) as JML,\r\n      format(bm.Besar, 0) as BSR,\r\n      (bm.Jumlah * bm.Besar) as SubTTL,\r\n      ((bm.Jumlah * bm.Besar) - bm.Dibayar) as SISA,\r\n      bn.DipotongBeasiswa, b2.PerMataKuliah, b2.PerSKS, b2.PerLab\r\n    from bipotmhsw bm\r\n      left outer join bipot2 b2 on b2.BIPOT2ID = bm.BIPOT2ID\r\n      left outer join saat s on b2.SaatID = s.SaatID\r\n\t  left outer join bipotnama bn on bn.BIPOTNamaID = bm.BIPOTNamaID\r\n\twhere bm.MhswID = '{$MhswID}'\r\n      and bm.PMBMhswID = 1\r\n      and bm.TahunID = '{$khs['TahunID']}'\r\n      and bm.KodeID = '" . KodeID . "'\r\n      and bm.NA = 'N'\r\n      order by bm.TagihanID, bm.TrxID , bm.BIPOTMhswID";
    //order by bm.TagihanID, b2.Prioritas, bm.TrxID DESC, bm.BIPOTMhswID
    $r = _query($s);
    $n = 0;
    $sisa = 0;
    $potongan = 0;
    $arrPotongan = array();
    echo "<table class=box cellspacing=1 width=100%>";
    echo "<tr><th class=ttl colspan=7>Detail Biaya</th></tr>";
    echo "<tr>\r\n    <th class=ttl>#</th>\r\n    <th class=ttl>Nama Biaya<hr size=1 color=silver />Saat Bayar</th>\r\n    <th class=ttl width=100>Jumlah\r\n      <hr size=1 color=silver />\r\n      Besar Biaya</th>\r\n    <th class=ttl width=100>Sub Total</th>\r\n    <th class=ttl width=100>Sdh Dibayar</th>\r\n    <th class=ttl width=100>Dibayarkan</th>\r\n    </tr>";
    while ($w = _fetch_array($r)) {
        if ($w['TrxID'] < 1) {
            $potongan += $w['Jumlah'] * $w['Besar'];
        } else {
            $n++;
            if ($w['PerMataKuliah'] == 'Y' or $w['PerSKS'] == 'Y' or $w['PerLab'] == 'Y') {
                $potonganpartial = $arrPotongan[$w['TambahanNama']];
                if ($potonganpartial > 0 and $w['DipotongBeasiswa'] == 'Y') {
                    if ($potonganpartial >= $w['SISA']) {
                        $Dibayar = $w['SubTTL'];
                        $selisih = 0;
                        $sisa += $selisih;
                        $arrPotongan[$w['TambahanNama']] -= $w['SISA'];
                    } else {
                        $selisih = $w['SISA'] - $potonganpartial;
                        $Dibayar = $w['Dibayar'] + $potonganpartial;
                        $sisa += $selisih;
                        $arrPotongan[$w['TambahanNama']] = 0;
                    }
                } else {
                    $Dibayar = $w['Dibayar'] + $potongan;
                    $selisih = $w['SISA'] - $potongan;
                    $sisa += $selisih;
                }
            } else {
                if ($potongan > 0 and $w['DipotongBeasiswa'] == 'Y') {
                    if ($potongan >= $w['SISA']) {
                        $Dibayar = $w['Dibayar'] + $potongan;
                        //$selisih = 0;
                        $selisih = $w['SISA'] - $potongan;
                        $sisa += $selisih;
                        //$potongan -= $w['SISA'];
                        $potongan = 0;
                    } else {
                        $selisih = $w['SISA'] - $potongan;
                        $Dibayar = $w['Dibayar'] + $potongan;
                        $sisa += $selisih;
                        $potongan = 0;
                    }
                } else {
                    $Dibayar = $w['Dibayar'] + $potongan;
                    $selisih = $w['SISA'] - $potongan;
                    $sisa += $selisih;
                }
            }
            $ro = '';
            $c = "class=ul";
            $SubTTL = number_format($w['SubTTL'], 2, ',', '.');
            $Dibayar = number_format($Dibayar, 2, ',', '.');
            echo "<tr>\r\n\t\t  <td class=inp>{$n}</td>\r\n\t\t  <td {$c}><b>{$w['Nama']}</b>\r\n\t\t\t<br />\r\n\t\t\t<sup>{$w['TambahanNama']}</sup>\r\n\t\t\t<div align=right><sub>{$w['_saat']}</sub></div></td>\r\n\t\t  <td {$c}><sup>{$w['JML']} &times;</sup><br />\r\n\t\t\t<div align=right>{$w['BSR']}</div>\r\n\t\t\t</td>\r\n\t\t  <td {$c} align=right><a href='#' onClick=\"javascript:SetBayar({$n}, {$selisih}); HitungUlang();\">{$SubTTL} &raquo;</a></td>\r\n\t\t  <td {$c} align=right>{$Dibayar}</td>\r\n\t\t  <td {$c}>\r\n\t\t\t<input type=hidden name='BYRID_{$n}' value='{$w['BIPOTMhswID']}' />\r\n\t\t\t<input type=text name='BYR_{$n}' value='0' size=10 maxlength=20 style='text-align:right' onChange='HitungUlang()' {$ro} />\r\n\t\t\t</td>\r\n\t\t  </tr>";
        }
        /*
         }
        */
    }
    if ($sisa > 0) {
        $sisa = 0;
    } else {
        $sisa = $sisa;
    }
    $_sisa = number_format(-1 * $sisa);
    echo "<input type=hidden name='CNT' value='{$n}' />";
    echo "<input type=hidden name='sisane' value='{$sisa}' />";
    echo "<tr><td bgcolor=silver colspan=10 height=1></td></tr>";
    echo "<tr>\r\n    <td class=ul1 colspan=4 align=right>Total yang Dapat Ditarik:</td>\r\n    <td class=ul1 align=right><font size=+1>{$_sisa}</font></td>\r\n    <td class=ul1><input type=text name='TTLBYR' size=10 maxlength=50 readonly=TRUE style='text-align:right' /></td>\r\n    </tr>";
    echo "<tr>\r\n    <td class=ul1 colspan=10 align=center>\r\n    <input type=submit  name='Simpan' value='Simpan' />\r\n    <input type=button name='Batal' value='Batal' onClick=\"window.close()\" />\r\n    </td></tr>";
    echo "</form>";
    echo "</table></p>";
    echo <<<ESD
  <script>
  function SetBayar(n, jml) {
    if(jml <0){
    eval("frmBayar.BYR_" + n + ".value = '" + (jml*-1) +"';");
    }
  }
  </script>
ESD;
    HitungUlang($n);
}
示例#3
0
function TampilkanDetailBiaya($pmbid, $pmb, $md)
{
    $s = "select bm.*, s.Nama as _saat,\r\n      format(bm.Jumlah, 0) as JML,\r\n      format(bm.Besar, 0) as BSR,\r\n      (bm.Jumlah * bm.Besar) as SubTTL,\r\n      ((bm.Jumlah * bm.Besar) - bm.Dibayar) as SISA,\r\n\t  bn.DipotongBeasiswa\r\n    from bipotmhsw bm\r\n      left outer join bipot2 b2 on b2.BIPOT2ID = bm.BIPOT2ID\r\n      left outer join saat s on b2.SaatID = s.SaatID\r\n\t  left outer join bipotnama bn on bn.BipotNamaID = bm.BipotNamaID\r\n\twhere bm.PMBID = '{$pmbid}'\r\n      and bm.PMBMhswID = 0\r\n      and bm.TahunID = '{$pmb['PMBPeriodID']}'\r\n      and bm.KodeID = '" . KodeID . "'\r\n    order by bm.TagihanID, bm.TrxID, bm.BIPOTMhswID";
    //order by bm.TrxID, bm.BIPOTMhswID
    $r = _query($s);
    $r2 = _query($s);
    //echo "<pre>$s</pre>";
    $n = 0;
    $sisa = 0;
    $potongan = 0;
    echo "<table class=box cellspacing=1 width=100%>";
    echo "<tr><th class=ttl colspan=7>Detail Biaya</th></tr>";
    echo "<tr>\r\n    <th class=ttl>#</th>\r\n    <th class=ttl>Nama Biaya<hr size=1 color=silver />Saat Bayar</th>\r\n    <th class=ttl width=100>Jumlah\r\n      <hr size=1 color=silver />\r\n      Besar Biaya</th>\r\n    <th class=ttl width=100>Sub Total</th>\r\n    <th class=ttl width=100>Sdh Dibayar</th>\r\n    <th class=ttl width=100>Dibayarkan</th>\r\n    </tr>";
    while ($w = _fetch_array($r2)) {
        if ($w['TrxID'] < 1) {
            $potongan += $w['Jumlah'] * $w['Besar'];
        } else {
            $n++;
            if ($potongan > 0 and $w['DipotongBeasiswa'] == 'Y') {
                if ($potongan >= $w['SISA']) {
                    $Dibayar = $w['SubTTL'];
                    $sisa += 0;
                    $potongan -= $w['SISA'];
                } else {
                    $selisih = $w['SISA'] - $potongan;
                    $Dibayar = $w['Dibayar'] + $potongan;
                    $sisa += $selisih;
                    $potongan = 0;
                }
            } else {
                $Dibayar = $w['Dibayar'];
                $selisih = $w['SISA'];
                $sisa += $selisih;
            }
            if ($Dibayar >= $w['Jumlah'] * $w['Besar']) {
                $ro = 'readonly=TRUE';
                $c = "class=nac";
            } else {
                $ro = '';
                $c = "class=ul";
            }
            $Dibayar = number_format($Dibayar, 2, ',', '.');
            $SubTTL = number_format($w['SubTTL'], 2, ',', '.');
            echo "<tr>\r\n\t\t  <td class=inp>{$n}</td>\r\n\t\t  <td {$c}><b>{$w['Nama']}</b>\r\n\t\t\t<br />\r\n\t\t\t<div align=right><sub>{$w['_saat']}</sub></div></td>\r\n\t\t  <td {$c}><sup>{$w['JML']} &times;</sup><br />\r\n\t\t\t<div align=right>{$w['BSR']}</div>\r\n\t\t\t</td>\r\n\t\t  <td {$c} align=right><a href='#' onClick=\"javascript:SetBayar({$n}, {$selisih}); HitungUlang();\">{$SubTTL}<a><input type=hidden name='SUBTTL_{$n}' value='{$w['SubTTL']}' /></td>\r\n\t\t  <td {$c} align=right>{$Dibayar}</td>\r\n\t\t  <td {$c}>\r\n\t\t\t<input type=hidden name='BYRID_{$n}' value='{$w['BIPOTMhswID']}' />\r\n\t\t\t<input type=text name='BYR_{$n}' value='0' size=10 maxlength=20 style='text-align:right' onChange='HitungUlang()' {$ro} />\r\n\t\t\t</td>\r\n\t\t  </tr>";
        }
    }
    $_sisa = number_format($sisa);
    echo "<input type=hidden name='CNT' value='{$n}' />";
    echo "<tr><td bgcolor=silver colspan=10 height=1></td></tr>";
    echo "<tr>\r\n    <td class=ul1 colspan=4 align=right>Total Yg Harus Dibayar:</td>\r\n    <td class=ul1 align=right><font size=+1>{$_sisa}</font></td>\r\n    <td class=ul1><input type=text name='TTLBYR' size=10 maxlength=50 readonly=TRUE style='text-align:right' /></td>\r\n    </tr>";
    echo "<tr>\r\n    <td class=ul1 colspan=10 align=center>\r\n    <input type=submit  name='Simpan' value='Simpan' />\r\n    <input type=button name='Batal' value='Batal' onClick=\"window.close()\" />\r\n    </td></tr>";
    echo "</form>";
    echo "</table></p>";
    echo <<<ESD
\t  <script>
\t  function SetBayar(n, jml) {
\t\t//alert("frmBayar.BYR_" + n + ".value = 'test';");
\t\teval("frmBayar.BYR_" + n + ".value = '" + jml +"';");
\t  }
\t  </script>
ESD;
    HitungUlang($n);
}