<input type="text" name="mes_vcto" id="mes_vcto" size="2" maxlength="2" value="<?php 
echo date('m');
?>
">
   <input type="text" name="ano_vcto" id="ano_vcto" size="4" maxlength="4" value="<?php 
echo date('Y');
?>
">
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   <input type="button" value="Voltar" onclick="js_voltar();" class="botao">
   <input type="button" name="enviar" id="enviar" value="Emite Recibo" class="botao" onClick="return js_emiterecibo();" disabled >
   <input type='hidden' name='debito' id='debito' value=''>
   <input type="hidden" value="" name="numpres" id ="numpres" size="60">
  </td>
 </tr>
</table>
</center>
<?php 
require_once "classes/db_configdbpref_classe.php";
$clconfigdbpref = new cl_configdbpref();
$rs_agrupadebitos = $clconfigdbpref->sql_record($clconfigdbpref->sql_query_file(db_getsession('DB_instit'), "w13_agrupadebrecibos"));
if ($clconfigdbpref->numrows > 0) {
    db_fieldsmemory($rs_agrupadebitos, 0);
    if ($w13_agrupadebrecibos == 't') {
        ?>
 			<script type="text/javascript">
 				agrupadebrecibos = true;
 			</script>
 		<?php 
    }
}
                 $numpres_temp = "";
                 break;
             } else {
                 $numpres_temp .= "N" . $numpreagrupa . "P" . $numparagrupa;
             }
         }
         if ($numpres_temp != "") {
             $numpre_temp1 .= $numpres_temp;
         }
     }
     foreach ($numprestemp as $value) {
         $numpres .= $value;
     }
     $numpres .= $numpre_temp1;
 }
 $rs_agrupadebitos = $clconfigdbpref->sql_record($clconfigdbpref->sql_query_file($instit, "w13_agrupadebrecibos"));
 if ($clconfigdbpref->numrows > 0) {
     db_fieldsmemory($rs_agrupadebitos, 0);
 } else {
     $w13_agrupadebrecibos = 'f';
 }
 if ($w13_agrupadebrecibos == 't') {
     $dDataVenc = $dt_agrupadebitos;
     $sqlagrupa = "\n          select distinct\n                 arrecad.k00_numpre as numpreagrupa,\n                 arrecad.k00_numpar as numparagrupa\n            from (select {$inner}.*\n                    from {$inner}\n                         inner join arreinstit    on arreinstit.k00_numpre = {$inner}.k00_numpre\n                                                 and arreinstit.k00_instit = " . db_getsession("DB_instit") . "\n                   where {$inner}.{$campoinner}) as {$inner}\n\n                 inner join arrecad  on arrecad.k00_numpre =  {$inner}.k00_numpre\n                                    and arrecad.k00_dtvenc < fc_calculavenci('{$dDataVenc}')\n                 left  join configdbprefarretipo  on w17_arretipo = arrecad.k00_tipo\n                                                 and w17_instit   = " . db_getsession("DB_instit") . "\n           where\n                 case\n                  when w17_sequencial is null then\n                    true\n                  else\n                    arrecad.k00_dtvenc between w17_dtini and w17_dtfim\n                 end";
     $resultagrupa = db_query($sqlagrupa);
     for ($agrupa = 0; $agrupa < pg_numrows($resultagrupa); $agrupa++) {
         db_fieldsmemory($resultagrupa, $agrupa);
         $numpre_testa = "N" . $numpreagrupa . "P" . $numparagrupa;
         if (strpos($numpres, $numpre_testa) === false) {
             $numpres .= "N" . $numpreagrupa . "P" . $numparagrupa;
         }
//$result    = db_query($sqlMenupref);
//$iMenupref = pg_numrows($result);
//
//if ($iMenupref > 0) {
//db_fieldsmemory($result,0);
//}
//
//if($m_publico != 't'){
//  if(!session_is_registered("DB_acesso"))
//    echo"<script>location.href='index.php?".base64_encode('erroscripts=3')."'</script>";
//}
if (isset($outro)) {
    setcookie("cookie_codigo_cgm");
    header("location:certidaoimovel003.php");
}
$rsParametro = $clconfigdbpref->sql_record($clconfigdbpref->sql_query_file($iInstit, "w13_exigecpfcnpjmatricula"));
$oRetorno = db_utils::fieldsMemory($rsParametro, 0);
if ($oRetorno->w13_exigecpfcnpjmatricula == "t") {
    db_mensagem("imovel_cab", "imovel_rod");
} else {
    db_mensagem("certidaomatric_cab", "certidaomatric_rod");
}
$onsubmit = "onsubmit=\"return js_verificaCGCCPF((this.cgc.value==''?'':this.cgc),this.cpf);\"";
?>
<html>
<head>
<title><?php 
echo $w01_titulo;
?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 */
set_time_limit(0);
include "db_conecta.php";
global $configsite;
//die("select * from confsite where w01_cod = $configsite and w01_instit = ".db_getsession("DB_instit"));
$result = db_query("select * from confsite where w01_cod = {$configsite} and w01_instit = " . db_getsession("DB_instit"));
db_fieldsmemory($result, 0);
$result2 = db_query("select\ncodigo    ,\nnomeinst  ,\nender     ,\nmunic     ,\nuf        ,\ntelef     ,\nemail     ,\nident     ,\ntx_banc   ,\nnumbanco  ,\nurl       ,\nlogo      ,\nfigura    ,\ndtcont    ,\ndiario    ,\npref      ,\nvicepref  ,\nfax       ,\ncep       ,\nbairro    ,\ntpropri   ,\nprefeitura,\ntsocios\nfrom db_config where codigo = " . db_getsession('DB_instit'));
db_fieldsmemory($result2, 0);
if (file_exists("classes/db_configdbpref_classe.php")) {
    require_once "classes/db_configdbpref_classe.php";
} else {
    require_once "../classes/db_configdbpref_classe.php";
}
$clconfigdbpref = new cl_configdbpref();
$result3 = $clconfigdbpref->sql_record($clconfigdbpref->sql_query(db_getsession("DB_instit"), "*"));
db_fieldsmemory($result3, 0);
function db_geratexto($texto)
{
    $texto .= "#";
    $txt = split("#", $texto);
    $texto1 = '';
    for ($x = 0; $x < sizeof($txt); $x++) {
        if (substr($txt[$x], 0, 1) == "\$") {
            $txt1 = substr($txt[$x], 1);
            global ${$txt1};
            $texto1 .= ${$txt1};
        } else {
            if (substr($txt[$x], 0, 2) == '\\n') {
                $texto1 .= "\n";
            } else {
    setcookie("cookie_codigo_cgm");
    header("location:digitamatricula.php");
}
require_once "libs/db_conecta.php";
require_once "libs/db_stdlib.php";
require_once "libs/db_sql.php";
require_once "libs/db_utils.php";
require_once "db_funcoes.php";
require_once "classes/db_imobil_classe.php";
require_once "classes/db_iptubase_classe.php";
require_once "classes/db_configdbpref_classe.php";
$climobil = new cl_imobil();
$cliptubase = new cl_iptubase();
$clconfigdbpref = new cl_configdbpref();
parse_str(base64_decode($HTTP_SERVER_VARS["QUERY_STRING"]));
$rsParametro = $clconfigdbpref->sql_record($clconfigdbpref->sql_query_file(db_getsession("DB_instit"), "w13_exigecpfcnpjmatricula"));
$oRetorno = db_utils::fieldsMemory($rsParametro, 0);
if ($oRetorno->w13_exigecpfcnpjmatricula == "t") {
    /*
     * Esta mensagem deve ser alterada diretamente no banco de dados
     * db_confmensagem
     * cod: imovel_cab_cpfcnpj
     */
    $sMensagem = "imovel_cab_cpfcnpj";
} else {
    $sMensagem = "imovel_cab";
}
db_mensagem($sMensagem, "");
$result = db_query(" select distinct m_publico,m_arquivo,m_descricao\n                       from db_menupref\n\t\t\t\t\t\t\t\t\t\t\twhere m_arquivo = 'digitamatricula.php'\n\t\t\t\t\t\t\t\t\t\t\torder by m_descricao ");
db_fieldsmemory($result, 0);
if ($m_publico != 't') {