wilian 2017-03-31 17:59:40 +00:00
parent 65b576fe38
commit f18069638c
3 changed files with 50 additions and 16 deletions

View File

@ -55,7 +55,7 @@ public interface ConferenciaComissaoService extends GenericService<Conferencia,
public boolean isOcdSemConferencia(List<OcdVO> lsOcd) throws BusinessException; public boolean isOcdSemConferencia(List<OcdVO> lsOcd) throws BusinessException;
public BigDecimal totalizarBoletoComissao(List<BoletoComissao> lsBoletoComissao, Boolean indreimpression, IndStatusBoleto... statusBilhete) throws BusinessException; public BigDecimal totalizarBoletoComissao(List<BoletoComissao> lsBoletoComissao, IndStatusBoleto... statusBilhete) throws BusinessException;
public BigDecimal totalizarEventosFinanceiros(List<EventosFinanceirosVO> lsEventosFinanceiros) throws BusinessException; public BigDecimal totalizarEventosFinanceiros(List<EventosFinanceirosVO> lsEventosFinanceiros) throws BusinessException;

View File

@ -376,7 +376,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
} }
@Override @Override
public BigDecimal totalizarBoletoComissao(List<BoletoComissao> lsBoletoComissao, Boolean indreimpression, IndStatusBoleto... statusBilhete) throws BusinessException { public BigDecimal totalizarBoletoComissao(List<BoletoComissao> lsBoletoComissao, IndStatusBoleto... statusBilhete) throws BusinessException {
List<IndStatusBoleto> lStatusBilhete = null; List<IndStatusBoleto> lStatusBilhete = null;
if (statusBilhete != null && statusBilhete.length > 0) { if (statusBilhete != null && statusBilhete.length > 0) {
lStatusBilhete = Arrays.asList(statusBilhete); lStatusBilhete = Arrays.asList(statusBilhete);
@ -389,11 +389,6 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
continue; continue;
} }
if(indreimpression != null && !indreimpression.equals(boletoComissao.getIndreimpresion())) {
continue;
}
if ((lStatusBilhete == null || lStatusBilhete.contains(boletoComissao.getIndstatusboletoEnum())) && if ((lStatusBilhete == null || lStatusBilhete.contains(boletoComissao.getIndstatusboletoEnum())) &&
!boletoComissao.isVendaBilheteConfirmaAberto(boletoComissao.getTipoVenta())) { !boletoComissao.isVendaBilheteConfirmaAberto(boletoComissao.getTipoVenta())) {
//log.info(boletoComissao.toString()); //log.info(boletoComissao.toString());
@ -411,6 +406,9 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
BigDecimal totalOcd = BigDecimal.ZERO; BigDecimal totalOcd = BigDecimal.ZERO;
if (lsBoletoComissao != null) { if (lsBoletoComissao != null) {
for (BoletoComissao boletoComissao : lsBoletoComissao) { for (BoletoComissao boletoComissao : lsBoletoComissao) {
if(boletoComissao.isNaoSomarBilhete()) {
continue;
}
if (boletoComissao.isOcd()) { if (boletoComissao.isOcd()) {
totalOcd = totalOcd.add(boletoComissao.getTotal()); totalOcd = totalOcd.add(boletoComissao.getTotal());
} else if (boletoComissao.isMotivocancelacionDevolvido()) { } else if (boletoComissao.isMotivocancelacionDevolvido()) {
@ -467,33 +465,65 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
resumoComissao.setTotalOcd(totalOcd); resumoComissao.setTotalOcd(totalOcd);
carregarTotalFormapago(resumoComissao, boletoComissaos, lsEventosFinanceiros); carregarTotalFormapago(resumoComissao, boletoComissaos, lsEventosFinanceiros);
subtrairOcdFormapagoDinheiro(totalOcd, resumoComissao); subtrairOcdFormapagoDinheiro(totalOcd, resumoComissao);
carregarTotalDeposito(resumoComissao, boletoComissaos, lsEventosFinanceiros);
resumoComissao.setValorDeposito(carregarTotalDeposito(resumoComissao));
resumoComissao.setQuantidadeEcf(puntoVentaDAO.quantidadeECFPorPuntoVenta(conferencia.getEmpresa().getEmpresaId(), conferencia.getPuntoVenta().getPuntoventaId())); resumoComissao.setQuantidadeEcf(puntoVentaDAO.quantidadeECFPorPuntoVenta(conferencia.getEmpresa().getEmpresaId(), conferencia.getPuntoVenta().getPuntoventaId()));
return resumoComissao; return resumoComissao;
} }
/** /**
* Retorna o valor total de deposito * Calcula o total de deposito
* @param resumoComissao * @param resumoComissao
* @param boletoComissaos
* @param lsEventosFinanceiros
* @return * @return
*/ */
private BigDecimal carregarTotalDeposito(ResumoComissao resumoComissao) { private void carregarTotalDeposito(ResumoComissao resumoComissao, List<BoletoComissao> boletoComissaos, List<EventosFinanceirosVO> lsEventosFinanceiros) {
List<Integer> formaspagosDeposito = new ArrayList<Integer>(Arrays.asList(Constantes.FORMA_PAGO_DINHEIRO.intValue(), List<Integer> formaspagosDeposito = new ArrayList<Integer>(Arrays.asList(Constantes.FORMA_PAGO_DINHEIRO.intValue(),
Constantes.FORMA_PAGO_TROCA_PASSAGEM.intValue())); Constantes.FORMA_PAGO_TROCA_PASSAGEM.intValue()));
BigDecimal total = BigDecimal.ZERO; BigDecimal totalDeposito = BigDecimal.ZERO;
for (FormapagoVO formapago : resumoComissao.getTotalFormapago()) { for (BoletoComissao boletoComissao : boletoComissaos) {
if(boletoComissao.isNaoSomarBilhete()) {
continue;
}
for (FormapagoVO formapago : boletoComissao.getFormapagos()) {
if(formaspagosDeposito.contains(formapago.getFormapagoId())) { if(formaspagosDeposito.contains(formapago.getFormapagoId())) {
total = MoneyHelper.somar(total, formapago.getImporte()); //somando as vendas
if(boletoComissao.isAbaBilheteVendido() || boletoComissao.isAbaGapVendido() || boletoComissao.isAbaBilheteManual()) {
totalDeposito = MoneyHelper.somar(totalDeposito, formapago.getImporte());
//subtraindo os cancelamentos
} else if(boletoComissao.isAbaBilheteCancelado() || boletoComissao.isAbaGapCancelado()) {
totalDeposito = MoneyHelper.subtrair(totalDeposito, formapago.getImporte());
//subtraindo as trocas
} else if(boletoComissao.isAbaBilheteDevolvido() || boletoComissao.isAbaGapDevolvido()) {
if(boletoComissao.isMotivocancelacionTrocado() || boletoComissao.isMotivocancelacionDevolvido()) {
totalDeposito = MoneyHelper.subtrair(totalDeposito, formapago.getImporte());
}
}
}
} }
} }
return total; //calculando os movimentos financeiros
for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) {
if(formaspagosDeposito.contains(eventosFinanceiros.getFormapagoId())) {
if (eventosFinanceiros.isCredito()) {
totalDeposito = MoneyHelper.somar(totalDeposito, eventosFinanceiros.getImpingreso());
} else if (eventosFinanceiros.isDebito()) {
totalDeposito = MoneyHelper.subtrair(totalDeposito, eventosFinanceiros.getImpingreso());
}
}
}
//subtraindo as ocds pagas
totalDeposito = MoneyHelper.subtrair(totalDeposito, resumoComissao.getTotalOcd().getValorPagar());
resumoComissao.setValorDeposito(totalDeposito);
} }
/** /**

View File

@ -980,6 +980,10 @@ public class BoletoComissao {
return true; return true;
} }
if(getIndreimpresion() != null && getIndreimpresion()) {
return true;
}
return false; return false;
} }