forked from kailIII/StockAPP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsulta.php
211 lines (211 loc) · 9.36 KB
/
consulta.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<?php
$numerosTotalSql= $db->SQL("SELECT COUNT(id) FROM cajatmp WHERE vendedor='{$usuarioApp['id']}'");
$numerosTotal = MysqliResultQualtiva($numerosTotalSql);
?>
<div class="col-md-9">
<div style="width:100%; height:300px; overflow: auto;">
<form name="EliminarCampos" id="EliminarCampos" method="post" action="">
<table class="table table-bordered">
<tr class="well">
<td style="display: none;"></td>
<td><input type="checkbox" value="1" id="todos" onclick="todosuno(this.value)" /></td>
<td><strong>Codigo</strong></td>
<td><strong>Producto</strong></td>
<td><strong>Cantidad</strong></td>
<td><strong>Stock</strong></td>
<td><strong>Precio</strong></td>
<td><strong>Importe</strong></td>
<td>
<button type="button" class="btn btn-primary btn-xs <?php if($numerosTotal <= 0): echo'disabled'; else: endif; ?>" data-toggle="modal" data-target="#EliminarVenta"><i class="fa fa-trash-o"></i> Limpiar Venta</button>
<!-- Modal -->
<div class="modal fade" id="EliminarVenta" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Eliminar Venta Actual</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" method="post" action="">
<input type="hidden" name="IdUsuario" value="<?php echo $usuarioApp['id']; ?>">
<div class="form-group">
<div class="col-md-12">
<div class="input-group">¿Está seguro que desea eliminar toda la venta actual?</div>
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<button type="button" class="btn btn-default" data-dismiss="modal" >Cerrar</button>
<button type="submit" name="EliminarTodo" class="btn btn-primary" onclick="$(this).button('loading');" >Si, Eliminar</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Modal Final -->
</td>
</tr>
<?php
$i = 0;
$cajatmpSql = $db->SQL("SELECT * FROM cajatmp WHERE vendedor='{$usuarioApp['id']}' ORDER BY id DESC");
while($cajatmp = $cajatmpSql->fetch_array()){
$i = $i + 1;
?>
<tr>
<td style="display: none;"><input name="IdProducto<?php echo $i; ?>" type="hidden" value="<?php echo $cajatmp['producto']; ?>" /></td>
<td><input id="ID<?php echo $i; ?>" name="IDS<?php echo $i; ?>" type="checkbox" value="<?php echo $cajatmp['id']; ?>" /></td>
<td>
<?php
$CodigoProductoSql = $db->SQL("SELECT codigo FROM `producto` WHERE id='{$cajatmp['producto']}'");
$CodigoProducto = $CodigoProductoSql->fetch_array();
echo $CodigoProducto['codigo'];
?>
</td>
<td>
<?php
$NombreProductoSql = $db->SQL("SELECT nombre FROM `producto` WHERE id='{$cajatmp['producto']}'");
$NombreProducto = $NombreProductoSql->fetch_array();
echo $NombreProducto['nombre'];
?>
</td>
<td><input type="hidden" name="cantidad<?php echo $i; ?>" value="<?php echo $cajatmp['cantidad']; ?>"><?php echo $cajatmp['cantidad']; ?></td>
<td>
<?php
if($cajatmp['stockTmp']>=1):
echo $cajatmp['stockTmp'];
else:
echo '<span class="label label-danger">'.$cajatmp['stockTmp'].'</span>';
endif;
?>
</td>
<td>$ <?php echo $cajatmp['precio']; ?></td>
<td>$ <?php echo $cajatmp['totalprecio']; ?></td>
<td>
<button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#EliminarProducto<?php echo $cajatmp['id']; ?>"><i class="fa fa-trash-o"></i></button>
<!-- Modal -->
<div class="modal fade" id="EliminarProducto<?php echo $cajatmp['id']; ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Eliminar <?php echo $cajatmp['producto']; ?> de la factura</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" method="post" action="">
<input type="hidden" name="IdCajatmp" value="<?php echo $cajatmp['id']; ?>">
<input type="hidden" name="IdProducto" value="<?php echo $cajatmp['producto']; ?>">
<input type="hidden" name="CantidadStock" value="<?php echo $cajatmp['cantidad']; ?>">
<div class="form-group">
<div class="col-sm-12">
<div class="input-group">
¿Está seguro que desea eliminar el producto?
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
<button type="submit" name="EliminarProducto" class="btn btn-primary" onclick="$(this).button('loading');" >Si, Eliminar</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Modal Final -->
<!-- Actulizar Apuesta-->
<button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#ActualizarCantidad<?php echo $cajatmp['id']; ?>"><i class="fa fa-edit"></i></button>
<!-- Modal -->
<div class="modal fade" id="ActualizarCantidad<?php echo $cajatmp['id']; ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Actualizar Cantidad de Producto</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" method="post" action="">
<input type="hidden" name="IdCajaTmp" value="<?php echo $cajatmp['id']; ?>">
<input type="hidden" name="IdProducto" value="<?php echo $cajatmp['producto']; ?>">
<input type="hidden" name="Precio" value="<?php echo $cajatmp['precio']; ?>">
<input type="hidden" name="CantidadAnterior" value="<?php echo $cajatmp['cantidad']; ?>">
<div class="col-md-12">
<div class="form-group">
<label class="control-label"> Cantidad</label>
<div class="input-group">
<span class="input-group-addon"><strong>#</strong></span>
<input type="number" min="1" step="1" maxlength="6" class="form-control" name="Cantidad" value="<?php echo $cajatmp['cantidad']; ?>" onkeypress="return PermitirSoloNumeros(event);" autocomplete="off" autofocus required />
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
<button type="submit" name="ActualizarCantidadCajaTmp" class="btn btn-primary" onclick="$(this).button('loading');" >Actualizar Cantidad de Productos</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Modal Final -->
</td>
</tr>
<?php
}
?>
<input type="hidden" value="<?php echo $i; ?>" name="contadorx"/>
</table>
</form>
</div>
</div>
<div class="col-md-3">
<?php
$netoSql= $db->SQL("SELECT SUM(totalprecio) AS deudatotal FROM cajatmp WHERE vendedor='{$usuarioApp['id']}'");
$neto = $netoSql->fetch_array();
$TipoDeCambioSql= $db->SQL("SELECT valor FROM `moneda` WHERE rango='2'");
$TipoDeCambio = $TipoDeCambioSql->fetch_assoc();
?>
<div class="panel panel-default">
<div class="panel-heading"><center><strong>Neto a Pagar</strong></center></div>
<div class="panel-body">
<h2 class="text-success" align="center">$ <?php echo $Vendedor->Formato($neto['deudatotal']); ?>
<?php
$TipoDeCambioActivoSql = $db->SQL("SELECT TipoCambio FROM `sistema`");
$TipoDeCambioActivo = $TipoDeCambioActivoSql->fetch_assoc();
if($TipoDeCambioActivo['TipoCambio'] == 1){
?>
<br/><small class="text-info" >¢ <?php echo $Vendedor->FormatoSaldo($neto['deudatotal']*$TipoDeCambio['valor']); ?></small></h2>
<?php
}else{
// Tipo Cambio deshabilitado
}
?>
</div>
<div class="panel-heading">
<center><strong>Cantidad de Productos: <br><span class="badge badge-success"><?php echo $numerosTotal; ?></span></strong></center>
</div>
</div>
<div class="form-group">
<?php
if($numerosTotal <= 0){
echo'
<button type="button" class="btn btn-default btn-lg btn-block" id="btsubmit" disabled>
<i class="fa fa-shopping-cart"></i> Registrar Compra
</button>';
}else{
?>
<button type="button" class="btn btn-primary btn-lg btn-block" id="btsubmit" data-toggle="modal" data-target="#RegistrarCompra"><i class="fa fa-shopping-cart"></i> Registrar Compra</button>
<?php
}
?>
</div>
<hr/>
<!-- Notificaciones -->
<?php include(MODULO.'notificacion.php'); ?>
<!-- Notificaciones fin -->
</div>