<?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="report" language="groovy" pageWidth="595" pageHeight="842" columnWidth="525" leftMargin="42" rightMargin="28" topMargin="32" bottomMargin="32" uuid="fd614d3e-f49f-4d37-848f-ffffd7b3d536"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <background> <band splitType="Stretch"/> </background> <title> <band height="79" splitType="Stretch"/> </title> <pageHeader> <band height="35" splitType="Stretch"/> </pageHeader> <columnHeader> <band height="61" splitType="Stretch"/> </columnHeader> <detail> <band height="125" splitType="Stretch"/> </detail> <columnFooter> <band height="45" splitType="Stretch"/> </columnFooter> <pageFooter> <band height="54" splitType="Stretch"/> </pageFooter> <summary> <band height="42" splitType="Stretch"/> </summary> </jasperReport>
<queryString> <![CDATA[SELECT REFERENCE , CODE , NAME , PRICEBUY , PRICESELL FROM PRODUCTS]]> </queryString>
SELECT PRODUCTS.NAME AS PRODUCT_NAME , PRODUCTS.REFERENCE AS PRODUCT_REFERENCE , PRODUCTS.PRICESELL AS PRODUCT_PRICESELL , PRODUCTS.CATEGORY AS CATEGORY_ID , CATEGORIES.NAME AS CATEGORY_NAME , TAXES.RATE AS TAX_RATE FROM PRODUCTS LEFT OUTER JOIN CATEGORIES ON PRODUCTS.CATEGORY = CATEGORIES.ID LEFT OUTER JOIN TAXCATEGORIES ON PRODUCTS.TAXCAT = TAXCATEGORIES.ID LEFT OUTER JOIN TAXES ON TAXCATEGORIES.ID = TAXES.CATEGORY ORDER BY CATEGORIES.NAME, PRODUCTS.NAME
<field name="PRODUCT_NAME" class="java.lang.String"/> <field name="PRODUCT_REFERENCE" class="java.lang.String"/> <field name="PRODUCT_PRICESELL" class="java.lang.Double"/> <field name="CATEGORY_ID" class="java.lang.String"/> <field name="CATEGORY_NAME" class="java.lang.String"/> <field name="TAX_RATE" class="java.lang.Double"/>
<columnHeader> <band height="25" splitType="Stretch"> <staticText> <reportElement uuid="3f6fd221-3e67-43c8-99fb-42ba466921b2" x="0" y="0" width="105" height="20"/> <textElement/> <text><![CDATA[CATEGORY_NAME]]></text> </staticText> <staticText> <reportElement uuid="94d5a5b4-7214-4859-a6d5-a6c42f4613f7" x="105" y="0" width="105" height="20"/> <textElement/> <text><![CDATA[PRODUCT_REFERENCE]]></text> </staticText> <staticText> <reportElement uuid="d50c28cb-ea78-4b71-9be5-b0902bd20a3f" x="210" y="0" width="105" height="20"/> <textElement/> <text><![CDATA[PRODUCT_NAME]]></text> </staticText> <staticText> <reportElement uuid="6ddf9669-96cc-4b68-9dc3-e5a9ae8378f7" x="315" y="0" width="105" height="20"/> <textElement/> <text><![CDATA[TAX_RATE]]></text> </staticText> <staticText> <reportElement uuid="4d226419-7cf1-4bfe-97fa-3dc1ff0ef184" x="420" y="0" width="105" height="20"/> <textElement/> <text><![CDATA[PRODUCT_PRICESELL]]></text> </staticText> </band> </columnHeader> <detail> <band height="36" splitType="Stretch"> <textField> <reportElement uuid="2ba3f12f-05fc-459e-aafa-12fdc94f3b33" x="0" y="0" width="105" height="20"/> <textElement/> <textFieldExpression><![CDATA[$F{CATEGORY_NAME}]]></textFieldExpression> </textField> <textField> <reportElement uuid="0305692c-11b5-4e56-a593-67d1e5125acc" x="105" y="0" width="105" height="20"/> <textElement/> <textFieldExpression><![CDATA[$F{PRODUCT_REFERENCE}]]></textFieldExpression> </textField> <textField> <reportElement uuid="b6788acf-3936-473c-ba83-b6fc204b6df0" x="210" y="0" width="105" height="20"/> <textElement/> <textFieldExpression><![CDATA[$F{PRODUCT_NAME}]]></textFieldExpression> </textField> <textField> <reportElement uuid="c7cf41b1-72db-4683-a83f-b7b1953a4f55" x="315" y="0" width="105" height="20"/> <textElement/> <textFieldExpression><![CDATA[$F{TAX_RATE}]]></textFieldExpression> </textField> <textField> <reportElement uuid="fe6e95c1-b6c2-4cf2-94c3-3a22bc176fe9" x="420" y="0" width="105" height="20"/> <textElement/> <textFieldExpression><![CDATA[$F{PRODUCT_PRICESELL}]]></textFieldExpression> </textField> </band> </detail>
<title> <band height="36" splitType="Stretch"> <rectangle> <reportElement uuid="9fb6b6a2-ea0f-4f4d-b1a6-a31857059071" style="banner" x="0" y="0" width="525" height="36"/> <graphicElement> <pen lineWidth="0.0"/> </graphicElement> </rectangle> <staticText> <reportElement uuid="5b0c017a-ff0b-436d-a40c-80193711879f" style="title" x="2" y="2" width="365" height="32"/> <textElement> <font fontName="SansSerif" pdfFontName="DejaVu Sans" isPdfEmbedded="false"/> </textElement> <text><![CDATA[ ]]></text> </staticText> </band> </title>
<pageFooter> <band height="26" splitType="Stretch"> <line> <reportElement uuid="fa91a55e-d7ff-40ea-9c32-850fe9e071d1" x="0" y="0" width="525" height="1"/> <graphicElement> <pen lineWidth="1.5" lineStyle="Double" lineColor="#000000"/> </graphicElement> </line> <textField> <reportElement uuid="c6de22d0-f93b-4514-bd5f-991f3096f696" style="base" x="449" y="6" width="39" height="20"/> <textElement textAlignment="Right"> <font isBold="true"/> </textElement> <textFieldExpression><![CDATA[$V{PAGE_NUMBER}.toString().concat("/")]]></textFieldExpression> </textField> <textField evaluationTime="Report"> <reportElement uuid="5fe48711-cf48-4b70-8b17-0826c3aaf6ca" style="base" x="488" y="6" width="21" height="20"/> <textElement> <font isBold="true"/> </textElement> <textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression> </textField> </band> </pageFooter>
<style name="base" isDefault="true" hAlign="Left" vAlign="Middle" fontSize="12" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/> <style name="header" style="base" hAlign="Center" isBold="true"/> <style name="title" style="base" forecolor="#FFFFFF" fontSize="20" isBold="true"> <paragraph leftIndent="24"/> </style> <style name="banner" backcolor="#003278" radius="5"> <box> <pen lineWidth="0.0"/> <topPen lineWidth="0.0"/> <leftPen lineWidth="0.0"/> <bottomPen lineWidth="0.0"/> <rightPen lineWidth="0.0"/> </box> </style>
<textField> <reportElement uuid="852df6f7-daf1-4deb-8a05-94c0dba32355" style="base" x="10" y="2" width="25" height="32"/> <textElement textAlignment="Center" verticalAlignment="Top"/> <textFieldExpression><![CDATA[$V{COLUMN_COUNT}]]></textFieldExpression> </textField>
<textField> <reportElement uuid="aacdbf49-b841-46b4-b7bf-12fe12c7fb96" x="193" y="2" width="98" height="32"/> <textElement verticalAlignment="Top"/> <textFieldExpression><![CDATA[$F{PRODUCT_NAME}]]></textFieldExpression> </textField> <textField pattern="#,##0.00 ₸" isBlankWhenNull="false"> <reportElement uuid="4e564eb3-3c86-4d3b-831b-2038679ebb3f" x="296" y="2" width="84" height="32"/> <textElement textAlignment="Right" verticalAlignment="Top"/> <textFieldExpression><![CDATA[$F{PRODUCT_PRICESELL}]]></textFieldExpression> </textField> <textField pattern="#,##0 %" isBlankWhenNull="false"> <reportElement uuid="4e564eb3-3c86-4d3b-831b-2038679ebb3f" x="384" y="2" width="35" height="32"/> <textElement textAlignment="Right" verticalAlignment="Top"/> <textFieldExpression><![CDATA[$F{TAX_RATE}]]></textFieldExpression> </textField>
<textField pattern="#,##0.00 ₸" isBlankWhenNull="false"> <reportElement uuid="1158eb51-5046-4b15-88f2-2456bac9eea1" x="425" y="2" width="84" height="32"/> <textElement textAlignment="Right" verticalAlignment="Top"/> <textFieldExpression><![CDATA[$F{PRODUCT_PRICESELL} * (1.0 + $F{TAX_RATE})]]></textFieldExpression> </textField>
<group name="Categories" isReprintHeaderOnEachPage="true"> <groupExpression><![CDATA[$F{CATEGORY_ID}]]></groupExpression> <groupHeader> <band height="33" splitType="Prevent"> <textField> <reportElement uuid="8bcbd93c-b2e7-4abd-a377-a8658c3ef27a" style="base" x="40" y="6" width="148" height="20"/> <textElement> <font size="14" isBold="true"/> </textElement> <textFieldExpression><![CDATA[$F{CATEGORY_NAME}]]></textFieldExpression> </textField> <textField evaluationTime="Group" evaluationGroup="Categories" pattern="#,##0"> <reportElement uuid="871626e0-83a8-4591-bccc-fc1c507b5a60" x="384" y="6" width="125" height="20"/> <textElement> <font size="14" isBold="true"/> </textElement> <textFieldExpression><![CDATA[$V{Categories_COUNT}]]></textFieldExpression> </textField> </band> </groupHeader> </group>
<summary> <band height="30"> <line> <reportElement uuid="fa91a55e-d7ff-40ea-9c32-850fe9e071d1" x="10" y="1" width="503" height="1"/> <graphicElement> <pen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> </graphicElement> </line> <textField> <reportElement uuid="e2e2a0be-0edc-4e04-b909-4452cab89989" x="384" y="6" width="125" height="20"/> <textElement> <font size="14" isBold="true"/> </textElement> <textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression> </textField> <staticText> <reportElement uuid="9780a598-1afc-41a5-9363-ef4bf3dc6e02" x="40" y="6" width="148" height="20"/> <textElement> <font size="14" isBold="true"/> </textElement> <text><![CDATA[ ]]></text> </staticText> </band> </summary>
Source: https://habr.com/ru/post/247515/
All Articles