fixes bug#13571
dev:Valdir qua:Junia git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/Integracion/IntegracaoReceitaDespesa/trunk/IntegracaoReceitaDespesa@89817 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
2898b19aca
commit
8508f782ef
|
@ -18,7 +18,6 @@ import com.rjconsultores.integracaoreceitadespesa.entidades.DespesaReceita;
|
||||||
import com.rjconsultores.integracaoreceitadespesa.entidades.Empresa;
|
import com.rjconsultores.integracaoreceitadespesa.entidades.Empresa;
|
||||||
import com.rjconsultores.integracaoreceitadespesa.entidades.PuntoVenta;
|
import com.rjconsultores.integracaoreceitadespesa.entidades.PuntoVenta;
|
||||||
|
|
||||||
|
|
||||||
public class Totalbus {
|
public class Totalbus {
|
||||||
|
|
||||||
private static final Logger log = Logger.getLogger(Totalbus.class);
|
private static final Logger log = Logger.getLogger(Totalbus.class);
|
||||||
|
@ -71,8 +70,16 @@ public class Totalbus {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
} finally {
|
} finally {
|
||||||
try { rs.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
try {
|
||||||
try { pstmt.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
rs.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
log.error(ignore.getMessage(), ignore);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
pstmt.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
log.error(ignore.getMessage(), ignore);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,8 +99,16 @@ public class Totalbus {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
} finally {
|
} finally {
|
||||||
try { rs.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
try {
|
||||||
try { pstmt.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
rs.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
log.error(ignore.getMessage(), ignore);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
pstmt.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
log.error(ignore.getMessage(), ignore);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +125,9 @@ public class Totalbus {
|
||||||
sb.append(" pv.puntoventa_id AS puntoventaId, ");
|
sb.append(" pv.puntoventa_id AS puntoventaId, ");
|
||||||
sb.append(" sum(cdp.importe) AS valor, ");
|
sb.append(" sum(cdp.importe) AS valor, ");
|
||||||
sb.append(" case when cdp.formapago_id = 2 then 802 else 803 end as contacontabil, ");
|
sb.append(" case when cdp.formapago_id = 2 then 802 else 803 end as contacontabil, ");
|
||||||
sb.append(" pv.numpuntoventa AS numpuntoventa, ev.tipoeventoextra_id ");
|
sb.append(" pv.numpuntoventa AS numpuntoventa, ");
|
||||||
|
sb.append(" ev.tipoeventoextra_id, ");
|
||||||
|
sb.append(" cdp.formapago_id as formapagoId ");
|
||||||
sb.append(" from ");
|
sb.append(" from ");
|
||||||
sb.append(" caja_diversos cd ");
|
sb.append(" caja_diversos cd ");
|
||||||
sb.append(" left join evento_extra ev on ev.eventoextra_id = cd.eventoextra_id ");
|
sb.append(" left join evento_extra ev on ev.eventoextra_id = cd.eventoextra_id ");
|
||||||
|
@ -130,8 +147,8 @@ public class Totalbus {
|
||||||
sb.append(" e.empresa_id, ");
|
sb.append(" e.empresa_id, ");
|
||||||
sb.append(" pv.puntoventa_id, ");
|
sb.append(" pv.puntoventa_id, ");
|
||||||
sb.append(" case when cdp.formapago_id = 2 then 802 else 803 end, ");
|
sb.append(" case when cdp.formapago_id = 2 then 802 else 803 end, ");
|
||||||
sb.append(" pv.numpuntoventa, ev.tipoeventoextra_id ");
|
sb.append(" pv.numpuntoventa, ev.tipoeventoextra_id, ");
|
||||||
|
sb.append(" cdp.formapago_id ");
|
||||||
|
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
|
@ -163,13 +180,22 @@ public class Totalbus {
|
||||||
if (incluiTipoPagamentoTurismoBGM) {
|
if (incluiTipoPagamentoTurismoBGM) {
|
||||||
despesa.setTipoPagamentoTurismo(rs.getString("tipoeventoextra_id"));
|
despesa.setTipoPagamentoTurismo(rs.getString("tipoeventoextra_id"));
|
||||||
}
|
}
|
||||||
|
despesa.setFormaPagamentoId(rs.getString("formapagoId"));
|
||||||
despesas.add(despesa);
|
despesas.add(despesa);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.toString(), e);
|
log.error(e.toString(), e);
|
||||||
} finally {
|
} finally {
|
||||||
try { rs.close(); } catch (Exception ignore) { log.error("", ignore); }
|
try {
|
||||||
try { stmt.close(); } catch (Exception ignore) { log.error("", ignore); }
|
rs.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
log.error("", ignore);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
stmt.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
log.error("", ignore);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return despesas;
|
return despesas;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +216,9 @@ public class Totalbus {
|
||||||
sb.append(" sum(cdp.importe) AS valor, ");
|
sb.append(" sum(cdp.importe) AS valor, ");
|
||||||
sb.append(" tee.contacontabil AS contacontabil, ");
|
sb.append(" tee.contacontabil AS contacontabil, ");
|
||||||
sb.append(" pv.numpuntoventa AS numpuntoventa, ");
|
sb.append(" pv.numpuntoventa AS numpuntoventa, ");
|
||||||
sb.append(" ev.descinfo as descinfo, ev.tipoeventoextra_id ");
|
sb.append(" ev.descinfo as descinfo, ");
|
||||||
|
sb.append(" ev.tipoeventoextra_id, ");
|
||||||
|
sb.append(" cdp.formapago_id as formapagoId ");
|
||||||
sb.append(" from ");
|
sb.append(" from ");
|
||||||
sb.append(" caja_diversos cd ");
|
sb.append(" caja_diversos cd ");
|
||||||
sb.append(" left join evento_extra ev on ev.eventoextra_id = cd.eventoextra_id ");
|
sb.append(" left join evento_extra ev on ev.eventoextra_id = cd.eventoextra_id ");
|
||||||
|
@ -208,7 +236,8 @@ public class Totalbus {
|
||||||
sb.append(" group by cd.feccorte, ");
|
sb.append(" group by cd.feccorte, ");
|
||||||
sb.append(" e.empresa_id, pv.puntoventa_id, ");
|
sb.append(" e.empresa_id, pv.puntoventa_id, ");
|
||||||
sb.append(" tee.contacontabil, pv.numpuntoventa, ");
|
sb.append(" tee.contacontabil, pv.numpuntoventa, ");
|
||||||
sb.append(" ev.descinfo, ev.tipoeventoextra_id ");
|
sb.append(" ev.descinfo, ev.tipoeventoextra_id, ");
|
||||||
|
sb.append(" cdp.formapago_id ");
|
||||||
|
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
|
@ -241,13 +270,22 @@ public class Totalbus {
|
||||||
if (incluiTipoPagamentoTurismoBGM) {
|
if (incluiTipoPagamentoTurismoBGM) {
|
||||||
receita.setTipoPagamentoTurismo(rs.getString("tipoeventoextra_id"));
|
receita.setTipoPagamentoTurismo(rs.getString("tipoeventoextra_id"));
|
||||||
}
|
}
|
||||||
|
receita.setFormaPagamentoId(rs.getString("formapagoId"));
|
||||||
despesas.add(receita);
|
despesas.add(receita);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
} finally {
|
} finally {
|
||||||
try { rs.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
try {
|
||||||
try { stmt.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
rs.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
log.error(ignore.getMessage(), ignore);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
stmt.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
log.error(ignore.getMessage(), ignore);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return despesas;
|
return despesas;
|
||||||
}
|
}
|
||||||
|
@ -261,7 +299,9 @@ public class Totalbus {
|
||||||
sb.append(" pv.numpuntoventa as numpuntoventa, ");
|
sb.append(" pv.numpuntoventa as numpuntoventa, ");
|
||||||
sb.append(" cdp.importe as valor, ");
|
sb.append(" cdp.importe as valor, ");
|
||||||
sb.append(" tee.contacontabil as contacontabil, ");
|
sb.append(" tee.contacontabil as contacontabil, ");
|
||||||
sb.append(" ev.descinfo as descinfo, ev.tipoeventoextra_id ");
|
sb.append(" ev.descinfo as descinfo, ");
|
||||||
|
sb.append(" ev.tipoeventoextra_id, ");
|
||||||
|
sb.append(" cdp.formapago_id as formapagoId ");
|
||||||
sb.append(" from ");
|
sb.append(" from ");
|
||||||
sb.append(" caja_diversos cd ");
|
sb.append(" caja_diversos cd ");
|
||||||
sb.append(" left join evento_extra ev on ev.eventoextra_id = cd.eventoextra_id ");
|
sb.append(" left join evento_extra ev on ev.eventoextra_id = cd.eventoextra_id ");
|
||||||
|
@ -305,13 +345,22 @@ public class Totalbus {
|
||||||
if (incluiTipoPagamentoTurismoBGM) {
|
if (incluiTipoPagamentoTurismoBGM) {
|
||||||
despesa.setTipoPagamentoTurismo(rs.getString("tipoeventoextra_id"));
|
despesa.setTipoPagamentoTurismo(rs.getString("tipoeventoextra_id"));
|
||||||
}
|
}
|
||||||
|
despesa.setFormaPagamentoId(rs.getString("formapagoId"));
|
||||||
despesas.add(despesa);
|
despesas.add(despesa);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
} finally {
|
} finally {
|
||||||
try { rs.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
try {
|
||||||
try { pstmt.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
rs.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
log.error(ignore.getMessage(), ignore);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
pstmt.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
log.error(ignore.getMessage(), ignore);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return despesas;
|
return despesas;
|
||||||
}
|
}
|
||||||
|
@ -357,12 +406,22 @@ public class Totalbus {
|
||||||
String codRecDesp = null;
|
String codRecDesp = null;
|
||||||
String numpuntoventa = rsFechamentos.getString(5);
|
String numpuntoventa = rsFechamentos.getString(5);
|
||||||
|
|
||||||
if (empId == null ){ empId = rsFechamentos.getInt(4); }
|
if (empId == null) {
|
||||||
if (banco.isEmpty()){banco = "Bco: " + StringUtils.leftPad(rsFechamentos.getString(8), 3, "0");}
|
empId = rsFechamentos.getInt(4);
|
||||||
|
}
|
||||||
|
if (banco.isEmpty()) {
|
||||||
|
banco = "Bco: " + StringUtils.leftPad(rsFechamentos.getString(8), 3, "0");
|
||||||
|
}
|
||||||
|
|
||||||
if (agencia.isEmpty()){ agencia = " Ag: " + rsFechamentos.getString(6); }
|
if (agencia.isEmpty()) {
|
||||||
if (contaCorrente.isEmpty()){ contaCorrente = " C/C: " + rsFechamentos.getString(7); }
|
agencia = " Ag: " + rsFechamentos.getString(6);
|
||||||
if (codRecDesp == null){ codRecDesp = rsFechamentos.getString(9); }
|
}
|
||||||
|
if (contaCorrente.isEmpty()) {
|
||||||
|
contaCorrente = " C/C: " + rsFechamentos.getString(7);
|
||||||
|
}
|
||||||
|
if (codRecDesp == null) {
|
||||||
|
codRecDesp = rsFechamentos.getString(9);
|
||||||
|
}
|
||||||
|
|
||||||
DespesaReceita deposito = new DespesaReceita();
|
DespesaReceita deposito = new DespesaReceita();
|
||||||
deposito.setCodigoEmpresa(empId);
|
deposito.setCodigoEmpresa(empId);
|
||||||
|
@ -381,8 +440,16 @@ public class Totalbus {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
} finally {
|
} finally {
|
||||||
try { pstmtFechamentos.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
try {
|
||||||
try { rsFechamentos.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
pstmtFechamentos.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
log.error(ignore.getMessage(), ignore);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
rsFechamentos.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
log.error(ignore.getMessage(), ignore);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return depositos;
|
return depositos;
|
||||||
}
|
}
|
||||||
|
@ -402,8 +469,16 @@ public class Totalbus {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
} finally {
|
} finally {
|
||||||
try { rs.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
try {
|
||||||
try { pstmt.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
rs.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
log.error(ignore.getMessage(), ignore);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
pstmt.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
log.error(ignore.getMessage(), ignore);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
@ -427,8 +502,16 @@ public class Totalbus {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
} finally {
|
} finally {
|
||||||
try { rs.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
try {
|
||||||
try { pstmt.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
rs.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
log.error(ignore.getMessage(), ignore);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
pstmt.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
log.error(ignore.getMessage(), ignore);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
@ -439,9 +522,7 @@ public class Totalbus {
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
||||||
try {
|
try {
|
||||||
if (!getConnection().
|
if (!getConnection().prepareStatement("Select valorconstante from constante where nombconstante = 'DATA_LIMITE_EDICAO_DEPOSITO_" + empresaId + "'").executeQuery().next()) {
|
||||||
prepareStatement("Select valorconstante from constante where nombconstante = 'DATA_LIMITE_EDICAO_DEPOSITO_" + empresaId + "'").
|
|
||||||
executeQuery().next()){
|
|
||||||
sb.append("insert into constante values (constante_seq.nextval, 'DATA_LIMITE_EDICAO_DEPOSITO_" + empresaId + "', 'DATA_LIMITE_EDICAO_DEPOSITO_" + empresaId + "',1," +
|
sb.append("insert into constante values (constante_seq.nextval, 'DATA_LIMITE_EDICAO_DEPOSITO_" + empresaId + "', 'DATA_LIMITE_EDICAO_DEPOSITO_" + empresaId + "',1," +
|
||||||
"'" + sdf.format(data) + "', 1, 1, :datamodif, 1)");
|
"'" + sdf.format(data) + "', 1, 1, :datamodif, 1)");
|
||||||
pstmt = getConnection().prepareStatement(sb.toString());
|
pstmt = getConnection().prepareStatement(sb.toString());
|
||||||
|
@ -456,7 +537,11 @@ public class Totalbus {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
} finally {
|
} finally {
|
||||||
try { pstmt.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
try {
|
||||||
|
pstmt.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
log.error(ignore.getMessage(), ignore);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ public class DespesaReceita {
|
||||||
private final String tipoDocumentoVenda = " ";// 228 1 Alfanumérico
|
private final String tipoDocumentoVenda = " ";// 228 1 Alfanumérico
|
||||||
private final String numerodocumentoCPG = "0000000000";// 229 10 Numérico
|
private final String numerodocumentoCPG = "0000000000";// 229 10 Numérico
|
||||||
private final String finalLinha = "*";// 239 1 Alfanumérico
|
private final String finalLinha = "*";// 239 1 Alfanumérico
|
||||||
|
private String formaPagamentoId = "";// 240 Numérico
|
||||||
|
|
||||||
private SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
private SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
||||||
|
|
||||||
|
@ -35,15 +36,30 @@ public class DespesaReceita {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void preencheLinha(List<String> rows) {
|
public void preencheLinha(List<String> rows) {
|
||||||
rows.add(dataLancamento + codigoEmpresa + codigoFilial +
|
StringBuilder sb = new StringBuilder();
|
||||||
localArrecadação.toUpperCase() +
|
sb.append(dataLancamento);
|
||||||
numeroDaGuia + dataMovimento + usuarioGlobus +
|
sb.append(codigoEmpresa);
|
||||||
turno + codigoReceitaDespesa +
|
sb.append(codigoFilial);
|
||||||
identificadorReceitaDespesa.toUpperCase() + valorLancamento +
|
sb.append(localArrecadação.toUpperCase());
|
||||||
numeroContratoTurismo + numeroReciboTurismo +
|
sb.append(numeroDaGuia);
|
||||||
getFormaPagamentoTurismo() + getTipoPagamentoTurismo() +
|
sb.append(dataMovimento);
|
||||||
descricaoDetalhada + documentoVenda + tipoDocumentoVenda +
|
sb.append(usuarioGlobus);
|
||||||
numerodocumentoCPG + finalLinha + System.getProperty("line.separator"));
|
sb.append(turno);
|
||||||
|
sb.append(codigoReceitaDespesa);
|
||||||
|
sb.append(identificadorReceitaDespesa.toUpperCase());
|
||||||
|
sb.append(valorLancamento);
|
||||||
|
sb.append(numeroContratoTurismo);
|
||||||
|
sb.append(numeroReciboTurismo);
|
||||||
|
sb.append(getFormaPagamentoTurismo());
|
||||||
|
sb.append(getTipoPagamentoTurismo());
|
||||||
|
sb.append(descricaoDetalhada);
|
||||||
|
sb.append(documentoVenda);
|
||||||
|
sb.append(tipoDocumentoVenda);
|
||||||
|
sb.append(numerodocumentoCPG);
|
||||||
|
sb.append(formaPagamentoId);
|
||||||
|
sb.append(finalLinha);
|
||||||
|
sb.append(System.getProperty("line.separator"));
|
||||||
|
rows.add(sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataLancamento(Date dataLancamento) {
|
public void setDataLancamento(Date dataLancamento) {
|
||||||
|
@ -94,6 +110,14 @@ public class DespesaReceita {
|
||||||
this.tipoPagamentoTurismo = StringUtils.leftPad(tipoPagamentoTurismo, 2, "0");
|
this.tipoPagamentoTurismo = StringUtils.leftPad(tipoPagamentoTurismo, 2, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFormaPagamentoId() {
|
||||||
|
return formaPagamentoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFormaPagamentoId(String formaPagamentoId) {
|
||||||
|
this.formaPagamentoId = formaPagamentoId;
|
||||||
|
}
|
||||||
|
|
||||||
private String truncStr(String str, int size) {
|
private String truncStr(String str, int size) {
|
||||||
if (str.length() > size) {
|
if (str.length() > size) {
|
||||||
return str.substring(0, size - 1);
|
return str.substring(0, size - 1);
|
||||||
|
|
Loading…
Reference in New Issue