Foros del Web » Programación para mayores de 30 ;) » Java »

Sumar una variable i-report

Estas en el tema de Sumar una variable i-report en el foro de Java en Foros del Web. Saludos a todos los colaboradores de este foro, soy nuevo en el foro y nuevo en el uso de I-report , estoy utilizando la versión ...
  #1 (permalink)  
Antiguo 12/03/2012, 12:09
 
Fecha de Ingreso: marzo-2012
Mensajes: 3
Antigüedad: 12 años, 1 mes
Puntos: 0
Sumar una variable i-report

Saludos a todos los colaboradores de este foro, soy nuevo en el foro y nuevo en el uso de I-report , estoy utilizando la versión 4.1.1. tengo una reporte que viene con parámetro que es el saldo inicial y luego el saldo de cada documento, me pueden ayudar diciéndome como sumo el saldo inicial al primer total por ejemplo:


saldo Anterior--> 1,000.00

cheque Descripcion valor saldo
-----------------------------------------------------------
101001 PRUEBA 1 1,000.00 2,000.00
101002 PRUEBA 2 500.00 2,500.00



.....
de antemano mil gracias por su aportes.

Alfonso Sánchez.
  #2 (permalink)  
Antiguo 12/03/2012, 13:56
Avatar de FiruzzZ  
Fecha de Ingreso: diciembre-2007
Ubicación: en casa
Mensajes: 470
Antigüedad: 16 años, 4 meses
Puntos: 41
Respuesta: Sumar una variable i-report

con una Variable... $V{variableTotal}
de tipo: Double (en tu caso) o si los sabés trabajar mejor BigDecimal
Calculation type: SUM
Initial value expression: el que mencionas.
Variable expression: los valores que se le van a ir adicionando.
__________________
BadProgrammerException!
  #3 (permalink)  
Antiguo 12/03/2012, 20:48
 
Fecha de Ingreso: marzo-2012
Mensajes: 3
Antigüedad: 12 años, 1 mes
Puntos: 0
Respuesta: Sumar una variable i-report

Muchas Gracias por tu apoyo, estuve probando como mencionabas no me resulto , adjunto el xml tal vez sirva de una guia ,

Gracias


