Cleopatra Minimarket
Report Pelanggan Tunai
"; echo "div#divprint{width:900px; border:0px solid #000; padding:20px 0; margin-bottom:25px;}"; echo "table.tbl {width:850px;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:10pt;}"; echo "div.luar{text-align:left;margin-left:150px;}"; echo ".header{font-weight:bold;text-align:center;}"; echo ".isi{text-align:left;}"; echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; echo ".master{text-align:left;}"; echo ""; require_once 'db_login.inc.php'; $startDate = decTgl($_POST['startDate']); // '2013-07-01' and '2013-08-31' $endDate = decTgl($_POST['endDate']); $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); $stmt = $mysqli->query("SELECT p.kd_customer,p.nama,sum(floor(m.jumlah_total/100000)) poin,count(m.no_nota) jmlTransaksi,sum(m.jumlah_total) rpTransaksi, tmpDetail.hp,sum(m.jumlah_total)-tmpDetail.hp bathi, (sum(m.jumlah_total)-tmpDetail.hp)/sum(m.jumlah_total)*100 profit FROM pelanggan p, m_nota_tunai m, (select p.kd_customer, p.nama,sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp from d_nota_tunai d,m_nota_tunai m, pelanggan p where d.no_nota = m.no_nota and p.kd_customer = m.kd_customer and d.harga_pokok IS NOT NULL and m.status_bayar = 'T' and m.no_nota_retur = '' and m.kd_customer != '' and m.status_nota = 'S' and date(m.tgl_nota) between '$startDate' and '$endDate' group by p.kd_customer ) tmpDetail WHERE m.status_bayar = 'T' and m.no_nota_retur = '' and m.kd_customer != '' and m.status_nota = 'S' and p.kd_customer = tmpDetail.kd_customer and p.kd_customer = m.kd_customer and date(m.tgl_nota) between '$startDate' and '$endDate' GROUP BY p.kd_customer ORDER BY poin DESC "); if($stmt->num_rows > 0) { print("
"); print("
"); print("
Kd.Plg
Nama
POIN
JML Trans.
Rp Trans.
Tot HP
Laba
Profit(%)
"); while($a = $stmt->fetch_array(MYSQLI_ASSOC)) { $kdplg = $a['kd_customer']; $nama = $a['nama']; $point = $a['poin']; $juml = $a['jmlTransaksi']; $rp = $a['rpTransaksi']; $hp = $a['hp']; $cwan = $a['bathi']; $profit = $a['profit']; print("
$kdplg
$nama
$point
$juml
".number_format($rp, 0, ",", ".")."
".number_format($hp, 0, ",", ".")."
".number_format($cwan, 0, ",", ".")."
".number_format($profit, 2, ",", ".")."
"); } print("
"); print("
"); $stmt->close(); } $mysqli->close(); ?>