<?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="hist_element_val_elem" language="groovy" pageWidth="959" pageHeight="100" orientation="Landscape" columnWidth="959" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
	<property name="ireport.zoom" value="1.5"/>
	<property name="ireport.x" value="297"/>
	<property name="ireport.y" value="0"/>
	<property name="ireport.jasperserver.reportUnit" value="/reports/inventario/inf_hist_elemento"/>
	<property name="ireport.jasperserver.url" value="http://192.168.2.43:8090/jasperserver/services/repository"/>
	<parameter name="id_meses" class="java.lang.String">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="vigencia" class="java.lang.String">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="wherePlaqueta" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<parameter name="whereInventarioDV" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<parameter name="whereSerie" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<parameter name="vigencia_mes" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<parameter name="wherePlaca" class="java.lang.String">
		<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
	</parameter>
	<parameter name="id_inventario_dv" class="java.math.BigDecimal">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<queryString>
		<![CDATA[select

tab0.id_novedad_val_elemento as id_novedad_val_elemento,
tab0.fecha_novedad as fecha_novedad,
tab0.num_doc_sop as num_doc_sop,
tab0.id_ts_td as id_ts_td,
tab0.fecha_doc_sop as fecha_doc_sop,
tab0.observaciones as observaciones,
tab0.id_tipo_valoracion as id_tipo_valoracion,
case when tab0.id_tipo_valoracion = 1 then 'Valoración' else 'Avaluo' end as tipo_valoracion,
tab1.documento as documento,
tab1.descripcion as descripcion_td,
tab1.desccorta as desccorta_td,
/*tab3.num_doc as num_doc_ter,
tab3.razon_soc as razon_soc, tab3.num_doc||' - '||
tab3.razon_soc as completo,*/

tab6.codigo,
tab6.id_inventario_dv as secuencia_inv,
tab6.descripcion as descripcion_inv,
tab5.valor_valoracion,
tab5.costo_inicial,
tab5.nuevo_costo,
tab5.valor_libros,
tab5.valor_avaluo,
tab5.valor_ajuste,
tab5.ajuste_ch_convergencia

from in_novedad_val_elemento tab0
join ts_td tab1 on tab0.id_ts_td = tab1.id


--LEFT JOIN INTERCEROS_V tab3 ON tab0.id_mae_ter = tab3.id_mae_ter

join in_det_nov_val_elemento tab5 on tab5.id_novedad_val_elemento = tab0.id_novedad_val_elemento
join in_inventario_dv tab6 on tab6.id_inventario_dv = tab5.id_inventario_dv

where
tab5.id_inventario_dv = $P{id_inventario_dv}

order by
tab0.fecha_novedad,
tab0.id_novedad_val_elemento desc]]>
	</queryString>
	<field name="ID_NOVEDAD_VAL_ELEMENTO" class="java.math.BigDecimal"/>
	<field name="FECHA_NOVEDAD" class="java.sql.Timestamp"/>
	<field name="NUM_DOC_SOP" class="java.lang.String"/>
	<field name="ID_TS_TD" class="java.math.BigDecimal"/>
	<field name="FECHA_DOC_SOP" class="java.sql.Timestamp"/>
	<field name="OBSERVACIONES" class="java.lang.String"/>
	<field name="ID_TIPO_VALORACION" class="java.math.BigDecimal"/>
	<field name="TIPO_VALORACION" class="java.lang.String"/>
	<field name="DOCUMENTO" class="java.lang.String"/>
	<field name="DESCRIPCION_TD" class="java.lang.String"/>
	<field name="DESCCORTA_TD" class="java.lang.String"/>
	<field name="CODIGO" class="java.math.BigDecimal"/>
	<field name="SECUENCIA_INV" class="java.math.BigDecimal"/>
	<field name="DESCRIPCION_INV" class="java.lang.String"/>
	<field name="VALOR_VALORACION" class="java.math.BigDecimal"/>
	<field name="COSTO_INICIAL" class="java.math.BigDecimal"/>
	<field name="NUEVO_COSTO" class="java.math.BigDecimal"/>
	<field name="VALOR_LIBROS" class="java.math.BigDecimal"/>
	<field name="VALOR_AVALUO" class="java.math.BigDecimal"/>
	<field name="VALOR_AJUSTE" class="java.math.BigDecimal"/>
	<field name="AJUSTE_CH_CONVERGENCIA" class="java.math.BigDecimal"/>
	<background>
		<band splitType="Stretch"/>
	</background>
	<columnHeader>
		<band height="50" splitType="Stretch">
			<staticText>
				<reportElement x="0" y="0" width="168" height="20" isRemoveLineWhenBlank="true"/>
				<box>
					<bottomPen lineWidth="0.75"/>
				</box>
				<textElement verticalAlignment="Middle">
					<font size="12" isBold="true"/>
				</textElement>
				<text><![CDATA[Tipo Novedad           :]]></text>
			</staticText>
			<staticText>
				<reportElement x="168" y="0" width="793" height="20"/>
				<textElement textAlignment="Left" verticalAlignment="Middle" markup="none"/>
				<text><![CDATA[VALORACIÓN O AVALUO DE ELEMENTO]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="64" y="32" width="75" height="18" forecolor="#000000" backcolor="#88C2F9"/>
				<box>
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Fecha Novedad]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="334" y="32" width="65" height="18" forecolor="#000000" backcolor="#88C2F9"/>
				<box>
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Fecha Doc]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="214" y="32" width="120" height="18" forecolor="#000000" backcolor="#88C2F9"/>
				<box>
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Tipo Doc]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="139" y="32" width="75" height="18" forecolor="#000000" backcolor="#88C2F9"/>
				<box>
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[N° Doc]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="0" y="32" width="64" height="18" forecolor="#000000" backcolor="#88C2F9"/>
				<box>
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[N° Novedad]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="761" y="32" width="99" height="18" forecolor="#000000" backcolor="#88C2F9"/>
				<box>
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Valor Avaluo]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="686" y="32" width="75" height="18" forecolor="#000000" backcolor="#88C2F9"/>
				<box>
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Valoración]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="860" y="32" width="99" height="18" forecolor="#000000" backcolor="#88C2F9"/>
				<box>
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Ajuste Convergencia]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="399" y="32" width="287" height="18" forecolor="#000000" backcolor="#88C2F9"/>
				<box>
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="7" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Observaciones]]></text>
			</staticText>
		</band>
	</columnHeader>
	<detail>
		<band height="20" splitType="Stretch">
			<textField isStretchWithOverflow="true" pattern="dd/MM/yyyy">
				<reportElement stretchType="RelativeToTallestObject" x="64" y="0" width="75" height="20"/>
				<box>
					<pen lineWidth="0.75" lineStyle="Solid"/>
					<topPen lineWidth="0.75" lineStyle="Solid"/>
					<leftPen lineWidth="0.75" lineStyle="Solid"/>
					<bottomPen lineWidth="0.75" lineStyle="Solid"/>
					<rightPen lineWidth="0.75" lineStyle="Solid"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="7"/>
				</textElement>
				<textFieldExpression class="java.util.Date"><![CDATA[$F{FECHA_NOVEDAD}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement stretchType="RelativeToTallestObject" x="0" y="0" width="64" height="20"/>
				<box>
					<pen lineWidth="0.75" lineStyle="Solid"/>
					<topPen lineWidth="0.75" lineStyle="Solid"/>
					<leftPen lineWidth="0.75" lineStyle="Solid"/>
					<bottomPen lineWidth="0.75" lineStyle="Solid"/>
					<rightPen lineWidth="0.75" lineStyle="Solid"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="7"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{ID_NOVEDAD_VAL_ELEMENTO}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" pattern="dd/MM/yyyy">
				<reportElement stretchType="RelativeToTallestObject" x="334" y="0" width="65" height="20"/>
				<box>
					<pen lineWidth="0.75" lineStyle="Solid"/>
					<topPen lineWidth="0.75" lineStyle="Solid"/>
					<leftPen lineWidth="0.75" lineStyle="Solid"/>
					<bottomPen lineWidth="0.75" lineStyle="Solid"/>
					<rightPen lineWidth="0.75" lineStyle="Solid"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="7"/>
				</textElement>
				<textFieldExpression class="java.util.Date"><![CDATA[$F{FECHA_DOC_SOP}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement stretchType="RelativeToTallestObject" x="214" y="0" width="120" height="20"/>
				<box leftPadding="2">
					<pen lineWidth="0.75" lineStyle="Solid"/>
					<topPen lineWidth="0.75" lineStyle="Solid"/>
					<leftPen lineWidth="0.75" lineStyle="Solid"/>
					<bottomPen lineWidth="0.75" lineStyle="Solid"/>
					<rightPen lineWidth="0.75" lineStyle="Solid"/>
				</box>
				<textElement verticalAlignment="Middle">
					<font size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{DESCCORTA_TD}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement stretchType="RelativeToTallestObject" x="139" y="0" width="75" height="20"/>
				<box>
					<pen lineWidth="0.75" lineStyle="Solid"/>
					<topPen lineWidth="0.75" lineStyle="Solid"/>
					<leftPen lineWidth="0.75" lineStyle="Solid"/>
					<bottomPen lineWidth="0.75" lineStyle="Solid"/>
					<rightPen lineWidth="0.75" lineStyle="Solid"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{NUM_DOC_SOP}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" pattern="#,##0.00;(-#,##0.00)" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" x="761" y="0" width="99" height="20"/>
				<box rightPadding="2">
					<pen lineWidth="0.75" lineStyle="Solid"/>
					<topPen lineWidth="0.75" lineStyle="Solid"/>
					<leftPen lineWidth="0.75" lineStyle="Solid"/>
					<bottomPen lineWidth="0.75" lineStyle="Solid"/>
					<rightPen lineWidth="0.75" lineStyle="Solid"/>
				</box>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font size="7"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{VALOR_AVALUO}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" pattern="#,##0.00;(-#,##0.00)" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" x="686" y="0" width="75" height="20"/>
				<box rightPadding="2">
					<pen lineWidth="0.75" lineStyle="Solid"/>
					<topPen lineWidth="0.75" lineStyle="Solid"/>
					<leftPen lineWidth="0.75" lineStyle="Solid"/>
					<bottomPen lineWidth="0.75" lineStyle="Solid"/>
					<rightPen lineWidth="0.75" lineStyle="Solid"/>
				</box>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font size="7"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{VALOR_VALORACION}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" pattern="#,##0.00;(-#,##0.00)" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" x="860" y="0" width="99" height="20"/>
				<box rightPadding="2">
					<pen lineWidth="0.75" lineStyle="Solid"/>
					<topPen lineWidth="0.75" lineStyle="Solid"/>
					<leftPen lineWidth="0.75" lineStyle="Solid"/>
					<bottomPen lineWidth="0.75" lineStyle="Solid"/>
					<rightPen lineWidth="0.75" lineStyle="Solid"/>
				</box>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font size="7"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{AJUSTE_CH_CONVERGENCIA}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" x="399" y="0" width="287" height="20"/>
				<box leftPadding="2">
					<pen lineWidth="0.75" lineStyle="Solid"/>
					<topPen lineWidth="0.75" lineStyle="Solid"/>
					<leftPen lineWidth="0.75" lineStyle="Solid"/>
					<bottomPen lineWidth="0.75" lineStyle="Solid"/>
					<rightPen lineWidth="0.75" lineStyle="Solid"/>
				</box>
				<textElement verticalAlignment="Middle">
					<font size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{OBSERVACIONES}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
</jasperReport>
