<?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="Catalogo Digitos New" language="groovy" pageWidth="792" pageHeight="612" orientation="Landscape" columnWidth="752" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
	<property name="ireport.zoom" value="1.5"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<queryString>
		<![CDATA[SELECT *
FROM
(
SELECT
'1' as num_dig,
digito||'00000' AS digitos, NOMBRE, NATURALEZA, '' AS USA_TERCERO, '' AS USA_AUXILIAR, '' AS USA_CEN_CTO,
 '' AS USA_SUB_CEN_CTO,
'' AS RETENCION,
0 AS ACTIVO,
0 AS CORRIENTE,
0 AS NO_CORRIENTE
FROM CN_CLASE_CUENTA
) UNION
(
SELECT
'2' as num_dig,
cla.DIGITO||gru.DIGITO||'0000' AS digitos, '__'||gru.NOMBRE, '' AS NATURALEZA, '' AS USA_TERCERO, '' AS USA_AUXILIAR, '' AS USA_CEN_CTO,
 '' AS USA_SUB_CEN_CTO,
'' AS RETENCION,
0 AS ACTIVO,
0 AS CORRIENTE,
0 AS NO_CORRIENTE
FROM CN_GRUPO_CUENTA gru
JOIN CN_CLASE_CUENTA cla ON cla.ID_CLASE_CUENTA = gru.ID_CLASE_CUENTA
) UNION
(
SELECT
'4' as num_dig,
cla.DIGITO||gru.DIGITO||may.DIGITOS||'00' AS digitos, '____'||may.NOMBRE, may.NATURALEZA, '' AS USA_TERCERO, '' AS USA_AUXILIAR, '' AS USA_CEN_CTO,
 '' AS USA_SUB_CEN_CTO,
'' AS RETENCION,
0 AS ACTIVO,
0 AS CORRIENTE,
0 AS NO_CORRIENTE
FROM CN_CUENTA_MAYOR may
JOIN CN_GRUPO_CUENTA gru ON may.ID_GRUPO_CUENTA = gru.ID_GRUPO_CUENTA
JOIN CN_CLASE_CUENTA cla ON cla.ID_CLASE_CUENTA = gru.ID_CLASE_CUENTA
) UNION
(
SELECT
'6' as num_dig,
cla.DIGITO||gru.DIGITO||may.DIGITOS||cat.DIGITOS AS digitos, '______'||cat.NOMBRE, '' AS NATURALEZA, TO_CHAR(est.USA_TERCERO), TO_CHAR(est.USA_AUXILIAR), TO_CHAR(est.USA_CEN_CTO),
 TO_CHAR(est.USA_SUB_CEN_CTO),
'' AS RETENCION,
cat.ACTIVO,
cat.CORRIENTE,
CASE cat.CORRIENTE
 WHEN 0 THEN 1
 ELSE 0
END AS NO_CORRIENTE
FROM CN_CATALOGO cat
JOIN CN_CUENTA_MAYOR may ON cat.ID_CUENTA_MAYOR = may.ID_CUENTA_MAYOR
JOIN CN_GRUPO_CUENTA gru ON may.ID_GRUPO_CUENTA = gru.ID_GRUPO_CUENTA
JOIN CN_CLASE_CUENTA cla ON cla.ID_CLASE_CUENTA = gru.ID_CLASE_CUENTA
JOIN CN_ESTADO_CATALOGO est ON est.ID_ESTADO_CATALOGO = cat.ID_ESTADO_CATALOGO
)
order by
Digitos]]>
	</queryString>
	<field name="NUM_DIG" class="java.lang.String"/>
	<field name="DIGITOS" class="java.lang.String"/>
	<field name="NOMBRE" class="java.lang.String"/>
	<field name="NATURALEZA" class="java.lang.String"/>
	<field name="USA_TERCERO" class="java.lang.String"/>
	<field name="USA_AUXILIAR" class="java.lang.String"/>
	<field name="USA_CEN_CTO" class="java.lang.String"/>
	<field name="USA_SUB_CEN_CTO" class="java.lang.String"/>
	<field name="RETENCION" class="java.lang.String"/>
	<field name="ACTIVO" class="java.math.BigDecimal"/>
	<field name="CORRIENTE" class="java.math.BigDecimal"/>
	<field name="NO_CORRIENTE" class="java.math.BigDecimal"/>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band height="60" splitType="Stretch">
			<textField pattern="dd-MMM-yyyy   hh:mm aaa">
				<reportElement mode="Opaque" x="601" y="29" width="150" height="12" forecolor="#000000" backcolor="#FFFFFF"/>
				<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement x="141" y="0" width="460" height="50"/>
				<textElement textAlignment="Center" verticalAlignment="Bottom" markup="none">
					<font fontName="SansSerif" size="12" isBold="true"/>
				</textElement>
				<text><![CDATA[Sistema de Contabilidad
Catalogo Digitos]]></text>
			</staticText>
			<image>
				<reportElement x="0" y="10" width="140" height="40"/>
				<imageExpression><![CDATA["repo:LogoEmpresa003.jpg"]]></imageExpression>
			</image>
			<staticText>
				<reportElement mode="Opaque" x="601" y="17" width="151" height="12" forecolor="#000000" backcolor="#FFFFFF"/>
				<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Fecha de Impresion:]]></text>
			</staticText>
		</band>
	</title>
	<pageHeader>
		<band height="20" splitType="Stretch"/>
	</pageHeader>
	<columnHeader>
		<band height="24" splitType="Stretch">
			<staticText>
				<reportElement mode="Opaque" x="0" y="0" width="60" height="24" 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">
					<font size="8" isBold="true"/>
				</textElement>
				<text><![CDATA[Dígitos]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="60" y="0" width="230" height="24" 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="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Nombre]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="360" y="0" width="40" height="24" 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="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Usa Tercero]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="290" y="0" width="70" height="24" 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="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Naturaleza]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="485" y="0" width="45" height="24" 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="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Usa Sub Cen Costo]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="440" y="0" width="45" height="24" 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="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Usa Cen Cost]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="400" y="0" width="40" height="24" 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="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Usa Auxiliar]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="706" y="0" width="46" height="24" 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="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Activo]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="530" y="0" width="86" height="24" 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="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Retención]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="661" y="0" width="45" height="24" 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="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[No corriente]]></text>
			</staticText>
			<staticText>
				<reportElement mode="Opaque" x="616" y="0" width="45" height="24" 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="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Corriente]]></text>
			</staticText>
		</band>
	</columnHeader>
	<detail>
		<band height="10" splitType="Stretch">
			<textField>
				<reportElement x="0" y="0" width="60" height="10"/>
				<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">
					<font size="6"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{DIGITOS}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="60" y="0" width="230" height="10"/>
				<box leftPadding="2">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement verticalAlignment="Middle">
					<font size="6"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{NOMBRE}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="290" y="0" width="70" height="10"/>
				<box leftPadding="2">
					<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">
					<font size="6"/>
				</textElement>
				<textFieldExpression><![CDATA[($F{NATURALEZA}.toString()=="D" ? "Débito" : "Crédito" )]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="360" y="0" width="40" height="10"/>
				<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">
					<font size="6"/>
				</textElement>
				<textFieldExpression><![CDATA[( $F{USA_TERCERO}.toString()=="0"
    ? "No"
    : ( $F{USA_TERCERO}.isEmpty() ? "" : "Si" )
)]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="400" y="0" width="40" height="10"/>
				<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">
					<font size="6"/>
				</textElement>
				<textFieldExpression><![CDATA[( $F{USA_AUXILIAR}.toString()=="0"
    ? "No"
    : ( $F{USA_AUXILIAR}.isEmpty() ? "" : "Si" )
)]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="485" y="0" width="45" height="10"/>
				<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">
					<font size="6"/>
				</textElement>
				<textFieldExpression><![CDATA[( $F{USA_SUB_CEN_CTO}.toString()=="0"
    ? "No"
    : ( $F{USA_SUB_CEN_CTO}.isEmpty() ? "" : "Si" )
)]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="440" y="0" width="45" height="10"/>
				<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">
					<font size="6"/>
				</textElement>
				<textFieldExpression><![CDATA[( $F{USA_CEN_CTO}.toString()=="0"
    ? "No"
    : ( $F{USA_CEN_CTO}.isEmpty() ? "" : "Si" )
)]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="530" y="0" width="86" height="10"/>
				<box leftPadding="3">
					<pen lineWidth="0.75"/>
					<topPen lineWidth="0.75"/>
					<leftPen lineWidth="0.75"/>
					<bottomPen lineWidth="0.75"/>
					<rightPen lineWidth="0.75"/>
				</box>
				<textElement verticalAlignment="Middle">
					<font size="6"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{RETENCION}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="616" y="0" width="45" height="10"/>
				<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">
					<font size="6"/>
				</textElement>
				<textFieldExpression><![CDATA[( $F{NUM_DIG}.toString()!="6"
    ? ""
    : ( $F{CORRIENTE}.toString()=="0" ? "No" :  "Si")
)]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="661" y="0" width="45" height="10"/>
				<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">
					<font size="6"/>
				</textElement>
				<textFieldExpression><![CDATA[( $F{NUM_DIG}.toString()!="6"
    ? ""
    : ( $F{NO_CORRIENTE}.toString()=="0" ? "No" :  "Si")
)]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="706" y="0" width="46" height="10"/>
				<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">
					<font size="6"/>
				</textElement>
				<textFieldExpression><![CDATA[( $F{NUM_DIG}.toString()!="6"
    ? ""
    : ( $F{ACTIVO}.toString()=="0" ? "No" :  "Si")
)]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<pageFooter>
		<band height="24" splitType="Stretch">
			<textField>
				<reportElement mode="Opaque" x="299" y="12" width="89" height="12" forecolor="#575757" backcolor="#FFFFFF"/>
				<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="6" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression><![CDATA["Página "+$V{PAGE_NUMBER}+" de "]]></textFieldExpression>
			</textField>
			<textField evaluationTime="Report" pattern="" isBlankWhenNull="false">
				<reportElement mode="Opaque" x="389" y="12" width="60" height="12" forecolor="#575757" backcolor="#FFFFFF"/>
				<textElement verticalAlignment="Middle" rotation="None" markup="none">
					<font fontName="SansSerif" size="6" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement mode="Opaque" x="299" y="0" width="150" height="12" forecolor="#575757"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="6"/>
				</textElement>
				<text><![CDATA[Websafi - Contabilidad]]></text>
			</staticText>
		</band>
	</pageFooter>
	<noData>
		<band height="20">
			<staticText>
				<reportElement x="0" y="0" width="752" height="20"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font isBold="true"/>
				</textElement>
				<text><![CDATA[No hay objetos a mostrar.]]></text>
			</staticText>
		</band>
	</noData>
</jasperReport>
