fixes bug #8086
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@61437 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
d46eb28e7d
commit
5eb39c958b
|
@ -25,6 +25,9 @@ public class RelatorioVendasPacotesBoletos extends Relatorio {
|
||||||
|
|
||||||
private static Logger log = Logger.getLogger(RelatorioVendasPacotesBoletos.class);
|
private static Logger log = Logger.getLogger(RelatorioVendasPacotesBoletos.class);
|
||||||
|
|
||||||
|
public static final Integer VENDIDOS = 1;
|
||||||
|
public static final Integer CANCELADOS = 0;
|
||||||
|
|
||||||
private SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
private SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
||||||
|
|
||||||
private List<RelatorioVendasPacotesBoletosBean> lsDadosRelatorio;
|
private List<RelatorioVendasPacotesBoletosBean> lsDadosRelatorio;
|
||||||
|
@ -38,6 +41,7 @@ public class RelatorioVendasPacotesBoletos extends Relatorio {
|
||||||
private Integer destinoId;
|
private Integer destinoId;
|
||||||
private Integer usuarioId;
|
private Integer usuarioId;
|
||||||
private Integer tipoTarifaPacoteId;
|
private Integer tipoTarifaPacoteId;
|
||||||
|
private Integer situacaoBilheteId;
|
||||||
|
|
||||||
public RelatorioVendasPacotesBoletos(Map<String, Object> parametros, Connection conexao, final String... nomeSubReporte) throws Exception {
|
public RelatorioVendasPacotesBoletos(Map<String, Object> parametros, Connection conexao, final String... nomeSubReporte) throws Exception {
|
||||||
super(parametros, conexao);
|
super(parametros, conexao);
|
||||||
|
@ -57,11 +61,17 @@ public class RelatorioVendasPacotesBoletos extends Relatorio {
|
||||||
destinoId = parametros.get("destinoId") != null && !parametros.get("destinoId").equals("null") ? Integer.valueOf(parametros.get("destinoId").toString()) : null;
|
destinoId = parametros.get("destinoId") != null && !parametros.get("destinoId").equals("null") ? Integer.valueOf(parametros.get("destinoId").toString()) : null;
|
||||||
usuarioId = parametros.get("usuarioId") != null && !parametros.get("usuarioId").equals("null") ? Integer.valueOf(parametros.get("usuarioId").toString()) : null;
|
usuarioId = parametros.get("usuarioId") != null && !parametros.get("usuarioId").equals("null") ? Integer.valueOf(parametros.get("usuarioId").toString()) : null;
|
||||||
tipoTarifaPacoteId = parametros.get("tipoTarifaPacoteId") != null && !parametros.get("tipoTarifaPacoteId").equals("null") ? Integer.valueOf(parametros.get("tipoTarifaPacoteId").toString()) : null;
|
tipoTarifaPacoteId = parametros.get("tipoTarifaPacoteId") != null && !parametros.get("tipoTarifaPacoteId").equals("null") ? Integer.valueOf(parametros.get("tipoTarifaPacoteId").toString()) : null;
|
||||||
|
situacaoBilheteId = parametros.get("situacaoBilheteId") != null && !parametros.get("situacaoBilheteId").equals("null") ? Integer.valueOf(parametros.get("situacaoBilheteId").toString()) : null;
|
||||||
|
|
||||||
Connection conexao = this.relatorio.getConexao();
|
Connection conexao = this.relatorio.getConexao();
|
||||||
processarVendasPacote(conexao);
|
processarVendasPacote(conexao);
|
||||||
processarVendasAvulsas(conexao);
|
|
||||||
processarVendasAvulsasCancelados(conexao);
|
if(situacaoBilheteId == null || !CANCELADOS.equals(situacaoBilheteId)) {
|
||||||
|
processarVendasAvulsas(conexao);
|
||||||
|
}
|
||||||
|
if(situacaoBilheteId == null || CANCELADOS.equals(situacaoBilheteId)) {
|
||||||
|
processarVendasAvulsasCancelados(conexao);
|
||||||
|
}
|
||||||
processarVendasPacoteTotais();
|
processarVendasPacoteTotais();
|
||||||
|
|
||||||
setNomeSubReporte(nomeSubReporte);
|
setNomeSubReporte(nomeSubReporte);
|
||||||
|
@ -76,7 +86,7 @@ public class RelatorioVendasPacotesBoletos extends Relatorio {
|
||||||
NamedParameterStatement stmt = null;
|
NamedParameterStatement stmt = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
stmt = carregarNamedParameterStatementVendasPacotes(conexao, false);
|
stmt = carregarNamedParameterStatementVendasPacotes(conexao);
|
||||||
rset = stmt.executeQuery();
|
rset = stmt.executeQuery();
|
||||||
|
|
||||||
if(lsDadosRelatorio == null) {
|
if(lsDadosRelatorio == null) {
|
||||||
|
@ -162,8 +172,8 @@ public class RelatorioVendasPacotesBoletos extends Relatorio {
|
||||||
return relatorioVendasPacotesBoletosBean;
|
return relatorioVendasPacotesBoletosBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
private NamedParameterStatement carregarNamedParameterStatementVendasPacotes(Connection conexao, boolean cancelados) throws SQLException {
|
private NamedParameterStatement carregarNamedParameterStatementVendasPacotes(Connection conexao) throws SQLException {
|
||||||
String sql = getSqlVendasPacotes(cancelados);
|
String sql = getSqlVendasPacotes();
|
||||||
log.info(sql);
|
log.info(sql);
|
||||||
|
|
||||||
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
|
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
|
||||||
|
@ -195,11 +205,14 @@ public class RelatorioVendasPacotesBoletos extends Relatorio {
|
||||||
if(tipoTarifaPacoteId != null && tipoTarifaPacoteId > 0) {
|
if(tipoTarifaPacoteId != null && tipoTarifaPacoteId > 0) {
|
||||||
stmt.setInt("tipoTarifaPacoteId", tipoTarifaPacoteId);
|
stmt.setInt("tipoTarifaPacoteId", tipoTarifaPacoteId);
|
||||||
}
|
}
|
||||||
|
if(situacaoBilheteId != null) {
|
||||||
|
stmt.setInt("situacaoPacote",SituacaoVendaPacote.CANCELADO.getShortValue());
|
||||||
|
}
|
||||||
|
|
||||||
return stmt;
|
return stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getSqlVendasPacotes(boolean cancelado) {
|
protected String getSqlVendasPacotes() {
|
||||||
StringBuilder sQuery = new StringBuilder();
|
StringBuilder sQuery = new StringBuilder();
|
||||||
|
|
||||||
sQuery.append("SELECT DES.CVEPARADA AS CVEDESTINO, ORI.CVEPARADA AS CVEORIGEM, ORI.DESCPARADA AS ORIGEM, DES.DESCPARADA AS DESTINO, R.NUMRUTA, R.DESCRUTA, PC.NOMCONVENIO, TTP.DESCTIPOTARIFA, VP.SITUACAO, ")
|
sQuery.append("SELECT DES.CVEPARADA AS CVEDESTINO, ORI.CVEPARADA AS CVEORIGEM, ORI.DESCPARADA AS ORIGEM, DES.DESCPARADA AS DESTINO, R.NUMRUTA, R.DESCRUTA, PC.NOMCONVENIO, TTP.DESCTIPOTARIFA, VP.SITUACAO, ")
|
||||||
|
@ -255,6 +268,17 @@ public class RelatorioVendasPacotesBoletos extends Relatorio {
|
||||||
sQuery.append("AND TTP.TIPOTARIFAPACOTE_ID = :tipoTarifaPacoteId ");
|
sQuery.append("AND TTP.TIPOTARIFAPACOTE_ID = :tipoTarifaPacoteId ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(situacaoBilheteId != null) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if(situacaoBilheteId != null && !CANCELADOS.equals(situacaoBilheteId)) {
|
||||||
|
sQuery.append("AND VP.SITUACAO <> :situacaoPacote ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(situacaoBilheteId != null && CANCELADOS.equals(situacaoBilheteId)) {
|
||||||
|
sQuery.append("AND VP.SITUACAO = :situacaoPacote ");
|
||||||
|
}
|
||||||
|
|
||||||
sQuery.append("GROUP BY DES.CVEPARADA, ORI.CVEPARADA, ORI.DESCPARADA, DES.DESCPARADA, R.NUMRUTA, R.DESCRUTA, PC.NOMCONVENIO, TTP.DESCTIPOTARIFA, VP.SITUACAO, 'PACOTE' ")
|
sQuery.append("GROUP BY DES.CVEPARADA, ORI.CVEPARADA, ORI.DESCPARADA, DES.DESCPARADA, R.NUMRUTA, R.DESCRUTA, PC.NOMCONVENIO, TTP.DESCTIPOTARIFA, VP.SITUACAO, 'PACOTE' ")
|
||||||
.append("ORDER BY DES.CVEPARADA, ORI.CVEPARADA, ORI.DESCPARADA, DES.DESCPARADA, R.NUMRUTA, R.DESCRUTA, PC.NOMCONVENIO, TTP.DESCTIPOTARIFA, VP.SITUACAO, 'PACOTE' ");
|
.append("ORDER BY DES.CVEPARADA, ORI.CVEPARADA, ORI.DESCPARADA, DES.DESCPARADA, R.NUMRUTA, R.DESCRUTA, PC.NOMCONVENIO, TTP.DESCTIPOTARIFA, VP.SITUACAO, 'PACOTE' ");
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ cabecalho.origem=Origem:
|
||||||
cabecalho.destino=Destino:
|
cabecalho.destino=Destino:
|
||||||
cabecalho.usuario=Usuário:
|
cabecalho.usuario=Usuário:
|
||||||
cabecalho.tipoTarifaPacote=Tipo Tarifa:
|
cabecalho.tipoTarifaPacote=Tipo Tarifa:
|
||||||
|
cabecalho.situacaoBilhete=Situação:
|
||||||
label.empresa=Empresa:
|
label.empresa=Empresa:
|
||||||
label.trecho=Trecho:
|
label.trecho=Trecho:
|
||||||
label.cancelados = - CANCELADOS
|
label.cancelados = - CANCELADOS
|
||||||
|
|
|
@ -16,6 +16,7 @@ cabecalho.origem=Origem:
|
||||||
cabecalho.destino=Destino:
|
cabecalho.destino=Destino:
|
||||||
cabecalho.usuario=Usuário:
|
cabecalho.usuario=Usuário:
|
||||||
cabecalho.tipoTarifaPacote=Tipo Tarifa:
|
cabecalho.tipoTarifaPacote=Tipo Tarifa:
|
||||||
|
cabecalho.situacaoBilhete=Situação:
|
||||||
label.empresa=Empresa:
|
label.empresa=Empresa:
|
||||||
label.trecho=Trecho:
|
label.trecho=Trecho:
|
||||||
label.cancelados=- CANCELADOS
|
label.cancelados=- CANCELADOS
|
||||||
|
|
Binary file not shown.
|
@ -17,6 +17,7 @@
|
||||||
<parameter name="tipoTarifaPacote" class="java.lang.String"/>
|
<parameter name="tipoTarifaPacote" class="java.lang.String"/>
|
||||||
<parameter name="periodoPacote" class="java.lang.String"/>
|
<parameter name="periodoPacote" class="java.lang.String"/>
|
||||||
<parameter name="periodoVenda" class="java.lang.String"/>
|
<parameter name="periodoVenda" class="java.lang.String"/>
|
||||||
|
<parameter name="situacaoBilhete" class="java.lang.String"/>
|
||||||
<queryString>
|
<queryString>
|
||||||
<![CDATA[]]>
|
<![CDATA[]]>
|
||||||
</queryString>
|
</queryString>
|
||||||
|
@ -27,7 +28,7 @@
|
||||||
<band splitType="Stretch"/>
|
<band splitType="Stretch"/>
|
||||||
</background>
|
</background>
|
||||||
<title>
|
<title>
|
||||||
<band height="142" splitType="Stretch">
|
<band height="160" splitType="Stretch">
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement x="0" y="0" width="620" height="20" uuid="43b2c28d-4760-4890-b00d-25e931e79c74"/>
|
<reportElement x="0" y="0" width="620" height="20" uuid="43b2c28d-4760-4890-b00d-25e931e79c74"/>
|
||||||
<textElement markup="none">
|
<textElement markup="none">
|
||||||
|
@ -84,6 +85,13 @@
|
||||||
</textElement>
|
</textElement>
|
||||||
<textFieldExpression><![CDATA[$R{cabecalho.periodoPacote} + " " + $P{periodoPacote}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$R{cabecalho.periodoPacote} + " " + $P{periodoPacote}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
|
<textField>
|
||||||
|
<reportElement x="0" y="140" width="802" height="20" uuid="10191622-490c-4eb8-800c-efe85abed02b"/>
|
||||||
|
<textElement>
|
||||||
|
<font isBold="true"/>
|
||||||
|
</textElement>
|
||||||
|
<textFieldExpression><![CDATA[$R{cabecalho.situacaoBilhete} + " " + $P{situacaoBilhete}]]></textFieldExpression>
|
||||||
|
</textField>
|
||||||
</band>
|
</band>
|
||||||
</title>
|
</title>
|
||||||
<pageHeader>
|
<pageHeader>
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.zkoss.zk.ui.event.Event;
|
||||||
import org.zkoss.zul.Comboitem;
|
import org.zkoss.zul.Comboitem;
|
||||||
import org.zkoss.zul.ComboitemRenderer;
|
import org.zkoss.zul.ComboitemRenderer;
|
||||||
import org.zkoss.zul.Datebox;
|
import org.zkoss.zul.Datebox;
|
||||||
|
import org.zkoss.zul.Radio;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||||
|
@ -67,6 +68,9 @@ public class RelatorioVendasPacotesBoletosController extends MyGenericForwardCom
|
||||||
private MyComboboxParada cmbParadaDestino;
|
private MyComboboxParada cmbParadaDestino;
|
||||||
private MyComboboxParadaCve cmbParadaDestinoCve;
|
private MyComboboxParadaCve cmbParadaDestinoCve;
|
||||||
private MyComboboxUsuario cmbUsuario;
|
private MyComboboxUsuario cmbUsuario;
|
||||||
|
private Radio rTodos;
|
||||||
|
private Radio rVendidos;
|
||||||
|
private Radio rCancelados;
|
||||||
|
|
||||||
public List<Empresa> getLsEmpresa() {
|
public List<Empresa> getLsEmpresa() {
|
||||||
return lsEmpresa;
|
return lsEmpresa;
|
||||||
|
@ -189,6 +193,15 @@ public class RelatorioVendasPacotesBoletosController extends MyGenericForwardCom
|
||||||
parametros.put("tipoTarifaPacote", tipoTarifaPacote.getDesctipotarifa());
|
parametros.put("tipoTarifaPacote", tipoTarifaPacote.getDesctipotarifa());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parametros.put("situacaoBilhete", "Todos");
|
||||||
|
if(rVendidos.isChecked()) {
|
||||||
|
parametros.put("situacaoBilhete", "Vendidos");
|
||||||
|
parametros.put("situacaoBilheteId", RelatorioVendasPacotesBoletos.VENDIDOS);
|
||||||
|
} else if(rCancelados.isChecked()) {
|
||||||
|
parametros.put("situacaoBilhete", "Cancelados");
|
||||||
|
parametros.put("situacaoBilheteId", RelatorioVendasPacotesBoletos.CANCELADOS);
|
||||||
|
}
|
||||||
|
|
||||||
Relatorio relatorio = gerarRelatorioVendaPacotesBoletos(parametros);
|
Relatorio relatorio = gerarRelatorioVendaPacotesBoletos(parametros);
|
||||||
|
|
||||||
Map<String, Object> args = new HashMap<String, Object>();
|
Map<String, Object> args = new HashMap<String, Object>();
|
||||||
|
|
|
@ -92,6 +92,20 @@
|
||||||
format="dd/MM/yyyy" lenient="false"
|
format="dd/MM/yyyy" lenient="false"
|
||||||
maxlength="10" />
|
maxlength="10" />
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
|
<row spans="1,3">
|
||||||
|
<label
|
||||||
|
value="${c:l('relatorioVendasPacotesBoletosController.lbSituacaoBilhete.value')}" />
|
||||||
|
<radiogroup>
|
||||||
|
<radio id="rTodos"
|
||||||
|
label="${c:l('relatorioVendasPacotesBoletosController.lbSituacaoBilheteTodos.value')}"
|
||||||
|
checked="true"/>
|
||||||
|
<radio id="rVendidos"
|
||||||
|
label="${c:l('relatorioVendasPacotesBoletosController.lbSituacaoBilheteVendidos.value')}"/>
|
||||||
|
<radio id="rCancelados"
|
||||||
|
label="${c:l('relatorioVendasPacotesBoletosController.lbSituacaoBilheteCancelados.value')}"/>
|
||||||
|
</radiogroup>
|
||||||
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
<toolbar>
|
<toolbar>
|
||||||
|
|
Loading…
Reference in New Issue