Browse Source

Makroberichte Pattern dynamisch #1

rpta_0.1_Release
Daniel Quathamer 1 year ago
parent
commit
bbc7ad8b08
  1. 1
      src-modules/module/rpta/conf/includes.txt
  2. 2
      src-modules/module/rpta/schluesseltabellen/sx_stylesheets_einfuegen.sql
  3. 67
      superx/images/icons/file-excel_rpta.svg
  4. 111
      superx/xml/rpta_templates.xsl

1
src-modules/module/rpta/conf/includes.txt

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
doku/rpta_modul/rpta.html
WEB-INF/conf/edustore/db/bin/SQL_ENV_rpta.sam
images/icons/file-excel_rpta.svg
images/icons/magic.svg
WEB-INF/conf/edustore/db/module/rpta/schluesseltabellen/sx_stylesheets_einfuegen.sql
WEB-INF/reports/simple_table.jrtx

2
src-modules/module/rpta/schluesseltabellen/sx_stylesheets_einfuegen.sql

@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
"relation":"table",
"contenttype":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"is_generic":"1",
"toolbar_icon_filepath":"../images/icons/page_white_excel.svg",
"toolbar_icon_filepath":"../images/icons/file-excel_rpta.svg",
"usage_resultset_data":"T",
"stylesheet_type":"XSL_JRXML",
"jr_datasource":"RS"

67
superx/images/icons/file-excel_rpta.svg

@ -0,0 +1,67 @@ @@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="25"
version="1.1"
id="svg4"
sodipodi:docname="file-mediawiki.svg"
height="25"
inkscape:version="0.92.2 5c3e80d, 2017-08-06">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="963"
id="namedview6"
showgrid="false"
inkscape:zoom="15.627722"
inkscape:cx="36.361146"
inkscape:cy="11.332993"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg4" />
<path
d="m 22.2625,5.3 c 0.266667,0.2666667 0.491667,0.6166667 0.675,1.05 0.183333,0.4333333 0.275,0.85 0.275,1.25 v 16.05 c 0,0.383333 -0.125,0.7 -0.375,0.95 -0.25,0.25 -0.566667,0.383333 -0.95,0.4 h -18.75 c -0.3833333,0 -0.7,-0.133333 -0.95,-0.4 -0.25,-0.266667 -0.3833333,-0.583333 -0.4,-0.95 V 1.35 c 0,-0.38333333 0.1333333,-0.7 0.4,-0.95 C 2.4541667,0.15 2.7708333,0.01666667 3.1375,0 h 12.5 c 0.366667,0 0.775,0.09166667 1.225,0.275 0.45,0.18333333 0.8,0.40833333 1.05,0.675 z m -6.2,-3.4 v 5.25 h 5.25 c -0.08333,-0.2666667 -0.183333,-0.4583333 -0.3,-0.575 L 16.6375,2.2 c -0.1,-0.1166667 -0.291667,-0.2166667 -0.575,-0.3 z m 5.375,21.325 v -14.3 h -5.8 c -0.383333,0 -0.7,-0.125 -0.95,-0.375 -0.25,-0.25 -0.383333,-0.5666667 -0.4,-0.95 V 1.775 H 3.5625 v 21.45 z"
id="path2"
inkscape:connector-curvature="0"
style="stroke-width:0.025"
sodipodi:nodetypes="ssssscsscsscsscscccsccccssccccc" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:8px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.23162518"
x="3.5765488"
y="19.120842"
id="text816"><tspan
sodipodi:role="line"
id="tspan814"
x="3.5765488"
y="19.120842"
style="stroke-width:0.23162518">XLSX</tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

111
superx/xml/rpta_templates.xsl

