-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaporan.php
65 lines (56 loc) · 2.35 KB
/
laporan.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
if( empty( $_SESSION['iduser'] ) ){
$_SESSION['err'] = '<strong>ERROR!</strong> Anda harus login terlebih dahulu.';
header('Location: ./');
die();
} else {
if( isset( $_REQUEST['sub'] )){
$sub = $_REQUEST['sub'];
include "laporan_tagihan.php";
} else {
if(isset($_REQUEST['submit'])){
$submit = $_REQUEST['submit'];
$tgl1 = $_REQUEST['tgl1'];
$tgl2 = $_REQUEST['tgl2'];
//echo $tgl1.'-'.$tgl2;
$q = "SELECT idtransaksi,total FROM transaksi WHERE tanggal BETWEEN '$tgl1' AND '$tgl2' ";
echo '<h2>Rekap Penjualan <small>'.$tgl1.' sampai '.$tgl2.'</small></h2><hr>';
echo '<a href="./cetak_data.php?tanggal1='.$tgl1.'&tanggal2='.$tgl2.'" class="noprint pull-right btn btn-default"><span class="glyphicon glyphicon-print" aria-hidden="true"></span> Cetak</a>';
} else {
$tgl = date("Y/m/d");
$q = "SELECT idtransaksi,total FROM transaksi WHERE tanggal='$tgl' ";
echo '<h2>Data Penjualan <small>'.$tgl.'</small></h2><hr>';
}
$sql = mysql_query($q) or die(mysql_error());
echo '<div class="row">';
echo '<div class="col-md-5">';
?>
<div class="well well-sm noprint">
<form class="form-inline" role="form" method="post" action="">
<div class="form-group">
<label class="sr-only" for="tgl1">Mulai</label>
<input type="date" class="form-control" id="tgl1" name="tgl1">
</div>
<div class="form-group">
<label class="sr-only" for="tgl2">Hingga</label>
<input type="date" class="form-control" id="tgl2" name="tgl2">
</div>
<button type="submit" name="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span> Tampilkan</button>
</form>
</div>
<?php
echo '<table class="table table-bordered">';
echo '<tr class="info"><th width="50">#</th><th>ID Transaksi</th><th>Jumlah</th></tr>';
$total = 0;
$no=1;
while(list($transaksi,$jml) = mysql_fetch_array($sql)){
echo '<tr><td>'.$no.'</td><td>'.$transaksi.'</td><td><span class="pull-right">'.$jml.'</span></td></tr>';
$total += $jml;
$no++;
}
echo '<tr><td colspan="2"><span class="pull-right">T O T A L</span></td><td><span class="pull-right">'.$total.'</span></td></tr>';
echo '</table>';
echo '</div></div>';
}
}
?>