fixes bug #7288
fixes bug #7287 git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/Integracion/IntegracaoReceitaDespesa/trunk/IntegracaoReceitaDespesa@54283 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
106596f4bf
commit
370b1e3f10
|
@ -306,11 +306,6 @@ public class Totalbus {
|
|||
|
||||
public List<DespesaReceita> getDepositos(Integer puntoventaId, Integer empresaId, Date fechaParam){
|
||||
List<DespesaReceita> depositos = new ArrayList<DespesaReceita>();
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// sb.append("select fdep.fechamentodeposito_id, fdep.valor, fdep.numdeposito, fdep.FECCREACION, fdep.fecha_deposito ");
|
||||
// sb.append("from fechamento_deposito fdep ");
|
||||
// sb.append("where trunc(FECCREACION) = :fecha and fdep.activo = 1 ");
|
||||
|
||||
|
||||
StringBuilder strFechamentos = new StringBuilder();
|
||||
strFechamentos.append("Select sum(fdep.valor), fdep.numdeposito, fdep.fecha_deposito, fc.empresa_id, pv.numpuntoventa, ec.numagencia, ec.numconta, if.CODIGO, ec.numintegracion, fdep.feccreacion ");
|
||||
|
@ -337,60 +332,45 @@ public class Totalbus {
|
|||
if(fechaParam == null){
|
||||
fecha = getData();
|
||||
}
|
||||
|
||||
//PreparedStatement pstmt = null;
|
||||
//ResultSet rs = null;
|
||||
|
||||
|
||||
// pstmt = getConnection().prepareStatement(sb.toString());
|
||||
// pstmt.setDate(1, new java.sql.Date(fecha.getTime()));
|
||||
//
|
||||
// rs = pstmt.executeQuery();
|
||||
Integer codigoReceitaDespesaGlobus = getCodigoReceitaDespesaGlobus();
|
||||
PreparedStatement pstmtFechamentos = null;
|
||||
ResultSet rsFechamentos = null;
|
||||
BigDecimal soma = BigDecimal.ZERO;
|
||||
try{
|
||||
pstmtFechamentos = getConnection().prepareStatement(strFechamentos.toString());
|
||||
pstmtFechamentos.setDate(1, new java.sql.Date(fecha.getTime()));
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("MM/yy");
|
||||
rsFechamentos = pstmtFechamentos.executeQuery();
|
||||
|
||||
PreparedStatement pstmtFechamentos = null;
|
||||
ResultSet rsFechamentos = null;
|
||||
BigDecimal soma = BigDecimal.ZERO;
|
||||
try{
|
||||
// while (rs.next()){
|
||||
pstmtFechamentos = getConnection().prepareStatement(strFechamentos.toString());
|
||||
pstmtFechamentos.setDate(1, new java.sql.Date(fecha.getTime()));
|
||||
|
||||
rsFechamentos = pstmtFechamentos.executeQuery();
|
||||
|
||||
while (rsFechamentos.next()){
|
||||
Integer empId = null;
|
||||
Integer pvId = null;
|
||||
String banco = "" ;
|
||||
String agencia = "";
|
||||
String contaCorrente = "";
|
||||
String numDep = " Dep: " + rsFechamentos.getString(2);
|
||||
String valor = " R$ " + df.format(rsFechamentos.getBigDecimal(1));
|
||||
String ref = " Ref: ";
|
||||
Integer codRecDesp = null;
|
||||
while (rsFechamentos.next()){
|
||||
Integer empId = null;
|
||||
Integer pvId = null;
|
||||
String banco = "" ;
|
||||
String agencia = "";
|
||||
String contaCorrente = "";
|
||||
String numDep = " Dep: " + rsFechamentos.getString(2);
|
||||
Integer codRecDesp = null;
|
||||
|
||||
if (empId == null ){ empId = rsFechamentos.getInt(4); }
|
||||
if (banco.isEmpty()){banco = "Bco: " + DespesaReceita.lpad(rsFechamentos.getString(8), "0", 3);}
|
||||
if (pvId == null){ pvId = rsFechamentos.getInt(5); }
|
||||
if (agencia.isEmpty()){ agencia = " Ag: " + rsFechamentos.getString(6); }
|
||||
if (contaCorrente.isEmpty()){ contaCorrente = " C/C: " + rsFechamentos.getString(7); }
|
||||
//ref += ref.length() <= 6 ? sdf.format(rsFechamentos.getDate(3)) : ", " + sdf.format(rsFechamentos.getDate(3));
|
||||
if (codRecDesp == null){ codRecDesp = rsFechamentos.getInt(9); }
|
||||
|
||||
DespesaReceita deposito = new DespesaReceita();
|
||||
deposito.setCodigoEmpresa(empId);
|
||||
deposito.setDataLancamento(rsFechamentos.getDate(10));
|
||||
deposito.setDataMovimento(rsFechamentos.getDate(3));
|
||||
deposito.setLocalArrecadação(pvId);
|
||||
deposito.setValorLancamento(df.format(rsFechamentos.getBigDecimal(1)));
|
||||
deposito.setIdentificadorReceitaDespesa("D");
|
||||
deposito.setCodigoReceitaDespesa(codRecDesp);
|
||||
deposito.setDescricaoDetalhada(banco + agencia + contaCorrente + numDep);
|
||||
depositos.add(deposito);
|
||||
soma = soma.add(rsFechamentos.getBigDecimal(1));
|
||||
}
|
||||
if (empId == null ){ empId = rsFechamentos.getInt(4); }
|
||||
if (banco.isEmpty()){banco = "Bco: " + DespesaReceita.lpad(rsFechamentos.getString(8), "0", 3);}
|
||||
if (pvId == null){ pvId = rsFechamentos.getInt(5); }
|
||||
if (agencia.isEmpty()){ agencia = " Ag: " + rsFechamentos.getString(6); }
|
||||
if (contaCorrente.isEmpty()){ contaCorrente = " C/C: " + rsFechamentos.getString(7); }
|
||||
//ref += ref.length() <= 6 ? sdf.format(rsFechamentos.getDate(3)) : ", " + sdf.format(rsFechamentos.getDate(3));
|
||||
if (codRecDesp == null){ codRecDesp = rsFechamentos.getInt(9); }
|
||||
|
||||
DespesaReceita deposito = new DespesaReceita();
|
||||
deposito.setCodigoEmpresa(empId);
|
||||
deposito.setDataLancamento(rsFechamentos.getDate(10));
|
||||
deposito.setDataMovimento(rsFechamentos.getDate(3));
|
||||
deposito.setLocalArrecadação(pvId);
|
||||
deposito.setValorLancamento(df.format(rsFechamentos.getBigDecimal(1)));
|
||||
deposito.setIdentificadorReceitaDespesa("D");
|
||||
deposito.setCodigoReceitaDespesa(codRecDesp);
|
||||
deposito.setDescricaoDetalhada(banco + agencia + contaCorrente + numDep);
|
||||
depositos.add(deposito);
|
||||
soma = soma.add(rsFechamentos.getBigDecimal(1));
|
||||
}
|
||||
log.debug("Total depósitos: " + soma);
|
||||
} catch (Exception e){
|
||||
log.error(e.getMessage(), e);
|
||||
|
|
Loading…
Reference in New Issue