comprobantes.component.ts
1.91 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
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-comprobantes',
templateUrl: './comprobantes.component.html',
styleUrls: ['./comprobantes.component.scss']
})
export class ComprobantesComponent implements OnInit {
constructor() { }
ngOnInit() {
this.obtenerConsulta();
}
filter = '';
comprobantes = [1, 2, 3];
cabecera = {};
cuerpo = [];
articulosFiltro = [];
paginaActiva = 1;
paginas = [];
fecha = new Date();
filtrar(event: any) {
this.articulosFiltro = this.cuerpo.filter((param)=> {
return (param.LI0).toLocaleUpperCase().includes(
(event.target.value).toLocaleUpperCase()) ||
param.codigoBarras == event.target.value;
});
this.paginar();
}
paginar() {
var cantPaginas = Math.round(this.articulosFiltro.length / 5) + 1;
this.paginas = [];
for (let i = 0; i < cantPaginas; i++) {
this.paginas.push(i + 1);
}
}
getPaginaFiltro() {
return this.articulosFiltro.slice(
(this.paginaActiva - 1) * 5 , this.paginaActiva * 5);
}
obtenerConsulta() {
setTimeout(() => {
this.cabecera = {
TIP: 'A',
TCO: 'FT',
SUC: 623,
NCO: 53979,
COD: 1,
FEC: new Date(),
NOM: 'POTIGIAN GOLOCINAS',
CUI: '30-54775125-2'
};
this.cuerpo = [
{
LI0: 'Mantel Combo Bolso CocaCola',
CAN: 5,
codigoBarras: '7790667006462'
},
{
LI0: 'Papas',
CAN: 5
},
{
LI0: 'Peras',
CAN: 5
},
{
LI0: 'Cafe',
CAN: 5
},
{
LI0: 'Menta',
CAN: 5
},
{
LI0: 'Fernet',
CAN: 5
},
{
LI0: 'Birra',
CAN: 5
}
];
this.articulosFiltro = this.cuerpo;
this.paginar();
}, 500);
}
}