Gleison da Cruz 2023-01-10 10:15:20 -03:00
commit 5dc65759f5
16 changed files with 53 additions and 126 deletions

View File

@ -4,12 +4,12 @@
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.rjconsultores</groupId>
<artifactId>ventaboletosadm</artifactId>
<version>1.0.31</version>
<version>1.0.34</version>
<packaging>war</packaging>
<properties>
<modelWeb.version>1.0.20</modelWeb.version>
<flyway.version>1.0.11</flyway.version>
<modelWeb.version>1.0.21</modelWeb.version>
<flyway.version>1.0.14</flyway.version>
</properties>
<distributionManagement>
@ -149,11 +149,13 @@
<artifactId>zcommon</artifactId>
<version>5.0.9</version>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zhtml</artifactId>
<version>5.0.9</version>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zk</artifactId>

View File

@ -30,9 +30,8 @@ public class TesteFlyway {
}finally{
if (dataSource != null){
try {
((OracleDataSource)dataSource).close();
((OracleDataSource)dataSource).getConnection().close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

View File

@ -82,7 +82,6 @@ public class RelatorioEstornoCartao extends Relatorio {
dataResult.put("descmotivo", rset.getString("descmotivo"));
dataResult.put("adquirente", rset.getString("adquirente"));
dataResult.put("estabelecimento", rset.getString("estabelecimento"));
dataResult.put("nsuhost", rset.getString("nsuhost"));
this.dados.add(dataResult);
@ -137,21 +136,7 @@ public class RelatorioEstornoCartao extends Relatorio {
sql.append(" AND c.corrida_id = dec.corrida_id ");
sql.append(" AND c.numfoliosistema = dec.numfoliosistema ");
sql.append(" AND c.indreimpresion = 1 ");
sql.append(" AND rownum = 1), 'CANCELAMENTO') as descmotivo, ");
//SubSelect para evitar duplicacao dos registros por causa do join com a caja
sql.append(" COALESCE(( select ct.nsuhost ");
sql.append(" from caja c inner join caja_formapago cfp on cfp.caja_id = c.caja_id ");
sql.append(" left join caja_det_pago cdp on cdp.cajaformapago_id = cfp.cajaformapago_id ");
sql.append(" left join caja_tarjeta ct on ct.cajadetpago_id = cdp.cajadetpago_id ");
sql.append(" inner join forma_pago fp on fp.formapago_id = cfp.formapago_id ");
sql.append(" where ");
sql.append(" c.numoperacion = dec.numoperacion ");
sql.append(" AND c.origen_id = dec.origen_id ");
sql.append(" AND c.destino_id = dec.destino_id ");
sql.append(" AND c.corrida_id = dec.corrida_id ");
sql.append(" AND coalesce( ct.nsuhost, '0') <> '0' ");
sql.append(" AND rownum = 1), '') as nsuhost ");
sql.append(" AND rownum = 1), 'CANCELAMENTO') as descmotivo ");
sql.append(" FROM ");
@ -202,7 +187,7 @@ public class RelatorioEstornoCartao extends Relatorio {
}
sql.append(" AND DEC.FECREGISTRO BETWEEN :data_inicial AND :data_final ");
sql.append(" ORDER BY e.nombempresa, DEC.FECREGISTRO ");
sql.append(" ORDER BY DEC.FECREGISTRO ");
return sql.toString();
}

View File

@ -139,6 +139,15 @@ public class RelatorioPdfAndExcel {
List<Map<String, ?>> preparedData = new ArrayList<Map<String, ?>>();
Map<String, Object> map;
map = new HashMap<String, Object>();
Boolean isValid = dispositivoVendaEmbarcadaList.getPaginal() != null;
Integer paginaActual = isValid ? dispositivoVendaEmbarcadaList.getPaginal().getActivePage() : null;
if (isValid) {
for (int i = 0; i < dispositivoVendaEmbarcadaList.getPaginal().getPageCount(); i++) {
dispositivoVendaEmbarcadaList.getPaginal().setActivePage(i);
dispositivoVendaEmbarcadaList.renderAll();
}
}
for (Integer i = 0; i < dispositivoVendaEmbarcadaList.getSize(); i++) {
List list = dispositivoVendaEmbarcadaList.getItemAtIndex(i).getChildren();
@ -150,6 +159,11 @@ public class RelatorioPdfAndExcel {
}
preparedData.add(map);
}
if (isValid && paginaActual != null) {
dispositivoVendaEmbarcadaList.getPaginal().setActivePage(paginaActual);
}
return new JRMapCollectionDataSource(preparedData);
}

View File

@ -35,5 +35,4 @@ empresa.label=Empresa:
formaPago.label=Forma de Pagamento
pontoDeventa.label=Ponto de Venda
estabelecimento.label=Estab.
adquirente.label=Adqui.
nsuhost.label=NSU/Host
adquirente.label=Adquirente

View File

@ -36,5 +36,4 @@ formaPago.label=Forma de Pagamento
pontoDeventa.label=Ponto de Venda
motivoCancelamento.label=Motivo Cancelamento
estabelecimento.label=Estab.
adquirente.label=Adqui.
nsuhost.label=NSU/Host
adquirente.label=Adquirente

View File

@ -48,15 +48,12 @@ detail.rg=RG
detail.status=Status
detail.codOrigem=Cod. Origem
detail.codDestino=Cod. Destino
detail.total=Total:
detail.total=Total
detail.totalComDesconto=Total c/ desconto
detail.totalSemDesconto=Total s/ desconto
detail.totalVendido=Total vendido
detail.ccf=CCf
detail.chaveBPe=Ch. BP-e
detail.totalV=Total Vendido:
detail.totalC=Total Cobrado:
detail.totalP=Total Preço:
linhas=Linhas

View File

@ -48,15 +48,12 @@ detail.rg=RG
detail.status=Status
detail.codOrigem=Cod. Origem
detail.codDestino=Cod. Destino
detail.total=Total:
detail.total=Total
detail.totalComDesconto=Total c/ desconto
detail.totalSemDesconto=Total s/ desconto
detail.totalVendido=Total vendido
detail.ccf=CCf
detail.chaveBPe=Ch. BP-e
detail.totalV=Total Vendido:
detail.totalC=Total Cobrado:
detail.totalP=Total Preço:
linhas=Linhas

View File

@ -44,9 +44,6 @@
<field name="estabelecimento" class="java.lang.String">
<fieldDescription><![CDATA[Estabelecimento]]></fieldDescription>
</field>
<field name="nsuhost" class="java.lang.String">
<fieldDescription><![CDATA[NsuHost]]></fieldDescription>
</field>
<group name="empresa" isStartNewPage="true" isReprintHeaderOnEachPage="true" minHeightToStartNewPage="150">
<groupExpression><![CDATA[$F{nombempresa}]]></groupExpression>
<groupHeader>
@ -186,14 +183,14 @@
<textFieldExpression><![CDATA[$R{dataServico.label}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="84ffd875-2c40-418f-916d-305d98a04dfc" stretchType="RelativeToTallestObject" x="671" y="27" width="28" height="20"/>
<reportElement uuid="84ffd875-2c40-418f-916d-305d98a04dfc" stretchType="RelativeToTallestObject" x="671" y="27" width="35" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="6" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{bilhete.label}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="53e910c5-7876-4cad-96c8-8bebeabcc0b6" stretchType="RelativeToTallestObject" x="699" y="27" width="26" height="20"/>
<reportElement uuid="53e910c5-7876-4cad-96c8-8bebeabcc0b6" stretchType="RelativeToTallestObject" x="706" y="27" width="30" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="6" isPdfEmbedded="true"/>
</textElement>
@ -221,7 +218,7 @@
<textFieldExpression><![CDATA[$R{motivoCancelamento.label}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="468fff71-1268-4136-9d45-c81f154addae" stretchType="RelativeToTallestObject" x="745" y="27" width="22" height="20"/>
<reportElement uuid="468fff71-1268-4136-9d45-c81f154addae" stretchType="RelativeToTallestObject" x="737" y="27" width="30" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="6" isPdfEmbedded="true"/>
</textElement>
@ -234,13 +231,6 @@
</textElement>
<textFieldExpression><![CDATA[$R{estabelecimento.label}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="14265fbe-d0be-4a76-b76b-844f21ca3612" stretchType="RelativeToTallestObject" x="725" y="27" width="20" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="6" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{nsuhost.label}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
<groupFooter>
@ -459,14 +449,14 @@
<textFieldExpression><![CDATA[$F{dataServico}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="ca18697e-f3ef-4b34-a10d-9c92b281be56" stretchType="RelativeToTallestObject" x="671" y="0" width="28" height="27"/>
<reportElement uuid="ca18697e-f3ef-4b34-a10d-9c92b281be56" stretchType="RelativeToTallestObject" x="671" y="0" width="35" height="27"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="6" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{bilhete}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="###0.00" isBlankWhenNull="true">
<reportElement uuid="bd34bccf-8a59-452a-8030-425e4974acae" stretchType="RelativeToTallestObject" x="699" y="0" width="26" height="27"/>
<reportElement uuid="bd34bccf-8a59-452a-8030-425e4974acae" stretchType="RelativeToTallestObject" x="706" y="0" width="30" height="27"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="6" isPdfEmbedded="true"/>
</textElement>
@ -510,7 +500,7 @@
<textFieldExpression><![CDATA[$F{descmotivo}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="###0.00" isBlankWhenNull="true">
<reportElement uuid="3c56f360-8ffd-451c-9287-b401874fa805" stretchType="RelativeToTallestObject" x="745" y="0" width="22" height="26"/>
<reportElement uuid="3c56f360-8ffd-451c-9287-b401874fa805" stretchType="RelativeToTallestObject" x="735" y="0" width="34" height="26"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="6" isPdfEmbedded="true"/>
</textElement>
@ -523,13 +513,6 @@
</textElement>
<textFieldExpression><![CDATA[$F{estabelecimento}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="###0.00" isBlankWhenNull="true">
<reportElement uuid="cfb968a8-fc71-456f-84e6-bfc132b09fe8" stretchType="RelativeToTallestObject" x="725" y="0" width="20" height="27"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="6" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{nsuhost}]]></textFieldExpression>
</textField>
</band>
</detail>
<summary>

View File

@ -1,8 +1,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="RelatorioEmpresaCorrida" pageWidth="1152" pageHeight="595" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="1132" leftMargin="10" rightMargin="10" topMargin="20" bottomMargin="20" resourceBundle="RelatorioEmpresaCorrida" whenResourceMissingType="Empty" uuid="94834362-0ecc-46da-b0a2-5cdee355da3e">
<property name="ireport.zoom" value="2.923075650000008"/>
<property name="ireport.x" value="90"/>
<property name="ireport.y" value="186"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="220"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.2" value="pageHeader"/>
<parameter name="fecInicioViagem" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
@ -600,60 +600,29 @@
<band height="18">
<textField>
<reportElement uuid="5fdd8d50-c70b-4a5c-9621-5b91642257bf" x="0" y="0" width="139" height="18"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$R{detail.total}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="6005f63d-1abc-408d-9af2-adea341fadda" x="182" y="0" width="75" height="18"/>
<textElement>
<font size="8"/>
</textElement>
<textElement/>
<textFieldExpression><![CDATA[$V{qtde}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="###0.00;-###0.00" isBlankWhenNull="true">
<reportElement uuid="91cfa7bb-414a-41a5-8971-4b91012dbc4d" x="474" y="0" width="98" height="18"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<reportElement uuid="91cfa7bb-414a-41a5-8971-4b91012dbc4d" x="779" y="0" width="90" height="18"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{total_sem_desconto}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="###0.00;-###0.00" isBlankWhenNull="true">
<reportElement uuid="779b8652-d8e3-4b84-85f2-d37ef88488b9" x="709" y="0" width="98" height="18"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<reportElement uuid="779b8652-d8e3-4b84-85f2-d37ef88488b9" x="869" y="0" width="90" height="18"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{total_com_desconto}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="###0.00;-###0.00" isBlankWhenNull="true">
<reportElement uuid="97a0b50b-6760-4619-86ea-ea6ac23547d9" x="943" y="0" width="98" height="18"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<reportElement uuid="97a0b50b-6760-4619-86ea-ea6ac23547d9" x="959" y="0" width="90" height="18"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{total_vendido}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="7702e077-cc45-41e8-83d7-a6b45fcd5a80" x="361" y="0" width="104" height="18"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.totalP}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="7d8e9e1e-3fb6-4b08-8b72-4ff02b598be5" x="591" y="0" width="104" height="18"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.totalC}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="1fe1943b-acc0-4514-8c0e-3c63aae5c329" x="822" y="0" width="104" height="18"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.totalV}]]></textFieldExpression>
</textField>
</band>
</summary>
<noData>

View File

@ -5,8 +5,6 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
@ -37,7 +35,6 @@ import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.enums.SistemaEnum;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioPdfAndExcel;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.SaidaRelatorio;
import com.rjconsultores.ventaboletos.service.DispositivoEmbarcadaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
@ -72,7 +69,6 @@ public class BusquedaDispositivoVendaEmbarcadaController extends MyGenericForwar
private Textbox txtRegistro;
private MyComboboxEstandar cmbVersaoUltimaSinc;
private Textbox txtMei;
private Paging pagingDispositivoVendaEmbarcada;
private MyListbox dispositivoVendaEmbarcadaList;
private Search dispositivoVendaEmbarcadaBusqueda;
private Checkbox chkDispBloqueadoSim;
@ -125,8 +121,7 @@ public class BusquedaDispositivoVendaEmbarcadaController extends MyGenericForwar
}
private void refreshLista() {
HibernateSearchObject<DispositivoEmbarcada> dispositivoEmbarcadaBusqueda = new HibernateSearchObject<DispositivoEmbarcada>(DispositivoEmbarcada.class,
pagingDispositivoVendaEmbarcada.getPageSize());
HibernateSearchObject<DispositivoEmbarcada> dispositivoEmbarcadaBusqueda = new HibernateSearchObject<DispositivoEmbarcada>(DispositivoEmbarcada.class);
dispositivoEmbarcadaBusqueda.addFilterLike("descricao",
"%" + txtDescricao.getText().trim().concat("%"));
@ -173,7 +168,7 @@ public class BusquedaDispositivoVendaEmbarcadaController extends MyGenericForwar
dispositivoEmbarcadaBusqueda.addFilterEqual("puntoVenta.puntoventaId", dab.getPuntoventaId());
}
plwDispositivoVendaEmbarcada.init(dispositivoEmbarcadaBusqueda, dispositivoVendaEmbarcadaList, pagingDispositivoVendaEmbarcada);
dispositivoVendaEmbarcadaList.setData(plwDispositivoVendaEmbarcada.searchObject(dispositivoEmbarcadaBusqueda));
if (dispositivoVendaEmbarcadaList.getData().length == 0) {
try {
@ -208,21 +203,15 @@ public class BusquedaDispositivoVendaEmbarcadaController extends MyGenericForwar
public void excutarRelatorios(boolean isPdf) throws SQLException, Exception {
// Map<String, Object> parametros = new HashMap<String, Object>();
RelatorioPdfAndExcel r = new RelatorioPdfAndExcel(dispositivoVendaEmbarcadaList);
// File file = r.generateReport(isPdf);
InputStream mediais = new ByteArrayInputStream(r.generateReportRender(isPdf));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH-mm");
String nomeRelatorioDownload = NOME_RELATORIO + "_" + sdf.format(Calendar.getInstance().getTime());
if(isPdf) {
// InputStream mediais = new FileInputStream(file);
AMedia conteudoRelatorioXLS = new AMedia("relatorio.pdf", "pdf", null, mediais);
Filedownload.save(conteudoRelatorioXLS.getStreamData(), "application/pdf", nomeRelatorioDownload + ".pdf");
}else {
// InputStream mediais = new FileInputStream(file);
AMedia conteudoRelatorioXLS = new AMedia("relatorio.xls", "xls", null, mediais);
Filedownload.save(conteudoRelatorioXLS.getStreamData(), "application/xls", nomeRelatorioDownload + ".xls");
}
@ -286,14 +275,6 @@ public class BusquedaDispositivoVendaEmbarcadaController extends MyGenericForwar
this.txtMei = txtMei;
}
public Paging getPagingDispositivoVendaEmbarcada() {
return pagingDispositivoVendaEmbarcada;
}
public void setPagingDispositivoVendaEmbarcada(Paging pagingDispositivoVendaEmbarcada) {
this.pagingDispositivoVendaEmbarcada = pagingDispositivoVendaEmbarcada;
}
public MyListbox getDispositivoVendaEmbarcadaList() {
return dispositivoVendaEmbarcadaList;
}

View File

@ -72,7 +72,7 @@ public class PagedListWrapper<E> implements Serializable {
setSearchObject(hibernateSearchObject1);
}
private void initModel() {
getSearchObject().setFirstResult(0);
getSearchObject().setMaxResults(getPageSize());
@ -255,4 +255,9 @@ public class PagedListWrapper<E> implements Serializable {
this.hibernateSearchObject = hibernateSearchObject1;
initModel();
}
public List<E> searchObject(HibernateSearchObject<E> hibernateSearchObject1) {
List<E> searchResult = getPagedListService().getBySearchObject(hibernateSearchObject1);
return searchResult;
}
}

View File

@ -6,7 +6,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<description>VentaBoletosAdm</description>
<description>ventaboletos</description>
<display-name>ventaboletosadm</display-name>
<context-param>

View File

@ -116,9 +116,6 @@
image="/gui/img/find.png"
label="${c:l('dispositivoVendaEmbarcadaController.btnPesquisa.label')}" />
</toolbar>
<paging id="pagingDispositivoVendaEmbarcada"
pageSize="20" />
<toolbar>
<button id="btnExportarPdf"
@ -129,11 +126,11 @@
label="${c:l('dispositivoVendaEmbarcadaController.btnExportarXls.label')}" />
</toolbar>
<listbox id="dispositivoVendaEmbarcadaList"
<listbox id="dispositivoVendaEmbarcadaList" mold="paging" pageSize="20"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true"
multiple="false"
height="85%">
height="80%">
<listhead sizable="true">
<listheader id="lhId"
width="70px"