fixes bug #8826
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@67509 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
65b576fe38
commit
f18069638c
|
@ -55,7 +55,7 @@ public interface ConferenciaComissaoService extends GenericService<Conferencia,
|
|||
|
||||
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;
|
||||
|
||||
|
|
|
@ -376,7 +376,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|||
}
|
||||
|
||||
@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;
|
||||
if (statusBilhete != null && statusBilhete.length > 0) {
|
||||
lStatusBilhete = Arrays.asList(statusBilhete);
|
||||
|
@ -389,11 +389,6 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|||
continue;
|
||||
}
|
||||
|
||||
if(indreimpression != null && !indreimpression.equals(boletoComissao.getIndreimpresion())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if ((lStatusBilhete == null || lStatusBilhete.contains(boletoComissao.getIndstatusboletoEnum())) &&
|
||||
!boletoComissao.isVendaBilheteConfirmaAberto(boletoComissao.getTipoVenta())) {
|
||||
//log.info(boletoComissao.toString());
|
||||
|
@ -411,6 +406,9 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|||
BigDecimal totalOcd = BigDecimal.ZERO;
|
||||
if (lsBoletoComissao != null) {
|
||||
for (BoletoComissao boletoComissao : lsBoletoComissao) {
|
||||
if(boletoComissao.isNaoSomarBilhete()) {
|
||||
continue;
|
||||
}
|
||||
if (boletoComissao.isOcd()) {
|
||||
totalOcd = totalOcd.add(boletoComissao.getTotal());
|
||||
} else if (boletoComissao.isMotivocancelacionDevolvido()) {
|
||||
|
@ -467,33 +465,65 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|||
resumoComissao.setTotalOcd(totalOcd);
|
||||
|
||||
carregarTotalFormapago(resumoComissao, boletoComissaos, lsEventosFinanceiros);
|
||||
|
||||
subtrairOcdFormapagoDinheiro(totalOcd, resumoComissao);
|
||||
carregarTotalDeposito(resumoComissao, boletoComissaos, lsEventosFinanceiros);
|
||||
|
||||
resumoComissao.setValorDeposito(carregarTotalDeposito(resumoComissao));
|
||||
resumoComissao.setQuantidadeEcf(puntoVentaDAO.quantidadeECFPorPuntoVenta(conferencia.getEmpresa().getEmpresaId(), conferencia.getPuntoVenta().getPuntoventaId()));
|
||||
|
||||
return resumoComissao;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna o valor total de deposito
|
||||
* Calcula o total de deposito
|
||||
* @param resumoComissao
|
||||
* @param boletoComissaos
|
||||
* @param lsEventosFinanceiros
|
||||
* @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(),
|
||||
Constantes.FORMA_PAGO_TROCA_PASSAGEM.intValue()));
|
||||
|
||||
BigDecimal total = BigDecimal.ZERO;
|
||||
BigDecimal totalDeposito = BigDecimal.ZERO;
|
||||
|
||||
for (FormapagoVO formapago : resumoComissao.getTotalFormapago()) {
|
||||
if(formaspagosDeposito.contains(formapago.getFormapagoId())) {
|
||||
total = MoneyHelper.somar(total, formapago.getImporte());
|
||||
for (BoletoComissao boletoComissao : boletoComissaos) {
|
||||
if(boletoComissao.isNaoSomarBilhete()) {
|
||||
continue;
|
||||
}
|
||||
for (FormapagoVO formapago : boletoComissao.getFormapagos()) {
|
||||
if(formaspagosDeposito.contains(formapago.getFormapagoId())) {
|
||||
//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);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -980,6 +980,10 @@ public class BoletoComissao {
|
|||
return true;
|
||||
}
|
||||
|
||||
if(getIndreimpresion() != null && getIndreimpresion()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue