Subversion Repositories Integrator Subversion

Rev

Rev 106 | Rev 315 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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