fixes bug#23550
dev: Celio qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/Integracion/IntegracaoReceitaDespesa/trunk/IntegracaoReceitaDespesa@110010 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
6f0192ee35
commit
612691f150
|
@ -125,7 +125,7 @@ public class BGMApplication {
|
||||||
File file = new File(fileName);
|
File file = new File(fileName);
|
||||||
|
|
||||||
log.debug("gerando arquivo...");
|
log.debug("gerando arquivo...");
|
||||||
Arquivo.GravaArquivo(file.getAbsolutePath(), totalbus.getDespesasReceitas(puntoVentaId, empresaId, cal.getTime(), incluiTipoPagamentoTurismoBGM));
|
Arquivo.GravaArquivo(file.getAbsolutePath(), totalbus.getDespesasReceitas(puntoVentaId, empresaId, cal.getTime(), incluiTipoPagamentoTurismoBGM, layoutNovo));
|
||||||
|
|
||||||
this.copiarArquivoExternamente(file, pathGravacaoExternaArquivos);
|
this.copiarArquivoExternamente(file, pathGravacaoExternaArquivos);
|
||||||
|
|
||||||
|
|
|
@ -68,11 +68,11 @@ public class Totalbus {
|
||||||
loadPuntosVenta();
|
loadPuntosVenta();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getDespesasReceitas(Integer puntoventaId, Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM) throws IntegracaoReceitaDespesaException{
|
public List<String> getDespesasReceitas(Integer puntoventaId, Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM, boolean isLayoutNovo) throws IntegracaoReceitaDespesaException{
|
||||||
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, isLayoutNovo);
|
||||||
log.debug("gerando despesas...");
|
log.debug("gerando despesas...");
|
||||||
despesasReceitas.addAll(getDespesas(puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM));
|
despesasReceitas.addAll(getDespesas(puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM, isLayoutNovo));
|
||||||
log.debug("gerando despesas cartão...");
|
log.debug("gerando despesas cartão...");
|
||||||
|
|
||||||
if (isReceitasDespesasComporte){
|
if (isReceitasDespesasComporte){
|
||||||
|
@ -81,9 +81,9 @@ public class Totalbus {
|
||||||
despesasReceitas.addAll(getReceitasComporte(puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM));
|
despesasReceitas.addAll(getReceitasComporte(puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM));
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
despesasReceitas.addAll(getDespesaCartaoDebCred(puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM));
|
despesasReceitas.addAll(getDespesaCartaoDebCred(puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM, isLayoutNovo));
|
||||||
log.debug("gerando receitas...");
|
log.debug("gerando receitas...");
|
||||||
despesasReceitas.addAll(getReceitas(puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM));
|
despesasReceitas.addAll(getReceitas(puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM, isLayoutNovo));
|
||||||
if(isReceitasDespesasOuroPrata) {
|
if(isReceitasDespesasOuroPrata) {
|
||||||
getContaCorrenteAgencia(despesasReceitas, puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM);
|
getContaCorrenteAgencia(despesasReceitas, puntoventaId, empresaId, fechaParam, incluiTipoPagamentoTurismoBGM);
|
||||||
}
|
}
|
||||||
|
@ -440,7 +440,7 @@ public class Totalbus {
|
||||||
return this.conn;
|
return this.conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DespesaReceita> getDespesaCartaoDebCred(final Integer puntoVentaId, final Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM) throws IntegracaoReceitaDespesaException{
|
public List<DespesaReceita> getDespesaCartaoDebCred(final Integer puntoVentaId, final Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM, boolean isLayoutNovo) throws IntegracaoReceitaDespesaException{
|
||||||
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 ");
|
||||||
|
@ -518,6 +518,13 @@ public class Totalbus {
|
||||||
despesa.setTipoPagamentoTurismo(rs.getString("tipoeventoextra_id"));
|
despesa.setTipoPagamentoTurismo(rs.getString("tipoeventoextra_id"));
|
||||||
}
|
}
|
||||||
despesa.setFormaPagamentoId(rs.getString("formapagoId"));
|
despesa.setFormaPagamentoId(rs.getString("formapagoId"));
|
||||||
|
|
||||||
|
if(isLayoutNovo) {
|
||||||
|
despesa.setTipoPagamentoTurismo("01");
|
||||||
|
despesa.setFormaPagamentoId("03");
|
||||||
|
despesa.setTipoDocumentoVenda("P");
|
||||||
|
}
|
||||||
|
|
||||||
despesas.add(despesa);
|
despesas.add(despesa);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -645,7 +652,7 @@ public class Totalbus {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DespesaReceita> getReceitas(final Integer puntoVentaId, final Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM) throws IntegracaoReceitaDespesaException {
|
public List<DespesaReceita> getReceitas(final Integer puntoVentaId, final Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM, boolean isLayoutNovo) throws IntegracaoReceitaDespesaException {
|
||||||
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 ");
|
||||||
|
@ -657,13 +664,16 @@ public class Totalbus {
|
||||||
sb.append(" pv.numpuntoventa AS numpuntoventa, ");
|
sb.append(" pv.numpuntoventa AS numpuntoventa, ");
|
||||||
sb.append(" ev.descinfo as descinfo, ");
|
sb.append(" ev.descinfo as descinfo, ");
|
||||||
sb.append(" ev.tipoeventoextra_id, ");
|
sb.append(" ev.tipoeventoextra_id, ");
|
||||||
sb.append(" COALESCE(cdp.formapago_id,0) as formapagoId ");
|
sb.append(" COALESCE(cdp.formapago_id,0) as formapagoId, ");
|
||||||
|
sb.append(" tee.desctipoevento, ");
|
||||||
|
sb.append(" fp.tipo_pago ");
|
||||||
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 ");
|
||||||
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 ");
|
||||||
sb.append(" left join caja_diversos_pago cdp on cdp.cajadiversos_id = cd.cajadiversos_id ");
|
sb.append(" left join caja_diversos_pago cdp on cdp.cajadiversos_id = cd.cajadiversos_id ");
|
||||||
|
sb.append(" left join forma_pago fp on cdp.formapago_id = fp.formapago_id ");
|
||||||
sb.append(" left join tipo_evento_extra tee on tee.tipoeventoextra_id = ev.tipoeventoextra_id ");
|
sb.append(" left join tipo_evento_extra tee on tee.tipoeventoextra_id = ev.tipoeventoextra_id ");
|
||||||
sb.append(" left join ptovta_integra pi on e.empresa_id = pi.empresa_id and pi.puntoventa_id = pv.puntoventa_id ");
|
sb.append(" left join ptovta_integra pi on e.empresa_id = pi.empresa_id and pi.puntoventa_id = pv.puntoventa_id ");
|
||||||
sb.append(" where ");
|
sb.append(" where ");
|
||||||
|
@ -676,7 +686,7 @@ public class Totalbus {
|
||||||
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 ");
|
sb.append(" cdp.formapago_id, tee.desctipoevento,fp.tipo_pago ");
|
||||||
|
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
|
@ -709,12 +719,25 @@ public class Totalbus {
|
||||||
String desc =rs.getString(7);
|
String desc =rs.getString(7);
|
||||||
|
|
||||||
desc = this.removerQuebraDeLinha(desc);
|
desc = this.removerQuebraDeLinha(desc);
|
||||||
|
|
||||||
receita.setDescricaoDetalhada(desc);
|
receita.setDescricaoDetalhada(desc);
|
||||||
|
|
||||||
if (incluiTipoPagamentoTurismoBGM) {
|
if (incluiTipoPagamentoTurismoBGM) {
|
||||||
receita.setTipoPagamentoTurismo(rs.getString("tipoeventoextra_id"));
|
receita.setTipoPagamentoTurismo(rs.getString("tipoeventoextra_id"));
|
||||||
}
|
}
|
||||||
receita.setFormaPagamentoId(rs.getString("formapagoId"));
|
receita.setFormaPagamentoId(rs.getString("formapagoId"));
|
||||||
|
|
||||||
|
if(isLayoutNovo) {
|
||||||
|
if( rs.getString("desctipoevento").matches("EXCESSO.BAGAGEM") ) {
|
||||||
|
receita.setTipoDocumentoVenda("E");
|
||||||
|
}else {
|
||||||
|
receita.setTipoDocumentoVenda("P");
|
||||||
|
}
|
||||||
|
|
||||||
|
receita.setTipoPagamentoTurismo("01");
|
||||||
|
receita.setFormaPagamentoId( converteFormaPagamentoLayoutNovo(rs.getString("tipo_pago")) );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
despesas.add(receita);
|
despesas.add(receita);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -835,7 +858,7 @@ public class Totalbus {
|
||||||
return despesas;
|
return despesas;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DespesaReceita> getDespesas(Integer puntoventaId, Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM) throws IntegracaoReceitaDespesaException {
|
public List<DespesaReceita> getDespesas(Integer puntoventaId, Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM, boolean isLayoutNovo ) throws IntegracaoReceitaDespesaException {
|
||||||
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 ");
|
||||||
|
@ -861,7 +884,7 @@ public class Totalbus {
|
||||||
adicionaFiltroQuery(puntoventaId, sb, " and cd.puntoventa_id = ", puntoventaId != null && !puntoventaId.equals(-1));
|
adicionaFiltroQuery(puntoventaId, sb, " and cd.puntoventa_id = ", puntoventaId != null && !puntoventaId.equals(-1));
|
||||||
adicionaFiltroQuery(empresaId, sb, " and e.empresa_id = ", empresaId != null);
|
adicionaFiltroQuery(empresaId, sb, " and e.empresa_id = ", empresaId != null);
|
||||||
sb.append(" and cd.activo = 1 ");
|
sb.append(" and cd.activo = 1 ");
|
||||||
sb.append(" AND cdp.formapago_id not IN (2,3) ");
|
sb.append(" and cdp.formapago_id not IN (2,3) ");
|
||||||
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 ");
|
||||||
|
|
||||||
|
@ -896,6 +919,13 @@ public class Totalbus {
|
||||||
despesa.setTipoPagamentoTurismo(rs.getString("tipoeventoextra_id"));
|
despesa.setTipoPagamentoTurismo(rs.getString("tipoeventoextra_id"));
|
||||||
}
|
}
|
||||||
despesa.setFormaPagamentoId(rs.getString("formapagoId"));
|
despesa.setFormaPagamentoId(rs.getString("formapagoId"));
|
||||||
|
|
||||||
|
if(isLayoutNovo) {
|
||||||
|
despesa.setTipoPagamentoTurismo("01");
|
||||||
|
despesa.setFormaPagamentoId("01");
|
||||||
|
despesa.setTipoDocumentoVenda("P");
|
||||||
|
}
|
||||||
|
|
||||||
despesas.add(despesa);
|
despesas.add(despesa);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -930,7 +960,7 @@ public class Totalbus {
|
||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DespesaReceita> getDepositos(Integer puntoventaId, Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM) throws IntegracaoReceitaDespesaException {
|
public List<DespesaReceita> getDepositos(Integer puntoventaId, Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM, boolean isLayoutNovo) throws IntegracaoReceitaDespesaException {
|
||||||
List<DespesaReceita> depositos = new ArrayList<DespesaReceita>();
|
List<DespesaReceita> depositos = new ArrayList<DespesaReceita>();
|
||||||
|
|
||||||
StringBuilder strFechamentos = new StringBuilder();
|
StringBuilder strFechamentos = new StringBuilder();
|
||||||
|
@ -998,6 +1028,12 @@ public class Totalbus {
|
||||||
deposito.setCodigoReceitaDespesa(codRecDesp);
|
deposito.setCodigoReceitaDespesa(codRecDesp);
|
||||||
deposito.setDescricaoDetalhada(banco + agencia + contaCorrente + numDep);
|
deposito.setDescricaoDetalhada(banco + agencia + contaCorrente + numDep);
|
||||||
|
|
||||||
|
if(isLayoutNovo) {
|
||||||
|
deposito.setTipoPagamentoTurismo("01");
|
||||||
|
deposito.setFormaPagamentoId("04");
|
||||||
|
deposito.setTipoDocumentoVenda("P");
|
||||||
|
}
|
||||||
|
|
||||||
depositos.add(deposito);
|
depositos.add(deposito);
|
||||||
soma = soma.add(rsFechamentos.getBigDecimal(1));
|
soma = soma.add(rsFechamentos.getBigDecimal(1));
|
||||||
}
|
}
|
||||||
|
@ -1119,6 +1155,33 @@ public class Totalbus {
|
||||||
return cal.getTime();
|
return cal.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String converteFormaPagamentoLayoutNovo(String formaPago) {
|
||||||
|
//lista de tipos: com.rjconsultores.ventaboletos.enums.TipoFormapago
|
||||||
|
if(formaPago == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer converted = new Integer( formaPago);
|
||||||
|
switch (converted) {
|
||||||
|
case 0:
|
||||||
|
return "01";
|
||||||
|
case 1:
|
||||||
|
return "03";
|
||||||
|
case 2:
|
||||||
|
return "03";
|
||||||
|
case 3:
|
||||||
|
return "05";
|
||||||
|
case 4:
|
||||||
|
return "05";
|
||||||
|
case 10:
|
||||||
|
return "02";
|
||||||
|
case 11:
|
||||||
|
return "04";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<PuntoVenta> getPontosVenda() {
|
public List<PuntoVenta> getPontosVenda() {
|
||||||
return pontosVenda;
|
return pontosVenda;
|
||||||
}
|
}
|
||||||
|
@ -1138,6 +1201,7 @@ public class Totalbus {
|
||||||
public void setIsReceitasDespesasComporte(Boolean isReceitasDespesasComporte) {
|
public void setIsReceitasDespesasComporte(Boolean isReceitasDespesasComporte) {
|
||||||
this.isReceitasDespesasComporte = isReceitasDespesasComporte;
|
this.isReceitasDespesasComporte = isReceitasDespesasComporte;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void amain(String[] args) {
|
public static void amain(String[] args) {
|
||||||
System.out.println(new BigDecimal("0").signum());
|
System.out.println(new BigDecimal("0").signum());
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class DespesaReceita {
|
||||||
protected String tipoPagamentoTurismo = " ";// 120 002 Numerico
|
protected String tipoPagamentoTurismo = " ";// 120 002 Numerico
|
||||||
protected String descricaoDetalhada = "";// 122 80 Alfanumerico
|
protected String descricaoDetalhada = "";// 122 80 Alfanumerico
|
||||||
protected final String documentoVenda = "000000";// 202 6 Numerico
|
protected final String documentoVenda = "000000";// 202 6 Numerico
|
||||||
protected final String tipoDocumentoVenda = " ";// 208 1 Alfanumerico
|
protected String tipoDocumentoVenda = " ";// 208 1 Alfanumerico
|
||||||
protected final String numerodocumentoCPG = "0000000000";// 209 10 Numerico
|
protected final String numerodocumentoCPG = "0000000000";// 209 10 Numerico
|
||||||
protected String formaPagamentoId = "0";// 218 Numerico
|
protected String formaPagamentoId = "0";// 218 Numerico
|
||||||
protected final String finalLinha = "*";// 239 1 Alfanumerico
|
protected final String finalLinha = "*";// 239 1 Alfanumerico
|
||||||
|
@ -78,7 +78,7 @@ public class DespesaReceita {
|
||||||
sb.append(StringUtils.leftPad(valorLancamento.trim(), 13, "0"));
|
sb.append(StringUtils.leftPad(valorLancamento.trim(), 13, "0"));
|
||||||
sb.append(StringUtils.rightPad("", 10, " "));
|
sb.append(StringUtils.rightPad("", 10, " "));
|
||||||
sb.append(StringUtils.rightPad(numeroReciboTurismo.trim(), 10, " "));
|
sb.append(StringUtils.rightPad(numeroReciboTurismo.trim(), 10, " "));
|
||||||
sb.append(StringUtils.leftPad(getFormaPagamentoTurismo().trim(), 2, "0"));
|
sb.append(StringUtils.leftPad(getFormaPagamentoId().trim(), 2, "0"));
|
||||||
sb.append(StringUtils.leftPad(getTipoPagamentoTurismo().trim(), 2, "0"));
|
sb.append(StringUtils.leftPad(getTipoPagamentoTurismo().trim(), 2, "0"));
|
||||||
sb.append(StringUtils.rightPad(StringUtils.isNotEmpty(descricaoDetalhada) ? truncStr(descricaoDetalhada, 100) : "", 100, " "));
|
sb.append(StringUtils.rightPad(StringUtils.isNotEmpty(descricaoDetalhada) ? truncStr(descricaoDetalhada, 100) : "", 100, " "));
|
||||||
sb.append(StringUtils.leftPad(documentoVenda.trim(), 6, "0"));
|
sb.append(StringUtils.leftPad(documentoVenda.trim(), 6, "0"));
|
||||||
|
@ -152,4 +152,12 @@ public class DespesaReceita {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTipoDocumentoVenda() {
|
||||||
|
return tipoDocumentoVenda;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoDocumentoVenda(String tipoDocumentoVenda) {
|
||||||
|
this.tipoDocumentoVenda = tipoDocumentoVenda;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue