wilian 2017-04-05 22:08:03 +00:00
parent 3bab18e657
commit e4f3a06d75
3 changed files with 41 additions and 36 deletions

View File

@ -531,19 +531,22 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
conferencia.getPuntoVenta(), conferencia.getDatamovimento());
StringBuilder sQuery = new StringBuilder()
.append("SELECT EE.BOLETO_ID AS \"boletoId\", EE.EVENTOEXTRA_ID AS \"eventoextraId\", EE.NUMDOCUMENTO AS \"numdocumento\", ")
.append("EE.IMPINGRESO AS \"impingreso\", TEE.DESCTIPOEVENTO AS \"desctipoevento\", EE.DESCINFO AS \"descinfo\", ")
.append("CFP.IMPORTE AS \"impingreso\", TEE.DESCTIPOEVENTO AS \"desctipoevento\", EE.DESCINFO AS \"descinfo\", ")
.append("LOG.STATUS AS \"status\", FP.FORMAPAGO_ID AS \"formapagoId\", FP.DESCPAGO AS \"descpago\", ")
.append("TEE.INDTIPO AS \"indtipo\", U.NOMBUSUARIO AS \"nombusuario\", LOG.LOGCONFERENCIA_ID AS \"logconferenciaId\", ")
.append("COMFP.COMEMPFORMAPAGO_ID AS \"comempformapagoId\", COMTEE.COMEMPTIPOEVENTOEXTRA_ID AS \"comemptipoeventoextraId\", ")
.append("CEC.INDEVENTOSFINANCEIROS AS \"exigeConferenciaAba\" ")
.append("CEC.INDEVENTOSFINANCEIROS AS \"exigeConferenciaAba\", B.NUMFOLIOSISTEMA \"numFolioSistema\" ")
.append("FROM EVENTO_EXTRA EE ")
.append("JOIN TIPO_EVENTO_EXTRA TEE ON EE.TIPOEVENTOEXTRA_ID = TEE.TIPOEVENTOEXTRA_ID ")
.append("JOIN CAJA_DIVERSOS CD ON CD.EVENTOEXTRA_ID = EE.EVENTOEXTRA_ID ")
.append("JOIN CAJA_DIVERSOS_PAGO CFP ON CFP.CAJADIVERSOS_ID = CD.CAJADIVERSOS_ID ")
.append("JOIN FORMA_PAGO FP ON FP.FORMAPAGO_ID = CFP.FORMAPAGO_ID ")
.append("INNER JOIN USUARIO U ON EE.USUARIO_ID = U.USUARIO_ID ")
.append("LEFT JOIN COM_EMP_CONFERENCIA CEC ON EE.EMPRESA_ID = CEC.EMPRESA_ID AND CEC.ACTIVO = 1 ")
.append("LEFT JOIN LOG_CONFERENCIA LOG ON LOG.EVENTOEXTRA_ID = EE.EVENTOEXTRA_ID AND LOG.ACTIVO = 1 ")
.append("LEFT JOIN FORMA_PAGO FP ON FP.FORMAPAGO_ID = EE.FORMAPAGO_ID ")
.append("LEFT JOIN COM_EMP_FORMAPAGO COMFP ON COMFP.FORMAPAGO_ID = FP.FORMAPAGO_ID AND COMFP.EMPRESA_ID = EE.EMPRESA_ID AND COMFP.ACTIVO = 1 ")
.append("LEFT JOIN COM_EMP_TIPOEVENTOEXTRA COMTEE ON COMTEE.TIPOEVENTOEXTRA_ID = TEE.TIPOEVENTOEXTRA_ID AND COMTEE.EMPRESA_ID = EE.EMPRESA_ID AND COMTEE.ACTIVO = 1 ")
.append("LEFT JOIN BOLETO B ON B.BOLETO_ID = EE.BOLETO_ID ")
.append("WHERE EE.ACTIVO = 1 ")
.append("AND EE.FECHORINGRESO BETWEEN TO_DATE(:dataInicial, 'DD/MM/YYYY HH24:MI') AND TO_DATE(:dataFinal, 'DD/MM/YYYY HH24:MI') ");
@ -571,6 +574,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
.addScalar("nombusuario", Hibernate.STRING)
.addScalar("logconferenciaId", Hibernate.LONG)
.addScalar("exigeConferenciaAba", Hibernate.BOOLEAN)
.addScalar("numFolioSistema", Hibernate.STRING)
.setResultTransformer(Transformers.aliasToBean(EventosFinanceirosVO.class));
setParametros(qr, parametros);
@ -729,8 +733,8 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
.append("INNER JOIN TARIFA tarifa ON (tarifa.RUTA_ID = B.RUTA_ID AND tarifa.ORIGEN_ID = B.ORIGEN_ID AND tarifa.DESTINO_ID = B.DESTINO_ID AND tarifa.MARCA_ID = M.MARCA_ID) ")
.append("INNER JOIN VIGENCIA_TARIFA vigenciaTarifa ON (vigenciaTarifa.VIGENCIATARIFA_ID = tarifa.VIGENCIATARIFA_ID) ")
.append("WHERE B.ACTIVO = 1 ")
.append("AND B.FECHORVENTA BETWEEN TO_DATE(:dataInicial, 'DD/MM/YYYY HH24:MI') AND TO_DATE(:dataFinal, 'DD/MM/YYYY HH24:MI') ")
.append("AND B.FECHORVENTA BETWEEN vigenciaTarifa.FECINICIOVIGENCIA AND vigenciaTarifa.FECFINVIGENCIA ");
.append("AND B.FECCREACION BETWEEN TO_DATE(:dataInicial, 'DD/MM/YYYY HH24:MI') AND TO_DATE(:dataFinal, 'DD/MM/YYYY HH24:MI') ")
.append("AND B.FECCREACION BETWEEN vigenciaTarifa.FECINICIOVIGENCIA AND vigenciaTarifa.FECFINVIGENCIA ");
if (parametros.containsKey("empresaId")) {
@ -813,13 +817,12 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
if(aux.getFormapagos().contains(formapagoVO)) {
formapagoVO = aux.getFormapagos().get(aux.getFormapagos().indexOf(formapagoVO));
formapagoVO.setImporte(formapagoVO.getImporte().add(boletoComissao.getImporteFp()));
formapagoVO.add(boletoComissao.getImporteFp());
} else {
aux.getFormapagos().add(formapagoVO);
}
lsBoletoComissao.set(indice, aux);
}
else {
} else {
boletoComissao.getFormapagos().add(new FormapagoVO(boletoComissao.getFormapagoId(),
boletoComissao.getDescpago(),
boletoComissao.getIndconferenciafisicacomissao(),

View File

@ -288,10 +288,6 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
private Set<BoletoComissao> carregarBilhetesGapsVendidos(List<BoletoComissao> boletoComissaos, ComEmpConferencia comEmpConferencia) {
Set<BoletoComissao> boletos = new HashSet<BoletoComissao>();
for (BoletoComissao boletoComissao : boletoComissaos) {
if(boletoComissao.getNumoperacion().equals("010047068229")) {
System.out.println("");
}
if (boletoComissao.isAbaGapVendido()) {
if (comEmpConferencia != null) {
@ -487,21 +483,20 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
BigDecimal totalDeposito = BigDecimal.ZERO;
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()) {
if (!boletoComissao.isNaoSomarBilhete()) {
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());
}
}
}
}
@ -514,13 +509,15 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
if (eventosFinanceiros.isCredito()) {
totalDeposito = MoneyHelper.somar(totalDeposito, eventosFinanceiros.getImpingreso());
} else if (eventosFinanceiros.isDebito()) {
totalDeposito = MoneyHelper.subtrair(totalDeposito, eventosFinanceiros.getImpingreso());
totalDeposito = MoneyHelper.subtrair(totalDeposito, eventosFinanceiros.getImpingreso().compareTo(BigDecimal.ZERO) >= 0 ? eventosFinanceiros.getImpingreso() : eventosFinanceiros.getImpingreso().abs());
}
}
}
//subtraindo as ocds pagas
totalDeposito = MoneyHelper.subtrair(totalDeposito, resumoComissao.getTotalOcd().getValorPagar());
if(resumoComissao.getTotalOcd() != null && resumoComissao.getTotalOcd().getValorPagar() != null) {
totalDeposito = MoneyHelper.subtrair(totalDeposito, resumoComissao.getTotalOcd().getValorPagar());
}
resumoComissao.setValorDeposito(totalDeposito);
@ -532,6 +529,10 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
* @param resumoComissao
*/
private void subtrairOcdFormapagoDinheiro(OcdVO totalOcd, ResumoComissao resumoComissao) {
if(totalOcd == null || totalOcd.getValorPagar() == null) {
return;
}
FormapagoVO formapagoDinheiro = null;
for (FormapagoVO formapagoVO : resumoComissao.getTotalFormapago()) {
if(formapagoVO.getFormapagoId().equals(Constantes.FORMA_PAGO_DINHEIRO.intValue())) {
@ -562,7 +563,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
private void carregarTotalFormapago(ResumoComissao resumoComissao, List<BoletoComissao> boletoComissaos, List<EventosFinanceirosVO> lsEventosFinanceiros) {
List<FormapagoVO> totalFormapagos = new ArrayList<FormapagoVO>();
for (BoletoComissao boletoComissao : boletoComissaos) {
if (boletoComissao.isTotalizarTipovenda() && !boletoComissao.isNaoSomarBilhete()) {
if (!boletoComissao.isNaoSomarBilhete()) {
for (FormapagoVO formapagoBoleto : boletoComissao.getFormapagos()) {
FormapagoVO formapago;
if (totalFormapagos.contains(formapagoBoleto)) {
@ -596,9 +597,10 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
if (eventosFinanceiros.isCredito()) {
formapagoEventoFinanceiro.add(eventosFinanceiros.getImpingreso());
} else if (eventosFinanceiros.isDebito()) {
formapagoEventoFinanceiro.subtract(eventosFinanceiros.getImpingreso());
formapagoEventoFinanceiro.subtract(eventosFinanceiros.getImpingreso().compareTo(BigDecimal.ZERO) >= 0 ? eventosFinanceiros.getImpingreso() : eventosFinanceiros.getImpingreso().abs());
}
}
resumoComissao.setTotalFormapago(totalFormapagos);
}

View File

@ -953,13 +953,17 @@ public class BoletoComissao {
public void setIndreimpresion(Boolean indreimpresion) {
this.indreimpresion = indreimpresion;
}
@Override
public String toString() {
return "BoletoComissao [boletoId=" + boletoId + ", tipoVenta=" + tipoVenta + ", indstatusboleto=" + indstatusboleto + ", motivoCancelacionId=" + motivoCancelacionId + ", descmotivocancelacion=" + descmotivocancelacion + ", tipoVentaOriginal1=" + tipoVentaOriginal1 + ", tipoVentaOriginal2=" + tipoVentaOriginal2 + ", indCancelacion=" + indCancelacion + ", indreimpresion=" + indreimpresion + "]";
return "BoletoComissao [boletoId=" + boletoId + ", tipoVenta=" + tipoVenta + ", indstatusboleto=" + indstatusboleto + ", motivoCancelacionId=" + motivoCancelacionId + ", descmotivocancelacion=" + descmotivocancelacion + ", tipoVentaOriginal1=" + tipoVentaOriginal1 + ", tipoVentaOriginal2=" + tipoVentaOriginal2 + ", indCancelacion=" + indCancelacion + ", indreimpresion=" + indreimpresion + ", total=" + getTotal() + "]";
}
public boolean isNaoSomarBilhete() {
/*if(getIndreimpresion() != null && getIndreimpresion()) {
return true;
}*/
if(isStatusTroca() && isVendaBilheteTransferencia(getTipoVenta())) {
return true;
}
@ -980,10 +984,6 @@ public class BoletoComissao {
return true;
}
if(getIndreimpresion() != null && getIndreimpresion()) {
return true;
}
return false;
}