Subversion Repositories Integrator Subversion

Rev

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