-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdashboard.php
177 lines (133 loc) · 6.99 KB
/
dashboard.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?php error_reporting(1); ?>
<?php include('./constant/layout/head.php');?>
<?php include('./constant/layout/header.php');?>
<?php include('./constant/layout/sidebar.php');?>
<?php
$sql = "SELECT * FROM product WHERE status = 1";
$query = $connect->query($sql);
$countProduct = $query->num_rows;
$orderSql = "SELECT * FROM orders WHERE order_status = 1";
$orderQuery = $connect->query($orderSql);
$countOrder = $orderQuery->num_rows;
$totalRevenue = 0;
while ($orderResult = $orderQuery->fetch_assoc()) {
//echo $orderResult['paid'];exit;
$totalRevenue += $orderResult['paid'];
}
$lowStockSql = "SELECT * FROM product WHERE quantity <= 3 AND status = 1";
$lowStockQuery = $connect->query($lowStockSql);
$countLowStock = $lowStockQuery->num_rows;
$userwisesql = "SELECT tbl_client.name , SUM(orders.grand_total) as totalorder,order_id FROM orders INNER JOIN tbl_client ON orders.client_name = tbl_client.id WHERE orders.order_status = 1 GROUP BY orders.client_name";
$userwiseQuery = $connect->query($userwisesql);
$userwieseOrder = $userwiseQuery->num_rows;
$connect->close();
?>
<style type="text/css">
.ui-datepicker-calendar {
display: none;
}
</style>
<div class="page-wrapper">
<div class="row page-titles">
<div class="col-md-12 align-self-center">
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-md-3 dashboard">
<div class="card" style="background: #2BC155">
<div class="media widget-ten">
<div class="media-left meida media-middle">
<span><i class="mdi mdi-gas-cylinder f-s-50"></i></span>
</div>
<div class="media-body media-text-right">
<h2 class="color-white"><?php echo $countProduct; ?></h2>
<a href="product.php"><p class="m-b-0">Total Cylinder</p></a>
</div>
</div>
</div>
</div>
<?php if(isset($_SESSION['userId']) && $_SESSION['userId']==1) { ?>
<div class="col-md-3 dashboard">
<div class="card" style="background:#A02CFA ">
<div class="media widget-ten">
<div class="media-left meida media-middle">
<span><i class="ti-user f-s-40"></i></span>
</div>
<div class="media-body media-text-right">
<h2 class="color-white"><?php echo 3 ?></h2>
<a href="#"><p class="m-b-0">Total Suppliers</p></a>
</div>
</div>
</div>
</div>
<?php }?>
<?php if(isset($_SESSION['userId']) && $_SESSION['userId']==1) { ?>
<div class="col-md-3 dashboard">
<div class="card" style="background-color: #F94687 ">
<div class="media widget-ten">
<div class="media-left meida media-middle">
<span><i class="ti-vector f-s-40"></i></span>
</div>
<div class="media-body media-text-right">
<h2 class="color-white"><?php echo $countOrder; ?></h2>
<a href="Order.php"><p class="m-b-0">Total Booking</p></a>
</div>
</div>
</div>
</div>
<?php }?>
<div class="col-md-3 dashboard">
<div class="card" style="background-color:#009688;">
<div class="media widget-ten">
<div class="media-left meida media-middle">
<span><i class="ti-credit-card f-s-40"></i></span>
</div>
<div class="media-body media-text-right">
<h2 class="color-white"><?php if($totalRevenue) {
echo $totalRevenue;
} else {
echo '0';
} ?></h2>
<a href="Order.php"><p class="m-b-0">Total Revenue</p></a>
</div>
</div>
</div>
</div>
<?php if(isset($_SESSION['userId']) && $_SESSION['userId']==1) { ?>
<div class="col-md-12">
<div class="card">
<div class="card-header">
<strong class="card-title">User Wise Booking</strong>
</div>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th scope="col">Name</th>
<!-- <th scope="col">Measurement</th> -->
<th scope="col">Booking Amount</th>
</tr>
</thead>
<tbody>
<?php while ($orderResult = $userwiseQuery->fetch_assoc()) { ?>
<tr>
<td><?php echo $orderResult['name']?></td>
<!-- <td><a href="viewMeasurement.php?id=<?php //echo $orderResult['order_id']?>"><button type="button" class="label label-success" ><h4>View Measurement</h4></button></a></td> -->
<td><?php echo $orderResult['totalorder']?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
<?php }?>
</div>
</div>
</div>
<?php include ('./constant/layout/footer.php');?>
<script>
$(function(){
$(".preloader").fadeOut();
})
</script>