-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmodeloK.php
executable file
·799 lines (686 loc) · 29 KB
/
modeloK.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
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
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
<?php
class connection{
public $conn;
function __construct(){
$this->conn = new mysqli("13.92.235.252","root","Jesus8+","puntoventalibreria");
}
}
class Sistema extends connection{
public $categorias;
public $productos;
public $marca;
public $proveedores;
public $venta;
public $detalleventa;
function __construct(){
}
public function getProductosCatCoin($idCategoria, $coinProducto){
$query = "SELECT * from producto where Categoria_idCategorias = $idCategoria and ProductoDescripcion like '%$coinProducto%'";
parent:: __construct();
$productosCatCoin = $this->conn->query($query);
$this->conn->close();
$productosCatCoinA = array();
while($productoCatCoinA = $productosCatCoin->fetch_assoc()){
array_push($productosCatCoinA, $productoCatCoinA);
}
return json_encode($productosCatCoinA);
}
public function getProductosCatMarCoin($idCategoria,$idMarca, $coinProducto){
$query = "SELECT * from producto where Categoria_idCategorias = $idCategoria and Marca_idMarcas = $idMarca and ProductoDescripcion like '%$coinProducto%'";
parent:: __construct();
$productosCatMarCoin = $this->conn->query($query);
$this->conn->close();
$productosCatMarCoinA = array();
while($productoCatMarCoinA = $productosCatMarCoin->fetch_assoc()){
array_push($productosCatMarCoinA, $productoCatMarCoinA);
}
return json_encode($productosCatMarCoinA);
}
public function getProductosCatMarProCoin($idCategoria, $idMarca, $idProveedor, $coinProducto){
$query = "SELECT * from producto where Categoria_idCategorias = $idCategoria and Marca_idMarcas = $idMarca and Proveedores_idProveedores = $idProveedor and ProductoDescripcion like '%$coinProducto%'";
parent:: __construct();
$productosCatMarCatCoin = $this->conn->query($query);
$this->conn->close();
$productosCatMarProCoinA = array();
while($productoCatMarProCoinA = $productosCatMarCatCoin->fetch_assoc()){
array_push($productosCatMarProCoinA, $productoCatMarProCoinA);
}
return json_encode($productosCatMarProCoinA);
}
public function getProductosCatProCoin($idCategoria, $idProveedor, $coinProducto){
$query = "SELECT * from producto where Categoria_idCategorias = $idCategoria and Proveedores_idProveedores = $idProveedor and ProductoDescripcion like '%$coinProducto%'";
parent:: __construct();
$productosCatProCoin = $this->conn->query($query);
$this->conn->close();
$productosCatProCoinA = array();
while($productoCatProCoinA = $productosCatProCoin->fetch_assoc()){
array_push($productosCatProCoinA, $productoCatProCoinA);
}
return json_encode($productosCatProCoinA);
}
public function getProductosMarProCoin($idMarca, $idProveedor, $coinProducto){
$query = "SELECT * from producto where Marca_idMarcas = $idMarca and Proveedores_idProveedores = $idProveedor and ProductoDescripcion like '%$coinProducto%'";
parent:: __construct();
$productosMarProCoin = $this->conn->query($query);
$this->conn->close();
$productosMarProCoinA = array();
while($productoMarProCoinA = $productosMarProCoin->fetch_assoc()){
array_push($productosMarProCoinA, $productoMarProCoinA);
}
return json_encode($productosMarProCoinA);
}
public function getParametros($idProducto){
$query = "SELECT Categoria_idCategorias, Marca_idMarcas, Proveedores_idProveedores from producto where idProducto = $idProducto";
parent:: __construct();
$parametros = $this->conn->query($query);
$this->conn->close();
$parametros = $parametros->fetch_assoc();
return json_encode($parametros);
}
function deleteProducto($id){
parent:: __construct();
$query = "call deleteProducto($id)";
$estadoDelete = $this->conn->query($query);
$this->conn->close();
return $estadoDelete;
}
function getProductosMarcaProveedor($idMarca, $idProveedor){
parent:: __construct();
$this->productos = $this->conn->query("call getProductosMarcaProveedor($idMarca, $idProveedor)");
$this->conn->close();
}
function obtenerProductosMarcaProveedor(){
if ($producto = $this->productos->fetch_assoc())
return $producto;
else
return false;
}
function getProductosCategoriaProveedor($idCategoria, $idProveedor){
parent:: __construct();
$this->productos = $this->conn->query("call getProductosCategoriaProveedor($idCategoria, $idProveedor)");
$this->conn->close();
}
function obtenerProductosCategoriaProveedor(){
if ($productoCP = $this->productos->fetch_assoc())
return $productoCP;
else
return false;
}
function consultarCategoriasIdNombre(){
parent:: __construct();
$this->categorias = $this->conn->query("SELECT idCategorias,categoriaNombre from categoria");
$this->conn->close();
}
function obtenerCategoriasIdNombre(){
if($categoria=$this->categorias->fetch_assoc())
return $categoria;
else
return false;
}
function consultarMarcasIdNombre(){
parent::__construct();
$this->marcas = $this->conn->query("SELECT idMarcas,marcaNombre from marca");
$this->conn->close();
}
function ObtenerMarcasIdNombre(){
if($marcas=$this->marcas->fetch_assoc())
return $marcas;
else
return false;
}
function consultarProveedoresIdNombre(){
parent::__construct();
$this->proveedores =$this->conn->query("SELECT idProveedores,proveedoresNombre from proveedores");
$this->conn->close();
}
function obtenerProveedoresIdNombre(){
if($proveedores=$this->proveedores->fetch_assoc())
return $proveedores;
else
return false;
}
function consultarProductosCategoria($id){
parent::__construct();
$this->productos = $this->conn->query("SELECT * from producto where Categoria_idCategorias ='$id'");
$this->conn->close();
}
function obtenerProductosCategorias(){
if($producto=$this->productos->fetch_assoc())
return $producto;
else
return false;
}
function consultarProductosMarcas($marca){
parent::__construct();
$this->marcas=$this->conn->query("SELECT * from producto where Marca_IdMarcas ='$marca'");
$this->conn->close();
}
function obtenerProductosMarcas(){
if($marca=$this->marcas-> fetch_assoc())
return $marca;
else
return false;
}
function consultarProductosProveedores($prov){
parent::__construct();
$this->proveedores=$this->conn->query("SELECT * from producto where Proveedores_idProveedores = $prov");
$this->conn->close();
}
function obtenerProductosProveedores(){
if($proveedores=$this->proveedores->fetch_assoc())
return $proveedores;
else
return false;
}
function consultarProductosCoincidencia($busqueda){
parent::__construct();
$this->producto=$this->conn->query("SELECT *from producto where ProductoDescripcion like '%$busqueda%'");
$this->conn->close();
}
function obtenerProductosCoincidencia(){
if($producto=$this->producto->fetch_assoc())
return $producto;
else
return false;
}
function consultarProductos(){
parent::__construct();
$this->productos=$this->conn->query("SELECT * from producto");
$this->conn->close();
}
function obtenerProductos(){
if($producto=$this->productos->fetch_assoc())
return $producto;
else
return false;
}
function consultarMarcas(){
parent::__construct();
$this->marca=$this->conn->query("SELECT * from marca");
$this->conn->close();
}
function obtenerMarcas(){
if($marca=$this->marcas->fetch_assoc())
return $marca;
else
return false;
}
function consultarProveedores(){
parent::__construct();
$this->proveedores=$this->conn->query("SELECT * from proveedores");
$this->conn->close();
}
function ObtenerProveedores(){
if ($proveedores = $this->proveedores->fetch_assoc())
return $proveedores;
else
return false;
}
function getProductos(){
parent::__construct();
$this->productos = $this->conn->query("call getProductos()");
$this->conn->close();
}
function obtenerGetProductos(){
if ($producto = $this->productos->fetch_assoc())
return $producto;
else
return false;
}
function consultarGetProductosCategoriasMarcas($idCategoria,$idMarca){
parent::__construct();
$this->productos=$this->conn->query("call getProductosCategoriaMarca($idCategoria,$idMarca)");
$this->conn->close();
}
function obtenerGetProductosCategoriasMarca(){
if($producto = $this->productos->fetch_assoc())
return $producto;
else
return false;
}
function consultarGetCatMarProv($idCategoria,$idMarca,$idProveedor){
parent::__construct();
$this->productos=$this->conn->query("call getProductosCategoriaMarcaProveedor($idCategoria,$idMarca,$idProveedor)");
$this->conn->close();
}
function obtenerGetCatMarProv(){
if($producto = $this->productos->fetch_assoc())
return $producto;
else
return false;
}
function crearNuevoProducto($arrayProducto){
$descripcionProducto=$arrayProducto['descripcionProducto'];
$codCategoria=$arrayProducto['codigoCategoria'];
if (is_string($codCategoria)) {
parent::__construct();
$query = "call setCategoriaNP('$codCategoria')";
$idNCP = $this->conn->query($query);
$this->conn->close();
$id = $idNCP->fetch_assoc();
$codCategoria = (int)$id['last_insert_id()'];
}
$codMarca=$arrayProducto['codigoMarca'];
if (is_string($codMarca)) {
parent::__construct();
$query = "call setMarcaNP('$codMarca')";
$idNCP = $this->conn->query($query);
$this->conn->close();
$id = $idNCP->fetch_assoc();
$codMarca = (int)$id['last_insert_id()'];
}
$totalInicial=(int)$arrayProducto['totalInicial'];
$precioCosto=(float)$arrayProducto['precioCosto'];
$precioVenta=$arrayProducto['precioVenta'];
$codProveedor=$arrayProducto['codigoProveedor'];
if (isset($arrayProducto['telProveedor']))
$telProveedor = $arrayProducto['telProveedor'];
if (isset($arrayProducto['nitProveedor']))
$nitProveedor = $arrayProducto['nitProveedor'];
if (isset($arrayProducto['dirProveedor']))
$dirProveedor = $arrayProducto['dirProveedor'];
if (is_string($codProveedor)) {
parent::__construct();
$query = "call setProveedorNP('$codProveedor', '$telProveedor', '$dirProveedor', '$nitProveedor')";
$idNCP = $this->conn->query($query);
$this->conn->close();
$id = $idNCP->fetch_assoc();
$codProveedor = (int)$id['last_insert_id()'];
}
$fecha = date("Y-m-d");
$query= ("setNames utf8");
parent:: __construct();
$this->conn->query($query);
$query = "call ingresarProducto($totalInicial, '$descripcionProducto', $totalInicial, $precioCosto, $precioVenta, $codCategoria, $codMarca, $codProveedor)";
if (!$this->productos = $this->conn->query($query)){
printf("Errormessage: %s\n", $this->conn->error);
}
$this->conn->close();
$productos = array();
if (!$this->productos) {
}
$filaProductos = $this->productos->fetch_assoc();
$producto=array();
foreach ($filaProductos as $key => $value) {
$producto[$key] = $value;
}
array_unshift($productos,$producto);
$idNuevoProducto = (int)$productos[0]['idProducto'];
$query = "call setDetalleCompra('$descripcionProducto', $precioCosto, $codMarca, $codProveedor, $codCategoria, $totalInicial, '$fecha', $idNuevoProducto)";
parent:: __construct();
if (!$this->conn->query($query)) {
printf("Errormessage: %s\n", $this->conn->error);
}
$this->conn->close();
return $productos;
}
function modificarNuevoProducto($arrayProducto){
$descripcionProducto = $arrayProducto['descripcionProducto'];
$totalInicial = $arrayProducto['totalInicial'];
$precioCosto = (float)$arrayProducto['precioCosto'];
$precioVenta = $arrayProducto['precioVenta'];
$codigoProductoo = (int)$arrayProducto['codigoProducto'];
$codCategoria = $arrayProducto['codigoCategoria'];
$codMarca = $arrayProducto['codigoMarca'];
$codProveedor = $arrayProducto['codigoProveedor'];
$fecha = date("Y-m-d");
// Modifico el producto en inventario
$query = "call setModificarProducto('$descripcionProducto',$totalInicial,$precioCosto,$precioVenta,$codigoProductoo,$codCategoria, $codMarca, $codProveedor)";
parent:: __construct();
$this->productos= $this->conn->query($query);
$this->conn->close();
// Si el usuario desea comprar mas de un producto existente
if ($totalInicial > 0) {
$query = "call setDetalleCompra('$descripcionProducto', $precioCosto, $codMarca, $codProveedor, $codCategoria, $totalInicial, '$fecha', $codigoProductoo)";
parent:: __construct();
if (!$this->conn->query($query)) {
printf("Errormessage: %s\n", $this->conn->error);
}
$this->conn->close();
}
}
function obtenerModificarNuevoProducto(){
if($producto = $this->productos->fetch_assoc())
return $producto;
else
return false;
}
function concultarNuevaVenta($arrayVenta){
$ventaDescripcion=$arrayVenta['ventaDescripcion'];
$ventaFecha=$arrayVenta['ventaFecha'];
$ventaHora=$arrayVenta['ventaHora'];
$VentaUsuario=$arrayVenta['ventaUsuario'];
$cliente=$arrayVenta['cliente'];
parent::__construct();
$query = ("call nuevaVenta('$ventaDescripcion',$ventaFecha,$ventaHora,$ventaUsuario,$cliente)");
$this->ventas= $this->conn->query($query);
$this->conn->close();
}
function obtenerNuevaVenta(){
if($venta = $this->productos->fetch_assoc());
return $venta;
}
function consultarProductosCoincidenciaVenta($coincidencia){
parent::__construct();
$this->producto=$this->conn->query("SELECT P.idProducto, C.CategoriaNombre, P.ProductoDescripcion, M.marcaNombre, P.ProductocoPrecioVenta, P.ProductoExistencia from categoria C inner join producto P on C.idCategorias = P.Categoria_idCategorias inner join marca M on P.Marca_idMarcas = M.idMarcas where ProductoDescripcion like '%$coincidencia%'");
$this->conn->close();
}
function obtenerProductosCoincidenciaVenta(){
if($producto=$this->producto->fetch_assoc())
return $producto;
else
return false;
}
function consultarGetProductosCategoriaMarcaVenta($catVenta,$imarcaVenta){
parent::__construct();
$this->productos=$this->conn->query("call getProductosCategoriaMarcaVenta($catVenta,$imarcaVenta)");
$this->conn->close();
}
function obtenerGetProductosCategoriaMarcaVenta(){
if($producto = $this->productos->fetch_assoc())
return $producto;
else
return false;
}
function consultarGetProductoMarcaVenta($idMarca){
parent::__construct();
$this->productos=$this->conn->query("call getMarcasColumnas($idMarca)");
$this->conn->close();
}
function obtenerProductoMarcaVenta(){
if($producto = $this->productos->fetch_assoc())
return $producto;
else
return false;
}
function consultarGetProductosCategoriaVenta($idCategoria){
parent::__construct();
$this->productos=$this->conn->query("call getProductosCategoriaVenta($idCategoria)");
$this->conn->close();
}
function obtenerProductoCategoriaVenta(){
if($producto = $this->productos->fetch_assoc())
return $producto;
else
return false;
}
function consultarCoincidenciaCatMVenta($idCategoria,$idMarca,$coincidencias){
parent::__construct();
$this->producto=$this->conn->query("SELECT P.idProducto, C.CategoriaNombre, P.ProductoDescripcion, M.marcaNombre, P.ProductocoPrecioVenta, P.ProductoExistencia from categoria C inner join producto P on C.idCategorias = P.Categoria_idCategorias inner join marca M on P.Marca_idMarcas = M.idMarcas where idCategorias and idMarcas like '%$coincidencia%'");
$this->conn->close();
}
function obtenerCoincidenciaCatMVenta(){
if($producto=$this->producto->fetch_assoc())
return $producto;
else
return false;
}
function crearVenta($descripcion,$fecha,$usuario,$idCliente){
parent::__construct();
if(!$idProducto = $this->conn->query("call nuevaVenta('$descripcion','$fecha','$usuario',$idCliente)"))
printf("Error: %s\n",$this->conn->error);
$this->conn->close();
if($idNuevoProducto = $idProducto->fetch_assoc())
return $idNuevoProducto;
else
return false;
}
function detalleVenta($cantidad,$idProductos,$idVentas){
$tipoCantidad = (int)$cantidad;
$tipoIdProducto = (int)$idProductos;
$tipoIdVenta = (int)$idVentas;
parent::__construct();
$query = ("call getAlmacenaDetalle($tipoCantidad,$tipoIdProducto,$tipoIdVenta)");
if(!$this->productos= $this->conn->query($query))
printf("Error %s\n ",$this->conn->error);
if (!$this->productos)
echo "Error al almacenar el detalle de venta";
$this->conn->close();
}
function modificarProducto(){
parent::__construct();
$this->productos=$this->conn->query("update producto set productoExistencia=nuevaExistencia");
if ($this->productos)
echo "Detalle de venta almacenado exitosamente";
else
echo "Error al almacenar el detalle de venta";
$this->conn->close();
}
function modificarCategorias($arrayCategoria){
$idCategoria=$arrayCategoria['idCategoria'];
$categoriaNombre=$arrayCategoria['categoriaNombre'];
parent::__construct();
$query = ("call setModificaCategoria($idCategoria,'categoriaNombre')");
$this->categorias= $this->conn->query($query);
$this->conn->close();
}
function obtenerModificarNuevaCategoria(){
if($categoria = $this->categorias->fetch_assoc())
return $categoria;
else
return false;
}
function deleteCategoria($id){
parent:: __construct();
$query = ("deleteCategoria($id)");
$estadoDelete = $this->conn->query($query);
$this->conn->close();
return $estadoDelete;
}
}
class Categoria extends connection{
private $nombreCategoria;
public $codigo;
public $nom;
public $descripcion;
function __construct(){
}
function borrarCategoria(){
}
function crearNuevaCategoria(){
}
}
class Producto extends connection{
private $codigoProducto;
public $codigo;
public $descripcion;
public $categoria;
public $marca;
public $total;
public $precioCosto;
public $precioVenta;
public $proveedores;
public $enlace;
function __construct(){
}
function productoBorrarProducto(){
}
function productoCrearNuevoProducto(){
}
}
class Marca extends connection{
private $marcaCodigo;
public $codigo;
public $nombre;
public $observacion;
public $enlace;
function __construct(){
}
function marcaBorrarMarca(){
}
function marcaCrearNuevaMarca(){
}
}
class Proveedores extends connection{
private $proveedorNombre;
public $nombre;
public $nit;
public $direccion;
public $telefono;
public $email;
function __construct(){
}
function proveedorBorrarProveedor(){
}
function proveedorCrearNuevoProveedor(){
}
}
/**
* Tienda
*/
class Tienda extends connection
{
public $carritoCompra = array();
public $totalVenta = 0;
function __construct()
{
}
public function getDatosProducto($idProducto,$cantidad){
$idInt = (int)$idProducto;
$query = "call getDatosProductoFactura($idInt)";
parent:: __construct();
if(!$datosProducto = $this->conn->query($query)){
printf("Error : %s\n",$this->conn->error);
$this->conn->close();
}
else{
$this->conn->close();
$datosProducto = $datosProducto->fetch_assoc();
$datosProductoA = array();
$datosProductoA[0] = $datosProducto["idProducto"];
$datosProductoA[1] = $datosProducto["ProductoDescripcion"];
$datosProductoA[2] = $datosProducto["marcaNombre"];
$datosProductoA[3] = $datosProducto["ProductocoPrecioVenta"];
$datosProductoA[4] = $cantidad;
$subTotal = (float)$datosProductoA[3] * (int)$cantidad;
$datosProductoA[5] = $subTotal;
$this->totalVenta = $this->totalVenta + $subTotal;
array_push($this->carritoCompra, $datosProductoA);
}
}
}
class PDF extends FPDF
{
// Cabecera de página
function Header()
{
// Logo
//$this->Image('images/headindex.png',10,8,33);
// Arial bold 15
$this->SetFont('Arial','B',15);
// Movernos a la derecha
$this->Cell(50);
// Título
$this->Cell(100,10,'Libreria y Papeleria',0,0,'C');
$this->Ln(5);
$this->SetFont('Arial','B',10);
$this->Cell(50);
$this->Cell(100,10,'Suenos de Papel',0,0,'C');
$this->Ln(5);
$this->SetFont('Arial','B',7);
$this->Cell(50);
$this->Cell(100,10,'Tel. 7766-7184 / 5699-0471',0,0,'C');
$this->Ln(10);
$this->SetFont('Arial','B',18);
$this->Cell(50);
$this->Cell(100,10,'Factura',0,0,'C');
// Salto de línea
$this->Ln(11);
}
function BasicTable($header, $data)
{
// Cabecera
$this->SetFont('Arial','B',8);
for ($i = 0; $i < count($header); $i++){
if ($i == 0)
$this->Cell(23,7,$header[$i],1,0,'C');
else if ($i == 1) {
$this->Cell(50,7,$header[$i],1,0,'C');
}
else
$this->Cell(23,7,$header[$i],1,0,'C');
}
$this->Ln();
// Datos
$this->SetFont('Arial','',7);
$unidadesUsadas = count($data);
for ($i = 0; $i < count($data); $i++) {
for ($j = 0; $j < count($data[$i]); $j++){
if ($j == 0)
$this->Cell(23,7,$data[$i][$j],1,0,'C');
else if($j == 1) {
$this->Cell(50,7,$data[$i][$j],1,0,'C');
}
else if($j == 5) {
$this->Cell(23,7,"Q. ".$data[$i][$j],1,0,'C');
}
else
$this->Cell(23,7,$data[$i][$j],1,0,'C');
}
$this->Ln();
}
}
}
class PDFC extends FPDF
{
// Cabecera de página
function Header()
{
// Logo
//$this->Image('images/headindex.png',10,8,33);
// Arial bold 15
$this->SetFont('Arial','B',15);
// Movernos a la derecha
$this->Cell(50);
// Título
$this->Cell(100,10,'Libreria y Papeleria',0,0,'C');
$this->Ln(5);
$this->SetFont('Arial','B',10);
$this->Cell(50);
$this->Cell(100,10,'Suenos de Papel',0,0,'C');
$this->Ln(5);
$this->SetFont('Arial','B',7);
$this->Cell(50);
$this->Cell(100,10,'Tel. 7766-7184 / 5699-0471',0,0,'C');
$this->Ln(10);
$this->SetFont('Arial','B',18);
$this->Cell(50);
$this->Cell(100,10,'Cotizacion',0,0,'C');
// Salto de línea
$this->Ln(11);
}
function BasicTable($header, $data)
{
// Cabecera
$this->SetFont('Arial','B',8);
for ($i = 0; $i < count($header); $i++){
if ($i == 0)
$this->Cell(23,7,$header[$i],1,0,'C');
else if ($i == 1) {
$this->Cell(50,7,$header[$i],1,0,'C');
}
else
$this->Cell(23,7,$header[$i],1,0,'C');
}
$this->Ln();
// Datos
$this->SetFont('Arial','',7);
$unidadesUsadas = count($data);
for ($i = 0; $i < count($data); $i++) {
for ($j = 0; $j < count($data[$i]); $j++){
if ($j == 0)
$this->Cell(23,7,$data[$i][$j],1,0,'C');
else if($j == 1) {
$this->Cell(50,7,$data[$i][$j],1,0,'C');
}
else if($j == 5) {
$this->Cell(23,7,"Q. ".$data[$i][$j],1,0,'C');
}
else
$this->Cell(23,7,$data[$i][$j],1,0,'C');
}
$this->Ln();
}
}
}
?>