diff --git a/pom.xml b/pom.xml index ce5cfaedc..1708ed6af 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 br.com.rjconsultores ventaboletosadm - 1.61.3 + 1.61.4 war diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioCheckinModoConsolidadoPorUsuario.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioCheckinModoConsolidadoPorUsuario.java new file mode 100644 index 000000000..915826469 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioCheckinModoConsolidadoPorUsuario.java @@ -0,0 +1,148 @@ +package com.rjconsultores.ventaboletos.relatorios.impl; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; + +import org.apache.commons.lang.StringUtils; + +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Checkin; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +public class RelatorioCheckinModoConsolidadoPorUsuario extends Relatorio { + + public RelatorioCheckinModoConsolidadoPorUsuario(Map parametros, Connection conexao) { + super(parametros, conexao); + } + + List lsInt; + + @Override + protected void processaParametros() throws Exception { + + Integer corridaId = (Integer) getParametros().get("CORRIDA_ID"); + Integer origenId = (Integer) getParametros().get("ORIGEN_ID"); + String idsBilheteiros = (String) getParametros().get("IDS_BILHETEIROS"); + Date fecInicio = (Date) getParametros().get("DATA_INICIAL"); + Date fecFinal = (Date) getParametros().get("DATA_FINAL"); + fecInicio = DateUtil.inicioFecha(fecInicio); + fecFinal = DateUtil.fimFecha(fecFinal); + + + if (StringUtils.isNotBlank(idsBilheteiros)) { + String []ls = idsBilheteiros.split(","); + lsInt = new ArrayList(); + for(String i : ls){ + lsInt.add(new Integer(Integer.parseInt(i.trim()))); + } + } + + String sql = getSql(corridaId, origenId, idsBilheteiros); + + 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) { + pstmt.setInt(index++, corridaId); + } + + if (origenId != null) { + pstmt.setInt(index++, origenId); + } + + if (StringUtils.isNotBlank(idsBilheteiros)) { + for(int i = 0 ; i < lsInt.size() ; i++){ + pstmt.setInt(index++, lsInt.get(i));//Object("idsBilheteiros", lsInt.toArray()); + } + } + + List checkins = new ArrayList(); + + ResultSet rset = pstmt.executeQuery(); + while (rset.next()) { + + Checkin checkin = new Checkin(); + checkin.setBoletoId(rset.getLong("boleto_Id")); + checkin.setNumFolioSistema(rset.getString("numoperacion")); + checkin.setOrigen(rset.getString("descparada")); + checkin.setCorridaId(rset.getInt("corrida_id")); + checkin.setFeccorrida(rset.getTimestamp("feccorrida")); + checkin.setDataVenda(rset.getTimestamp("datavenda")); + checkin.setDataCancelado(rset.getTimestamp("datacancelado")); + checkin.setDataRemarcacao(rset.getTimestamp("dataremarcacao")); + checkin.setNombUsuario(rset.getString("nombusuario")); + checkin.setCveusuario(rset.getString("cveusuario")); + checkin.setUsuariovenda(rset.getString("usuariovenda")); + checkin.setUsuarioNowShow(rset.getString("usuarioNowShow")); + checkin.setUsuariocheckin(rset.getString("usuariocheckin")); + + checkins.add(checkin); + } + + setLsDadosRelatorio(checkins); + } + + public void setLsDadosRelatorio(List checkins) { + this.setCollectionDataSource(new JRBeanCollectionDataSource(checkins)); + } + + private String getSql(Integer corridaId, Integer origenId, String idsBilheteiros) { + + StringBuffer sql = new StringBuffer(); + sql.append("select b.boleto_id, o.descparada, b.corrida_id, "); + sql.append(" case when b.numfoliosistema is not null "); + sql.append(" then b.numfoliosistema else b.numoperacion "); + sql.append(" end numoperacion, "); + sql.append(" b.feccorrida, "); + sql.append(" bc.datavenda, "); + sql.append(" bc.datacancelado, "); + sql.append(" bc.dataremarcacao, "); + sql.append(" u.cveusuario as usuariovenda, "); + sql.append(" uc.cveusuario as usuarioNowShow, "); + sql.append(" case when uca.cveusuario is not null then uca.cveusuario else ucr.cveusuario end as usuariocheckin, "); + sql.append(" u.cveusuario, "); + sql.append(" u.nombusuario "); + sql.append(" from boleto b left join boleto_checkin bc on (b.boleto_id = bc.boletooriginal_id) "); + sql.append(" inner join parada o on b.origen_id = o.parada_id "); + sql.append(" left join checkin_automatico ca on (ca.boleto_id = b.boleto_id)"); + sql.append(" left join checkin_cerrado cc on (cc.feccorrida = b.feccorrida and "); + sql.append(" cc.corrida_id = b.corrida_id and "); + sql.append(" cc.origen_id = b.origen_id) "); + //sql.append(" and cc.destino_id = b.destino_id) "); + sql.append(" left join usuario u on (u.usuario_id = b.usuario_id)"); + sql.append(" left join usuario uc on (uc.usuario_id = bc.usuario_id)"); + sql.append(" left join usuario uca on (uca.usuario_id = ca.usuario_id)"); + sql.append(" left join usuario ucr on (ucr.usuario_id = cc.usuario_id)"); + sql.append(""); + sql.append(" where b.activo = 1 "); + sql.append("and bc.FECMODIF between ? and ? "); + sql.append(corridaId == null ? "" : " and b.corrida_id = ? "); + sql.append(origenId == null ? "" : " and b.origen_id = ? "); + sql.append((lsInt == null || lsInt.size() == 0) ? "" : " and u.USUARIO_ID in ( "+ createIn(lsInt.size()) + ") "); + + sql.append(" order by 3, 4, 7 desc"); + + 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 ""; + } + + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioCheckinModoConsolidadoPorUsuario_es.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioCheckinModoConsolidadoPorUsuario_es.properties new file mode 100644 index 000000000..0c26637f0 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioCheckinModoConsolidadoPorUsuario_es.properties @@ -0,0 +1,24 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. + +#Labels cabeçalho +cabecalho.relatorio=Relatório: +cabecalho.periodo=Período: +cabecalho.periodoA=à +cabecalho.dataHora=Data/Hora: +cabecalho.impressorPor=Impressor por: +cabecalho.pagina=Página +cabecalho.de=de +cabecalho.filtros=Filtros: + +#Labels datail +datail.voucher=Nº Bilhete / Voucher +datail.origen=Origem do Serviço +datail.servicio=Serviço +datail.data.servicio=Data do Serviço +datail.data.checkin=Data Checkin +datail.bilheteiro=Bilheteiro +datail.data.remarcada=Data Remarcada +datail.cveusuario=Login +datail.usuariocheckin=Usuário Checkin +datail.usuarionowshow=Usuário Now Show diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioCheckinModoConsolidadoPorUsuario_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioCheckinModoConsolidadoPorUsuario_pt_BR.properties new file mode 100644 index 000000000..4cef72173 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioCheckinModoConsolidadoPorUsuario_pt_BR.properties @@ -0,0 +1,30 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. + +#Labels cabeçalho +cabecalho.relatorio=Relatório: +cabecalho.periodo=Período: +cabecalho.periodoA=à +cabecalho.dataHora=Data/Hora: +cabecalho.impressorPor=Impressor por: +cabecalho.pagina=Página +cabecalho.de=de +cabecalho.filtros=Filtros: +#Labels header +cabecalho.pagina=Página\: +cabecalho.empresa=Empresa\: +cabecalho.bilheteiro = Bilheteiro(s)\: +cabecalho.usuario = Usuário\: + + +#Labels datail +datail.voucher=Nº Bilhete / Voucher +datail.origen=Origem do Serviço +datail.servicio=Serviço +datail.data.servicio=Data do Serviço +datail.data.checkin=Data Checkin +datail.bilheteiro=Bilheteiro +datail.data.remarcada=Data Remarcada +datail.cveusuario=Login +datail.usuariocheckin=Usuário Checkin +datail.usuarionowshow=Usuário Now Show \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioCheckinModoConsolidadoPorUsuario.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioCheckinModoConsolidadoPorUsuario.jasper new file mode 100644 index 000000000..23911aacc Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioCheckinModoConsolidadoPorUsuario.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioCheckinModoConsolidadoPorUsuario.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioCheckinModoConsolidadoPorUsuario.jrxml new file mode 100644 index 000000000..c03ebb9fb --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioCheckinModoConsolidadoPorUsuario.jrxml @@ -0,0 +1,281 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <band height="83" splitType="Stretch"> + <line> + <reportElement uuid="b28df970-c219-4853-afeb-6821e0a44f04" x="0" y="80" width="873" height="3"/> + </line> + <textField> + <reportElement uuid="50c553a9-7292-44df-8b24-24eb14e98841" mode="Opaque" x="0" y="0" width="646" height="30" backcolor="#D7D7D7"/> + <textElement markup="styled"> + <font size="16" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$P{NOME_RELATORIO}]]></textFieldExpression> + </textField> + <textField> + <reportElement uuid="3cbad5ad-ea6f-4718-b7e5-a98dc6be0188" x="0" y="31" width="130" height="16"/> + <textElement> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$R{cabecalho.periodo}]]></textFieldExpression> + </textField> + <textField> + <reportElement uuid="6c12f1b5-cae1-4ea9-b674-703d0f3d2bdc" x="130" y="31" width="672" height="16"/> + <textElement/> + <textFieldExpression><![CDATA[($P{DATA_INICIAL} != null ? new java.text.SimpleDateFormat("dd/MM/yyyy").format($P{DATA_INICIAL}) : "") + +" à " + +($P{DATA_FINAL} != null ? new java.text.SimpleDateFormat("dd/MM/yyyy").format($P{DATA_FINAL}) : "")]]></textFieldExpression> + </textField> + <textField> + <reportElement uuid="64d65c79-be80-4596-b84e-e2c3c3ddaa8a" x="131" y="49" width="504" height="16" isRemoveLineWhenBlank="true"/> + <textElement/> + <textFieldExpression><![CDATA[$P{nombUsuario}]]></textFieldExpression> + </textField> + <textField> + <reportElement uuid="cdd0af8e-575e-4afa-b68f-6d0812032d4b" x="0" y="49" width="130" height="16" isRemoveLineWhenBlank="true"/> + <textElement> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$R{cabecalho.usuario}]]></textFieldExpression> + </textField> + <textField> + <reportElement uuid="17fabb43-59cc-4375-86a8-793ff7a67f50" mode="Opaque" x="817" y="15" width="29" height="15" backcolor="#D7D7D7"/> + <textElement textAlignment="Right"/> + <textFieldExpression><![CDATA[$V{PAGE_NUMBER}+" de"]]></textFieldExpression> + </textField> + <textField> + <reportElement uuid="e0a35762-56d1-4da2-a945-8ae4d5348bb7" mode="Opaque" x="646" y="15" width="132" height="15" backcolor="#D7D7D7"/> + <textElement> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$R{cabecalho.pagina}]]></textFieldExpression> + </textField> + <textField pattern="dd/MM/yyyy HH:mm"> + <reportElement uuid="54f55cc3-21cb-482f-a58b-fca885e48517" mode="Opaque" x="778" y="0" width="97" height="15" backcolor="#D7D7D7"/> + <textElement textAlignment="Left"/> + <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression> + </textField> + <textField evaluationTime="Report"> + <reportElement uuid="d0201aca-580e-4359-9503-c579a43dcccd" mode="Opaque" x="846" y="15" width="29" height="15" backcolor="#D7D7D7"/> + <textElement textAlignment="Left"/> + <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression> + </textField> + <textField> + <reportElement uuid="1ac071ee-3dcd-427a-909f-9d39e40c6708" mode="Opaque" x="646" y="0" width="132" height="15" backcolor="#D7D7D7"/> + <textElement> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$R{cabecalho.dataHora}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement uuid="fb1a5b0c-1e7e-443e-b0ff-db26c4ed289d" mode="Opaque" x="778" y="15" width="39" height="15" backcolor="#D7D7D7"/> + <textElement textAlignment="Right"/> + </textField> + </band> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioCheckinController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioCheckinController.java index 1d26ea234..03833ada6 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioCheckinController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioCheckinController.java @@ -16,6 +16,7 @@ import org.zkoss.zhtml.Messagebox; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.event.Event; import org.zkoss.zul.Bandbox; +import org.zkoss.zul.Checkbox; import org.zkoss.zul.Comboitem; import org.zkoss.zul.ComboitemRenderer; import org.zkoss.zul.Datebox; @@ -26,6 +27,7 @@ import org.zkoss.zul.Textbox; 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.RelatorioCheckinModoConsolidadoPorUsuario; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada; @@ -55,6 +57,7 @@ public class RelatorioCheckinController extends MyGenericForwardComposer { private MyListbox usuarioSelList; private MyComboboxParada cmbParadaOrigem; private MyComboboxParadaCve cmbParadaOrigemCve; + private Checkbox chkConsolidadoPorUsuario; @@ -113,7 +116,9 @@ public class RelatorioCheckinController extends MyGenericForwardComposer { } public void onClick$btnExecutarRelatorio(Event ev) throws Exception { - + + Relatorio relatorio; + List lsUsuariosSelecionados = new ArrayList(Arrays.asList(usuarioSelList.getData())); Integer origenId = cmbParadaOrigemCve.getSelectedItem() == null ? null @@ -152,8 +157,11 @@ public class RelatorioCheckinController extends MyGenericForwardComposer { } parametros.put("IDS_BILHETEIROS", usuariosIds); - - Relatorio relatorio = new RelatorioCheckin(parametros, dataSourceRead.getConnection()); + if (chkConsolidadoPorUsuario.isChecked()) { + relatorio = new RelatorioCheckinModoConsolidadoPorUsuario(parametros, dataSourceRead.getConnection()); + }else { + relatorio = new RelatorioCheckin(parametros, dataSourceRead.getConnection()); + } Map args = new HashMap(); args.put("relatorio", relatorio); diff --git a/web/gui/relatorios/filtroRelatorioCheckin.zul b/web/gui/relatorios/filtroRelatorioCheckin.zul index 6b2285f89..94ba3b88f 100644 --- a/web/gui/relatorios/filtroRelatorioCheckin.zul +++ b/web/gui/relatorios/filtroRelatorioCheckin.zul @@ -113,7 +113,14 @@ - + + + + + + +