← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2572: Impl automatic export to Jasper report for report table

 

------------------------------------------------------------
revno: 2572
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-01-14 19:53:02 +0100
message:
  Impl automatic export to Jasper report for report table
modified:
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/grid.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/grid.vm'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/grid.vm	2011-01-14 18:10:02 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/grid.vm	2011-01-14 18:53:02 +0000
@@ -38,31 +38,15 @@
 					<dataset>
 						<datasetRun subDataset="chart"/>
 					</dataset>
-					<categorySeries>
-						<seriesExpression><![CDATA["DPT 1"]]></seriesExpression>
-						<categoryExpression><![CDATA[""]]></categoryExpression>
-						<valueExpression><![CDATA[${dollar}F{dpt1_doses_given}]]></valueExpression>
-					</categorySeries>
-					<categorySeries>
-						<seriesExpression><![CDATA["DPT 2"]]></seriesExpression>
-						<categoryExpression><![CDATA[""]]></categoryExpression>
-						<valueExpression><![CDATA[${dollar}F{dpt2_doses_given}]]></valueExpression>
-					</categorySeries>
-					<categorySeries>
-						<seriesExpression><![CDATA["DPT 3"]]></seriesExpression>
-						<categoryExpression><![CDATA[""]]></categoryExpression>
-						<valueExpression><![CDATA[${dollar}F{dpt3_doses_given}]]></valueExpression>
-					</categorySeries>
-					<categorySeries>
-						<seriesExpression><![CDATA["Measles"]]></seriesExpression>
-						<categoryExpression><![CDATA[""]]></categoryExpression>
-						<valueExpression><![CDATA[${dollar}F{measles_doses_given}]]></valueExpression>
-					</categorySeries>
-					<categorySeries>
-						<seriesExpression><![CDATA["Fully Imm"]]></seriesExpression>
-						<categoryExpression><![CDATA[""]]></categoryExpression>
-						<valueExpression><![CDATA[${dollar}F{fully_immunised}]]></valueExpression>
-					</categorySeries>
+					#foreach( $header in $grid.getHeaders() )
+					#if ( !$header.meta )					
+					<categorySeries>
+						<seriesExpression><![CDATA["${header.name}"]]></seriesExpression>
+						<categoryExpression><![CDATA[""]]></categoryExpression>
+						<valueExpression><![CDATA[${dollar}F{${header.column}}]]></valueExpression>
+					</categorySeries>
+					#end
+					#end
 				</categoryDataset>
 				<bar3DPlot>
 					<plot/>
@@ -88,94 +72,38 @@
 	</pageHeader>
 	<columnHeader>
 		<band height="51" splitType="Stretch">
-			<staticText>
-				<reportElement x="170" y="26" width="64" height="20"/>
-				<textElement textAlignment="Center">
-					<font size="10" isBold="true"/>
-				</textElement>
-				<text><![CDATA[DPT 1 given]]></text>
-			</staticText>
-			<staticText>
-				<reportElement x="234" y="26" width="64" height="20"/>
-				<textElement textAlignment="Center">
-					<font size="10" isBold="true"/>
-				</textElement>
-				<text><![CDATA[DPT 2 given]]></text>
-			</staticText>
-			<staticText>
-				<reportElement x="298" y="26" width="64" height="20"/>
-				<textElement textAlignment="Center">
-					<font size="10" isBold="true"/>
-				</textElement>
-				<text><![CDATA[DPT 3 given]]></text>
-			</staticText>
-			<staticText>
-				<reportElement x="362" y="26" width="64" height="20"/>
-				<textElement textAlignment="Center">
-					<font size="10" isBold="true"/>
-				</textElement>
-				<text><![CDATA[Measles given]]></text>
-			</staticText>
-			<staticText>
-				<reportElement x="426" y="26" width="64" height="20"/>
-				<textElement textAlignment="Center">
-					<font size="10" isBold="true"/>
-				</textElement>
-				<text><![CDATA[Fully imm]]></text>
-			</staticText>
-			<staticText>
-				<reportElement x="12" y="26" width="148" height="20"/>
-				<textElement>
-					<font size="10" isBold="true"/>
-				</textElement>
-				<text><![CDATA[Organisation unit]]></text>
-			</staticText>
+			#set( $x = 10 )
+			#foreach( $header in $grid.getVisibleHeaders() )
+			
+			#if( $header.meta )	#set( $offset = 110 ) #else	#set( $offset = 60 ) #end
+			
+			<staticText>
+				<reportElement x="${x}" y="26" width="${offset}" height="20"/>
+				<textElement #if( !$header.meta )textAlignment="Center"#end>
+					<font size="10" isBold="true"/>
+				</textElement>
+				<text><![CDATA[${header.name}]]></text>
+			</staticText>
+			#set( $x = ( $x + $offset ) )
+			#end
 		</band>
 	</columnHeader>
 	<detail>
 		<band height="21" splitType="Stretch">
-			<textField>
-				<reportElement x="170" y="0" width="64" height="20"/>
-				<textElement textAlignment="Center">
-					<font size="9"/>
-				</textElement>
-				<textFieldExpression class="java.lang.Double"><![CDATA[${dollar}F{dpt1_doses_given}]]></textFieldExpression>
-			</textField>
-			<textField>
-				<reportElement x="234" y="0" width="64" height="20"/>
-				<textElement textAlignment="Center">
-					<font size="9"/>
-				</textElement>
-				<textFieldExpression class="java.lang.Double"><![CDATA[${dollar}F{dpt2_doses_given}]]></textFieldExpression>
-			</textField>
-			<textField>
-				<reportElement x="298" y="0" width="64" height="20"/>
-				<textElement textAlignment="Center">
-					<font size="9"/>
-				</textElement>
-				<textFieldExpression class="java.lang.Double"><![CDATA[${dollar}F{dpt3_doses_given}]]></textFieldExpression>
-			</textField>
-			<textField>
-				<reportElement x="362" y="0" width="64" height="20"/>
-				<textElement textAlignment="Center">
-					<font size="9"/>
-				</textElement>
-				<textFieldExpression class="java.lang.Double"><![CDATA[${dollar}F{measles_doses_given}]]></textFieldExpression>
-			</textField>
-			<textField>
-				<reportElement x="426" y="0" width="64" height="20"/>
-				<textElement textAlignment="Center">
-					<font size="9"/>
-				</textElement>
-				<textFieldExpression class="java.lang.Double"><![CDATA[${dollar}F{fully_immunised}]]></textFieldExpression>
-			</textField>
-			<textField>
-				<reportElement x="12" y="0" width="148" height="20"/>
-				<textElement>
-					<font size="9" isBold="false"/>
-				</textElement>
-				<textFieldExpression class="java.lang.String"><![CDATA[${dollar}F{organisationunitname}]]></textFieldExpression>
-			</textField>
+			#set( $x = 10 )
+			#foreach( $header in $grid.getVisibleHeaders() )
+			
+			#if( $header.meta )	#set( $offset = 110 ) #else	#set( $offset = 60 ) #end
+			
+			<textField>
+				<reportElement x="${x}" y="0" width="${offset}" height="20"/>
+				<textElement #if( !$header.meta )textAlignment="Center"#end>
+					<font size="9"/>
+				</textElement>
+				<textFieldExpression class="${header.type}"><![CDATA[${dollar}F{${header.column}}]]></textFieldExpression>
+			</textField>			
+			#set( $x = ( $x + $offset ) )
+			#end
 		</band>
 	</detail>
 	<columnFooter>