Ejemplo n.º 1
0
</script>

<?php 
//tampil_data1.php
include '../../inc/inc_koneksi.php';
include '../../inc/fungsi_tanggal.php';
include '../../inc/fungsi_koperasi.php';
if (isset($_POST['tgl1']) && isset($_POST['tgl2'])) {
    $tgl1 = date('Y-m-d', strtotime($_POST['tgl1']));
    $tgl2 = date('Y-m-d', strtotime($_POST['tgl2']));
    $where = " WHERE tgl BETWEEN '{$tgl1}' AND '{$tgl2}'";
} else {
    $where = "";
}
echo "<table id='theTable' width='100%'>\n\t<tr>\n\t\t<th width='5%'>No</th>\n\t\t<th>Nomor</th> \n\t\t<th>Tanggal</th>\n\t\t<th>No. Anggota</th>\n\t\t<th>Nama</th>\n\t\t<th>L/P</th>\n\t\t<th>Lama</th>\n\t\t<th>Jumlah</th>\n\t\t<th>Bunga</th>\n\t\t<th>Jumlah Bayar</th>\n\t\t<th>Jumlah Cicilan</th>\n\t\t<th>Sisa</th>\n\t\t<th>Hapus</th>\n\t\t<th>Cetak</th>\n\t</tr>";
$sql = "SELECT a.*,b.namaanggota,b.jk FROM pinjaman_header as a\n\t\t\tJOIN anggota as b\n\t\t\tON a.noanggota=b.noanggota\n\t\t\t{$where}\n\t\t\tORDER BY a.id_pinjam DESC";
$query = mysql_query($sql);
$no = 1;
$gtotal = 0;
while ($rows = mysql_fetch_array($query)) {
    $jml_bayar = jmlBayar($rows['id_pinjam']);
    //yg harus dibayar (tagihan)
    $jml_cicilan = cicilan($rows['id_pinjam']);
    //yg sudah dibayar
    $sisa = $jml_bayar - $jml_cicilan;
    echo "<tr>\n\t\t\t<td align='center'>{$no}</td>\n\t\t\t<td>" . $rows['id_pinjam'] . "</td>\n\t\t\t<td align='center'>" . jin_date_sql($rows['tgl']) . "</td>\n\t\t\t<td align='center'>" . $rows['noanggota'] . "</td>\n\t\t\t<td>" . $rows['namaanggota'] . "</td>\n\t\t\t<td align='center'>" . $rows['jk'] . "</td>\n\t\t\t<td align='center'>" . $rows['lama'] . "</td>\n\t\t\t<td align='center'>" . number_format($rows['jumlah']) . "</td>\n\t\t\t<td align='center'>" . $rows['bunga'] . "</td>\n\t\t\t<td align='center'>" . number_format($jml_bayar) . "</td>\n\t\t\t<td align='center'>" . number_format($jml_cicilan) . "</td>\n\t\t\t<td align='center'>" . number_format($sisa) . "</td> \n\t\t\t<td align='center'>\n\t\t\t<a href='javascript:deleteRow(\"" . $rows['id_pinjam'] . "\")'>Hapus</a>\n\t\t\t</td>\n\t\t\t<td align='center'>\n\t\t\t<a href='javascript:cetakRow(\"" . $rows['id_pinjam'] . "\")'>Cetak</a>\n\t\t\t</td>\n\t\t</tr>";
    $no++;
    $gtotal += $rows['jumlah'];
}
echo "\n\t<tr>\n\t\t<td colspan='7' align='center'>Total</td>\n\t\t<td align='right'><b>" . number_format($gtotal) . "</b></td>\n\t</tr>\n</table>";
Ejemplo n.º 2
0
//echo $query;
$data = mysql_query($query);
function myheader($judul_H)
{
    echo "<div class='header'>\r\n\t\t  <h2>" . $judul_H . "</h2>\r\n\t\t  </div>\r\n\t\t<table class='grid' >\r\n\t\t<tr>\r\n\t\t\t<th width='5%'>No</th>\r\n\t\t\t<th>Nomor</th>\r\n\t\t\t<th>Tanggal</th>\r\n\t\t\t<th>No.Anggota</th>\r\n\t\t\t<th>Nama</th>\r\n\t\t\t<th>L/P</th>\r\n\t\t\t<th>Lama</th>\r\n\t\t\t<th>Jumlah</th>\r\n\t\t\t<th>Bunga</th>\r\n\t\t\t<th>Jumlah <br>Bayar</th>\r\n\t\t\t<th>Jumlah <br>Cicilan</th>\r\n\t\t\t<th>Sisa</th>\r\n\t\t</tr>";
}
//echo $query;
function myfooter()
{
    echo "</table>";
}
$no = 1;
$page = 1;
while ($r_data = mysql_fetch_array($data)) {
    $tgl = jin_date_str($r_data['tgl']);
    $jml_bayar = jmlBayar($r_data[id_pinjam]);
    $jml_cicilan = sisa($r_data[id_pinjam]);
    $sisa = $jml_bayar - $jml_cicilan;
    $t_jml = $t_jml + $r_data['jumlah'];
    $t_jmlbayar = $t_jmlbayar + $jml_bayar;
    $t_jmlcicilan = $t_jmlcicilan + $jml_cicilan;
    $t_jmlsisa = $t_jmlsisa + $sisa;
    //$stotal = $stotal+$saldo;
    if ($no % 40 == 1) {
        if ($no > 1) {
            myfooter();
            echo "<div class=\"pagebreak\" align='right'>\r\n\t\t<div class='page' align='center'>Hal - {$page}</div>\r\n\t\t</div>";
            $page++;
        }
        myheader($judul_H);
    }