<?xml version="1.0" standalone="yes"?>
  <DATAPACKET Version="2.0">
<METADATA>
<FIELDS>
<FIELD attrname="vie_key" fieldtype="string.uni" WIDTH="128">
<PARAM Name="ORIGIN" Value="vie_key" Roundtrip="True"/>
</FIELD>
<FIELD attrname="fonte" fieldtype="bin.hex" SUBTYPE="WideText">
<PARAM Name="PROVFLAGS" Value="1" Type="i4" Roundtrip="True"/>
<PARAM Name="ORIGIN" Value="fonte" Roundtrip="True"/>
</FIELD>
</FIELDS>
<PARAMS DEFAULT_ORDER="1"/>
</METADATA>
<ROWDATA>
<ROW vie_key="agenciabanc" fonte=" SELECT agencia.codigoagenciabanc,&#010;    agencia.codigobanco,&#010;    agencia.numeroagencia AS nragencia,&#010;    agencia.digitoagencia AS dgagencia,&#010;    agencia.nomeagencia,&#010;    &apos;&apos;::character varying(60) AS pessoacontato,&#010;    (((agencia.dddfone)::character varying(4))::text || ((agencia.numerofone)::character varying(9))::text) AS telefone,&#010;    agencia.codigoendereco,&#010;    (agencia.numenderagencia)::character varying(10) AS nrendereco,&#010;    agencia.complenderagencia AS complemento&#010;   FROM agencia&#010;  WHERE (agencia.codigoagenciabanc &gt; &apos;-1&apos;::integer);"/>
<ROW vie_key="cliente" fonte=" SELECT cl.codigopessoafin AS codigocliente,&#010;    pf.codigoempresa,&#010;    pf.codigoestab,&#010;    NULL::text AS codigocontatocom,&#010;    pf.codigopessoa,&#010;    pf.nome AS razaosocialcliente,&#010;    pf.apelido AS nomefantasiacliente,&#010;    tl.dstipologradoro AS logradcliente,&#010;    lo.nomelogradoro AS enderecocliente,&#010;    pe.nrendereco AS numendercliente,&#010;    pe.complemento AS complendercliente,&#010;    ba.nomebairro AS bairroendercliente,&#010;    mu.siglaestado,&#010;    mu.codigomunic,&#010;    ed.cep AS cependercliente,&#010;    ( SELECT formatardddfone.ddd&#010;           FROM formatardddfone(fone.valor) formatardddfone(ddd)) AS dddfonecliente,&#010;    ( SELECT formatarnumerofone.fone&#010;           FROM formatarnumerofone(fone.valor) formatarnumerofone(fone)) AS numerofonecliente,&#010;    ( SELECT formatardddfone.ddd&#010;           FROM formatardddfone(fx.valor) formatardddfone(ddd)) AS dddfaxcliente,&#010;    ( SELECT formatarnumerofone.fone&#010;           FROM formatarnumerofone(fx.valor) formatarnumerofone(fone)) AS numerofaxcliente,&#010;    ( SELECT ep.emails&#010;           FROM emailspessoafinanceiro(cl.codigopessoafin) ep(emails)) AS emailcliente,&#010;    cl.paginainternetcliente,&#010;    cl.datainicioativcliente,&#010;    pf.tipoinscfederal AS tipoinscr,&#010;    pf.inscfederal AS inscrfederal,&#010;    cl.produtrural,&#010;    cl.inscrprod,&#010;    cl.inscrestad,&#010;    cl.irrf,&#010;    cl.pis,&#010;    cl.considlimpis,&#010;    cl.cofins,&#010;    cl.considlimcofins,&#010;    cl.csll,&#010;    cl.considlimcsll,&#010;    cl.inss,&#010;    cl.honorariobalanco,&#010;    cl.codigocaixaconta,&#010;    cl.diavcto,&#010;    cl.vencimentofixovar,&#010;    cl.vctosabdomfer,&#010;    pf.databaixa AS databaixacliente,&#010;    cl.localprestacaoservico,&#010;    cl.situacaocliente,&#010;    pf.observbaixacliente&#010;   FROM (((((((((pessoafincliente cl&#010;     JOIN pessoafinanceiro pf ON ((pf.codigopessoafin = cl.codigopessoafin)))&#010;     LEFT JOIN pessoaendereco pe ON (((pe.codigopessoafin = cl.codigopessoafin) AND (pe.padrao = &apos;1&apos;::bpchar))))&#010;     LEFT JOIN endereco ed ON ((ed.codigoendereco = pe.codigoendereco)))&#010;     LEFT JOIN tipologradoro tl ON ((tl.codigotipologradoro = ed.codigotipologradoro)))&#010;     LEFT JOIN logradoro lo ON ((lo.codigologradoro = ed.codigologradoro)))&#010;     LEFT JOIN bairro ba ON ((ba.codigobairro = ed.codigobairro)))&#010;     LEFT JOIN municipio mu ON ((mu.codigomunicipio = ed.codigomunicipio)))&#010;     LEFT JOIN ( SELECT ft.codigopessoafin,&#010;            ft.valor&#010;           FROM pessoacontato ft&#010;          WHERE (ft.codigopessoacontato = ( SELECT min(ft2.codigopessoacontato) AS min&#010;                   FROM pessoacontato ft2&#010;                  WHERE ((ft2.codigopessoafin = ft.codigopessoafin) AND (ft2.tipocontato = 5))))) fx ON ((fx.codigopessoafin = cl.codigopessoafin)))&#010;     LEFT JOIN ( SELECT fo.codigopessoafin,&#010;            fo.valor&#010;           FROM pessoacontato fo&#010;          WHERE (fo.codigopessoacontato = ( SELECT min(fo2.codigopessoacontato) AS min&#010;                   FROM pessoacontato fo2&#010;                  WHERE ((fo2.codigopessoafin = fo.codigopessoafin) AND (fo2.tipocontato = ANY (ARRAY[0, 1, 2, 3, 4])))))) fone ON ((fone.codigopessoafin = cl.codigopessoafin)));"/>
<ROW vie_key="clientecobranca" fonte=" SELECT pe.codigopessoafin AS codigocliente,&#010;    tl.dstipologradoro AS logradcobranca,&#010;    lo.nomelogradoro AS enderecocobranca,&#010;    pe.nrendereco AS numendercobranca,&#010;    pe.complemento AS complendercobranca,&#010;    ba.nomebairro AS bairroendercobranca,&#010;    mu.siglaestado,&#010;    mu.codigomunicipio AS codigomunic,&#010;    en.cep AS cependercobranca&#010;   FROM (((((pessoaendereco pe&#010;     LEFT JOIN endereco en ON ((en.codigoendereco = pe.codigoendereco)))&#010;     LEFT JOIN tipologradoro tl ON ((tl.codigotipologradoro = en.codigotipologradoro)))&#010;     LEFT JOIN logradoro lo ON ((lo.codigologradoro = en.codigologradoro)))&#010;     LEFT JOIN bairro ba ON ((ba.codigobairro = en.codigobairro)))&#010;     LEFT JOIN municipio mu ON ((mu.codigomunicipio = en.codigomunicipio)))&#010;  WHERE (pe.seq = ( SELECT min(aux.seq) AS min&#010;           FROM pessoaendereco aux&#010;          WHERE ((aux.codigopessoafin = pe.codigopessoafin) AND (aux.tipoendereco = 2))));"/>
<ROW vie_key="debitofederaldarf" fonte=" SELECT debitofederal.codigoempresa,&#010;    debitofederal.codigoestab,&#010;    debitofederal.chavedebitofed,&#010;    debitofederal.codigoimposto,&#010;    debitofederal.variacaoimposto,&#010;    debitofederal.datavencimento,&#010;    debitofederal.valordebito,&#010;    debitofederal.situacaodebito,&#010;    debitofederal.observdebito&#010;   FROM debitofederal&#010;  WHERE (debitofederal.formadebito &lt;&gt; 1);"/>
<ROW vie_key="esocialdadosfunc" fonte=" SELECT s2200.codigoempresa,&#010;    s2200.codigoesocialtransacao,&#010;    s2200.codigofunccontr&#010;   FROM esocialdadoss2200 s2200&#010;UNION&#010; SELECT s2300.codigoempresa,&#010;    s2300.codigoesocialtransacao,&#010;    s2300.codigofunccontr&#010;   FROM esocialdadoss2300 s2300;"/>
<ROW vie_key="esocialuniftab14e15" fonte=" SELECT vw.codigosituacao,&#010;    vw.descricao,&#010;    vw.aplicacao,&#010;    vw.datainicial,&#010;    vw.datafinal&#010;   FROM ( SELECT t_t.codigoagentecausador AS codigosituacao,&#010;            t_t.descricaocausadoracidtrab AS descricao,&#010;            NULL::character varying(1000) AS aplicacao,&#010;            t_t.datainicial,&#010;            t_t.datafinal&#010;           FROM agentecausadoracidtrab t_t&#010;        UNION ALL&#010;         SELECT t_t.codigosituacao,&#010;            (t_t.descricao)::character varying(255) AS descricao,&#010;            t_t.aplicacao,&#010;            t_t.datainicial,&#010;            t_t.datafinal&#010;           FROM catsitgeradora t_t) vw;"/>
<ROW vie_key="fpracertocr" fonte=" SELECT cr.codigoescrit,&#010;    cr.codigoacerto,&#010;    cr.numerodctocr AS codigoreceber,&#010;    2 AS operacaoacerto&#010;   FROM fpracertocxfincr cr;"/>
<ROW vie_key="fprcontareceber" fonte=" SELECT cr.codigoescrit,&#010;    cr.codigocliente AS codigopessoafin,&#010;    cr.numerodctocr AS codigorecebercab,&#010;    cr.numerodctocr AS codigoreceber,&#010;    cr.numerodctocr AS documentorec,&#010;    cr.datavctocr AS datavencimentorec,&#010;    cr.datahoralcto AS datalancamentorec,&#010;    cr.codigocaixaplano AS codigoconta,&#010;    cr.observcr AS historicorec,&#010;    cr.origemdado AS origemrec,&#010;    cr.statuscr AS situacaorec,&#010;    cr.valorcr AS nominalrec,&#010;    0 AS jurorec,&#010;    0 AS multarec,&#010;    0 AS descontorec,&#010;    0 AS tarifarec,&#010;    cr.valorcr AS valorrec,&#010;        CASE&#010;            WHEN ((cr.valorcr - COALESCE(( SELECT sum((COALESCE(rb.valorrctocr, (0)::numeric) + COALESCE(rb.descontorctocr, (0)::numeric))) AS sum&#010;               FROM contarecebida rb&#010;              WHERE ((rb.codigoescrit = cr.codigoescrit) AND ((rb.numerodctocr)::text = (cr.numerodctocr)::text))), (0)::numeric)) &lt; (0)::numeric) THEN (0)::numeric&#010;            ELSE (cr.valorcr - COALESCE(( SELECT sum((COALESCE(rb.valorrctocr, (0)::numeric) + COALESCE(rb.descontorctocr, (0)::numeric))) AS sum&#010;               FROM contarecebida rb&#010;              WHERE ((rb.codigoescrit = cr.codigoescrit) AND ((rb.numerodctocr)::text = (cr.numerodctocr)::text))), (0)::numeric))&#010;        END AS saldorec&#010;   FROM contareceber cr;"/>
<ROW vie_key="fprcontareceberbaixa" fonte=" SELECT cr.codigoescrit,&#010;    cr.seqcr AS codigorecbaixa,&#010;    cr.numerodctocr AS codigoreceber,&#010;    ( SELECT ac.codigoacerto&#010;           FROM fpracertocxfincr ac&#010;          WHERE ((ac.codigoescrit = cr.codigoescrit) AND ((ac.numerodctocr)::text = (cr.numerodctocr)::text) AND (ac.seqcr = cr.seqcr))&#010;         LIMIT 1) AS codigoacerto,&#010;    cr.valorrctocr AS valorbaixa,&#010;    cr.jurorctocr AS valorjurobaixa,&#010;    cr.multarctocr AS valormultabaixa,&#010;    cr.descontorctocr AS valordescbaixa&#010;   FROM contarecebida cr;"/>
<ROW vie_key="fprcotacao" fonte=" SELECT cotacao.codigomoeda,&#010;    cotacao.datacotacao,&#010;    cotacao.valorcotacao&#010;   FROM cotacao&#010;  WHERE (cotacao.codigomoeda &gt; &apos;-1&apos;::integer);"/>
<ROW vie_key="fprmoeda" fonte=" SELECT moeda.codigomoeda,&#010;    moeda.nomemoeda,&#010;    moeda.tipocotacao,&#010;    moeda.numerodecimal,&#010;    moeda.nomesingular,&#010;    moeda.nomeplural,&#010;    moeda.cifraomoeda&#010;   FROM moeda&#010;  WHERE (moeda.codigomoeda &gt; &apos;-1&apos;::integer);"/>
<ROW vie_key="funcionario" fonte=" SELECT fc.codigoempresa,&#010;    fc.codigofunccontr,&#010;    fp.codigofuncpessoa,&#010;    fp.nomefunc,&#010;    fp.apelidofunc,&#010;    fp.fotofunc,&#010;    tl.codigotipolograd,&#010;    tl.descrtipolograd AS logradfunc,&#010;    fp.enderfunc,&#010;    fp.complender,&#010;    fp.numeroender,&#010;    fp.bairrofunc,&#010;    fp.siglaestado,&#010;    fp.codigomunic,&#010;    fp.cepfunc,&#010;    fp.dddfone,&#010;    fp.numerofone,&#010;    fp.ramalfone,&#010;    fp.endereletr,&#010;    fp.datanasc,&#010;    fp.siglaestadonasc,&#010;    fp.codigomunicnasc,&#010;    fp.sexo,&#010;    fp.racacor,&#010;    fp.deffisica,&#010;    fp.defvisual,&#010;    fp.defauditiva,&#010;    fp.defmental,&#010;    fp.defintelectual,&#010;    fp.defreabilitado,&#010;    fp.defobs,&#010;    fp.estadocivil,&#010;    fp.grauinstr,&#010;    fp.nacionalidade,&#010;    fp.datachegada,&#010;    fp.tipovisto,&#010;    fp.cartrne,&#010;    fp.validrne,&#010;    ftd.utilizacarteiradigital,&#010;    ftd.numeroctps,&#010;    ftd.seriectps,&#010;    ftd.siglaestadoctps,&#010;    ftd.expedctps,&#010;    fp.pisfunc,&#010;    fp.datacadpis,&#010;    fp.cpffunc,&#010;    fp.numerorg,&#010;    oerg.siglaorgaoemissor AS orgemisrg,&#010;    fp.siglaestadorg,&#010;    fp.emissrg,&#010;    fp.complrg,&#010;    fp.titeleit,&#010;    fp.zonatiteleit,&#010;    fp.secaotiteleit,&#010;    fp.cnhfunc,&#010;    fp.categcnh,&#010;    fp.validcnh,&#010;    fp.cartreserv,&#010;    fp.categcartreserv,&#010;    fp.codigoconselho,&#010;    fp.numeroregist,&#010;    fp.dataregist,&#010;    fp.paisorigem,&#010;    fp.certciviltipo,&#010;    fp.certcivilemissao,&#010;    fp.certciviltermo,&#010;    fp.certcivillivro,&#010;    fp.certcivilfolha,&#010;    fp.certcivilcartorio,&#010;    fp.certcivilsiglaestado,&#010;    fp.certcivilmunic,&#010;    fp.passapnumero,&#010;    oepass.siglaorgaoemissor AS passapemissor,&#010;    fp.passapsiglaestado,&#010;    fp.passapemissao,&#010;    fp.passapvalidade,&#010;    fp.passappaisemissao,&#010;    fp.portnatnumero,&#010;    fp.portnatdata,&#010;    fp.ricnumero,&#010;    fp.ricsiglaestado,&#010;    fp.ricmunic,&#010;    oeric.siglaorgaoemissor AS ricorgaoemissor,&#010;    fp.ricdataexped,&#010;    fp.brpdhppp,&#010;    fc.codigotipocontr,&#010;    fc.dataadm,&#010;    fc.optantefgts,&#010;    fc.dataopcaofgts,&#010;    fc.contafgts,&#010;    fc.codigosit,&#010;    fc.dataaposent,&#010;    fc.tipovinculo,&#010;    fc.siglaestadominreg,&#010;    fc.codigocateg,&#010;    fc.categoria,&#010;    fd.sindicalizado,&#010;    fd.descmenssind,&#010;    fd.mescontribsind,&#010;    fc.recebe13sal,&#010;    fc.recebeadto,&#010;    fc.percadto,&#010;    fc.perpgto,&#010;    fc.modopgto,&#010;    fc.tipoconta,&#010;    fc.codigobanco,&#010;    fc.numeroagencia,&#010;    fc.numeroconta,&#010;    fc.digitoconta,&#010;    fpix.tipopix,&#010;    fpix.tipochavepix,&#010;    fpix.chavepix,&#010;    fpix.chavepixqrcode,&#010;    vth.codigoescvt,&#010;    fc.numerocartaovt,&#010;    fc.prevtermafastvt,&#010;    fvr.codigoescalarefeicao,&#010;    fd.desccontribsind,&#010;    fc.emitecartao,&#010;    fc.chapeira,&#010;    fc.numeroinscrinss,&#010;    fc.codigoimposto,&#010;    fc.variacaoimposto,&#010;    fc.codigoimposto13,&#010;    fc.variacaoimposto13,&#010;    fc.emitircarne,&#010;    fc.inssfolha,&#010;    fc.datadem,&#010;    fc.datapgtoresccompl,&#010;    fc.particpat,&#010;    fc.possuialvara,&#010;    fc.formacalculo,&#010;    fc.diacontrexp,&#010;    fc.diaprorrogcontrexp,&#010;    fd.desccustconfed,&#010;    fd.desctaxaassist,&#010;    fc.datatransfemp,&#010;    fc.codigousuario,&#010;    fc.datahoralcto,&#010;    fc.origemdado,&#010;    fc.tipoinscrsefip,&#010;    fc.documentoscompletos,&#010;    fc.utilizaqcolabore,&#010;    fc.perfiltareffa,&#010;    fd.descontarevsal,&#010;    fc.codigofunccontrsubst,&#010;    fc.codigoprocessojudadm,&#010;    fc.indicatprimemp,&#010;    fc.motivocontrat,&#010;    fc.regimeprev,&#010;    fc.regimetrab,&#010;    fp.codigopostal,&#010;    fp.datanatural,&#010;    fp.dddcelular,&#010;    fp.expedicaocnh,&#010;    fp.expedicaorne,&#010;    fp.numerocelular,&#010;    oecnh.siglaorgaoemissor AS orgaoemissorcnh,&#010;    oerne.siglaorgaoemissor AS orgaoemissorrne,&#010;    fp.validaderegist,&#010;    fd.codigosind,&#010;    fp.codigoorgaoemissorrg,&#010;    fp.codigoorgaoemissorcnh,&#010;    fp.codigoorgaoemissorpasport,&#010;    fp.codigoorgaoemissorric,&#010;    fp.codigoorgaoemissorrne,&#010;    fp.nomefunc AS nomefuncgrava,&#010;    fc.dataadm AS datacontrexp1,&#010;    fc.dataadm AS datacontrexp2,&#010;    sal.codigotabsal,&#010;    es.codigoativfederal,&#010;    fg.codigofuncao,&#010;    fg.codigocargo,&#010;    fe.codigoescala,&#010;    fe.tipojornada,&#010;    fe.descrtipojornada,&#010;    fes.codigoestabil,&#010;    fq.codigoqualif,&#010;    fl.classiforgan,&#010;    fc.dataadm AS datainperaquis,&#010;    fci.codigoconvocacao,&#010;    fci.dataconvocacao,&#010;    fci.horaconvocacao,&#010;    fci.datapagamento,&#010;    fci.datasituacao,&#010;    fci.horasituacao,&#010;    fci.status,&#010;    fci.indicativolocal,&#010;    fci.situacao,&#010;    sal.codigoestrutsal,&#010;    sal.codigomotivo,&#010;    sal.tiposalario,&#010;    sal.valorsal,&#010;    sal.complsal,&#010;    sal.antecsal,&#010;    sal.salcarne,&#010;    sal.descrsal,&#010;    sal.seq,&#010;    sal.dataefeito,&#010;    fd.mestaxaassistencial,&#010;    fd.descanoadmissao,&#010;    fad.jaexposto,&#010;    fad.agentenocivo,&#010;    fl.codigoestab,&#010;    fl.tipoadmcaged,&#010;    fs.codigoseguro,&#010;    fs.codigoseguro AS codigoseguroprop,&#010;    fl.tipoadm,&#010;    ctb.localctbrateio,&#010;    ctb.codigolocalctb,&#010;    fl.datahoracadast,&#010;    mae.nomedepend AS mae,&#010;    pai.nomedepend AS pai,&#010;    fad.percinsalub,&#010;    fad.percpericul,&#010;    fe.tempoparcial,&#010;    fl.fichareg,&#010;    fl.tipoadmrais,&#010;    fl.indicatadm,&#010;    fl.numeroprocesso,&#010;    fe.regimejor,&#010;    es.codigotipolograd AS codigotipologradlocal,&#010;    fci.logradouro,&#010;    fci.numero,&#010;    fci.complemento,&#010;    fci.bairro,&#010;    fci.cep,&#010;    fci.siglaestado AS siglaestadolocal,&#010;    fci.codigomunic AS codigomuniclocal,&#010;    fl.livroreg,&#010;    fl.folhalivroreg,&#010;    fs.numeroapolice,&#010;    fs.datavalidade,&#010;    fs.datavalidade AS datavalidadeprop,&#010;    fs.numeroapolice AS numeroapoliceprop,&#010;    fp.casadobr,&#010;    fp.filhosbr,&#010;    fc.indnumeroidentfiscal,&#010;    fp.defcota,&#010;    fc.empcontrataprendiz,&#010;    fc.codigocursoform,&#010;    fc.naturezaestagio,&#010;    fc.nivelestagio,&#010;    fc.numeroidentfiscal,&#010;    fc.esocialsituacao,&#010;    fc.instituicaoensino,&#010;    fc.agenteintegracao,&#010;    fc.codigosupervisorestagio,&#010;    fc.areaatuacao,&#010;    fc.categesocial,&#010;    fc.codigotipofato,&#010;    fc.antecipdecimoterceiroeferias,&#010;    fc.tpinclcontr,&#010;    fc.justcontr,&#010;    fc.clausulaassegresc,&#010;    fp.ufcnh,&#010;    fc.recebsegurodesemprego,&#010;    fc.cnpjorigem,&#010;    fc.cnpjcednt,&#010;    fc.categorig,&#010;    fc.categorigcedido,&#010;    fc.matricced,&#010;    fc.dtadmced,&#010;    fc.infonus,&#010;    fc.dataadmorig,&#010;    fc.matricorig,&#010;    fc.codigoempresasubst,&#010;    fp.numerocns,&#010;    fp.primhabcnh,&#010;    fp.nomesocial,&#010;    fc.codigoempcontrataaprendiz,&#010;    fp.observ,&#010;    es.tipoalteracaoesocial,&#010;    fc.justprorrog,&#010;    fc.codigoesocialtransacao,&#010;    fc.ordemcalculo,&#010;    fc.enviouprorrogesocial,&#010;    fc.matriculaesocial,&#010;    NULL::date AS datasolicitacaoaso,&#010;    fp.tmpresid,&#010;    fc.tpinscr,&#010;    0 AS cadastratreicap&#010;   FROM (((((((((((((((((((((((((((((((funccontrato fc&#010;     JOIN funcpessoa fp ON ((fc.codigofuncpessoa = fp.codigofuncpessoa)))&#010;     LEFT JOIN ( SELECT fd_1.codigoempresa,&#010;            fd_1.codigofunccontr,&#010;            max(fd_1.datainicial) AS datainicial&#010;           FROM funcsindicato fd_1&#010;          GROUP BY fd_1.codigoempresa, fd_1.codigofunccontr) fsd ON (((fsd.codigoempresa = fc.codigoempresa) AND (fsd.codigofunccontr = fc.codigofunccontr))))&#010;     LEFT JOIN funcpix fpix ON (((fpix.codigoempresa = fc.codigoempresa) AND (fpix.codigofunccontr = fc.codigofunccontr))))&#010;     LEFT JOIN funcsindicato fd ON (((fd.codigoempresa = fc.codigoempresa) AND (fd.codigofunccontr = fc.codigofunccontr) AND (fd.datainicial = fsd.datainicial))))&#010;     LEFT JOIN ( SELECT ftd_1.codigoempresa,&#010;            ftd_1.codigofunccontr,&#010;            max(ftd_1.datainicial) AS datainicial&#010;           FROM funcctps ftd_1&#010;          GROUP BY ftd_1.codigoempresa, ftd_1.codigofunccontr) fctd ON (((fctd.codigoempresa = fc.codigoempresa) AND (fctd.codigofunccontr = fc.codigofunccontr))))&#010;     LEFT JOIN funcctps ftd ON (((ftd.codigoempresa = fc.codigoempresa) AND (ftd.codigofunccontr = fc.codigofunccontr) AND (ftd.datainicial = fctd.datainicial))))&#010;     LEFT JOIN ( SELECT fevt.codigoempresa,&#010;            fevt.codigofunccontr,&#010;            max(fevt.datainicial) AS datainicial&#010;           FROM funcescalavaletransp fevt&#010;          GROUP BY fevt.codigoempresa, fevt.codigofunccontr) vthm ON (((vthm.codigoempresa = fc.codigoempresa) AND (vthm.codigofunccontr = fc.codigofunccontr))))&#010;     LEFT JOIN funcescalavaletransp vth ON (((vth.codigoempresa = vthm.codigoempresa) AND (vth.codigofunccontr = vthm.codigofunccontr) AND (vth.datainicial = vthm.datainicial))))&#010;     LEFT JOIN ( SELECT fev.codigoempresa,&#010;            fev.codigofunccontr,&#010;            max(fev.datainicial) AS datainicial&#010;           FROM funcescalavalerefeicao fev&#010;          GROUP BY fev.codigoempresa, fev.codigofunccontr) fevm ON (((fevm.codigoempresa = fc.codigoempresa) AND (fevm.codigofunccontr = fc.codigofunccontr))))&#010;     LEFT JOIN funcescalavalerefeicao fvr ON (((fvr.codigoempresa = fc.codigoempresa) AND (fvr.codigofunccontr = fc.codigofunccontr) AND (fvr.datainicial = fevm.datainicial))))&#010;     LEFT JOIN tipologradouro tl ON ((fp.codigotipolograd = tl.codigotipolograd)))&#010;     LEFT JOIN orgaoemissor oerg ON ((fp.codigoorgaoemissorrg = oerg.codigoorgaoemissor)))&#010;     LEFT JOIN orgaoemissor oecnh ON ((fp.codigoorgaoemissorcnh = oecnh.codigoorgaoemissor)))&#010;     LEFT JOIN orgaoemissor oepass ON ((fp.codigoorgaoemissorpasport = oepass.codigoorgaoemissor)))&#010;     LEFT JOIN orgaoemissor oeric ON ((fp.codigoorgaoemissorric = oeric.codigoorgaoemissor)))&#010;     LEFT JOIN orgaoemissor oerne ON ((fp.codigoorgaoemissorrne = oerne.codigoorgaoemissor)))&#010;     LEFT JOIN ( SELECT m.codigoempresa,&#010;            m.codigofunccontr,&#010;            max(m.datainicial) AS datainicial&#010;           FROM funcsalario m&#010;          GROUP BY m.codigoempresa, m.codigofunccontr) fsm ON (((fsm.codigoempresa = fc.codigoempresa) AND (fsm.codigofunccontr = fc.codigofunccontr))))&#010;     LEFT JOIN funcsalario sal ON (((sal.codigoempresa = fc.codigoempresa) AND (sal.codigofunccontr = fc.codigofunccontr) AND (sal.datainicial = fsm.datainicial) AND (EXISTS ( SELECT max(fub.seq) AS max&#010;           FROM funcsalario fub&#010;          WHERE ((fub.datainicial = sal.datainicial) AND (fub.codigoempresa = sal.codigoempresa) AND (fub.codigofunccontr = sal.codigofunccontr))&#010;         HAVING (max(fub.seq) = sal.seq))))))&#010;     LEFT JOIN funclocal fl ON (((fl.codigoempresa = fc.codigoempresa) AND (fl.codigofunccontr = fc.codigofunccontr) AND (EXISTS ( SELECT max(fls.datatransf) AS max&#010;           FROM funclocal fls&#010;          WHERE ((fls.codigoempresa = fl.codigoempresa) AND (fls.codigofunccontr = fl.codigofunccontr))&#010;         HAVING (max(fls.datatransf) = fl.datatransf))))))&#010;     LEFT JOIN estab es ON (((es.codigoempresa = fl.codigoempresa) AND (es.codigoestab = fl.codigoestab))))&#010;     LEFT JOIN funccargo fg ON (((fg.codigoempresa = fc.codigoempresa) AND (fg.codigofunccontr = fc.codigofunccontr) AND (EXISTS ( SELECT max(fgs.datainicial) AS max&#010;           FROM funccargo fgs&#010;          WHERE ((fgs.codigoempresa = fg.codigoempresa) AND (fgs.codigofunccontr = fg.codigofunccontr))&#010;         HAVING (max(fgs.datainicial) = fg.datainicial))))))&#010;     LEFT JOIN funcescala fe ON (((fe.codigoempresa = fc.codigoempresa) AND (fe.codigofunccontr = fc.codigofunccontr) AND (EXISTS ( SELECT max(fes_1.datainicial) AS max&#010;           FROM funcescala fes_1&#010;          WHERE ((fes_1.codigoempresa = fc.codigoempresa) AND (fes_1.codigofunccontr = fc.codigofunccontr))&#010;         HAVING (max(fes_1.datainicial) = fe.datainicial))))))&#010;     LEFT JOIN funcestabil fes ON (((fes.codigoempresa = fc.codigoempresa) AND (fes.codigofunccontr = fc.codigofunccontr) AND (EXISTS ( SELECT max(fess.datainicial) AS max&#010;           FROM funcestabil fess&#010;          WHERE ((fess.codigoempresa = fc.codigoempresa) AND (fess.codigofunccontr = fc.codigofunccontr))&#010;         HAVING (max(fess.datainicial) = fes.datainicial))))))&#010;     LEFT JOIN funcqualif fq ON (((fq.codigoempresa = fc.codigoempresa) AND (fq.codigofunccontr = fc.codigofunccontr) AND (EXISTS ( SELECT max(fqs.datainicial) AS max&#010;           FROM funcqualif fqs&#010;          WHERE ((fqs.codigoempresa = fc.codigoempresa) AND (fqs.codigofunccontr = fc.codigofunccontr))&#010;         HAVING (max(fqs.datainicial) = fq.datainicial))))))&#010;     LEFT JOIN funccontrintermitente fci ON (((fci.codigoempresa = fc.codigoempresa) AND (fci.codigofunccontr = fc.codigofunccontr) AND (EXISTS ( SELECT max(fcis.dataconvocacao) AS max&#010;           FROM funccontrintermitente fcis&#010;          WHERE ((fcis.codigoempresa = fc.codigoempresa) AND (fcis.codigofunccontr = fc.codigofunccontr))&#010;         HAVING (max(fcis.dataconvocacao) = fci.dataconvocacao))))))&#010;     LEFT JOIN funcadicional fad ON (((fad.codigoempresa = fc.codigoempresa) AND (fad.codigofunccontr = fc.codigofunccontr) AND (EXISTS ( SELECT max(fads.datainicial) AS max&#010;           FROM funcadicional fads&#010;          WHERE ((fads.codigoempresa = fc.codigoempresa) AND (fads.codigofunccontr = fc.codigofunccontr))&#010;         HAVING (max(fads.datainicial) = fad.datainicial))))))&#010;     LEFT JOIN funcseguro fs ON (((fs.codigoempresa = fc.codigoempresa) AND (fs.codigofunccontr = fc.codigofunccontr) AND (EXISTS ( SELECT max(fss.datainicial) AS max&#010;           FROM funcseguro fss&#010;          WHERE ((fss.codigoempresa = fc.codigoempresa) AND (fss.codigofunccontr = fc.codigofunccontr))&#010;         HAVING (max(fss.datainicial) = fs.datainicial))))))&#010;     LEFT JOIN ( SELECT m.codigoempresa,&#010;            m.codigofunccontr,&#010;            max(m.dataopcao) AS dataopcao&#010;           FROM funclocalctb m&#010;          GROUP BY m.codigoempresa, m.codigofunccontr) ctbmaior ON (((ctbmaior.codigoempresa = fc.codigoempresa) AND (ctbmaior.codigofunccontr = fc.codigofunccontr))))&#010;     LEFT JOIN funclocalctb ctb ON (((ctb.codigoempresa = fc.codigoempresa) AND (ctb.codigofunccontr = fc.codigofunccontr) AND (ctb.dataopcao = ctbmaior.dataopcao))))&#010;     LEFT JOIN dependente pai ON (((pai.codigoempresa = fc.codigoempresa) AND (pai.codigofunccontr = fc.codigofunccontr) AND ((pai.parentesco)::text = &apos;03&apos;::text) AND (pai.sexo = 1))))&#010;     LEFT JOIN dependente mae ON (((mae.codigoempresa = fc.codigoempresa) AND (mae.codigofunccontr = fc.codigofunccontr) AND ((mae.parentesco)::text = &apos;03&apos;::text) AND (mae.sexo = 2))));"/>
<ROW vie_key="funcionarioretificacao" fonte=" SELECT fc.codigoempresa,&#010;    fc.codigofunccontr,&#010;    fc.codigofuncpessoa,&#010;    fc.dataadm,&#010;    fp.nomefunc,&#010;    fp.cpffunc,&#010;    fp.datanasc,&#010;    fp.pisfunc,&#010;    fp.datacadpis,&#010;    fp.nomesocial,&#010;    fp.apelidofunc,&#010;    fp.fotofunc,&#010;    fc.datadem&#010;   FROM (funccontrato fc&#010;     JOIN funcpessoa fp ON ((fp.codigofuncpessoa = fc.codigofuncpessoa)));"/>
<ROW vie_key="loterescisao" fonte=" SELECT a.codigoempresa,&#010;    af.codigofunccontr,&#010;    a.loteavprevresccolet AS lote,&#010;    a.datacadastro,&#010;    a.origem,&#010;    a.estado AS tiporescisao,&#010;    a.dataresc,&#010;    a.datapgtoresc&#010;   FROM (avisoprevresccolet a&#010;     JOIN avisoprevresccoletfunc af ON (((a.codigoempresa = af.codigoempresa) AND (a.loteavprevresccolet = af.loteavprevresccolet))));"/>
<ROW vie_key="patbemdocumentofiscalcomp" fonte=" SELECT pbd.codigobem,&#010;    doc.codigodocumentofiscal,&#010;    doc.codigopessoa,&#010;    doc.numeronf,&#010;    doc.especienf,&#010;    doc.serienf,&#010;    doc.subserienf,&#010;    doc.datalcto,&#010;    doc.valorcontabil,&#010;    doc.emitentenf,&#010;    doc.cdmodelo,&#010;    doc.chavenfe,&#010;    pbd.tipodocumento&#010;   FROM (lctodocumentofiscal doc&#010;     JOIN patbemdocumentofiscal pbd ON ((pbd.codigodocumentofiscal = doc.codigodocumentofiscal)))&#010;  ORDER BY pbd.codigobem, doc.codigodocumentofiscal;"/>
<ROW vie_key="planoespecimob" fonte=" SELECT planoespec.codigoempresa,&#010;    planoespec.contactb&#010;   FROM planoespec&#010;  WHERE (planoespec.contaimob = &apos;1&apos;::bpchar)&#010;  ORDER BY planoespec.codigoempresa, planoespec.contactb;"/>
<ROW vie_key="vendereco" fonte=" SELECT t1.codigoendereco,&#010;    t5.codigomunicipio,&#010;    (((t2.dstipologradoro)::text || &apos; &apos;::text) || (t3.nomelogradoro)::text) AS endereco1,&#010;    (((((t4.nomebairro)::text || &apos; - &apos;::text) || (t5.nomemunic)::text) || &apos; - &apos;::text) || (t5.siglaestado)::text) AS endereco2,&#010;    t1.cep,&#010;    t1.complemento,&#010;    t2.dstipologradoro,&#010;    t3.nomelogradoro,&#010;    t1.codigobairro,&#010;    t4.nomebairro,&#010;    t5.nomemunic,&#010;    t5.siglaestado&#010;   FROM ((((endereco t1&#010;     JOIN tipologradoro t2 ON ((t2.codigotipologradoro = t1.codigotipologradoro)))&#010;     JOIN logradoro t3 ON ((t3.codigologradoro = t1.codigologradoro)))&#010;     JOIN bairro t4 ON ((t4.codigobairro = t1.codigobairro)))&#010;     JOIN municipio t5 ON ((t5.codigomunicipio = t1.codigomunicipio)))&#010;  ORDER BY t1.codigoendereco;"/>
<ROW vie_key="vestabhistorico" fonte=" SELECT e.codigoempresa,&#010;    e.codigoestab,&#010;    e.nomeestab,&#010;        CASE&#010;            WHEN (eh.nomeestabcompleto IS NULL) THEN e.nomeestabcompleto&#010;            ELSE eh.nomeestabcompleto&#010;        END AS nomeestabcompleto,&#010;        CASE&#010;            WHEN (eh.nomefantasia IS NULL) THEN e.nomefantasia&#010;            ELSE eh.nomefantasia&#010;        END AS nomefantasia,&#010;    e.apelidoestab,&#010;        CASE&#010;            WHEN (eh.codigotipolograd IS NULL) THEN e.codigotipolograd&#010;            ELSE eh.codigotipolograd&#010;        END AS codigotipolograd,&#010;        CASE&#010;            WHEN (eh.codigotipolograd IS NULL) THEN tle.descrtipolograd&#010;            ELSE tleh.descrtipolograd&#010;        END AS descrtipolograd,&#010;        CASE&#010;            WHEN (eh.enderecoestab IS NULL) THEN e.enderecoestab&#010;            ELSE eh.enderecoestab&#010;        END AS enderecoestab,&#010;        CASE&#010;            WHEN (eh.numenderestab IS NULL) THEN e.numenderestab&#010;            ELSE eh.numenderestab&#010;        END AS numenderestab,&#010;        CASE&#010;            WHEN (eh.complenderestab IS NULL) THEN e.complenderestab&#010;            ELSE eh.complenderestab&#010;        END AS complenderestab,&#010;        CASE&#010;            WHEN (eh.bairroenderestab IS NULL) THEN e.bairroenderestab&#010;            ELSE eh.bairroenderestab&#010;        END AS bairroenderestab,&#010;    e.dataalterender,&#010;        CASE&#010;            WHEN (eh.siglaestado IS NULL) THEN e.siglaestado&#010;            ELSE eh.siglaestado&#010;        END AS siglaestado,&#010;        CASE&#010;            WHEN (eh.codigomunic IS NULL) THEN e.codigomunic&#010;            ELSE eh.codigomunic&#010;        END AS codigomunic,&#010;        CASE&#010;            WHEN (eh.cependerestab IS NULL) THEN e.cependerestab&#010;            ELSE eh.cependerestab&#010;        END AS cependerestab,&#010;    e.dddfone,&#010;    e.numerofone,&#010;    e.dddfax,&#010;    e.numerofax,&#010;    e.caixapostal,&#010;    e.siglaestadocxp,&#010;    e.cepcaixapostal,&#010;    e.email,&#010;    e.paginainternet,&#010;    e.datainicioativ,&#010;    e.dataencerativ,&#010;    e.sociedadecontaparticipacao,&#010;    e.inscricaoscp,&#010;        CASE&#010;            WHEN (eh.tipoinscr IS NULL) THEN e.tipoinscr&#010;            ELSE eh.tipoinscr&#010;        END AS tipoinscr,&#010;        CASE&#010;            WHEN (eh.inscrfederal IS NULL) THEN e.inscrfederal&#010;            ELSE eh.inscrfederal&#010;        END AS inscrfederal,&#010;    e.suframa,&#010;    e.codigonaturjurid,&#010;        CASE&#010;            WHEN (eh.codigoativfederal IS NULL) THEN e.codigoativfederal&#010;            ELSE eh.codigoativfederal&#010;        END AS codigoativfederal,&#010;        CASE&#010;            WHEN (eh.descrativfedestab IS NULL) THEN e.descrativfedestab&#010;            ELSE eh.descrativfedestab&#010;        END AS descrativfedestab,&#010;    e.dataalterativfed,&#010;    e.tiporegist,&#010;        CASE&#010;            WHEN (eh.numeroregist IS NULL) THEN e.numeroregist&#010;            ELSE eh.numeroregist&#010;        END AS numeroregist,&#010;    e.dataregist,&#010;    e.observregist,&#010;        CASE&#010;            WHEN (eh.inscrestad IS NULL) THEN e.inscrestad&#010;            ELSE eh.inscrestad&#010;        END AS inscrestad,&#010;        CASE&#010;            WHEN (eh.codigoativestad IS NULL) THEN e.codigoativestad&#010;            ELSE eh.codigoativestad&#010;        END AS codigoativestad,&#010;        CASE&#010;            WHEN (eh.descrativestestab IS NULL) THEN e.descrativestestab&#010;            ELSE eh.descrativestestab&#010;        END AS descrativestestab,&#010;    e.inscrmunic,&#010;        CASE&#010;            WHEN (eh.codigoativmunic IS NULL) THEN e.codigoativmunic&#010;            ELSE eh.codigoativmunic&#010;        END AS codigoativmunic,&#010;    e.inscrimobiliaria,&#010;    e.especieestab,&#010;    e.inscrbancocentral,&#010;    e.inscrsusep,&#010;        CASE&#010;            WHEN (eh.descrativmunestab IS NULL) THEN e.descrativmunestab&#010;            ELSE eh.descrativmunestab&#010;        END AS descrativmunestab,&#010;    e.porteempresa,&#010;    e.inscrcvm,&#010;    e.codigotabferiado,&#010;    e.valornominalcotas,&#010;    e.caepf,&#010;    e.nomeauditor,&#010;    e.cvmauditor,&#010;    e.capitalsocial,&#010;    eh.datahistorico&#010;   FROM (((estab e&#010;     JOIN estabhistorico eh ON (((eh.codigoempresa = e.codigoempresa) AND (eh.codigoestab = e.codigoestab))))&#010;     LEFT JOIN tipologradouro tle ON ((tle.codigotipolograd = e.codigotipolograd)))&#010;     LEFT JOIN tipologradouro tleh ON ((tleh.codigotipolograd = eh.codigotipolograd)));"/>
<ROW vie_key="vestabhistoricoatual" fonte=" SELECT e.codigoempresa,&#010;    e.codigoestab,&#010;    e.nomeestab,&#010;        CASE&#010;            WHEN (eh.nomeestabcompleto IS NULL) THEN e.nomeestabcompleto&#010;            ELSE eh.nomeestabcompleto&#010;        END AS nomeestabcompleto,&#010;        CASE&#010;            WHEN (eh.nomefantasia IS NULL) THEN e.nomefantasia&#010;            ELSE eh.nomefantasia&#010;        END AS nomefantasia,&#010;    e.apelidoestab,&#010;        CASE&#010;            WHEN (eh.codigotipolograd IS NULL) THEN e.codigotipolograd&#010;            ELSE eh.codigotipolograd&#010;        END AS codigotipolograd,&#010;        CASE&#010;            WHEN (eh.codigotipolograd IS NULL) THEN tle.descrtipolograd&#010;            ELSE tleh.descrtipolograd&#010;        END AS descrtipolograd,&#010;        CASE&#010;            WHEN (eh.enderecoestab IS NULL) THEN e.enderecoestab&#010;            ELSE eh.enderecoestab&#010;        END AS enderecoestab,&#010;        CASE&#010;            WHEN (eh.numenderestab IS NULL) THEN e.numenderestab&#010;            ELSE eh.numenderestab&#010;        END AS numenderestab,&#010;        CASE&#010;            WHEN (eh.complenderestab IS NULL) THEN e.complenderestab&#010;            ELSE eh.complenderestab&#010;        END AS complenderestab,&#010;        CASE&#010;            WHEN (eh.bairroenderestab IS NULL) THEN e.bairroenderestab&#010;            ELSE eh.bairroenderestab&#010;        END AS bairroenderestab,&#010;    e.dataalterender,&#010;        CASE&#010;            WHEN (eh.siglaestado IS NULL) THEN e.siglaestado&#010;            ELSE eh.siglaestado&#010;        END AS siglaestado,&#010;        CASE&#010;            WHEN (eh.codigomunic IS NULL) THEN e.codigomunic&#010;            ELSE eh.codigomunic&#010;        END AS codigomunic,&#010;        CASE&#010;            WHEN (eh.cependerestab IS NULL) THEN e.cependerestab&#010;            ELSE eh.cependerestab&#010;        END AS cependerestab,&#010;    e.dddfone,&#010;    e.numerofone,&#010;    e.dddfax,&#010;    e.numerofax,&#010;    e.caixapostal,&#010;    e.siglaestadocxp,&#010;    e.cepcaixapostal,&#010;    e.email,&#010;    e.paginainternet,&#010;    e.datainicioativ,&#010;    e.dataencerativ,&#010;    e.sociedadecontaparticipacao,&#010;    e.inscricaoscp,&#010;        CASE&#010;            WHEN (eh.tipoinscr IS NULL) THEN e.tipoinscr&#010;            ELSE eh.tipoinscr&#010;        END AS tipoinscr,&#010;        CASE&#010;            WHEN (eh.inscrfederal IS NULL) THEN e.inscrfederal&#010;            ELSE eh.inscrfederal&#010;        END AS inscrfederal,&#010;    e.suframa,&#010;    e.codigonaturjurid,&#010;        CASE&#010;            WHEN (eh.codigoativfederal IS NULL) THEN e.codigoativfederal&#010;            ELSE eh.codigoativfederal&#010;        END AS codigoativfederal,&#010;        CASE&#010;            WHEN (eh.descrativfedestab IS NULL) THEN e.descrativfedestab&#010;            ELSE eh.descrativfedestab&#010;        END AS descrativfedestab,&#010;    e.dataalterativfed,&#010;    e.tiporegist,&#010;        CASE&#010;            WHEN (eh.numeroregist IS NULL) THEN e.numeroregist&#010;            ELSE eh.numeroregist&#010;        END AS numeroregist,&#010;    e.dataregist,&#010;    e.observregist,&#010;        CASE&#010;            WHEN (eh.inscrestad IS NULL) THEN e.inscrestad&#010;            ELSE eh.inscrestad&#010;        END AS inscrestad,&#010;        CASE&#010;            WHEN (eh.codigoativestad IS NULL) THEN e.codigoativestad&#010;            ELSE eh.codigoativestad&#010;        END AS codigoativestad,&#010;        CASE&#010;            WHEN (eh.descrativestestab IS NULL) THEN e.descrativestestab&#010;            ELSE eh.descrativestestab&#010;        END AS descrativestestab,&#010;    e.inscrmunic,&#010;        CASE&#010;            WHEN (eh.codigoativmunic IS NULL) THEN e.codigoativmunic&#010;            ELSE eh.codigoativmunic&#010;        END AS codigoativmunic,&#010;    e.inscrimobiliaria,&#010;    e.especieestab,&#010;    e.inscrbancocentral,&#010;    e.inscrsusep,&#010;        CASE&#010;            WHEN (eh.descrativmunestab IS NULL) THEN e.descrativmunestab&#010;            ELSE eh.descrativmunestab&#010;        END AS descrativmunestab,&#010;    e.porteempresa,&#010;    e.inscrcvm,&#010;    e.codigotabferiado,&#010;    e.valornominalcotas,&#010;    e.caepf,&#010;    e.nomeauditor,&#010;    e.cvmauditor,&#010;    e.capitalsocial,&#010;    eh.datahistorico&#010;   FROM (((estab e&#010;     JOIN estabhistorico eh ON (((eh.codigoempresa = e.codigoempresa) AND (eh.codigoestab = e.codigoestab))))&#010;     LEFT JOIN tipologradouro tle ON ((tle.codigotipolograd = e.codigotipolograd)))&#010;     LEFT JOIN tipologradouro tleh ON ((tleh.codigotipolograd = eh.codigotipolograd)))&#010;  WHERE (eh.datahistorico = ( SELECT max(eh2.datahistorico) AS max&#010;           FROM estabhistorico eh2&#010;          WHERE ((eh2.codigoempresa = eh.codigoempresa) AND (eh2.codigoestab = eh.codigoestab) AND (eh2.datahistorico &lt;= CURRENT_DATE))));"/>
<ROW vie_key="vwfuncplanosaudedespesadet" fonte=" SELECT t_t.codigoempresa,&#010;    t_t.codigooutemp,&#010;    t_t.codigofunccontr,&#010;    t_t.compet,&#010;    t_t.seq,&#010;    NULL::integer AS codigodepend,&#010;    &apos;T&apos;::text AS tipo,&#010;    fp.nomefunc AS nomedepend,&#010;    fps.datainicial,&#010;    fps.datafinal,&#010;    fps.valor,&#010;    fps.valorbenfemp&#010;   FROM ((((funcplanosaudedespesa t_t&#010;     JOIN funcplanosaude fps ON (((t_t.codigoempresa = fps.codigoempresa) AND (t_t.codigofunccontr = fps.codigofunccontr) AND (t_t.codigooutemp = fps.codigooutemp) AND (t_t.datainicial = fps.datainicial))))&#010;     JOIN funccontrato fc ON (((fc.codigoempresa = fps.codigoempresa) AND (fc.codigofunccontr = fps.codigofunccontr))))&#010;     JOIN funcpessoa fp ON ((fp.codigofuncpessoa = fc.codigofuncpessoa)))&#010;     JOIN outraempresa oe ON ((oe.codigooutemp = fps.codigooutemp)))&#010;  WHERE (fps.datainicial = ( SELECT max(ps1.datainicial) AS max&#010;           FROM funcplanosaude ps1&#010;          WHERE ((ps1.codigoempresa = fps.codigoempresa) AND (ps1.codigofunccontr = fps.codigofunccontr) AND (ps1.codigooutemp = fps.codigooutemp) AND (ps1.datainicial &lt;= ((to_char((t_t.compet)::timestamp with time zone, &apos;YYYY-MM-01&apos;::text))::date + (&apos;1 mon&apos;::interval - &apos;1 day&apos;::interval))))))&#010;UNION ALL&#010; SELECT t_t.codigoempresa,&#010;    t_t.codigooutemp,&#010;    t_t.codigofunccontr,&#010;    t_t.compet,&#010;    t_t.seq,&#010;    psd.codigodepend,&#010;    &apos;D&apos;::text AS tipo,&#010;    d.nomedepend,&#010;    ps.datainicial,&#010;    ps.datafinal,&#010;    psd.valor,&#010;    psd.valorbenfemp&#010;   FROM (((((funcplanosaudedespesa t_t&#010;     JOIN funcplanosaude ps ON (((t_t.codigoempresa = ps.codigoempresa) AND (t_t.codigofunccontr = ps.codigofunccontr) AND (t_t.codigooutemp = ps.codigooutemp) AND (t_t.datainicial = ps.datainicial))))&#010;     JOIN funcplanosaudedepend psd ON (((ps.codigoempresa = psd.codigoempresa) AND (ps.codigofunccontr = psd.codigofunccontr) AND (ps.codigooutemp = psd.codigooutemp) AND (ps.datainicial = psd.datainicial))))&#010;     JOIN funccontrato fp ON (((fp.codigoempresa = ps.codigoempresa) AND (fp.codigofunccontr = ps.codigofunccontr))))&#010;     JOIN outraempresa oe ON ((oe.codigooutemp = ps.codigooutemp)))&#010;     JOIN dependente d ON (((d.codigoempresa = ps.codigoempresa) AND (d.codigofunccontr = ps.codigofunccontr) AND (d.codigodepend = psd.codigodepend))))&#010;  WHERE (ps.datainicial = ( SELECT max(ps1.datainicial) AS max&#010;           FROM funcplanosaude ps1&#010;          WHERE ((ps1.codigoempresa = ps.codigoempresa) AND (ps1.codigofunccontr = ps.codigofunccontr) AND (ps1.codigooutemp = ps.codigooutemp) AND (ps1.datainicial &lt;= ((to_char((t_t.compet)::timestamp with time zone, &apos;YYYY-MM-01&apos;::text))::date + (&apos;1 mon&apos;::interval - &apos;1 day&apos;::interval))))));"/>
<ROW vie_key="vwgrupoempresa" fonte=" SELECT t_t.codigogrupoproc,&#010;    t_t.codigoempresaproc,&#010;    t_t.codigoempresaproc AS codigoempresa&#010;   FROM grupoempresa t_t;"/>
</ROWDATA>
</DATAPACKET>
