<?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="rel_sub_vendas_categoria" language="groovy" pageWidth="595" pageHeight="842" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="07d95488-694d-4a54-a078-e88a15a7016d"> <property name="ireport.zoom" value="4.0"/> <property name="ireport.x" value="1122"/> <property name="ireport.y" value="0"/> <parameter name="pSituacao" class="java.lang.Integer"> <defaultValueExpression><![CDATA[]]></defaultValueExpression> </parameter> <parameter name="pTipoDoc" class="java.lang.Integer"> <defaultValueExpression><![CDATA[]]></defaultValueExpression> </parameter> <parameter name="pIdCategoria" class="java.lang.Integer"> <defaultValueExpression><![CDATA[]]></defaultValueExpression> </parameter> <parameter name="dataFim" class="java.util.Date"/> <parameter name="dataInicio" class="java.util.Date"> <parameterDescription><![CDATA[]]></parameterDescription> </parameter> <queryString> <![CDATA[select m.idProduto, m.nomeProduto, m.unMed, sum(m.quantidade) as qtdTotal, round((sum(m.quantidade*m.vlrUnitario) / sum(m.quantidade)),2) as vlrUnit, round((sum(m.quantidade*m.vlrUnitario)),2) as vlrTotal from movdocs m left join produtos p on m.idProduto = p.id left join categorias c on p.idCategoria = c.id where m.tipo = 'S' and m.tipoDoc = $P{pTipoDoc} and m.situacao = $P{pSituacao} and p.idCategoria = $P{pIdCategoria} and m.dataMov between $P{dataInicio} and $P{dataFim} group by m.idProduto;]]> </queryString> <field name="idProduto" class="java.lang.Integer"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="nomeProduto" class="java.lang.String"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="unMed" class="java.lang.String"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="qtdTotal" class="java.math.BigDecimal"/> <field name="vlrUnit" class="java.math.BigDecimal"/> <field name="vlrTotal" class="java.math.BigDecimal"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <variable name="sum(vTotal)" class="java.lang.Double" calculation="Sum"> <variableExpression><![CDATA[$F{vlrTotal}]]></variableExpression> </variable> <title> <band splitType="Stretch"/> </title> <pageHeader> <band height="15" splitType="Stretch"> <line> <reportElement x="0" y="0" width="555" height="1" uuid="78e37a7e-7861-4de7-be80-27f6b4ac0ece"/> <graphicElement> <pen lineStyle="Dotted" lineColor="#999999"/> </graphicElement> </line> <staticText> <reportElement x="24" y="0" width="51" height="15" uuid="fd61ff0a-4e63-4136-ad81-b4c3aa72edab"/> <textElement verticalAlignment="Middle"/> <text><![CDATA[Código]]></text> </staticText> <staticText> <reportElement x="75" y="0" width="50" height="15" uuid="9b957a65-5d07-4a4f-8822-76f6a562349f"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <text><![CDATA[Descrição]]></text> </staticText> <staticText> <reportElement x="441" y="0" width="75" height="15" uuid="5b87fd21-d0e8-45fc-8710-bbc7946cf446"/> <textElement textAlignment="Right" verticalAlignment="Middle"/> <text><![CDATA[Total]]></text> </staticText> <line> <reportElement x="0" y="14" width="555" height="1" uuid="90fdf5c2-dd88-42ef-8212-038b2eb59c16"/> <graphicElement> <pen lineStyle="Dotted" lineColor="#999999"/> </graphicElement> </line> <staticText> <reportElement x="239" y="-1" width="40" height="15" uuid="11a8e144-616a-439a-bdf1-df2146ce5c2d"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <text><![CDATA[UN]]></text> </staticText> <staticText> <reportElement x="279" y="0" width="81" height="15" uuid="21eab38c-c971-4105-b6fd-53cdbf95d1e5"/> <textElement textAlignment="Right" verticalAlignment="Middle"/> <text><![CDATA[Quantidade]]></text> </staticText> <staticText> <reportElement x="360" y="0" width="81" height="15" uuid="01013432-1974-4369-86ab-05bc60b89320"/> <textElement textAlignment="Right" verticalAlignment="Middle"/> <text><![CDATA[Valor]]></text> </staticText> </band> </pageHeader> <detail> <band height="15" splitType="Stretch"> <textField> <reportElement x="24" y="0" width="51" height="15" uuid="8846dc4c-5242-48fd-b612-7414267874c5"/> <textElement verticalAlignment="Middle"/> <textFieldExpression><![CDATA[new DecimalFormat("000000").format($F{idProduto})]]></textFieldExpression> </textField> <textField> <reportElement x="75" y="0" width="164" height="15" uuid="bd91fef0-12e4-4b21-810e-467faff6386c"/> <textElement verticalAlignment="Middle"/> <textFieldExpression><![CDATA[$F{nomeProduto}]]></textFieldExpression> </textField> <textField pattern="¤ #,##0.00"> <reportElement x="441" y="0" width="75" height="15" uuid="0fceb8cf-d51d-46db-a3c5-ff4cec9e823d"/> <textElement textAlignment="Right" verticalAlignment="Middle"/> <textFieldExpression><![CDATA[$F{vlrTotal}]]></textFieldExpression> </textField> <textField pattern="¤ #,##0.00"> <reportElement x="360" y="0" width="81" height="15" uuid="124b9dfb-77bd-416b-83ba-9b937926964a"/> <textElement textAlignment="Right" verticalAlignment="Middle"/> <textFieldExpression><![CDATA[$F{vlrUnit}]]></textFieldExpression> </textField> <textField pattern="###0.000"> <reportElement x="279" y="0" width="81" height="15" uuid="101c68ec-f24c-4267-bb10-4c42239724b2"/> <textElement textAlignment="Right" verticalAlignment="Middle"/> <textFieldExpression><![CDATA[$F{qtdTotal}]]></textFieldExpression> </textField> <textField> <reportElement x="239" y="0" width="40" height="15" uuid="e7dd6b50-1103-4d5b-b7a1-fe25fdce1fd0"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <textFieldExpression><![CDATA[$F{unMed}]]></textFieldExpression> </textField> </band> </detail> <summary> <band height="30" splitType="Stretch"> <textField pattern="¤ #,##0.00"> <reportElement x="360" y="6" width="156" height="20" uuid="03aeebb3-ad9a-4fa6-8fde-9fa14861bc52"/> <textElement textAlignment="Right"/> <textFieldExpression><![CDATA["SubTotal: " + (new DecimalFormat("¤ #,##0.00")).format($V{sum(vTotal)})]]></textFieldExpression> </textField> <line> <reportElement x="360" y="5" width="195" height="1" uuid="c4885051-2df7-41e1-8563-8f4e801cdf9d"/> <graphicElement> <pen lineStyle="Dotted" lineColor="#999999"/> </graphicElement> </line> </band> </summary> </jasperReport>