Example #1
0
		window.open('modul/laporan/cetak-pinjam.php?kode='+id);	
	}
}
</script>
<?php 
include '../../inc/inc.koneksi.php';
include '../../inc/fungsi_tanggal.php';
include '../../inc/fungsi_koperasi.php';
$tgl1 = !empty($_POST['tgl1']) ? $_POST['tgl1'] : '';
$tgl2 = !empty($_POST['tgl2']) ? $_POST['tgl2'] : '';
if (!empty($tgl1)) {
    $tgl1 = jin_date_sql($_POST['tgl1']);
    $tgl2 = jin_date_sql($_POST['tgl2']);
    $where = " WHERE tgl BETWEEN '{$tgl1}' AND '{$tgl2}'";
} else {
    $where = "";
}
echo "<table id='theTable' class='satu' width='100%'>\n\t\t<tr>\n\t\t\t<th width='5%'>No</th>\n\t\t\t<th>Nomor</th>\n\t\t\t<th>Tanggal</th>\n\t\t\t<th>No.Anggota</th>\n\t\t\t<th>Nama</th>\n\t\t\t<th>L/P</th>\n\t\t\t<th>Lama</th>\n\t\t\t<th>Jumlah</th>\n\t\t\t<th>Bunga</th>\n\t\t\t<th>Jumlah <br>Bayar</th>\n\t\t\t<th>Jumlah <br>Cicilan</th>\n\t\t\t<th>Sisa</th>\n\t\t\t<th>Hapus</th>\n\t\t\t<th>Cetak</th>\n\t\t</tr>";
$sql = "SELECT a.*,b.namaanggota,b.jk\n\t\t\t\tFROM pinjaman as a\n\t\t\t\tJOIN nasabah as b\n\t\t\t\tON a.noanggota=b.noanggota\n\t\t\t\t{$where}\n\t\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']);
    $jml_cicilan = sisa($rows['id_pinjam']);
    $sisa = $jml_bayar - $jml_cicilan;
    echo "<tr>\n\t\t\t\t<td align='center'>{$no}</td>\n\t\t\t\t<td>" . $rows['id_pinjam'] . "</td>\n\t\t\t\t<td align='center'>" . jin_date_str($rows['tgl']) . "</td>\n\t\t\t\t<td align='center'>" . $rows['noanggota'] . "</td>\n\t\t\t\t<td>" . $rows['namaanggota'] . "</td>\n\t\t\t\t<td align='center'>" . $rows['jk'] . "</td>\n\t\t\t\t<td align='center'>" . $rows['lama'] . "</td>\n\t\t\t\t<td align='right'>" . number_format($rows['jumlah']) . "</td>\n\t\t\t\t<td align='center'>" . $rows['bunga'] . "</td>\n\t\t\t\t<td align='center'>" . number_format($jml_bayar) . "</td>\n\t\t\t\t<td align='center'>" . number_format($jml_cicilan) . "</td>\n\t\t\t\t<td align='center'>" . number_format($sisa) . "</td>\n\t\t\t\t<td align='center'>\n\t\t\t\t<a href='javascript:deleteRow(\"{$rows['id_pinjam']}\")'>Hapus</a>\t\t\t\n\t\t\t\t</td>\n\t\t\t\t<td align='center'>\n\t\t\t\t<a href='javascript:CetakRow(\"{$rows['id_pinjam']}\")'>Cetak</a>\t\t\t\n\t\t\t\t</td>\n\t\t\t</tr>";
    $no++;
    $gtotal = $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    </tr>\n\t</table>";
Example #2
0
$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);
    }
    echo "<tr>\r\n\t\t\t<td align='center'>{$no}</td>\r\n\t\t\t<td align='center'>{$r_data['id_pinjam']}</td>\r\n\t\t\t<td align='center'>{$tgl}</td>\r\n\t\t\t<td align='center'>{$r_data['noanggota']}</td>\r\n\t\t\t<td align='left'>{$r_data['namaanggota']}</td>\r\n\t\t\t<td align='center'>{$r_data['jk']}</td>\r\n\t\t\t<td align='center'>{$r_data['lama']}</td>\r\n\t\t\t<td align='right'>" . number_format($r_data['jumlah']) . "</td>\r\n\t\t\t<td align='center'>{$r_data['bunga']} %</td>\r\n\t\t\t<td align='right'>" . number_format($jml_bayar) . "</td>\r\n\t\t\t<td align='right'>" . number_format($jml_cicilan) . "</td>\r\n\t\t\t<td align='right'>" . number_format($sisa) . "</td>\r\n\t\t\t</tr>";