fixes bug#14405
dev:julio qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@93858 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
0f34470fc8
commit
d44b3b3aaf
|
@ -432,8 +432,8 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
||||||
sql.append(" AND r3.totparcial not in (");
|
sql.append(" AND r3.totparcial not in (");
|
||||||
sql.append("'" + SituacaoTributaria.NAO_FISCAL.getValue() + "'").append(")");
|
sql.append("'" + SituacaoTributaria.NAO_FISCAL.getValue() + "'").append(")");
|
||||||
sql.append(" AND anterior.numserie20 = r2.numserie20 ");
|
sql.append(" AND anterior.numserie20 = r2.numserie20 ");
|
||||||
sql.append(" AND anterior.datamov = r2.datamov - 1 ");
|
sql.append(" AND anterior.datamov = r2.datamov - 1 ");
|
||||||
sql.append(" AND to_number(anterior.crz) = to_number(r2.crz) - 1 ");
|
sql.append(" AND to_number(anterior.crz) = to_number(r2.crz) - 1 ");
|
||||||
sql.append(" AND r2.vendabrutadiaria > 0 ");
|
sql.append(" AND r2.vendabrutadiaria > 0 ");
|
||||||
sql.append("GROUP BY r2.datamov, ");
|
sql.append("GROUP BY r2.datamov, ");
|
||||||
sql.append(" r2.numreducoes, ");
|
sql.append(" r2.numreducoes, ");
|
||||||
|
@ -2317,6 +2317,8 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
||||||
public ExportacaoBPR buscarRegistroBPR(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado) {
|
public ExportacaoBPR buscarRegistroBPR(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado) {
|
||||||
ExportacaoBPR exportacaoRMD = new ExportacaoBPR();
|
ExportacaoBPR exportacaoRMD = new ExportacaoBPR();
|
||||||
|
|
||||||
|
boolean isDif = validaConstanteCustom(empresaId.toString(), "IMPORT_FISCAL_DIF");
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(" select distinct");
|
sb.append(" select distinct");
|
||||||
sb.append(" eof.estado_id as codigoParticipantePar,");
|
sb.append(" eof.estado_id as codigoParticipantePar,");
|
||||||
|
@ -2373,7 +2375,6 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
||||||
sb.append(" left join empresa_imposto eif on eif.activo = 1 and eif.empresa_id = f.empresa_id and eif.estado_id = eof.estado_id");
|
sb.append(" left join empresa_imposto eif on eif.activo = 1 and eif.empresa_id = f.empresa_id and eif.estado_id = eof.estado_id");
|
||||||
sb.append(" left join inscricao_estadual ie on ie.empresa_id = f.empresa_id and ie.estado_id = eof.estado_id and ie.activo = 1");
|
sb.append(" left join inscricao_estadual ie on ie.empresa_id = f.empresa_id and ie.estado_id = eof.estado_id and ie.activo = 1");
|
||||||
sb.append(" left join ciudad cie on cie.ciudad_id = ie.ciudad_id");
|
sb.append(" left join ciudad cie on cie.ciudad_id = ie.ciudad_id");
|
||||||
// sb.append(" left join caja b on b.activo = 1 and b.rmd_id = (case when coalesce(f.indcancelacion, 0) = 1 then -1 else f.rmd_id end) and b.empresacorrida_id = f.empresa_id and b.foliormd = f.folio and to_char(b.fechorventa, 'ddmmyyyy') = to_char(f.fechorfolio, 'ddmmyyyy')");
|
|
||||||
sb.append(" left join caja b on b.activo = 1 and b.rmd_id = f.rmd_id and b.empresacorrida_id = f.empresa_id and b.foliormd = f.folio and to_char(b.fechorventa, 'ddmmyyyy') = to_char(f.fechorfolio, 'ddmmyyyy')");
|
sb.append(" left join caja b on b.activo = 1 and b.rmd_id = f.rmd_id and b.empresacorrida_id = f.empresa_id and b.foliormd = f.folio and to_char(b.fechorventa, 'ddmmyyyy') = to_char(f.fechorfolio, 'ddmmyyyy')");
|
||||||
sb.append(" left join parada po on po.parada_id = b.origen_id and po.activo = 1 ");
|
sb.append(" left join parada po on po.parada_id = b.origen_id and po.activo = 1 ");
|
||||||
sb.append(" left join ciudad co on co.ciudad_id = po.ciudad_id and co.activo = 1 ");
|
sb.append(" left join ciudad co on co.ciudad_id = po.ciudad_id and co.activo = 1 ");
|
||||||
|
@ -2397,9 +2398,20 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
||||||
sb.append(" and f.fechorfolio >= to_date(?,'DD/MM/YYYY HH24:MI:SS') and f.fechorfolio <= to_date(?,'DD/MM/YYYY HH24:MI:SS') ");
|
sb.append(" and f.fechorfolio >= to_date(?,'DD/MM/YYYY HH24:MI:SS') and f.fechorfolio <= to_date(?,'DD/MM/YYYY HH24:MI:SS') ");
|
||||||
sb.append(" and f.empresa_id = ? ");
|
sb.append(" and f.empresa_id = ? ");
|
||||||
sb.append(" and eof.cveestado like ? ");
|
sb.append(" and eof.cveestado like ? ");
|
||||||
sb.append(" and (f.indcancelacion = 1 or ( ((b.tipoventa_id = 3 and b.indstatusboleto = 'V' and b.indreimpresion = 0) ");
|
sb.append(" and (f.indcancelacion = 1 or ( ");
|
||||||
sb.append(" or (b.tipoventa_id in (12,18) and b.indstatusboleto = 'E' and b.numfoliosistema = b.numfoliopreimpreso)) ");
|
|
||||||
sb.append(" and (b.motivocancelacion_id is null or b.motivocancelacion_id <> 35) ))");
|
if (isDif) {
|
||||||
|
sb.append(" ((b.tipoventa_id not in (5,12,18,81,82,49,41) and b.indstatusboleto = 'V' and b.indreimpresion = 0) ");
|
||||||
|
sb.append(" or (b.tipoventa_id in (5,12,18,81,82,49,41) ");
|
||||||
|
sb.append(" and b.indstatusboleto = 'E' and b.numfoliosistema = b.numfoliopreimpreso)) ");
|
||||||
|
sb.append(" and a.aidf_id is not null and b.indcancelacion = 0 ");
|
||||||
|
sb.append(" and (b.motivocancelacion_id is null or b.motivocancelacion_id <> 35) )) ");
|
||||||
|
} else {
|
||||||
|
sb.append(" ((b.tipoventa_id = 3 and b.indstatusboleto = 'V' and b.indreimpresion = 0) ");
|
||||||
|
sb.append(" or (b.tipoventa_id in (12,18) and b.indstatusboleto = 'E' and b.numfoliosistema = b.numfoliopreimpreso)) ");
|
||||||
|
sb.append(" and (b.motivocancelacion_id is null or b.motivocancelacion_id <> 35) )) ");
|
||||||
|
}
|
||||||
|
|
||||||
sb.append(" order by dataEmissaoRMD ");
|
sb.append(" order by dataEmissaoRMD ");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -3673,7 +3685,7 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
||||||
List<DetalhadoRMD> list = new ArrayList<DetalhadoRMD>();
|
List<DetalhadoRMD> list = new ArrayList<DetalhadoRMD>();
|
||||||
try {
|
try {
|
||||||
boolean isDif = validaConstanteCustom(empresaId.toString(), "IMPORT_FISCAL_DIF");
|
boolean isDif = validaConstanteCustom(empresaId.toString(), "IMPORT_FISCAL_DIF");
|
||||||
|
|
||||||
String sql = null;
|
String sql = null;
|
||||||
if (isECF && !isCancelamento) {
|
if (isECF && !isCancelamento) {
|
||||||
sql = getSqlImpressaoRMDTipoECF();
|
sql = getSqlImpressaoRMDTipoECF();
|
||||||
|
@ -3682,7 +3694,7 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
||||||
} else if (isCancelamento) {
|
} else if (isCancelamento) {
|
||||||
sql = getSqlImpressaoRMDCancelados();
|
sql = getSqlImpressaoRMDCancelados();
|
||||||
}
|
}
|
||||||
|
|
||||||
NamedParameterStatement ps = new NamedParameterStatement(connection, sql);
|
NamedParameterStatement ps = new NamedParameterStatement(connection, sql);
|
||||||
ps.getStatement().setFetchSize(100);
|
ps.getStatement().setFetchSize(100);
|
||||||
ps.setInt("EMPRESA_ID", empresaId);
|
ps.setInt("EMPRESA_ID", empresaId);
|
||||||
|
@ -3757,11 +3769,11 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean validaConstanteCustom(String valor, String nomeConstante) {
|
public boolean validaConstanteCustom(String valor, String nomeConstante) {
|
||||||
ConstanteService constanteService = (ConstanteService) AppContext.getApplicationContext().getBean("constanteService");
|
ConstanteService constanteService = (ConstanteService) AppContext.getApplicationContext().getBean("constanteService");
|
||||||
String value = constanteService.buscarPorNomeConstante(nomeConstante).getValorconstante();
|
String value = constanteService.buscarPorNomeConstante(nomeConstante).getValorconstante();
|
||||||
|
|
||||||
if (StringUtils.isBlank(value))
|
if (StringUtils.isBlank(value))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue