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
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue