-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdashboard_report.php
More file actions
79 lines (76 loc) · 2.53 KB
/
Copy pathdashboard_report.php
File metadata and controls
79 lines (76 loc) · 2.53 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
include('header.php');
checkUser();
userArea();
$from='';
$to='';
$sub_sql="";
if(isset($_GET['from'])){
$from=get_safe_value($_GET['from']);
}
if(isset($_GET['to'])){
$to=get_safe_value($_GET['to']);
}
if($from!=='' && $to!=''){
$sub_sql.=" and expense.expense_date between '$from' and '$to' ";
}
$res=mysqli_query($con,"select expense.price,category.name,expense.item,expense.expense_date from expense,category where expense.category_id=category.id and expense.added_by='".$_SESSION['UID']."' $sub_sql");
?>
<div class="main-content">
<div class="section__content section__content--p30">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div>
<h2>
<?php if($from!='' && $to!=''){ ?>
From <?php echo $from?>
:
To <?php echo $to?>
<?php } ?>
</h2>
<br/>
</div>
<?php
if(mysqli_num_rows($res)>0){
?>
<div class="table-responsive table--no-card m-b-30">
<table class="table table-borderless table-striped table-earning">
<tr>
<th>Category</th>
<th>Item</th>
<th>Expense Date</th>
<th>Price</th>
</tr>
<?php
$final_price=0;
while($row=mysqli_fetch_assoc($res)){
$final_price=$final_price+$row['price'];
?>
<tr>
<td><?php echo $row['name']?></td>
<td><?php echo $row['item']?></td>
<td><?php echo $row['expense_date']?></td>
<td><?php echo $row['price']?></td>
</tr>
<?php } ?>
<tr>
<th></th>
<th></th>
<th>Total</th>
<th><?php echo $final_price?></th>
</tr>
</table>
<?php } else {
echo "<b>No data found</b>";
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
include('footer.php');
?>