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);
|
||||
|
@ -31,13 +30,13 @@ public class Totalbus {
|
|||
|
||||
private DecimalFormat df = new DecimalFormat("#0.00");
|
||||
|
||||
public Totalbus(Connection con){
|
||||
public Totalbus(Connection con) {
|
||||
this.conn = con;
|
||||
loadEmpresas();
|
||||
loadPuntosVenta();
|
||||
}
|
||||
|
||||
public List<String> getDespesasReceitas(Integer puntoventaId, Integer empresaId,Date fechaParam, boolean incluiTipoPagamentoTurismoBGM){
|
||||
public List<String> getDespesasReceitas(Integer puntoventaId, Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM) {
|
||||
log.debug("gerando depósitos...");
|
||||
List<DespesaReceita> despesasReceitas = getDepositos(puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM);
|
||||
log.debug("gerando despesas...");
|
||||
|
@ -49,55 +48,71 @@ public class Totalbus {
|
|||
|
||||
List<String> rows = new ArrayList<String>();
|
||||
|
||||
for (DespesaReceita item : despesasReceitas){
|
||||
for (DespesaReceita item : despesasReceitas) {
|
||||
item.preencheLinha(rows);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
private void loadPuntosVenta(){
|
||||
private void loadPuntosVenta() {
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
try{
|
||||
try {
|
||||
pstmt = getConnection().prepareStatement("Select puntoventa_id, nombpuntoventa from punto_venta order by nombpuntoventa");
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next()){
|
||||
while (rs.next()) {
|
||||
PuntoVenta puntoVenta = new PuntoVenta();
|
||||
puntoVenta.codigo = rs.getInt(1);
|
||||
puntoVenta.nombpuntoventa = rs.getString(2);
|
||||
pontosVenda.add(puntoVenta);
|
||||
}
|
||||
} catch (Exception e){
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadEmpresas(){
|
||||
private void loadEmpresas() {
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
try{
|
||||
try {
|
||||
pstmt = getConnection().prepareStatement("Select empresa_id, nombempresa from empresa order by nombempresa");
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next()){
|
||||
while (rs.next()) {
|
||||
Empresa empresa = new Empresa();
|
||||
empresa.codigo = rs.getInt(1);
|
||||
empresa.nombempresa = rs.getString(2);
|
||||
empresas.add(empresa);
|
||||
}
|
||||
} catch (Exception e){
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Connection getConnection(){
|
||||
public Connection getConnection() {
|
||||
return this.conn;
|
||||
}
|
||||
|
||||
|
@ -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,30 +147,30 @@ 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;
|
||||
|
||||
Date fecha = fechaParam;
|
||||
if(fechaParam== null){
|
||||
if (fechaParam == null) {
|
||||
fecha = getData();
|
||||
}
|
||||
|
||||
try{
|
||||
try {
|
||||
stmt = getConnection().prepareStatement(sb.toString());
|
||||
stmt.setDate(1, new java.sql.Date(fecha.getTime()));
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
while (rs.next()){
|
||||
while (rs.next()) {
|
||||
DespesaReceita despesa = new DespesaReceita();
|
||||
despesa.setCodigoEmpresa(rs.getInt(2));
|
||||
despesa.setCodigoReceitaDespesa(rs.getString(5));
|
||||
despesa.setDataLancamento(rs.getDate(1));
|
||||
despesa.setDataMovimento(rs.getDate(1));
|
||||
despesa.setLocalArrecadacao(rs.getString(6));
|
||||
if (rs.getBigDecimal(4).signum() == -1){
|
||||
if (rs.getBigDecimal(4).signum() == -1) {
|
||||
despesa.setIdentificadorReceitaDespesa("R");
|
||||
despesa.setValorLancamento(df.format(rs.getBigDecimal(4).multiply(new BigDecimal(-1))));
|
||||
} else {
|
||||
|
@ -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);
|
||||
} 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,29 +236,30 @@ 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;
|
||||
|
||||
Date fecha = fechaParam;
|
||||
if(fechaParam== null){
|
||||
if (fechaParam == null) {
|
||||
fecha = getData();
|
||||
}
|
||||
|
||||
try{
|
||||
try {
|
||||
stmt = getConnection().prepareStatement(sb.toString());
|
||||
stmt.setDate(1, new java.sql.Date(fecha.getTime()));
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
while (rs.next()){
|
||||
while (rs.next()) {
|
||||
DespesaReceita receita = new DespesaReceita();
|
||||
receita.setCodigoEmpresa(rs.getInt(2));
|
||||
receita.setCodigoReceitaDespesa(rs.getString(5));
|
||||
receita.setDataLancamento(rs.getDate(1));
|
||||
receita.setDataMovimento(rs.getDate(1));
|
||||
receita.setLocalArrecadacao(rs.getString(6));
|
||||
if (rs.getBigDecimal(4).signum() == -1){
|
||||
if (rs.getBigDecimal(4).signum() == -1) {
|
||||
receita.setIdentificadorReceitaDespesa("D");
|
||||
receita.setValorLancamento(df.format(rs.getBigDecimal(4).multiply(new BigDecimal(-1))));
|
||||
} else {
|
||||
|
@ -241,18 +270,27 @@ 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);
|
||||
} 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;
|
||||
}
|
||||
|
||||
public List<DespesaReceita> getDespesas(Integer puntoventaId, Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM){
|
||||
public List<DespesaReceita> getDespesas(Integer puntoventaId, Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM) {
|
||||
List<DespesaReceita> despesas = new ArrayList<DespesaReceita>();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(" select ");
|
||||
|
@ -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 ");
|
||||
|
@ -280,19 +320,19 @@ public class Totalbus {
|
|||
sb.append(" and ev.EVENTOEXTRACANC_ID is null ");
|
||||
|
||||
Date fecha = fechaParam;
|
||||
if(fechaParam== null){
|
||||
if (fechaParam == null) {
|
||||
fecha = getData();
|
||||
}
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
try{
|
||||
try {
|
||||
pstmt = getConnection().prepareStatement(sb.toString());
|
||||
pstmt.setDate(1, new java.sql.Date(fecha.getTime()));
|
||||
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next()){
|
||||
while (rs.next()) {
|
||||
DespesaReceita despesa = new DespesaReceita();
|
||||
despesa.setCodigoEmpresa(rs.getInt(2));
|
||||
despesa.setCodigoReceitaDespesa(rs.getString(5));
|
||||
|
@ -305,18 +345,27 @@ public class Totalbus {
|
|||
if (incluiTipoPagamentoTurismoBGM) {
|
||||
despesa.setTipoPagamentoTurismo(rs.getString("tipoeventoextra_id"));
|
||||
}
|
||||
despesa.setFormaPagamentoId(rs.getString("formapagoId"));
|
||||
despesas.add(despesa);
|
||||
}
|
||||
} catch (Exception e){
|
||||
} 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;
|
||||
}
|
||||
|
||||
public List<DespesaReceita> getDepositos(Integer puntoventaId, Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM){
|
||||
public List<DespesaReceita> getDepositos(Integer puntoventaId, Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM) {
|
||||
List<DespesaReceita> depositos = new ArrayList<DespesaReceita>();
|
||||
|
||||
StringBuilder strFechamentos = new StringBuilder();
|
||||
|
@ -335,34 +384,44 @@ public class Totalbus {
|
|||
strFechamentos.append(" group by fdep.numdeposito, fdep.feccreacion, fdep.fecha_deposito, fc.empresa_id, pv.numpuntoventa, ec.numagencia, ec.numconta, if.CODIGO, ec.numintegracion ");
|
||||
|
||||
Date fecha = fechaParam;
|
||||
if(fechaParam == null){
|
||||
if (fechaParam == null) {
|
||||
fecha = getData();
|
||||
}
|
||||
|
||||
PreparedStatement pstmtFechamentos = null;
|
||||
ResultSet rsFechamentos = null;
|
||||
BigDecimal soma = BigDecimal.ZERO;
|
||||
try{
|
||||
try {
|
||||
pstmtFechamentos = getConnection().prepareStatement(strFechamentos.toString());
|
||||
pstmtFechamentos.setDate(1, new java.sql.Date(fecha.getTime()));
|
||||
|
||||
rsFechamentos = pstmtFechamentos.executeQuery();
|
||||
|
||||
while (rsFechamentos.next()){
|
||||
while (rsFechamentos.next()) {
|
||||
Integer empId = null;
|
||||
String banco = "" ;
|
||||
String banco = "";
|
||||
String agencia = "";
|
||||
String contaCorrente = "";
|
||||
String numDep = " Dep: " + rsFechamentos.getString(2);
|
||||
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);
|
||||
|
@ -378,71 +437,93 @@ public class Totalbus {
|
|||
soma = soma.add(rsFechamentos.getBigDecimal(1));
|
||||
}
|
||||
log.debug("Total depósitos: " + soma);
|
||||
} catch (Exception e){
|
||||
} 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;
|
||||
}
|
||||
|
||||
public Integer getCodigoReceitaDespesaGlobus(){
|
||||
public Integer getCodigoReceitaDespesaGlobus() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Select valorconstante from constante where nombconstante = 'CODIGO_RECEITA_DESPESA_GLOBUS' ");
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
Integer result = null;
|
||||
try{
|
||||
try {
|
||||
pstmt = getConnection().prepareStatement(sb.toString());
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next()){
|
||||
if (rs.next()) {
|
||||
result = rs.getInt(1);
|
||||
}
|
||||
} catch (Exception e){
|
||||
} 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;
|
||||
|
||||
}
|
||||
|
||||
public Boolean isConstanteBloqueioMenorQueData(Integer empresaId, Date data){
|
||||
public Boolean isConstanteBloqueioMenorQueData(Integer empresaId, Date data) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Select valorconstante from constante where nombconstante = 'DATA_LIMITE_EDICAO_DEPOSITO_" + empresaId + "'");
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
Boolean result = null;
|
||||
try{
|
||||
try {
|
||||
pstmt = getConnection().prepareStatement(sb.toString());
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next()){
|
||||
if (rs.next()) {
|
||||
Date rsDate = new SimpleDateFormat("dd/MM/yyyy").parse(rs.getString(1));
|
||||
result = !rsDate.after(data);
|
||||
} else { // se não existir a constante, retorno true para que ela seja criada na função updateDataBloqueio
|
||||
result = true;
|
||||
}
|
||||
} catch (Exception e){
|
||||
} 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;
|
||||
|
||||
}
|
||||
|
||||
public void updateDataBloqueio(Integer empresaId, Date data){
|
||||
public void updateDataBloqueio(Integer empresaId, Date data) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
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()){
|
||||
sb.append("insert into constante values (constante_seq.nextval, 'DATA_LIMITE_EDICAO_DEPOSITO_" + empresaId + "', 'DATA_LIMITE_EDICAO_DEPOSITO_" + empresaId + "',1,"+
|
||||
try {
|
||||
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());
|
||||
pstmt.setDate(1, new java.sql.Date(new Date().getTime()));
|
||||
|
@ -453,14 +534,18 @@ public class Totalbus {
|
|||
}
|
||||
|
||||
pstmt.executeUpdate();
|
||||
} catch (Exception e){
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Date getData(){
|
||||
private Date getData() {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(2015, 10, 13);
|
||||
cal.setTime(new Date());
|
||||
|
|
|
@ -27,23 +27,39 @@ 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");
|
||||
|
||||
public DespesaReceita(){
|
||||
public 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"));
|
||||
public void preencheLinha(List<String> rows) {
|
||||
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) {
|
||||
|
@ -78,7 +94,7 @@ public class DespesaReceita {
|
|||
this.valorLancamento = StringUtils.leftPad(valorLancamento.replace(",", "").replace(".", ""), 13, "0");
|
||||
}
|
||||
|
||||
public void setDescricaoDetalhada(String desc){
|
||||
public void setDescricaoDetalhada(String desc) {
|
||||
this.descricaoDetalhada = StringUtils.rightPad(desc != null ? truncStr(desc, 100) : "", 100, " ");
|
||||
}
|
||||
|
||||
|
@ -94,9 +110,17 @@ public class DespesaReceita {
|
|||
this.tipoPagamentoTurismo = StringUtils.leftPad(tipoPagamentoTurismo, 2, "0");
|
||||
}
|
||||
|
||||
private String truncStr(String str, int size){
|
||||
if (str.length() > size){
|
||||
return str.substring(0, size -1);
|
||||
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);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue