daniel.zauli 2015-12-21 20:17:33 +00:00
parent bf3e4530a6
commit 63529372d7
12 changed files with 344 additions and 49 deletions

View File

@ -1,6 +1,7 @@
package com.rjconsultores.ventaboletos.relatorios.impl; package com.rjconsultores.ventaboletos.relatorios.impl;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@ -13,7 +14,6 @@ import org.apache.commons.lang.StringUtils;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Checkin; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Checkin;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
public class RelatorioCheckin extends Relatorio { public class RelatorioCheckin extends Relatorio {
@ -21,36 +21,50 @@ public class RelatorioCheckin extends Relatorio {
super(parametros, conexao); super(parametros, conexao);
} }
List<Integer> lsInt;
@Override @Override
protected void processaParametros() throws Exception { protected void processaParametros() throws Exception {
Integer corridaId = (Integer) getParametros().get("CORRIDA_ID"); Integer corridaId = (Integer) getParametros().get("CORRIDA_ID");
Integer origenId = (Integer) getParametros().get("ORIGEN_ID"); Integer origenId = (Integer) getParametros().get("ORIGEN_ID");
String nomeBilheteiro = (String) getParametros().get("NOME_BILHETEIRO"); String idsBilheteiros = (String) getParametros().get("IDS_BILHETEIROS");
Date fecInicio = (Date) getParametros().get("DATA_INICIAL"); Date fecInicio = (Date) getParametros().get("DATA_INICIAL");
Date fecFinal = (Date) getParametros().get("DATA_FINAL"); Date fecFinal = (Date) getParametros().get("DATA_FINAL");
String sql = getSql(corridaId, origenId, nomeBilheteiro); if (StringUtils.isNotBlank(idsBilheteiros)) {
String []ls = idsBilheteiros.split(",");
lsInt = new ArrayList<Integer>();
for(String i : ls){
lsInt.add(new Integer(Integer.parseInt(i.trim())));
}
}
NamedParameterStatement stmt = new NamedParameterStatement(getConexao(), sql); String sql = getSql(corridaId, origenId, idsBilheteiros);
stmt.setTimestamp("fecInicio", new java.sql.Timestamp(fecInicio.getTime()));
stmt.setTimestamp("fecFinal", new java.sql.Timestamp(fecFinal.getTime())); PreparedStatement pstmt = getConexao().prepareStatement(sql);
int index = 1;
pstmt.setTimestamp(index++, new java.sql.Timestamp(fecInicio.getTime()));
pstmt.setTimestamp(index++, new java.sql.Timestamp(fecFinal.getTime()));
if (corridaId != null) { if (corridaId != null) {
stmt.setInt("corridaId", corridaId); pstmt.setInt(index++, corridaId);
} }
if (origenId != null) { if (origenId != null) {
stmt.setInt("origenId", origenId); pstmt.setInt(index++, origenId);
} }
if (StringUtils.isNotBlank(nomeBilheteiro)) { if (StringUtils.isNotBlank(idsBilheteiros)) {
stmt.setString("nomeBilheteiro", nomeBilheteiro); for(int i = 0 ; i < lsInt.size() ; i++){
pstmt.setInt(index++, lsInt.get(i));//Object("idsBilheteiros", lsInt.toArray());
}
} }
List<Checkin> checkins = new ArrayList<Checkin>(); List<Checkin> checkins = new ArrayList<Checkin>();
ResultSet rset = stmt.executeQuery(); ResultSet rset = pstmt.executeQuery();
while (rset.next()) { while (rset.next()) {
Checkin checkin = new Checkin(); Checkin checkin = new Checkin();
@ -63,6 +77,7 @@ public class RelatorioCheckin extends Relatorio {
checkin.setDataCancelado(rset.getTimestamp("datacancelado")); checkin.setDataCancelado(rset.getTimestamp("datacancelado"));
checkin.setDataRemarcacao(rset.getTimestamp("dataremarcacao")); checkin.setDataRemarcacao(rset.getTimestamp("dataremarcacao"));
checkin.setNombUsuario(rset.getString("nombusuario")); checkin.setNombUsuario(rset.getString("nombusuario"));
checkin.setCveusuario(rset.getString("cveusuario"));
checkins.add(checkin); checkins.add(checkin);
} }
@ -74,24 +89,34 @@ public class RelatorioCheckin extends Relatorio {
this.setCollectionDataSource(new JRBeanCollectionDataSource(checkins)); this.setCollectionDataSource(new JRBeanCollectionDataSource(checkins));
} }
private String getSql(Integer corridaId, Integer origenId, String nomeBilheteiro) { private String getSql(Integer corridaId, Integer origenId, String idsBilheteiros) {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append("select b.boleto_id, o.descparada, b.corrida_id, "); sql.append("select b.boleto_id, o.descparada, b.corrida_id, ");
sql.append("case when b.numfoliosistema is not null "); sql.append("case when b.numfoliosistema is not null ");
sql.append(" then b.numfoliosistema else b.numoperacion end numoperacion, "); sql.append(" then b.numfoliosistema else b.numoperacion end numoperacion, ");
sql.append("b.feccorrida, bc.datavenda, bc.datacancelado, bc.dataremarcacao, u.nombusuario "); sql.append("b.feccorrida, bc.datavenda, bc.datacancelado, bc.dataremarcacao, u.nombusuario, u.cveusuario ");
sql.append("from boleto b "); sql.append("from boleto b ");
sql.append("inner join boleto_checkin bc on b.boletooriginal_id = bc.boletooriginal_id "); sql.append("inner join boleto_checkin bc on b.boletooriginal_id = bc.boletooriginal_id ");
sql.append("inner join parada o on b.origen_id = o.parada_id "); sql.append("inner join parada o on b.origen_id = o.parada_id ");
sql.append("inner join usuario u on b.usuario_id = u.usuario_id "); sql.append("inner join usuario u on b.usuario_id = u.usuario_id ");
sql.append(" where b.activo = 1 "); sql.append(" where b.activo = 1 ");
sql.append("and b.feccorrida between :fecInicio and :fecFinal "); sql.append("and b.feccorrida between ? and ? ");
sql.append(corridaId == null ? "" : " and b.corrida_id = :corridaId "); sql.append(corridaId == null ? "" : " and b.corrida_id = ? ");
sql.append(origenId == null ? "" : " and b.origen_id = :origenId "); sql.append(origenId == null ? "" : " and b.origen_id = ? ");
sql.append(StringUtils.isBlank(nomeBilheteiro) ? "" : " and u.nombusuario like :nomeBilheteiro "); sql.append((lsInt == null || lsInt.size() == 0) ? "" : " and u.USUARIO_ID in ( "+ createIn(lsInt.size()) + ") ");
return sql.toString(); return sql.toString();
} }
public String createIn(int n) {
if(n > 0){
String str = StringUtils.repeat(" ? ,", n);
return str.substring(0, str.length()-1);
}else{
return "";
}
}
} }

View File

@ -19,3 +19,4 @@ datail.data.servicio=Data do Servi
datail.data.checkin=Data Checkin datail.data.checkin=Data Checkin
datail.bilheteiro=Bilheteiro datail.bilheteiro=Bilheteiro
datail.data.remarcada=Data Remarcada datail.data.remarcada=Data Remarcada
datail.cveusuario=Login

View File

@ -19,3 +19,4 @@ datail.data.servicio=Data do Servi
datail.data.checkin=Data Checkin datail.data.checkin=Data Checkin
datail.bilheteiro=Bilheteiro datail.bilheteiro=Bilheteiro
datail.data.remarcada=Data Remarcada datail.data.remarcada=Data Remarcada
datail.cveusuario=Login

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="RelatorioCheckin" pageWidth="595" pageHeight="842" whenNoDataType="NoDataSection" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="48d32af4-ba9f-41c2-91a5-5d2fe57e149c"> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="RelatorioCheckin" pageWidth="675" pageHeight="842" whenNoDataType="NoDataSection" columnWidth="635" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="48d32af4-ba9f-41c2-91a5-5d2fe57e149c">
<property name="ireport.zoom" value="1.4641000000000008"/> <property name="ireport.zoom" value="1.4641000000000008"/>
<property name="ireport.x" value="72"/> <property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/> <property name="ireport.y" value="0"/>
<parameter name="NOME_RELATORIO" class="java.lang.String"/> <parameter name="NOME_RELATORIO" class="java.lang.String"/>
<parameter name="DATA_INICIAL" class="java.util.Date"/> <parameter name="DATA_INICIAL" class="java.util.Date"/>
<parameter name="DATA_FINAL" class="java.util.Date"/> <parameter name="DATA_FINAL" class="java.util.Date"/>
<parameter name="CORRIDA_ID" class="java.lang.Long"/> <parameter name="CORRIDA_ID" class="java.lang.Long"/>
<parameter name="ORIGEN" class="java.lang.String"/> <parameter name="ORIGEN" class="java.lang.String"/>
<parameter name="NOME_BILHETEIRO" class="java.lang.String"/> <parameter name="IDS_BILHETEIROS" class="java.lang.String"/>
<queryString> <queryString>
<![CDATA[]]> <![CDATA[]]>
</queryString> </queryString>
@ -21,13 +21,14 @@
<field name="dataCancelado" class="java.util.Date"/> <field name="dataCancelado" class="java.util.Date"/>
<field name="dataRemarcacao" class="java.util.Date"/> <field name="dataRemarcacao" class="java.util.Date"/>
<field name="nombUsuario" class="java.lang.String"/> <field name="nombUsuario" class="java.lang.String"/>
<field name="cveusuario" class="java.lang.String"/>
<background> <background>
<band splitType="Stretch"/> <band splitType="Stretch"/>
</background> </background>
<title> <title>
<band height="21" splitType="Stretch"> <band height="21" splitType="Stretch">
<textField pattern="" isBlankWhenNull="false"> <textField pattern="" isBlankWhenNull="false">
<reportElement mode="Transparent" x="0" y="0" width="338" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="5ee43799-932b-4ce1-8056-df380a9050a8"/> <reportElement uuid="5ee43799-932b-4ce1-8056-df380a9050a8" mode="Transparent" x="0" y="0" width="338" height="20" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none"> <textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/> <font fontName="SansSerif" size="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/> <paragraph lineSpacing="Single"/>
@ -35,7 +36,7 @@
<textFieldExpression><![CDATA[$P{NOME_RELATORIO}]]></textFieldExpression> <textFieldExpression><![CDATA[$P{NOME_RELATORIO}]]></textFieldExpression>
</textField> </textField>
<line> <line>
<reportElement x="0" y="20" width="555" height="1" uuid="b28df970-c219-4853-afeb-6821e0a44f04"/> <reportElement uuid="b28df970-c219-4853-afeb-6821e0a44f04" x="0" y="20" width="619" height="1"/>
</line> </line>
</band> </band>
</title> </title>
@ -45,110 +46,124 @@
<columnHeader> <columnHeader>
<band height="33" splitType="Stretch"> <band height="33" splitType="Stretch">
<textField> <textField>
<reportElement x="0" y="0" width="100" height="30" uuid="e4282770-fa67-4c58-a5aa-92e4d6f27166"/> <reportElement uuid="e4282770-fa67-4c58-a5aa-92e4d6f27166" x="0" y="0" width="100" height="30"/>
<textElement markup="none"> <textElement markup="none">
<font isBold="true"/> <font isBold="true"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$R{datail.voucher}]]></textFieldExpression> <textFieldExpression><![CDATA[$R{datail.voucher}]]></textFieldExpression>
</textField> </textField>
<textField> <textField>
<reportElement x="100" y="0" width="134" height="30" uuid="1e0b20c0-f208-4853-8601-73cec6e1992e"/> <reportElement uuid="1e0b20c0-f208-4853-8601-73cec6e1992e" x="100" y="0" width="134" height="30"/>
<textElement markup="none"> <textElement markup="none">
<font isBold="true"/> <font isBold="true"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$R{datail.origen}]]></textFieldExpression> <textFieldExpression><![CDATA[$R{datail.origen}]]></textFieldExpression>
</textField> </textField>
<textField> <textField>
<reportElement x="234" y="0" width="39" height="30" uuid="32e830a3-6303-465c-85aa-12678fe6b80a"/> <reportElement uuid="32e830a3-6303-465c-85aa-12678fe6b80a" x="234" y="0" width="39" height="30"/>
<textElement markup="none"> <textElement markup="none">
<font isBold="true"/> <font isBold="true"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$R{datail.servicio}]]></textFieldExpression> <textFieldExpression><![CDATA[$R{datail.servicio}]]></textFieldExpression>
</textField> </textField>
<textField> <textField>
<reportElement x="273" y="0" width="55" height="30" isPrintWhenDetailOverflows="true" uuid="a5ac8565-1ca0-425b-9d25-97d26753e7ec"/> <reportElement uuid="a5ac8565-1ca0-425b-9d25-97d26753e7ec" x="273" y="0" width="55" height="30" isPrintWhenDetailOverflows="true"/>
<textElement rotation="None" markup="none"> <textElement rotation="None" markup="none">
<font isBold="true" isUnderline="false"/> <font isBold="true" isUnderline="false"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$R{datail.data.servicio}]]></textFieldExpression> <textFieldExpression><![CDATA[$R{datail.data.servicio}]]></textFieldExpression>
</textField> </textField>
<textField> <textField>
<reportElement x="328" y="0" width="48" height="30" isPrintWhenDetailOverflows="true" uuid="d937b8b4-5e49-4d0d-a211-42e3d3fb45ba"/> <reportElement uuid="d937b8b4-5e49-4d0d-a211-42e3d3fb45ba" x="328" y="0" width="48" height="30" isPrintWhenDetailOverflows="true"/>
<textElement markup="none"> <textElement markup="none">
<font isBold="true"/> <font isBold="true"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$R{datail.data.checkin}]]></textFieldExpression> <textFieldExpression><![CDATA[$R{datail.data.checkin}]]></textFieldExpression>
</textField> </textField>
<textField> <textField>
<reportElement x="376" y="0" width="115" height="30" uuid="44e42972-eac1-40e6-ba0e-7c83b208d41b"/> <reportElement uuid="44e42972-eac1-40e6-ba0e-7c83b208d41b" x="376" y="0" width="115" height="30"/>
<textElement markup="none"> <textElement markup="none">
<font isBold="true"/> <font isBold="true"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$R{datail.bilheteiro}]]></textFieldExpression> <textFieldExpression><![CDATA[$R{datail.bilheteiro}]]></textFieldExpression>
</textField> </textField>
<textField> <textField>
<reportElement x="491" y="0" width="64" height="30" isPrintWhenDetailOverflows="true" uuid="29e15a6a-68ff-4f19-832f-ce0d7a7310ae"/> <reportElement uuid="29e15a6a-68ff-4f19-832f-ce0d7a7310ae" x="555" y="0" width="64" height="30" isPrintWhenDetailOverflows="true"/>
<textElement markup="none"> <textElement markup="none">
<font isBold="true"/> <font isBold="true"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$R{datail.data.remarcada}]]></textFieldExpression> <textFieldExpression><![CDATA[$R{datail.data.remarcada}]]></textFieldExpression>
</textField> </textField>
<line> <line>
<reportElement x="0" y="30" width="555" height="1" uuid="acc2f86e-4ee2-4e61-807f-27fd740db652"/> <reportElement uuid="acc2f86e-4ee2-4e61-807f-27fd740db652" x="0" y="30" width="619" height="1"/>
</line> </line>
<textField>
<reportElement uuid="28a7ce94-e2d1-4a68-a816-185b176ba0a8" x="491" y="0" width="64" height="30" isPrintWhenDetailOverflows="true"/>
<textElement markup="none">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{datail.cveusuario}]]></textFieldExpression>
</textField>
</band> </band>
</columnHeader> </columnHeader>
<detail> <detail>
<band height="23" splitType="Stretch"> <band height="23" splitType="Stretch">
<textField isBlankWhenNull="true"> <textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="100" height="20" uuid="82b42ca3-255a-4038-9730-35e2f9a1bb0f"/> <reportElement uuid="82b42ca3-255a-4038-9730-35e2f9a1bb0f" x="0" y="0" width="100" height="20"/>
<textElement> <textElement>
<font size="8"/> <font size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{numFolioSistema}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{numFolioSistema}]]></textFieldExpression>
</textField> </textField>
<textField isBlankWhenNull="true"> <textField isBlankWhenNull="true">
<reportElement x="100" y="0" width="134" height="20" uuid="c5cc5e04-b1fa-4ebc-b408-3810648fc7eb"/> <reportElement uuid="c5cc5e04-b1fa-4ebc-b408-3810648fc7eb" x="100" y="0" width="134" height="20"/>
<textElement> <textElement>
<font size="8"/> <font size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{origen}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{origen}]]></textFieldExpression>
</textField> </textField>
<textField isBlankWhenNull="true"> <textField isBlankWhenNull="true">
<reportElement x="234" y="0" width="39" height="20" uuid="d4baaf3d-a171-4b29-8aa8-cef5b56a11b3"/> <reportElement uuid="d4baaf3d-a171-4b29-8aa8-cef5b56a11b3" x="234" y="0" width="39" height="20"/>
<textElement> <textElement>
<font size="8"/> <font size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{corridaId}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{corridaId}]]></textFieldExpression>
</textField> </textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="true"> <textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
<reportElement x="273" y="0" width="55" height="20" uuid="acbbd64d-1fbd-4b4f-b7d5-5a11005ae98e"/> <reportElement uuid="acbbd64d-1fbd-4b4f-b7d5-5a11005ae98e" x="273" y="0" width="55" height="20"/>
<textElement> <textElement>
<font size="8"/> <font size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{feccorrida}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{feccorrida}]]></textFieldExpression>
</textField> </textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="true"> <textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
<reportElement x="328" y="0" width="48" height="20" uuid="1ce5d236-a684-450f-8e63-1523f0c7e103"/> <reportElement uuid="1ce5d236-a684-450f-8e63-1523f0c7e103" x="328" y="0" width="48" height="20"/>
<textElement> <textElement>
<font size="8"/> <font size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{dataVenda}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{dataVenda}]]></textFieldExpression>
</textField> </textField>
<textField isBlankWhenNull="true"> <textField isBlankWhenNull="true">
<reportElement x="376" y="0" width="115" height="20" uuid="64e2b043-f9cb-4211-852c-def2fed7ae2c"/> <reportElement uuid="64e2b043-f9cb-4211-852c-def2fed7ae2c" x="376" y="0" width="115" height="20"/>
<textElement> <textElement>
<font size="8"/> <font size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{nombUsuario}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{nombUsuario}]]></textFieldExpression>
</textField> </textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="true"> <textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
<reportElement x="491" y="0" width="64" height="20" uuid="648d03b0-ee8a-4b2f-af9f-c33c4d01f40e"/> <reportElement uuid="648d03b0-ee8a-4b2f-af9f-c33c4d01f40e" x="555" y="0" width="64" height="20"/>
<textElement> <textElement>
<font size="8"/> <font size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{dataRemarcacao}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{dataRemarcacao}]]></textFieldExpression>
</textField> </textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
<reportElement uuid="80c86e43-26cc-428c-b2e5-99d685118a06" x="491" y="0" width="64" height="20"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{cveusuario}]]></textFieldExpression>
</textField>
</band> </band>
</detail> </detail>
<columnFooter> <columnFooter>
@ -163,7 +178,7 @@
<noData> <noData>
<band height="38"> <band height="38">
<textField> <textField>
<reportElement x="15" y="11" width="530" height="20" uuid="c68d03cd-3b82-4f22-ba2a-6bb344fd3944"/> <reportElement uuid="c68d03cd-3b82-4f22-ba2a-6bb344fd3944" x="15" y="11" width="530" height="20"/>
<textElement markup="none"> <textElement markup="none">
<font size="11" isBold="true"/> <font size="11" isBold="true"/>
</textElement> </textElement>

View File

@ -13,6 +13,7 @@ public class Checkin {
private Date dataCancelado; private Date dataCancelado;
private Date dataRemarcacao; private Date dataRemarcacao;
private String nombUsuario; private String nombUsuario;
private String cveusuario;
public Long getBoletoId() { public Long getBoletoId() {
return boletoId; return boletoId;
@ -86,4 +87,12 @@ public class Checkin {
this.nombUsuario = nombUsuario; this.nombUsuario = nombUsuario;
} }
public String getCveusuario() {
return cveusuario;
}
public void setCveusuario(String cveusuario) {
this.cveusuario = cveusuario;
}
} }

View File

@ -1,6 +1,9 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios; package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import javax.sql.DataSource; import javax.sql.DataSource;
@ -12,18 +15,26 @@ import org.zkoss.util.resource.Labels;
import org.zkoss.zhtml.Messagebox; import org.zkoss.zhtml.Messagebox;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Bandbox;
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.Intbox; import org.zkoss.zul.Intbox;
import org.zkoss.zul.Paging;
import org.zkoss.zul.Textbox; import org.zkoss.zul.Textbox;
import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.Parada;
import com.rjconsultores.ventaboletos.entidad.Usuario;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioCheckin; import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioCheckin;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParadaCve; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParadaCve;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRelatorioCheckinUsuario;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRelatorioCheckinUsuariosSelecionados;
@Controller("relatorioCheckinController") @Controller("relatorioCheckinController")
@Scope("prototype") @Scope("prototype")
@ -34,7 +45,13 @@ public class RelatorioCheckinController extends MyGenericForwardComposer {
private Datebox datInicial; private Datebox datInicial;
private Datebox datFinal; private Datebox datFinal;
private Intbox txtCorridaId; private Intbox txtCorridaId;
private Textbox txtBilheteiro; private Bandbox bbPesquisaBilhetero;
private Paging pagingUsuario;
private Textbox txtPalavraPesquisa;
@Autowired
private transient PagedListWrapper<Usuario> plwUsuario;
private MyListbox usuarioList;
private MyListbox usuarioSelList;
private MyComboboxParada cmbParadaOrigem; private MyComboboxParada cmbParadaOrigem;
private MyComboboxParadaCve cmbParadaOrigemCve; private MyComboboxParadaCve cmbParadaOrigemCve;
@ -56,10 +73,47 @@ public class RelatorioCheckinController extends MyGenericForwardComposer {
cmbtm.setValue(parada); cmbtm.setValue(parada);
} }
}); });
usuarioList.setItemRenderer(new RenderRelatorioCheckinUsuario());
usuarioSelList.setItemRenderer(new RenderRelatorioCheckinUsuariosSelecionados());
}
public void onClick$btnPesquisa(Event ev) {
executarPesquisa();
}
public void onDoubleClick$usuarioList(Event ev) {
Usuario usuario = (Usuario) usuarioList.getSelected();
usuarioSelList.addItemNovo(usuario);
}
private void executarPesquisa() {
HibernateSearchObject<Usuario> usuarioBusqueda =
new HibernateSearchObject<Usuario>(Usuario.class, pagingUsuario.getPageSize());
usuarioBusqueda.addFilterLike("nombusuario", "%" + txtPalavraPesquisa.getValue() + "%");
usuarioBusqueda.addSortAsc("nombusuario");
usuarioBusqueda.addFilterEqual("activo", Boolean.TRUE);
plwUsuario.init(usuarioBusqueda, usuarioList, pagingUsuario);
if (usuarioList.getData().length == 0) {
try {
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
Labels.getLabel("indexController.mniRelatorioCheckin.label"),
Messagebox.OK, Messagebox.INFORMATION);
} catch (InterruptedException ex) {
}
}
} }
public void onClick$btnExecutarRelatorio(Event ev) throws Exception { public void onClick$btnExecutarRelatorio(Event ev) throws Exception {
List<Usuario> lsUsuariosSelecionados = new ArrayList(Arrays.asList(usuarioSelList.getData()));
Integer origenId = cmbParadaOrigemCve.getSelectedItem() == null ? null Integer origenId = cmbParadaOrigemCve.getSelectedItem() == null ? null
: ((Parada) cmbParadaOrigemCve.getSelectedItem().getValue()).getParadaId(); : ((Parada) cmbParadaOrigemCve.getSelectedItem().getValue()).getParadaId();
String origen = cmbParadaOrigemCve.getSelectedItem() == null ? null String origen = cmbParadaOrigemCve.getSelectedItem() == null ? null
@ -75,13 +129,25 @@ public class RelatorioCheckinController extends MyGenericForwardComposer {
Map<String, Object> parametros = new HashMap<String, Object>(); Map<String, Object> parametros = new HashMap<String, Object>();
parametros.put("CORRIDA_ID", txtCorridaId.getValue()); parametros.put("CORRIDA_ID", txtCorridaId.getValue());
parametros.put("NOME_BILHETEIRO", txtBilheteiro.getValue());
parametros.put("DATA_INICIAL", datInicial.getValue()); parametros.put("DATA_INICIAL", datInicial.getValue());
parametros.put("DATA_FINAL", datFinal.getValue()); parametros.put("DATA_FINAL", datFinal.getValue());
parametros.put("ORIGEN_ID", origenId); parametros.put("ORIGEN_ID", origenId);
parametros.put("ORIGEN", origen); parametros.put("ORIGEN", origen);
parametros.put("NOME_RELATORIO", Labels.getLabel("indexController.mniRelatorioCheckin.label")); parametros.put("NOME_RELATORIO", Labels.getLabel("indexController.mniRelatorioCheckin.label"));
String usuariosIds = "";
for (int i = 0; i < lsUsuariosSelecionados.size(); i++) {
Usuario usuario = lsUsuariosSelecionados.get(i);
if(i == 0){
usuariosIds = usuariosIds + " " + usuario.getUsuarioId();
}else{
usuariosIds = usuariosIds + "," + usuario.getUsuarioId();
}
}
parametros.put("IDS_BILHETEIROS", usuariosIds);
Relatorio relatorio = new RelatorioCheckin(parametros, dataSourceRead.getConnection()); Relatorio relatorio = new RelatorioCheckin(parametros, dataSourceRead.getConnection());
Map<String, Object> args = new HashMap<String, Object>(); Map<String, Object> args = new HashMap<String, Object>();
@ -102,4 +168,28 @@ public class RelatorioCheckinController extends MyGenericForwardComposer {
cmbParadaOrigemCve.setComboItemByParada((Parada) cmbParadaOrigem.getSelectedItem().getValue()); cmbParadaOrigemCve.setComboItemByParada((Parada) cmbParadaOrigem.getSelectedItem().getValue());
} }
public void onClick$btnLimpar(Event ev) {
limparPesquisa();
}
private void limparPesquisa() {
usuarioList.setData(new ArrayList<Usuario>());
bbPesquisaBilhetero.setText(getDescBilheteirosSelecionados());
}
@SuppressWarnings({ "unchecked", "rawtypes" })
private String getDescBilheteirosSelecionados() {
List<Usuario> lsUsuariosSelecionados = new ArrayList(Arrays.asList(usuarioSelList.getData()));
StringBuilder selecionados = new StringBuilder("");
if (!lsUsuariosSelecionados.isEmpty()) {
for (Usuario usuario : lsUsuariosSelecionados) {
selecionados.append(usuario.getNombusuario()).append(", ");
}
}
txtPalavraPesquisa.setText("");
return selecionados.toString();
}
} }

