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,99 +18,116 @@ 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);
|
||||||
private static final int DAYS_AGO = -1;
|
private static final int DAYS_AGO = -1;
|
||||||
|
|
||||||
private Connection conn;
|
private Connection conn;
|
||||||
|
|
||||||
private List<PuntoVenta> pontosVenda = new ArrayList<PuntoVenta>();
|
private List<PuntoVenta> pontosVenda = new ArrayList<PuntoVenta>();
|
||||||
private List<Empresa> empresas = new ArrayList<Empresa>();
|
private List<Empresa> empresas = new ArrayList<Empresa>();
|
||||||
|
|
||||||
private DecimalFormat df = new DecimalFormat("#0.00");
|
private DecimalFormat df = new DecimalFormat("#0.00");
|
||||||
|
|
||||||
public Totalbus(Connection con){
|
public Totalbus(Connection con) {
|
||||||
this.conn = con;
|
this.conn = con;
|
||||||
loadEmpresas();
|
loadEmpresas();
|
||||||
loadPuntosVenta();
|
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...");
|
log.debug("gerando depósitos...");
|
||||||
List<DespesaReceita> despesasReceitas = getDepositos(puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM);
|
List<DespesaReceita> despesasReceitas = getDepositos(puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM);
|
||||||
log.debug("gerando despesas...");
|
log.debug("gerando despesas...");
|
||||||
despesasReceitas.addAll(getDespesas(puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM));
|
despesasReceitas.addAll(getDespesas(puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM));
|
||||||
log.debug("gerando despesas cartão...");
|
log.debug("gerando despesas cartão...");
|
||||||
despesasReceitas.addAll(getDespesaCartaoDebCred(puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM));
|
despesasReceitas.addAll(getDespesaCartaoDebCred(puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM));
|
||||||
log.debug("gerando receitas...");
|
log.debug("gerando receitas...");
|
||||||
despesasReceitas.addAll(getReceitas(puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM));
|
despesasReceitas.addAll(getReceitas(puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM));
|
||||||
|
|
||||||
List<String> rows = new ArrayList<String>();
|
List<String> rows = new ArrayList<String>();
|
||||||
|
|
||||||
for (DespesaReceita item : despesasReceitas){
|
for (DespesaReceita item : despesasReceitas) {
|
||||||
item.preencheLinha(rows);
|
item.preencheLinha(rows);
|
||||||
}
|
}
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadPuntosVenta(){
|
private void loadPuntosVenta() {
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
|
|
||||||
try{
|
try {
|
||||||
pstmt = getConnection().prepareStatement("Select puntoventa_id, nombpuntoventa from punto_venta order by nombpuntoventa");
|
pstmt = getConnection().prepareStatement("Select puntoventa_id, nombpuntoventa from punto_venta order by nombpuntoventa");
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next()){
|
while (rs.next()) {
|
||||||
PuntoVenta puntoVenta = new PuntoVenta();
|
PuntoVenta puntoVenta = new PuntoVenta();
|
||||||
puntoVenta.codigo = rs.getInt(1);
|
puntoVenta.codigo = rs.getInt(1);
|
||||||
puntoVenta.nombpuntoventa = rs.getString(2);
|
puntoVenta.nombpuntoventa = rs.getString(2);
|
||||||
pontosVenda.add(puntoVenta);
|
pontosVenda.add(puntoVenta);
|
||||||
}
|
}
|
||||||
} 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadEmpresas(){
|
private void loadEmpresas() {
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
|
|
||||||
try{
|
try {
|
||||||
pstmt = getConnection().prepareStatement("Select empresa_id, nombempresa from empresa order by nombempresa");
|
pstmt = getConnection().prepareStatement("Select empresa_id, nombempresa from empresa order by nombempresa");
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next()){
|
while (rs.next()) {
|
||||||
Empresa empresa = new Empresa();
|
Empresa empresa = new Empresa();
|
||||||
empresa.codigo = rs.getInt(1);
|
empresa.codigo = rs.getInt(1);
|
||||||
empresa.nombempresa = rs.getString(2);
|
empresa.nombempresa = rs.getString(2);
|
||||||
empresas.add(empresa);
|
empresas.add(empresa);
|
||||||
}
|
}
|
||||||
} 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Connection getConnection(){
|
public Connection getConnection() {
|
||||||
return this.conn;
|
return this.conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DespesaReceita> getDespesaCartaoDebCred(final Integer puntoVentaId, final Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM) {
|
public List<DespesaReceita> getDespesaCartaoDebCred(final Integer puntoVentaId, final Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM) {
|
||||||
List<DespesaReceita> despesas = new ArrayList<DespesaReceita>();
|
List<DespesaReceita> despesas = new ArrayList<DespesaReceita>();
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(" select ");
|
sb.append(" select ");
|
||||||
sb.append(" cd.feccorte AS fechorvta, ");
|
sb.append(" cd.feccorte AS fechorvta, ");
|
||||||
sb.append(" e.empresa_id AS empresa, ");
|
sb.append(" e.empresa_id AS empresa, ");
|
||||||
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,30 +147,30 @@ 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;
|
||||||
|
|
||||||
Date fecha = fechaParam;
|
Date fecha = fechaParam;
|
||||||
if(fechaParam== null){
|
if (fechaParam == null) {
|
||||||
fecha = getData();
|
fecha = getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try {
|
||||||
stmt = getConnection().prepareStatement(sb.toString());
|
stmt = getConnection().prepareStatement(sb.toString());
|
||||||
stmt.setDate(1, new java.sql.Date(fecha.getTime()));
|
stmt.setDate(1, new java.sql.Date(fecha.getTime()));
|
||||||
rs = stmt.executeQuery();
|
rs = stmt.executeQuery();
|
||||||
|
|
||||||
while (rs.next()){
|
while (rs.next()) {
|
||||||
DespesaReceita despesa = new DespesaReceita();
|
DespesaReceita despesa = new DespesaReceita();
|
||||||
despesa.setCodigoEmpresa(rs.getInt(2));
|
despesa.setCodigoEmpresa(rs.getInt(2));
|
||||||
despesa.setCodigoReceitaDespesa(rs.getString(5));
|
despesa.setCodigoReceitaDespesa(rs.getString(5));
|
||||||
despesa.setDataLancamento(rs.getDate(1));
|
despesa.setDataLancamento(rs.getDate(1));
|
||||||
despesa.setDataMovimento(rs.getDate(1));
|
despesa.setDataMovimento(rs.getDate(1));
|
||||||
despesa.setLocalArrecadacao(rs.getString(6));
|
despesa.setLocalArrecadacao(rs.getString(6));
|
||||||
if (rs.getBigDecimal(4).signum() == -1){
|
if (rs.getBigDecimal(4).signum() == -1) {
|
||||||
despesa.setIdentificadorReceitaDespesa("R");
|
despesa.setIdentificadorReceitaDespesa("R");
|
||||||
despesa.setValorLancamento(df.format(rs.getBigDecimal(4).multiply(new BigDecimal(-1))));
|
despesa.setValorLancamento(df.format(rs.getBigDecimal(4).multiply(new BigDecimal(-1))));
|
||||||
} else {
|
} else {
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +205,7 @@ public class Totalbus {
|
||||||
sb.append(filtroSQL + valor);
|
sb.append(filtroSQL + valor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DespesaReceita> getReceitas(final Integer puntoVentaId, final Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM) {
|
public List<DespesaReceita> getReceitas(final Integer puntoVentaId, final Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM) {
|
||||||
List<DespesaReceita> despesas = new ArrayList<DespesaReceita>();
|
List<DespesaReceita> despesas = new ArrayList<DespesaReceita>();
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
@ -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,62 +236,74 @@ 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;
|
||||||
|
|
||||||
Date fecha = fechaParam;
|
Date fecha = fechaParam;
|
||||||
if(fechaParam== null){
|
if (fechaParam == null) {
|
||||||
fecha = getData();
|
fecha = getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try {
|
||||||
stmt = getConnection().prepareStatement(sb.toString());
|
stmt = getConnection().prepareStatement(sb.toString());
|
||||||
stmt.setDate(1, new java.sql.Date(fecha.getTime()));
|
stmt.setDate(1, new java.sql.Date(fecha.getTime()));
|
||||||
rs = stmt.executeQuery();
|
rs = stmt.executeQuery();
|
||||||
|
|
||||||
while (rs.next()){
|
while (rs.next()) {
|
||||||
DespesaReceita receita = new DespesaReceita();
|
DespesaReceita receita = new DespesaReceita();
|
||||||
receita.setCodigoEmpresa(rs.getInt(2));
|
receita.setCodigoEmpresa(rs.getInt(2));
|
||||||
receita.setCodigoReceitaDespesa(rs.getString(5));
|
receita.setCodigoReceitaDespesa(rs.getString(5));
|
||||||
receita.setDataLancamento(rs.getDate(1));
|
receita.setDataLancamento(rs.getDate(1));
|
||||||
receita.setDataMovimento(rs.getDate(1));
|
receita.setDataMovimento(rs.getDate(1));
|
||||||
receita.setLocalArrecadacao(rs.getString(6));
|
receita.setLocalArrecadacao(rs.getString(6));
|
||||||
if (rs.getBigDecimal(4).signum() == -1){
|
if (rs.getBigDecimal(4).signum() == -1) {
|
||||||
receita.setIdentificadorReceitaDespesa("D");
|
receita.setIdentificadorReceitaDespesa("D");
|
||||||
receita.setValorLancamento(df.format(rs.getBigDecimal(4).multiply(new BigDecimal(-1))));
|
receita.setValorLancamento(df.format(rs.getBigDecimal(4).multiply(new BigDecimal(-1))));
|
||||||
} else {
|
} else {
|
||||||
receita.setIdentificadorReceitaDespesa("R");
|
receita.setIdentificadorReceitaDespesa("R");
|
||||||
receita.setValorLancamento(df.format(rs.getBigDecimal(4)));
|
receita.setValorLancamento(df.format(rs.getBigDecimal(4)));
|
||||||
}
|
}
|
||||||
receita.setDescricaoDetalhada(rs.getString(7));
|
receita.setDescricaoDetalhada(rs.getString(7));
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
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>();
|
List<DespesaReceita> despesas = new ArrayList<DespesaReceita>();
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(" select ");
|
sb.append(" select ");
|
||||||
sb.append(" cd.feccorte as feccorte, ");
|
sb.append(" cd.feccorte as feccorte, ");
|
||||||
sb.append(" e.empresa_id as empresa_id, ");
|
sb.append(" e.empresa_id as empresa_id, ");
|
||||||
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(" from ");
|
sb.append(" ev.tipoeventoextra_id, ");
|
||||||
sb.append(" caja_diversos cd ");
|
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 ");
|
sb.append(" left join evento_extra ev on ev.eventoextra_id = cd.eventoextra_id ");
|
||||||
sb.append(" left join empresa e on e.empresa_id = ev.empresa_id ");
|
sb.append(" left join empresa e on e.empresa_id = ev.empresa_id ");
|
||||||
sb.append(" left join punto_venta pv on pv.puntoventa_id = cd.puntoventa_id ");
|
sb.append(" left join punto_venta pv on pv.puntoventa_id = cd.puntoventa_id ");
|
||||||
|
@ -278,21 +318,21 @@ public class Totalbus {
|
||||||
sb.append(" and cd.activo = 1 ");
|
sb.append(" and cd.activo = 1 ");
|
||||||
sb.append(" and not exists (select ee.EVENTOEXTRA_ID from evento_extra ee where ev.EVENTOEXTRA_ID = ee.EVENTOEXTRACANC_ID) ");
|
sb.append(" and not exists (select ee.EVENTOEXTRA_ID from evento_extra ee where ev.EVENTOEXTRA_ID = ee.EVENTOEXTRACANC_ID) ");
|
||||||
sb.append(" and ev.EVENTOEXTRACANC_ID is null ");
|
sb.append(" and ev.EVENTOEXTRACANC_ID is null ");
|
||||||
|
|
||||||
Date fecha = fechaParam;
|
Date fecha = fechaParam;
|
||||||
if(fechaParam== null){
|
if (fechaParam == null) {
|
||||||
fecha = getData();
|
fecha = getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
|
|
||||||
try{
|
try {
|
||||||
pstmt = getConnection().prepareStatement(sb.toString());
|
pstmt = getConnection().prepareStatement(sb.toString());
|
||||||
pstmt.setDate(1, new java.sql.Date(fecha.getTime()));
|
pstmt.setDate(1, new java.sql.Date(fecha.getTime()));
|
||||||
|
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next()){
|
while (rs.next()) {
|
||||||
DespesaReceita despesa = new DespesaReceita();
|
DespesaReceita despesa = new DespesaReceita();
|
||||||
despesa.setCodigoEmpresa(rs.getInt(2));
|
despesa.setCodigoEmpresa(rs.getInt(2));
|
||||||
despesa.setCodigoReceitaDespesa(rs.getString(5));
|
despesa.setCodigoReceitaDespesa(rs.getString(5));
|
||||||
|
@ -305,65 +345,84 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
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>();
|
List<DespesaReceita> depositos = new ArrayList<DespesaReceita>();
|
||||||
|
|
||||||
StringBuilder strFechamentos = new StringBuilder();
|
StringBuilder strFechamentos = new StringBuilder();
|
||||||
strFechamentos.append("Select distinct sum(fd.valor_pago), fdep.numdeposito, fdep.fecha_deposito, fc.empresa_id, ");
|
strFechamentos.append("Select distinct sum(fd.valor_pago), fdep.numdeposito, fdep.fecha_deposito, fc.empresa_id, ");
|
||||||
strFechamentos.append(" pv.numpuntoventa, ec.numagencia, ec.numconta, if.CODIGO, ec.numintegracion, fdep.feccreacion ");
|
strFechamentos.append(" pv.numpuntoventa, ec.numagencia, ec.numconta, if.CODIGO, ec.numintegracion, fdep.feccreacion ");
|
||||||
strFechamentos.append(" from fechamento_deposito fdep ");
|
strFechamentos.append(" from fechamento_deposito fdep ");
|
||||||
strFechamentos.append(" join fechamento_cct_deposito fd on fd.fechamentodeposito_id = fdep.fechamentodeposito_id ");
|
strFechamentos.append(" join fechamento_cct_deposito fd on fd.fechamentodeposito_id = fdep.fechamentodeposito_id ");
|
||||||
strFechamentos.append(" join fechamento_cntcorrente fc on fc.fechamentocntcorrente_id = fd.fechamentocntcorrente_id ");
|
strFechamentos.append(" join fechamento_cntcorrente fc on fc.fechamentocntcorrente_id = fd.fechamentocntcorrente_id ");
|
||||||
strFechamentos.append(" inner join PUNTO_VENTA pv on PV.PUNTOVENTA_ID = FC.PUNTOVENTA_ID ");
|
strFechamentos.append(" inner join PUNTO_VENTA pv on PV.PUNTOVENTA_ID = FC.PUNTOVENTA_ID ");
|
||||||
strFechamentos.append(" join empresa_contabancaria ec on ec.EMPRESACONTABANCARIA_ID = fdep.EMPRESACONTABANCARIA_ID ");
|
strFechamentos.append(" join empresa_contabancaria ec on ec.EMPRESACONTABANCARIA_ID = fdep.EMPRESACONTABANCARIA_ID ");
|
||||||
strFechamentos.append(" join INSTI_FINANCEIRA if on if.INSTIFINANCEIRA_ID = EC.INSTIFINANCEIRA_ID ");
|
strFechamentos.append(" join INSTI_FINANCEIRA if on if.INSTIFINANCEIRA_ID = EC.INSTIFINANCEIRA_ID ");
|
||||||
strFechamentos.append(" join EMPRESA e on e.empresa_id = fc.empresa_id ");
|
strFechamentos.append(" join EMPRESA e on e.empresa_id = fc.empresa_id ");
|
||||||
strFechamentos.append(" where trunc(fdep.feccreacion) = :fecha and fd.activo = 1 and fc.activo = 1 and fdep.activo = 1 ");
|
strFechamentos.append(" where trunc(fdep.feccreacion) = :fecha and fd.activo = 1 and fc.activo = 1 and fdep.activo = 1 ");
|
||||||
adicionaFiltroQuery(puntoventaId, strFechamentos, " and fc.puntoventa_id = ", puntoventaId != null && !puntoventaId.equals(-1));
|
adicionaFiltroQuery(puntoventaId, strFechamentos, " and fc.puntoventa_id = ", puntoventaId != null && !puntoventaId.equals(-1));
|
||||||
adicionaFiltroQuery(empresaId, strFechamentos, " and fc.empresa_id = ", empresaId != null);
|
adicionaFiltroQuery(empresaId, strFechamentos, " and fc.empresa_id = ", empresaId != null);
|
||||||
strFechamentos.append(" group by fdep.numdeposito, fdep.feccreacion, fdep.fecha_deposito, fc.empresa_id, pv.numpuntoventa, ec.numagencia, ec.numconta, if.CODIGO, ec.numintegracion ");
|
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;
|
Date fecha = fechaParam;
|
||||||
if(fechaParam == null){
|
if (fechaParam == null) {
|
||||||
fecha = getData();
|
fecha = getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
PreparedStatement pstmtFechamentos = null;
|
PreparedStatement pstmtFechamentos = null;
|
||||||
ResultSet rsFechamentos = null;
|
ResultSet rsFechamentos = null;
|
||||||
BigDecimal soma = BigDecimal.ZERO;
|
BigDecimal soma = BigDecimal.ZERO;
|
||||||
try{
|
try {
|
||||||
pstmtFechamentos = getConnection().prepareStatement(strFechamentos.toString());
|
pstmtFechamentos = getConnection().prepareStatement(strFechamentos.toString());
|
||||||
pstmtFechamentos.setDate(1, new java.sql.Date(fecha.getTime()));
|
pstmtFechamentos.setDate(1, new java.sql.Date(fecha.getTime()));
|
||||||
|
|
||||||
rsFechamentos = pstmtFechamentos.executeQuery();
|
rsFechamentos = pstmtFechamentos.executeQuery();
|
||||||
|
|
||||||
while (rsFechamentos.next()){
|
while (rsFechamentos.next()) {
|
||||||
Integer empId = null;
|
Integer empId = null;
|
||||||
String banco = "" ;
|
String banco = "";
|
||||||
String agencia = "";
|
String agencia = "";
|
||||||
String contaCorrente = "";
|
String contaCorrente = "";
|
||||||
String numDep = " Dep: " + rsFechamentos.getString(2);
|
String numDep = " Dep: " + rsFechamentos.getString(2);
|
||||||
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 (agencia.isEmpty()){ agencia = " Ag: " + rsFechamentos.getString(6); }
|
if (banco.isEmpty()) {
|
||||||
if (contaCorrente.isEmpty()){ contaCorrente = " C/C: " + rsFechamentos.getString(7); }
|
banco = "Bco: " + StringUtils.leftPad(rsFechamentos.getString(8), 3, "0");
|
||||||
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();
|
DespesaReceita deposito = new DespesaReceita();
|
||||||
deposito.setCodigoEmpresa(empId);
|
deposito.setCodigoEmpresa(empId);
|
||||||
deposito.setDataLancamento(rsFechamentos.getDate(10));
|
deposito.setDataLancamento(rsFechamentos.getDate(10));
|
||||||
|
@ -373,101 +432,127 @@ public class Totalbus {
|
||||||
deposito.setIdentificadorReceitaDespesa("D");
|
deposito.setIdentificadorReceitaDespesa("D");
|
||||||
deposito.setCodigoReceitaDespesa(codRecDesp);
|
deposito.setCodigoReceitaDespesa(codRecDesp);
|
||||||
deposito.setDescricaoDetalhada(banco + agencia + contaCorrente + numDep);
|
deposito.setDescricaoDetalhada(banco + agencia + contaCorrente + numDep);
|
||||||
|
|
||||||
depositos.add(deposito);
|
depositos.add(deposito);
|
||||||
soma = soma.add(rsFechamentos.getBigDecimal(1));
|
soma = soma.add(rsFechamentos.getBigDecimal(1));
|
||||||
}
|
}
|
||||||
log.debug("Total depósitos: " + soma);
|
log.debug("Total depósitos: " + soma);
|
||||||
} 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getCodigoReceitaDespesaGlobus(){
|
public Integer getCodigoReceitaDespesaGlobus() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Select valorconstante from constante where nombconstante = 'CODIGO_RECEITA_DESPESA_GLOBUS' ");
|
sb.append("Select valorconstante from constante where nombconstante = 'CODIGO_RECEITA_DESPESA_GLOBUS' ");
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
Integer result = null;
|
Integer result = null;
|
||||||
try{
|
try {
|
||||||
pstmt = getConnection().prepareStatement(sb.toString());
|
pstmt = getConnection().prepareStatement(sb.toString());
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next()){
|
if (rs.next()) {
|
||||||
result = rs.getInt(1);
|
result = rs.getInt(1);
|
||||||
}
|
}
|
||||||
} 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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isConstanteBloqueioMenorQueData(Integer empresaId, Date data){
|
public Boolean isConstanteBloqueioMenorQueData(Integer empresaId, Date data) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Select valorconstante from constante where nombconstante = 'DATA_LIMITE_EDICAO_DEPOSITO_" + empresaId + "'");
|
sb.append("Select valorconstante from constante where nombconstante = 'DATA_LIMITE_EDICAO_DEPOSITO_" + empresaId + "'");
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
Boolean result = null;
|
Boolean result = null;
|
||||||
try{
|
try {
|
||||||
pstmt = getConnection().prepareStatement(sb.toString());
|
pstmt = getConnection().prepareStatement(sb.toString());
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next()){
|
if (rs.next()) {
|
||||||
Date rsDate = new SimpleDateFormat("dd/MM/yyyy").parse(rs.getString(1));
|
Date rsDate = new SimpleDateFormat("dd/MM/yyyy").parse(rs.getString(1));
|
||||||
result = !rsDate.after(data);
|
result = !rsDate.after(data);
|
||||||
} else { // se não existir a constante, retorno true para que ela seja criada na função updateDataBloqueio
|
} else { // se não existir a constante, retorno true para que ela seja criada na função updateDataBloqueio
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
} 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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDataBloqueio(Integer empresaId, Date data){
|
public void updateDataBloqueio(Integer empresaId, Date data) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
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 + "'").
|
sb.append("insert into constante values (constante_seq.nextval, 'DATA_LIMITE_EDICAO_DEPOSITO_" + empresaId + "', 'DATA_LIMITE_EDICAO_DEPOSITO_" + empresaId + "',1," +
|
||||||
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)");
|
"'" + sdf.format(data) + "', 1, 1, :datamodif, 1)");
|
||||||
pstmt = getConnection().prepareStatement(sb.toString());
|
pstmt = getConnection().prepareStatement(sb.toString());
|
||||||
pstmt.setDate(1, new java.sql.Date(new Date().getTime()));
|
pstmt.setDate(1, new java.sql.Date(new Date().getTime()));
|
||||||
} else {
|
} else {
|
||||||
sb.append("update constante set valorconstante = :valor where nombconstante = 'DATA_LIMITE_EDICAO_DEPOSITO_" + empresaId + "'");
|
sb.append("update constante set valorconstante = :valor where nombconstante = 'DATA_LIMITE_EDICAO_DEPOSITO_" + empresaId + "'");
|
||||||
pstmt = getConnection().prepareStatement(sb.toString());
|
pstmt = getConnection().prepareStatement(sb.toString());
|
||||||
pstmt.setString(1, sdf.format(data));
|
pstmt.setString(1, sdf.format(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
pstmt.executeUpdate();
|
pstmt.executeUpdate();
|
||||||
} 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Date getData(){
|
private Date getData() {
|
||||||
Calendar cal = Calendar.getInstance();
|
Calendar cal = Calendar.getInstance();
|
||||||
cal.set(2015, 10, 13);
|
cal.set(2015, 10, 13);
|
||||||
cal.setTime(new Date());
|
cal.setTime(new Date());
|
||||||
cal.add(Calendar.DAY_OF_MONTH, DAYS_AGO);
|
cal.add(Calendar.DAY_OF_MONTH, DAYS_AGO);
|
||||||
return cal.getTime();
|
return cal.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PuntoVenta> getPontosVenda() {
|
public List<PuntoVenta> getPontosVenda() {
|
||||||
return pontosVenda;
|
return pontosVenda;
|
||||||
}
|
}
|
||||||
|
@ -482,5 +567,5 @@ public class Totalbus {
|
||||||
|
|
||||||
public void setEmpresas(List<Empresa> empresas) {
|
public void setEmpresas(List<Empresa> empresas) {
|
||||||
this.empresas = empresas;
|
this.empresas = empresas;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,44 +8,60 @@ import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
public class DespesaReceita {
|
public class DespesaReceita {
|
||||||
private String dataLancamento; // DD/MM/YYYY
|
private String dataLancamento; // DD/MM/YYYY
|
||||||
private String codigoEmpresa; // 011 003 Numérico
|
private String codigoEmpresa; // 011 003 Numérico
|
||||||
private final String codigoFilial = "001"; // 014 003 Numérico
|
private final String codigoFilial = "001"; // 014 003 Numérico
|
||||||
private String localArrecadação; // 017 005 Alfanumérico
|
private String localArrecadação; // 017 005 Alfanumérico
|
||||||
private final String numeroDaGuia = " "; // 022 025 Alfanumérico
|
private final String numeroDaGuia = " "; // 022 025 Alfanumérico
|
||||||
private String dataMovimento; // 047 010 Alfanumérico
|
private String dataMovimento; // 047 010 Alfanumérico
|
||||||
private final String usuarioGlobus = "TOTALBUS ";// 057 015 Alfanumérico
|
private final String usuarioGlobus = "TOTALBUS ";// 057 015 Alfanumérico
|
||||||
private final String turno = "01";// 072 002 Numérico
|
private final String turno = "01";// 072 002 Numérico
|
||||||
private String codigoReceitaDespesa;// 074 010 Numérico CONSTANTE CODIGO_RECEITA_DESPESA_GLOBUS
|
private String codigoReceitaDespesa;// 074 010 Numérico CONSTANTE CODIGO_RECEITA_DESPESA_GLOBUS
|
||||||
private String identificadorReceitaDespesa;// 084 001 Alfanumérico
|
private String identificadorReceitaDespesa;// 084 001 Alfanumérico
|
||||||
private String valorLancamento;// 085 013 Numérico
|
private String valorLancamento;// 085 013 Numérico
|
||||||
private final String numeroContratoTurismo = "0000000000";// 098 010 Numérico
|
private final String numeroContratoTurismo = "0000000000";// 098 010 Numérico
|
||||||
private final String numeroReciboTurismo = " ";// 108 010 Alfanumérico
|
private final String numeroReciboTurismo = " ";// 108 010 Alfanumérico
|
||||||
private final String formaPagamentoTurismo = "00";// 118 002 Numérico
|
private final String formaPagamentoTurismo = "00";// 118 002 Numérico
|
||||||
private String tipoPagamentoTurismo = "00";// 120 002 Numérico
|
private String tipoPagamentoTurismo = "00";// 120 002 Numérico
|
||||||
private String descricaoDetalhada = " ";// 122 100 Alfanumérico
|
private String descricaoDetalhada = " ";// 122 100 Alfanumérico
|
||||||
private final String documentoVenda = "000000";// 222 6 Numérico
|
private final String documentoVenda = "000000";// 222 6 Numérico
|
||||||
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");
|
||||||
|
|
||||||
public DespesaReceita(){
|
public 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) {
|
||||||
this.dataLancamento = sdf.format(dataLancamento);
|
this.dataLancamento = sdf.format(dataLancamento);
|
||||||
}
|
}
|
||||||
|
@ -57,19 +73,19 @@ public class DespesaReceita {
|
||||||
public void setLocalArrecadacao(Integer localArrecadacao) {
|
public void setLocalArrecadacao(Integer localArrecadacao) {
|
||||||
this.localArrecadação = StringUtils.rightPad(localArrecadacao.toString(), 5, " ");
|
this.localArrecadação = StringUtils.rightPad(localArrecadacao.toString(), 5, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLocalArrecadacao(String localArrecadacao) {
|
public void setLocalArrecadacao(String localArrecadacao) {
|
||||||
this.localArrecadação = StringUtils.rightPad(localArrecadacao, 5, " ");
|
this.localArrecadação = StringUtils.rightPad(localArrecadacao, 5, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataMovimento(Date dataMovimento) {
|
public void setDataMovimento(Date dataMovimento) {
|
||||||
this.dataMovimento = sdf.format(dataMovimento);
|
this.dataMovimento = sdf.format(dataMovimento);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCodigoReceitaDespesa(String codigoReceitaDespesa) {
|
public void setCodigoReceitaDespesa(String codigoReceitaDespesa) {
|
||||||
this.codigoReceitaDespesa = StringUtils.leftPad(codigoReceitaDespesa != null ? codigoReceitaDespesa : "0", 10, "0");
|
this.codigoReceitaDespesa = StringUtils.leftPad(codigoReceitaDespesa != null ? codigoReceitaDespesa : "0", 10, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIdentificadorReceitaDespesa(String identificadorReceitaDespesa) {
|
public void setIdentificadorReceitaDespesa(String identificadorReceitaDespesa) {
|
||||||
this.identificadorReceitaDespesa = identificadorReceitaDespesa.toUpperCase();
|
this.identificadorReceitaDespesa = identificadorReceitaDespesa.toUpperCase();
|
||||||
}
|
}
|
||||||
|
@ -78,10 +94,10 @@ public class DespesaReceita {
|
||||||
this.valorLancamento = StringUtils.leftPad(valorLancamento.replace(",", "").replace(".", ""), 13, "0");
|
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, " ");
|
this.descricaoDetalhada = StringUtils.rightPad(desc != null ? truncStr(desc, 100) : "", 100, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFormaPagamentoTurismo() {
|
public String getFormaPagamentoTurismo() {
|
||||||
return formaPagamentoTurismo;
|
return formaPagamentoTurismo;
|
||||||
}
|
}
|
||||||
|
@ -94,11 +110,19 @@ public class DespesaReceita {
|
||||||
this.tipoPagamentoTurismo = StringUtils.leftPad(tipoPagamentoTurismo, 2, "0");
|
this.tipoPagamentoTurismo = StringUtils.leftPad(tipoPagamentoTurismo, 2, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String truncStr(String str, int size){
|
public String getFormaPagamentoId() {
|
||||||
if (str.length() > size){
|
return formaPagamentoId;
|
||||||
return str.substring(0, size -1);
|
}
|
||||||
}
|
|
||||||
|
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;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue