package br.com.ec.domain.dto;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import br.com.ec.domain.model.Loja;
import br.com.ec.domain.model.Pagamento;
import br.com.ec.domain.model.Venda;
import br.com.ec.domain.model.VendaFormaPagamento;
import br.com.ec.domain.model.tipos.TipoSituacaoVenda;
public class ParametrosFecharCaixaDTO
{
private Loja loja
;
private Date dataVendas
;
private Boolean processado
;
private List<Venda
> listaVendas
;
private List<Pagamento
> listaPagamentos
;
private List<CartaoResumoDTO
> cartoesResumo
;
private CartaoResumoDTO cartaoResumo
;
private Double totalEmDinheiro
;
private Integer quantidadeEmCartao
;
private Double totalEmCartao
;
private Integer quantidadeNoDebito
;
private Double totalNoDebito
;
private Integer quantidadeNoCredito
;
private Double totalNoCredito
;
private Integer quantidadeEm1
;
private Double totalEm1
;
private Integer quantidadeEm2
;
private Double totalEm2
;
private Integer quantidadeEm3
;
private Double totalEm3
;
private Integer quantidadeEm4
;
private Double totalEm4
;
private Integer quantidadeEm5
;
private Double totalEm5
;
private Integer quantidadeEm6
;
private Double totalEm6
;
private Integer quantidadeEm7
;
private Double totalEm7
;
private Integer quantidadeEm8
;
private Double totalEm8
;
private Integer quantidadeEm9
;
private Double totalEm9
;
private Integer quantidadeEm10
;
private Double totalEm10
;
private Integer quantidadeEm11
;
private Double totalEm11
;
private Integer quantidadeEm12
;
private Double totalEm12
;
private Integer quantidadeEm13
;
private Double totalEm13
;
private Integer quantidadeEm14
;
private Double totalEm14
;
private Integer quantidadeEm15
;
private Double totalEm15
;
private Integer quantidadeNoPagseguro
;
private Double totalNoPagseguro
;
private Integer quantidadeNoPix
;
private Double totalNoPix
;
private Integer quantidadeNaTransferencia
;
private Double totalNaTransferencia
;
private Integer quantidadeEmOutros
;
private Double totalEmOutros
;
private Double subtotal
;
private Double total
;
public ParametrosFecharCaixaDTO
() {
iniciarEntidade
();
}
public ParametrosFecharCaixaDTO
(Loja loja,
Date dataRecebimento
) {
this.
loja = loja
;
this.
dataVendas = dataRecebimento
;
iniciarEntidade
();
}
private void iniciarEntidade
() {
processado =
false;
listaVendas =
new ArrayList<Venda
>();
listaPagamentos =
new ArrayList<Pagamento
>();
totalEmDinheiro =
new Double(0.0);
totalEmCartao =
new Double(0.0);
quantidadeEmCartao =
new Integer(0);
totalNoDebito =
new Double(0.0);
quantidadeNoDebito =
new Integer(0);
totalNoCredito =
new Double(0.0);
quantidadeNoCredito =
new Integer(0);
totalEm1 =
new Double(0.0);
quantidadeEm1 =
new Integer(0);
totalEm2 =
new Double(0.0);
quantidadeEm2 =
new Integer(0);
totalEm3 =
new Double(0.0);
quantidadeEm3 =
new Integer(0);
totalEm4 =
new Double(0.0);
quantidadeEm4 =
new Integer(0);
totalEm5 =
new Double(0.0);
quantidadeEm5 =
new Integer(0);
totalEm6 =
new Double(0.0);
quantidadeEm6 =
new Integer(0);
totalEm7 =
new Double(0.0);
quantidadeEm7 =
new Integer(0);
totalEm8 =
new Double(0.0);
quantidadeEm8 =
new Integer(0);
totalEm9 =
new Double(0.0);
quantidadeEm9 =
new Integer(0);
totalEm10 =
new Double(0.0);
quantidadeEm10 =
new Integer(0);
totalEm11 =
new Double(0.0);
quantidadeEm11 =
new Integer(0);
totalEm12 =
new Double(0.0);
quantidadeEm12 =
new Integer(0);
totalEm13 =
new Double(0.0);
quantidadeEm13 =
new Integer(0);
totalEm14 =
new Double(0.0);
quantidadeEm14 =
new Integer(0);
totalEm15 =
new Double(0.0);
quantidadeEm15 =
new Integer(0);
totalNoPagseguro =
new Double(0.0);
quantidadeNoPagseguro =
new Integer(0);
totalNoPix =
new Double(0.0);
quantidadeNoPix =
new Integer(0);
totalNaTransferencia =
new Double(0.0);
quantidadeNaTransferencia =
new Integer(0);
totalEmOutros =
new Double(0.0);
quantidadeEmOutros=
new Integer(0);
subtotal =
new Double(0.0);
total =
new Double(0.0);
}
public Loja getLoja
() {
return loja
;
}
public void setLoja
(Loja loja
) {
this.
loja = loja
;
}
public Date getDataVendas
() {
return dataVendas
;
}
public void setDataVendas
(Date dataVendas
) {
this.
dataVendas = dataVendas
;
}
public Boolean getProcessado
() {
return processado
;
}
public void setProcessado
(Boolean processado
) {
this.
processado = processado
;
}
public List<Venda
> getListaVendas
() {
return listaVendas
;
}
public void setListaVendas
(List<Venda
> listaVendas
) {
this.
listaVendas = listaVendas
;
}
public List<Pagamento
> getListaPagamentos
() {return listaPagamentos
;}
public void setListaPagamentos
(List<Pagamento
> listaPagamentos
) {this.
listaPagamentos = listaPagamentos
;}
public CartaoResumoDTO getCartaoResumo
() {
return cartaoResumo
;
}
public void setCartaoResumo
(CartaoResumoDTO cartaoResumo
) {
this.
cartaoResumo = cartaoResumo
;
}
public Double getTotalEmDinheiro
() {return totalEmDinheiro
;}
public void setTotalEmDinheiro
(Double totalEmDinheiro
) {this.
totalEmDinheiro = totalEmDinheiro
;}
public Double getTotalEmCartao
() {return totalEmCartao
;}
public void setTotalEmCartao
(Double totalEmCartao
) {this.
totalEmCartao = totalEmCartao
;}
public Integer getQuantidadeEmCartao
() {return quantidadeEmCartao
;}
public void setQuantidadeEmCartao
(Integer quantidadeEmCartao
) {this.
quantidadeEmCartao = quantidadeEmCartao
;}
public Double getTotalNoDebito
() {return totalNoDebito
;}
public void setTotalNoDebito
(Double totalNoDebito
) {this.
totalNoDebito = totalNoDebito
;}
public Integer getQuantidadeNoDebito
() {return quantidadeNoDebito
;}
public void setQuantidadeNoDebito
(Integer quantidadeNoDebito
) {this.
quantidadeNoDebito = quantidadeNoDebito
;}
public Double getTotalNoCredito
() {return totalNoCredito
;}
public void setTotalNoCredito
(Double totalNoCredito
) {this.
totalNoCredito = totalNoCredito
;}
public Integer getQuantidadeNoCredito
() {return quantidadeNoCredito
;}
public void setQuantidadeNoCredito
(Integer quantidadeNoCredito
) {this.
quantidadeNoCredito = quantidadeNoCredito
;}
public Double getTotalEm1
() {return totalEm1
;}
public void setTotalEm1
(Double totalEm1
) {this.
totalEm1 = totalEm1
;}
public Integer getQuantidadeEm1
() {return quantidadeEm1
;}
public void setQuantidadeEm1
(Integer quantidadeEm1
) {this.
quantidadeEm1 = quantidadeEm1
;}
public Double getTotalEm2
() {return totalEm2
;}
public void setTotalEm2
(Double totalEm2
) {this.
totalEm2 = totalEm2
;}
public Integer getQuantidadeEm2
() {return quantidadeEm2
;}
public void setQuantidadeEm2
(Integer quantidadeEm2
) {this.
quantidadeEm2 = quantidadeEm2
;}
public Double getTotalEm3
() {return totalEm3
;}
public void setTotalEm3
(Double totalEm3
) {this.
totalEm3 = totalEm3
;}
public Integer getQuantidadeEm3
() {return quantidadeEm3
;}
public void setQuantidadeEm3
(Integer quantidadeEm3
) {this.
quantidadeEm3 = quantidadeEm3
;}
public Double getTotalEm4
() {return totalEm4
;}
public void setTotalEm4
(Double totalEm4
) {this.
totalEm4 = totalEm4
;}
public Integer getQuantidadeEm4
() {return quantidadeEm4
;}
public void setQuantidadeEm4
(Integer quantidadeEm4
) {this.
quantidadeEm4 = quantidadeEm4
;}
public Double getTotalEm5
() {return totalEm5
;}
public void setTotalEm5
(Double totalEm5
) {this.
totalEm5 = totalEm5
;}
public Integer getQuantidadeEm5
() {return quantidadeEm5
;}
public void setQuantidadeEm5
(Integer quantidadeEm5
) {this.
quantidadeEm5 = quantidadeEm5
;}
public Double getTotalEm6
() {return totalEm6
;}
public void setTotalEm6
(Double totalEm6
) {this.
totalEm6 = totalEm6
;}
public Integer getQuantidadeEm6
() {return quantidadeEm6
;}
public void setQuantidadeEm6
(Integer quantidadeEm6
) {this.
quantidadeEm6 = quantidadeEm6
;}
public Double getTotalEm7
() {return totalEm7
;}
public void setTotalEm7
(Double totalEm7
) {this.
totalEm7 = totalEm7
;}
public Integer getQuantidadeEm7
() {return quantidadeEm7
;}
public void setQuantidadeEm7
(Integer quantidadeEm7
) {this.
quantidadeEm7 = quantidadeEm7
;}
public Double getTotalEm8
() {return totalEm8
;}
public void setTotalEm8
(Double totalEm8
) {this.
totalEm8 = totalEm8
;}
public Integer getQuantidadeEm8
() {return quantidadeEm8
;}
public void setQuantidadeEm8
(Integer quantidadeEm8
) {this.
quantidadeEm8 = quantidadeEm8
;}
public Double getTotalEm9
() {return totalEm9
;}
public void setTotalEm9
(Double totalEm9
) {this.
totalEm9 = totalEm9
;}
public Integer getQuantidadeEm9
() {return quantidadeEm9
;}
public void setQuantidadeEm9
(Integer quantidadeEm9
) {this.
quantidadeEm9 = quantidadeEm9
;}
public Double getTotalEm10
() {return totalEm10
;}
public void setTotalEm10
(Double totalEm10
) {this.
totalEm10 = totalEm10
;}
public Integer getQuantidadeEm10
() {return quantidadeEm10
;}
public void setQuantidadeEm10
(Integer quantidadeEm10
) {this.
quantidadeEm10 = quantidadeEm10
;}
public Double getTotalEm11
() {return totalEm11
;}
public void setTotalEm11
(Double totalEm11
) {this.
totalEm11 = totalEm11
;}
public Integer getQuantidadeEm11
() {return quantidadeEm11
;}
public void setQuantidadeEm11
(Integer quantidadeEm11
) {this.
quantidadeEm11 = quantidadeEm11
;}
public Double getTotalEm12
() {return totalEm12
;}
public void setTotalEm12
(Double totalEm12
) {this.
totalEm12 = totalEm12
;}
public Integer getQuantidadeEm12
() {return quantidadeEm12
;}
public void setQuantidadeEm12
(Integer quantidadeEm12
) {this.
quantidadeEm12 = quantidadeEm12
;}
public Double getTotalEm13
() {return totalEm13
;}
public void setTotalEm13
(Double totalEm13
) {this.
totalEm13 = totalEm13
;}
public Integer getQuantidadeEm13
() {return quantidadeEm13
;}
public void setQuantidadeEm13
(Integer quantidadeEm13
) {this.
quantidadeEm13 = quantidadeEm13
;}
public Double getTotalEm14
() {return totalEm14
;}
public void setTotalEm14
(Double totalEm14
) {this.
totalEm14 = totalEm14
;}
public Integer getQuantidadeEm14
() {return quantidadeEm14
;}
public void setQuantidadeEm14
(Integer quantidadeEm14
) {this.
quantidadeEm14 = quantidadeEm14
;}
public Double getTotalEm15
() {return totalEm15
;}
public void setTotalEm15
(Double totalEm15
) {this.
totalEm15 = totalEm15
;}
public Integer getQuantidadeEm15
() {return quantidadeEm15
;}
public void setQuantidadeEm15
(Integer quantidadeEm15
) {this.
quantidadeEm15 = quantidadeEm15
;}
public Double getTotalNoPagseguro
() {return totalNoPagseguro
;}
public void setTotalNoPagseguro
(Double totalNoPagseguro
) {this.
totalNoPagseguro = totalNoPagseguro
;}
public Integer getQuantidadeNoPagseguro
() {return quantidadeNoPagseguro
;}
public void setQuantidadeNoPagseguro
(Integer quantidadeNoPagseguro
) {this.
quantidadeNoPagseguro = quantidadeNoPagseguro
;}
public Double getTotalNoPix
() {return totalNoPix
;}
public void setTotalNoPix
(Double totalNoPix
) {this.
totalNoPix = totalNoPix
;}
public Integer getQuantidadeNoPix
() {return quantidadeNoPix
;}
public void setQuantidadeNoPix
(Integer quantidadeNoPix
) {this.
quantidadeNoPix = quantidadeNoPix
;}
public Double getTotalNaTransferencia
() {return totalNaTransferencia
;}
public void setTotalNaTransferencia
(Double totalNaTransferencia
) {this.
totalNaTransferencia = totalNaTransferencia
;}
public Integer getQuantidadeNaTransferencia
() {return quantidadeNaTransferencia
;}
public void setQuantidadeNaTransferencia
(Integer quantidadeNaTransferencia
) {this.
quantidadeNaTransferencia = quantidadeNaTransferencia
;}
public Double getTotalEmOutros
() {return totalEmOutros
;}
public void setTotalEmOutros
(Double totalEmOutros
) {this.
totalEmOutros = totalEmOutros
;}
public Integer getQuantidadeEmOutros
() {return quantidadeEmOutros
;}
public void setQuantidadeEmOutros
(Integer quantidadeEmOutros
) {this.
quantidadeEmOutros = quantidadeEmOutros
;}
public Double getSubtotal
() {
return subtotal
;
}
public void setSubtotal
(Double subtotal
) {
this.
subtotal = subtotal
;
}
public Double getTotal
() {
return total
;
}
public void setTotal
(Double total
) {
this.
total = total
;
}
public Double getTotalPagamentos
() {
Double totalPagamentos =
new Double(0.0);
for (Pagamento pagamento : getListaPagamentos
()) {
totalPagamentos = totalPagamentos + pagamento.
getValor();
}
return totalPagamentos
;
}
public void iniciarFechamento
() {
for (Venda venda : getListaVendas
()) {
for (VendaFormaPagamento vendaFormaPagamento : venda.
getListaVendaFormaPagamentos()) {
total = total + vendaFormaPagamento.
getValorPagamento();
if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEhDinheiro()) {
totalEmDinheiro = totalEmDinheiro + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEhDebito()) {
quantidadeEmCartao = quantidadeEmCartao +
1;
quantidadeNoDebito = quantidadeNoDebito +
1;
totalEmCartao = totalEmCartao + vendaFormaPagamento.
getValorPagamento();
totalNoDebito = totalNoDebito + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEhPagseguro()) {
quantidadeNoPagseguro = quantidadeNoPagseguro +
1;
totalNoPagseguro = totalNoPagseguro + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEhPix()) {
quantidadeNoPix = quantidadeNoPix +
1;
totalNoPix = totalNoPix + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEhTransferencia()) {
quantidadeNaTransferencia = quantidadeNaTransferencia +
1;
totalNaTransferencia= totalNaTransferencia + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEhOutros()) {
quantidadeEmOutros = quantidadeEmOutros +
1;
totalEmOutros = totalEmOutros + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEh1x()) {
quantidadeEmCartao = quantidadeEmCartao +
1;
quantidadeEm1 = quantidadeEm1 +
1;
totalEmCartao = totalEmCartao + vendaFormaPagamento.
getValorPagamento();
totalEm1 = totalEm1 + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEh2x()) {
quantidadeEmCartao = quantidadeEmCartao +
1;
quantidadeEm2 = quantidadeEm2 +
1;
totalEmCartao = totalEmCartao + vendaFormaPagamento.
getValorPagamento();
totalEm2 = totalEm2 + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEh3x()) {
quantidadeEmCartao = quantidadeEmCartao +
1;
quantidadeEm3 = quantidadeEm3 +
1;
totalEmCartao = totalEmCartao + vendaFormaPagamento.
getValorPagamento();
totalEm3 = totalEm3 + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEh4x()) {
quantidadeEmCartao = quantidadeEmCartao +
1;
quantidadeEm4 = quantidadeEm4 +
1;
totalEmCartao = totalEmCartao + vendaFormaPagamento.
getValorPagamento();
totalEm4 = totalEm4 + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEh5x()) {
quantidadeEmCartao = quantidadeEmCartao +
1;
quantidadeEm5 = quantidadeEm5 +
1;
totalEmCartao = totalEmCartao + vendaFormaPagamento.
getValorPagamento();
totalEm5 = totalEm5 + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEh6x()) {
quantidadeEmCartao = quantidadeEmCartao +
1;
quantidadeEm6 = quantidadeEm6 +
1;
totalEmCartao = totalEmCartao + vendaFormaPagamento.
getValorPagamento();
totalEm6 = totalEm6 + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEh7x()) {
quantidadeEmCartao = quantidadeEmCartao +
1;
quantidadeEm7 = quantidadeEm7 +
1;
totalEmCartao = totalEmCartao + vendaFormaPagamento.
getValorPagamento();
totalEm7 = totalEm7 + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEh8x()) {
quantidadeEmCartao = quantidadeEmCartao +
1;
quantidadeEm8 = quantidadeEm8 +
1;
totalEmCartao = totalEmCartao + vendaFormaPagamento.
getValorPagamento();
totalEm8 = totalEm8 + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEh9x()) {
quantidadeEmCartao = quantidadeEmCartao +
1;
quantidadeEm9 = quantidadeEm9 +
1;
totalEmCartao = totalEmCartao + vendaFormaPagamento.
getValorPagamento();
totalEm9 = totalEm9 + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEh10x()) {
quantidadeEmCartao = quantidadeEmCartao +
1;
quantidadeEm10 = quantidadeEm10 +
1;
totalEmCartao = totalEmCartao + vendaFormaPagamento.
getValorPagamento();
totalEm10 = totalEm10 + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEh11x()) {
quantidadeEmCartao = quantidadeEmCartao +
1;
quantidadeEm11 = quantidadeEm11 +
1;
totalEmCartao = totalEmCartao + vendaFormaPagamento.
getValorPagamento();
totalEm10 = totalEm10 + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEh12x()) {
quantidadeEmCartao = quantidadeEmCartao +
1;
quantidadeEm12 = quantidadeEm12 +
1;
totalEmCartao = totalEmCartao + vendaFormaPagamento.
getValorPagamento();
totalEm12 = totalEm12 + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEh13x()) {
quantidadeEmCartao = quantidadeEmCartao +
1;
quantidadeEm13 = quantidadeEm13 +
1;
totalEmCartao = totalEmCartao + vendaFormaPagamento.
getValorPagamento();
totalEm13 = totalEm13 + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEh14x()) {
quantidadeEmCartao = quantidadeEmCartao +
1;
quantidadeEm14 = quantidadeEm14 +
1;
totalEmCartao = totalEmCartao + vendaFormaPagamento.
getValorPagamento();
totalEm14 = totalEm14 + vendaFormaPagamento.
getValorPagamento();
} else if (vendaFormaPagamento.
getFormaPagamento().
formaPagamentoEh15x()) {
quantidadeEmCartao = quantidadeEmCartao +
1;
quantidadeEm15 = quantidadeEm15 +
1;
totalEmCartao = totalEmCartao + vendaFormaPagamento.
getValorPagamento();
totalEm15 = totalEm15 + vendaFormaPagamento.
getValorPagamento();
}
}
}
subtotal = totalEmDinheiro - getTotalPagamentos
();
processado =
true;
}
public Boolean getVendasConferidas
() {
for (Venda venda : getListaVendas
()) {
if (venda.
getTipoSituacao().
equals(TipoSituacaoVenda.
NOVO.
getValor())) {
return false;
}
}
return true;
}
}