jasperreports-server-ce/samples/reports/SalesByMonth.jrxml

220 lines
11 KiB
XML
Executable File

<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © 2005 - 2018 TIBCO Software Inc.
~ http://www.jaspersoft.com.
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<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="SalesByMonth" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="515" leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50" scriptletClass="test.TestScriptlet" resourceBundle="sales" whenResourceMissingType="Error">
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.1" value="title"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.2" value="summary"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.4" value="pageFooter"/>
<property name="net.sf.jasperreports.export.pdf.tagged" value="true"/>
<property name="net.sf.jasperreports.export.pdf.tag.language" value="EN-US"/>
<import value="com.jaspersoft.jasperserver.api.metadata.user.domain.User"/>
<style name="Sans_Normal" isDefault="true" fontName="SansSerif" fontSize="12" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<style name="Sans_Bold" isDefault="false" fontName="SansSerif" fontSize="12" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<style name="Sans_Italic" isDefault="false" fontName="SansSerif" fontSize="12" isItalic="true" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<style name="DetailHeader" isDefault="false" style="Sans_Bold" forecolor="#FFFFFF"/>
<style name="Title" isDefault="false" style="Sans_Normal" lineSpacing="Single" fontSize="22"/>
<parameter name="TextInput" class="java.lang.Integer"/>
<parameter name="CheckboxInput" class="java.lang.Boolean">
<defaultValueExpression><![CDATA[new Boolean("true")]]></defaultValueExpression>
</parameter>
<parameter name="ListInput" class="java.lang.String">
<defaultValueExpression><![CDATA["1"]]></defaultValueExpression>
</parameter>
<parameter name="DateInput" class="java.util.Date"/>
<parameter name="QueryInput" class="java.lang.String"/>
<parameter name="LoggedInUser" class="com.jaspersoft.jasperserver.api.metadata.user.domain.User"/>
<queryString>
<![CDATA[SELECT DISTINCT
sales_date_of_close.close_year as close_year,
sales_date_of_close.close_month as close_month,
sales_date_of_close.close_month_name as close_month_name
FROM
sales_date_of_close
ORDER BY sales_date_of_close.close_year, sales_date_of_close.close_month]]>
</queryString>
<field name="close_year" class="java.lang.Short"/>
<field name="close_month" class="java.lang.Short"/>
<field name="close_month_name" class="java.lang.String"/>
<variable name="MonthAmount" class="java.lang.Float" calculation="System"/>
<title>
<band height="220" splitType="Stretch">
<line>
<reportElement x="0" y="1" width="515" height="1" forecolor="#000000"/>
</line>
<image scaleImage="RetainShape" hAlign="Center" vAlign="Middle">
<reportElement x="0" y="10" width="150" height="26"/>
<imageExpression class="java.lang.String"><![CDATA["repo:/images/JRLogo"]]></imageExpression>
<hyperlinkTooltipExpression><![CDATA["JasperReports Logo"]]></hyperlinkTooltipExpression>
</image>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement style="Title" x="160" y="10" width="355" height="30"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$R{title}]]></textFieldExpression>
</textField>
<frame>
<reportElement style="Title" positionType="Float" x="160" y="40" width="300" height="30" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf($P{TextInput} != null)]]></printWhenExpression>
</reportElement>
<textField>
<reportElement style="Title" x="0" y="0" width="150" height="30"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$R{param.number}]]></textFieldExpression>
</textField>
<textField pattern="#,###" isBlankWhenNull="true">
<reportElement style="Title" x="150" y="0" width="150" height="30"/>
<textElement/>
<textFieldExpression class="java.lang.Number"><![CDATA[$P{TextInput}]]></textFieldExpression>
</textField>
</frame>
<textField>
<reportElement style="Title" positionType="Float" x="160" y="70" width="300" height="30" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$P{CheckboxInput}]]></printWhenExpression>
</reportElement>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$R{param.checkbox}]]></textFieldExpression>
</textField>
<frame>
<reportElement style="Title" positionType="Float" x="160" y="100" width="300" height="30" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf($P{ListInput} != null)]]></printWhenExpression>
</reportElement>
<textField>
<reportElement style="Title" x="0" y="0" width="150" height="30"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$R{param.list}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement style="Title" x="150" y="0" width="150" height="30"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$P{ListInput}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement style="Title" positionType="Float" x="160" y="130" width="300" height="30" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf($P{DateInput} != null)]]></printWhenExpression>
</reportElement>
<textField>
<reportElement style="Title" x="0" y="0" width="150" height="30"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$R{param.date}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="medium,hide" isBlankWhenNull="true">
<reportElement style="Title" x="150" y="0" width="150" height="30"/>
<textElement/>
<textFieldExpression class="java.util.Date"><![CDATA[$P{DateInput}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement style="Title" positionType="Float" x="160" y="160" width="300" height="30" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf($P{QueryInput} != null)]]></printWhenExpression>
</reportElement>
<textField>
<reportElement style="Title" x="0" y="0" width="150" height="30"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$R{param.query}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement style="Title" x="150" y="0" width="150" height="30"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$P{QueryInput}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement style="Title" positionType="Float" x="160" y="190" width="300" height="30" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf($P{LoggedInUser} != null)]]></printWhenExpression>
</reportElement>
<textField>
<reportElement style="Title" x="0" y="0" width="150" height="30"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$R{param.user}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement style="Title" x="150" y="0" width="150" height="30"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$P{LoggedInUser}.getFullName()]]></textFieldExpression>
</textField>
</frame>
</band>
</title>
<detail>
<band height="50" splitType="Stretch">
<frame>
<reportElement mode="Opaque" x="0" y="0" width="515" height="16" backcolor="#333333">
<property name="net.sf.jasperreports.export.pdf.tag.h1" value="full"/>
</reportElement>
<box>
<bottomPen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textField>
<reportElement style="DetailHeader" x="20" y="0" width="200" height="16"/>
<textElement textAlignment="Left"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{close_month_name}+ ", " + $F{close_year}]]></textFieldExpression>
</textField>
<textField evaluationTime="Band" pattern="#0.00">
<reportElement style="DetailHeader" x="410" y="0" width="95" height="16"/>
<textElement textAlignment="Right"/>
<textFieldExpression class="java.lang.Float"><![CDATA[$V{MonthAmount}]]></textFieldExpression>
</textField>
</frame>
<subreport>
<reportElement x="0" y="16" width="515" height="25"/>
<subreportParameter name="CloseMonth">
<subreportParameterExpression><![CDATA[$F{close_month}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="CloseYear">
<subreportParameterExpression><![CDATA[$F{close_year}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<returnValue subreportVariable="totalAmount" toVariable="MonthAmount"/>
<subreportExpression class="java.lang.String"><![CDATA["repo:SalesByMonthDetail"]]></subreportExpression>
</subreport>
</band>
</detail>
<pageFooter>
<band height="40" splitType="Stretch">
<line>
<reportElement x="0" y="10" width="515" height="1"/>
</line>
<textField isStretchWithOverflow="true">
<reportElement x="200" y="20" width="80" height="16"/>
<textElement textAlignment="Right"/>
<textFieldExpression class="java.lang.String"><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" evaluationTime="Report">
<reportElement x="280" y="20" width="75" height="16"/>
<textElement textAlignment="Left"/>
<textFieldExpression class="java.lang.String"><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="100" splitType="Stretch">
<image scaleImage="Clip" hAlign="Center" vAlign="Middle">
<reportElement x="0" y="10" width="515" height="70"/>
<imageExpression class="java.lang.String"><![CDATA["repo:Logo"]]></imageExpression>
<hyperlinkTooltipExpression><![CDATA["JasperReports Logo"]]></hyperlinkTooltipExpression>
</image>
<textField isStretchWithOverflow="true">
<reportElement x="100" y="80" width="315" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Bottom"/>
<textFieldExpression class="java.lang.String"><![CDATA[$P{REPORT_SCRIPTLET}.message()]]></textFieldExpression>
</textField>
</band>
</summary>
</jasperReport>