View File

@ -0,0 +1,51 @@
package com.rjconsultores.ventaboletos.web.utilerias.render;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Button;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;
import com.rjconsultores.ventaboletos.entidad.Ruta;
import com.rjconsultores.ventaboletos.entidad.Usuario;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
public class RenderRelatorioCheckinUsuario implements ListitemRenderer {
public void render(Listitem lstm, Object o) throws Exception {
Usuario usuario = (Usuario) o;
Listcell lc = new Listcell(usuario.getUsuarioId().toString());
lc.setParent(lstm);
lc = new Listcell(usuario.getClaveUsuario());
lc.setParent(lstm);
lc = new Listcell(usuario.getNombusuario());
lc.setParent(lstm);
Button btn = new Button();
lc = new Listcell();
lc.setParent(lstm);
btn.setWidth("16");
btn.setHeight("16");
btn.setImage("/gui/img/remove.png");
btn.addEventListener("onClick", new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
MyListbox listBox = (MyListbox) event.getTarget().getParent().getParent().getParent();
Listitem listItem = (Listitem) event.getTarget().getParent().getParent();
listBox.removeItem((Ruta) listItem.getAttribute("data"));
}
});
lc.appendChild(btn);
lstm.setAttribute("data", usuario);
}
}

View File

@ -0,0 +1,46 @@
package com.rjconsultores.ventaboletos.web.utilerias.render;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Button;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;
import com.rjconsultores.ventaboletos.entidad.Usuario;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
public class RenderRelatorioCheckinUsuariosSelecionados implements ListitemRenderer {
public void render(Listitem lstm, Object o) throws Exception {
Usuario usuario = (Usuario) o;
Listcell lc = new Listcell(usuario.getClaveUsuario().toString());
lc.setParent(lstm);
lc = new Listcell(usuario.getNombusuario());
lc.setParent(lstm);
Button btn = new Button();
lc = new Listcell();
lc.setParent(lstm);
btn.setWidth("16");
btn.setHeight("16");
btn.setImage("/gui/img/remove.png");
btn.addEventListener("onClick", new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
MyListbox listBox = (MyListbox) event.getTarget().getParent().getParent().getParent();
Listitem listItem = (Listitem) event.getTarget().getParent().getParent();
listBox.removeItem((Usuario) listItem.getAttribute("data"));
}
});
lc.appendChild(btn);
lstm.setAttribute("data", usuario);
}
}

