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.PuntoVenta;
|
||||
|
||||
|
||||
public class Totalbus {
|
||||
|
||||
private static final Logger log = Logger.getLogger(Totalbus.class);
|
||||
|
@ -71,8 +70,16 @@ public class Totalbus {
|
|||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
} finally {
|
||||
try { rs.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
||||
try { pstmt.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
||||
try {
|
||||
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) {
|
||||
log.error(e.getMessage(), e);
|
||||
} finally {
|
||||
try { rs.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
||||
try { pstmt.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
||||
try {
|
||||
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(" sum(cdp.importe) AS valor, ");
|
||||
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(" caja_diversos cd ");
|
||||
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(" pv.puntoventa_id, ");
|
||||
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;
|
||||
ResultSet rs = null;
|
||||
|
@ -163,13 +180,22 @@ public class Totalbus {
|
|||
if (incluiTipoPagamentoTurismoBGM) {
|
||||
despesa.setTipoPagamentoTurismo(rs.getString("tipoeventoextra_id"));
|
||||
}
|
||||
despesa.setFormaPagamentoId(rs.getString("formapagoId"));
|
||||
despesas.add(despesa);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
} finally {
|
||||
try { rs.close(); } catch (Exception ignore) { log.error("", ignore); }
|
||||
try { stmt.close(); } catch (Exception ignore) { log.error("", ignore); }
|
||||
try {
|
||||
rs.close();
|
||||
} catch (Exception ignore) {
|
||||
log.error("", ignore);
|
||||
}
|
||||
try {
|
||||
stmt.close();
|
||||
} catch (Exception ignore) {
|
||||
log.error("", ignore);
|
||||
}
|
||||
}
|
||||
return despesas;
|
||||
}
|
||||
|
@ -190,7 +216,9 @@ public class Totalbus {
|
|||
sb.append(" sum(cdp.importe) AS valor, ");
|
||||
sb.append(" tee.contacontabil AS contacontabil, ");
|
||||
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(" caja_diversos cd ");
|
||||
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(" e.empresa_id, pv.puntoventa_id, ");
|
||||
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;
|
||||
ResultSet rs = null;
|
||||
|
@ -241,13 +270,22 @@ public class Totalbus {
|
|||
if (incluiTipoPagamentoTurismoBGM) {
|
||||
receita.setTipoPagamentoTurismo(rs.getString("tipoeventoextra_id"));
|
||||
}
|
||||
receita.setFormaPagamentoId(rs.getString("formapagoId"));
|
||||
despesas.add(receita);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
} finally {
|
||||
try { rs.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
||||
try { stmt.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
||||
try {
|
||||
rs.close();
|
||||
} catch (Exception ignore) {
|
||||
log.error(ignore.getMessage(), ignore);
|
||||
}
|
||||
try {
|
||||
stmt.close();
|
||||
} catch (Exception ignore) {
|
||||
log.error(ignore.getMessage(), ignore);
|
||||
}
|
||||
}
|
||||
return despesas;
|
||||
}
|
||||
|
@ -261,7 +299,9 @@ public class Totalbus {
|
|||
sb.append(" pv.numpuntoventa as numpuntoventa, ");
|
||||
sb.append(" cdp.importe as valor, ");
|
||||
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(" caja_diversos cd ");
|
||||
sb.append(" left join evento_extra ev on ev.eventoextra_id = cd.eventoextra_id ");
|
||||
|
@ -305,13 +345,22 @@ public class Totalbus {
|
|||
if (incluiTipoPagamentoTurismoBGM) {
|
||||
despesa.setTipoPagamentoTurismo(rs.getString("tipoeventoextra_id"));
|
||||
}
|
||||
despesa.setFormaPagamentoId(rs.getString("formapagoId"));
|
||||
despesas.add(despesa);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
} finally {
|
||||
try { rs.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
||||
try { pstmt.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
||||
try {
|
||||
rs.close();
|
||||
} catch (Exception ignore) {
|
||||
log.error(ignore.getMessage(), ignore);
|
||||
}
|
||||
try {
|
||||
pstmt.close();
|
||||
} catch (Exception ignore) {
|
||||
log.error(ignore.getMessage(), ignore);
|
||||
}
|
||||
}
|
||||
return despesas;
|
||||
}
|
||||
|
@ -357,12 +406,22 @@ public class Totalbus {
|
|||
String codRecDesp = null;
|
||||
String numpuntoventa = rsFechamentos.getString(5);
|
||||
|
||||
if (empId == null ){ empId = rsFechamentos.getInt(4); }
|
||||
if (banco.isEmpty()){banco = "Bco: " + StringUtils.leftPad(rsFechamentos.getString(8), 3, "0");}
|
||||
if (empId == null) {
|
||||
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 (contaCorrente.isEmpty()){ contaCorrente = " C/C: " + rsFechamentos.getString(7); }
|
||||
if (codRecDesp == null){ codRecDesp = rsFechamentos.getString(9); }
|
||||
if (agencia.isEmpty()) {
|
||||
agencia = " Ag: " + rsFechamentos.getString(6);
|
||||
}
|
||||
if (contaCorrente.isEmpty()) {
|
||||
contaCorrente = " C/C: " + rsFechamentos.getString(7);
|
||||
}
|
||||
if (codRecDesp == null) {
|
||||
codRecDesp = rsFechamentos.getString(9);
|
||||
}
|
||||
|
||||
DespesaReceita deposito = new DespesaReceita();
|
||||
deposito.setCodigoEmpresa(empId);
|
||||
|
@ -381,8 +440,16 @@ public class Totalbus {
|
|||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
} finally {
|
||||
try { pstmtFechamentos.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
||||
try { rsFechamentos.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
||||
try {
|
||||
pstmtFechamentos.close();
|
||||
} catch (Exception ignore) {
|
||||
log.error(ignore.getMessage(), ignore);
|
||||
}
|
||||
try {
|
||||
rsFechamentos.close();
|
||||
} catch (Exception ignore) {
|
||||
log.error(ignore.getMessage(), ignore);
|
||||
}
|
||||
}
|
||||
return depositos;
|
||||
}
|
||||
|
@ -402,8 +469,16 @@ public class Totalbus {
|
|||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
} finally {
|
||||
try { rs.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
||||
try { pstmt.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
||||
try {
|
||||
rs.close();
|
||||
} catch (Exception ignore) {
|
||||
log.error(ignore.getMessage(), ignore);
|
||||
}
|
||||
try {
|
||||
pstmt.close();
|
||||
} catch (Exception ignore) {
|
||||
log.error(ignore.getMessage(), ignore);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
|
@ -427,8 +502,16 @@ public class Totalbus {
|
|||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
} finally {
|
||||
try { rs.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
||||
try { pstmt.close(); } catch (Exception ignore) { log.error(ignore.getMessage(), ignore); }
|
||||
try {
|
||||
rs.close();
|
||||
} catch (Exception ignore) {
|
||||
log.error(ignore.getMessage(), ignore);
|
||||
}
|
||||
try {
|
||||
pstmt.close();
|
||||
} catch (Exception ignore) {
|
||||
log.error(ignore.getMessage(), ignore);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
|
@ -439,9 +522,7 @@ public class Totalbus {
|
|||
PreparedStatement pstmt = null;
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
||||
try {
|
||||
if (!getConnection().
|
||||
prepareStatement("Select valorconstante from constante where nombconstante = 'DATA_LIMITE_EDICAO_DEPOSITO_" + empresaId + "'").
|
||||
executeQuery().next()){
|
||||
if (!getConnection().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," +
|
||||
"'" + sdf.format(data) + "', 1, 1, :datamodif, 1)");
|
||||
pstmt = getConnection().prepareStatement(sb.toString());
|
||||
|
@ -456,7 +537,11 @@ public class Totalbus {
|
|||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
} 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 numerodocumentoCPG = "0000000000";// 229 10 Numérico
|
||||
private final String finalLinha = "*";// 239 1 Alfanumérico
|
||||
private String formaPagamentoId = "";// 240 Numérico
|
||||
|
||||
private SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
||||
|
||||
|
@ -35,15 +36,30 @@ public class DespesaReceita {
|
|||
}
|
||||
|
||||
public void preencheLinha(List<String> rows) {
|
||||
rows.add(dataLancamento + codigoEmpresa + codigoFilial +
|
||||
localArrecadação.toUpperCase() +
|
||||
numeroDaGuia + dataMovimento + usuarioGlobus +
|
||||
turno + codigoReceitaDespesa +
|
||||
identificadorReceitaDespesa.toUpperCase() + valorLancamento +
|
||||
numeroContratoTurismo + numeroReciboTurismo +
|
||||
getFormaPagamentoTurismo() + getTipoPagamentoTurismo() +
|
||||
descricaoDetalhada + documentoVenda + tipoDocumentoVenda +
|
||||
numerodocumentoCPG + finalLinha + System.getProperty("line.separator"));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(dataLancamento);
|
||||
sb.append(codigoEmpresa);
|
||||
sb.append(codigoFilial);
|
||||
sb.append(localArrecadação.toUpperCase());
|
||||
sb.append(numeroDaGuia);
|
||||
sb.append(dataMovimento);
|
||||
sb.append(usuarioGlobus);
|
||||
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) {
|
||||
|
@ -94,6 +110,14 @@ public class DespesaReceita {
|
|||
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) {
|
||||
if (str.length() > size) {
|
||||
return str.substring(0, size - 1);
|
||||
|
|
Loading…
Reference in New Issue