forked from siamon123/warehouse-inventory-system
/
home.php
155 lines (148 loc) · 4.69 KB
/
home.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
<?php
require_once('includes/load.php');
if (!$session->isUserLoggedIn(true)) { redirect('index.php', false);}
?>
<?php
$c_categorie = count_categories();
$c_product = count_products();
$c_sale = count_sales();
$c_user = count_users();
$products_sold = find_higest_sale_product();
$recent_products = find_recent_product_added();
$recent_sales = find_recent_sale_added()
?>
<?php include_once('layouts/header.php'); ?>
<div class="row">
<div class="col-md-6">
<?php echo display_msg($msg); ?>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="alert info-box clearfix">
<div class="alert btn-danger pull-left">
<i class="glyphicon glyphicon-user"></i>
</div>
<strong>Total User</strong>
<span> <?php echo $c_user['total_user']; ?> </span>
</div>
</div>
<div class="col-md-3">
<div class="alert info-box clearfix">
<div class="alert btn-success pull-left">
<i class="glyphicon glyphicon-indent-left"></i>
</div>
<strong>Total calegorie</strong>
<span> <?php echo $c_categorie['total_cat']; ?> </span>
</div>
</div>
<div class="col-md-3">
<div class="alert info-box clearfix">
<div class="alert btn-info pull-left">
<i class="glyphicon glyphicon-th-large"></i>
</div>
<strong>Total Product</strong>
<span> <?php echo $c_product['total_pro']; ?> </span>
</div>
</div>
<div class="col-md-3">
<div class="alert info-box clearfix">
<div class="alert btn-warning pull-left">
<i class="glyphicon glyphicon-th-list"></i>
</div>
<strong>Total Sale</strong>
<span> <?php echo $c_sale['total_sale']; ?> </span>
</div>
</div>
</div>
<div class="padding-top">
<div class="row">
<div class="col-md-6">
<div class="panel panel-success">
<div class="panel-heading">
<h4>Highest saleing Products</h4>
</div>
<div class="panel-body">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Title</th>
<th>Total Sold</th>
<th>Total Quantity</th>
<tr>
</thead>
<tbody>
<?php foreach ($products_sold as $product_sold): ?>
<tr>
<td><?php echo remove_junk(ucfirst($product_sold['name'])); ?></td>
<td><?php echo (int)$product_sold['Totalsold']; ?></td>
<td><?php echo (int)$product_sold['Totalquantity']; ?></td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="panel panel-primary">
<div class="panel-heading">
<h4>Recently Added Products</h4>
</div>
<div class="panel-body">
<ul class="list-group">
<?php foreach ($recent_products as $recent_product): ?>
<li class="list-group-item">
<a href="edit_product.php?id=<?php echo (int)$recent_product['id']; ?>">
<h4 class="list-group-item-heading"><?php echo remove_junk(ucfirst($recent_product['name'])); ?>
<span class="label label-warning pull-right">
$<?php echo (int)$recent_product['sale_price']; ?>
</span>
</h4>
</a>
<span class="list-group-item-text">
<?php echo remove_junk(ucfirst($recent_product['categorie_name'])); ?>
</span>
<?php endforeach; ?>
<ul>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-warning">
<div class="panel-heading">
<h4>Latest Sales</h4>
</div>
<div class="panel-body">
<table class="table">
<thead>
<tr>
<th>Sale ID</th>
<th>Product Name</th>
<th>Date</th>
<th>Total Sale</th>
</tr>
</thead>
<tbody>
<?php foreach ($recent_sales as $recent_sale): ?>
<tr>
<td>
<a href="edit_sale.php?id=<?php echo (int)$recent_sale['id']; ?>">
<?php echo (int)$recent_sale['id']; ?>
</a>
</td>
<td><?php echo remove_junk(ucfirst($recent_sale['name'])); ?></td>
<td><?php echo remove_junk(ucfirst($recent_sale['date'])); ?></td>
<td>$<?php echo remove_junk(ucfirst($recent_sale['price'])); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php include_once('layouts/footer.php'); ?>