-
Notifications
You must be signed in to change notification settings - Fork 33
/
index.php
209 lines (204 loc) · 7.59 KB
/
index.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
<?php session_start();
include ('sistema/configuracion.php');
$usuario->LoginCuentaConsulta();
$usuario->VerificacionCuenta();
//$sistema->MonedaActiva();
?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8"/>
<title><?php echo TITULO ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="shortcut icon" href="<?php echo ESTATICO ?>img/favicon.ico"/>
<link rel="stylesheet" href="<?php echo ESTATICO ?>css/sweet-alert.css"/>
<link rel="stylesheet" href="<?php echo ESTATICO ?>css/bootstrap-combobox.css"/>
<?php include(MODULO.'Tema.CSS.php');?>
</head>
<body>
<?php
// Menu inicio
if($usuarioApp['id_perfil']==2){
include(MODULO.'menu_vendedor.php');
}elseif($usuarioApp['id_perfil']==1){
include(MODULO.'menu_admin.php');
}else{
echo'<meta http-equiv="refresh" content="0;url='.URLBASE.'cerrar-sesion"/>';
}
// Menu Fin
?>
<div id="wrap">
<div class="container">
<div class="page-header" id="banner">
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-4"></div>
</div>
</div>
<div class="row">
<?php
$CajaDeVenta->EliminarProducto();
$CajaDeVenta->LimpiarCarritoCompras();
$CajaDeVenta->ActualizarCantidadCajaTmp();
?>
<div class="row">
<div class="col-md-12">
<?php
$ComprobarCierreCajaSQL = $db->SQL("SELECT id, tipo FROM `cajaregistros` ORDER BY id DESC LIMIT 1");
$ComprobarCierreCaja = $ComprobarCierreCajaSQL->fetch_assoc();
?>
<form name="nuevo_producto" action="" class="contact-form" onsubmit="enviarDatosProducto(); return false">
<div class="row">
<div class="col-md-3">
<div class="form-group">
<select class="form-control clientes" value="Cliente Contado" name="cliente" id="select" required <?php if($ComprobarCierreCaja['tipo']==2): echo'disabled'; else: endif;?> >
<?php foreach($SelectorClientesArray as $SelectorClientesRow): ?>
<option value="<?php echo $SelectorClientesRow['id']; ?>" <?php if($SelectorClientesRow['id']==1){echo'selected="selected"';}else{} ?> ><?php echo $SelectorClientesRow['nombre']; ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text" class="form-control" id="inputEmail3" value="<?php echo FechaActual(); ?>" required disabled>
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label>
Hora: <div id="hora"></div>
</label>
</div>
</div>
<div class="col-md-4">
<div class="well well-sm"><center>Nombre del Cajero/a: <?php echo ucwords($usuarioApp['usuario']); ?></center></div>
</div>
<div class="col-md-6">
<div class="form-group">
<select class="form-control productos" name="codigo" id="select" autofocus <?php if($ComprobarCierreCaja['tipo']==2): echo'disabled'; else: endif;?>>
<option value=""></option>
<?php foreach($ProductosStockArray as $ProductosStockRow): ?>
<option value="<?php echo $ProductosStockRow['id']; ?>"><?php echo $ProductosStockRow['codigo'].' - '.$ProductosStockRow['nombre']; ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<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" id="cantidad" placeholder="Cantidad" value="1" onkeypress="return PermitirSoloNumeros(event);" autocomplete="off" required <?php if($ComprobarCierreCaja['tipo']==2): echo'disabled'; else: endif;?> />
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<?php if($ComprobarCierreCaja['tipo']==2): ?>
<button type="button" class="btn btn-primary btn-block" data-container="body" data-toggle="popover" data-placement="top" data-content="No a realizado la apertura de caja, haz la apertura para poder facturar." data-original-title="Apertura de Caja" title="Apertura de Caja" aria-describedby="Préstamo Cancelado">
Agregar Producto
</button>
<?php else:?>
<button type="submit" name="Submit" value="Grabar" class="btn btn-primary btn-block"><i class="fa fa-plus"></i> Agregar Producto</button>
<?php endif;?>
</div>
</div>
</div>
<br/>
</form>
</div>
<div id="resultado"><?php include('consulta.php');?></div>
<?php include (MODULO.'tipo-compra.php'); ?>
</div>
</div>
</div>
</div>
<?php include (MODULO.'footer.php'); ?>
<!-- Cargado archivos javascript al final para que la pagina cargue mas rapido -->
<?php include(MODULO.'Tema.JS.php');?>
<script type="text/javascript" charset="utf-8">
// Clientes
$(document).ready(function(){
$('.clientes').combobox();
});
// Productos
$(document).ready(function(){
$('.productos').combobox();
});
// Permitir Solo numeros en los input
function PermitirSoloNumeros(e)
{
var keynum = window.event ? window.event.keyCode : e.which;
if ((keynum == 8) || (keynum == 46))
return true;
return /\d/.test(String.fromCharCode(keynum));
}
//Hora del servidor
window.onload=hora;
fecha = new Date("<?php echo date('d M Y h:i:s'); ?>");
function hora(){
var hora=fecha.getHours();
var minutos=fecha.getMinutes();
var segundos=fecha.getSeconds();
if(hora<10){ hora='0'+hora;}
if(minutos<10){minutos='0'+minutos; }
if(segundos<10){ segundos='0'+segundos; }
fech=hora+":"+minutos+":"+segundos;
document.getElementById('hora').innerHTML=fech;
fecha.setSeconds(fecha.getSeconds()+1);
setTimeout("hora()",1000);
}
function InhabilitarSubmit(){
document.getElementById("btsubmit").value = "";
document.getElementById("btsubmit").disabled = true;
return true;
}
var statSend = false;
function ComprobarVenta(){
if (!statSend) {
statSend = true;
return true;
} else {
swal("La compra ya se esta procesando...");
return false;
}
}
$(function () {
$('.btn-radio').click(function(e) {
$('.btn-radio').not(this).removeClass('active')
.siblings('input').prop('checked',false)
.siblings('.img-radio').css('opacity','0.5');
$(this).addClass('active')
.siblings('input').prop('checked',true)
.siblings('.img-radio').css('opacity','1');
});
});
function todosuno(valor){
//obtenemos cuantos campos son en total
cuantos = eval(EliminarCampos.contadorx.value);
//Recibimos el valor si es igual a 1 entonces no se ha checkeado todos y lo chekeamos
if(valor==1){
for (var x = 1; x <= cuantos; x++) {
campo = "ID"+x;
document.getElementById(campo).checked=true;
document.getElementById("todos").value=0;
}
}
//Si recibimos el valor 0 entonces se ha checkeado a todos y lo desactivamos
if(valor==0){
for (var x = 1; x <= cuantos; x++) {
campo = "ID"+x;
document.getElementById(campo).checked=false;
document.getElementById("todos").value=1;
}
}
}
</script>
<script src="<?php echo ESTATICO ?>js/sweet-alert.min.js"></script>
<script src="<?php echo ESTATICO ?>js/bootstrap-combobox.js"></script>
<script src="<?php echo ESTATICO ?>js/ajax.js"></script>
<!-- Cargado archivos javascript al final para que la pagina cargue mas rapido Fin -->
</body>
</html>