Subversion Repositories Integrator Subversion

Rev

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