<?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="Libro de Bancos" language="groovy" printOrder="Horizontal" pageWidth="800" pageHeight="752" orientation="Landscape" columnWidth="800" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="ID_EMPRESA" class="java.lang.String">
<parameterDescription><![CDATA[]]></parameterDescription>
</parameter>
<parameter name="ID_MESANIO" class="java.lang.String"/>
<parameter name="ID_BANCO" class="java.lang.String"/>
<parameter name="MESLETRA" class="java.lang.String"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["C:\\sidi5\\luna\\reportes\\"]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[SELECT BANCO,DESC_BANCO,TIPODOCTO,DOCTO,VALORDOCTO,STR(FE CHADOCTO,'00/00/0000') AS FECHAX, CATEGORIA,BENEFICIARIO,CONCEPTO, CASE TIPODOCTO WHEN '1' THEN 'Deposito' WHEN '2' THEN 'N/C' WHEN '3' THEN 'Cheque' ELSE 'N/D' END, CASE TIPODOCTO WHEN '1' THEN VALORDOCTO*1 WHEN '2' THEN VALORDOCTO*1 WHEN '3' THEN VALORDOCTO*-1 ELSE VALORDOCTO*-1 END FROM TBL_BCO04H LEFT JOIN TBL_BCO01 ON TBL_BCO04H.BANCO = TBL_BCO01.BANCO WHERE BANCO LIKE $P{ID_BANCO} AND sUBSTRING(FECHADOCTO,5,4)+SUBSTRING(FECHADOCTO,3,2 ) LIKE $P{ID_MESANIO} order by SUBSTRING(FECHADOCTO,5,4)+SUBSTRING(FECHADOCTO,3,2 )+SUBSTRING(FECHADOCTO,1,2)]]>
</queryString>
<field name="BANCO" class="java.lang.String"/>
<field name="DESC_BANCO" class="java.lang.String"/>
<field name="TIPODOCTO" class="java.lang.String"/>
<field name="DOCTO" class="java.lang.String"/>
<field name="VALORDOCTO" class="java.math.BigDecimal"/>
<field name="FECHAX" class="java.lang.String"/>
<field name="CATEGORIA" class="java.lang.String"/>
<field name="BENEFICIARIO" class="java.lang.String"/>
<field name="CONCEPTO" class="java.lang.String"/>
<field name="COL010" class="java.lang.String"/>
<field name="COL011" class="java.math.BigDecimal"/>
<variable name="LINEA" class="java.lang.Integer" resetType="Column" incrementType="Column" calculation="Count"/>
<variable name="V_SALDO" class="java.lang.Double" calculation="Sum">
<variableExpression><![CDATA[$F{COL011}]]></variableExpression>
<initialValueExpression><![CDATA[]]></initialValueExpression>
</variable>
<variable name="RTOTALANTES" class="java.lang.Double" calculation="Sum">
<variableExpression><![CDATA[$F{COL011}]]></variableExpression>
<initialValueExpression><![CDATA[$V{V_SALDO}]]></initialValueExpression>
</variable>
<group name="banco">
<groupExpression><![CDATA[$F{BANCO}]]></groupExpression>
<groupHeader>
<band height="32">
<staticText>
<reportElement x="559" y="12" width="113" height="20"/>
<textElement verticalAlignment="Middle">
<font size="10" isBold="true"/>
</textElement>
<text><![CDATA[Saldo Anterior ->]]></text>
</staticText>
<subreport isUsingCache="false" runToBottom="false">
<reportElement x="672" y="0" width="110" height="32"/>
<subreportParameter name="ID_BANCO">
<subreportParameterExpression><![CDATA[$P{ID_BANCO}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="ID_ANIOMESA">
<subreportParameterExpression><![CDATA[$P{ID_MESANIO}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<returnValue subreportVariable="TSALDOANTES" toVariable="RTOTALANTES"/>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "saldoanterior.jasper"]]></subreportExpression>
</subreport>
</band>
</groupHeader>
<groupFooter>
<band/>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="47" splitType="Stretch">
<textField>
<reportElement x="0" y="10" width="782" height="20"/>
<textElement textAlignment="Center">
<font size="16" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{ID_EMPRESA}]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="44" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="153" height="20"/>
<textElement>
<font size="14" isBold="true"/>
</textElement>
<text><![CDATA[Libro de Bancos]]></text>
</staticText>
<staticText>
<reportElement x="0" y="20" width="49" height="20"/>
<textElement>
<font size="14" isBold="true"/>
</textElement>
<text><![CDATA[Banco]]></text>
</staticText>
<textField>
<reportElement x="49" y="24" width="305" height="20"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{DESC_BANCO}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="153" y="0" width="197" height="20"/>
<textElement>
<font size="14" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{MESLETRA}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="54" splitType="Stretch">
<rectangle radius="10">
<reportElement x="3" y="0" width="779" height="44"/>
</rectangle>
<staticText>
<reportElement x="153" y="24" width="72" height="20"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Documento]]></text>
</staticText>
<staticText>
<reportElement x="225" y="24" width="100" height="20"/>
<textElement/>
<text><![CDATA[Beneficiario]]></text>
</staticText>
<staticText>
<reportElement x="418" y="24" width="199" height="20"/>
<textElement/>
<text><![CDATA[Concepto]]></text>
</staticText>
<staticText>
<reportElement x="617" y="24" width="79" height="20"/>
<textElement/>
<text><![CDATA[Valor]]></text>
</staticText>
<staticText>
<reportElement x="29" y="24" width="64" height="20"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Fecha]]></text>
</staticText>
<staticText>
<reportElement x="696" y="24" width="86" height="20"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Saldo]]></text>
</staticText>
<staticText>
<reportElement x="93" y="24" width="60" height="20"/>
<textElement/>
<text><![CDATA[Tipo Docto]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="33" splitType="Stretch">
<textField>
<reportElement x="418" y="0" width="199" height="32"/>
<textElement/>
<textFieldExpression><![CDATA[$F{CONCEPTO}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="29" y="0" width="64" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{FECHAX}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="225" y="0" width="193" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{BENEFICIARIO}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="153" y="0" width="72" height="20"/>
<textElement>
<font size="7"/>
</textElement>
<textFieldExpression><![CDATA[$F{DOCTO}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="3" y="0" width="26" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{COLUMN_COUNT}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="93" y="0" width="60" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{COL010}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00">
<reportElement x="617" y="0" width="79" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{COL011}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00">
<reportElement x="696" y="0" width="86" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{V_SALDO}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch">
<line>
<reportElement x="0" y="7" width="782" height="1"/>
</line>
<textField pattern="dd/MM/yyyy">
<reportElement x="3" y="17" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
<textField>
<reportElement x="662" y="17" width="80" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA["Hoja "+$V{PAGE_NUMBER}+" de"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="742" y="17" width="40" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</columnFooter>
<pageFooter>
<band splitType="Stretch"/>
</pageFooter>
<summary>
<band splitType="Stretch"/>
</summary>
</jasperReport>
  #4 (permalink)  
Antiguo 12/03/2012, 21:08
 
Fecha de Ingreso: marzo-2012
Mensajes: 3
Antigüedad: 12 años, 1 mes
Puntos: 0
Respuesta: Sumar una variable i-report

Gracias, ya me funciono como me indicaste , lo único que hice fue reiniciar el Jasper y luego que ingrese funciono muy bien, gracias por tu apoyo

Etiquetas: variables
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:18.