Subversion Repositories Integrator Subversion

Rev

Rev 182 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 espaco 1
package br.com.ec.domain.dto;
2
 
3
import java.util.ArrayList;
4
import java.util.Date;
5
import java.util.List;
6
 
7
import br.com.ec.domain.model.Loja;
8
import br.com.ec.domain.model.Pagamento;
9
import br.com.ec.domain.model.Venda;
10
import br.com.ec.domain.model.VendaFormaPagamento;
11
import br.com.ec.domain.model.tipos.TipoSituacaoVenda;
12
 
13
public class ParametrosFecharCaixaDTO {
14
 
15
        private Loja loja;
16
        private Date dataVendas;
17
        private Boolean processado;
18
 
19
        private List<Venda> listaVendas;
20
        private List<Pagamento> listaPagamentos;
21
        private CartaoResumoDTO cartaoResumo;
22
 
23
        private Double totalEmDinheiro;
24
        private Integer quantidadeEmCartao;
25
        private Double totalEmCartao;
26
        private Integer quantidadeNoDebito;
27
        private Double totalNoDebito;
28
        private Integer quantidadeNoCredito;
29
        private Double totalNoCredito;
30
        private Integer quantidadeEm1;
31
        private Double totalEm1;
32
        private Integer quantidadeEm2;
33
        private Double totalEm2;
34
        private Integer quantidadeEm3;
35
        private Double totalEm3;
36
        private Integer quantidadeEm4;
37
        private Double totalEm4;
38
        private Integer quantidadeEm5;
39
        private Double totalEm5;
40
        private Integer quantidadeEm6;
41
        private Double totalEm6;
42
        private Integer quantidadeEm7;
43
        private Double totalEm7;
44
        private Integer quantidadeEm8;
45
        private Double totalEm8;
46
        private Integer quantidadeEm9;
47
        private Double totalEm9;
48
        private Integer quantidadeEm10;
49
        private Double totalEm10;
50
        private Integer quantidadeEm11;
51
        private Double totalEm11;
52
        private Integer quantidadeEm12;
53
        private Double totalEm12;
54
        private Integer quantidadeNoPagseguro;
55
        private Double totalNoPagseguro;
56
        private Integer quantidadeNoPix;
57
        private Double totalNoPix;
58
        private Integer quantidadeEmOutros;
59
        private Double totalEmOutros;
60
 
61
        private Double subtotal;
62
        private Double total;
63
 
64
        public ParametrosFecharCaixaDTO() {
65
                iniciarEntidade();
66
        }
67
 
68
        public ParametrosFecharCaixaDTO(Loja loja, Date dataRecebimento) {
69
                this.loja = loja;
70
                this.dataVendas = dataRecebimento;
71
                iniciarEntidade();
72
        }
73
 
74
        private void iniciarEntidade() {
75
                processado = false;
76
                listaVendas = new ArrayList<Venda>();
77
                listaPagamentos = new ArrayList<Pagamento>();
78
                totalEmDinheiro = new Double(0.0);
79
                totalEmCartao = new Double(0.0);
80
                quantidadeEmCartao = new Integer(0);
81
                totalNoDebito = new Double(0.0);
82
                quantidadeNoDebito = new Integer(0);
83
                totalNoCredito = new Double(0.0);
84
                quantidadeNoCredito = new Integer(0);
85
                totalEm1 = new Double(0.0);
86
                quantidadeEm1 = new Integer(0);
87
                totalEm2 = new Double(0.0);
88
                quantidadeEm2 = new Integer(0);
89
                totalEm3 = new Double(0.0);
90
                quantidadeEm3 = new Integer(0);
91
                totalEm4 = new Double(0.0);
92
                quantidadeEm4 = new Integer(0);
93
                totalEm5 = new Double(0.0);
94
                quantidadeEm5 = new Integer(0);
95
                totalEm6 = new Double(0.0);
96
                quantidadeEm6 = new Integer(0);
97
                totalEm7 = new Double(0.0);
98
                quantidadeEm7 = new Integer(0);
99
                totalEm8 = new Double(0.0);
100
                quantidadeEm8 = new Integer(0);
101
                totalEm9 = new Double(0.0);
102
                quantidadeEm9 = new Integer(0);
103
                totalEm10 = new Double(0.0);
104
                quantidadeEm10 = new Integer(0);
105
                totalEm11 = new Double(0.0);
106
                quantidadeEm11 = new Integer(0);
107
                totalEm12 = new Double(0.0);
108
                quantidadeEm12 = new Integer(0);
109
                totalNoPagseguro = new Double(0.0);
110
                quantidadeNoPagseguro = new Integer(0);
111
                totalNoPix = new Double(0.0);
112
                quantidadeNoPix = new Integer(0);
113
                totalEmOutros = new Double(0.0);
114
                quantidadeEmOutros= new Integer(0);
115
                subtotal = new Double(0.0);
116
                total = new Double(0.0);
117
        }
118
 
119
        public Loja getLoja() {
120
                return loja;
121
        }
122
        public void setLoja(Loja loja) {
123
                this.loja = loja;
124
        }
125
 
126
        public Date getDataVendas() {
127
                return dataVendas;
128
        }
129
        public void setDataVendas(Date dataVendas) {
130
                this.dataVendas = dataVendas;
131
        }
132
 
133
        public Boolean getProcessado() {
134
                return processado;
135
        }
136
        public void setProcessado(Boolean processado) {
137
                this.processado = processado;
138
        }
139
 
140
        public List<Venda> getListaVendas() {
141
                return listaVendas;
142
        }
143
        public void setListaVendas(List<Venda> listaVendas) {
144
                this.listaVendas = listaVendas;
145
        }
146
 
147
        public List<Pagamento> getListaPagamentos() {return listaPagamentos;}
148
        public void setListaPagamentos(List<Pagamento> listaPagamentos) {this.listaPagamentos = listaPagamentos;}
149
 
150
        public CartaoResumoDTO getCartaoResumo() {
151
                return cartaoResumo;
152
        }
153
        public void setCartaoResumo(CartaoResumoDTO cartaoResumo) {
154
                this.cartaoResumo = cartaoResumo;
155
        }
156
 
157
        public Double getTotalEmDinheiro() {return totalEmDinheiro;}
158
        public void setTotalEmDinheiro(Double totalEmDinheiro) {this.totalEmDinheiro = totalEmDinheiro;}
159
 
160
        public Double getTotalEmCartao() {return totalEmCartao;}
161
        public void setTotalEmCartao(Double totalEmCartao) {this.totalEmCartao = totalEmCartao;}
162
        public Integer getQuantidadeEmCartao() {return quantidadeEmCartao;}
163
        public void setQuantidadeEmCartao(Integer quantidadeEmCartao) {this.quantidadeEmCartao = quantidadeEmCartao;}
164
 
165
        public Double getTotalNoDebito() {return totalNoDebito;}
166
        public void setTotalNoDebito(Double totalNoDebito) {this.totalNoDebito = totalNoDebito;}
167
        public Integer getQuantidadeNoDebito() {return quantidadeNoDebito;}
168
        public void setQuantidadeNoDebito(Integer quantidadeNoDebito) {this.quantidadeNoDebito = quantidadeNoDebito;}
169
 
170
        public Double getTotalNoCredito() {return totalNoCredito;}
171
        public void setTotalNoCredito(Double totalNoCredito) {this.totalNoCredito = totalNoCredito;}
172
        public Integer getQuantidadeNoCredito() {return quantidadeNoCredito;}
173
        public void setQuantidadeNoCredito(Integer quantidadeNoCredito) {this.quantidadeNoCredito = quantidadeNoCredito;}
174
 
175
        public Double getTotalEm1() {return totalEm1;}
176
        public void setTotalEm1(Double totalEm1) {this.totalEm1 = totalEm1;}
177
        public Integer getQuantidadeEm1() {return quantidadeEm1;}
178
        public void setQuantidadeEm1(Integer quantidadeEm1) {this.quantidadeEm1 = quantidadeEm1;}
179
 
180
        public Double getTotalEm2() {return totalEm2;}
181
        public void setTotalEm2(Double totalEm2) {this.totalEm2 = totalEm2;}
182
        public Integer getQuantidadeEm2() {return quantidadeEm2;}
183
        public void setQuantidadeEm2(Integer quantidadeEm2) {this.quantidadeEm2 = quantidadeEm2;}
184
 
185
        public Double getTotalEm3() {return totalEm3;}
186
        public void setTotalEm3(Double totalEm3) {this.totalEm3 = totalEm3;}
187
        public Integer getQuantidadeEm3() {return quantidadeEm3;}
188
        public void setQuantidadeEm3(Integer quantidadeEm3) {this.quantidadeEm3 = quantidadeEm3;}
189
 
190
        public Double getTotalEm4() {return totalEm4;}
191
        public void setTotalEm4(Double totalEm4) {this.totalEm4 = totalEm4;}
192
        public Integer getQuantidadeEm4() {return quantidadeEm4;}
193
        public void setQuantidadeEm4(Integer quantidadeEm4) {this.quantidadeEm4 = quantidadeEm4;}
194
 
195
        public Double getTotalEm5() {return totalEm5;}
196
        public void setTotalEm5(Double totalEm5) {this.totalEm5 = totalEm5;}
197
        public Integer getQuantidadeEm5() {return quantidadeEm5;}
198
        public void setQuantidadeEm5(Integer quantidadeEm5) {this.quantidadeEm5 = quantidadeEm5;}
199
 
200
        public Double getTotalEm6() {return totalEm6;}
201
        public void setTotalEm6(Double totalEm6) {this.totalEm6 = totalEm6;}
202
        public Integer getQuantidadeEm6() {return quantidadeEm6;}
203
        public void setQuantidadeEm6(Integer quantidadeEm6) {this.quantidadeEm6 = quantidadeEm6;}
204
 
205
        public Double getTotalEm7() {return totalEm7;}
206
        public void setTotalEm7(Double totalEm7) {this.totalEm7 = totalEm7;}
207
        public Integer getQuantidadeEm7() {return quantidadeEm7;}
208
        public void setQuantidadeEm7(Integer quantidadeEm7) {this.quantidadeEm7 = quantidadeEm7;}
209
 
210
        public Double getTotalEm8() {return totalEm8;}
211
        public void setTotalEm8(Double totalEm8) {this.totalEm8 = totalEm8;}
212
        public Integer getQuantidadeEm8() {return quantidadeEm8;}
213
        public void setQuantidadeEm8(Integer quantidadeEm8) {this.quantidadeEm8 = quantidadeEm8;}
214
 
215
        public Double getTotalEm9() {return totalEm9;}
216
        public void setTotalEm9(Double totalEm9) {this.totalEm9 = totalEm9;}
217
        public Integer getQuantidadeEm9() {return quantidadeEm9;}
218
        public void setQuantidadeEm9(Integer quantidadeEm9) {this.quantidadeEm9 = quantidadeEm9;}
219
 
220
        public Double getTotalEm10() {return totalEm10;}
221
        public void setTotalEm10(Double totalEm10) {this.totalEm10 = totalEm10;}
222
        public Integer getQuantidadeEm10() {return quantidadeEm10;}
223
        public void setQuantidadeEm10(Integer quantidadeEm10) {this.quantidadeEm10 = quantidadeEm10;}
224
 
225
        public Double getTotalEm11() {return totalEm11;}
226
        public void setTotalEm11(Double totalEm11) {this.totalEm11 = totalEm11;}
227
        public Integer getQuantidadeEm11() {return quantidadeEm11;}
228
        public void setQuantidadeEm11(Integer quantidadeEm11) {this.quantidadeEm11 = quantidadeEm11;}
229
 
230
        public Double getTotalEm12() {return totalEm12;}
231
        public void setTotalEm12(Double totalEm12) {this.totalEm12 = totalEm12;}
232
        public Integer getQuantidadeEm12() {return quantidadeEm12;}
233
        public void setQuantidadeEm12(Integer quantidadeEm12) {this.quantidadeEm12 = quantidadeEm12;}
234
 
235
        public Double getTotalNoPagseguro() {return totalNoPagseguro;}
236
        public void setTotalNoPagseguro(Double totalNoPagseguro) {this.totalNoPagseguro = totalNoPagseguro;}
237
        public Integer getQuantidadeNoPagseguro() {return quantidadeNoPagseguro;}
238
        public void setQuantidadeNoPagseguro(Integer quantidadeNoPagseguro) {this.quantidadeNoPagseguro = quantidadeNoPagseguro;}
239
 
240
        public Double getTotalNoPix() {return totalNoPix;}
241
        public void setTotalNoPix(Double totalNoPix) {this.totalNoPix = totalNoPix;}
242
        public Integer getQuantidadeNoPix() {return quantidadeNoPix;}
243
        public void setQuantidadeNoPix(Integer quantidadeNoPix) {this.quantidadeNoPix = quantidadeNoPix;}
244
 
245
        public Double getTotalEmOutros() {return totalEmOutros;}
246
        public void setTotalEmOutros(Double totalEmOutros) {this.totalEmOutros = totalEmOutros;}
247
        public Integer getQuantidadeEmOutros() {return quantidadeEmOutros;}
248
        public void setQuantidadeEmOutros(Integer quantidadeEmOutros) {this.quantidadeEmOutros = quantidadeEmOutros;}
249
 
250
        public Double getSubtotal() {
251
                return subtotal;
252
        }
253
        public void setSubtotal(Double subtotal) {
254
                this.subtotal = subtotal;
255
        }
256
 
257
        public Double getTotal() {
258
                return total;
259
        }
260
        public void setTotal(Double total) {
261
                this.total = total;
262
        }
263
 
264
        public Double getTotalPagamentos() {
265
                Double totalPagamentos = new Double(0.0);
266
                for (Pagamento pagamento : getListaPagamentos()) {
267
                        totalPagamentos = totalPagamentos + pagamento.getValor();
268
                }
269
                return totalPagamentos;
270
        }
271
 
272
        public void iniciarFechamento() {
273
                for (Venda venda : getListaVendas()) {
274
                        for (VendaFormaPagamento vendaFormaPagamento : venda.getListaVendaFormaPagamentos()) {
275
                                total = total + vendaFormaPagamento.getValorPagamento();
276
                                if (vendaFormaPagamento.getFormaPagamento().formaPagamentoEhDinheiro()) {
277
                                        totalEmDinheiro = totalEmDinheiro + vendaFormaPagamento.getValorPagamento();
278
                                } else if (vendaFormaPagamento.getFormaPagamento().formaPagamentoEhDebito()) {
279
                                        quantidadeEmCartao = quantidadeEmCartao + 1;
280
                                        quantidadeNoDebito = quantidadeNoDebito + 1;
281
                                        totalEmCartao = totalEmCartao + vendaFormaPagamento.getValorPagamento();
282
                                        totalNoDebito = totalNoDebito + vendaFormaPagamento.getValorPagamento();
283
                                } else if (vendaFormaPagamento.getFormaPagamento().formaPagamentoEhPagseguro()) {
284
                                        quantidadeNoPagseguro = quantidadeNoPagseguro + 1;
285
                                        totalNoPagseguro = totalNoPagseguro + vendaFormaPagamento.getValorPagamento();
286
                                } else if (vendaFormaPagamento.getFormaPagamento().formaPagamentoEhPix()) {
287
                                        quantidadeNoPix = quantidadeNoPix + 1;
288
                                        totalNoPix = totalNoPix + vendaFormaPagamento.getValorPagamento();
289
                                } else if (vendaFormaPagamento.getFormaPagamento().formaPagamentoEhOutros()) {
290
                                        quantidadeEmOutros = quantidadeEmOutros + 1;
291
                                        totalEmOutros = totalEmOutros + vendaFormaPagamento.getValorPagamento();
292
                                } else if (vendaFormaPagamento.getFormaPagamento().formaPagamentoEh1x()) {
293
                                        quantidadeEmCartao = quantidadeEmCartao + 1;
294
                                        quantidadeEm1 = quantidadeEm1 + 1;
295
                                        totalEmCartao = totalEmCartao + vendaFormaPagamento.getValorPagamento();
296
                                        totalEm1 = totalEm1 + vendaFormaPagamento.getValorPagamento();
297
                                } else if (vendaFormaPagamento.getFormaPagamento().formaPagamentoEh2x()) {
298
                                        quantidadeEmCartao = quantidadeEmCartao + 1;
299
                                        quantidadeEm2 = quantidadeEm2 + 1;
300
                                        totalEmCartao = totalEmCartao + vendaFormaPagamento.getValorPagamento();
301
                                        totalEm2 = totalEm2 + vendaFormaPagamento.getValorPagamento();
302
                                } else if (vendaFormaPagamento.getFormaPagamento().formaPagamentoEh3x()) {
303
                                        quantidadeEmCartao = quantidadeEmCartao + 1;
304
                                        quantidadeEm3 = quantidadeEm3 + 1;
305
                                        totalEmCartao = totalEmCartao + vendaFormaPagamento.getValorPagamento();
306
                                        totalEm3 = totalEm3 + vendaFormaPagamento.getValorPagamento();
307
                                } else if (vendaFormaPagamento.getFormaPagamento().formaPagamentoEh4x()) {
308
                                        quantidadeEmCartao = quantidadeEmCartao + 1;
309
                                        quantidadeEm4 = quantidadeEm4 + 1;
310
                                        totalEmCartao = totalEmCartao + vendaFormaPagamento.getValorPagamento();
311
                                        totalEm4 = totalEm4 + vendaFormaPagamento.getValorPagamento();
312
                                } else if (vendaFormaPagamento.getFormaPagamento().formaPagamentoEh5x()) {
313
                                        quantidadeEmCartao = quantidadeEmCartao + 1;
314
                                        quantidadeEm5 = quantidadeEm5 + 1;
315
                                        totalEmCartao = totalEmCartao + vendaFormaPagamento.getValorPagamento();
316
                                        totalEm5 = totalEm5 + vendaFormaPagamento.getValorPagamento();
317
                                } else if (vendaFormaPagamento.getFormaPagamento().formaPagamentoEh6x()) {
318
                                        quantidadeEmCartao = quantidadeEmCartao + 1;
319
                                        quantidadeEm6 = quantidadeEm6 + 1;
320
                                        totalEmCartao = totalEmCartao + vendaFormaPagamento.getValorPagamento();
321
                                        totalEm6 = totalEm6 + vendaFormaPagamento.getValorPagamento();
322
                                } else if (vendaFormaPagamento.getFormaPagamento().formaPagamentoEh7x()) {
323
                                        quantidadeEmCartao = quantidadeEmCartao + 1;
324
                                        quantidadeEm7 = quantidadeEm7 + 1;
325
                                        totalEmCartao = totalEmCartao + vendaFormaPagamento.getValorPagamento();
326
                                        totalEm7 = totalEm7 + vendaFormaPagamento.getValorPagamento();
327
                                } else if (vendaFormaPagamento.getFormaPagamento().formaPagamentoEh8x()) {
328
                                        quantidadeEmCartao = quantidadeEmCartao + 1;
329
                                        quantidadeEm8 = quantidadeEm8 + 1;
330
                                        totalEmCartao = totalEmCartao + vendaFormaPagamento.getValorPagamento();
331
                                        totalEm8 = totalEm8 + vendaFormaPagamento.getValorPagamento();
332
                                } else if (vendaFormaPagamento.getFormaPagamento().formaPagamentoEh9x()) {
333
                                        quantidadeEmCartao = quantidadeEmCartao + 1;
334
                                        quantidadeEm9 = quantidadeEm9 + 1;
335
                                        totalEmCartao = totalEmCartao + vendaFormaPagamento.getValorPagamento();
336
                                        totalEm9 = totalEm9 + vendaFormaPagamento.getValorPagamento();
337
                                } else if (vendaFormaPagamento.getFormaPagamento().formaPagamentoEh10x()) {
338
                                        quantidadeEmCartao = quantidadeEmCartao + 1;
339
                                        quantidadeEm10 = quantidadeEm10 + 1;
340
                                        totalEmCartao = totalEmCartao + vendaFormaPagamento.getValorPagamento();
341
                                        totalEm10 = totalEm10 + vendaFormaPagamento.getValorPagamento();
342
                                } else if (vendaFormaPagamento.getFormaPagamento().formaPagamentoEh11x()) {
343
                                        quantidadeEmCartao = quantidadeEmCartao + 1;
344
                                        quantidadeEm11 = quantidadeEm11 + 1;
345
                                        totalEmCartao = totalEmCartao + vendaFormaPagamento.getValorPagamento();
346
                                        totalEm10 = totalEm10 + vendaFormaPagamento.getValorPagamento();
347
                                } else if (vendaFormaPagamento.getFormaPagamento().formaPagamentoEh12x()) {
348
                                        quantidadeEmCartao = quantidadeEmCartao + 1;
349
                                        quantidadeEm12 = quantidadeEm12 + 1;
350
                                        totalEmCartao = totalEmCartao + vendaFormaPagamento.getValorPagamento();
351
                                        totalEm10 = totalEm10 + vendaFormaPagamento.getValorPagamento();
352
                                }
353
                        }
354
                }
355
                subtotal = totalEmDinheiro - getTotalPagamentos();
356
                processado = true;
357
        }
358
 
359
        public Boolean getVendasConferidas() {
360
                for (Venda venda : getListaVendas()) {
361
                        if (venda.getTipoSituacao().equals(TipoSituacaoVenda.NOVO.getValor())) {
362
                                return false;
363
                        }
364
                }
365
                return true;
366
        }
367
 
368
}