-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeposito.class.php
More file actions
572 lines (542 loc) · 21.8 KB
/
deposito.class.php
File metadata and controls
572 lines (542 loc) · 21.8 KB
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
<?php
session_start();
/**
* Clase principal del sistema Deposito del Hogar
*/
class Deposito
{
/*
*/
var $con = null;// VARIABLE GLOBAL DE CONEXIÓN A BD
/************************************************************
* METODO: ESTABLECE CONEXIÓN A UNA BASE DE DATOS USANDO PDO Y ASIGNA LA CONEXION A UNA VARIBALE GLOBAL
************************************************************/
public function conexion(){
$user = 'root';
$password = '';
$server = 'localhost';
$bd = 'depot';
# DSN
$mbd = new PDO('mysql:host='.$server.';dbname='.$bd, $user, $password);
$this->con=$mbd;
} # END conexion()
/************************************************************
* METODO: REGRESA EL RESULTADO DE UNA CONSULTA POR TODOS LOS PRODUCTOS EN LA BASE DE DATOS
* @return $productos array RESULTADOS OBTENIDOS DE LA CONSULTA
************************************************************/
public function getProductos()
{
$this->conexion();
$sql = "SELECT
producto.id,
producto.nombre,
producto.imagen,
producto.precio,
producto.precio_desc,
producto.id_marca,
marca.marca
FROM
producto INNER JOIN marca
ON
producto.id_marca = marca.id
ORDER BY
producto.nombre;";
$stmt = $this->con->query($sql);
$productos = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $productos;
} # END getProductos
/************************************************************
* METODO: REGRESA EL RESULTADO DE UNA CONSULTA POR TODOS LOS PRODUCTOS SIMILARES A UNA CADENA DE TEXTO EN LA BASE DE DATOS
* @param $item string CADENA DE TEXTO A BUSCAR
* @return $products array RESULTADOS OBTENIDOS DE LA CONSULTA
************************************************************/
public function searchProductos($item)
{
$item = "%".$item."%";
$sql = "SELECT producto.*, marca.marca FROM producto INNER JOIN marca ON producto.id_marca = marca.id WHERE nombre LIKE :item ORDER BY id";
$this->conexion();
$stmt = $this->con->prepare($sql);
$stmt->bindParam(':item', $item);
$stmt->execute();
$products = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $products;
}
/************************************************************
* METODO: REGRESA EL RESULTADO DE UNA CONSULTA POR SOLO UN PRODUCTO SEGUN SU ID EN LA BASE DE DATOS
* @param $id_producto integer ID QUE SE DESEA ENCONTRAR
* @return $producto array RESULTADOS OBTENIDOS DE LA CONSULTA
************************************************************/
public function getProductoById($id_producto){
$this->conexion();
$sql = "SELECT * FROM producto WHERE id=:id_producto";
$stmt = $this->con->prepare($sql);
$stmt->bindParam(':id_producto', $id_producto);
$stmt->execute();
$producto = $stmt->fetchObject();
return $producto;
}
/************************************************************
* METODO: REGRESA EL RESULTADO DE UNA CONSULTA TODAS LAS MARCAS SEGUN SU MARCA
* @param $id_marca integer ID QUE SE DESEA ENCONTRAR
* @return $producto array RESULTADOS OBTENIDOS DE LA CONSULTA
************************************************************/
public function getProductosByIdMarca($id_marca)
{
$this->conexion();
$sql = "SELECT
producto.id,
producto.nombre,
producto.imagen,
producto.precio,
producto.precio_desc,
producto.id_marca,
marca.id AS id_marca,
marca.marca
FROM
producto INNER JOIN marca
ON
producto.id_marca = marca.id
WHERE
id_marca = :id_marca
ORDER BY
producto.nombre";
$stmt = $this->con->prepare($sql);
$stmt->bindParam(':id_marca', $id_marca);
$stmt->execute();
$productos = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $productos;
}
/************************************************************
* METODO: REGRESA EL RESULTADO DE UNA CONSULTA POR TODOS LAS MARCAS EN LA BASE DE DATOS
* @return $marcas array RESULTADOS OBTENIDOS DE LA CONSULTA
************************************************************/
public function getMarcas()
{
$sql = "SELECT * FROM marca";
$this->conexion();
$stmt = $this->con->query($sql);
$marcas = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $marcas;
} # END getMarcas
/************************************************************
* METODO: REGRESA EL RESULTADO DE UNA CONSULTA POR TODOS LAS MARCAS EN LA BASE DE DATOS
* @return $marcas array RESULTADOS OBTENIDOS DE LA CONSULTA
************************************************************/
public function getMarcasById($id_marca)
{
$sql = "SELECT * FROM marca WHERE id=:id_marca";
$this->conexion();
$stmt = $this->con->prepare($sql);
$stmt->bindParam(':id_marca', $id_marca);
$stmt->execute();
$marcas = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $marcas;
} # END getMarcasById
/************************************************************
* METODO: REGRESA EL RESULTADO DE UNA CONSULTA POR TODOS LAS MARCAS CONTANDO LOS PRODUCTOS DISPONIBLES DE ESA MARCA LA BASE DE DATOS
* @return $marcas array RESULTADOS OBTENIDOS DE LA CONSULTA
************************************************************/
public function getMarcasCountProducts()
{
$sql = "SELECT m.*, count(p.id) AS cantidad FROM marca AS m INNER JOIN producto p ON m.id = p.id_marca GROUP BY m.id;";
$this->conexion();
$stmt = $this->con->query($sql);
$marcas = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $marcas;
}
/************************************************************
* METODO: REGRESA EL RESULTADO DE UNA CONSULTA POR UNA PUBLICIDAD EN LA BASE DE DATOS DE MANERA ALEATORIA
* @return $publicidad array RESULTADOS OBTENIDOS DE LA CONSULTA
************************************************************/
public function getPublicidad()
{
$publicidad = array();
$this -> conexion();
$sql = "SELECT * FROM publicidad WHERE fecha >= now() order by rand() limit 1";
if ($resultado = $this->con->query($sql)) {
while ($datos = $resultado -> fetchObject()) {
$publicidad = array('id' => $datos ->id, 'publicidad' => $datos->publicidad, 'imagen' => $datos->imagen, 'fecha' => $datos->fecha);
}
return $publicidad;
}
} # END getPublicidad
/************************************************************
* METODO: REGRESA EL RESULTADO DE UNA CONSULTA POR TODOS LOS PROYECTOS VIGENTES EN LA BASE DE DATOS
* @return $proyectos array RESULTADOS OBTENIDOS DE LA CONSULTA
************************************************************/
public function getProyectos()
{
$proyectos = array();
$this -> conexion();
$sql = "SELECT * FROM proyecto WHERE fecha >= now()";
if ($resultado = $this->con->query($sql)) {
while ($datos = $resultado -> fetchObject()) {
array_push($proyectos, (array)$datos);
}
return $proyectos;
}
} # END getProyectos
/************************************************************
* METODO: REGRESA EL RESULTADO DE UNA CONSULTA POR UN PROYECTO SEGUN SU ID EN LA BASE DE DATOS JUNTO CON SUS PRODUCTOS NECESARIOS
* @param $id_proyecto integer ID QUE SE DESEA ENCONTRAR
* @return $productos array RESULTADOS OBTENIDOS DE LA CONSULTA
************************************************************/
public function getProductosDeProyecto($id_proyecto)
{
$sql = "SELECT p.id, p.nombre, pro.proyecto FROM producto p INNER JOIN producto_proyecto pp ON p.id=pp.id_producto INNER JOIN proyecto pro ON pp.id_proyecto=pro.id WHERE pro.id=:id_proyecto";
$this -> conexion();
$stmt = $this->con->prepare($sql);
$stmt->bindParam(':id_proyecto', $id_proyecto);
$stmt->execute();
$productos = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $productos;
} # END getPRoductosDeProyecto
/************************************************************
* METODO: REGRESA EL RESULTADO DE UNA CONSULTA POR TODOS LOS PROYECTOS EN LA BASE DE DATOS, INCLUYEENDO LOS CADUCOS
* @return $proyectos array RESULTADOS OBTENIDOS DE LA CONSULTA
************************************************************/
public function getAllProyectos()
{
$sql = "SELECT * FROM proyecto";
$this -> conexion();
$stmt = $this->con->query($sql);
$proyectos = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $proyectos;
}
/************************************************************
* METODO: ELIMINA UN PRODUCTO DE LA BASE DE DATOS POR SU ID
* @param $id_producto integer ID QUE SE DESEA ENCONTRAR
* @return $stmt array RESULTADOS OBTENIDOS DE LA CONSULTA
************************************************************/
public function deleteProducto($id_producto)
{
if (is_numeric($id_producto)) {
$sql = "DELETE FROM producto WHERE producto.id=:id_producto";
$this->conexion();
$stmt = $this->con->prepare($sql);
$stmt->bindParam(':id_producto', $id_producto);
return $stmt->execute();
}
return 0;
} # END deleteProducto
/************************************************************
* METODO: OBTIENE EL ID DE CLIENTE EN FUNCION DEL ID DE USUARIO EN SESIO
* @return $id_cliente integer ID DE CLIENTE OBTENIDO
************************************************************/
public function getClienteId()
{
if ($_SESSION['validado']) {
$sql = "SELECT id_cliente FROM cliente WHERE id_usuario=:id_usuario";
$stmt = $this->con->prepare($sql);
$id_usuario = $_SESSION['id_usuario'];
$stmt->bindParam(':id_usuario', $id_usuario);
$stmt->execute();
$resultado = $stmt->fetchObject();
$id_cliente = $resultado->id_cliente;
return $id_cliente;
}else{
return null;
}
}
/************************************************************
* METODO: REGRESA EL RESULTADO DE UNA CONSULTA A LA BASE DE DATOS
* @param $sql string CONSULTA A SER REALIZADA
* @return $resultado array RESULTADOS OBTENIDOS DE LA CONSULTA
************************************************************/
public function consultar($sql)
{
$this->conexion();
$resultado = $this->con->query($sql);
if ($resultado) {
return $resultado->fetch(PDO::FETCH_ASSOC);
}else{
return null;
}
}
/************************************************************
____ _____ ____ ____ ___ ___ _ _
/ ___|| ____/ ___/ ___|_ _/ _ \| \ | |
\___ \| _| \___ \___ \| | | | | \| |
___) | |___ ___) |__) | | |_| | |\ |
|____/|_____|____/____/___\___/|_| \_|
************************************************************/
/************************************************************
* METODO: INICIA UNA NUEVA SESION
* @param $email string EMAIL DEL CLIENTE
* @param $contrasena string CONTRASEÑA DEL CLIENTE
* @return null null IMPRIME UN MENSAJE O REDIRECCIONA
************************************************************/
public function login($email, $contrasena, $admin = null)
{
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
$contrasena = md5($contrasena);
$sql = "SELECT id_usuario,email from usuario where email=:email and contrasena=:contrasena";
$this->conexion();
$stmt = $this->con->prepare($sql);
$stmt->bindParam(":email",$email);
$stmt->bindParam(":contrasena",$contrasena);
$stmt->execute();
$user = $stmt->fetchObject();
if (isset($user->email)) {
$_SESSION['validado'] = true;
$_SESSION['email'] = $email;
$_SESSION['id_usuario'] = $user->id_usuario;
$sql = "SELECT id_rol, rol from vwroles where email=:email";
$stmt = $this->con->prepare($sql);
$stmt->bindParam(":email", $email);
$stmt->execute();
$_SESSION['roles'] = [];
while($roles = $stmt->fetch(PDO::FETCH_ASSOC)){
array_push($_SESSION['roles'], $roles);
}
if (!$admin) {
header("Location: perfil.php");
}else{
header("Location: index.php");
}
}else{
$this->logout();
die("Credenciales invalidas, verifique los datos ingresados e intente nuevamente");
}
}else{
die("Se necesita un email electrónico");
}
} # END login
/************************************************************
* METODO: CIERRA UNA SESION
* @return null null REDIRECCIONA A HOME
************************************************************/
public function logout()
{
foreach ($_SESSION as $key => $value) {
if($key != 'carrito'){
unset($_SESSION[$key]);
}
}
header('Location: login.php');
} # END logout
/************************************************************
* METODO: VERIFICA LOS PERMISOS SEGUN LOS ROLES DEL USUARIO ACTIVO
* @param $roles array CONTIENE LOS ROLES A VALIDAR
* @return null null REDIRECCIONA SI NO SE CUENTAN CON LOS PERMISOS
************************************************************/
public function validar($roles)
{
if (isset($_SESSION)) {
if (isset($_SESSION['validado'])) {
if ($_SESSION['validado']) {
$roles_usuario = $_SESSION['roles'];
$aceptado = false;
foreach ($roles_usuario as $rol_usuario) {
if (in_array($rol_usuario['rol'], $roles)) {
$aceptado = true;
}
}
if (!$aceptado) {
header("Location: login.php");
}
}else{
$this->logout();
header("Location: login.php");
}
}else{
header("Location: login.php");
}
}else{
$this->logout();
header("Location: login.php");
}
} # END validar
/************************************************************
____ ____ ___ _____ ___ _ _____
| _ \| _ \ / _ \| ___|_ _| | | ____|
| |_) | |_) | | | | |_ | || | | _|
| __/| _ <| |_| | _| | || |___| |___
|_| |_| \_\\___/|_| |___|_____|_____|
************************************************************/
/************************************************************
* METODO: ACTUALIZA LA INFORMACION DE PERFIL
* @param $nombre string CONTIENE EL NOMBRE DE USUARIO
* @param $apaterno string CONTIENE EL APELLIDO PATERNO DE USUARIO
* @param $amaterno string CONTIENE EL APELLIDO MATERNO DE USUARIO
* @param $domicilio string CONTIENE EL domicilio DE USUARIO
* @param $new_email string CONTIENE EL NUEVO CORREO DE USUARIO
* @param $old_email string CONTIENE EL VIEJO CORREO DE USUARIO
* @param $id_usuario string CONTIENE EL ID DE USUARIO
* @return null null REDIRECCIONA EN CASO DE EXITO
************************************************************/
public function actualizarPerfil($nombre, $apaterno, $amaterno, $domicilio, $new_email, $old_email, $id_usuario)
{
$this->conexion();
$this->con->beginTransaction();
try {
$sql = "SELECT email from usuario WHERE email=:new_email AND id_usuario!=:id_usuario";
$stmt = $this->con->prepare($sql);
$stmt->bindParam(':new_email', $new_email);
$stmt->bindParam(':id_usuario', $id_usuario);
$stmt->execute();
$usuario = $stmt->fetchObject();
if (!isset($usuario->email)) {
if ($old_email != $new_email) {
$sql = "UPDATE usuario SET email=:new_email WHERE id_usuario=:id_usuario";
$stmt = $this->con->prepare($sql);
$stmt->bindParam(':new_email', $new_email);
$stmt->bindParam(':id_usuario', $id_usuario);
$stmt->execute();
}
$sql = "UPDATE cliente SET nombre=:nombre, apaterno=:apaterno, amaterno=:amaterno, domicilio=:domicilio WHERE id_usuario=:id_usuario";
$stmt = $this->con->prepare($sql);
$stmt->bindParam(':nombre', $nombre);
$stmt->bindParam(':apaterno', $apaterno);
$stmt->bindParam(':amaterno', $amaterno);
$stmt->bindParam(':domicilio', $domicilio);
$stmt->bindParam(':id_usuario',$id_usuario);
$stmt->execute();
$this->con->commit();
$_SESSION['email'] = $new_email;
header("Location: perfil.php");
}else{
echo "Correo ya existente, use otro";
$this->con->rollBack();
}
} catch (Exception $e) {
$this->con->rollBack();
}
} #END actualizarPerfil
/************************************************************
* METODO: ACTUALIZA LA CONTRASEÑA DE PERFIL
* @param $contrasena string CONTIENE LA CONTRASEÑA NUEVA
* @param $contrasena2 string CONTIENE LA CONTRASEÑA NUEVA REPETIDA
* @param $id_usuario string CONTIENE EL ID DE USUARIO
* @return boolean boolean REGRESA UN BOLEANO DEPENDIENDO DEL EXITO DE LA TRANSACCION
************************************************************/
public function cambiar_contrasena($contrasena, $contrasena2, $id_usuario)
{
$sql = "UPDATE usuario SET contrasena=:contrasena WHERE id_usuario=:id_usuario";
$this->conexion();
$stmt = $this->con->prepare($sql);
$contrasena = md5($contrasena);
$stmt->bindParam(':contrasena', $contrasena);
$stmt->bindParam(':id_usuario', $id_usuario);
$stmt->execute();
if ($stmt->rowCount()>0) {
return true;
}else{
return false;
}
} # END cambiar_contrasena
/************************************************************
____ _ _ ____ ___ _ _ _____ ____ ____ _ ___ ____ ___ ____
| __ )| | | / ___|_ _| \ | | ____/ ___/ ___| | | / _ \ / ___|_ _/ ___|
| _ \| | | \___ \| || \| | _| \___ \___ \ | | | | | | | _ | | |
| |_) | |_| |___) | || |\ | |___ ___) |__) | | |__| |_| | |_| || | |___
|____/ \___/|____/___|_| \_|_____|____/____/ |_____\___/ \____|___\____|
************************************************************/
/************************************************************
* METODO: AGREGA UN PRODUCTO AL CARRITO
* @param $id_producto integer ID DEL PRODUCTO A AGREGAR
* @param $cantidad integer CANTIDAD DE PRODUCTO A AGREGAR
* @return null null REDIRECCIONA A CARRITO
************************************************************/
public function addCarrito($id_producto, $cantidad)
{
if (!isset($_SESSION['carrito'])) {
$_SESSION['carrito'] = array();
}
$datos = array('id_producto'=>$id_producto, 'cantidad'=>$cantidad);
if(in_array($id_producto, array_column($_SESSION['carrito'], 'id_producto'))) {
$key = array_search($id_producto, array_column($_SESSION['carrito'], 'id_producto'));
$_SESSION['carrito'][$key]['cantidad'] += $cantidad;
}else{
array_push($_SESSION['carrito'], $datos);
}
header('Location: carrito.php');
} #END addCarrito
/************************************************************
* METODO: DESTRUYE TODO EL CARRITO
* @return null null REDIRECCIONA A CARRITO
************************************************************/
public function destroyCarrito()
{
if (isset($_SESSION['carrito'])) {
unset($_SESSION['carrito']);
}
header('Location: carrito.php');
} # END destroyCarrito
/************************************************************
* METODO: ELIMINA UN SOLO PRODUCTO EN PARTICULAR DEL CARRITO
* @param $id_producto integer ID DEL PRODUCTO A ELIMINAR
* @return null null REDIRECCIONA A CARRITO
************************************************************/
public function eliminarProductoCarrito($id_producto)
{
if (is_numeric($id_producto) && isset($_SESSION['carrito'])) {
$key_eliminar = null;
foreach ($_SESSION['carrito'] as $key => $value) {
if ($id_producto == $value['id_producto']) {
$key_eliminar = $key;
}
}
if (!is_null($key_eliminar)) {
unset($_SESSION['carrito'][$key_eliminar]);
}
if (sizeof($_SESSION['carrito']) == 0) {
$this->destroyCarrito();
}
header('Location: carrito.php');
}
} #END eliminarProductoCarrito
/************************************************************
* METODO: REALIZA LA COMPRA Y GUARDA EL REGISTRO Y DETALLES EN LA BASE DE DATOS
* @return $id_carrito integer REGRESA EL ID DE COMPRA DEL CARRITO REGISTRADO
************************************************************/
public function compra()
{
if (isset($_SESSION['carrito'])) {
if (sizeof($_SESSION['carrito']) > 0) {
$this->conexion();
$this->con->beginTransaction();
try {
$sql = "SELECT id_cliente FROM cliente WHERE id_usuario=:id_usuario";
$stmt = $this->con->prepare($sql);
$id_usuario = $_SESSION['id_usuario'];
$stmt->bindParam(':id_usuario', $id_usuario);
$stmt->execute();
$resultado = $stmt->fetchObject();
$id_cliente = $resultado->id_cliente;
$sql = "INSERT INTO carrito(id_cliente, fecha, estatus) VALUES(:id_cliente, now(), 1)";
$stmt = $this->con->prepare($sql);
$stmt->bindParam(':id_cliente', $id_cliente);
$stmt->execute();
$id_carrito = $this->con->lastInsertId();
foreach ($_SESSION['carrito'] as $key => $value) {
$id_producto = $_SESSION['carrito'][$key]['id_producto'];
$cantidad = $_SESSION['carrito'][$key]['cantidad'];
$sql = "SELECT * FROM producto WHERE id = :id";
$stmt = $this->con->prepare($sql);
$stmt->bindParam(':id', $id_producto);
$stmt->execute();
$datos = $stmt->fetchObject();
$precio_final = 0;
$precio_final = !is_null($datos->precio_desc) ? $datos->precio_desc : $datos->precio;
$sql = "INSERT INTO carrito_detalle VALUES(:id_carrito, :id_producto, :cantidad, :precio_final)";
$stmt = $this->con->prepare($sql);
$stmt->bindParam(':id_carrito', $id_carrito);
$stmt->bindParam(':id_producto', $id_producto);
$stmt->bindParam(':cantidad', $cantidad);
$stmt->bindParam(':precio_final', $precio_final);
$stmt->execute();
}
$this->con->commit();
unset($_SESSION['carrito']);
return $id_carrito;
} catch (Exception $e) {
$this->con->rollBack();
die("No se puede realizar la compra");
}
}
}
return false;
} # END compra
} # END class Deposito
?>