bug #7500
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@56832 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
9408a4f383
commit
f46fc91cbf
|
@ -17,7 +17,7 @@ public interface FiscalDAO {
|
||||||
|
|
||||||
public List<ImportacionFiscalVO> buscaDatosFiscaisECF(Date inicio, Date fim, Integer empresaId, boolean isNormal, boolean isCancelados, boolean isPendencias, Connection connection) throws SQLException;
|
public List<ImportacionFiscalVO> buscaDatosFiscaisECF(Date inicio, Date fim, Integer empresaId, boolean isNormal, boolean isCancelados, boolean isPendencias, Connection connection) throws SQLException;
|
||||||
|
|
||||||
public List<ImportacionFiscalReducaoZVO> buscaDatosFiscaisReducaoZ(Date inicio, Date fim, Integer empresaId, Connection connection) throws SQLException;
|
public List<ImportacionFiscalReducaoZVO> buscaDatosFiscaisReducaoZ(Date inicio, Date fim, Integer empresaId, boolean isPendencias, Connection connection) throws SQLException;
|
||||||
|
|
||||||
public List<ImportacionManualFiscalVO> buscaDatosFiscaisECFManual(Date inicio, Date fim, Integer empresaId, Connection connection) throws SQLException;
|
public List<ImportacionManualFiscalVO> buscaDatosFiscaisECFManual(Date inicio, Date fim, Integer empresaId, Connection connection) throws SQLException;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ public class FiscalHibernateDAO implements FiscalDAO {
|
||||||
public static final String DATE_FORMAT_FISCAL = "yyyyMMdd";
|
public static final String DATE_FORMAT_FISCAL = "yyyyMMdd";
|
||||||
|
|
||||||
public FiscalHibernateDAO() {
|
public FiscalHibernateDAO() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -189,10 +188,7 @@ public class FiscalHibernateDAO implements FiscalDAO {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private String sqlFiscaisReducaoZPendencia() {
|
||||||
public List<ImportacionFiscalReducaoZVO> buscaDatosFiscaisReducaoZ(Date inicio, Date fim, Integer empresaId, Connection connection) throws SQLException {
|
|
||||||
PreparedStatement stmt = null;
|
|
||||||
ResultSet rset = null;
|
|
||||||
|
|
||||||
StringBuilder sql = new StringBuilder();
|
StringBuilder sql = new StringBuilder();
|
||||||
sql.append("SELECT r2.datamov AS datamov, ");
|
sql.append("SELECT r2.datamov AS datamov, ");
|
||||||
|
@ -210,7 +206,78 @@ public class FiscalHibernateDAO implements FiscalDAO {
|
||||||
sql.append(" ifi.numserie AS numpdv, ");
|
sql.append(" ifi.numserie AS numpdv, ");
|
||||||
sql.append(" TRANSLATE(t2.cnpj, ' / - . ', ' ') AS cnpj,");
|
sql.append(" TRANSLATE(t2.cnpj, ' / - . ', ' ') AS cnpj,");
|
||||||
sql.append(" r2.totgeral AS gtFinal, ");
|
sql.append(" r2.totgeral AS gtFinal, ");
|
||||||
sql.append(" anterior.totgeral AS gtInicial ");
|
sql.append(" anterior.totgeral AS gtInicial, ");
|
||||||
|
sql.append(" CASE WHEN r3.totparcial = 'Can-T' THEN 'CANCELADO' ");
|
||||||
|
sql.append(" WHEN r3.totparcial = 'DT' THEN 'DESCONTO' ELSE '' END AS status ");
|
||||||
|
sql.append("FROM fiscal_r2 r2 ");
|
||||||
|
sql.append(" inner join fiscal_impressora ifi ");
|
||||||
|
sql.append(" ON ifi.numserie20 = r2.numserie20 ");
|
||||||
|
sql.append(" inner join fiscal_r3 r3 ");
|
||||||
|
sql.append(" ON r3.crz = r2.crz ");
|
||||||
|
sql.append(" AND r2.numserie20 = r3.numserie20 ");
|
||||||
|
sql.append(" AND r3.datamov = r2.datamov ");
|
||||||
|
sql.append(" AND r3.fiscalimpressora_id = ifi.fiscalimpressora_id ");
|
||||||
|
sql.append(" inner join fiscal_t2 t2 ");
|
||||||
|
sql.append(" ON ifi.fiscalimpressora_id = t2.fiscalimpressora_id ");
|
||||||
|
sql.append(" inner join empresa e ON (TRANSLATE(t2.cnpj, ' / - . ', ' ') = (TRANSLATE(e.cnpj, ' / - . ', ' ')) ) or ");
|
||||||
|
sql.append(" (TRANSLATE(t2.cnpj, ' / - . ', ' ') in ");
|
||||||
|
sql.append(" (select TRANSLATE(cnpj, ' / - . ', ' ') from inscricao_estadual where empresa_id = ? and activo = 1 )), ");
|
||||||
|
sql.append(" (SELECT numserie20, crz, totgeral ");
|
||||||
|
sql.append(" FROM fiscal_r2) anterior ");
|
||||||
|
sql.append("WHERE r2.datamov BETWEEN ? AND ? ");
|
||||||
|
sql.append(" AND r2.activo = 1 ");
|
||||||
|
sql.append(" AND e.empresa_id = ? ");
|
||||||
|
sql.append(" AND r3.totparcial IN (");
|
||||||
|
sql.append("'" + SituacaoTributaria.CANCELADO.getValue() + "'").append(", ");
|
||||||
|
sql.append("'" + SituacaoTributaria.DESCONTO.getValue() + "'").append(")");
|
||||||
|
sql.append(" AND anterior.numserie20 = r2.numserie20 ");
|
||||||
|
sql.append(" AND anterior.crz = r2.crz - 1 ");
|
||||||
|
sql.append(" AND (SELECT MAX(fiscalr4_id) FROM fiscal_r4 r4 WHERE r4.numserie20 = r2.numserie20 ");
|
||||||
|
sql.append(" AND r4.datamov = r2.datamov) IS NOT NULL ");
|
||||||
|
sql.append("GROUP BY r2.datamov, ");
|
||||||
|
sql.append(" r2.numreducoes, ");
|
||||||
|
sql.append(" r2.crz, ");
|
||||||
|
sql.append(" r2.numserie20, ");
|
||||||
|
sql.append(" r2.coo, ");
|
||||||
|
sql.append(" r2.cooinicial, ");
|
||||||
|
sql.append(" r2.coofinal, ");
|
||||||
|
sql.append(" r2.vendabrutadiaria, ");
|
||||||
|
sql.append(" r2.datareducao, ");
|
||||||
|
sql.append(" r2.horareducao, ");
|
||||||
|
sql.append(" r3.totparcial, ");
|
||||||
|
sql.append(" r3.valoracumulado, ");
|
||||||
|
sql.append(" ifi.numserie, ");
|
||||||
|
sql.append(" t2.cnpj, ");
|
||||||
|
sql.append(" r2.totgeral, ");
|
||||||
|
sql.append(" anterior.totgeral ");
|
||||||
|
sql.append("ORDER BY r2.datamov, ");
|
||||||
|
sql.append(" numserie20, ");
|
||||||
|
sql.append(" crz, ");
|
||||||
|
sql.append(" r2.numreducoes, ");
|
||||||
|
sql.append(" r3.totparcial desc ");
|
||||||
|
return sql.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String sqlFiscaisReducaoZPendenciaInconcistencias() {
|
||||||
|
|
||||||
|
StringBuilder sql = new StringBuilder();
|
||||||
|
sql.append("SELECT r2.datamov AS datamov, ");
|
||||||
|
sql.append(" r2.numreducoes AS numreducoes, ");
|
||||||
|
sql.append(" r2.crz AS crz, ");
|
||||||
|
sql.append(" r2.numserie20 AS numserie20, ");
|
||||||
|
sql.append(" r2.coo AS coo, ");
|
||||||
|
sql.append(" r2.cooinicial AS cooinicial, ");
|
||||||
|
sql.append(" r2.coofinal AS coofinal, ");
|
||||||
|
sql.append(" r2.vendabrutadiaria AS vendabrutadiaria, ");
|
||||||
|
sql.append(" r2.datareducao AS datareducao, ");
|
||||||
|
sql.append(" r2.horareducao AS horareducao, ");
|
||||||
|
sql.append(" r3.totparcial AS aliquota, ");
|
||||||
|
sql.append(" r3.valoracumulado AS imposto, ");
|
||||||
|
sql.append(" ifi.numserie AS numpdv, ");
|
||||||
|
sql.append(" TRANSLATE(t2.cnpj, ' / - . ', ' ') AS cnpj,");
|
||||||
|
sql.append(" r2.totgeral AS gtFinal, ");
|
||||||
|
sql.append(" anterior.totgeral AS gtInicial, ");
|
||||||
|
sql.append(" 'INCONSISTENTE' AS status ");
|
||||||
sql.append("FROM fiscal_r2 r2 ");
|
sql.append("FROM fiscal_r2 r2 ");
|
||||||
sql.append(" inner join fiscal_impressora ifi ");
|
sql.append(" inner join fiscal_impressora ifi ");
|
||||||
sql.append(" ON ifi.numserie20 = r2.numserie20 ");
|
sql.append(" ON ifi.numserie20 = r2.numserie20 ");
|
||||||
|
@ -233,6 +300,8 @@ public class FiscalHibernateDAO implements FiscalDAO {
|
||||||
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.crz = r2.crz - 1 ");
|
sql.append(" AND anterior.crz = r2.crz - 1 ");
|
||||||
|
sql.append(" AND (SELECT MAX(fiscalr4_id) FROM fiscal_r4 r4 WHERE r4.numserie20 = r2.numserie20 ");
|
||||||
|
sql.append(" AND r4.datamov = r2.datamov) IS NULL ");
|
||||||
sql.append("GROUP BY r2.datamov, ");
|
sql.append("GROUP BY r2.datamov, ");
|
||||||
sql.append(" r2.numreducoes, ");
|
sql.append(" r2.numreducoes, ");
|
||||||
sql.append(" r2.crz, ");
|
sql.append(" r2.crz, ");
|
||||||
|
@ -254,17 +323,101 @@ public class FiscalHibernateDAO implements FiscalDAO {
|
||||||
sql.append(" crz, ");
|
sql.append(" crz, ");
|
||||||
sql.append(" r2.numreducoes, ");
|
sql.append(" r2.numreducoes, ");
|
||||||
sql.append(" r3.totparcial desc ");
|
sql.append(" r3.totparcial desc ");
|
||||||
|
return sql.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String sqlFiscaisReducaoZ() {
|
||||||
|
|
||||||
|
StringBuilder sql = new StringBuilder();
|
||||||
|
sql.append("SELECT r2.datamov AS datamov, ");
|
||||||
|
sql.append(" r2.numreducoes AS numreducoes, ");
|
||||||
|
sql.append(" r2.crz AS crz, ");
|
||||||
|
sql.append(" r2.numserie20 AS numserie20, ");
|
||||||
|
sql.append(" r2.coo AS coo, ");
|
||||||
|
sql.append(" r2.cooinicial AS cooinicial, ");
|
||||||
|
sql.append(" r2.coofinal AS coofinal, ");
|
||||||
|
sql.append(" r2.vendabrutadiaria AS vendabrutadiaria, ");
|
||||||
|
sql.append(" r2.datareducao AS datareducao, ");
|
||||||
|
sql.append(" r2.horareducao AS horareducao, ");
|
||||||
|
sql.append(" r3.totparcial AS aliquota, ");
|
||||||
|
sql.append(" r3.valoracumulado AS imposto, ");
|
||||||
|
sql.append(" ifi.numserie AS numpdv, ");
|
||||||
|
sql.append(" TRANSLATE(t2.cnpj, ' / - . ', ' ') AS cnpj,");
|
||||||
|
sql.append(" r2.totgeral AS gtFinal, ");
|
||||||
|
sql.append(" anterior.totgeral AS gtInicial, ");
|
||||||
|
sql.append(" 'NORMAL' AS status ");
|
||||||
|
sql.append("FROM fiscal_r2 r2 ");
|
||||||
|
sql.append(" inner join fiscal_impressora ifi ");
|
||||||
|
sql.append(" ON ifi.numserie20 = r2.numserie20 ");
|
||||||
|
sql.append(" inner join fiscal_r3 r3 ");
|
||||||
|
sql.append(" ON r3.crz = r2.crz ");
|
||||||
|
sql.append(" AND r2.numserie20 = r3.numserie20 ");
|
||||||
|
sql.append(" AND r3.datamov = r2.datamov ");
|
||||||
|
sql.append(" AND r3.fiscalimpressora_id = ifi.fiscalimpressora_id ");
|
||||||
|
sql.append(" inner join fiscal_t2 t2 ");
|
||||||
|
sql.append(" ON ifi.fiscalimpressora_id = t2.fiscalimpressora_id ");
|
||||||
|
sql.append(" inner join empresa e ON (TRANSLATE(t2.cnpj, ' / - . ', ' ') = (TRANSLATE(e.cnpj, ' / - . ', ' ')) ) or ");
|
||||||
|
sql.append(" (TRANSLATE(t2.cnpj, ' / - . ', ' ') in ");
|
||||||
|
sql.append(" (select TRANSLATE(cnpj, ' / - . ', ' ') from inscricao_estadual where empresa_id = ? and activo = 1 )), ");
|
||||||
|
sql.append(" (SELECT numserie20, crz, totgeral ");
|
||||||
|
sql.append(" FROM fiscal_r2) anterior ");
|
||||||
|
sql.append("WHERE r2.datamov BETWEEN ? AND ? ");
|
||||||
|
sql.append(" AND r2.activo = 1 ");
|
||||||
|
sql.append(" AND e.empresa_id = ? ");
|
||||||
|
sql.append(" AND r3.totparcial not in (");
|
||||||
|
sql.append("'" + SituacaoTributaria.NAO_FISCAL.getValue() + "'").append(")");
|
||||||
|
sql.append(" AND anterior.numserie20 = r2.numserie20 ");
|
||||||
|
sql.append(" AND anterior.crz = r2.crz - 1 ");
|
||||||
|
sql.append(" AND (SELECT MAX(fiscalr4_id) FROM fiscal_r4 r4 WHERE r4.numserie20 = r2.numserie20 ");
|
||||||
|
sql.append(" AND r4.datamov = r2.datamov) IS NOT NULL ");
|
||||||
|
sql.append("GROUP BY r2.datamov, ");
|
||||||
|
sql.append(" r2.numreducoes, ");
|
||||||
|
sql.append(" r2.crz, ");
|
||||||
|
sql.append(" r2.numserie20, ");
|
||||||
|
sql.append(" r2.coo, ");
|
||||||
|
sql.append(" r2.cooinicial, ");
|
||||||
|
sql.append(" r2.coofinal, ");
|
||||||
|
sql.append(" r2.vendabrutadiaria, ");
|
||||||
|
sql.append(" r2.datareducao, ");
|
||||||
|
sql.append(" r2.horareducao, ");
|
||||||
|
sql.append(" r3.totparcial, ");
|
||||||
|
sql.append(" r3.valoracumulado, ");
|
||||||
|
sql.append(" ifi.numserie, ");
|
||||||
|
sql.append(" t2.cnpj, ");
|
||||||
|
sql.append(" r2.totgeral, ");
|
||||||
|
sql.append(" anterior.totgeral ");
|
||||||
|
sql.append("ORDER BY r2.datamov, ");
|
||||||
|
sql.append(" numserie20, ");
|
||||||
|
sql.append(" crz, ");
|
||||||
|
sql.append(" r2.numreducoes, ");
|
||||||
|
sql.append(" r3.totparcial desc ");
|
||||||
|
return sql.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ImportacionFiscalReducaoZVO> buscaDatosFiscaisReducaoZ(Date inicio, Date fim, Integer empresaId, boolean isPendencias, Connection connection) throws SQLException {
|
||||||
|
if (isPendencias) {
|
||||||
|
List<ImportacionFiscalReducaoZVO> list = new ArrayList<ImportacionFiscalReducaoZVO>();
|
||||||
|
list.addAll(montarItensReducaoZ(inicio, fim, empresaId, sqlFiscaisReducaoZPendencia(), connection));
|
||||||
|
list.addAll(montarItensReducaoZ(inicio, fim, empresaId, sqlFiscaisReducaoZPendenciaInconcistencias(), connection));
|
||||||
|
return list;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return montarItensReducaoZ(inicio, fim, empresaId, sqlFiscaisReducaoZ(), connection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ImportacionFiscalReducaoZVO> montarItensReducaoZ(Date inicio, Date fim, Integer empresaId, String sql, Connection connection) throws SQLException {
|
||||||
|
|
||||||
List<ImportacionFiscalReducaoZVO> listRedZ = new ArrayList<ImportacionFiscalReducaoZVO>();
|
List<ImportacionFiscalReducaoZVO> listRedZ = new ArrayList<ImportacionFiscalReducaoZVO>();
|
||||||
|
PreparedStatement stmt = connection.prepareStatement(sql);
|
||||||
stmt = connection.prepareStatement(sql.toString());
|
|
||||||
stmt.setFetchSize(100);
|
stmt.setFetchSize(100);
|
||||||
stmt.setInt(1, empresaId);
|
stmt.setInt(1, empresaId);
|
||||||
stmt.setString(2, DateUtil.getStringDate(inicio, DATE_FORMAT_FISCAL));
|
stmt.setString(2, DateUtil.getStringDate(inicio, DATE_FORMAT_FISCAL));
|
||||||
stmt.setString(3, DateUtil.getStringDate(fim, DATE_FORMAT_FISCAL));
|
stmt.setString(3, DateUtil.getStringDate(fim, DATE_FORMAT_FISCAL));
|
||||||
stmt.setInt(4, empresaId);
|
stmt.setInt(4, empresaId);
|
||||||
|
|
||||||
rset = stmt.executeQuery();
|
ResultSet rset = stmt.executeQuery();
|
||||||
while (rset.next()) {
|
while (rset.next()) {
|
||||||
|
|
||||||
ImportacionFiscalReducaoZVO item = new ImportacionFiscalReducaoZVO();
|
ImportacionFiscalReducaoZVO item = new ImportacionFiscalReducaoZVO();
|
||||||
|
@ -284,15 +437,14 @@ public class FiscalHibernateDAO implements FiscalDAO {
|
||||||
item.setCnpj(rset.getString("cnpj"));
|
item.setCnpj(rset.getString("cnpj"));
|
||||||
item.setGtFinal(rset.getBigDecimal("gtFinal"));
|
item.setGtFinal(rset.getBigDecimal("gtFinal"));
|
||||||
item.setGtInicial(rset.getBigDecimal("gtInicial"));
|
item.setGtInicial(rset.getBigDecimal("gtInicial"));
|
||||||
|
item.setStatus(rset.getString("status"));
|
||||||
listRedZ.add(item);
|
listRedZ.add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return listRedZ;
|
return listRedZ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String sqlFiscaisECFCancelados() {
|
private String sqlFiscaisECFCancelados() {
|
||||||
|
|
||||||
StringBuilder sql = new StringBuilder();
|
StringBuilder sql = new StringBuilder();
|
||||||
sql.append("SELECT r4.numserie20 as numImpressora, ");
|
sql.append("SELECT r4.numserie20 as numImpressora, ");
|
||||||
|
@ -380,7 +532,7 @@ public class FiscalHibernateDAO implements FiscalDAO {
|
||||||
return sql.toString();
|
return sql.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String sqlFiscaisECF() {
|
private String sqlFiscaisECF() {
|
||||||
|
|
||||||
StringBuilder sql = new StringBuilder();
|
StringBuilder sql = new StringBuilder();
|
||||||
sql.append("SELECT r4.numserie20 as numImpressora, ");
|
sql.append("SELECT r4.numserie20 as numImpressora, ");
|
||||||
|
|
|
@ -15,6 +15,8 @@ public interface FiscalService {
|
||||||
|
|
||||||
public File importacionFiscalReducaoZ(Date inicio, Date fim, Empresa empresa);
|
public File importacionFiscalReducaoZ(Date inicio, Date fim, Empresa empresa);
|
||||||
|
|
||||||
|
public File importacionFiscalReducaoZPendencia(Date inicio, Date fim, Empresa empresa);
|
||||||
|
|
||||||
public File importacionFiscalECFManual(Date inicio, Date fim, Empresa empresa);
|
public File importacionFiscalECFManual(Date inicio, Date fim, Empresa empresa);
|
||||||
|
|
||||||
public File importacionNaoFiscal(Date inicio, Date fim, Empresa empresa);
|
public File importacionNaoFiscal(Date inicio, Date fim, Empresa empresa);
|
||||||
|
|
|
@ -331,11 +331,24 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
return aux;
|
return aux;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File importacionFiscalReducaoZPendencia(Date inicio, Date fim, Empresa empresa) {
|
||||||
|
return importacionReducaoZ(inicio, fim, empresa, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public File importacionFiscalReducaoZ(Date inicio, Date fim, Empresa empresa) {
|
public File importacionFiscalReducaoZ(Date inicio, Date fim, Empresa empresa) {
|
||||||
|
return importacionReducaoZ(inicio, fim, empresa, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private File importacionReducaoZ(Date inicio, Date fim, Empresa empresa, boolean isPendencias) {
|
||||||
Connection connection = null;
|
Connection connection = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String nomeArquivo = "fiscal_reducao_z_" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss");
|
String nomeArquivo = "fiscal_reducao_z_" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss");
|
||||||
|
if (isPendencias)
|
||||||
|
nomeArquivo = "fiscal_pendencia_reducao_z_" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss");
|
||||||
|
|
||||||
File arquivo = File.createTempFile(nomeArquivo, ".txt");
|
File arquivo = File.createTempFile(nomeArquivo, ".txt");
|
||||||
|
|
||||||
PrintWriter gravarArq = new PrintWriter(new OutputStreamWriter(new FileOutputStream(arquivo), Constantes.UTF_8));
|
PrintWriter gravarArq = new PrintWriter(new OutputStreamWriter(new FileOutputStream(arquivo), Constantes.UTF_8));
|
||||||
|
@ -352,7 +365,12 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
|
|
||||||
connection = DataSourceUtils.getConnection(dataSourceRead);
|
connection = DataSourceUtils.getConnection(dataSourceRead);
|
||||||
|
|
||||||
List<ImportacionFiscalReducaoZVO> list = agruparReducaoZ(fiscalDAO.buscaDatosFiscaisReducaoZ(inicio, fim, empresa.getEmpresaId(), connection));
|
List<ImportacionFiscalReducaoZVO> list = null;
|
||||||
|
if (isPendencias) {
|
||||||
|
list = fiscalDAO.buscaDatosFiscaisReducaoZ(inicio, fim, empresa.getEmpresaId(), isPendencias, connection);
|
||||||
|
} else {
|
||||||
|
list = agruparReducaoZ(fiscalDAO.buscaDatosFiscaisReducaoZ(inicio, fim, empresa.getEmpresaId(), isPendencias, connection));
|
||||||
|
}
|
||||||
|
|
||||||
for (ImportacionFiscalReducaoZVO ifrZ : list) {
|
for (ImportacionFiscalReducaoZVO ifrZ : list) {
|
||||||
|
|
||||||
|
@ -409,7 +427,13 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
String horaReducaoZ = ifrZ.getHorareducao();
|
String horaReducaoZ = ifrZ.getHorareducao();
|
||||||
|
|
||||||
String valorDocFiscal = StringHelper.preencherZeroEsquerda(ifrZ.getImposto().toString(), 13);
|
String valorDocFiscal = StringHelper.preencherZeroEsquerda(ifrZ.getImposto().toString(), 13);
|
||||||
String brancos82 = StringHelper.preencherStringEspacoEsquerda(null, 82);
|
|
||||||
|
String brancos = StringHelper.preencherStringEspacoEsquerda(null, 82);
|
||||||
|
String status = StringHelper.preencherStringEspacoEsquerda(null, 1);
|
||||||
|
if (isPendencias) {
|
||||||
|
brancos = StringHelper.preencherStringEspacoEsquerda(null, 82);
|
||||||
|
status = StringHelper.preencherStringEspacoEsquerda(ifrZ.getStatus(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
seq++;
|
seq++;
|
||||||
sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6);
|
sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6);
|
||||||
|
@ -417,7 +441,7 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
String redZ = reducaoZ("1", dataMovimento, cnpj, numRelatorio, numPDV, numSeriePDV, numReducaoZ,
|
String redZ = reducaoZ("1", dataMovimento, cnpj, numRelatorio, numPDV, numSeriePDV, numReducaoZ,
|
||||||
gtInicial, gtFinal, docFiscalInic, docFiscalFinal, valorCancel, valorContabil, subtributaria,
|
gtInicial, gtFinal, docFiscalInic, docFiscalFinal, valorCancel, valorContabil, subtributaria,
|
||||||
descontos, isento, naoTributado, aliquota, aliquota2, aliquota3, aliquota4, coo, outrosRecebimentos,
|
descontos, isento, naoTributado, aliquota, aliquota2, aliquota3, aliquota4, coo, outrosRecebimentos,
|
||||||
impostoDebitado, dataReducaoZ, horaReducaoZ, valorDocFiscal, brancos82, sequencial);
|
impostoDebitado, dataReducaoZ, horaReducaoZ, valorDocFiscal, status, brancos, sequencial);
|
||||||
gravarArq.print(redZ + QUEBRA_LINHA);
|
gravarArq.print(redZ + QUEBRA_LINHA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -972,7 +996,7 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
String docFiscalFinal, String valorCancel, String valorContabil, String subtributaria, String descontos,
|
String docFiscalFinal, String valorCancel, String valorContabil, String subtributaria, String descontos,
|
||||||
String isento, String naoTributado, String aliquota, String aliquota2, String aliquota3, String aliquota4,
|
String isento, String naoTributado, String aliquota, String aliquota2, String aliquota3, String aliquota4,
|
||||||
String coo, String outrosRecebimentos, String impostoDebitado, String dataReducaoZ, String horaReducaoZ,
|
String coo, String outrosRecebimentos, String impostoDebitado, String dataReducaoZ, String horaReducaoZ,
|
||||||
String valorDocFiscal, String brancos, String sequencial) {
|
String valorDocFiscal, String status, String brancos, String sequencial) {
|
||||||
|
|
||||||
StringBuilder reducaoZ = new StringBuilder();
|
StringBuilder reducaoZ = new StringBuilder();
|
||||||
reducaoZ.append(identificador);
|
reducaoZ.append(identificador);
|
||||||
|
@ -1002,6 +1026,7 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
reducaoZ.append(dataReducaoZ);
|
reducaoZ.append(dataReducaoZ);
|
||||||
reducaoZ.append(horaReducaoZ);
|
reducaoZ.append(horaReducaoZ);
|
||||||
reducaoZ.append(valorDocFiscal);
|
reducaoZ.append(valorDocFiscal);
|
||||||
|
reducaoZ.append(status);
|
||||||
reducaoZ.append(brancos);
|
reducaoZ.append(brancos);
|
||||||
reducaoZ.append(sequencial);
|
reducaoZ.append(sequencial);
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ public class ImportacionFiscalReducaoZVO {
|
||||||
private BigDecimal gtFinal;
|
private BigDecimal gtFinal;
|
||||||
private BigDecimal gtInicial;
|
private BigDecimal gtInicial;
|
||||||
private BigDecimal valorNaoIncluido;
|
private BigDecimal valorNaoIncluido;
|
||||||
|
private String status;
|
||||||
|
|
||||||
public String getDatamov() {
|
public String getDatamov() {
|
||||||
return datamov;
|
return datamov;
|
||||||
|
@ -216,4 +217,12 @@ public class ImportacionFiscalReducaoZVO {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue