-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.php
168 lines (163 loc) · 5.75 KB
/
admin.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
<?php
$page_title = 'Inicio';
require_once('includes/load.php');
// Verificar que nivel de usuario tiene permiso de ver esta página.
page_require_level(1);
$c_categorie = count_by_id('categories');
$c_product = count_by_id('products');
$c_sale = count_by_id('sales');
$c_user = count_by_id('users');
$products_sold = find_higest_saleing_product('10');
$recent_products = find_recent_product_added('5');
$recent_sales = find_recent_sale_added('5')
?>
<?php include_once('layouts/header.php'); ?>
<br>
<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="panel panel-box clearfix">
<div class="panel-icon pull-left bg-green">
<i class="glyphicon glyphicon-user"></i>
</div>
<div class="panel-value pull-right">
<h2 class="margin-top"> <?php echo $c_user['total']; ?> </h2>
<p class="text-muted">Usuarios</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="panel panel-box clearfix">
<div class="panel-icon pull-left bg-red">
<i class="glyphicon glyphicon-list"></i>
</div>
<div class="panel-value pull-right">
<h2 class="margin-top"> <?php echo $c_categorie['total']; ?> </h2>
<p class="text-muted">Categorías</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="panel panel-box clearfix">
<div class="panel-icon pull-left bg-blue">
<i class="glyphicon glyphicon-shopping-cart"></i>
</div>
<div class="panel-value pull-right">
<h2 class="margin-top"> <?php echo $c_product['total']; ?> </h2>
<p class="text-muted">Productos</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="panel panel-box clearfix">
<div class="panel-icon pull-left bg-yellow">
<i class="glyphicon glyphicon-usd"></i>
</div>
<div class="panel-value pull-right">
<h2 class="margin-top"> <?php echo $c_sale['total']; ?></h2>
<p class="text-muted">Ventas</p>
</div>
</div>
</div>
</div>
<br><br>
<div class="row">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<strong>
<span class="glyphicon glyphicon-th"></span>
<span>Productos más vendidos</span>
</strong>
</div>
<div class="panel-body">
<table class="table table-striped table-condensed">
<thead>
<tr>
<th class="text-center">Descripción</th>
<th class="text-center">Nº Ventas</th>
<th class="text-center">Cant. vendida</th>
<tr>
</thead>
<tbody>
<?php foreach ($products_sold as $product_sold): ?>
<tr>
<td><?php echo remove_junk(first_character($product_sold['name'])); ?></td>
<td class="text-center"><?php echo (int)$product_sold['totalSold']; ?></td>
<td class="text-center"><?php echo (int)$product_sold['totalQty']; ?></td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<strong>
<span class="glyphicon glyphicon-th"></span>
<span>ÚLTIMAS VENTAS</span>
</strong>
</div>
<div class="panel-body">
<table class="table table-striped table-condensed">
<thead>
<tr>
<th class="text-center" style="width: 50px;">#</th>
<th class="text-center">Descripción</th>
<th class="text-center">Fecha</th>
<th class="text-center">Venta</th>
</tr>
</thead>
<tbody>
<?php foreach ($recent_sales as $recent_sale): ?>
<tr>
<td class="text-center"><?php echo count_id();?></td>
<td>
<a href="edit_sale.php?id=<?php echo (int)$recent_sale['id']; ?>">
<?php echo remove_junk(first_character($recent_sale['name'])); ?>
</a>
</td>
<td class="text-center"><?php echo remove_junk(ucfirst($recent_sale['date'])); ?></td>
<td class="text-center">$<?php echo remove_junk(first_character($recent_sale['price'])); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<strong>
<span class="glyphicon glyphicon-th"></span>
<span>Productos recientemente añadidos</span>
</strong>
</div>
<div class="panel-body">
<div class="list-group" style="border: none; !important">
<?php foreach ($recent_products as $recent_product): ?>
<a class="list-group-item clearfix" style="border: none; border-top: 0.5px solid #dbdbdb; border-bottom: 0.5px solid #dbdbdb;" href="edit_product.php?id=<?php echo (int)$recent_product['id'];?>">
<h5 class="list-group-item-heading"><b>
<?php echo remove_junk(first_character($recent_product['name']));?>
<span class="label label-warning pull-right">
$<?php echo (int)$recent_product['sale_price']; ?>
</span>
</b></h5>
<span class="list-group-item-text pull-right">
<?php echo remove_junk(first_character($recent_product['categorie'])); ?>
</span>
</a>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</div>
<?php include_once('layouts/footer.php'); ?>