You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
4.3 KiB
PHP
101 lines
4.3 KiB
PHP
<?php
|
|
include "../func_lib.php";
|
|
|
|
session_start();
|
|
if($_SESSION['validUser'] !== TRUE)
|
|
{
|
|
header("location: ./index.php");
|
|
exit();
|
|
}
|
|
|
|
echo "<style type='text/css'>";
|
|
echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}";
|
|
echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}";
|
|
echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}";
|
|
echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}";
|
|
echo "body {font-size:9pt;}";
|
|
echo "div.luar{text-align:left;margin-left:150px;}";
|
|
echo ".header{font-weight:bold;text-align:center;}";
|
|
echo ".isi{text-align:left;}";
|
|
echo "</style>";
|
|
|
|
$startDate = decTgl($_POST['startDate']);
|
|
$endDate = decTgl($_POST['endDate']);
|
|
$kodeplg = $_POST['kodepelanggan'];
|
|
|
|
if(bukaKoneksi()){
|
|
global $conn;
|
|
IF (strlen($startDate) > 2 && strlen($endDate) > 2 && $kodeplg !=''){
|
|
$query = "select t.tgl_byr,t.kd_plg,p.nama,p.upline,t.no_bon,t.jumlah_bon,t.bayar_bon,t.kd_kasir
|
|
from pelanggan p,bayar_bon t
|
|
where t.kd_plg = p.kd_customer
|
|
and date(t.tgl_byr) between '$startDate' and '$endDate'
|
|
and (t.kd_plg = '$kodeplg' or p.upline = '$kodeplg')
|
|
order by t.tgl_byr,t.no_bon ";
|
|
}elseif ($startDate != '' && $endDate != '' && $kodeplg =='' ){
|
|
$query = "select t.tgl_byr,t.kd_plg,p.nama,p.upline,t.no_bon,t.jumlah_bon,t.bayar_bon,t.kd_kasir
|
|
from pelanggan p,bayar_bon t
|
|
where t.kd_plg = p.kd_customer
|
|
and date(t.tgl_byr) between '$startDate' and '$endDate'
|
|
order by t.tgl_byr,t.kd_plg";
|
|
}elseif (strlen($startDate) <= 2 && strlen($endDate) <= 2 && $kodeplg !=''){
|
|
$query = "select t.tgl_byr,t.kd_plg,p.nama,p.upline,t.no_bon,t.jumlah_bon,t.bayar_bon,t.kd_kasir
|
|
from pelanggan p,bayar_bon t
|
|
where t.kd_plg = p.kd_customer
|
|
and (t.kd_plg = '$kodeplg' or p.upline = '$kodeplg')
|
|
order by t.tgl_byr,t.no_bon";
|
|
}
|
|
$querynama = "select nama from pelanggan where kd_customer = '$kodeplg'";
|
|
|
|
if($stmt = mysqli_prepare($conn,$query)){
|
|
mysqli_stmt_execute($stmt);
|
|
mysqli_stmt_store_result($stmt);
|
|
$cek = mysqli_stmt_num_rows($stmt);
|
|
if($cek >= 0){
|
|
mysqli_stmt_bind_result($stmt,$tahun,$strip,$kdbrg,$nmbrg,$nomor,$totNota,$hp,$kasir);
|
|
$ttJumlah = array();
|
|
|
|
$ttJumlah['hp'] = 0;
|
|
print("<center><div id=\"divprint\" >");
|
|
print("<h2>Laporan Rekap Titipan Bon</h2><br/><br/>");
|
|
print("<div class=\"luar\">TOKO ".$_SESSION['namatoko']."<br/>");
|
|
print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."<br/>");
|
|
print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."<br/>");
|
|
if($stmtnama = mysqli_prepare($conn,$querynama)){
|
|
mysqli_stmt_execute($stmtnama);
|
|
mysqli_stmt_store_result($stmtnama);
|
|
$ceknama = mysqli_stmt_num_rows($stmtnama);
|
|
if($ceknama > 0){
|
|
mysqli_stmt_bind_result($stmtnama,$nama);
|
|
|
|
while(mysqli_stmt_fetch($stmtnama)){
|
|
print("Nama Pelanggan : ".$nama."<br/>");
|
|
}
|
|
}
|
|
}
|
|
print("</div><br/>");
|
|
print("<table border=\"1\" class=\"tbl\">");
|
|
print("<tr class=\"header\"><td>Tanggal Titip</td><td>Kode Plg</td><td>Nama</td><td>Penanggung Jawab</td><td>Total Titipan</td><td>Kasir</td></tr>");
|
|
|
|
while(mysqli_stmt_fetch($stmt)){
|
|
$ttJumlah['hp'] += $hp;
|
|
$ttJumlah['rp'] += $totNota;
|
|
if ($hp != 0) {
|
|
print("<tr class=\"isi\"><td align=\"center\">".encTgl($tahun)."</td><td align=\"center\">$strip</td><td>$kdbrg</td><td>$nmbrg</td><td align=\"right\">".number_format($hp, 0, ",", ".")."</td><td>$kasir</td></tr>");
|
|
}
|
|
}
|
|
|
|
print("</table><br/>");
|
|
print("<div class=\"luar\"><table border=\"0\">");
|
|
|
|
print("<tr><td>Total Titipan Bon</td><td> : ".number_format($ttJumlah['hp'],0,',','.')."</td><td></td></tr>");
|
|
print("<tr><td>Saldo Titipan Bon</td><td> : ".number_format($ttJumlah['hp']-$ttJumlah['rp'],0,',','.')."</td><td></td></tr>");
|
|
print("</table></div></div></center>");
|
|
}else{
|
|
echo "Data tidak ditemukan!";
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
|