PHPJasperXML没有运行子报表

时间:2016-12-16 13:17:34

标签: php jasper-reports subreport

我正在尝试使用PHPJasperXML库在PHP中运行jaspert报告。它可以在单个报表中正常工作,但如果在报表中我们包含子报表或带有subDataSet的表...我们无法使其工作,并且不会显示错误。

这是我们在PHP中的代码

  

include_once('类/ TCPDF / tcpdf.php&#39);   include_once("类/ PHPJasperXML.inc.php&#34); include_once   (' setting2.php&#39);

     

$ PHPJasperXML = new PHPJasperXML(); $ p1 =   ' f31ecc1c-cf89-FCBA-e5a5-583c196e1bb4&#39 ;; $ p2 =   ' 16e72cac-0dc3-3ae8-dd38-5847ef21c927&#39 ;;   $ PHPJasperXML-> arrayParameter = array(" contact_id" =>"'"。$ p1。   "'"" PF_ID" = GT;"'" 。$ P2"'&#34);   $ PHPJasperXML-> load_xml_file(" another.jrxml&#34);

     

$ PHPJasperXML-> transferDBtoArray($服务器,$用户,$通,$分贝);   $ PHPJasperXML-> outpage(" I&#34);

这是jaspert报告(another.jrxml)

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.3.1.final using JasperReports Library version 6.3.1  -->
<!-- 2016-12-16T13:55:31 -->
<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="another" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="16540d19-a3b3-4a1b-98fa-5c4f46e1b7d6">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="crm_fhom"/>
    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
    <style name="Table_TH" mode="Opaque" backcolor="#F0F8FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="Table_CH" mode="Opaque" backcolor="#BFE1FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <subDataset name="Dataset1" whenResourceMissingType="Error" uuid="cb286bc1-dd4f-4969-b8c9-662d895617a0">
        <property name="com.jaspersoft.studio.data.sql.tables" value="crm_fhom"/>
        <property name="com.jaspersoft.studio.data.defaultdataadapter" value="crm_fhom"/>
        <parameter name="contact_id_ds" class="java.lang.String"/>
        <parameter name="pf_id_ds" class="java.lang.String"/>
        <queryString>
            <![CDATA[SELECT a.name AS  IDCuota, c.importe_c AS Importe  FROM oms2b_pagocuotas a, contacts_oms2b_pagocuotas_1_c b,oms2b_pagocuotas_cstm c 
            WHERE a.id =b.contacts_oms2b_pagocuotas_1oms2b_pagocuotas_idb AND 
    b.contacts_oms2b_pagocuotas_1contacts_ida=$P{contact_id_ds} AND c.id_c = a.id AND
    a.estado_pago NOT IN ('enviado', 'cobrado') AND a.deleted = '0' AND b.deleted = '0'

    UNION
SELECT a.name AS  IDCuota, c.importe_c AS Importe  FROM oms2b_pagocuotas a, oms2b_facturacion_oms2b_pagocuotas_1_c b, 
oms2b_pagocuotas_cstm c, contacts_oms2b_pagocuotas_1_c d WHERE a.id = b.oms2b_facturacion_oms2b_pagocuotas_1oms2b_pagocuotas_idb AND  
b.oms2b_facturacion_oms2b_pagocuotas_1oms2b_facturacion_ida=$P{pf_id_ds} AND 
c.id_c = a.id AND 
d.contacts_oms2b_pagocuotas_1contacts_ida=$P{contact_id_ds} AND
a.id = d.contacts_oms2b_pagocuotas_1oms2b_pagocuotas_idb]]>
        </queryString>
        <field name="IDCuota" class="java.lang.String"/>
        <field name="Importe" class="java.math.BigDecimal"/>
    </subDataset>
    <parameter name="contact_id" class="java.lang.String"/>
    <parameter name="pf_id" class="java.lang.String"/>
    <queryString>
        <![CDATA[SELECT NULL AS Empty]]>
    </queryString>
    <field name="Empty" class="java.lang.Object"/>
    <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="227" splitType="Stretch">
            <componentElement>
                <reportElement x="180" y="10" width="200" height="200" uuid="60aeb3c3-5590-4311-b01f-c69c16d47e8d">
                    <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
                    <property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/>
                    <property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/>
                    <property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/>
                </reportElement>
                <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
                    <datasetRun subDataset="Dataset1" uuid="f79c2300-e582-44ee-9ff4-22e0aa877229">
                        <datasetParameter name="contact_id_ds">
                            <datasetParameterExpression><![CDATA[$P{contact_id}]]></datasetParameterExpression>
                        </datasetParameter>
                        <datasetParameter name="pf_id_ds">
                            <datasetParameterExpression><![CDATA[$P{pf_id}]]></datasetParameterExpression>
                        </datasetParameter>
                        <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                    </datasetRun>
                    <jr:column width="40" uuid="4267d755-22c6-4f25-8e4b-12ab685762a8">
                        <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
                        <jr:tableHeader style="Table_TH" height="30" rowSpan="1"/>
                        <jr:tableFooter style="Table_TH" height="30" rowSpan="1"/>
                        <jr:columnHeader style="Table_CH" height="30" rowSpan="1">
                            <textField>
                                <reportElement x="0" y="0" width="40" height="30" uuid="3f62601f-8974-46bd-9016-e2cd7d41af3a"/>
                                <textFieldExpression><![CDATA[$F{IDCuota}]]></textFieldExpression>
                            </textField>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table_CH" height="30" rowSpan="1"/>
                        <jr:detailCell style="Table_TD" height="30"/>
                    </jr:column>
                    <jr:column width="40" uuid="a16363a3-a9a7-4516-93df-f8b43eddc6ce">
                        <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
                        <jr:tableHeader style="Table_TH" height="30" rowSpan="1"/>
                        <jr:tableFooter style="Table_TH" height="30" rowSpan="1"/>
                        <jr:columnHeader style="Table_CH" height="30" rowSpan="1">
                            <textField>
                                <reportElement x="0" y="0" width="40" height="30" uuid="b956d610-43eb-4181-8cd0-59b2897daec5"/>
                                <textFieldExpression><![CDATA[$F{Importe}]]></textFieldExpression>
                            </textField>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table_CH" height="30" rowSpan="1"/>
                        <jr:detailCell style="Table_TD" height="30"/>
                    </jr:column>
                </jr:table>
            </componentElement>
        </band>
    </detail>
    <columnFooter>
        <band height="45" splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band height="54" splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band height="42" splitType="Stretch"/>
    </summary>
</jasperReport>

任何sugestions?此库是否支持此功能?

此致

0 个答案:

没有答案