IDEMPIERE-5922 Jasper Report: support loading of jasper report file from non-fragment bundle (#2096)

This commit is contained in:
hengsin 2023-11-08 20:29:20 +08:00 committed by GitHub
parent ee66699d4a
commit d58fb15f18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1032 additions and 4 deletions

View File

@ -14,6 +14,7 @@ Import-Package: com.zaxxer.sparsebits;version="1.2.0",
org.jfree.chart,
org.jfree.chart.plot,
org.osgi.framework;version="1.10.0",
org.osgi.framework.wiring;version="1.2.0",
org.osgi.service.event
Require-Bundle: org.adempiere.base;bundle-version="0.0.0",
net.sf.jasperreports.engine;bundle-version="6.3.1",

View File

@ -33,12 +33,15 @@ import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Optional;
import java.util.logging.Level;
import org.compiere.util.CLogger;
import org.compiere.util.Language;
import org.compiere.utils.DigestOfFile;
import org.osgi.framework.Bundle;
/**
*
@ -75,12 +78,29 @@ public class BundleResourceLoader {
boolean empty = true;
String parentPath = "/";
String bundleFileName = resourceName;
String bundleName = null;
//check is resource name include optional bundle symbolic name (syntax -> bundle:bundleSymbolicName:jasperReportFileName)
if (resourceName.indexOf(":") > 0) {
bundleName = resourceName.substring(0, resourceName.indexOf(":"));
resourceName = resourceName.substring(resourceName.indexOf(":")+1);
bundleFileName = resourceName;
}
if (resourceName.lastIndexOf("/") > 0) {
parentPath = "/"+resourceName.substring(0, resourceName.lastIndexOf("/"));
bundleFileName = resourceName.substring(resourceName.lastIndexOf("/")+1);
}
URL url = null;
Enumeration<URL> entries = Activator.getBundleContext().getBundle().findEntries(parentPath, bundleFileName, false);
Bundle bundle = null;
//if resource name include optional bundle symbolic name, load from specific bundle
if (bundleName == null) {
bundle = Activator.getBundleContext().getBundle();
} else {
String symbolicName = bundleName;
Optional<Bundle> optional = Arrays.stream(Activator.getBundleContext().getBundles()).filter(b -> b.getSymbolicName().equals(symbolicName)).findFirst();
if (optional.isPresent())
bundle = optional.get();
}
Enumeration<URL> entries = bundle != null ? bundle.findEntries(parentPath, bundleFileName, false) : null;
if (entries != null && entries.hasMoreElements())
url = entries.nextElement();
if (url != null) {

View File

@ -33,11 +33,15 @@ import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.Arrays;
import java.util.Optional;
import java.util.logging.Level;
import org.compiere.util.CLogger;
import org.compiere.util.Language;
import org.compiere.utils.DigestOfFile;
import org.osgi.framework.Bundle;
import org.osgi.framework.wiring.BundleWiring;
/**
*
@ -72,6 +76,22 @@ public class ClassResourceLoader {
URL url = null;
File reportFile = null;
String resourceName = path.startsWith(RESOURCE_PATH_PREFIX) ? path.substring(RESOURCE_PATH_PREFIX.length()).trim() : path.trim();
Bundle bundle = null;
//if resource name include optional bundle symbolic name (syntax -> resource:bundleSymbolicName:jasperReportFileName), find the specific bundle
if (resourceName.indexOf(":") > 0) {
String symbolicName = resourceName.substring(0, resourceName.indexOf(":"));
resourceName = resourceName.substring(resourceName.indexOf(":")+1);
Optional<Bundle> optional = Arrays.stream(Activator.getBundleContext().getBundles()).filter(b -> b.getSymbolicName().equals(symbolicName)).findFirst();
if (optional.isPresent())
bundle = optional.get();
}
ClassLoader classLoader = null;
//if resource name include optional bundle symbolic name, use classLoader of the specific bundle
if (bundle != null) {
classLoader = bundle.adapt(BundleWiring.class).getClassLoader();
} else {
classLoader = getClass().getClassLoader();
}
//only copy to tmp if reportPath is jrxml file (for compilation)
if (resourceName.endsWith(".jrxml")) {
String localResourceName = toLocalName(resourceName);
@ -89,7 +109,7 @@ public class ClassResourceLoader {
String extension = localFileName.substring(localFileName.lastIndexOf("."));
File tmpOutputFile = null;
url = getClass().getClassLoader().getResource(resourceName);
url = classLoader.getResource(resourceName);
if (url != null) {
try (InputStream inputStream = url.openStream()) {
if (inputStream != null) {
@ -131,7 +151,7 @@ public class ClassResourceLoader {
}
}
} else {
url = getClass().getClassLoader().getResource(resourceName);
url = classLoader.getResource(resourceName);
empty = (url == null);
}

View File

@ -0,0 +1,867 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.16.0.final using JasperReports Library version 6.16.0-48579d909b7943b64690c65c71e07e0b80981928 -->
<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="AR_Invoice" language="groovy" pageWidth="595" pageHeight="842" columnWidth="540" leftMargin="35" rightMargin="20" topMargin="30" bottomMargin="20" isFloatColumnFooter="true" uuid="62c38dfb-5c12-421e-8082-ab1ebdc8c5ba">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Local Test Breuer"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<parameterDescription><![CDATA[]]></parameterDescription>
<defaultValueExpression><![CDATA["./"]]></defaultValueExpression>
</parameter>
<parameter name="RECORD_ID" class="java.lang.Integer">
<parameterDescription><![CDATA[Waarschuwing.]]></parameterDescription>
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="CURRENT_LANG" class="java.lang.String" isForPrompting="false">
<parameterDescription><![CDATA[]]></parameterDescription>
<defaultValueExpression><![CDATA["en_US"]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[SELECT
i.documentno,
i.description,
i.dateinvoiced,
i.dateprinted,
i.dateordered,
i.totallines,
i.grandtotal,
i.paymentrule,
il.line,
il.description AS ildescription,
il.qtyinvoiced,
il.pricelist,
il.taxamt,
il.linenetamt,
il.linetotalamt,
il.qtyentered,
il.priceentered,
p.value AS prodvalue,
p.name AS prodname,
p.description AS proddescription,
coalesce(it.taxamt,0) AS taxtotamt,
coalesce(t.rate,0) AS taxrate,
t.name AS taxname,
uom.name AS uomname,
bp.value AS custnum,
bp.name AS custname,
bp.name2 AS custname2,
bp.taxid AS taxid,
l.address1,
l.address2,
l.address3,
l.address4,
l.postal,
l.city,
r.name AS region,
c.name AS country,
u.name AS invoicerefuser,
im.binarydata,
cu.iso_code,
pt.name AS paytermname,
o.name as orgname,
oi.phone AS orgphone,
oi.email AS orgmail,
dt.name AS dtname
FROM c_invoice i
JOIN c_invoiceline il ON il.c_invoice_id = i.c_invoice_id
JOIN c_doctype dt ON dt.c_doctype_id = i.c_doctype_id
JOIN m_product p ON p.m_product_id = il.m_product_id
JOIN c_bpartner bp ON bp.c_bpartner_id = i.c_bpartner_id
JOIN c_bpartner_location bpl ON bpl.c_bpartner_location_id = i.c_bpartner_location_id
JOIN c_location l ON l.c_location_id = bpl.c_location_id
JOIN c_region r ON r.c_region_id = l.c_region_id
JOIN c_country c ON c.c_country_id = l.c_country_id
LEFT JOIN ad_user u ON u.ad_user_id = i.ad_user_id
LEFT JOIN c_invoicetax it ON it.c_invoice_id = il.c_invoice_id
LEFT JOIN c_tax t ON t.c_tax_id = it.c_tax_id
JOIN ad_orginfo oi ON oi.ad_org_id = il.ad_org_id
JOIN ad_org o ON o.ad_org_id = il.ad_org_id
LEFT JOIN ad_image im ON im.ad_image_id = oi.logo_id
JOIN c_currency cu ON cu.c_currency_id = i.c_currency_id
JOIN c_uom uom ON uom.c_uom_id = il.c_uom_id
LEFT JOIN c_paymentterm pt ON pt.c_paymentterm_id = bp.c_paymentterm_id
WHERE
i.c_invoice_id = $P{RECORD_ID}
ORDER BY
il.line ASC]]>
</queryString>
<field name="documentno" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="documentno"/>
<property name="com.jaspersoft.studio.field.label" value="documentno"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_invoice"/>
</field>
<field name="description" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="description"/>
<property name="com.jaspersoft.studio.field.label" value="description"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_invoice"/>
</field>
<field name="dateinvoiced" class="java.sql.Timestamp">
<property name="com.jaspersoft.studio.field.name" value="dateinvoiced"/>
<property name="com.jaspersoft.studio.field.label" value="dateinvoiced"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_invoice"/>
</field>
<field name="dateprinted" class="java.sql.Timestamp">
<property name="com.jaspersoft.studio.field.name" value="dateprinted"/>
<property name="com.jaspersoft.studio.field.label" value="dateprinted"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_invoice"/>
</field>
<field name="dateordered" class="java.sql.Timestamp">
<property name="com.jaspersoft.studio.field.name" value="dateordered"/>
<property name="com.jaspersoft.studio.field.label" value="dateordered"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_invoice"/>
</field>
<field name="totallines" class="java.math.BigDecimal">
<property name="com.jaspersoft.studio.field.name" value="totallines"/>
<property name="com.jaspersoft.studio.field.label" value="totallines"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_invoice"/>
</field>
<field name="grandtotal" class="java.math.BigDecimal">
<property name="com.jaspersoft.studio.field.name" value="grandtotal"/>
<property name="com.jaspersoft.studio.field.label" value="grandtotal"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_invoice"/>
</field>
<field name="paymentrule" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="paymentrule"/>
<property name="com.jaspersoft.studio.field.label" value="paymentrule"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_invoice"/>
</field>
<field name="line" class="java.math.BigDecimal">
<property name="com.jaspersoft.studio.field.name" value="line"/>
<property name="com.jaspersoft.studio.field.label" value="line"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_invoiceline"/>
</field>
<field name="ildescription" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="ildescription"/>
<property name="com.jaspersoft.studio.field.label" value="ildescription"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_invoiceline"/>
</field>
<field name="qtyinvoiced" class="java.math.BigDecimal">
<property name="com.jaspersoft.studio.field.name" value="qtyinvoiced"/>
<property name="com.jaspersoft.studio.field.label" value="qtyinvoiced"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_invoiceline"/>
</field>
<field name="pricelist" class="java.math.BigDecimal">
<property name="com.jaspersoft.studio.field.name" value="pricelist"/>
<property name="com.jaspersoft.studio.field.label" value="pricelist"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_invoiceline"/>
</field>
<field name="taxamt" class="java.math.BigDecimal">
<property name="com.jaspersoft.studio.field.name" value="taxamt"/>
<property name="com.jaspersoft.studio.field.label" value="taxamt"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_invoiceline"/>
</field>
<field name="linenetamt" class="java.math.BigDecimal">
<property name="com.jaspersoft.studio.field.name" value="linenetamt"/>
<property name="com.jaspersoft.studio.field.label" value="linenetamt"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_invoiceline"/>
</field>
<field name="linetotalamt" class="java.math.BigDecimal">
<property name="com.jaspersoft.studio.field.name" value="linetotalamt"/>
<property name="com.jaspersoft.studio.field.label" value="linetotalamt"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_invoiceline"/>
</field>
<field name="qtyentered" class="java.math.BigDecimal">
<property name="com.jaspersoft.studio.field.name" value="qtyentered"/>
<property name="com.jaspersoft.studio.field.label" value="qtyentered"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_invoiceline"/>
</field>
<field name="priceentered" class="java.math.BigDecimal">
<property name="com.jaspersoft.studio.field.name" value="priceentered"/>
<property name="com.jaspersoft.studio.field.label" value="priceentered"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_invoiceline"/>
</field>
<field name="prodvalue" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="prodvalue"/>
<property name="com.jaspersoft.studio.field.label" value="prodvalue"/>
<property name="com.jaspersoft.studio.field.tree.path" value="m_product"/>
</field>
<field name="prodname" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="prodname"/>
<property name="com.jaspersoft.studio.field.label" value="prodname"/>
<property name="com.jaspersoft.studio.field.tree.path" value="m_product"/>
</field>
<field name="proddescription" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="proddescription"/>
<property name="com.jaspersoft.studio.field.label" value="proddescription"/>
<property name="com.jaspersoft.studio.field.tree.path" value="m_product"/>
</field>
<field name="taxtotamt" class="java.math.BigDecimal">
<property name="com.jaspersoft.studio.field.name" value="taxtotamt"/>
<property name="com.jaspersoft.studio.field.label" value="taxtotamt"/>
</field>
<field name="taxrate" class="java.math.BigDecimal">
<property name="com.jaspersoft.studio.field.name" value="taxrate"/>
<property name="com.jaspersoft.studio.field.label" value="taxrate"/>
</field>
<field name="taxname" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="taxname"/>
<property name="com.jaspersoft.studio.field.label" value="taxname"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_tax"/>
</field>
<field name="uomname" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="uomname"/>
<property name="com.jaspersoft.studio.field.label" value="uomname"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_uom"/>
</field>
<field name="custnum" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="custnum"/>
<property name="com.jaspersoft.studio.field.label" value="custnum"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_bpartner"/>
</field>
<field name="custname" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="custname"/>
<property name="com.jaspersoft.studio.field.label" value="custname"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_bpartner"/>
</field>
<field name="custname2" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="custname2"/>
<property name="com.jaspersoft.studio.field.label" value="custname2"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_bpartner"/>
</field>
<field name="taxid" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="taxid"/>
<property name="com.jaspersoft.studio.field.label" value="taxid"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_bpartner"/>
</field>
<field name="address1" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="address1"/>
<property name="com.jaspersoft.studio.field.label" value="address1"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_location"/>
</field>
<field name="address2" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="address2"/>
<property name="com.jaspersoft.studio.field.label" value="address2"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_location"/>
</field>
<field name="address3" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="address3"/>
<property name="com.jaspersoft.studio.field.label" value="address3"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_location"/>
</field>
<field name="address4" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="address4"/>
<property name="com.jaspersoft.studio.field.label" value="address4"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_location"/>
</field>
<field name="postal" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="postal"/>
<property name="com.jaspersoft.studio.field.label" value="postal"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_location"/>
</field>
<field name="city" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="city"/>
<property name="com.jaspersoft.studio.field.label" value="city"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_location"/>
</field>
<field name="region" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="region"/>
<property name="com.jaspersoft.studio.field.label" value="region"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_region"/>
</field>
<field name="country" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="country"/>
<property name="com.jaspersoft.studio.field.label" value="country"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_country"/>
</field>
<field name="invoicerefuser" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="invoicerefuser"/>
<property name="com.jaspersoft.studio.field.label" value="invoicerefuser"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ad_user"/>
</field>
<field name="binarydata" class="byte[]">
<property name="com.jaspersoft.studio.field.name" value="binarydata"/>
<property name="com.jaspersoft.studio.field.label" value="binarydata"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ad_image"/>
</field>
<field name="iso_code" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="iso_code"/>
<property name="com.jaspersoft.studio.field.label" value="iso_code"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_currency"/>
</field>
<field name="paytermname" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="paytermname"/>
<property name="com.jaspersoft.studio.field.label" value="paytermname"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_paymentterm"/>
</field>
<field name="orgname" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="orgname"/>
<property name="com.jaspersoft.studio.field.label" value="orgname"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ad_org"/>
</field>
<field name="orgphone" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="orgphone"/>
<property name="com.jaspersoft.studio.field.label" value="orgphone"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ad_orginfo"/>
</field>
<field name="orgmail" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="orgmail"/>
<property name="com.jaspersoft.studio.field.label" value="orgmail"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ad_orginfo"/>
</field>
<field name="dtname" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="dtname"/>
<property name="com.jaspersoft.studio.field.label" value="dtname"/>
<property name="com.jaspersoft.studio.field.tree.path" value="c_doctype"/>
</field>
<variable name="linenetamt_SUM" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{linenetamt}]]></variableExpression>
</variable>
<variable name="taxamt_SUM" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{taxamt}]]></variableExpression>
</variable>
<variable name="priceentered_2_SUM" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{priceentered}]]></variableExpression>
</variable>
<background>
<band splitType="Stretch"/>
</background>
<pageHeader>
<band height="232" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<textField>
<reportElement x="340" y="10" width="200" height="10" uuid="08ede401-eccc-4a0c-95dd-f3911d280d63">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right">
<font size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{address1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="340" y="20" width="200" height="10" uuid="76e9641f-4c95-43ab-836d-4255d15b6bbc">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right">
<font size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{address2}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="340" y="0" width="200" height="10" uuid="2954ec98-aaf7-4bf7-9a61-506e28c8663b">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right">
<font size="8" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{orgname}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="340" y="40" width="200" height="10" uuid="4216cbbe-6091-4fe0-a736-cac6bbb3b3e4">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right">
<font size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{orgmail}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="340" y="30" width="200" height="10" uuid="69d623b7-79e7-40a7-bd75-302a45ef61c2">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right">
<font size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{orgphone}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="340" y="50" width="200" height="10" uuid="c0f22140-b229-4806-bf1c-75ffb302ed85">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right">
<font size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{country}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="340" y="60" width="200" height="10" uuid="f50db898-e39c-4cfb-ba00-7c7a802ecb4c">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right">
<font size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{taxname}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight">
<reportElement x="5" y="199" width="100" height="21" uuid="82060245-6328-4d2b-b0b5-c56a33a5278c">
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Left">
<font size="18" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{dtname}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight">
<reportElement x="6" y="220" width="529" height="11" uuid="ca9ff695-193b-42a7-8486-cede5b0d478e">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement markup="html">
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[($F{description} == null ? "" : "<br>"+ $F{description})]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight">
<reportElement x="340" y="110" width="200" height="11" uuid="21d70622-dd11-4eb6-8ea8-a84d265350e9">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textElement textAlignment="Right" markup="html">
<font size="9" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[($F{custnum} == null ? "" : "<b>CUSTOMER:</b> " + $F{custnum}) +
($F{documentno} == null ? "" : "<br><b>INVOICE:</b> " + $F{documentno}) +
($F{dateinvoiced} == null ? "" : "<BR><b>DATE:</b> " + DATEFORMAT($F{dateinvoiced},"dd-MM-yyyy"))]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight">
<reportElement x="5" y="110" width="240" height="11" uuid="41229863-f38b-4034-ad2c-533b96c1a018">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement markup="html">
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[($F{custname} == null ? "" : $F{custname}) +
($F{custname2} == null ? "" : "<br>" + $F{custname2})]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight">
<reportElement positionType="Float" x="5" y="121" width="240" height="11" uuid="044db3ba-d8cf-4bba-a3ac-90dc0934f1f7">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement markup="html">
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[($F{address1} == null ? "" : $F{address1}) +
($F{address2} == null ? "" : "<br>" + $F{address2}) +
($F{address3} == null ? "" : "<br>" + $F{address3}) +
($F{address4} == null ? "" : "<br>" + $F{address4})]]></textFieldExpression>
</textField>
<textField>
<reportElement positionType="Float" x="5" y="132" width="240" height="11" uuid="847b4968-d48a-4c5f-a05e-99accd61ac49">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{region} + " " + $F{postal} + " " + $F{city}]]></textFieldExpression>
</textField>
<textField>
<reportElement positionType="Float" x="5" y="143" width="240" height="11" uuid="fd66f31c-45d3-4929-8b49-7d90b6bea370">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{country}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="20" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<textField>
<reportElement x="460" y="3" width="80" height="11" uuid="45a90a57-89dc-4599-9bf7-24210451ec31">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right">
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["TOTAL"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="430" y="3" width="30" height="11" uuid="bf64c0b1-a969-4c33-843e-1534fd53916e">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right">
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["DISCOUNT"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="380" y="3" width="50" height="11" uuid="e41fae9c-c4bd-448a-b445-52809997b07d">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right">
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["PRICE"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="340" y="3" width="40" height="11" uuid="735a0d88-5180-467a-b6c9-9fb01b07904a">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right">
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["UOM"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="300" y="3" width="40" height="11" uuid="a7277a49-165c-463b-ac4e-35c9a020ed95">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right">
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["QTY"]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight">
<reportElement x="34" y="3" width="266" height="11" uuid="77ee6573-5b77-419f-a744-86c127490278">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Left">
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["DESC"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="2" y="3" width="26" height="11" uuid="3162c7ec-e507-40d0-b5bd-d82c8f4cf6ae">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right">
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["LINE"]]></textFieldExpression>
</textField>
<line>
<reportElement x="0" y="0" width="540" height="1" uuid="d0baba45-5970-4fb6-84e2-4a93a8431f7d">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
</line>
<line>
<reportElement x="0" y="16" width="540" height="1" uuid="7d04d9da-c923-424d-937a-7af0c4b26cba">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
</line>
</band>
</columnHeader>
<detail>
<band height="31" splitType="Stretch">
<rectangle>
<reportElement stretchType="ContainerHeight" x="0" y="0" width="542" height="31" backcolor="#EEEEEE" uuid="02804adc-dd3a-41bf-a408-d9402a0e5d15">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[ISEVEN($V{REPORT_COUNT})]]></printWhenExpression>
</reportElement>
<graphicElement>
<pen lineWidth="0.0"/>
</graphicElement>
</rectangle>
<textField>
<reportElement x="2" y="1" width="26" height="14" uuid="dc53ea41-70b5-4fd3-832e-047e530d1174">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="a5ca8cab-1f35-4013-9a3d-e61e77ececd0"/>
<printWhenExpression><![CDATA[$F{uomname} != 'txt']]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{line}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00#">
<reportElement x="300" y="1" width="40" height="14" uuid="2136a2f1-b32e-4940-8882-a07f10f4f7ef">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="7fe9780d-9a32-4876-981c-3b86a46549a8"/>
<printWhenExpression><![CDATA[$F{uomname} != 'txt']]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{qtyinvoiced}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
<reportElement positionType="FixRelativeToBottom" x="34" y="17" width="506" height="14" uuid="fbf47e75-1f7a-4aa2-a220-38d292d86bb9">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="ee6a2493-d7aa-4cb9-811b-10ce8eb9c634"/>
<printWhenExpression><![CDATA[$F{uomname} != 'txt']]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Middle">
<font size="9"/>
<paragraph lineSpacing="Proportional"/>
</textElement>
<textFieldExpression><![CDATA[LTRIM($F{proddescription} + " ") + $F{ildescription}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="34" y="1" width="266" height="14" uuid="0aca123b-5ac0-45cd-bc8b-0f3889b05068">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bb17d6df-d373-43d4-a461-14fb4bca3dc5"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<printWhenExpression><![CDATA[$F{uomname} != 'txt']]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Middle">
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA["["+ $F{prodvalue} + "] "+$F{prodname}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="340" y="1" width="40" height="14" uuid="98560507-1ec3-4f5c-b3d1-2d4c9542dee4">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="a7245c2b-6a99-4ae5-8708-781021815d97"/>
<printWhenExpression><![CDATA[$F{uomname} != 'txt']]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{uomname}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;#,##0.00- ">
<reportElement x="380" y="1" width="50" height="14" uuid="4b4aa062-8619-4471-8e14-e2368879e98d">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="3cbae2ff-aa17-46cd-9b52-a764398333c6"/>
<printWhenExpression><![CDATA[$F{uomname} != 'txt']]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{pricelist}]]></textFieldExpression>
</textField>
<textField pattern="¤ #,##0.00;¤ #,##0.00- ">
<reportElement positionType="Float" x="460" y="1" width="80" height="14" uuid="460cd94c-fb2f-4fe0-90e5-0d381da90b4e">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="081373e2-5b55-4081-82dd-fea4d4884fcc"/>
<printWhenExpression><![CDATA[$F{uomname} != 'txt']]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{linenetamt}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement x="34" y="1" width="256" height="14" backcolor="#EEEEEE" uuid="2093b7c7-ffe7-4ad9-9bb2-f7041902809a">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<printWhenExpression><![CDATA[ISEVEN($V{REPORT_COUNT}) && $F{uomname} == 'txt']]></printWhenExpression>
</reportElement>
<graphicElement>
<pen lineWidth="0.0" lineColor="#EEEEEE"/>
</graphicElement>
</rectangle>
<textField>
<reportElement x="34" y="1" width="196" height="14" uuid="669b04c0-b368-4c60-865b-690426d8d342">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bb17d6df-d373-43d4-a461-14fb4bca3dc5"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<printWhenExpression><![CDATA[$F{uomname} == 'txt']]></printWhenExpression>
</reportElement>
<box>
<pen lineWidth="0.25"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{prodname}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="242" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<textField pattern="¤ #,##0.00;¤ #,##0.00- ">
<reportElement x="460" y="10" width="80" height="12" uuid="b89c5b73-2295-486c-9ab5-9ea1be665230">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{totallines}]]></textFieldExpression>
</textField>
<textField pattern="¤ #,##0.00;¤ #,##0.00- ">
<reportElement x="460" y="30" width="80" height="12" uuid="1201ead6-f805-47f4-8dc8-099d456f0f25">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{taxtotamt}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="300" y="30" width="160" height="12" uuid="e2173dd2-98fc-41a4-9f08-934e2732281c">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement textAlignment="Left"/>
<textFieldExpression><![CDATA["TAX: " + $F{taxname} + " " + $F{taxrate} + " %"]]></textFieldExpression>
</textField>
<textField pattern="¤ #,##0.00;¤ #,##0.00- ">
<reportElement x="460" y="50" width="80" height="12" uuid="f3fb1c5b-ea2b-4efc-949a-6734422a8ede">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textElement textAlignment="Right">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{grandtotal}]]></textFieldExpression>
</textField>
<line>
<reportElement x="0" y="1" width="540" height="1" uuid="8bf81aff-f94c-4f98-95c0-fd6ac705e48a">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
</line>
<line>
<reportElement x="300" y="43" width="240" height="1" uuid="0205e1ba-db40-42f4-a393-448ae9731e84">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
</line>
<line>
<reportElement x="0" y="67" width="540" height="1" uuid="4bb854ac-4c7a-45b4-a3be-073f3e789d7d">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
</line>
<textField>
<reportElement positionType="Float" x="300" y="50" width="160" height="12" uuid="9de31fea-96c6-41d8-9b0b-f409ca4b4a09">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Left">
<font size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Grand Total"]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight">
<reportElement positionType="Float" x="0" y="84" width="540" height="24" uuid="e5978041-3278-45d7-b853-36ffcb940927">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[$F{paymentrule}=="P"]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center">
<font size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Payment Term " + $F{paytermname}]]></textFieldExpression>
</textField>
<textField>
<reportElement positionType="Float" x="300" y="10" width="160" height="12" uuid="b17ee29e-bdc8-4a4b-afdf-047df7de42c6">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Left">
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA["Sub Total"]]></textFieldExpression>
</textField>
</band>
</columnFooter>
<pageFooter>
<band height="40" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<line>
<reportElement x="0" y="28" width="540" height="1" uuid="b4d9c31c-396c-4274-a7d0-b7ebc7ad2c84">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
</line>
<textField textAdjust="StretchHeight">
<reportElement x="270" y="30" width="260" height="10" uuid="137cc0d1-0b46-4d6b-82ee-d9612ba38f10">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA["INVOICE: " + $F{documentno} + " DATE: " + new SimpleDateFormat("dd-MM-yyyy").format($F{dateinvoiced}.getTime()) + ", PAGE: " + $V{PAGE_NUMBER} + " OF"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="490" y="30" width="50" height="10" uuid="a7cc0c90-10d4-45bc-a15a-4d91453ff088">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
</jasperReport>

View File

@ -2,5 +2,6 @@ source.. = src/
output.. = target/classes/
bin.includes = META-INF/,\
.,\
OSGI-INF/
OSGI-INF/,\
AR_Invoice_Bundle.jrxml
jre.compilation.profile = JavaSE-17

View File

@ -145,4 +145,123 @@ public class PrintWithinProcess extends AbstractTestCase {
throw new AdempiereException("Resource " + resource + " not found");
}
@Test
public void testPrintWithBundleResource() {
Properties ctx = Env.getCtx();
String trxName = getTrxName();
MProcess process = null;
try {
process = new MProcess(ctx, 0, trxName);
process.set_ValueNoCheck("AD_Client_ID", 0);
process.setAD_Org_ID(0);
process.setJasperReport("bundle:org.idempiere.test:/AR_Invoice_Bundle.jrxml");
process.setName("Test Invoice Jasper");
process.setValue("Test_Invoice_Jasper");
process.saveCrossTenantSafeEx();
commit();
List<MInvoice> invoices = new Query(ctx, MInvoice.Table_Name, "C_Invoice_ID IN (?,?)", trxName)
.setClient_ID()
.setOnlyActiveRecords(true)
.setParameters(103, 109)
.list();
for (MInvoice invoice : invoices) {
invoice.setDescription("Test Printing within a Process");
invoice.saveEx();
}
ProcessInfo pi = new ProcessInfo (process.getName(), process.getAD_Process_ID());
pi.setClassName(ProcessUtil.JASPER_STARTER_CLASS);
pi.setAD_User_ID(getAD_User_ID());
pi.setAD_Client_ID(getAD_Client_ID());
pi.setPrintPreview(false);
pi.setIsBatch(true);
Trx trx = Trx.get(trxName, false);
List<File> pdfList = new ArrayList<File>();
for (MInvoice invoice : invoices) {
pi.setRecord_ID(invoice.getC_Invoice_ID());
ProcessUtil.startJavaProcess(Env.getCtx(), pi, trx, false);
assertFalse(pi.isError(), pi.getSummary());
assertFalse(pi.getPDFReport() == null);
pdfList.add(pi.getPDFReport());
}
assertFalse(pdfList.isEmpty());
} finally {
rollback();
if (process != null) {
int oldRole = Env.getAD_Role_ID(ctx);
try {
PO.setCrossTenantSafe();
Env.setContext(ctx, Env.AD_ROLE_ID, 0); // to allow deleting process
process.deleteEx(true);
} finally {
Env.setContext(ctx, Env.AD_ROLE_ID, oldRole);
PO.clearCrossTenantSafe();
}
}
commit();
}
}
@Test
public void testPrintWithClassPathResource() {
Properties ctx = Env.getCtx();
String trxName = getTrxName();
MProcess process = null;
try {
process = new MProcess(ctx, 0, trxName);
process.set_ValueNoCheck("AD_Client_ID", 0);
process.setAD_Org_ID(0);
process.setJasperReport("resource:org.idempiere.test:org/idempiere/test/jasper/AR_Invoice.jrxml");
process.setName("Test Invoice Jasper");
process.setValue("Test_Invoice_Jasper");
process.saveCrossTenantSafeEx();
commit();
List<MInvoice> invoices = new Query(ctx, MInvoice.Table_Name, "C_Invoice_ID IN (?,?)", trxName)
.setClient_ID()
.setOnlyActiveRecords(true)
.setParameters(103, 109)
.list();
for (MInvoice invoice : invoices) {
invoice.setDescription("Test Printing within a Process");
invoice.saveEx();
}
ProcessInfo pi = new ProcessInfo (process.getName(), process.getAD_Process_ID());
pi.setClassName(ProcessUtil.JASPER_STARTER_CLASS);
pi.setAD_User_ID(getAD_User_ID());
pi.setAD_Client_ID(getAD_Client_ID());
pi.setPrintPreview(false);
pi.setIsBatch(true);
Trx trx = Trx.get(trxName, false);
List<File> pdfList = new ArrayList<File>();
for (MInvoice invoice : invoices) {
pi.setRecord_ID(invoice.getC_Invoice_ID());
ProcessUtil.startJavaProcess(Env.getCtx(), pi, trx, false);
assertFalse(pi.isError(), pi.getSummary());
assertFalse(pi.getPDFReport() == null);
pdfList.add(pi.getPDFReport());
}
assertFalse(pdfList.isEmpty());
} finally {
rollback();
if (process != null) {
int oldRole = Env.getAD_Role_ID(ctx);
try {
PO.setCrossTenantSafe();
Env.setContext(ctx, Env.AD_ROLE_ID, 0); // to allow deleting process
process.deleteEx(true);
} finally {
Env.setContext(ctx, Env.AD_ROLE_ID, oldRole);
PO.clearCrossTenantSafe();
}
}
commit();
}
}
}