View File

@ -5398,6 +5398,10 @@ relatorioOrigemDestinoController.MSG.trechoSemMovimento = Para exibir tramos sin
# Relatorio Checkin # Relatorio Checkin
relatorioCheckinController.lbBilheteiro.label = Asesor relatorioCheckinController.lbBilheteiro.label = Asesor
relatorioCheckinController.MSG.erroPeriodo = Los campos Fecha de inicio y Fecha de finalización deben ser completado relatorioCheckinController.MSG.erroPeriodo = Los campos Fecha de inicio y Fecha de finalización deben ser completado
relatorioCheckinController.btnPesquisa.label = Buscar
relatorioCheckinController.btnLimpar.label = Limpiar
relatorioCheckinController.usuarioCVE.label = CVE
relatorioCheckinController.usuarioNome.label = Nome
# Editar Conexion # Editar Conexion
#busquedaConexionController.btnNovo.tooltiptext = Nuevo #busquedaConexionController.btnNovo.tooltiptext = Nuevo

View File

@ -5474,6 +5474,10 @@ relatorioOrigemDestinoController.MSG.trechoSemMovimento = Para exibir trechos se
# Relatorio Checkin # Relatorio Checkin
relatorioCheckinController.lbBilheteiro.label = Bilheteiro relatorioCheckinController.lbBilheteiro.label = Bilheteiro
relatorioCheckinController.MSG.erroPeriodo = Os campos Data Inicial e Data Final devem ser preenchidos relatorioCheckinController.MSG.erroPeriodo = Os campos Data Inicial e Data Final devem ser preenchidos
relatorioCheckinController.btnPesquisa.label = Buscar
relatorioCheckinController.btnLimpar.label = Limpar
relatorioCheckinController.usuarioCVE.label = CVE
relatorioCheckinController.usuarioNome.label = Nome
# Editar Conexion # Editar Conexion
#busquedaConexionController.btnNovo.tooltiptext = Novo #busquedaConexionController.btnNovo.tooltiptext = Novo

