Então Lucas, eu add o parâmetro no relatório(se quiser envio xml pra vc ver)…e fui testar na app
primeiro gero o relatorio na tela, segundo eu seleciono uma venda e terceiro clico em exportar:
mas recebo este erro
java.lang.NullPointerException: null
at com.vaadin.flow.server.StreamResource$Pipe.read(StreamResource.java:104) ~[flow-server-2.6.3.jar:2.6.3]
at com.vaadin.flow.server.StreamResource$Pipe.copy(StreamResource.java:94) ~[flow-server-2.6.3.jar:2.6.3]
at com.vaadin.flow.server.StreamResource$Pipe.accept(StreamResource.java:77) ~[flow-server-2.6.3.jar:2.6.3]
at com.vaadin.flow.server.communication.StreamResourceHandler.handleRequest(StreamResourceHandler.java:89) ~[flow-server-2.6.3.jar:2.6.3]
at com.vaadin.flow.server.communication.StreamRequestHandler.handleRequest(StreamRequestHandler.java:106) ~[flow-server-2.6.3.jar:2.6.3]
at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1570) ~[flow-server-2.6.3.jar:2.6.3]
at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:252) ~[flow-server-2.6.3.jar:2.6.3]
at com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:111) ~[vaadin-spring-12.4.0.jar:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.45.jar:4.0.FR]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:710) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:457) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:352) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.springframework.web.servlet.mvc.ServletForwardingController.handleRequestInternal(ServletForwardingController.java:141) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:52) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1060) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.6.jar:5.3.6]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.45.jar:4.0.FR]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.6.jar:5.3.6]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.45.jar:4.0.FR]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.6.jar:5.3.6]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.6.jar:5.3.6]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.6.jar:5.3.6]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.6.jar:5.3.6]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.6.jar:5.3.6]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.6.jar:5.3.6]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1707) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at java.base/java.lang.Thread.run(Thread.java:830) ~[na:na]
2021-07-02 14:30:47.835 WARN 2168 --- [nio-8080-exec-8] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotWritableException: No converter for [class java.util.LinkedHashMap] with preset Content-Type 'application/pdf']
Esse erro não parece que está completo. A linha onde ocorreu o NPE parece ser interno (nas dependências) do vaadin.
1 curtida
@Lucas_Camara bom dia mano!
então, dei uma mexida aqui, e agora o erro não existe mais, porem o único resultado que estou obtendo é um relatório em branco…sem erros de execução ou compilação:
Não sei se tem algo haver, mas aqui nos parametros, estou passando isso:
Map<String, Object> parameters = new LinkedHashMap<String, Object>();
parameters.put("idVenda", idsVendasSelecionadas);
Como estou passando o id como parametro e o id é Long, não deveria passar desta forma?:
Map<Long, Object> parameters = new LinkedHashMap<Long, Object>();
parameters.put("idVenda", idsVendasSelecionadas);
Dei mais outra mexida, agora o relatório voltou aparecer, mas não faz a filtragem:
repare que ele diz que o ID é nulo
O certo é Map<String, Object>
, pois o mapa vai servir apenas para a passagem do valor. A chave do mapa sendo uma string é o que será usado pelo relatório para obter o valor.
Depois que vc passou o parâmetro para o relatório, como ficou a consulta sql dentro do jrxml?
1 curtida
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.17.0.final using JasperReports Library version 6.17.0-6d93193241dd8cc42629e188b94f9e0bc5722efd -->
<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="RelatorioVendas" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="df013db5-f76e-44d3-b0df-bcbc46d93160">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.sql.SQLQueryDesigner.sash.w1" value="140"/>
<property name="com.jaspersoft.studio.data.sql.SQLQueryDesigner.sash.w2" value="855"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="fsistemas"/>
<style name="Title" fontName="Times New Roman" fontSize="50" isBold="true"/>
<style name="SubTitle" forecolor="#736343" fontName="Arial" fontSize="18"/>
<style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/>
<style name="Detail" fontName="Arial" fontSize="12"/>
<style name="Row" mode="Transparent">
<conditionalStyle>
<conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression>
<style backcolor="#E6DAC3"/>
</conditionalStyle>
</style>
<parameter name="idVenda" class="java.lang.Long"/>
<queryString language="SQL">
<![CDATA[SELECT fjsistemas.cliente.nome,
fjsistemas.forma_de_pagamento.forma_de_pagamento,
fjsistemas.produto.valor,
fjsistemas.produto.nome,
fjsistemas.produto_vendido.produto_id,
fjsistemas.produto_vendido.valor_total_do_item,
fjsistemas.produto_vendido.quantidade,
fjsistemas.venda.id,
fjsistemas.venda.data_venda,
fjsistemas.venda.valor_total_venda
FROM fjsistemas.venda
INNER JOIN fjsistemas.cliente ON
fjsistemas.cliente.id = fjsistemas.venda.cliente_id
INNER JOIN fjsistemas.forma_de_pagamento ON
fjsistemas.forma_de_pagamento.id = fjsistemas.venda.forma_de_pagamento_id
INNER JOIN fjsistemas.produto_vendido ON
fjsistemas.produto_vendido.venda_id = fjsistemas.venda.id
INNER JOIN fjsistemas.produto ON
fjsistemas.produto.id = fjsistemas.produto_vendido.produto_id
ORDER BY fjsistemas.venda.id ASC]]>
</queryString>
<field name="nome" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="nome"/>
<property name="com.jaspersoft.studio.field.label" value="nome"/>
<property name="com.jaspersoft.studio.field.tree.path" value="cliente"/>
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="forma_de_pagamento" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="forma_de_pagamento"/>
<property name="com.jaspersoft.studio.field.label" value="forma_de_pagamento"/>
<property name="com.jaspersoft.studio.field.tree.path" value="forma_de_pagamento"/>
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="valor" class="java.lang.Double">
<property name="com.jaspersoft.studio.field.name" value="valor"/>
<property name="com.jaspersoft.studio.field.label" value="valor"/>
<property name="com.jaspersoft.studio.field.tree.path" value="produto"/>
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="COLUMN_4" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="nome"/>
<property name="com.jaspersoft.studio.field.label" value="nome"/>
<property name="com.jaspersoft.studio.field.tree.path" value="produto"/>
</field>
<field name="produto_id" class="java.lang.Long">
<property name="com.jaspersoft.studio.field.name" value="produto_id"/>
<property name="com.jaspersoft.studio.field.label" value="produto_id"/>
<property name="com.jaspersoft.studio.field.tree.path" value="produto_vendido"/>
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="valor_total_do_item" class="java.lang.Double">
<property name="com.jaspersoft.studio.field.name" value="valor_total_do_item"/>
<property name="com.jaspersoft.studio.field.label" value="valor_total_do_item"/>
<property name="com.jaspersoft.studio.field.tree.path" value="produto_vendido"/>
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="quantidade" class="java.lang.Integer">
<property name="com.jaspersoft.studio.field.name" value="quantidade"/>
<property name="com.jaspersoft.studio.field.label" value="quantidade"/>
<property name="com.jaspersoft.studio.field.tree.path" value="produto_vendido"/>
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="id" class="java.lang.Long">
<property name="com.jaspersoft.studio.field.name" value="id"/>
<property name="com.jaspersoft.studio.field.label" value="id"/>
<property name="com.jaspersoft.studio.field.tree.path" value="venda"/>
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="data_venda" class="java.sql.Date">
<property name="com.jaspersoft.studio.field.name" value="data_venda"/>
<property name="com.jaspersoft.studio.field.label" value="data_venda"/>
<property name="com.jaspersoft.studio.field.tree.path" value="venda"/>
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="valor_total_venda" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="valor_total_venda"/>
<property name="com.jaspersoft.studio.field.label" value="valor_total_venda"/>
<property name="com.jaspersoft.studio.field.tree.path" value="venda"/>
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<variable name="Soma" class="java.lang.Double" calculation="Sum">
<variableExpression><![CDATA[$F{valor_total_do_item}]]></variableExpression>
</variable>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="60" splitType="Stretch">
<staticText>
<reportElement style="Title" x="1" y="0" width="799" height="60" uuid="bc1ce1da-8232-46ea-be55-cec4abb986dd"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[RELATÓTIO VENDAS]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="20" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="80" height="20" uuid="22e99724-47f5-43db-890e-f358c9f52841"/>
<textFieldExpression><![CDATA["Filtro ID: " + $P{idVenda}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="16" splitType="Stretch">
<line>
<reportElement positionType="FixRelativeToBottom" x="0" y="15" width="802" height="1" uuid="e9d2002a-c8ee-4649-a258-640dad29110c"/>
<graphicElement>
<pen lineWidth="0.5" lineColor="#999999"/>
</graphicElement>
</line>
<staticText>
<reportElement style="Column header" x="0" y="0" width="89" height="15" forecolor="#736343" uuid="f957e008-a7be-42e2-ae1e-6dd37d516e1d">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="3cfcbd04-6058-4ae4-9559-fcaf41cff3d7"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[ID]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="89" y="0" width="89" height="15" forecolor="#736343" uuid="347f29a5-d360-4f5a-a83c-d6b7d6a4ddd2">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="f1b1e558-48c2-4edf-89e3-f00326230e66"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[DATA]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="178" y="0" width="89" height="15" forecolor="#736343" uuid="81f8f18f-f32f-47f8-a734-fede5682198e">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="2648b9ef-6fe4-43f1-abf9-8794829d1694"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[CLIENTE]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="267" y="0" width="89" height="15" forecolor="#736343" uuid="bcba985c-963b-49ea-86cc-ec57344a2086">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="06ecdd4b-9066-41e1-9a1a-acc122e485b1"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[PRODUTO]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="356" y="0" width="89" height="15" forecolor="#736343" uuid="1a122b7f-c2c3-4c51-8747-32f0bb61f7f6">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="730df7e6-112f-45ca-b531-02341e4ce46f"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[UN]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="445" y="0" width="89" height="15" forecolor="#736343" uuid="ca4ac53c-0a68-4502-995a-4bf4cd3d5b35">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="77b6370b-c0f6-49e1-ba91-4a7faaae799c"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[V. UN]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="534" y="0" width="89" height="15" forecolor="#736343" uuid="0371cdde-c420-4c96-8d0a-8b43279ac129">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="77b95e65-85ca-40f2-94b4-ef57c2267b80"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[V. ITEM]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="623" y="0" width="89" height="15" forecolor="#736343" uuid="8eb42e24-ec00-47dc-94eb-6ede95073832">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="131ec30c-5aca-4030-9716-cb59c6a9d76f"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[V. TOTAL]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="712" y="0" width="89" height="15" forecolor="#736343" uuid="7cdf36f3-0d71-4f85-8c29-86c8f9465f2a">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="54cd7934-4c56-45c8-8d53-c09e9f5ab87d"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[PAGAMENTO]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="15" splitType="Stretch">
<frame>
<reportElement style="Row" mode="Opaque" x="0" y="0" width="802" height="15" uuid="fa7cec56-4ec1-48e6-a26e-7266a995d174"/>
<textField textAdjust="StretchHeight">
<reportElement style="Detail" isPrintRepeatedValues="false" x="0" y="0" width="89" height="15" uuid="470f2a4b-9c82-447f-b058-045f8f7b6320">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="3cfcbd04-6058-4ae4-9559-fcaf41cff3d7"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{id}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" pattern="dd/MM/yyyy">
<reportElement style="Detail" x="89" y="0" width="89" height="15" uuid="3d20ac67-da36-485b-85c1-64fa11bcd1ce">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="f1b1e558-48c2-4edf-89e3-f00326230e66"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{data_venda}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight">
<reportElement style="Detail" isPrintRepeatedValues="false" x="178" y="0" width="89" height="15" uuid="717bcda6-46fc-4758-827f-5ab0d783b475">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="2648b9ef-6fe4-43f1-abf9-8794829d1694"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{nome}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight">
<reportElement style="Detail" x="267" y="0" width="89" height="15" uuid="8b5e5563-b822-4b3b-82cf-aa2652cb016b">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="06ecdd4b-9066-41e1-9a1a-acc122e485b1"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{COLUMN_4}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight">
<reportElement style="Detail" x="356" y="0" width="89" height="15" uuid="51b4525b-bbf4-42bf-b641-466821af7721">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="730df7e6-112f-45ca-b531-02341e4ce46f"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{quantidade}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" pattern="R$ #,##0.###;#,##0.###-">
<reportElement style="Detail" x="445" y="0" width="89" height="15" uuid="e894bbca-56cd-4eec-8df0-9bea51b83c39">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="77b6370b-c0f6-49e1-ba91-4a7faaae799c"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{valor}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" pattern="R$ #,##0.###;#,##0.###-">
<reportElement style="Detail" x="534" y="0" width="89" height="15" uuid="2687f8ba-75bf-4750-8d8e-cb46f7f23c88">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="77b95e65-85ca-40f2-94b4-ef57c2267b80"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{valor_total_do_item}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight">
<reportElement style="Detail" isPrintRepeatedValues="false" x="623" y="0" width="89" height="15" uuid="60c6f2c9-7bd4-4278-893a-bb1af0e02120">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="131ec30c-5aca-4030-9716-cb59c6a9d76f"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{valor_total_venda}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight">
<reportElement style="Detail" isPrintRepeatedValues="false" x="712" y="0" width="89" height="15" uuid="9f6d3f67-984d-40a1-9275-cb4fe98fb4c7">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="54cd7934-4c56-45c8-8d53-c09e9f5ab87d"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{forma_de_pagamento}]]></textFieldExpression>
</textField>
</frame>
</band>
</detail>
<columnFooter>
<band height="6" splitType="Stretch">
<line>
<reportElement positionType="FixRelativeToBottom" x="0" y="3" width="802" height="1" uuid="fa5e88d5-a011-4e32-8f12-ce923f903111"/>
<graphicElement>
<pen lineWidth="0.5" lineColor="#999999"/>
</graphicElement>
</line>
</band>
</columnFooter>
<pageFooter>
<band height="25" splitType="Stretch">
<frame>
<reportElement mode="Opaque" x="-21" y="1" width="843" height="24" forecolor="#D0B48E" backcolor="#F2EBDF" uuid="5d8169bd-4a75-48c8-8a68-6d3ad5ba9402"/>
<textField pattern="EEEEE dd MMMMM yyyy">
<reportElement style="Column header" x="22" y="0" width="197" height="24" forecolor="#736343" uuid="fbce24bb-3cb1-44a3-8eec-8c067ddbe5b5"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
<textField pattern="R$ #,##0.###;#,##0.###-">
<reportElement x="644" y="0" width="179" height="24" forecolor="#736343" uuid="70bde723-8ff5-462c-8210-53a024e848ec"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid"/>
<bottomPen lineWidth="1.0" lineStyle="Solid"/>
<rightPen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$V{Soma}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="555" y="0" width="89" height="24" forecolor="#736343" uuid="379838be-d508-4b97-995c-522af90f8019"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid"/>
<leftPen lineWidth="1.0" lineStyle="Solid"/>
<bottomPen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Valor Total:"]]></textFieldExpression>
</textField>
</frame>
</band>
</pageFooter>
<summary>
<band splitType="Stretch"/>
</summary>
</jasperReport>
Ah, a consulta ainda não está considerando o parâmetro com os IDs selecionados.
Abri seu jrxml aqui no jasper e vi que a forma como vc declarou o parâmetro está errado. Se pode ser selecionado várias vendas na tela e vc está passando uma lista de ids como parâmetro do relatório, vc deve declarar o parâmetro no jrxml como List e não como um simples Long.
Recomendo usar um nome mais indicativo para a lista de ids selecionados, como, por exemplo: idsVendasSelecionadas. Do jeito que está: idVenda, parece que é apenas uma venda que pode ser selecionada.
1 curtida
Então devo alterar isso:
<parameter name="idVenda" class="java.lang.Long"/>
para isso:
<parameter name="idVenda" class="java.util.List"/>
1 curtida
Isso mesmo. Antes de alterar a consulta, continue tentando fazer esse parâmetro dos ids das vendas aparecer no relatório.
1 curtida
Mesmo alterando o xml para:
<parameter name="idsVendasSelecionadas" class="java.util.List"/>
Vc usou o parâmetro para aparecer no relatório assim: $P{idsVendasSelecionadas}
?
Lembrando que o parâmetro declarado no relatório tem que ter o mesmo nome do valor passado no Map pela aplicação.
1 curtida
<parameter name="$P{idsVendasSelecionadas}" class="java.util.List"/>
está desta forma
A declaração do parameter no relatório pode ficar só assim mesmo:
<parameter name="idsVendasSelecionadas" class="java.util.List"/>
Apenas quando vc for usar o parâmetro, tem que ser assim: $P{idsVendasSelecionadas}
. Mas pelo que vi aqui no seu jrxml, vc estava fazendo certo já.
Agora tem que verificar se na aplicação o ids estão preenchidos corretamente no momento em que o relatório é gerado.
1 curtida
Então, pelo que foi gerado na tela, está tudo preenchido corretamente:
no mysql:
Aparentemente, tudo ok
Na app o código está assim:
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("idsVendasSelecionadas", idsVendasSelecionadas);
e no xml está assim:
`<parameter name="idsVendasSelecionadas" class="java.util.List"/>`
Ao gerar o relatório, no código java, a variável idsVendasSelecionadas está com quais valores?
1 curtida
mano estou usando Set lembra?
não deveria ser assim?:
<parameter name="idsVendasSelecionadas" class="java.util.Set"/>
Verdade. Tem que ser java.util.Set. Porém o problema mesmo é que o Set está sendo enviado null para o relatório.
1 curtida
exato…alterei testei e continua null
Mudar o tipo, não vai corrigir o valor que está null. Tem que ver na tela, se o esquema de pegar os itens selecionados está correto.
1 curtida