<?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="subreporte_iva" language="groovy" pageWidth="572" pageHeight="595" orientation="Landscape" columnWidth="572" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
	<property name="ireport.zoom" value="1.4641000000000013"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<property name="ireport.jasperserver.reportUnit" value="/reports/inventario/contrato_general"/>
	<property name="ireport.jasperserver.url" value="http://localhost:18091/jasperserver/services/repository"/>
	<parameter name="id_contrato" class="java.math.BigDecimal">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="id_cen_op" class="java.math.BigDecimal">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="id_vigencia" class="java.math.BigDecimal">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="numero_letras" class="java.lang.String"/>
	<parameter name="reteiva" class="java.math.BigDecimal"/>
	<queryString>
		<![CDATA[SELECT tab.iva, valor_total,sum(tab.valor_iva) FROM(

select  tab12.iva, tab12.valor_iva, tab11.valor_total

from in_contrato tab11

join in_det_contrato tab12 on tab11.id_contrato= tab12.id_contrato and tab12.id_vigencia = tab11.id_vigencia and tab12.id_cen_op= tab11.id_cen_op


where 1=1 and tab11.id_contrato= $P{id_contrato} and tab11.id_vigencia=$P{id_vigencia} and tab11.id_cen_op =$P{id_cen_op}

) tab
group by
tab.iva, valor_total]]>
	</queryString>
	<field name="IVA" class="java.math.BigDecimal"/>
	<field name="VALOR_TOTAL" class="java.math.BigDecimal"/>
	<field name="SUM(TAB.VALOR_IVA)" class="java.math.BigDecimal"/>
	<detail>
		<band height="16" splitType="Stretch">
			<textField pattern="#,##0.00;(-#,##0.00)" isBlankWhenNull="true">
				<reportElement mode="Opaque" x="464" y="0" width="108" height="16" isRemoveLineWhenBlank="true" backcolor="#E2D9D9">
					<printWhenExpression><![CDATA[$P{reteiva}==1]]></printWhenExpression>
				</reportElement>
				<box leftPadding="0" rightPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.0"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font size="6" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{SUM(TAB.VALOR_IVA)}]]></textFieldExpression>
			</textField>
			<textField pattern="#,##0.00 %" isBlankWhenNull="true">
				<reportElement mode="Opaque" x="26" y="0" width="97" height="16" isRemoveLineWhenBlank="true" backcolor="#E2D9D9">
					<printWhenExpression><![CDATA[$P{reteiva}==1]]></printWhenExpression>
				</reportElement>
				<box leftPadding="0" rightPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.0"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.0"/>
				</box>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="6" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{IVA}+"% :"]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement mode="Opaque" x="0" y="0" width="27" height="16" forecolor="#000000" backcolor="#E2D9D9">
					<printWhenExpression><![CDATA[$P{reteiva}==1]]></printWhenExpression>
				</reportElement>
				<box leftPadding="2">
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Left" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[IVA]]></text>
			</staticText>
			<staticText>
				<reportElement stretchType="RelativeToBandHeight" mode="Opaque" x="109" y="0" width="355" height="16" forecolor="#000000" backcolor="#E2D9D9">
					<printWhenExpression><![CDATA[$P{reteiva}==1]]></printWhenExpression>
				</reportElement>
				<box leftPadding="2">
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.0"/>
					<bottomPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Left" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[]]></text>
			</staticText>
		</band>
	</detail>
	<columnFooter>
		<band height="52">
			<staticText>
				<reportElement stretchType="RelativeToBandHeight" mode="Opaque" x="-1" y="28" width="109" height="16" forecolor="#000000" backcolor="#E2D9D9"/>
				<box leftPadding="2">
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Left" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[VALOR NETO A PAGAR:]]></text>
			</staticText>
			<staticText>
				<reportElement stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="6" width="464" height="16" forecolor="#000000" backcolor="#E2D9D9"/>
				<box leftPadding="2">
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Left" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="6" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[TOTAL:]]></text>
			</staticText>
			<textField pattern="#,##0.00;(-#,##0.00)" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="108" y="28" width="464" height="16" backcolor="#E2D9D9"/>
				<box leftPadding="2" rightPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.0"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Left" verticalAlignment="Middle">
					<font size="6" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{numero_letras}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" pattern="#,##0.00;(#,##0.00)" isBlankWhenNull="true">
				<reportElement stretchType="RelativeToBandHeight" mode="Opaque" x="464" y="6" width="108" height="16" backcolor="#E2D9D9"/>
				<box leftPadding="2" rightPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.0"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font size="6" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{VALOR_TOTAL}]]></textFieldExpression>
			</textField>
		</band>
	</columnFooter>
</jasperReport>
