Results 1 to 13 of 13

Thread: Jasper Report

  1. #1
    sysout is offline Member
    Join Date
    Aug 2009
    Posts
    66
    Rep Power
    0

    Default Jasper Report

    Invoice.jrxml
    Java Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <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="null" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
    	<queryString language="SQL">
    		<![CDATA[SELECT * FROM trheaderpemesanan]]>
    	</queryString>
    	<field name="kdPemesanan" class="java.lang.String">
    		<fieldDescription><![CDATA[]]></fieldDescription>
    	</field>
    	<field name="tanggalPemesanan" class="java.sql.Timestamp">
    		<fieldDescription><![CDATA[]]></fieldDescription>
    	</field>
    	<field name="totalHarga" class="java.math.BigDecimal">
    		<fieldDescription><![CDATA[]]></fieldDescription>
    	</field>
    	<field name="totalVolume" class="java.math.BigDecimal">
    		<fieldDescription><![CDATA[]]></fieldDescription>
    	</field>
    	<field name="diskonPlus" class="java.math.BigDecimal">
    		<fieldDescription><![CDATA[]]></fieldDescription>
    	</field>
    	<field name="kdPelanggan" class="java.lang.Integer">
    		<fieldDescription><![CDATA[]]></fieldDescription>
    	</field>
    	<field name="statusPemesanan" class="java.lang.String">
    		<fieldDescription><![CDATA[]]></fieldDescription>
    	</field>
    	<group name="kdPemesanan">
    		<groupExpression><![CDATA[$F{kdPemesanan}]]></groupExpression>
    		<groupHeader>
    			<band height="27" splitType="Stretch">
    				<staticText>
    					<reportElement mode="Opaque" x="0" y="0" width="139" height="27" forecolor="#FFFFFF" backcolor="#000000"/>
    					<textElement>
    						<font size="18"/>
    					</textElement>
    					<text><![CDATA[Kode Invoice]]></text>
    				</staticText>
    				<textField>
    					<reportElement mode="Opaque" x="139" y="0" width="416" height="27" forecolor="#FFFFFF" backcolor="#000000"/>
    					<textElement>
    						<font size="18" isBold="true"/>
    					</textElement>
    					<textFieldExpression class="java.lang.String"><![CDATA[$F{kdPemesanan}]]></textFieldExpression>
    				</textField>
    			</band>
    		</groupHeader>
    		<groupFooter>
    			<band height="8" splitType="Stretch">
    				<line direction="BottomUp">
    					<reportElement key="line" x="1" y="4" width="554" height="1"/>
    				</line>
    			</band>
    		</groupFooter>
    	</group>
    	<background>
    		<band splitType="Stretch"/>
    	</background>
    	<title>
    		<band height="58" splitType="Stretch">
    			<line>
    				<reportElement x="0" y="8" width="555" height="1"/>
    			</line>
    			<line>
    				<reportElement positionType="FixRelativeToBottom" x="0" y="51" width="555" height="1"/>
    			</line>
    			<staticText>
    				<reportElement x="65" y="13" width="424" height="35"/>
    				<textElement textAlignment="Center">
    					<font size="26" isBold="true"/>
    				</textElement>
    				<text><![CDATA[Laporan Pemesanan]]></text>
    			</staticText>
    		</band>
    	</title>
    	<pageHeader>
    		<band splitType="Stretch"/>
    	</pageHeader>
    	<columnHeader>
    		<band splitType="Stretch"/>
    	</columnHeader>
    	<detail>
    		<band height="120" splitType="Stretch">
    			<staticText>
    				<reportElement x="0" y="0" width="139" height="20"/>
    				<textElement>
    					<font size="12"/>
    				</textElement>
    				<text><![CDATA[Tanggal Pemesanan]]></text>
    			</staticText>
    			<textField>
    				<reportElement x="139" y="0" width="416" height="20"/>
    				<textElement>
    					<font size="12"/>
    				</textElement>
    				<textFieldExpression class="java.sql.Timestamp"><![CDATA[$F{tanggalPemesanan}]]></textFieldExpression>
    			</textField>
    			<staticText>
    				<reportElement x="0" y="20" width="139" height="20"/>
    				<textElement>
    					<font size="12"/>
    				</textElement>
    				<text><![CDATA[Total Harga]]></text>
    			</staticText>
    			<textField>
    				<reportElement x="139" y="20" width="416" height="20"/>
    				<textElement>
    					<font size="12"/>
    				</textElement>
    				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{totalHarga}]]></textFieldExpression>
    			</textField>
    			<staticText>
    				<reportElement x="0" y="40" width="139" height="20"/>
    				<textElement>
    					<font size="12"/>
    				</textElement>
    				<text><![CDATA[Total Volume]]></text>
    			</staticText>
    			<textField>
    				<reportElement x="139" y="40" width="416" height="20"/>
    				<textElement>
    					<font size="12"/>
    				</textElement>
    				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{totalVolume}]]></textFieldExpression>
    			</textField>
    			<staticText>
    				<reportElement x="0" y="60" width="139" height="20"/>
    				<textElement>
    					<font size="12"/>
    				</textElement>
    				<text><![CDATA[Diskon]]></text>
    			</staticText>
    			<textField>
    				<reportElement x="139" y="60" width="416" height="20"/>
    				<textElement>
    					<font size="12"/>
    				</textElement>
    				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{diskonPlus}]]></textFieldExpression>
    			</textField>
    			<staticText>
    				<reportElement x="0" y="80" width="139" height="20"/>
    				<textElement>
    					<font size="12"/>
    				</textElement>
    				<text><![CDATA[Kode Pelanggan]]></text>
    			</staticText>
    			<textField>
    				<reportElement x="139" y="80" width="416" height="20"/>
    				<textElement>
    					<font size="12"/>
    				</textElement>
    				<textFieldExpression class="java.lang.Integer"><![CDATA[$F{kdPelanggan}]]></textFieldExpression>
    			</textField>
    			<staticText>
    				<reportElement x="0" y="100" width="139" height="20"/>
    				<textElement>
    					<font size="12"/>
    				</textElement>
    				<text><![CDATA[Status Pemesanan]]></text>
    			</staticText>
    			<textField>
    				<reportElement x="139" y="100" width="416" height="20"/>
    				<textElement>
    					<font size="12"/>
    				</textElement>
    				<textFieldExpression class="java.lang.String"><![CDATA[$F{statusPemesanan}]]></textFieldExpression>
    			</textField>
    		</band>
    	</detail>
    	<columnFooter>
    		<band splitType="Stretch"/>
    	</columnFooter>
    	<pageFooter>
    		<band height="26" splitType="Stretch">
    			<textField evaluationTime="Report" pattern="" isBlankWhenNull="false">
    				<reportElement key="textField" x="516" y="6" width="36" height="19" forecolor="#000000" backcolor="#FFFFFF"/>
    				<box>
    					<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>
    					<font size="10"/>
    				</textElement>
    				<textFieldExpression class="java.lang.String"><![CDATA["" + $V{PAGE_NUMBER}]]></textFieldExpression>
    			</textField>
    			<textField pattern="" isBlankWhenNull="false">
    				<reportElement key="textField" x="342" y="6" width="170" height="19" forecolor="#000000" backcolor="#FFFFFF"/>
    				<box>
    					<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 textAlignment="Right">
    					<font size="10"/>
    				</textElement>
    				<textFieldExpression class="java.lang.String"><![CDATA["Page " + $V{PAGE_NUMBER} + " of "]]></textFieldExpression>
    			</textField>
    			<textField pattern="" isBlankWhenNull="false">
    				<reportElement key="textField" x="1" y="6" width="209" height="19" forecolor="#000000" backcolor="#FFFFFF"/>
    				<box>
    					<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>
    					<font size="10"/>
    				</textElement>
    				<textFieldExpression class="java.util.Date"><![CDATA[new Date()]]></textFieldExpression>
    			</textField>
    		</band>
    	</pageFooter>
    	<summary>
    		<band splitType="Stretch"/>
    	</summary>
    </jasperReport>
    Thats the jrxml that I generated with Report Wizard.
    It's successfull but, just generate 1 row, no loop at all, how to modif this xml code?

    is there any template for report?
    thanks

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Just use iReport for generating jasper reports.

  3. #3
    sysout is offline Member
    Join Date
    Aug 2009
    Posts
    66
    Rep Power
    0

    Default

    Quote Originally Posted by r035198x View Post
    Just use iReport for generating jasper reports.
    any links buddy?

  4. #4
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

  5. #5
    sysout is offline Member
    Join Date
    Aug 2009
    Posts
    66
    Rep Power
    0

    Default

    Quote Originally Posted by quad64bit View Post
    successfully downloaded, palz.
    hmm..but it's still not working, I still don't understand how to use the tools :( (absolutely blank)

  6. #6
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    That's why they come with manuals. If you get a specific error with it then post the error message that you got.

  7. #7
    sysout is offline Member
    Join Date
    Aug 2009
    Posts
    66
    Rep Power
    0

    Default

    Quote Originally Posted by r035198x View Post
    That's why they come with manuals. If you get a specific error with it then post the error message that you got.
    it's successfully generate the jrxml, but it's failed to preview.
    if I use ireport as a plugin of Netbeans, it's successfully gives a preview, even it can be saved as a pdf, but the template design is standard, and it doesn't loop for some parts.

    the code is like above.

  8. #8
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    How did it fail to preview? What error message did you get?
    The looping depends on what you put in the detail band and is all explained the iReport manual.

  9. #9
    sysout is offline Member
    Join Date
    Aug 2009
    Posts
    66
    Rep Power
    0

    Default

    Quote Originally Posted by r035198x View Post
    How did it fail to preview? What error message did you get?
    The looping depends on what you put in the detail band and is all explained the iReport manual.
    there's no any error message. If I pressed the preview Button, it's automatically turn back to design :confused:

    i c, so I just search in report manual?

  10. #10
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Quote Originally Posted by sysout View Post
    ...

    i c, so I just search in report manual?
    Well there is no point in doing anything without first reading any manuals if available. It takes guessing out of the game which is a good thing.

  11. #11
    sysout is offline Member
    Join Date
    Aug 2009
    Posts
    66
    Rep Power
    0

    Default

    This is the Result, it loops successfully, but I just want to loop for the detail (the blues one), the black one I want it on header, and the red one, I want it on footer.

    watch the color of this file :
    Free File Hosting Made Simple - MediaFire

    Actually, This is the best preview for the report.
    As Example, I want to create Report for Invoice #0000001, then, it gives me report for all items, and their details.
    The header of the report is about the invoice detail, and the footer is about the shipment detail.

    this is the screen shot of my .jar


    Thanks palz, for your help until today :)
    Last edited by sysout; 09-11-2009 at 04:13 AM.

  12. #12
    sysout is offline Member
    Join Date
    Aug 2009
    Posts
    66
    Rep Power
    0

    Default

    anyone has successfully used JasperReport combined with Java? So it can send parameters from Java to the report.

    Please, I really need your hands :(

  13. #13
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    So make the part you want the looping to happen on be a subreport and do the looping in it's detail band. As I said before, it's all explained in the manuals.

Similar Threads

  1. jasper report
    By vidhyaprabu in forum New To Java
    Replies: 6
    Last Post: 11-12-2009, 03:31 AM
  2. jasper report in struts
    By saru_2785@rediff.com in forum Advanced Java
    Replies: 2
    Last Post: 03-31-2009, 11:30 AM
  3. JSP and Jasper Report in Netbeans 6.1
    By ShatireAzam in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 11-08-2008, 09:43 AM
  4. Cannot compile or run jasper report!!!!!!!
    By neo3matrix in forum XML
    Replies: 0
    Last Post: 09-23-2008, 02:10 PM
  5. Jasper report + JPQL
    By tarat in forum Advanced Java
    Replies: 2
    Last Post: 08-01-2008, 06:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •