comprobantes.component.ts
1.72 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
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 = [];
pagina = 1;
paginas = [];
fecha = new Date();
filtrar(event: any) {
var filtro = this.cuerpo.filter((param)=> {
return (param.LI0).toLocaleUpperCase().includes((event.target.value).toLocaleUpperCase());
});
this.paginar(filtro, this.pagina);
this.paginas.length = Math.round(filtro.length / 5);
}
paginar(filtro: any, pagina: any) {
this.articulosFiltro = filtro.slice(
filtro.length - 1 * pagina, filtro.length * this.pagina + 4);
}
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
},
{
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(this.articulosFiltro);
}, 500);
}
}