-
Notifications
You must be signed in to change notification settings - Fork 0
/
detalles.php
161 lines (138 loc) · 6.04 KB
/
detalles.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
<?php
include 'libreria/php/principal.php';
restricionAcceso();
$fecha = date("Y-m-d");
$hora = date("H:i:s");
$hoy = $fecha. " " .$hora;
$usuario = $_SESSION['IDusuario'];
// EXTRAER informaciónde la venta
$queryVentas = "SELECT id, total FROM tbl_venta WHERE usuario = '$usuario' AND fecha LIKE '$fecha%'";
$resultVentas = mysql_query($queryVentas) or die(mysql_error());
$datosVentas = mysql_fetch_array($resultVentas);
$numDatosVentas = mysql_num_rows($resultVentas);
$queryTotales = "SELECT SUM(total) AS totales FROM tbl_venta WHERE usuario = '$usuario' AND fecha LIKE '$fecha%'";
$resultTotales = mysql_query($queryTotales) or die(mysql_error());
$datosTotales = mysql_fetch_array($resultTotales);
/*
* EXTRAER NÚMERO DE PERSONAS DE UNA CUENTA
*
* Extracción del número de personas de una cuenta pasada como parámetro
*/
function mostrarNumPersonas($venta){
$query = "SELECT SUM( personas ) AS personas
FROM tbl_productos_venta
WHERE venta = '$venta'";
$result = mysql_query($query) or die(mysql_error());
$datos = mysql_fetch_array($result);
return $datos['personas'];
}
function numUsuarios($usuario, $fecha){
$cuenta = 0;
$queryVentas = "SELECT id FROM tbl_venta WHERE usuario = '$usuario' AND fecha LIKE '$fecha%'";
$resultVentas = mysql_query($queryVentas) or die(mysql_error());
$datosVentas = mysql_fetch_array($resultVentas);
do {
$venta = $datosVentas['id'];
$query = "SELECT SUM( personas ) AS personas FROM tbl_productos_venta
WHERE venta = '$venta'";
$result = mysql_query($query) or die(mysql_error());
$datos = mysql_fetch_array($result);
$suma = $datos['personas'];
$cuenta += $suma;
} while($datosVentas = mysql_fetch_array($resultVentas));
return $cuenta;
}
?>
<!DOCTYPE html>
<html lang="es-MX">
<head>
<meta charset="UTF-8" />
<title>Sistema PDV Tezontle Express</title>
<meta name="author" content="Fernando Magrosoto V. | [email protected]" />
<meta name="description" content="Sistema PDV para Tezontle Express" />
<meta name="keywords" content="PDV, magrosoto, tezontle, fernando magrosoto,
nimbus, digitae" />
<meta name="robots" content="INDEX,NOFOLLOW" />
<link rel="stylesheet" type="text/css" href="css/principal.css" />
<link href='http://fonts.googleapis.com/css?family=Roboto+Slab:400,700' rel='stylesheet' type='text/css'>
<script src="libreria/js/interno.js"></script>
</head>
<!-- Gracias por ver nuestro código
Este sitio está hecho en HTML5.
Desarrollado por Fernando Magrosoto V. - [email protected] -->
<body>
<!-- área del WRAPPER -->
<div id="contenedor-principal">
<!-- ZONA DE ENCABEZADO -->
<header>
<h1><img src="imagenes/express.png" alt="" /></h1>
</header>
<!-- FIN ENCABEZADO -->
<!-- Navegación -->
<nav>
<ul>
<li><a href="dashboard.php">Dashboard</a></li>
<li><a href="portero.php?accion=cerrarSesion">Cerrar sesión</a></li>
<li><em class="tip">Usuario activo: <?php echo $_SESSION['Nusuario']; ?></em></li>
</ul>
</nav>
<!-- ZONA DEL CUERPO -->
<section>
<div class="titulo">
<h2>Detalles de venta del día</h2>
</div>
<div class="fecha">Fecha: <?php echo mostrarFechaH($hoy, 1) ?></div>
<table class="detalles">
<thead>
<tr>
<th>ID de venta</th>
<th>Importe</th>
<th>No. de personas</th>
</tr>
</thead>
<tfoot>
<tr>
<td><?php echo $numDatosVentas; ?> ventas</td>
<td>Total $ <?php echo number_format($datosTotales['totales'], 2); ?></td>
<td><?php echo numUsuarios($usuario, $fecha); ?> usuarios del tren</td>
</tr>
</tfoot>
<tbody>
<?php do { ?>
<tr>
<td><?php echo $datosVentas['id'] ?></td>
<td>$ <?php echo $datosVentas['total'] ?></td>
<td><?php echo mostrarNumPersonas($datosVentas['id']) ?></td>
</tr>
<?php } while ($datosVentas = mysql_fetch_array($resultVentas)); ?>
</tbody>
</table>
<hr />
<div>
<button type="button"
name="nueva-venta"
onclick="nuevaVenta();">Nueva venta</button>
</div>
</section>
<!-- fin CUERPO -->
<!-- ZONA DE PIE DE PÁGINA -->
<footer>
<div class="legales">
<p>©2013 - Sistema PDV Tezontle Express</p>
<p>Todos los Derechos Reservados</p>
</div>
<div class="creditos">
<a href="javascript:void(0);"
onclick="nimbus();">
<img src="imagenes/logoNimbus.png"
alt="Tecnología NIMBUS"
title="Tecnología NIMBUS"
height="35" />
</a>
</div>
</footer>
<!-- FIN DE PIE DE PÁGINA -->
</div>
<!-- fin WRAPPER -->
</body>
</html>