0011103: ESPEC04 - 44482 - Nova forma de cobrança de taxa de embarque arquivo

fixes bug#0011103
dev:Valdir
qua:Renato

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@86217 d1611594-4594-4d17-8e1d-87c2c4800839
master
daniel.zauli 2018-10-16 19:08:42 +00:00
parent b7f48dbf20
commit 325823d280
5 changed files with 500 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package com.rjconsultores.ventaboletos.relatorios.utilitarios;
import java.math.BigDecimal;
import java.sql.Timestamp;
public class RelatorioTaxasLinhaBean {
@ -16,6 +17,21 @@ public class RelatorioTaxasLinhaBean {
protected String CIDADE_DESTINO;
protected String NOMBEMPRESA;
protected Integer empresaId;
protected Integer origenCorridaId;
protected Integer destinoCorridaId;
protected Timestamp fecHorSalidaCorrida;
protected Timestamp fecHorventa;
protected Timestamp fechaEmbarque;
protected Integer numfoliosistema;
protected Integer numfoliopreimpreso;
protected String numseriepreimpresa;
protected Integer numasiento;
protected BigDecimal precioPagado;
protected String categoria;
protected Integer desembarqueId;
protected Integer tipoServicioId;
protected String NOMBPUNTOVENTA;
protected BigDecimal EMBARQUE_VENDIDOS;
@ -105,5 +121,88 @@ public class RelatorioTaxasLinhaBean {
public void setSEGURO_VENDIDOS(BigDecimal sEGURO_VENDIDOS) {
SEGURO_VENDIDOS = sEGURO_VENDIDOS;
}
public Integer getEmpresaId() {
return empresaId;
}
public void setEmpresaId(Integer empresaId) {
this.empresaId = empresaId;
}
public Integer getOrigenCorridaId() {
return origenCorridaId;
}
public void setOrigenCorridaId(Integer origenCorridaId) {
this.origenCorridaId = origenCorridaId;
}
public Timestamp getFechaEmbarque() {
return fechaEmbarque;
}
public void setFechaEmbarque(Timestamp fechaEmbarque) {
this.fechaEmbarque = fechaEmbarque;
}
public Timestamp getFecHorventa() {
return fecHorventa;
}
public void setFecHorventa(Timestamp fecHorventa) {
this.fecHorventa = fecHorventa;
}
public Timestamp getFecHorSalidaCorrida() {
return fecHorSalidaCorrida;
}
public void setFecHorSalidaCorrida(Timestamp fecHorSalidaCorrida) {
this.fecHorSalidaCorrida = fecHorSalidaCorrida;
}
public Integer getNumfoliosistema() {
return numfoliosistema;
}
public void setNumfoliosistema(Integer numfoliosistema) {
this.numfoliosistema = numfoliosistema;
}
public String getNumseriepreimpresa() {
return numseriepreimpresa;
}
public void setNumseriepreimpresa(String numseriepreimpresa) {
this.numseriepreimpresa = numseriepreimpresa;
}
public Integer getNumasiento() {
return numasiento;
}
public void setNumasiento(Integer numasiento) {
this.numasiento = numasiento;
}
public BigDecimal getPrecioPagado() {
return precioPagado;
}
public void setPrecioPagado(BigDecimal precioPagado) {
this.precioPagado = precioPagado;
}
public String getCategoria() {
return categoria;
}
public void setCategoria(String categoria) {
this.categoria = categoria;
}
public Integer getTipoServicioId() {
return tipoServicioId;
}
public void setTipoServicioId(Integer tipoServicioId) {
this.tipoServicioId = tipoServicioId;
}
public Integer getDesembarqueId() {
return desembarqueId;
}
public void setDesembarqueId(Integer desembarqueId) {
this.desembarqueId = desembarqueId;
}
public Integer getDestinoCorridaId() {
return destinoCorridaId;
}
public void setDestinoCorridaId(Integer destinoCorridaId) {
this.destinoCorridaId = destinoCorridaId;
}
public Integer getNumfoliopreimpreso() {
return numfoliopreimpreso;
}
public void setNumfoliopreimpreso(Integer numfoliopreimpreso) {
this.numfoliopreimpreso = numfoliopreimpreso;
}
}

View File

@ -4,13 +4,23 @@
*/
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.activation.MimetypesFileTypeMap;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
@ -24,6 +34,7 @@ import org.zkoss.zul.Bandbox;
import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.ComboitemRenderer;
import org.zkoss.zul.Filedownload;
import org.zkoss.zul.Paging;
import org.zkoss.zul.Radiogroup;
@ -31,8 +42,14 @@ import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.Parada;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioTaxasLinha;
import com.rjconsultores.ventaboletos.relatorios.negocio.CalculoImposto;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioTaxasLinhaBean;
import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.service.ParadaService;
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.utilerias.StringHelper;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada;
@ -41,6 +58,7 @@ import com.rjconsultores.ventaboletos.web.utilerias.MyDatebox;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRelatorioTaxasLinhaPuntoVenta;
@ -79,6 +97,11 @@ public class RelatorioTaxasLinhaController extends MyGenericForwardComposer {
private Checkbox chkTaxaEmbarque;
private Checkbox chkTaxaPedagio;
private Checkbox chkTaxaSeguro;
@Autowired
private ParadaService paradaService;
private Boolean chkDownloadTxtVisible;
private Checkbox chkDownloadTxt;
private void executarPesquisa() {
HibernateSearchObject<PuntoVenta> puntoVentaBusqueda = new HibernateSearchObject<PuntoVenta>(PuntoVenta.class, pagingPuntoVenta.getPageSize());
@ -105,7 +128,7 @@ public class RelatorioTaxasLinhaController extends MyGenericForwardComposer {
@Override
public void doAfterCompose(Component comp) throws Exception {
lsEmpresa = empresaService.obtenerTodos();
chkDownloadTxtVisible = ApplicationProperties.getInstance().relatorioTaxasLinhaTxtDownloadVisible();
super.doAfterCompose(comp);
cmbParadaOrigemCve.setItemRenderer(new ComboitemRenderer() {
@ -233,6 +256,9 @@ public class RelatorioTaxasLinhaController extends MyGenericForwardComposer {
Connection connection = dataSourceRead.getConnection();
try {
if(chkDownloadTxt.isChecked())
exportarTxt(parametros, connection);
parametros.put("FILTROS", filtro.toString());
relatorio = new RelatorioTaxasLinha(parametros, connection);
@ -247,6 +273,96 @@ public class RelatorioTaxasLinhaController extends MyGenericForwardComposer {
}
}
}
private void exportarTxt(Map<String, Object> parametros, Connection conexao) throws Exception{
Calendar data = Calendar.getInstance();
FileInputStream inputStream;
Empresa e = new Empresa();
Comboitem itemEmpresa = cmbEmpresa.getSelectedItem();
if (itemEmpresa != null) {
e = (Empresa) itemEmpresa.getValue();
}
List<RelatorioTaxasLinhaBean> ls = relatorioComNaoPagantes(parametros, conexao);
StringBuffer nameDate = new StringBuffer();
nameDate.append(String.format("%08d",e.getEmpresaId())).append("_").append(data.get(Calendar.YEAR)).append(data.get(Calendar.MONTH))
.append(data.get(Calendar.DATE)).append("_").append(data.get(Calendar.HOUR_OF_DAY)).append(data.get(Calendar.MINUTE));
SimpleDateFormat formatador = new SimpleDateFormat("dd/MM/yyyy");
File filez = new File(nameDate+".txt");
FileWriter fw = new FileWriter(filez,false);
StringBuffer fileContent = new StringBuffer();
for(RelatorioTaxasLinhaBean i : ls){
fileContent.append(String.format("%07d",i.getOrigenCorridaId()));
fileContent.append(";");
fileContent.append(String.format("%07d",i.getDestinoCorridaId()));
fileContent.append(";");
fileContent.append((""+i.getFecHorSalidaCorrida()).substring(11, 16));
fileContent.append(";");
fileContent.append(formatador.format(i.getFecHorventa()));
fileContent.append(";");
fileContent.append(i.getFechaEmbarque() != null ? formatador.format(i.getFechaEmbarque()) : " " );
fileContent.append(";");
fileContent.append( i.getFechaEmbarque() != null ? (""+i.getFechaEmbarque()).substring(11, 16) : " ");
fileContent.append(";");
fileContent.append(i.getNumfoliopreimpreso() != null && !i.getNumfoliopreimpreso().equals("") ? String.format("%08d",i.getNumfoliopreimpreso()): " ");
fileContent.append(";");
fileContent.append(i.getNumseriepreimpresa() != null ? StringHelper.preencherStringDireita(i.getNumseriepreimpresa(), 10, " ") : " ");
fileContent.append(";");
fileContent.append(i.getNumasiento()!=null && !i.getNumasiento().equals("") ? String.format("%02d",i.getNumasiento()) : " ");
fileContent.append(";");
if(i.getPrecioPagado() != null && i.getPrecioPagado().doubleValue() > 0f){
fileContent.append("S");
}else{
fileContent.append("N");
}
fileContent.append(";");
if(i.getPrecioPagado() == null || i.getPrecioPagado().doubleValue() == 0f){
fileContent.append((StringHelper.preencherStringDireita(i.getCategoria(), 10, " ")).substring(0, 10));//10chars
}
fileContent.append(";");
fileContent.append(String.format("%07d",i.getDesembarqueId()));
fileContent.append(";");
if(i.getTipoServicioId() == 2){
fileContent.append("1");
}else{
fileContent.append("0");
}
fileContent.append(";");
fileContent.append("CR+LF");
fileContent.append("\r\n");
}
fw.write(fileContent.toString());
fw.close();
inputStream = new FileInputStream(filez);
Filedownload.save(inputStream, new MimetypesFileTypeMap().getContentType(filez), filez.getName());
}
public List<Empresa> getLsEmpresa() {
return lsEmpresa;
@ -278,4 +394,276 @@ public class RelatorioTaxasLinhaController extends MyGenericForwardComposer {
cmbParadaDestinoCve.setComboItemByParada((Parada) cmbParadaDestino.getSelectedItem().getValue());
}
}
public Boolean getChkDownloadTxtVisible() {
return chkDownloadTxtVisible;
}
public void setChkDownloadTxtVisible(Boolean chkDownloadTxtVisible) {
this.chkDownloadTxtVisible = chkDownloadTxtVisible;
}
public Checkbox getChkDownloadTxt() {
return chkDownloadTxt;
}
public void setChkDownloadTxt(Checkbox chkDownloadTxt) {
this.chkDownloadTxt = chkDownloadTxt;
}
public void onCheck$chkDownloadTxt() {
if (chkDownloadTxt.isChecked()) {
List<Parada> lsp = paradaService.buscaLike("PONTA GROSSA - PR");
cmbParadaOrigemCve.setComboItemByParada(lsp.get(0));
cmbParadaOrigem.setComboItemByParada(lsp.get(0));
cmbParadaOrigemCve.setDisabled(true);
cmbParadaOrigem.setDisabled(true);
}else{
cmbParadaOrigemCve.setDisabled(false);
cmbParadaOrigem.setDisabled(false);
}
}
private List<RelatorioTaxasLinhaBean> relatorioComNaoPagantes(Map<String, Object> parametros, Connection conexao)throws Exception {
String puntosVentaIds = (String) parametros.get("NUMPUNTOVENTA");
List<RelatorioTaxasLinhaBean> lsDadosRelatorio = new ArrayList<RelatorioTaxasLinhaBean>();
String sql = getSql(puntosVentaIds);
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
ResultSet rset1 = null;
stmt.setInt("TIPO_DATA", (Integer) parametros.get("TIPO_DATA"));
stmt.setTimestamp("DATA_INICIAL", new Timestamp(DateUtil.inicioFecha((Date) parametros.get("DATA_INICIAL")).getTime()));
stmt.setTimestamp("DATA_FINAL", new Timestamp(DateUtil.fimFecha((Date) parametros.get("DATA_FINAL")).getTime()));
if (parametros.get("EMPRESA_ID") != null)
stmt.setInt("EMPRESA_ID", (Integer) parametros.get("EMPRESA_ID"));
else
stmt.setNull("EMPRESA_ID", java.sql.Types.INTEGER);
if (parametros.get("ORIGEN_ID") != null && parametros.get("ORIGEN_ID") != "" && ((Integer) parametros.get("ORIGEN_ID") != -1))
stmt.setInt("ORIGEN_ID", (Integer) parametros.get("ORIGEN_ID"));
else
stmt.setNull("ORIGEN_ID", java.sql.Types.INTEGER);
if (parametros.get("DESTINO_ID") != null && parametros.get("DESTINO_ID") != "" && ((Integer) parametros.get("DESTINO_ID") != -1))
stmt.setInt("DESTINO_ID", (Integer) parametros.get("DESTINO_ID"));
else
stmt.setNull("DESTINO_ID", java.sql.Types.INTEGER);
rset1 = stmt.executeQuery();
while (rset1.next()) {
BigDecimal valorIcms;
// Se não for pra subtrair o ICMS, realiza o calculo e adiciona o mesmo
if(!(Boolean) parametros.get("B_SUBTRAIR_ICMS")){
valorIcms = BigDecimal.ZERO;
}else{
valorIcms = rset1.getBigDecimal("ICMS") == null ? BigDecimal.ZERO : rset1.getBigDecimal("ICMS");
}
String indInterestadual = rset1.getString("INTERESTADUAL");
Integer idEstado = rset1.getInt("ORIGEM_ESTADO_ID");
Integer empresaId = rset1.getInt("EMPRESA_ID");
BigDecimal importeTaxaEmbarque = rset1.getBigDecimal("IMPORTETAXAEMBARQUE") == null ? BigDecimal.ZERO : rset1.getBigDecimal("IMPORTETAXAEMBARQUE");
BigDecimal importePedagio = rset1.getBigDecimal("IMPORTEPEDAGIO") == null ? BigDecimal.ZERO : rset1.getBigDecimal("IMPORTEPEDAGIO");
BigDecimal importeSeguro = rset1.getBigDecimal("IMPORTESEGURO") == null ? BigDecimal.ZERO : rset1.getBigDecimal("IMPORTESEGURO");
BigDecimal totalEmbarque = rset1.getBigDecimal("TOTAL_EMBARQUE") == null ? BigDecimal.ZERO : rset1.getBigDecimal("TOTAL_EMBARQUE");
BigDecimal totalPedagio = rset1.getBigDecimal("TOTAL_PEDAGIO") == null ? BigDecimal.ZERO : rset1.getBigDecimal("TOTAL_PEDAGIO");
BigDecimal totalSeguro = rset1.getBigDecimal("TOTAL_SEGURO") == null ? BigDecimal.ZERO : rset1.getBigDecimal("TOTAL_SEGURO");
String prefixo = rset1.getString("PREFIXO") == null ? "" : rset1.getString("PREFIXO");
String cidadeOrigem = rset1.getString("CIDADE_ORIGEM") == null ? "" : rset1.getString("CIDADE_ORIGEM");
String cidadeDestino= rset1.getString("CIDADE_DESTINO") == null ? "" : rset1.getString("CIDADE_DESTINO");
String nombEmpresa = rset1.getString("NOMBEMPRESA") == null ? "" : rset1.getString("NOMBEMPRESA");
String nombPuntoVenta = rset1.getString("NOMBPUNTOVENTA") == null ? "" : rset1.getString("NOMBPUNTOVENTA");
BigDecimal embarque_vendidos = rset1.getBigDecimal("EMBARQUE_VENDIDOS") == null ? BigDecimal.ZERO : rset1.getBigDecimal("EMBARQUE_VENDIDOS");
BigDecimal pedagio_vendidos = rset1.getBigDecimal("PEDAGIO_VENDIDOS") == null ? BigDecimal.ZERO : rset1.getBigDecimal("PEDAGIO_VENDIDOS");
BigDecimal seguro_vendidos = rset1.getBigDecimal("SEGURO_VENDIDOS") == null ? BigDecimal.ZERO : rset1.getBigDecimal("SEGURO_VENDIDOS");
RelatorioTaxasLinhaBean taxasLinha = new RelatorioTaxasLinhaBean();
if(!importeTaxaEmbarque.equals(BigDecimal.ZERO) && (Boolean) parametros.get("B_SUBTRAIR_ICMS")){
valorIcms = CalculoImposto.getValorImposto(conexao, idEstado, empresaId, indInterestadual, BigDecimal.ZERO, BigDecimal.ZERO, importeTaxaEmbarque, BigDecimal.ZERO);
importeTaxaEmbarque = importeTaxaEmbarque.subtract(valorIcms);
}
taxasLinha.setIMPORTETAXAEMBARQUE(importeTaxaEmbarque);
if(!importePedagio.equals(BigDecimal.ZERO) && (Boolean) parametros.get("B_SUBTRAIR_ICMS")){
valorIcms = CalculoImposto.getValorImposto(conexao, idEstado, empresaId, indInterestadual, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, importePedagio);
importePedagio = importePedagio.subtract(valorIcms);
}
taxasLinha.setIMPORTEPEDAGIO(importePedagio);
if(!importeSeguro.equals(BigDecimal.ZERO) && (Boolean) parametros.get("B_SUBTRAIR_ICMS")){
valorIcms = CalculoImposto.getValorImposto(conexao, idEstado, empresaId, indInterestadual, BigDecimal.ZERO, importeSeguro, BigDecimal.ZERO, BigDecimal.ZERO);
importeSeguro = importeSeguro.subtract(valorIcms);
}
taxasLinha.setIMPORTESEGURO(importeSeguro);
if(!totalEmbarque.equals(BigDecimal.ZERO) && (Boolean) parametros.get("B_SUBTRAIR_ICMS")){
valorIcms = CalculoImposto.getValorImposto(conexao, idEstado, empresaId, indInterestadual, BigDecimal.ZERO, BigDecimal.ZERO, totalEmbarque , BigDecimal.ZERO);
totalEmbarque = totalEmbarque.subtract(valorIcms);
}
taxasLinha.setTOTAL_EMBARQUE(totalEmbarque);
if(!totalPedagio.equals(BigDecimal.ZERO) && (Boolean) parametros.get("B_SUBTRAIR_ICMS")){
valorIcms = CalculoImposto.getValorImposto(conexao, idEstado, empresaId, indInterestadual, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, totalPedagio);
totalPedagio = totalPedagio.subtract(valorIcms);
}
taxasLinha.setTOTAL_PEDAGIO(totalPedagio);
if(!totalSeguro.equals(BigDecimal.ZERO) && (Boolean)parametros.get("B_SUBTRAIR_ICMS")){
valorIcms = CalculoImposto.getValorImposto(conexao, idEstado, empresaId, indInterestadual, BigDecimal.ZERO, totalSeguro, BigDecimal.ZERO, BigDecimal.ZERO);
totalSeguro = totalSeguro.subtract(valorIcms);
}
taxasLinha.setTOTAL_SEGURO(totalSeguro);
taxasLinha.setPREFIXO(prefixo);
taxasLinha.setCIDADE_ORIGEM(cidadeOrigem);
taxasLinha.setCIDADE_DESTINO(cidadeDestino);
taxasLinha.setNOMBEMPRESA(nombEmpresa);
taxasLinha.setNOMBPUNTOVENTA(nombPuntoVenta);
taxasLinha.setEMBARQUE_VENDIDOS(embarque_vendidos);
taxasLinha.setPEDAGIO_VENDIDOS(pedagio_vendidos);
taxasLinha.setSEGURO_VENDIDOS(seguro_vendidos);
taxasLinha.setEmpresaId(empresaId);
taxasLinha.setOrigenCorridaId(rset1.getInt("origenCorridaId"));
taxasLinha.setDestinoCorridaId(rset1.getInt("destinoCorridaId"));
taxasLinha.setDesembarqueId(rset1.getInt("desembarqueId"));
taxasLinha.setFecHorventa(rset1.getTimestamp("FECHORVENTA"));
taxasLinha.setNumfoliosistema(rset1.getInt("numfoliosistema"));
taxasLinha.setNumseriepreimpresa(rset1.getString("NUMSERIEPREIMPRESA"));
taxasLinha.setNumfoliopreimpreso(rset1.getInt("NUMFOLIOPREIMPRESO"));
taxasLinha.setNumasiento(rset1.getInt("numasiento"));
taxasLinha.setPrecioPagado(rset1.getBigDecimal("PRECIOPAGADO"));
taxasLinha.setCategoria(rset1.getString("CATEGORIA"));
taxasLinha.setTipoServicioId(rset1.getInt("TIPOSERVICIO_ID"));
taxasLinha.setFecHorSalidaCorrida(rset1.getTimestamp("FECHORSALIDACORRIDA"));
taxasLinha.setFechaEmbarque(rset1.getTimestamp("FECHORVIAJE"));//FECHORVIAJE
lsDadosRelatorio.add(taxasLinha);
}
return lsDadosRelatorio;
}
private String getSql(String puntosVentaIds) {
StringBuilder sql = new StringBuilder();
sql.append(" SELECT RT.PREFIXO, ");
sql.append(" PO.DESCPARADA CIDADE_ORIGEM, ");
sql.append(" PD.DESCPARADA CIDADE_DESTINO, ");
sql.append(" CJ.IMPORTETAXAEMBARQUE, ");
sql.append(" CJ.IMPORTEPEDAGIO, ");
sql.append(" CJ.IMPORTESEGURO, ");
sql.append(" EM.NOMBEMPRESA, ");
sql.append(" EM.EMPRESA_ID, ");
sql.append(" CJ.PUNTOVENTA_ID, ");
sql.append(" PV.NOMBPUNTOVENTA, ");
sql.append(" SUM(CASE WHEN (CJ.IMPORTETAXAEMBARQUE>0 and cj.motivocancelacion_id is null ) THEN 1 WHEN (CJ.IMPORTETAXAEMBARQUE>0 and cj.motivocancelacion_id is not null ) then -1 ELSE 0 END) EMBARQUE_VENDIDOS, ");
sql.append(" SUM(CASE WHEN (CJ.IMPORTEPEDAGIO>0 and cj.motivocancelacion_id is null) THEN 1 WHEN (CJ.IMPORTEPEDAGIO>0 and cj.motivocancelacion_id is not null) THEN -1 ELSE 0 END) PEDAGIO_VENDIDOS, ");
sql.append(" SUM(CASE WHEN (CJ.IMPORTESEGURO>0 and cj.motivocancelacion_id is null) THEN 1 WHEN (CJ.IMPORTESEGURO>0 and cj.motivocancelacion_id is not null) THEN -1 ELSE 0 END) SEGURO_VENDIDOS, ");
sql.append(" CO.ESTADO_ID ORIGEM_ESTADO_ID, ");
sql.append(" CD.ESTADO_ID DESTINO_ESTADO_ID, ");
sql.append(" CASE ");
sql.append(" WHEN CO.ESTADO_ID <> CD.ESTADO_ID THEN ");
sql.append(" 'S' ");
sql.append(" ELSE ");
sql.append(" 'N' ");
sql.append(" END INTERESTADUAL, ");
sql.append(" SUM( (case when cj.motivocancelacion_id is null then 1 else -1 end) * CJ.IMPORTETAXAEMBARQUE) TOTAL_EMBARQUE, ");
sql.append(" SUM( (case when cj.motivocancelacion_id is null then 1 else -1 end) * CJ.IMPORTEPEDAGIO) TOTAL_PEDAGIO, ");
sql.append(" SUM( (case when cj.motivocancelacion_id is null then 1 else -1 end) * CJ.IMPORTESEGURO) TOTAL_SEGURO, ");
sql.append(" EST.ICMS AS ICMS, ");
sql.append(" POC.PARADA_id as origenCorridaId, ");
sql.append(" PDC.PARADA_id as destinoCorridaId, ");
sql.append(" PD.PARADA_id as desembarqueId, ");
sql.append(" CJ.FECHORVENTA as FECHORVENTA, ");
sql.append(" CJ.FECHORVIAJE as FECHORVIAJE, ");
sql.append(" CJ.NUMFOLIOSISTEMA as NUMFOLIOSISTEMA, ");
sql.append(" CJ.NUMSERIEPREIMPRESA as NUMSERIEPREIMPRESA, ");
sql.append(" CJ.NUMFOLIOPREIMPRESO as NUMFOLIOPREIMPRESO, ");
sql.append(" CJ.NUMASIENTO as NUMASIENTO, ");
sql.append(" CJ.PRECIOPAGADO as PRECIOPAGADO, ");
sql.append(" CAT.DESCCATEGORIA as CATEGORIA, ");
sql.append(" CR.TIPOSERVICIO_ID as TIPOSERVICIO_ID, ");
sql.append(" CR.FECHORSALIDA AS FECHORSALIDACORRIDA, ");
sql.append(" CT.FECHORLLEGADA AS FECHORLLEGADA, ");
sql.append(" CT.FECHORSALIDA AS FECHORSALIDATRAMO ");
sql.append("FROM CAJA CJ ");
sql.append("INNER JOIN PUNTO_VENTA PV ON CJ.PUNTOVENTA_ID = PV.PUNTOVENTA_ID ");
sql.append("INNER JOIN EMPRESA EM ON CJ.EMPRESACORRIDA_ID = EM.EMPRESA_ID ");
sql.append("INNER JOIN PARADA PO ON CJ.ORIGEN_ID = PO.PARADA_ID ");
sql.append("INNER JOIN PARADA PD ON CJ.DESTINO_ID = PD.PARADA_ID ");
sql.append("INNER JOIN CIUDAD CO ON PO.CIUDAD_ID = CO.CIUDAD_ID ");
sql.append("INNER JOIN ESTADO EST ON EST.ESTADO_ID = CO.estado_ID ");
sql.append("INNER JOIN CIUDAD CD ON PD.CIUDAD_ID = CD.CIUDAD_ID ");
sql.append("INNER JOIN CATEGORIA CAT ON CJ.CATEGORIA_ID = CAT.CATEGORIA_ID ");
sql.append("LEFT JOIN CORRIDA CR ON (CJ.CORRIDA_ID = CR.CORRIDA_ID AND CJ.FECCORRIDA = CR.FECCORRIDA) ");
sql.append("LEFT JOIN CORRIDA_TRAMO CT ON (CT.CORRIDA_ID = CR.CORRIDA_ID AND CT.FECCORRIDA = CR.FECCORRIDA AND CT.ORIGEN_ID = PO.PARADA_id AND CT.DESTINO_ID = PD.PARADA_id ) ");
sql.append("INNER JOIN PARADA POC ON CR.ORIGEN_ID = POC.PARADA_ID ");
sql.append("INNER JOIN PARADA PDC ON CR.DESTINO_ID = PDC.PARADA_ID ");
sql.append("LEFT JOIN RUTA RT ON RT.RUTA_ID = CR.RUTA_ID ");
sql.append("WHERE CJ.INDSTATUSOPERACION = 'F' ");
sql.append("AND CJ.INDREIMPRESION = 0 ");
sql.append("AND DECODE(:TIPO_DATA, 1, CJ.FECHORVENTA, 2, CJ.FECCORRIDA) BETWEEN :DATA_INICIAL AND :DATA_FINAL ");
sql.append("AND EM.EMPRESA_ID = NVL(:EMPRESA_ID, EM.EMPRESA_ID) ");
if (!puntosVentaIds.equals("Todas")) {
sql.append(" AND PV.PUNTOVENTA_ID IN (").append(puntosVentaIds).append(") ");
}
sql.append(" AND PO.PARADA_ID = NVL(:ORIGEN_ID, PO.PARADA_ID) ");
sql.append(" AND PD.PARADA_ID = NVL(:DESTINO_ID, PD.PARADA_ID) ");
sql.append(" GROUP BY RT.PREFIXO, ");
sql.append(" PO.DESCPARADA, ");
sql.append(" PD.DESCPARADA, ");
sql.append(" PD.PARADA_id, ");
sql.append(" CJ.IMPORTETAXAEMBARQUE, ");
sql.append(" CJ.IMPORTEPEDAGIO, ");
sql.append(" CJ.IMPORTESEGURO, ");
sql.append(" CO.ESTADO_ID, ");
sql.append(" CD.ESTADO_ID, ");
sql.append(" EM.NOMBEMPRESA, ");
sql.append(" EM.EMPRESA_ID, ");
sql.append(" CJ.PUNTOVENTA_ID, ");
sql.append(" PV.NOMBPUNTOVENTA, ");
sql.append(" EST.ICMS, ");
sql.append(" POC.PARADA_id, ");
sql.append(" PDC.PARADA_id, ");
sql.append(" CJ.FECHORVENTA, ");
sql.append(" CJ.NUMFOLIOSISTEMA, ");
sql.append(" CJ.NUMSERIEPREIMPRESA, ");
sql.append(" CJ.NUMFOLIOPREIMPRESO, ");
sql.append(" CJ.NUMASIENTO, ");
sql.append(" CJ.PRECIOPAGADO, ");
sql.append(" CAT.DESCCATEGORIA, ");
sql.append(" CR.TIPOSERVICIO_ID, ");
sql.append(" CR.FECHORSALIDA, ");
sql.append(" CJ.FECHORVIAJE, ");
sql.append(" CT.FECHORLLEGADA, ");
sql.append(" CT.FECHORSALIDA ");
sql.append(" ORDER BY EM.NOMBEMPRESA, PO.DESCPARADA, PD.DESCPARADA, PV.NOMBPUNTOVENTA ");
return sql.toString();
}
}

View File

@ -669,6 +669,7 @@ relatorioTaxasLinhaController.lbPuntoVenta.value = N. punto de venta
relatorioTaxasLinhaController.lbCidadaOrigem.value = Parada origen
relatorioTaxasLinhaController.lbCidadeDestino.value = Parada destino
relatorioTaxasLinhaController.lbPuntoVenta.value = Punto de venta
relatorioTaxasLinhaController.lbChkDownloadTxt.value = Exportar .txt
#Relatorio de Receita por servico
relatorioReceitaServicoController.window.title = Reporte de ingreso por servicio

View File

@ -714,6 +714,7 @@ relatorioTaxasLinhaController.lbPuntoVenta.value = Agência
relatorioTaxasLinhaController.lbChkTaxaEmbarque.value = Taxa de Embarque
relatorioTaxasLinhaController.lbChkTaxaPedagio.value = Pedagio
relatorioTaxasLinhaController.lbChkTaxaSeguro.value = Seguro
relatorioTaxasLinhaController.lbChkDownloadTxt.value = Exportar .txt
#Relatorio de Receita por servico
relatorioReceitaServicoController.window.title = Relatório de Receita por Serviço

View File

@ -125,6 +125,15 @@
</bandpopup>
</bandbox>
</row>
<row spans="1,1,2" visible="@{winFiltroRelatorioTaxasLinha$composer.chkDownloadTxtVisible}">
<label
value="${c:l('relatorioTaxasLinhaController.lbChkDownloadTxt.value')}" />
<cell colspan="3">
<checkbox id="chkDownloadTxt"
label="${c:l('relatorioTaxasLinhaController.lbChkDownloadTxt.value')}" />
</cell>
</row>
<row spans="5">
<listbox id="puntoVentaSelList" mold="paging"