wilian 2016-02-12 20:25:26 +00:00
parent 4cbd5de4e9
commit 5777d22168
13 changed files with 647 additions and 35 deletions

View File

@ -1,5 +1,6 @@
package com.rjconsultores.ventaboletos.dao; package com.rjconsultores.ventaboletos.dao;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -7,7 +8,6 @@ import com.rjconsultores.ventaboletos.entidad.Conferencia;
import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.LogConferencia; import com.rjconsultores.ventaboletos.entidad.LogConferencia;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.enums.comissao.BoletoStatusComissao;
import com.rjconsultores.ventaboletos.exception.BusinessException; import com.rjconsultores.ventaboletos.exception.BusinessException;
import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao; import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao;
import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO; import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO;
@ -35,7 +35,7 @@ public interface ConferenciaComissaoDAO extends GenericDAO<Conferencia, Long> {
public LogConferencia obtenerLogConferenciaID(Long logconferenciaId); public LogConferencia obtenerLogConferenciaID(Long logconferenciaId);
public List<BoletoComissao> carregarBilhetesComissao(Conferencia conferencia, BoletoStatusComissao boletoStatusComissao) throws BusinessException; public List<BoletoComissao> carregarBilhetesComissao(Conferencia conferencia) throws BusinessException;
public List<OcdVO> carregarOcds(Conferencia conferencia) throws BusinessException; public List<OcdVO> carregarOcds(Conferencia conferencia) throws BusinessException;
@ -49,4 +49,6 @@ public interface ConferenciaComissaoDAO extends GenericDAO<Conferencia, Long> {
public boolean isEventosFinanceirosSemConferencia(Conferencia conferencia) throws BusinessException; public boolean isEventosFinanceirosSemConferencia(Conferencia conferencia) throws BusinessException;
public BigDecimal carregarTotalFechamentoContaCorrente(Conferencia conferencia) throws BusinessException;
} }

View File

@ -36,7 +36,6 @@ import com.rjconsultores.ventaboletos.entidad.ContaCorrentePtoVta;
import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.LogConferencia; import com.rjconsultores.ventaboletos.entidad.LogConferencia;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.enums.comissao.BoletoStatusComissao;
import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia; import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia;
import com.rjconsultores.ventaboletos.exception.BusinessException; import com.rjconsultores.ventaboletos.exception.BusinessException;
import com.rjconsultores.ventaboletos.utilerias.DateUtil; import com.rjconsultores.ventaboletos.utilerias.DateUtil;
@ -97,7 +96,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
} }
Map<String, Object> parametros = new HashMap<String, Object>(); Map<String, Object> parametros = new HashMap<String, Object>();
StringBuilder sQuery = new StringBuilder("SELECT DISTINCT PV.PUNTOVENTA_ID AS \"puntoventaId\", PV.NUMPUNTOVENTA as \"numPuntoVenta\", PV.NOMBPUNTOVENTA as \"nombpuntoventa\" "); StringBuilder sQuery = new StringBuilder("SELECT PV.PUNTOVENTA_ID AS \"puntoventaId\", PV.NUMPUNTOVENTA as \"numPuntoVenta\", PV.NOMBPUNTOVENTA as \"nombpuntoventa\" ");
sQuery.append("FROM PUNTO_VENTA PV ") sQuery.append("FROM PUNTO_VENTA PV ")
.append("JOIN PTOVTA_EMPRESA PTE ON PTE.PUNTOVENTA_ID = PV.PUNTOVENTA_ID ") .append("JOIN PTOVTA_EMPRESA PTE ON PTE.PUNTOVENTA_ID = PV.PUNTOVENTA_ID ")
.append("WHERE PV.ACTIVO = 1 "); .append("WHERE PV.ACTIVO = 1 ");
@ -128,7 +127,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
private void carregarConferenciasRegistradas(List<ConferenciaComissaoVO> lsConferencias, String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException { private void carregarConferenciasRegistradas(List<ConferenciaComissaoVO> lsConferencias, String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException {
try { try {
Map<String, Object> parametros = carregarParametros(competencia, empresa, puntoVenta); Map<String, Object> parametros = carregarParametros(competencia, empresa, puntoVenta);
StringBuilder sQuery = new StringBuilder("SELECT DISTINCT co FROM Conferencia co "); StringBuilder sQuery = new StringBuilder("SELECT co FROM Conferencia co ");
sQuery.append("JOIN co.empresa em ") sQuery.append("JOIN co.empresa em ")
.append("JOIN co.puntoVenta pv ") .append("JOIN co.puntoVenta pv ")
.append("WHERE co.activo = 1 ") .append("WHERE co.activo = 1 ")
@ -170,14 +169,14 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
private void carregarMovimentoVendas(List<ConferenciaComissaoVO> lsConferencias, String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException { private void carregarMovimentoVendas(List<ConferenciaComissaoVO> lsConferencias, String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException {
try { try {
Map<String, Object> parametros = carregarParametros(competencia, empresa, puntoVenta); Map<String, Object> parametros = carregarParametros(competencia, empresa, puntoVenta);
StringBuilder sQuery = new StringBuilder("SELECT DISTINCT PV.PUNTOVENTA_ID AS \"puntoventaId\", PV.NUMPUNTOVENTA as \"numPuntoVenta\", PV.NOMBPUNTOVENTA as \"nombpuntoventa\", TO_DATE(B.FECHORVENTA, 'DD/MM/YY') as \"datamovimento\" "); StringBuilder sQuery = new StringBuilder("SELECT PV.PUNTOVENTA_ID AS \"puntoventaId\", PV.NUMPUNTOVENTA as \"numPuntoVenta\", PV.NOMBPUNTOVENTA as \"nombpuntoventa\", TO_DATE(B.FECHORVENTA, 'DD/MM/YY') as \"datamovimento\" ");
sQuery.append("FROM BOLETO B ") sQuery.append("FROM BOLETO B ")
.append("INNER JOIN PUNTO_VENTA PV ON B.PUNTOVENTA_ID = PV.PUNTOVENTA_ID ") .append("INNER JOIN PUNTO_VENTA PV ON B.PUNTOVENTA_ID = PV.PUNTOVENTA_ID ")
.append("WHERE PV.ACTIVO = 1 ") .append("WHERE PV.ACTIVO = 1 ")
.append("AND B.FECHORVENTA BETWEEN :dataInicial AND :dataFinal ") .append("AND B.FECHORVENTA BETWEEN :dataInicial AND :dataFinal ")
.append("AND B.TIPOVENTA_ID IN (:tipoVenta) ") .append("AND B.TIPOVENTA_ID IN (:tipoVenta) ")
.append("AND ( ") .append("AND ( ")
.append(" (B.INDSTATUSBOLETO = 'V' AND B.MOTIVOCANCELACION_ID IS NULL) ") .append(" (B.INDSTATUSBOLETO = 'V' AND (B.MOTIVOCANCELACION_ID IS NULL OR B.MOTIVOCANCELACION_ID IN (:motivocancelacionId))) ")
.append(" OR ") .append(" OR ")
.append(" (B.INDSTATUSBOLETO = 'C' AND B.MOTIVOCANCELACION_ID IN (:motivocancelacionId)) ") .append(" (B.INDSTATUSBOLETO = 'C' AND B.MOTIVOCANCELACION_ID IN (:motivocancelacionId)) ")
.append(" ) "); .append(" ) ");
@ -403,7 +402,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
try { try {
Map<String, Object> parametros = carregarParametros(null, conferencia.getEmpresa(), conferencia.getPuntoVenta()); Map<String, Object> parametros = carregarParametros(null, conferencia.getEmpresa(), conferencia.getPuntoVenta());
StringBuilder sQuery = new StringBuilder(); StringBuilder sQuery = new StringBuilder();
sQuery.append("SELECT DISTINCT FECHAMENTOCNTCORRENTE_ID ") sQuery.append("SELECT FECHAMENTOCNTCORRENTE_ID ")
.append("FROM FECHAMENTO_CNTCORRENTE ") .append("FROM FECHAMENTO_CNTCORRENTE ")
.append("WHERE ACTIVO = 1 ") .append("WHERE ACTIVO = 1 ")
.append("AND :datamovimento BETWEEN FECINIFECHAMENTO AND FECFINFECHAMENTO "); .append("AND :datamovimento BETWEEN FECINIFECHAMENTO AND FECFINFECHAMENTO ");
@ -443,14 +442,18 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
try { try {
Map<String, Object> parametros = carregarParametros(null, conferencia.getEmpresa(), conferencia.getPuntoVenta()); Map<String, Object> parametros = carregarParametros(null, conferencia.getEmpresa(), conferencia.getPuntoVenta());
StringBuilder sQuery = new StringBuilder(); StringBuilder sQuery = new StringBuilder();
sQuery.append("SELECT DISTINCT EE.EVENTOEXTRA_ID AS \"eventoextraId\", EE.NUMDOCUMENTO AS \"numdocumento\", ") sQuery.append("SELECT EE.EVENTOEXTRA_ID AS \"eventoextraId\", EE.NUMDOCUMENTO AS \"numdocumento\", ")
.append("EE.IMPINGRESO AS \"impingreso\", TEE.DESCTIPOEVENTO AS \"desctipoevento\", EE.DESCINFO AS \"descinfo\", ") .append("EE.IMPINGRESO 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("LOG.STATUS AS \"status\", FP.FORMAPAGO_ID AS \"formapagoId\", FP.DESCPAGO AS \"descpago\", ")
.append("FP.INDCONFERENCIAFISICACOMISSAO AS \"indconferenciafisicacomissao\", TEE.INDTIPO AS \"indtipo\" ") .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("FROM EVENTO_EXTRA EE ") .append("FROM EVENTO_EXTRA EE ")
.append("JOIN TIPO_EVENTO_EXTRA TEE ON EE.TIPOEVENTOEXTRA_ID = TEE.TIPOEVENTOEXTRA_ID ") .append("JOIN TIPO_EVENTO_EXTRA TEE ON EE.TIPOEVENTOEXTRA_ID = TEE.TIPOEVENTOEXTRA_ID ")
.append("INNER JOIN USUARIO U ON EE.USUARIO_ID = U.USUARIO_ID ")
.append("LEFT JOIN LOG_CONFERENCIA LOG ON LOG.EVENTOEXTRA_ID = EE.EVENTOEXTRA_ID ") .append("LEFT JOIN LOG_CONFERENCIA LOG ON LOG.EVENTOEXTRA_ID = EE.EVENTOEXTRA_ID ")
.append("LEFT JOIN FORMA_PAGO FP ON FP.FORMAPAGO_ID = EE.FORMAPAGO_ID ") .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 ")
.append("LEFT JOIN COM_EMP_TIPOEVENTOEXTRA COMTEE ON COMTEE.TIPOEVENTOEXTRA_ID = TEE.TIPOEVENTOEXTRA_ID AND COMTEE.EMPRESA_ID = EE.EMPRESA_ID ")
.append("WHERE EE.ACTIVO = 1 ") .append("WHERE EE.ACTIVO = 1 ")
.append("AND TO_DATE(EE.FECHORINGRESO,'DD/MM/YY') = :datamovimento "); .append("AND TO_DATE(EE.FECHORINGRESO,'DD/MM/YY') = :datamovimento ");
@ -477,8 +480,11 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
.addScalar("status", Hibernate.INTEGER) .addScalar("status", Hibernate.INTEGER)
.addScalar("formapagoId", Hibernate.INTEGER) .addScalar("formapagoId", Hibernate.INTEGER)
.addScalar("descpago", Hibernate.STRING) .addScalar("descpago", Hibernate.STRING)
.addScalar("indconferenciafisicacomissao", Hibernate.BOOLEAN) .addScalar("comempformapagoId", Hibernate.INTEGER)
.addScalar("comemptipoeventoextraId", Hibernate.INTEGER)
.addScalar("indtipo", Hibernate.STRING) .addScalar("indtipo", Hibernate.STRING)
.addScalar("nombusuario", Hibernate.STRING)
.addScalar("logconferenciaId", Hibernate.LONG)
.setResultTransformer(Transformers.aliasToBean(EventosFinanceirosVO.class)); .setResultTransformer(Transformers.aliasToBean(EventosFinanceirosVO.class));
setParametros(qr, parametros); setParametros(qr, parametros);
@ -543,7 +549,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
logConferencia.setConferencia(confirmarChegadaMalote(logConferencia.getConferencia())); logConferencia.setConferencia(confirmarChegadaMalote(logConferencia.getConferencia()));
} }
getSession().merge(logConferencia); getSession().save(logConferencia);
return logConferencia; return logConferencia;
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
@ -581,7 +587,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
@Override @Override
@SuppressWarnings({ "unchecked", "deprecation" }) @SuppressWarnings({ "unchecked", "deprecation" })
public List<BoletoComissao> carregarBilhetesComissao(Conferencia conferencia, BoletoStatusComissao boletoStatusComissao) throws BusinessException { public List<BoletoComissao> carregarBilhetesComissao(Conferencia conferencia) throws BusinessException {
try { try {
Map<String, Object> parametros = carregarParametros(null, conferencia.getEmpresa(), conferencia.getPuntoVenta()); Map<String, Object> parametros = carregarParametros(null, conferencia.getEmpresa(), conferencia.getPuntoVenta());
@ -591,8 +597,9 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
.append("NVL(B.PRECIOPAGADO,0) AS \"valorpagado\", NVL(B.IMPORTEOUTROS,0) AS \"seguroOutros\", ") .append("NVL(B.PRECIOPAGADO,0) AS \"valorpagado\", NVL(B.IMPORTEOUTROS,0) AS \"seguroOutros\", ")
.append("NVL(B.IMPORTEPEDAGIO,0) AS \"pedagio\", NVL(B.IMPORTESEGURO,0) AS \"seguro\", NVL(B.IMPORTETAXAEMBARQUE,0) AS \"embarque\", ") .append("NVL(B.IMPORTEPEDAGIO,0) AS \"pedagio\", NVL(B.IMPORTESEGURO,0) AS \"seguro\", NVL(B.IMPORTETAXAEMBARQUE,0) AS \"embarque\", ")
.append("B.TIPOVENTA_ID AS \"tipoVenta\", B.INDSTATUSBOLETO AS \"indstatusboleto\", LOG.STATUS AS \"status\", ") .append("B.TIPOVENTA_ID AS \"tipoVenta\", B.INDSTATUSBOLETO AS \"indstatusboleto\", LOG.STATUS AS \"status\", ")
.append("FP.FORMAPAGO_ID AS \"formapagoId\", FP.DESCPAGO AS \"descpago\", FP.INDCONFERENCIAFISICACOMISSAO AS \"indconferenciafisicacomissao\", ") .append("FP.FORMAPAGO_ID AS \"formapagoId\", FP.DESCPAGO AS \"descpago\", LOG.LOGCONFERENCIA_ID AS \"logconferenciaId\", ")
.append("MC.DESCMOTIVO AS \"descmotivocancelacion\", U.NOMBUSUARIO AS \"nombusuario\" ") .append("MC.DESCMOTIVO AS \"descmotivocancelacion\", U.NOMBUSUARIO AS \"nombusuario\", B.MOTIVOCANCELACION_ID AS \"motivocancelacionId\", ")
.append("BF.IMPORTE AS \"importeFp\", COMFP.COMEMPFORMAPAGO_ID AS \"comempformapagoId\", COMCAT.COMEMPCATEGORIA_ID AS \"comempcategoriaId\" ")
.append("FROM BOLETO B ") .append("FROM BOLETO B ")
.append("LEFT JOIN PARADA ORI ON ORI.PARADA_ID = B.ORIGEN_ID ") .append("LEFT JOIN PARADA ORI ON ORI.PARADA_ID = B.ORIGEN_ID ")
.append("LEFT JOIN CIUDAD CID ON CID.CIUDAD_ID = ORI.PARADA_ID ") .append("LEFT JOIN CIUDAD CID ON CID.CIUDAD_ID = ORI.PARADA_ID ")
@ -603,10 +610,17 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
.append("INNER JOIN BOLETO_FORMAPAGO BF ON BF.BOLETO_ID = B.BOLETO_ID ") .append("INNER JOIN BOLETO_FORMAPAGO BF ON BF.BOLETO_ID = B.BOLETO_ID ")
.append("INNER JOIN FORMA_PAGO FP ON FP.FORMAPAGO_ID = BF.FORMAPAGO_ID ") .append("INNER JOIN FORMA_PAGO FP ON FP.FORMAPAGO_ID = BF.FORMAPAGO_ID ")
.append("INNER JOIN USUARIO U ON B.USUARIO_ID = U.USUARIO_ID ") .append("INNER JOIN USUARIO U ON B.USUARIO_ID = U.USUARIO_ID ")
.append("LEFT JOIN COM_EMP_FORMAPAGO COMFP ON COMFP.FORMAPAGO_ID = FP.FORMAPAGO_ID AND COMFP.EMPRESA_ID = B.EMPRESACORRIDA_ID ")
.append("LEFT JOIN COM_EMP_CATEGORIA COMCAT ON COMCAT.CATEGORIA_ID = B.CATEGORIA_ID AND COMCAT.EMPRESA_ID = B.EMPRESACORRIDA_ID ")
.append("WHERE B.ACTIVO = 1 ") .append("WHERE B.ACTIVO = 1 ")
.append("AND TO_DATE(B.FECHORVENTA,'DD/MM/YY') = :datamovimento "); .append("AND TO_DATE(B.FECHORVENTA,'DD/MM/YY') = :datamovimento ")
.append("AND ((B.INDSTATUSBOLETO = 'V' AND (B.MOTIVOCANCELACION_ID IS NULL OR B.MOTIVOCANCELACION_ID IN (:motivocancelacionId))) ")
.append(" OR ")
.append(" (B.INDSTATUSBOLETO = 'C' AND B.MOTIVOCANCELACION_ID IN (:motivocancelacionId))")
.append(" )");
parametros.put("datamovimento", conferencia.getDatamovimento()); parametros.put("datamovimento", conferencia.getDatamovimento());
parametros.put("motivocancelacionId", Arrays.asList(Constantes.MVO_CANCEL_CANCELACION, Constantes.MVO_CANCEL_DEVOLUCAO));
if(parametros.containsKey("empresaId")) { if(parametros.containsKey("empresaId")) {
sQuery.append("AND B.EMPRESACORRIDA_ID = :empresaId "); sQuery.append("AND B.EMPRESACORRIDA_ID = :empresaId ");
@ -621,10 +635,11 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
parametros.put("numfoliosistema", conferencia.getNumfoliosistema()); parametros.put("numfoliosistema", conferencia.getNumfoliosistema());
} }
/*parametros.put("tipoVenta", Arrays.asList(Constantes.TPV_BOLETO_REMOTO,Constantes.TPV_MANUAL,Constantes.TPV_DIRECTO_NORMAL));
if(BoletoStatusComissao.BOLETOS.equals(boletoStatusComissao)) { if(BoletoStatusComissao.BOLETOS.equals(boletoStatusComissao)) {
sQuery.append("AND B.TIPOVENTA_ID NOT IN (:tipoVenta) ") sQuery.append("AND B.TIPOVENTA_ID NOT IN (:tipoVenta) ")
.append("AND B.MOTIVOCANCELACION_ID IS NULL ") .append("AND B.INDSTATUSBOLETO IN ('V','C') ");
.append("AND B.INDSTATUSBOLETO = 'V' ");
parametros.put("tipoVenta", Arrays.asList(Constantes.TPV_BOLETO_REMOTO,Constantes.TPV_MANUAL)); parametros.put("tipoVenta", Arrays.asList(Constantes.TPV_BOLETO_REMOTO,Constantes.TPV_MANUAL));
} }
@ -654,7 +669,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
.append("AND B.MOTIVOCANCELACION_ID = :motivocancelacionId "); .append("AND B.MOTIVOCANCELACION_ID = :motivocancelacionId ");
parametros.put("motivocancelacionId", BoletoStatusComissao.GAP_CANCELADO.equals(boletoStatusComissao) ? Constantes.MVO_CANCEL_CANCELACION : Constantes.MVO_CANCEL_DEVOLUCAO); parametros.put("motivocancelacionId", BoletoStatusComissao.GAP_CANCELADO.equals(boletoStatusComissao) ? Constantes.MVO_CANCEL_CANCELACION : Constantes.MVO_CANCEL_DEVOLUCAO);
parametros.put("tipoVenta", Constantes.TPV_BOLETO_REMOTO); parametros.put("tipoVenta", Constantes.TPV_BOLETO_REMOTO);
} }*/
log.info(sQuery.toString()); log.info(sQuery.toString());
@ -677,9 +692,13 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
.addScalar("status", Hibernate.INTEGER) .addScalar("status", Hibernate.INTEGER)
.addScalar("formapagoId", Hibernate.INTEGER) .addScalar("formapagoId", Hibernate.INTEGER)
.addScalar("descpago", Hibernate.STRING) .addScalar("descpago", Hibernate.STRING)
.addScalar("indconferenciafisicacomissao", Hibernate.BOOLEAN) .addScalar("logconferenciaId", Hibernate.LONG)
.addScalar("descmotivocancelacion", Hibernate.STRING) .addScalar("descmotivocancelacion", Hibernate.STRING)
.addScalar("nombusuario", Hibernate.STRING) .addScalar("nombusuario", Hibernate.STRING)
.addScalar("motivoCancelacionId", Hibernate.INTEGER)
.addScalar("importeFp", Hibernate.BIG_DECIMAL)
.addScalar("comempformapagoId", Hibernate.INTEGER)
.addScalar("comempcategoriaId", Hibernate.INTEGER)
.setResultTransformer(Transformers.aliasToBean(BoletoComissao.class)); .setResultTransformer(Transformers.aliasToBean(BoletoComissao.class));
setParametros(qr, parametros); setParametros(qr, parametros);
@ -692,10 +711,10 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
if(lsBoletoComissao.contains(boletoComissao)) { if(lsBoletoComissao.contains(boletoComissao)) {
BoletoComissao aux = lsBoletoComissao.get(lsBoletoComissao.indexOf(boletoComissao)); BoletoComissao aux = lsBoletoComissao.get(lsBoletoComissao.indexOf(boletoComissao));
aux.getFormapagos().add(new FormapagoVO(boletoComissao.getFormapagoId(), boletoComissao.getDescpago(), boletoComissao.getIndconferenciafisicacomissao())); aux.getFormapagos().add(new FormapagoVO(boletoComissao.getFormapagoId(), boletoComissao.getDescpago(), boletoComissao.getIndconferenciafisicacomissao(), boletoComissao.getImporteFp()));
lsBoletoComissao.set(lsBoletoComissao.indexOf(boletoComissao), aux); lsBoletoComissao.set(lsBoletoComissao.indexOf(boletoComissao), aux);
} else { } else {
boletoComissao.getFormapagos().add(new FormapagoVO(boletoComissao.getFormapagoId(), boletoComissao.getDescpago(), boletoComissao.getIndconferenciafisicacomissao())); boletoComissao.getFormapagos().add(new FormapagoVO(boletoComissao.getFormapagoId(), boletoComissao.getDescpago(), boletoComissao.getIndconferenciafisicacomissao(), boletoComissao.getImporteFp()));
lsBoletoComissao.add(boletoComissao); lsBoletoComissao.add(boletoComissao);
} }
} }
@ -714,11 +733,12 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
Map<String, Object> parametros = carregarParametros(null, conferencia.getEmpresa(), conferencia.getPuntoVenta()); Map<String, Object> parametros = carregarParametros(null, conferencia.getEmpresa(), conferencia.getPuntoVenta());
StringBuilder sQuery = new StringBuilder(); StringBuilder sQuery = new StringBuilder();
sQuery.append("SELECT O.OCD_ID AS \"ocdId\", O.NUMOPERACION AS \"numoperacion\", O.FECINC AS \"fecinc\", O.FECPAGAR AS \"fecpagar\", O.FECPAGO AS \"fecpago\", ") sQuery.append("SELECT DISTINCT O.OCD_ID AS \"ocdId\", O.NUMOPERACION AS \"numoperacion\", O.FECINC AS \"fecinc\", O.FECPAGAR AS \"fecpagar\", O.FECPAGO AS \"fecpago\", ")
.append("O.INDPAGO AS \"indpago\", O.VALOR_PAGAR AS \"valorPagar\", O.PENALIZACION AS \"penalizacion\", LOG.STATUS AS \"status\" ") .append("O.INDPAGO AS \"indpago\", O.VALOR_PAGAR AS \"valorPagar\", O.PENALIZACION AS \"penalizacion\", LOG.STATUS AS \"status\", U.NOMBUSUARIO AS \"nombusuario\", LOG.LOGCONFERENCIA_ID AS \"logconferenciaId\" ")
.append("FROM OCD O ") .append("FROM OCD O ")
.append("LEFT JOIN BOLETO B ON B.BOLETO_ID = O.BOLETO_ID ") .append("LEFT JOIN BOLETO B ON B.BOLETO_ID = O.BOLETO_ID ")
.append("LEFT JOIN LOG_CONFERENCIA LOG ON LOG.OCD_ID = O.OCD_ID ") .append("LEFT JOIN LOG_CONFERENCIA LOG ON LOG.OCD_ID = O.OCD_ID ")
.append("INNER JOIN USUARIO U ON O.USUARIO_ID = U.USUARIO_ID ")
.append("WHERE O.ACTIVO = 1 ") .append("WHERE O.ACTIVO = 1 ")
.append("AND TO_DATE(O.FECINC,'DD/MM/YY') = :datamovimento "); .append("AND TO_DATE(O.FECINC,'DD/MM/YY') = :datamovimento ");
@ -744,6 +764,8 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
.addScalar("valorPagar", Hibernate.BIG_DECIMAL) .addScalar("valorPagar", Hibernate.BIG_DECIMAL)
.addScalar("penalizacion", Hibernate.BIG_DECIMAL) .addScalar("penalizacion", Hibernate.BIG_DECIMAL)
.addScalar("status", Hibernate.INTEGER) .addScalar("status", Hibernate.INTEGER)
.addScalar("nombusuario", Hibernate.STRING)
.addScalar("logconferenciaId", Hibernate.STRING)
.setResultTransformer(Transformers.aliasToBean(OcdVO.class)); .setResultTransformer(Transformers.aliasToBean(OcdVO.class));
setParametros(qr, parametros); setParametros(qr, parametros);
@ -758,7 +780,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
public Conferencia obtenerConferenciaDataMovimento(Date datamovimento, Integer puntoventaId, Integer empresaId) throws BusinessException { public Conferencia obtenerConferenciaDataMovimento(Date datamovimento, Integer puntoventaId, Integer empresaId) throws BusinessException {
try { try {
StringBuilder sQuery = new StringBuilder(); StringBuilder sQuery = new StringBuilder();
sQuery.append("SELECT DISTINCT co ") sQuery.append("SELECT co ")
.append("FROM Conferencia co ") .append("FROM Conferencia co ")
.append("WHERE co.activo = 1 ") .append("WHERE co.activo = 1 ")
.append("AND co.datamovimento = :datamovimento ") .append("AND co.datamovimento = :datamovimento ")
@ -822,7 +844,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
public List<LogConferencia> carregarLogConferencia(Long conferenciaId) throws BusinessException { public List<LogConferencia> carregarLogConferencia(Long conferenciaId) throws BusinessException {
try { try {
StringBuilder sQuery = new StringBuilder(); StringBuilder sQuery = new StringBuilder();
sQuery.append("SELECT DISTINCT log ") sQuery.append("SELECT log ")
.append("FROM LogConferencia log ") .append("FROM LogConferencia log ")
.append("WHERE log.activo = 1 ") .append("WHERE log.activo = 1 ")
.append("AND log.conferencia.conferenciaId = :conferenciaId "); .append("AND log.conferencia.conferenciaId = :conferenciaId ");
@ -893,7 +915,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
try { try {
Map<String, Object> parametros = carregarParametros(null, conferencia.getEmpresa(), conferencia.getPuntoVenta()); Map<String, Object> parametros = carregarParametros(null, conferencia.getEmpresa(), conferencia.getPuntoVenta());
StringBuilder sQuery = new StringBuilder(); StringBuilder sQuery = new StringBuilder();
sQuery.append("SELECT DISTINCT EE.EVENTOEXTRA_ID AS \"eventoextraId\" ") sQuery.append("SELECT EE.EVENTOEXTRA_ID AS \"eventoextraId\" ")
.append("FROM EVENTO_EXTRA EE ") .append("FROM EVENTO_EXTRA EE ")
.append("JOIN TIPO_EVENTO_EXTRA TEE ON EE.TIPOEVENTOEXTRA_ID = TEE.TIPOEVENTOEXTRA_ID ") .append("JOIN TIPO_EVENTO_EXTRA TEE ON EE.TIPOEVENTOEXTRA_ID = TEE.TIPOEVENTOEXTRA_ID ")
.append("LEFT JOIN COM_EMP_TIPOEVENTOEXTRA COMTEE ON COMTEE.TIPOEVENTOEXTRA_ID = TEE.TIPOEVENTOEXTRA_ID AND COMTEE.EMPRESA_ID = EE.EMPRESA_ID ") .append("LEFT JOIN COM_EMP_TIPOEVENTOEXTRA COMTEE ON COMTEE.TIPOEVENTOEXTRA_ID = TEE.TIPOEVENTOEXTRA_ID AND COMTEE.EMPRESA_ID = EE.EMPRESA_ID ")
@ -929,4 +951,36 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
} }
} }
@Override
public BigDecimal carregarTotalFechamentoContaCorrente(Conferencia conferencia) throws BusinessException {
try {
Map<String, Object> parametros = carregarParametros(null, conferencia.getEmpresa(), conferencia.getPuntoVenta());
StringBuilder sQuery = new StringBuilder();
sQuery.append("SELECT SUM(TOTAL) AS TOTAL ")
.append("FROM FECHAMENTO_CNTCORRENTE ")
.append("WHERE ACTIVO = 1 ")
.append("AND :datamovimento BETWEEN FECINIFECHAMENTO AND FECFINFECHAMENTO ");
parametros.put("datamovimento", conferencia.getDatamovimento());
if(parametros.containsKey("empresaId")) {
sQuery.append("AND EMPRESA_ID = :empresaId ");
}
if(parametros.containsKey("puntoventaId")) {
sQuery.append("AND PUNTOVENTA_ID = :puntoventaId ");
}
log.info(sQuery.toString());
Query qr = getSession().createSQLQuery(sQuery.toString());
setParametros(qr, parametros);
return (BigDecimal) qr.uniqueResult();
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new BusinessException(e.getMessage(), e);
}
}
} }

View File

@ -2,11 +2,11 @@ package com.rjconsultores.ventaboletos.enums.comissao;
public enum BoletoStatusComissao { public enum BoletoStatusComissao {
BOLETOS, BOLETOS_VENDIDOS,
BOLETO_CANCELADO, BOLETO_CANCELADO,
BOLETO_DEVOLVIDO, BOLETO_DEVOLVIDO,
BOLETO_MANUAL, BOLETO_MANUAL,
GAP, GAP_VENDIDOS,
GAP_CANCELADO, GAP_CANCELADO,
GAP_DEVOLVIDO; GAP_DEVOLVIDO;

View File

@ -15,6 +15,7 @@ import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO;
import com.rjconsultores.ventaboletos.vo.comissao.EventosFinanceirosVO; import com.rjconsultores.ventaboletos.vo.comissao.EventosFinanceirosVO;
import com.rjconsultores.ventaboletos.vo.comissao.LogConferenciaVO; import com.rjconsultores.ventaboletos.vo.comissao.LogConferenciaVO;
import com.rjconsultores.ventaboletos.vo.comissao.OcdVO; import com.rjconsultores.ventaboletos.vo.comissao.OcdVO;
import com.rjconsultores.ventaboletos.vo.comissao.ResumoComissao;
public interface ConferenciaComissaoService extends GenericService<Conferencia, Long> { public interface ConferenciaComissaoService extends GenericService<Conferencia, Long> {
@ -36,7 +37,7 @@ public interface ConferenciaComissaoService extends GenericService<Conferencia,
public LogConferencia obtenerLogConferenciaID(Long logconferenciaId); public LogConferencia obtenerLogConferenciaID(Long logconferenciaId);
public List<BoletoComissao> carregarBilhetesComissao(Conferencia conferencia, BoletoStatusComissao boletoStatusComissao) throws BusinessException; public List<BoletoComissao> carregarBilhetesComissao(List<BoletoComissao> boletoComissaos, Conferencia conferencia, BoletoStatusComissao boletoStatusComissao) throws BusinessException;
public List<OcdVO> carregarOcds(Conferencia conferencia) throws BusinessException; public List<OcdVO> carregarOcds(Conferencia conferencia) throws BusinessException;
@ -54,4 +55,8 @@ public interface ConferenciaComissaoService extends GenericService<Conferencia,
public OcdVO totalizarOcd(List<OcdVO> lsOcd) throws BusinessException; public OcdVO totalizarOcd(List<OcdVO> lsOcd) throws BusinessException;
public ResumoComissao gerarResumo(Conferencia conferencia, List<BoletoComissao> boletoComissaos, List<EventosFinanceirosVO> lsEventosFinanceiros, BigDecimal totalBilhetesManual, BigDecimal totalBilhetesVendidos, BigDecimal totalBilhetesCancelados,
BigDecimal totalBilhetesDevolvidos, BigDecimal totalBilhetesGap, BigDecimal totalBilhetesGapCancelados, BigDecimal totalBilhetesGapDevolvidos,
BigDecimal totalCreditosEventoFinanceiros, BigDecimal totalDebitosEventoFinanceiros, OcdVO totalOcd) throws BusinessException;
} }

View File

@ -1,6 +1,7 @@
package com.rjconsultores.ventaboletos.service.impl; package com.rjconsultores.ventaboletos.service.impl;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -8,11 +9,13 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.rjconsultores.ventaboletos.constantes.Constantes;
import com.rjconsultores.ventaboletos.dao.ConferenciaComissaoDAO; import com.rjconsultores.ventaboletos.dao.ConferenciaComissaoDAO;
import com.rjconsultores.ventaboletos.entidad.Conferencia; import com.rjconsultores.ventaboletos.entidad.Conferencia;
import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.LogConferencia; import com.rjconsultores.ventaboletos.entidad.LogConferencia;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.enums.IndStatusBoleto;
import com.rjconsultores.ventaboletos.enums.comissao.BoletoStatusComissao; import com.rjconsultores.ventaboletos.enums.comissao.BoletoStatusComissao;
import com.rjconsultores.ventaboletos.exception.BusinessException; import com.rjconsultores.ventaboletos.exception.BusinessException;
import com.rjconsultores.ventaboletos.service.ConferenciaComissaoService; import com.rjconsultores.ventaboletos.service.ConferenciaComissaoService;
@ -20,8 +23,10 @@ import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao; import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao;
import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO; import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO;
import com.rjconsultores.ventaboletos.vo.comissao.EventosFinanceirosVO; import com.rjconsultores.ventaboletos.vo.comissao.EventosFinanceirosVO;
import com.rjconsultores.ventaboletos.vo.comissao.FormapagoVO;
import com.rjconsultores.ventaboletos.vo.comissao.LogConferenciaVO; import com.rjconsultores.ventaboletos.vo.comissao.LogConferenciaVO;
import com.rjconsultores.ventaboletos.vo.comissao.OcdVO; import com.rjconsultores.ventaboletos.vo.comissao.OcdVO;
import com.rjconsultores.ventaboletos.vo.comissao.ResumoComissao;
@Service("conferenciaComissaoService") @Service("conferenciaComissaoService")
public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoService { public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoService {
@ -114,8 +119,118 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
} }
@Override @Override
public List<BoletoComissao> carregarBilhetesComissao(Conferencia conferencia, BoletoStatusComissao boletoStatusComissao) throws BusinessException { public List<BoletoComissao> carregarBilhetesComissao(List<BoletoComissao> boletoComissaos, Conferencia conferencia, BoletoStatusComissao boletoStatusComissao) throws BusinessException {
return conferenciaComissaoDAO.carregarBilhetesComissao(conferencia, boletoStatusComissao); if(boletoComissaos == null) {
boletoComissaos = conferenciaComissaoDAO.carregarBilhetesComissao(conferencia);
}
if(boletoStatusComissao == null) {
return boletoComissaos;
}
switch (boletoStatusComissao) {
case BOLETOS_VENDIDOS:
return carregarBilhetesVendidos(boletoComissaos);
case BOLETO_MANUAL:
return carregarBilhetesManuais(boletoComissaos);
case BOLETO_CANCELADO:
return carregarBilhetesCancelados(boletoComissaos);
case BOLETO_DEVOLVIDO:
return carregarBilhetesDevolvidos(boletoComissaos);
case GAP_VENDIDOS:
return carregarBilhetesGapsVendidos(boletoComissaos);
case GAP_CANCELADO:
return carregarBilhetesGapCancelados(boletoComissaos);
case GAP_DEVOLVIDO:
return carregarBilhetesGapDevolvidos(boletoComissaos);
default:
break;
}
return new ArrayList<BoletoComissao>();
}
private List<BoletoComissao> carregarBilhetesVendidos(List<BoletoComissao> boletoComissaos) {
List<BoletoComissao> boletos = new ArrayList<BoletoComissao>();
for (BoletoComissao boletoComissao : boletoComissaos) {
if(IndStatusBoleto.V.getShortValue().equalsIgnoreCase(boletoComissao.getIndstatusboleto()) &&
Constantes.TPV_BOLETO_REMOTO.intValue() != boletoComissao.getTipoVenta() &&
Constantes.TPV_MANUAL.intValue() != boletoComissao.getTipoVenta()) {
boletos.add(boletoComissao);
}
}
return boletos;
}
private List<BoletoComissao> carregarBilhetesManuais(List<BoletoComissao> boletoComissaos) {
List<BoletoComissao> boletos = new ArrayList<BoletoComissao>();
for (BoletoComissao boletoComissao : boletoComissaos) {
if(IndStatusBoleto.V.getShortValue().equalsIgnoreCase(boletoComissao.getIndstatusboleto()) &&
Constantes.TPV_MANUAL.intValue() == boletoComissao.getTipoVenta()) {
boletos.add(boletoComissao);
}
}
return boletos;
}
private List<BoletoComissao> carregarBilhetesCancelados(List<BoletoComissao> boletoComissaos) {
List<BoletoComissao> boletos = new ArrayList<BoletoComissao>();
for (BoletoComissao boletoComissao : boletoComissaos) {
if(IndStatusBoleto.C.getShortValue().equalsIgnoreCase(boletoComissao.getIndstatusboleto()) &&
Constantes.MVO_CANCEL_CANCELACION.intValue() == boletoComissao.getMotivoCancelacionId() &&
Constantes.TPV_BOLETO_REMOTO.intValue() != boletoComissao.getTipoVenta() &&
Constantes.TPV_MANUAL.intValue() != boletoComissao.getTipoVenta()) {
boletos.add(boletoComissao);
}
}
return boletos;
}
private List<BoletoComissao> carregarBilhetesDevolvidos(List<BoletoComissao> boletoComissaos) {
List<BoletoComissao> boletos = new ArrayList<BoletoComissao>();
for (BoletoComissao boletoComissao : boletoComissaos) {
if(IndStatusBoleto.C.getShortValue().equalsIgnoreCase(boletoComissao.getIndstatusboleto()) &&
Constantes.MVO_CANCEL_DEVOLUCAO.intValue() == boletoComissao.getMotivoCancelacionId() &&
Constantes.TPV_BOLETO_REMOTO.intValue() != boletoComissao.getTipoVenta() &&
Constantes.TPV_MANUAL.intValue() != boletoComissao.getTipoVenta()) {
boletos.add(boletoComissao);
}
}
return boletos;
}
private List<BoletoComissao> carregarBilhetesGapsVendidos(List<BoletoComissao> boletoComissaos) {
List<BoletoComissao> boletos = new ArrayList<BoletoComissao>();
for (BoletoComissao boletoComissao : boletoComissaos) {
if(IndStatusBoleto.V.getShortValue().equalsIgnoreCase(boletoComissao.getIndstatusboleto()) &&
Constantes.TPV_BOLETO_REMOTO.intValue() == boletoComissao.getTipoVenta()) {
boletos.add(boletoComissao);
}
}
return boletos;
}
private List<BoletoComissao> carregarBilhetesGapCancelados(List<BoletoComissao> boletoComissaos) {
List<BoletoComissao> boletos = new ArrayList<BoletoComissao>();
for (BoletoComissao boletoComissao : boletoComissaos) {
if(IndStatusBoleto.C.getShortValue().equalsIgnoreCase(boletoComissao.getIndstatusboleto()) &&
Constantes.MVO_CANCEL_CANCELACION.intValue() == boletoComissao.getMotivoCancelacionId() &&
Constantes.TPV_BOLETO_REMOTO.intValue() == boletoComissao.getTipoVenta()) {
boletos.add(boletoComissao);
}
}
return boletos;
}
private List<BoletoComissao> carregarBilhetesGapDevolvidos(List<BoletoComissao> boletoComissaos) {
List<BoletoComissao> boletos = new ArrayList<BoletoComissao>();
for (BoletoComissao boletoComissao : boletoComissaos) {
if(IndStatusBoleto.C.getShortValue().equalsIgnoreCase(boletoComissao.getIndstatusboleto()) &&
Constantes.MVO_CANCEL_DEVOLUCAO.intValue() == boletoComissao.getMotivoCancelacionId() &&
Constantes.TPV_BOLETO_REMOTO.intValue() == boletoComissao.getTipoVenta()) {
boletos.add(boletoComissao);
}
}
return boletos;
} }
@Override @Override
@ -182,4 +297,52 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
return total; return total;
} }
@Override
public ResumoComissao gerarResumo(Conferencia conferencia, List<BoletoComissao> boletoComissaos, List<EventosFinanceirosVO> lsEventosFinanceiros, BigDecimal totalBilhetesManual, BigDecimal totalBilhetesVendidos,
BigDecimal totalBilhetesCancelados, BigDecimal totalBilhetesDevolvidos, BigDecimal totalBilhetesGap, BigDecimal totalBilhetesGapCancelados,
BigDecimal totalBilhetesGapDevolvidos, BigDecimal totalCreditosEventoFinanceiros, BigDecimal totalDebitosEventoFinanceiros, OcdVO totalOcd) throws BusinessException {
ResumoComissao resumoComissao = new ResumoComissao();
resumoComissao.setTotalDevolvidos(totalBilhetesDevolvidos.add(totalBilhetesGapDevolvidos));
resumoComissao.setTotalCancelados(totalBilhetesCancelados.add(totalBilhetesGapCancelados));
resumoComissao.setTotalVendas(totalBilhetesVendidos.add(totalBilhetesManual).add(totalBilhetesGap));
resumoComissao.setTotalReceitas(totalCreditosEventoFinanceiros);
resumoComissao.setTotalDespesas(totalDebitosEventoFinanceiros);
resumoComissao.setTotalOcd(totalOcd);
resumoComissao.setValorDeposito(conferenciaComissaoDAO.carregarTotalFechamentoContaCorrente(conferencia));
carregarTotalFormapago(resumoComissao, boletoComissaos, lsEventosFinanceiros);
return resumoComissao;
}
private void carregarTotalFormapago(ResumoComissao resumoComissao, List<BoletoComissao> boletoComissaos, List<EventosFinanceirosVO> lsEventosFinanceiros) {
List<FormapagoVO> totalFormapagos = new ArrayList<FormapagoVO>();
for (BoletoComissao boletoComissao : boletoComissaos) {
if(boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.V.getShortValue()) &&
boletoComissao.getMotivoCancelacionId() == null) {
for (FormapagoVO formapagoBoleto : boletoComissao.getFormapagos()) {
FormapagoVO formapago;
if(totalFormapagos.contains(formapagoBoleto)) {
formapago = totalFormapagos.get(totalFormapagos.indexOf(formapagoBoleto));
formapago.setImporte(formapagoBoleto.getImporte().add(formapago.getImporte()));
} else {
formapago = new FormapagoVO(formapagoBoleto.getFormapagoId(), formapagoBoleto.getDescpago(), null, formapagoBoleto.getImporte());
totalFormapagos.add(formapagoBoleto);
}
}
}
}
for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) {
FormapagoVO formapagoEventoFinanceiro = new FormapagoVO(eventosFinanceiros.getFormapagoId(), eventosFinanceiros.getDescpago(), null, eventosFinanceiros.getImpingreso());
if(totalFormapagos.contains(formapagoEventoFinanceiro)) {
FormapagoVO formapago = totalFormapagos.get(totalFormapagos.indexOf(formapagoEventoFinanceiro));
formapago.setImporte(formapagoEventoFinanceiro.getImporte().add(formapago.getImporte()));
} else {
totalFormapagos.add(formapagoEventoFinanceiro);
}
}
resumoComissao.setTotalFormapago(totalFormapagos);
}
} }

View File

@ -0,0 +1,37 @@
package com.rjconsultores.ventaboletos.utilerias;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Locale;
import org.apache.commons.lang.StringUtils;
/**
*
* @author Wilian
*
*/
public class BigDecimalUtil {
public static BigDecimal getStringToBigDecimal(String value, Locale locale) throws ParseException {
if(value != null && StringUtils.isNotBlank(value)) {
NumberFormat nf = NumberFormat.getInstance(locale);
return new BigDecimal(nf.parse(value).toString());
}
return null;
}
public static String getBigDecimalToStringDouble2CasasDecimaisFormatado(BigDecimal value, Locale locale) {
if(value != null) {
NumberFormat nf = NumberFormat.getInstance(locale);
nf.setMinimumFractionDigits(2);
nf.setMaximumFractionDigits(2);
return nf.format(value.doubleValue());
}
return null;
}
}

View File

@ -0,0 +1,36 @@
package com.rjconsultores.ventaboletos.utilerias;
import java.util.Locale;
import org.zkoss.util.Locales;
/**
* Retorna o locale atual, caso o locale não seja suportado pelo sistema,<br>
* será retornado o locale pt_br
* @author Wilian
*/
public class LocaleUtil {
private static Locale LOCALE_PT_BR = new Locale("pt", "br");
private static Locale LOCALE_ES_MX = new Locale("es", "mx");
private static Locale [] LOCALES = new Locale[]{LOCALE_PT_BR, LOCALE_ES_MX};
/**
* Retorna o locale atual, caso o locale não seja suportado pelo sistema,<br>
* será retornado o locale pt_br
* @return
*/
public static Locale getLocale() {
Locale localeCurrent = Locales.getCurrent();
for (Locale locale : LOCALES) {
if(localeCurrent.getLanguage().equals(locale.getLanguage())) {
return localeCurrent;
}
}
return LOCALE_PT_BR;
}
}

View File

@ -40,10 +40,16 @@ public class BoletoComissao {
private Integer formapagoId; private Integer formapagoId;
private String descpago; private String descpago;
private Boolean indconferenciafisicacomissao; private Boolean indconferenciafisicacomissao;
private BigDecimal importeFp;
private Set<FormapagoVO> formapagos; private Set<FormapagoVO> formapagos;
private BigDecimal icmsBase; private BigDecimal icmsBase;
private String nombusuario; private String nombusuario;
private Integer comempformapagoId;
private Integer comempcategoriaId;
private Long logconferenciaId;
private boolean conferido;
public Integer getEmpresaId() { public Integer getEmpresaId() {
return empresaId; return empresaId;
@ -366,4 +372,48 @@ public class BoletoComissao {
this.nombusuario = nombusuario; this.nombusuario = nombusuario;
} }
public BigDecimal getImporteFp() {
return importeFp;
}
public void setImporteFp(BigDecimal importeFp) {
this.importeFp = importeFp;
}
public Integer getComempformapagoId() {
return comempformapagoId;
}
public void setComempformapagoId(Integer comempformapagoId) {
this.comempformapagoId = comempformapagoId;
}
public Integer getComempcategoriaId() {
return comempcategoriaId;
}
public void setComempcategoriaId(Integer comempcategoriaId) {
this.comempcategoriaId = comempcategoriaId;
}
public boolean isExigeConferencia() {
return getComempcategoriaId() != null || getComempformapagoId() != null;
}
public boolean isConferido() {
return conferido;
}
public void setConferido(boolean conferido) {
this.conferido = conferido;
}
public Long getLogconferenciaId() {
return logconferenciaId;
}
public void setLogconferenciaId(Long logconferenciaId) {
this.logconferenciaId = logconferenciaId;
}
} }

View File

@ -21,6 +21,13 @@ public class EventosFinanceirosVO {
private String descpago; private String descpago;
private Boolean indconferenciafisicacomissao; private Boolean indconferenciafisicacomissao;
private String indtipo; /* 0- Debito, 1- Credito */ private String indtipo; /* 0- Debito, 1- Credito */
private String nombusuario;
private Integer comemptipoeventoextraId;
private Integer comempformapagoId;
private Long logconferenciaId;
private boolean conferido;
public Long getEventoextraId() { public Long getEventoextraId() {
return eventoextraId; return eventoextraId;
@ -126,4 +133,48 @@ public class EventosFinanceirosVO {
return isCredito() ? Labels.getLabel("conferenciaController.lbCredito.value") : Labels.getLabel("conferenciaController.lbDebito.value"); return isCredito() ? Labels.getLabel("conferenciaController.lbCredito.value") : Labels.getLabel("conferenciaController.lbDebito.value");
} }
public String getNombusuario() {
return nombusuario;
}
public void setNombusuario(String nombusuario) {
this.nombusuario = nombusuario;
}
public Long getLogconferenciaId() {
return logconferenciaId;
}
public void setLogconferenciaId(Long logconferenciaId) {
this.logconferenciaId = logconferenciaId;
}
public boolean isConferido() {
return conferido;
}
public void setConferido(boolean conferido) {
this.conferido = conferido;
}
public Integer getComemptipoeventoextraId() {
return comemptipoeventoextraId;
}
public void setComemptipoeventoextraId(Integer comemptipoeventoextraId) {
this.comemptipoeventoextraId = comemptipoeventoextraId;
}
public Integer getComempformapagoId() {
return comempformapagoId;
}
public void setComempformapagoId(Integer comempformapagoId) {
this.comempformapagoId = comempformapagoId;
}
public boolean isExigeConferencia() {
return getComemptipoeventoextraId() != null || getComempformapagoId() != null;
}
} }

View File

@ -1,20 +1,27 @@
package com.rjconsultores.ventaboletos.vo.comissao; package com.rjconsultores.ventaboletos.vo.comissao;
import java.math.BigDecimal;
import com.rjconsultores.ventaboletos.utilerias.BigDecimalUtil;
import com.rjconsultores.ventaboletos.utilerias.LocaleUtil;
public class FormapagoVO { public class FormapagoVO {
private Integer formapagoId; private Integer formapagoId;
private String descpago; private String descpago;
private Boolean indconferenciafisicacomissao; private Boolean indconferenciafisicacomissao;
private BigDecimal importe;
public FormapagoVO() { public FormapagoVO() {
super(); super();
} }
public FormapagoVO(Integer formapagoId, String descpago, Boolean indconferenciafisicacomissao) { public FormapagoVO(Integer formapagoId, String descpago, Boolean indconferenciafisicacomissao, BigDecimal importeFp) {
this(); this();
this.formapagoId = formapagoId; this.formapagoId = formapagoId;
this.descpago = descpago; this.descpago = descpago;
this.indconferenciafisicacomissao = indconferenciafisicacomissao; this.indconferenciafisicacomissao = indconferenciafisicacomissao;
this.importe = importeFp;
} }
public Integer getFormapagoId() { public Integer getFormapagoId() {
@ -41,4 +48,39 @@ public class FormapagoVO {
this.indconferenciafisicacomissao = indconferenciafisicacomissao; this.indconferenciafisicacomissao = indconferenciafisicacomissao;
} }
public BigDecimal getImporte() {
return importe;
}
public void setImporte(BigDecimal importe) {
this.importe = importe;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((formapagoId == null) ? 0 : formapagoId.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
FormapagoVO other = (FormapagoVO) obj;
if (formapagoId == null) {
if (other.formapagoId != null)
return false;
} else if (!formapagoId.equals(other.formapagoId))
return false;
return true;
}
public String getImporteFormatado() {
return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getImporte(), LocaleUtil.getLocale());
}
} }

View File

@ -43,6 +43,11 @@ public class LogConferenciaVO {
this.numfoliosistema = numfoliosistema; this.numfoliosistema = numfoliosistema;
} }
public LogConferenciaVO(Long logconferenciaId) {
this();
this.logconferenciaId = logconferenciaId;
}
public Long getLogconferenciaId() { public Long getLogconferenciaId() {
return logconferenciaId; return logconferenciaId;
} }

View File

@ -6,6 +6,8 @@ import java.util.Date;
import org.zkoss.util.resource.Labels; import org.zkoss.util.resource.Labels;
import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia; import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia;
import com.rjconsultores.ventaboletos.utilerias.BigDecimalUtil;
import com.rjconsultores.ventaboletos.utilerias.LocaleUtil;
public class OcdVO { public class OcdVO {
@ -31,8 +33,11 @@ public class OcdVO {
private Date fecmodif; private Date fecmodif;
private Integer usuarioId; private Integer usuarioId;
private Boolean activo; private Boolean activo;
private String nombusuario;
private Integer status; private Integer status;
private Long logconferenciaId;
private boolean conferido;
public Long getOcdId() { public Long getOcdId() {
return ocdId; return ocdId;
@ -182,4 +187,36 @@ public class OcdVO {
return getIndpago() != null && getIndpago() ? Labels.getLabel("conferenciaController.lbl.sim") : Labels.getLabel("conferenciaController.lbl.nao"); return getIndpago() != null && getIndpago() ? Labels.getLabel("conferenciaController.lbl.sim") : Labels.getLabel("conferenciaController.lbl.nao");
} }
public String getNombusuario() {
return nombusuario;
}
public void setNombusuario(String nombusuario) {
this.nombusuario = nombusuario;
}
public String getValorPagarFormatado() {
return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getValorPagar(), LocaleUtil.getLocale());
}
public String getPenalizacionFormatado() {
return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getPenalizacion(), LocaleUtil.getLocale());
}
public Long getLogconferenciaId() {
return logconferenciaId;
}
public void setLogconferenciaId(Long logconferenciaId) {
this.logconferenciaId = logconferenciaId;
}
public boolean isConferido() {
return conferido;
}
public void setConferido(boolean conferido) {
this.conferido = conferido;
}
} }

View File

@ -0,0 +1,130 @@
package com.rjconsultores.ventaboletos.vo.comissao;
import java.math.BigDecimal;
import java.util.List;
import com.rjconsultores.ventaboletos.utilerias.BigDecimalUtil;
import com.rjconsultores.ventaboletos.utilerias.LocaleUtil;
public class ResumoComissao {
private BigDecimal totalVendas;
private BigDecimal totalCancelados;
private BigDecimal totalDevolvidos;
private BigDecimal totalTroca;
private BigDecimal totalReceitas;
private BigDecimal totalDespesas;
private BigDecimal valorDeposito;
private OcdVO totalOcd;
private List<FormapagoVO> totalFormapago;
public BigDecimal getTotalVendas() {
return totalVendas;
}
public void setTotalVendas(BigDecimal totalVendas) {
this.totalVendas = totalVendas;
}
public BigDecimal getTotalCancelados() {
return totalCancelados;
}
public void setTotalCancelados(BigDecimal totalCancelados) {
this.totalCancelados = totalCancelados;
}
public BigDecimal getTotalDevolvidos() {
return totalDevolvidos;
}
public void setTotalDevolvidos(BigDecimal totalDevolvidos) {
this.totalDevolvidos = totalDevolvidos;
}
public BigDecimal getTotalTroca() {
return totalTroca;
}
public void setTotalTroca(BigDecimal totalTroca) {
this.totalTroca = totalTroca;
}
public BigDecimal getTotalReceitas() {
return totalReceitas;
}
public void setTotalReceitas(BigDecimal totalReceitas) {
this.totalReceitas = totalReceitas;
}
public BigDecimal getTotalDespesas() {
return totalDespesas;
}
public void setTotalDespesas(BigDecimal totalDespesas) {
this.totalDespesas = totalDespesas;
}
public BigDecimal getValorDeposito() {
return valorDeposito;
}
public void setValorDeposito(BigDecimal valorDeposito) {
this.valorDeposito = valorDeposito;
}
public List<FormapagoVO> getTotalFormapago() {
return totalFormapago;
}
public void setTotalFormapago(List<FormapagoVO> totalFormapago) {
this.totalFormapago = totalFormapago;
}
public OcdVO getTotalOcd() {
return totalOcd;
}
public void setTotalOcd(OcdVO totalOcd) {
this.totalOcd = totalOcd;
}
public String getTotalVendasFormatado() {
return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalVendas(), LocaleUtil.getLocale());
}
public String getTotalCanceladosFormatado() {
return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalCancelados(), LocaleUtil.getLocale());
}
public String getTotalDevolvidosFormatado() {
return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalDevolvidos(), LocaleUtil.getLocale());
}
public String getTotalTrocaFormatado() {
return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalTroca(), LocaleUtil.getLocale());
}
public String getTotalReceitasFormatado() {
return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalReceitas(), LocaleUtil.getLocale());
}
public String getTotalDespesasFormatado() {
return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalDespesas(), LocaleUtil.getLocale());
}
public BigDecimal getTotalDiferenca() {
return getTotalReceitas().subtract(getTotalDespesas());
}
public String getTotalDiferencaFormatado() {
return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalDiferenca(), LocaleUtil.getLocale());
}
public String getValorDepositoFormatado() {
return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getValorDeposito(), LocaleUtil.getLocale());
}
}