@ -11,6 +11,7 @@ xmlns="http://jasperreports.sourceforge.net/jasperreports"> @@ -11,6 +11,7 @@ xmlns="http://jasperreports.sourceforge.net/jasperreports">
<xsl:param name="seitenbreite" select="842" />
<xsl:param name="seitenhoehe" select="595" />
<xsl:param name="seitenrand" select="12" />
<xsl:param name="topMargin" select="12" />
<xsl:param name="bottomMargin" select="12" />
<xsl:param name="isIgnorePagination" select="'true'" />
<xsl:param name="orientation" select="'Landscape'" />
@ -32,7 +33,7 @@ orientation="{$orientation}" @@ -32,7 +33,7 @@ orientation="{$orientation}"
columnWidth="{$druckbreite}"
leftMargin="{$seitenrand}"
rightMargin="{$seitenrand}"
topMargin="{$seitenrand}"
topMargin="{$topMargin}"
bottomMargin="{$bottomMargin}"
isIgnorePagination="{$isIgnorePagination}" >
<xsl:call-template name="jr_properties" />
@ -45,7 +46,10 @@ isIgnorePagination="{$isIgnorePagination}" > @@ -45,7 +46,10 @@ isIgnorePagination="{$isIgnorePagination}" >
<!--<property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w1" value="466"/>
<property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w2" value="522"/>-->
<template><xsl:value-of select="concat('&quot;',$stylesFile,'&quot;')" /></template>
<xsl:call-template name="jr_styles" />
<xsl:call-template name="jr_styles" >
<xsl:with-param name="ergebniselementOrdnr" select="$ergebniselementOrdnr" />
</xsl:call-template>
<xsl:call-template name="querystring">
<xsl:with-param name="ordnr" select="$ergebniselementOrdnr" />
</xsl:call-template>
@ -425,8 +429,9 @@ isIgnorePagination="{$isIgnorePagination}" > @@ -425,8 +429,9 @@ isIgnorePagination="{$isIgnorePagination}" >
<xsl:variable name="ndefbreite"><xsl:value-of select="count(/ergebnisse/ergebnis/ergebniselement[@ordnr=$ergebniselementOrdnr]/sqlerg/headers/header[ @width = '' and not(starts-with(f_name,'hidden')) and not(starts-with(f_name,'next'))])" /></xsl:variable>
<xsl:variable name="gesamtbreite"><xsl:value-of select="$defbreite+($ndefbreite* $std_spaltenbreite)" /></xsl:variable>
<xsl:variable name="width"><xsl:value-of select="/ergebnisse/ergebnis/ergebniselement[@ordnr=$ergebniselementOrdnr]/sqlerg/headers/header[@id=$colId]/@width"/></xsl:variable>
<xsl:comment><xsl:value-of select="concat('defbreite=',$defbreite)" /></xsl:comment>
<xsl:choose>
<xsl:when test="($colCount - 1)=$colId">
<xsl:when test="($colCount - 1) =$colId ">
<!-- letzte Spalte -->
<xsl:value-of select="$druckbreite - $previousX"/>
</xsl:when>
@ -500,17 +505,13 @@ isIgnorePagination="{$isIgnorePagination}" > @@ -500,17 +505,13 @@ isIgnorePagination="{$isIgnorePagination}" >
</xsl:variable>
<xsl:if test="normalize-space($jasperFieldname)!=''"> <!-- keine leeren Feldnamen-->
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<xsl:attribute name="pattern">
<xsl:call-template name="tableCellPattern">
<xsl:with-param name="fieldType" select="$fieldType" />
</xsl:call-template>
</xsl:attribute>
<reportElement stretchType="ContainerHeight" x="{$x}" y="0" width="{$width}" height="{$height}" >
<xsl:attribute name="style">
<xsl:call-template name="getTableRowStyle" >
<xsl:with-param name="flavorTableRowStyle" select="$flavorTableRowStyle"/>
<xsl:with-param name="tableRowLevel" select="$tableRowLevel"/>
<xsl:with-param name="ergebnisElementOrdnr" select="$ergebnisElementOrdnr" />
<xsl:with-param name="fieldType" select="$fieldType" />
</xsl:call-template>
</xsl:attribute>
<xsl:if test="$flavorTableRowStyle='treeTable'">
@ -526,6 +527,11 @@ isIgnorePagination="{$isIgnorePagination}" > @@ -526,6 +527,11 @@ isIgnorePagination="{$isIgnorePagination}" >
<textElement textAlignment="Left"/>
</xsl:if>
<textFieldExpression><xsl:value-of select="concat('$F{',$fldPrefix,$jasperFieldname,'}')" /></textFieldExpression>
<xsl:call-template name="tableCellPatternExpression">
<xsl:with-param name="fieldType" select="$fieldType" />
<xsl:with-param name="ergebnisElementOrdnr" select="$ergebnisElementOrdnr"/>
<xsl:with-param name="fieldName" select="$fieldName" />
</xsl:call-template>
</textField>
</xsl:if>
</xsl:template>
@ -563,14 +569,27 @@ isIgnorePagination="{$isIgnorePagination}" > @@ -563,14 +569,27 @@ isIgnorePagination="{$isIgnorePagination}" >
<xsl:param name="zeilenhoehe" select="30" />
<xsl:param name="ordnr" select="0"/>
<xsl:param name="y_offset" select="0"/>
<xsl:for-each select="/ergebnisse/ergebnis/ergebniselement[@ordnr=$ordnr]"><!--derzeit nur eine Tabelle erlaubt-->
<xsl:for-each select="/ergebnisse/ergebnis/ergebniselement[@ordnr=$ordnr]">
<xsl:choose>
<xsl:when test="sqlerg/headers/@hasAggregationHeaders='true'" >
<!-- verschachtelter Header -->
<xsl:variable name="colCount"><xsl:value-of select="count(sqlerg/aggregationHeaders/tr)"/></xsl:variable>
<xsl:variable name="totalColCount"><xsl:value-of select="sqlerg/headers/@count"/></xsl:variable>
<xsl:variable name="rowCount"><xsl:value-of select="count(sqlerg/aggregationHeaders/tr)"/></xsl:variable>
<xsl:for-each select="sqlerg/aggregationHeaders/tr">
<xsl:variable name="rowCounter" select="position()-1" />
<xsl:variable name="currentRowColCount"><xsl:value-of select="count(th[ @isHidden='false'])"/></xsl:variable>
<xsl:variable name="colCount">
<xsl:choose>
<xsl:when test="($rowCounter - 1)=$rowCount">
<xsl:value-of select="$totalColCount"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$totalColCount"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:for-each select="th" >
<xsl:variable name="colId"><xsl:value-of select="position()-1" /></xsl:variable>
<xsl:if test="@isHidden='false'">
@ -584,6 +603,9 @@ isIgnorePagination="{$isIgnorePagination}" > @@ -584,6 +603,9 @@ isIgnorePagination="{$isIgnorePagination}" >
<xsl:with-param name="colCount" select="$colCount"/>
</xsl:call-template>
</xsl:variable>
<xsl:comment><xsl:text>columnX=</xsl:text><xsl:value-of select="$columnX"/></xsl:comment>
<xsl:comment><xsl:text>colCount=</xsl:text><xsl:value-of select="$colCount"/></xsl:comment>
<xsl:comment><xsl:text>druckbreite=</xsl:text><xsl:value-of select="$druckbreite"/></xsl:comment>
<xsl:variable name="columnWidth">
<xsl:call-template name="getColumnwidth">
<xsl:with-param name="druckbreite" select="$druckbreite"/>
@ -595,6 +617,7 @@ isIgnorePagination="{$isIgnorePagination}" > @@ -595,6 +617,7 @@ isIgnorePagination="{$isIgnorePagination}" >
</xsl:call-template>
</xsl:variable>
<xsl:comment><xsl:text>columnWidth=</xsl:text><xsl:value-of select="$columnWidth"/></xsl:comment>
<xsl:variable name="rowspan">
<xsl:choose>
@ -618,7 +641,7 @@ isIgnorePagination="{$isIgnorePagination}" > @@ -618,7 +641,7 @@ isIgnorePagination="{$isIgnorePagination}" >
</xsl:variable>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" style="TableColumnHeader" mode="Opaque" stretchType="ContainerHeight"
<reportElement style="TableColumnHeader" mode="Opaque" stretchType="ContainerHeight"
x="{$columnX}" y="{$y_offset+( $rowCounter * $zeilenhoehe )}" width="{$columnWidth * $colspan}" height="{$zeilenhoehe*$rowspan}" />
<textFieldExpression><xsl:text>"</xsl:text>
<xsl:call-template name="newline_to_backslash_n">
@ -727,29 +750,20 @@ isIgnorePagination="{$isIgnorePagination}" > @@ -727,29 +750,20 @@ isIgnorePagination="{$isIgnorePagination}" >
</textField>
</xsl:if>
<!--Legende -->
<textField>
<reportElement style="LegendLabel" x="0" y="{$subReportTitleHeight}" width="{$druckbreite}" height="{$legendLabelHeight}" />
<textElement verticalAlignment="Bottom">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Filterkriterien: "]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="LegendContent" isPrintWhenDetailOverflows="true" x="0" y="{$subReportTitleHeight + $legendLabelHeight}" width="{$druckbreite}" height="{$legendContentHeight}" />
<box padding="5"/>
<textFieldExpression>
<xsl:call-template name="getLegendExpression">
<xsl:with-param name="ergebniselementOrdnr" select="$ergebniselementOrdnr"/>
<xsl:call-template name="legendLabelAndContent">
<xsl:with-param name="ergebniselementOrdnr" select="$ergebniselementOrdnr" />
<xsl:with-param name="subReportTitleHeight" select="$subReportTitleHeight" />
<xsl:with-param name="druckbreite" select="$druckbreite" />
<xsl:with-param name="legendLabelHeight" select="$legendLabelHeight" />
<xsl:with-param name="legendContentHeight" select="$legendContentHeight" />
</xsl:call-template>
<xsl:text disable-output-escaping="yes"><![CDATA[ +"Datenstand: "+ $F{standdatum} + "; " + "Erstellt: "+ DATEFORMAT( TODAY(), "dd.MM.YYYY")]]></xsl:text></textFieldExpression>
</textField>
</band>
<band height="{$hinweisContentHeight}">
<printWhenExpression><![CDATA[$F{Hinweis}.length() >0]]></printWhenExpression>
<!-- hinweis-->
<textField isStretchWithOverflow="true">
<reportElement style="HinweisContent" positionType="Float" isPrintWhenDetailOverflows="true" x="0" y="0" width="{$druckbreite}" height="{$hinweisContentHeight}" />
<box topPadding="10" leftPadding="2" bottomPadding="10" rightPadding="2"/>
<textElement verticalAlignment="Middle"/>
<textFieldExpression>
<xsl:text disable-output-escaping="yes"><![CDATA[$F{Hinweis}]]></xsl:text></textFieldExpression>
@ -834,6 +848,7 @@ isIgnorePagination="{$isIgnorePagination}" > @@ -834,6 +848,7 @@ isIgnorePagination="{$isIgnorePagination}" >
<xsl:param name="flavorTableRowStyle"/>
<xsl:param name="tableRowLevel"/>
<xsl:param name="ergebnisElementOrdnr" select="0" />
<xsl:param name="fieldType" />
<xsl:choose>
<xsl:when test="$flavorTableRowStyle='listAlternatingBg'">
<xsl:text>TableRowDetail</xsl:text>
@ -954,27 +969,31 @@ isIgnorePagination="{$isIgnorePagination}" > @@ -954,27 +969,31 @@ isIgnorePagination="{$isIgnorePagination}" >
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="tableCellPattern">
<xsl:template name="tableCellPatternExpression">
<xsl:param name="fieldType" />
<xsl:param name="ergebnisElementOrdnr"/>
<xsl:param name="fieldName" />
<patternExpression>
<xsl:choose>
<xsl:when test="$fieldType='4'"> <!--integer-->
<xsl:text>0</xsl:text>
<xsl:text>"#,##0"</xsl:text>
</xsl:when>
<xsl:when test="$fieldType='3'"> <!--decimal-->
<xsl:text>#,##0.00;-#,##0.00</xsl:text>
<xsl:text>"#,##0.00;-#,##0.00"</xsl:text>
</xsl:when>
<xsl:when test="$fieldType='6'"> <!--date-->
<xsl:text>dd.MM.yyyy</xsl:text>
<xsl:text>"dd.MM.yyyy"</xsl:text>
</xsl:when>
<xsl:when test="$fieldType='8'"> <!--timestamp-->
<xsl:text>dd.MM.yyyy hh:mm:ss</xsl:text>
<xsl:text>"dd.MM.yyyy hh:mm:ss"</xsl:text>
</xsl:when>
<xsl:when test="$fieldType='9'"> <!--time-->
<xsl:text>hh:mm:ss</xsl:text>
<xsl:text>"hh:mm:ss"</xsl:text>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</patternExpression>
</xsl:template>
<xsl:template name="newline_to_backslash_n">
<xsl:param name="string"/>
@ -991,4 +1010,30 @@ isIgnorePagination="{$isIgnorePagination}" > @@ -991,4 +1010,30 @@ isIgnorePagination="{$isIgnorePagination}" >
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="legendLabelAndContent">
<xsl:param name="ergebniselementOrdnr" select="0" />
<xsl:param name="subReportTitleHeight" select="10" />
<xsl:param name="druckbreite" select="842" />
<xsl:param name="legendLabelHeight" select="10" />
<xsl:param name="legendContentHeight" select="50" />
<textField>
<reportElement style="LegendLabel" x="0" y="{$subReportTitleHeight}" width="{$druckbreite}" height="{$legendLabelHeight}" />
<textElement verticalAlignment="Bottom">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Filterkriterien: "]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="LegendContent" isPrintWhenDetailOverflows="true" x="0" y="{$subReportTitleHeight + $legendLabelHeight}" width="{$druckbreite}" height="{$legendContentHeight}" />
<box topPadding="10" leftPadding="2" bottomPadding="10" rightPadding="2"/>
<textFieldExpression>
<xsl:call-template name="getLegendExpression">
<xsl:with-param name="ergebniselementOrdnr" select="$ergebniselementOrdnr"/>
</xsl:call-template>
<xsl:text disable-output-escaping="yes"><![CDATA[ +"Datenstand: "+ $F{standdatum} + "; " + "Erstellt: "+ DATEFORMAT( TODAY(), "dd.MM.YYYY")]]></xsl:text></textFieldExpression>
</textField>
</xsl:template>
</xsl:stylesheet>

Loading…
Cancel
Save