fixes bug#14644

dev:thiago
qua:wallysson

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@94535 d1611594-4594-4d17-8e1d-87c2c4800839
master
wilian 2019-06-12 21:09:32 +00:00
parent 3a52c569db
commit 24a7b79f9f
4 changed files with 45 additions and 42 deletions

View File

@ -3,7 +3,6 @@ package com.rjconsultores.ventaboletos.relatorios.impl;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -12,7 +11,6 @@ import org.apache.log4j.Logger;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioVendasConexaoBean;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioVendasRequisicaoBean;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
@ -24,8 +22,8 @@ public class RelatorioVendasRequisicao extends Relatorio {
private List<RelatorioVendasRequisicaoBean> lsDadosRelatorio;
private Timestamp fecInicio;
private Timestamp fecFinal;
private String fecInicio;
private String fecFinal;
private Integer empresaId;
private Integer puntoventaId;
private Integer secretariaId;
@ -38,8 +36,8 @@ public class RelatorioVendasRequisicao extends Relatorio {
@Override
public void initDados() throws Exception {
Map<String, Object> parametros = this.relatorio.getParametros();
fecInicio = (Timestamp) parametros.get("dataFiltroInicial");
fecFinal = (Timestamp) parametros.get("dataFiltroFinal");
fecInicio = parametros.get("dataFiltroInicial").toString();
fecFinal = parametros.get("dataFiltroFinal").toString();
if(parametros.get("EMPRESA_ID")!=null){
empresaId = Integer.valueOf(parametros.get("EMPRESA_ID").toString());
}
@ -125,10 +123,10 @@ public class RelatorioVendasRequisicao extends Relatorio {
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
if(fecInicio != null) {
stmt.setTimestamp("fecInicio", fecInicio);
stmt.setString("fecInicio", fecInicio);
}
if(fecFinal != null) {
stmt.setTimestamp("fecFinal", fecFinal);
stmt.setString("fecFinal", fecFinal);
}
if(empresaId != null) {
stmt.setInt("EMPRESA_ID", empresaId);
@ -150,20 +148,22 @@ public class RelatorioVendasRequisicao extends Relatorio {
.append("FROM CAJA C ")
.append("JOIN PARADA ORI ON ORI.PARADA_ID = C.ORIGEN_ID ")
.append("JOIN PARADA DES ON DES.PARADA_ID = C.DESTINO_ID ")
.append("JOIN CAJA_FORMAPAGO CFP ON CFP.CAJA_ID = C.CAJA_ID ")
.append("LEFT JOIN CAJA_DET_PAGO CDP ON CDP.CAJAFORMAPAGO_ID = CFP.CAJAFORMAPAGO_ID ")
.append("JOIN CAJA_FORMAPAGO CFP ON CFP.CAJA_ID = C.CAJA_ID AND CFP.ACTIVO = 1 ")
.append("LEFT JOIN CAJA_DET_PAGO CDP ON CDP.CAJAFORMAPAGO_ID = CFP.CAJAFORMAPAGO_ID AND CDP.ACTIVO = 1 ")
.append("JOIN SECRETARIA SEC ON CDP.OPCIONAL1 = SEC.SECRETARIA_ID ")
.append("JOIN FORMA_PAGO FP ON FP.FORMAPAGO_ID = CFP.FORMAPAGO_ID ")
.append("JOIN MARCA M ON C.MARCA_ID = M.MARCA_ID ")
.append("JOIN EMPRESA E ON E.EMPRESA_ID = M.EMPRESA_ID ")
.append("JOIN PUNTO_VENTA PV ON PV.PUNTOVENTA_ID = C.PUNTOVENTA_ID ")
.append("WHERE FP.FORMAPAGO_ID = 11 ");
.append("WHERE FP.FORMAPAGO_ID = 11 ")
.append("AND C.ACTIVO = 1 ")
.append("AND C.INDREIMPRESION = 0 ");
if(fecInicio != null) {
sQuery.append("AND NVL(C.FECHORVENTA_H,C.FECHORVENTA) >= :fecInicio ");
sQuery.append("AND NVL(C.FECHORVENTA_H,C.FECHORVENTA) >= TO_DATE(:fecInicio, 'dd/mm/yyyy hh24:mi') ");
}
if(fecFinal != null) {
sQuery.append("AND NVL(C.FECHORVENTA_H,C.FECHORVENTA) <= :fecFinal ");
sQuery.append("AND NVL(C.FECHORVENTA_H,C.FECHORVENTA) <= TO_DATE(:fecFinal, 'dd/mm/yyyy hh24:mi') ");
}
if(empresaId != null) {
sQuery.append("AND E.EMPRESA_ID = :EMPRESA_ID ");

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="RelatorioVendasRequisicao" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="84b9dfcf-8ec5-4f51-80cc-7339e3b158b4">
<property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="ireport.x" value="554"/>
<property name="ireport.y" value="78"/>
<style name="Crosstab Data Text" hAlign="Center"/>
<parameter name="fecInicio" class="java.lang.String"/>
<parameter name="fecFinal" class="java.lang.String"/>
@ -49,7 +49,7 @@
<text><![CDATA[Origem]]></text>
</staticText>
<textField>
<reportElement x="53" y="0" width="234" height="20" uuid="8fc0dadc-9470-4614-9ed8-588df8f619a5"/>
<reportElement x="53" y="0" width="748" height="20" uuid="8fc0dadc-9470-4614-9ed8-588df8f619a5"/>
<textFieldExpression><![CDATA[$F{secretariaId}+" - "+$F{descsecretaria}]]></textFieldExpression>
</textField>
<staticText>
@ -61,14 +61,14 @@
</staticText>
<staticText>
<reportElement x="702" y="20" width="100" height="20" uuid="8b2b4d01-a0ed-474d-a721-d2eabbcb5af7"/>
<textElement>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<text><![CDATA[Total]]></text>
</staticText>
<staticText>
<reportElement x="620" y="20" width="82" height="20" uuid="86d422e2-4c74-4304-9275-43cf0b9c99bb"/>
<textElement textAlignment="Center">
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<text><![CDATA[QTDE]]></text>
@ -90,23 +90,27 @@
</band>
</groupHeader>
<groupFooter>
<band height="32">
<textField>
<reportElement x="702" y="10" width="100" height="20" uuid="3a5276ac-d393-4a51-b60a-28f8105643d5"/>
<band height="21">
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="702" y="1" width="100" height="20" uuid="3a5276ac-d393-4a51-b60a-28f8105643d5"/>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{importe_1}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="520" y="10" width="100" height="20" uuid="ab651bcd-8815-40b4-843d-3c675ae94009"/>
<textElement textAlignment="Right">
<reportElement x="520" y="1" width="100" height="20" uuid="ab651bcd-8815-40b4-843d-3c675ae94009"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Subtotal:]]></text>
</staticText>
<textField>
<reportElement x="620" y="10" width="82" height="20" uuid="e1424ee9-fbe0-4d10-8153-ac0f5ff0a04b"/>
<textElement textAlignment="Center"/>
<reportElement x="620" y="1" width="82" height="20" uuid="e1424ee9-fbe0-4d10-8153-ac0f5ff0a04b"/>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{qtde_1}]]></textFieldExpression>
</textField>
<line>
<reportElement x="0" y="0" width="801" height="1" uuid="6789c052-c282-4536-8dc1-5a93c4d870f5"/>
</line>
</band>
</groupFooter>
</group>
@ -158,7 +162,7 @@
</band>
</title>
<pageHeader>
<band height="22">
<band height="21">
<textField>
<reportElement x="606" y="1" width="195" height="20" uuid="701a95fd-2c75-40c1-bb18-0e784375e289"/>
<textElement textAlignment="Right">
@ -178,13 +182,14 @@
<reportElement x="410" y="0" width="210" height="20" uuid="4f8b2848-6c67-468e-ae96-2a77fa2ffa1f"/>
<textFieldExpression><![CDATA[$F{destinoId}+" - "+$F{destino}]]></textFieldExpression>
</textField>
<textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="702" y="0" width="100" height="20" uuid="a373f36c-db6b-4e0f-8351-871d8533f8ec"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{importe}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="620" y="0" width="82" height="20" uuid="26fb8d06-0109-4496-8428-c300d86b9c74"/>
<textElement textAlignment="Center"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{qtde}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
@ -198,25 +203,26 @@
<band splitType="Stretch"/>
</columnFooter>
<summary>
<band height="50">
<band height="21">
<textField>
<reportElement x="620" y="19" width="82" height="20" uuid="05274e36-60ad-4390-9f27-3d06d96eb168"/>
<textElement textAlignment="Center"/>
<reportElement x="620" y="1" width="82" height="20" uuid="05274e36-60ad-4390-9f27-3d06d96eb168"/>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{qtdeTotal}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="520" y="19" width="100" height="20" uuid="ba76f4f2-00f1-4bef-aeef-823589ad8b5b"/>
<textElement textAlignment="Right">
<reportElement x="520" y="1" width="100" height="20" uuid="ba76f4f2-00f1-4bef-aeef-823589ad8b5b"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[TOTAL:]]></text>
</staticText>
<textField>
<reportElement x="702" y="19" width="100" height="20" uuid="36067a9c-e8b0-4f38-808a-0469b3a38d51"/>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="702" y="1" width="100" height="20" uuid="36067a9c-e8b0-4f38-808a-0469b3a38d51"/>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{importeTotal}]]></textFieldExpression>
</textField>
<line>
<reportElement x="10" y="10" width="801" height="1" uuid="add1375c-df33-44b5-a5e7-fc894b024bc2"/>
<reportElement x="0" y="0" width="801" height="1" uuid="add1375c-df33-44b5-a5e7-fc894b024bc2"/>
</line>
</band>
</summary>

View File

@ -1,7 +1,6 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
@ -65,15 +64,13 @@ public class RelatorioVendasRequisicaoController extends MyGenericForwardCompose
Date dataDe = dataInicial.getValue();
Date dataAte = dataFinal.getValue();
Timestamp fecVentaInicial = new Timestamp(DateUtil.inicioFecha(dataDe).getTime());
Timestamp fecVentaFinal = new Timestamp(DateUtil.fimFecha(dataAte).getTime());
Map<String, Object> parametros = new HashMap<String, Object>();
parametros.put("fecInicio", sdf.format(dataDe));
parametros.put("fecFinal", sdf.format(dataAte));
parametros.put("dataFiltroInicial", fecVentaInicial);
parametros.put("dataFiltroFinal", fecVentaFinal);
sdf.applyPattern("dd/MM/yyyy HH:mm");
parametros.put("dataFiltroInicial", sdf.format(DateUtil.inicioFecha(dataDe)));
parametros.put("dataFiltroFinal", sdf.format(DateUtil.fimFecha(dataAte)));
Comboitem itemEmpresa = cmbEmpresa.getSelectedItem();
if (itemEmpresa != null) {