blob: 7630bbd7e1d8cbae5c7d2d3b1bca4784956bbcd0 (
plain)
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
|
using Gestor.Application.Helpers;
using Gestor.Application.Servicos;
using Gestor.Model.Domain.Configuracoes;
using Gestor.Model.Domain.Ferramentas;
using Gestor.Model.Domain.Generic;
using Gestor.Model.Domain.Seguros;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace Gestor.Application.ViewModels.Generic
{
public class ExtratoComissaoViewModel : BaseViewModel
{
private ServicoExtrato _servico;
private bool _apelido;
private List<Seguradora> _seguradoras;
private DateTime _inicio;
private DateTime _fim;
private ObservableCollection<Extrato> _extratos;
public bool Apelido
{
get
{
return this._apelido;
}
set
{
this._apelido = value;
base.OnPropertyChanged("Apelido");
}
}
public ObservableCollection<Extrato> Extratos
{
get
{
return this._extratos;
}
set
{
this._extratos = value;
base.OnPropertyChanged("Extratos");
}
}
public DateTime Fim
{
get
{
return this._fim;
}
set
{
this._fim = value;
base.OnPropertyChanged("Fim");
}
}
public DateTime Inicio
{
get
{
return this._inicio;
}
set
{
this._inicio = value;
base.OnPropertyChanged("Inicio");
}
}
public List<Seguradora> Seguradoras
{
get
{
return this._seguradoras;
}
set
{
this._seguradoras = value;
base.OnPropertyChanged("Seguradoras");
}
}
public ExtratoComissaoViewModel(List<Seguradora> seguradoras)
{
DateTime date = Funcoes.GetNetworkTime().Date;
int year = date.Year;
date = Funcoes.GetNetworkTime().Date;
this._inicio = new DateTime(year, date.Month, 1);
this._fim = Funcoes.GetNetworkTime().Date;
base();
this._servico = new ServicoExtrato();
this.Apelido = Recursos.Configuracoes.Any<ConfiguracaoSistema>((ConfiguracaoSistema x) => x.get_Configuracao() == 6);
this.Seguradoras = seguradoras;
}
public async Task CarregarExtratos(Seguradora seguradora, DateTime inicio, DateTime fim)
{
this.Extratos = new ObservableCollection<Extrato>(await this._servico.BuscarExtrato(seguradora.get_Id(), (long)0, 4, inicio, fim));
}
internal List<NotaFiscal> Selecionar()
{
if (this.Extratos == null)
{
return null;
}
return (
from x in this.Extratos
where x.get_Selecionado()
select x).Select<Extrato, NotaFiscal>((Extrato x) => {
NotaFiscal notaFiscal = new NotaFiscal();
notaFiscal.set_IdExtrato(new long?(x.get_Id()));
notaFiscal.set_Seguradora(x.get_Seguradora());
notaFiscal.set_Data(x.get_Data());
notaFiscal.set_Iss(x.get_Iss().GetValueOrDefault());
notaFiscal.set_Ir(x.get_Ir().GetValueOrDefault());
notaFiscal.set_ValorBruto(x.get_Bruto().GetValueOrDefault());
notaFiscal.set_ValorLiquido(x.get_Liquido().GetValueOrDefault());
notaFiscal.set_Extrato(x.get_Numero());
return notaFiscal;
}).ToList<NotaFiscal>();
}
internal void SelecionarTudo()
{
if (this.Extratos == null)
{
return;
}
this.Extratos.ToList<Extrato>().ForEach((Extrato x) => x.set_Selecionado(!x.get_Selecionado()));
this.Extratos = new ObservableCollection<Extrato>(this.Extratos);
}
}
}
|