<?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="Relatório de Equiparação Salarial" pageWidth="845" pageHeight="595" orientation="Landscape" columnWidth="805" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
	<property name="ireport.zoom" value="2.928200000000008"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<parameter name="P_CODEMP" class="java.math.BigDecimal">
		<property name="nomeTabela" value="TSIEMP"/>
		<parameterDescription><![CDATA[Empresa]]></parameterDescription>
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="P_CODCARGO" class="java.math.BigDecimal">
		<property name="nomeTabela" value="TFPCAR"/>
		<parameterDescription><![CDATA[Cargo]]></parameterDescription>
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<parameter name="P_CODCBO" class="java.math.BigDecimal">
		<parameterDescription><![CDATA[CBO]]></parameterDescription>
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<queryString>
		<![CDATA[SELECT
    EMP.CODEMP,
    EMP.RAZAOSOCIAL,
    Sankhya.FORMATAR_CPF_CNPJ(EMP.CGC) CGC,
    FUN.CODCARGO,
    CAR.DESCRCARGO DESCRCARGO,
    CAR.CODCBO,
    CBO.DESCRCBO,
    FUN.MATRICULA,
    FUN.NOMEFUNC,
    (
        SELECT MAX(OCO.DTINICOCOR)
        FROM TFPOCO OCO
        WHERE OCO.CODFUNC = FUN.CODFUNC
          AND OCO.CODEMP = FUN.CODEMP
          AND OCO.CODHISTOCOR IN (600,601,602,603,604,605,606,9999)
          AND FUN.SITUACAO NOT IN (0,8)
          AND FUN.VINCULO <> 90
    ) AS ULTIMA,
    FUN.SALBASE,
    CASE
        WHEN FUN.SEXO = 'F' THEN 'Feminino'
        WHEN FUN.SEXO = 'M' THEN 'Masculino'
    END AS Sexo,
    FUN.DTADM
FROM TFPFUN FUN
INNER JOIN TSIEMP EMP ON FUN.CODEMP = EMP.CODEMP
LEFT JOIN TFPDEP DEP ON FUN.CODDEP = DEP.CODDEP
LEFT JOIN TFPCAR CAR ON FUN.CODCARGO = CAR.CODCARGO
INNER JOIN TFPCBO CBO ON CAR.CODCBO = CBO.CODCBO
WHERE ($P{P_CODEMP} IS NULL OR FUN.CODEMP = $P{P_CODEMP})
AND ($P{P_CODCARGO} IS NULL OR FUN.CODCARGO = $P{P_CODCARGO})
AND ($P{P_CODCBO} IS NULL OR CAR.CODCBO = $P{P_CODCBO})
AND FUN.SITUACAO NOT IN (0,8)
AND FUN.VINCULO <> 90
ORDER BY FUN.CODEMP, CAR.CODCBO, FUN.NOMEFUNC]]>
	</queryString>
	<field name="CODEMP" class="java.math.BigDecimal"/>
	<field name="RAZAOSOCIAL" class="java.lang.String"/>
	<field name="CGC" class="java.lang.String"/>
	<field name="DESCRCBO" class="java.lang.String"/>
	<field name="CODCARGO" class="java.math.BigDecimal"/>
	<field name="DESCRCARGO" class="java.lang.String"/>
	<field name="MATRICULA" class="java.math.BigDecimal"/>
	<field name="NOMEFUNC" class="java.lang.String"/>
	<field name="SEXO" class="java.lang.String"/>
	<field name="DTADM" class="java.sql.Timestamp"/>
	<field name="CODCBO" class="java.lang.String"/>
	<field name="SALBASE" class="java.math.BigDecimal"/>
	<field name="ULTIMA" class="java.sql.Timestamp"/>
	<variable name="MATRICULA_1" class="java.lang.Integer" calculation="Count">
		<variableExpression><![CDATA[$F{MATRICULA}]]></variableExpression>
	</variable>
	<group name="EMPRESA" isStartNewPage="true">
		<groupExpression><![CDATA[$F{CODEMP}]]></groupExpression>
		<groupHeader>
			<band height="72">
				<rectangle>
					<reportElement mode="Opaque" x="0" y="41" width="805" height="15" backcolor="#CCCCCC"/>
					<graphicElement>
						<pen lineWidth="0.25"/>
					</graphicElement>
				</rectangle>
				<textField isBlankWhenNull="true">
					<reportElement x="0" y="41" width="482" height="15"/>
					<box leftPadding="2"/>
					<textElement verticalAlignment="Middle">
						<font size="9" isBold="true"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA["Empresa: "+$F{CODEMP}+" - "+$F{RAZAOSOCIAL}]]></textFieldExpression>
				</textField>
				<textField isBlankWhenNull="true">
					<reportElement x="482" y="41" width="323" height="15"/>
					<textElement verticalAlignment="Middle">
						<font size="9" isBold="true"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA["CNPJ: "+$F{CGC}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement stretchType="RelativeToBandHeight" x="0" y="56" width="46" height="16" isPrintWhenDetailOverflows="true"/>
					<box leftPadding="2">
						<leftPen lineWidth="0.5"/>
						<bottomPen lineWidth="0.5"/>
					</box>
					<textElement verticalAlignment="Middle">
						<font size="8" isBold="true"/>
					</textElement>
					<text><![CDATA[Matrícula]]></text>
				</staticText>
				<staticText>
					<reportElement stretchType="RelativeToBandHeight" x="46" y="56" width="190" height="16" isPrintWhenDetailOverflows="true"/>
					<box>
						<bottomPen lineWidth="0.5"/>
					</box>
					<textElement verticalAlignment="Middle">
						<font size="8" isBold="true"/>
					</textElement>
					<text><![CDATA[Funcionário (a)]]></text>
				</staticText>
				<staticText>
					<reportElement stretchType="RelativeToBandHeight" x="653" y="56" width="59" height="16" isPrintWhenDetailOverflows="true"/>
					<box>
						<bottomPen lineWidth="0.5"/>
					</box>
					<textElement textAlignment="Right" verticalAlignment="Middle">
						<font size="8" isBold="true"/>
					</textElement>
					<text><![CDATA[Sexo]]></text>
				</staticText>
				<staticText>
					<reportElement stretchType="RelativeToBandHeight" x="712" y="56" width="93" height="16" isPrintWhenDetailOverflows="true"/>
					<box rightPadding="2">
						<bottomPen lineWidth="0.5"/>
						<rightPen lineWidth="0.5"/>
					</box>
					<textElement textAlignment="Right" verticalAlignment="Middle">
						<font size="8" isBold="true"/>
					</textElement>
					<text><![CDATA[Salário Base]]></text>
				</staticText>
				<staticText>
					<reportElement stretchType="RelativeToBandHeight" x="236" y="56" width="85" height="16" isPrintWhenDetailOverflows="true"/>
					<box>
						<bottomPen lineWidth="0.5"/>
					</box>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="8" isBold="true"/>
					</textElement>
					<text><![CDATA[Data da Admissão]]></text>
				</staticText>
				<staticText>
					<reportElement stretchType="RelativeToBandHeight" x="321" y="56" width="161" height="16" isPrintWhenDetailOverflows="true"/>
					<box>
						<bottomPen lineWidth="0.5"/>
					</box>
					<textElement verticalAlignment="Middle">
						<font size="8" isBold="true"/>
					</textElement>
					<text><![CDATA[Cargo]]></text>
				</staticText>
				<staticText>
					<reportElement stretchType="RelativeToBandHeight" x="482" y="56" width="51" height="16" isPrintWhenDetailOverflows="true"/>
					<box>
						<bottomPen lineWidth="0.5"/>
					</box>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="8" isBold="true"/>
					</textElement>
					<text><![CDATA[CBO]]></text>
				</staticText>
				<staticText>
					<reportElement stretchType="RelativeToBandHeight" x="533" y="56" width="120" height="16" isPrintWhenDetailOverflows="true"/>
					<box>
						<bottomPen lineWidth="0.5"/>
					</box>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="8" isBold="true"/>
					</textElement>
					<text><![CDATA[Última Alteração Salarial]]></text>
				</staticText>
				<rectangle>
					<reportElement x="0" y="21" width="805" height="20" backcolor="#999999"/>
					<graphicElement>
						<pen lineWidth="0.5"/>
					</graphicElement>
				</rectangle>
				<staticText>
					<reportElement x="0" y="21" width="805" height="20"/>
					<textElement textAlignment="Center" verticalAlignment="Middle">
						<font size="14" isBold="true" isUnderline="false"/>
					</textElement>
					<text><![CDATA[RELATÓRIO DE ANÁLISE DE EQUIPARAÇÃO SALARIAL]]></text>
				</staticText>
				<staticText>
					<reportElement x="0" y="1" width="653" height="20"/>
					<textElement>
						<font size="14" isBold="true" isItalic="true"/>
					</textElement>
					<text><![CDATA[PESSOAL +]]></text>
				</staticText>
				<textField pattern="">
					<reportElement x="653" y="1" width="152" height="20"/>
					<textElement textAlignment="Right">
						<font size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[(new SimpleDateFormat("dd/MM/yyyy").format(new java.util.Date())) + "  " + (new SimpleDateFormat("HH:mm:ss").format(new java.util.Date()))]]></textFieldExpression>
				</textField>
			</band>
		</groupHeader>
	</group>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band height="1" splitType="Stretch"/>
	</title>
	<detail>
		<band height="14" splitType="Stretch">
			<textField isBlankWhenNull="true">
				<reportElement x="46" y="2" width="190" height="12"/>
				<box leftPadding="2"/>
				<textElement verticalAlignment="Middle">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{NOMEFUNC}]]></textFieldExpression>
			</textField>
			<textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
				<reportElement x="236" y="2" width="85" height="12"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.sql.Timestamp"><![CDATA[$F{DTADM}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="653" y="2" width="59" height="12"/>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{SEXO}]]></textFieldExpression>
			</textField>
			<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
				<reportElement x="712" y="2" width="93" height="12"/>
				<box rightPadding="2"/>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{SALBASE}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="0" y="2" width="46" height="12"/>
				<box leftPadding="0" rightPadding="5"/>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{MATRICULA}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="321" y="2" width="161" height="12"/>
				<box leftPadding="2"/>
				<textElement verticalAlignment="Middle">
					<font size="8" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{CODCARGO}+" - "+$F{DESCRCARGO}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement x="482" y="2" width="51" height="12"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="8" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{CODCBO}]]></textFieldExpression>
			</textField>
			<textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
				<reportElement x="533" y="2" width="120" height="12"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="8"/>
				</textElement>
				<textFieldExpression class="java.sql.Timestamp"><![CDATA[$F{ULTIMA}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<pageFooter>
		<band height="18" splitType="Stretch">
			<textField evaluationTime="Report">
				<reportElement x="785" y="3" width="0" height="12"/>
				<textElement verticalAlignment="Middle">
					<font size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="0" y="3" width="775" height="15"/>
				<box>
					<topPen lineWidth="0.25"/>
				</box>
				<textElement textAlignment="Right" verticalAlignment="Middle">
					<font size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["Pag. "+$V{PAGE_NUMBER}+" de"]]></textFieldExpression>
			</textField>
			<textField evaluationTime="Report">
				<reportElement x="775" y="3" width="30" height="15"/>
				<box>
					<topPen lineWidth="0.25"/>
				</box>
				<textElement verticalAlignment="Middle">
					<font size="7"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
			</textField>
		</band>
	</pageFooter>
	<summary>
		<band height="16" splitType="Stretch">
			<textField>
				<reportElement x="0" y="0" width="805" height="16"/>
				<box rightPadding="2">
					<topPen lineWidth="0.5"/>
				</box>
				<textElement textAlignment="Right" verticalAlignment="Bottom">
					<font size="8" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["Total de Funcionários: "+$V{MATRICULA_1}]]></textFieldExpression>
			</textField>
		</band>
	</summary>
</jasperReport>