View File

@ -56,11 +56,60 @@
</row> </row>
<row> <row>
<label id="lbBilheteiro" <label
value="${c:l('relatorioCheckinController.lbBilheteiro.label')}" /> value="${c:l('relatorioCheckinController.lbBilheteiro.label')}" />
<textbox id="txtBilheteiro" width="99%" <vbox>
maxlength="50" <bandbox id="bbPesquisaBilhetero" width="100%"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox" /> mold="rounded" readonly="true">
<bandpopup>
<vbox>
<hbox>
<label
value="${c:l('relatorioCheckinController.lbBilheteiro.label')}" />
<textbox id="txtPalavraPesquisa"
width="250px"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox" />
<button id="btnPesquisa"
image="/gui/img/find.png"
label="${c:l('relatorioCheckinController.btnPesquisa.label')}" />
<button id="btnLimpar"
image="/gui/img/eraser.png"
label="${c:l('relatorioCheckinController.btnLimpar.label')}" />
</hbox>
<paging id="pagingUsuario"
pageSize="20" />
<listbox id="usuarioList" mold="paging"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" height="100%" width="500px">
<listhead>
<listheader
label="${c:l('lb.id')}" width="30%" />
<listheader
label="${c:l('relatorioCheckinController.usuarioCVE.label')}"
width="30%" />
<listheader
label="${c:l('relatorioCheckinController.usuarioNome.label')}" width="60%" />
</listhead>
</listbox>
</vbox>
</bandpopup>
</bandbox>
<listbox id="usuarioSelList" mold="paging"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" height="100px" width="100%">
<listhead>
<listheader label="${c:l('relatorioCheckinController.usuarioCVE.label')}"
width="30%" />
<listheader label="${c:l('relatorioCheckinController.usuarioNome.label')}"
width="60%" />
<listheader width="10%" />
</listhead>
</listbox>
<paging id="pagingSelUsuario" pageSize="10" />
</vbox>
</row> </row>
</rows> </rows>