$dDataValidacao = $datavalidacao; $sSql = "select '{$dDataValidacao}'::date - '{$ano}-{$mes1}-{$dia}'::date as datavalida"; $rsValida = db_query($sSql); db_fieldsmemory($rsValida, 0); if ($datavalida > 0) { $lReemitirCertidao = true; } } } /** * Só deve permitir a reemisão caso a data seja valida */ if ($lReemitirCertidao && isset($iOidCertidao) && $iOidCertidao != 0 && $p50_web == 't') { db_inicio_transacao(); $sArquivo = "tmp/certidao_" . $p50_sequencial . '.pdf'; $lReemitiuArquivo = DBLargeObject::leitura($iOidCertidao, $sArquivo); db_fim_transacao(); if ($lReemitiuArquivo) { db_redireciona($sArquivo); exit; } } $sqlvenc = "select '{$ano}-{$mes1}-{$dia}'::date + '{$k03_diasvalidadecertidao} days'::interval as datavenc"; $resultvenc = db_query($sqlvenc) or die($sqlvenc); db_fieldsmemory($resultvenc, 0); $venc = $datavenc; $dia2 = substr($venc, 8, 2); $mes2 = substr($venc, 5, 2); $ano2 = substr($venc, 0, 4); $venc = $ano2 . "-" . $mes2 . "-" . $dia2; $sequencia = db_query("select nextval('db_certidaoweb_codcert_seq')") or die("erro ao gerar sequencia");
function Header() { //#00#//header //#10#//Este método é usado gerar o cabeçalho da página. É chamado automaticamente por |addPage| e não //#10#//deve ser chamado diretamente pela aplicação. A implementação em FPDF está vazia, então você //#10#//precisa criar uma subclasse dele para sobrepor o método se você quiser um processamento //#10#//específico para o cabeçalho. //#15#//header() //#99#//Exemplo: //#99#//class PDF extends FPDF //#99#//{ //#99#// function Header() //#99#// { //#99#// Seleciona fonte Arial bold 15 //#99#// $this->SetFont('Arial','B',15); //#99#// Move para a direita //#99#// $this->Cell(80); //#99#// Titulo dentro de uma caixa //#99#// $this->Cell(30,10,'Title',1,0,'C'); //#99#// Quebra de linha //#99#// $this->Ln(20); //#99#// } //#99#//} global $conn; global $result; global $url; /** * Dados da instituição */ $dados = db_query($conn, "select nomeinst,\n trim(ender)||','||trim(cast(numero as text)) as ender,\n munic,\n uf,\n telef,\n email,\n url,\n logo\n from db_config\n where codigo = " . db_getsession("DB_instit")); $url = @pg_result($dados, 0, "url"); $this->SetXY(1, 1); /** * Verifica se existe o logotipo informado no diretorio, caso nao encontre exporta do banco via oid */ $sImagemLogo = pg_result($dados, 0, "logo"); if (!file_exists("imagens/files/{$sImagemLogo}")) { require_once 'classes/db_db_configarquivos_classe.php'; require_once 'std/DBLargeObject.php'; $iInstituicao = db_getsession("DB_instit"); $sWhere = "db38_instit = {$iInstituicao} and db38_tipo = 1"; /** * Busca o Oid do arquivo na db_configarquivos pelo db38_tipo = 1 -> logo */ $oDaoDBConfigarquivos = new cl_db_configarquivos(); $sSqlOidLogo = $oDaoDBConfigarquivos->sql_query(null, "db38_arquivo", null, $sWhere); $rsDBConfigarquivos = $oDaoDBConfigarquivos->sql_record($sSqlOidLogo); if ($rsDBConfigarquivos) { $iOidLogo = db_utils::fieldsMemory($rsDBConfigarquivos, 0)->db38_arquivo; db_query('begin'); DBLargeObject::leitura($iOidLogo, "imagens/files/{$sImagemLogo}"); db_query('end'); } } $this->Image('imagens/files/' . pg_result($dados, 0, "logo"), 7, 3, 20); $nome = pg_result($dados, 0, "nomeinst"); global $nomeinst; $nomeinst = pg_result($dados, 0, "nomeinst"); $TamFonteNome = 9; if (strlen($nome) > 42) { $TamFonteNome = 8; } $this->SetFont('Arial', 'BI', $TamFonteNome); $this->Text(33, 9, $nome); $this->SetFont('Arial', 'I', 8); $this->Text(33, 14, trim(pg_result($dados, 0, "ender"))); $this->Text(33, 18, trim(pg_result($dados, 0, "munic")) . " - " . pg_result($dados, 0, "uf")); $this->Text(33, 22, trim(pg_result($dados, 0, "telef"))); $this->Text(33, 26, trim(pg_result($dados, 0, "email"))); $comprim = $this->w - $this->rMargin - $this->lMargin; $this->Text(33, 30, $url); $Espaco = $this->w - 80; $this->SetFont('Arial', '', 7); $margemesquerda = $this->lMargin; $this->setleftmargin($Espaco); $this->sety(6); $this->setfillcolor(235); $this->roundedrect($Espaco - 3, 5, 75, 28, 2, 'DF', '123'); $this->line(10, 33, $comprim, 33); $this->setfillcolor(255); $this->multicell(0, 3, @$GLOBALS["head1"], 0, 1, "J", 0); $this->multicell(0, 3, @$GLOBALS["head2"], 0, 1, "J", 0); $this->multicell(0, 3, @$GLOBALS["head3"], 0, 1, "J", 0); $this->multicell(0, 3, @$GLOBALS["head4"], 0, 1, "J", 0); $this->multicell(0, 3, @$GLOBALS["head5"], 0, 1, "J", 0); $this->multicell(0, 3, @$GLOBALS["head6"], 0, 1, "J", 0); $this->multicell(0, 3, @$GLOBALS["head7"], 0, 1, "J", 0); $this->multicell(0, 3, @$GLOBALS["head8"], 0, 1, "J", 0); $this->multicell(0, 3, @$GLOBALS["head9"], 0, 1, "J", 0); $this->setleftmargin($margemesquerda); $this->SetY(35); }