/
ajax.php
288 lines (250 loc) · 9.18 KB
/
ajax.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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
<?php
session_start();
$idusuario=$_SESSION["idusuario"];
include_once './class/bodega/tipobodega.php';
include_once './class/conexion.php';
include_once './class/bodega/bodega.php';
include_once './class/cliente/cliente.php';
include_once './class/proveedor/proveedor.php';
include_once './class/articulo/articulo.php';
include_once './class/inventario/inventario.php';
include_once './class/compra/compra.php';
include_once './class/entrada_producto/entrada_producto.php';
include_once './class/compra_producto/compra_producto.php';
include_once './class/cuenta_pagar/cuenta_pagar.php';
include_once './class/salidacaja/salidacaja.php';
include_once './class/venta/venta.php';
include_once './class/salidaproducto/salidaproducto.php';
include_once './class/ventaproducto/ventaproducto.php';
include_once './class/cuenta_cobrar/cuenta_cobrar.php';
include_once './class/entrada_caja/entradacaja.php';
include_once './class/viaje/viaje.php';
include_once './class/ventacompra/ventacompra.php';
include_once './class/convetirmaterial/convertirmaterial.php';
include_once './class/ajusteinventario/ajusteinventario.php';
include_once './class/eventos/eventos.php';
include_once './class/transportematerial/transportematerial.php';
include_once './class/movimientocaja/movimientocaja.php';
include_once './class/costoscompra/costoscompra.php';
$tipobodega=new Tipobodega();
$bodega=new Bodega();
$cliente=new Cliente();
$proveedor=new Proveedor();
$articulo=new Articulo();
$inventario=new Inventario();
$compra=new Compra();
$entradaproducto=new Entrada_producto();
$compraproducto=new Compra_producto();
$cuentapagar=new Cuenta_Pagar();
$salidacaja=new Salida_caja();
$venta=new Venta();
$salidaproducto= new Salida_producto();
$ventaproducto=new Venta_Producto();
$cuantacobrar=new Cuenta_cobrar();
$entradacaja=new Entrada_caja();
$viaje= new Viaje();
$ventacompra=new Ventacompra();
$convertirmaterial=new ConvertirMaterial();
$ajusteinventario=new Ajuste_Inventario();
$eventos=new Eventos();
$transporte=new Transporte_Material();
$movimientocaja=new Movimientocaja();
$costoscompra=new Costo_compra();
$type = $_GET['type'];
switch ($type) {
case 1:
$tipobodega=new Tipobodega();
$tipobodega->insertarbodega($miconexion,$_GET);
$eventos=new Eventos();
$evento="Insertar Tipo Bodega Nueva";
$eventos->insertareventos($miconexion, $idusuario, $evento);
break;
case 2:
$tipobodega=new Tipobodega();
$tipobodega->editarbodega($miconexion, $_GET);
$eventos=new Eventos();
$evento="Editar Tipo Bodega ";
$eventos->insertareventos($miconexion, $idusuario, $evento);
break;
case 3:
$bodega=new Bodega();
$bodega->insertarbodega($miconexion, $_GET);
$eventos=new Eventos();
$evento="Insertar Bodega Nueva";
$eventos->insertareventos($miconexion, $idusuario, $evento);
break;
case 4:
$bodega=new Bodega();
$bodega->editarbodega($miconexion, $_GET);
$eventos=new Eventos();
$evento="Editar Bodega";
$eventos->insertareventos($miconexion, $idusuario, $evento);
break;
case 5:
$cliente=new Cliente();
$cliente->insertarcliente($miconexion, $_GET);
break;
case 6:
$cliente=new Cliente();
$cliente->editarcliente($miconexion, $_GET);
break;
case 7:
$proveedor=new Proveedor();
$proveedor->insertarproveedor($miconexion, $_GET);
break;
case 8:
$proveedor=new Proveedor();
$proveedor->editarproveedor($miconexion, $_GET);
break;
case 9:
$articulo=new Articulo();
$articulo->insertararticulo($miconexion, $_GET);
break;
case 10:
$articulo=new Articulo();
$articulo->editararticulo($miconexion, $_GET);
break;
case 11:
$inventario=new Inventario();
$inventario->insertararticuloinventario($miconexion, $_GET);
break;
case 12:
$inventario=new Inventario();
$inventario->editararticuloinventario($miconexion, $_GET);
break;
case 13:
$compra=new Compra();
$compra->insertarcompra($miconexion, $_GET);
$compra=new Compra();
$numero=$compra->seleccionarultimoid($miconexion);
while($rs=mysqli_fetch_assoc($numero)){
echo $rs["id"];
}
break;
case 14:
$entradaproducto=new Entrada_producto();
$entradaproducto->insertarentrada($miconexion, $_GET);
$entradaproducto=new Entrada_producto();
$numero=$entradaproducto->seleccionarultimoid($miconexion);
while($rs=mysqli_fetch_assoc($numero)){
echo $rs["id"];
}
break;
case 15:
$compraproducto=new Compra_producto();
$compraproducto->insertarcompraproducto($miconexion, $_GET);
break;
case 16:
$cuentapagar=new Cuenta_Pagar();
$cuentapagar->insertarcuentapagar($miconexion,$_GET);
break;
case 17:
$salidacaja=new Salida_caja ();
$salidacaja->insertarsalidacaja($miconexion,$_GET);
break;
case 18:
$venta=new Venta();
$venta->insertarventa($miconexion, $_GET);
$salidaproducto= new Salida_producto();
$salidaproducto->insertarsalida($miconexion,$_GET);
break;
case 19:
$ventaproducto=new Venta_Producto();
$ventaproducto->insertarventaproducto($miconexion, $_GET);
break;
case 20:
$cuentacobrar=new Cuenta_cobrar();
$cuentacobrar->insertarcuentacobrar($miconexion, $_GET);
break;
case 21:
$venta=new Venta();
$numero=$venta->seleccionarultimoid($miconexion);
while($rs=mysqli_fetch_assoc($numero)){
echo $rs["id"];
}
break;
case 22:
$entradacaja=new Entrada_caja();
$entradacaja->insertarentradacaja($miconexion, $_GET);
break;
case 23:
$viaje=new Viaje();
$viaje->insertarviaje($miconexion, $_GET);
break;
case 24:
$ventacompra=new Ventacompra();
$ventacompra->insertarventacompra($miconexion, $_GET);
break;
case 25:
$convertirmaterial=new ConvertirMaterial();
$convertirmaterial->insertarconvertirmaterial($miconexion, $_GET);
$salidaproducto=new Salida_producto();
$salidaproducto->insertarsalidaconvertir($miconexion, $_GET);
$entradaproducto=new Entrada_producto();
$entradaproducto->insertarentradaconvertir($miconexion, $_GET);
break;
case 26:
$tipo=$_GET['tipo'];
$identradasalida;
if($tipo==1){
$entradaproducto=new Entrada_producto();
$entradaproducto->insertarentradaajuste($miconexion, $_GET);
$sql1='select max(identradaproducto) as valor from entrada_producto';
$dato= mysqli_query($miconexion,$sql1);
while($rs=mysqli_fetch_array($dato)){
$identradasalida=$rs["valor"];
}
;
}
if($tipo==2){
$salidaproducto=new Salida_producto();
$salidaproducto->insertarsalidaajuste($miconexion, $_GET);
$sql1='select max(idsalida_producto) as valor from salida_producto';
$dato= mysqli_query($miconexion,$sql1);
while($rs=mysqli_fetch_array($dato)){
$identradasalida=$rs["valor"];
}
}
$ajusteinventario=new Ajuste_Inventario();
$ajusteinventario->insertarajusteinventario($miconexion, $_GET,$identradasalida);
break;
case 27:
$transporte=new Transporte_Material();
$transporte->insertartransportematerial($miconexion, $_GET);
$salidaproducto=new Salida_producto();
$salidaproducto->insertarsalidatransporte($miconexion, $_GET);
$entradaproducto=new Entrada_producto();
$entradaproducto->insertarentradatransporte($miconexion, $_GET);
break;
case 28:
$movimientocaja=new Movimientocaja();
$movimientocaja->insertarmovimiento($miconexion, $_GET);
$tipoguardado=$_GET['tipomovimiento'];
if($tipoguardado>0&&$tipoguardado<3){
$entradacaja=new Entrada_caja();
$entradacaja->insertarentradacaja($miconexion, $_GET);
}
else{
$salidacaja=new Salida_caja();
$salidacaja->insertarsalidacaja($miconexion, $_GET);
}
break;
case 29:
//guarda costos de la compra
$costoscompra=new Costo_compra();
$costoscompra->insertarcostoscompra($miconexion, $_GET);
break;
case 30:
$venta=new Venta();
$venta->editarventa($miconexion, $_GET);
break;
case 31:
$venta=new Venta();
$venta->editarventaplaya($miconexion, $_GET);
break;
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/