*  junto com este programa; se nao, escreva para a Free Software     
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA          
 *  02111-1307, USA.                                                  
 *  
 *  Copia da licenca no diretorio licenca/licenca_en.txt 
 *                                licenca/licenca_pt.txt 
 */
error_reporting('** FAVOR FAÇA SEU PEDIDO DE SENHA! **');
include "libs/db_conecta.php";
include "libs/db_stdlib.php";
include "libs/db_utils.php";
include "dbforms/db_funcoes.php";
include "libs/db_sql.php";
$oGet = db_utils::postmemory($_GET);
$sMatric = $oGet->nummatric;
$datanasc = formataDataNasc($oGet->z01_nasc);
$cpf = formataCpf($oGet->z01_cgccpf);
$conf = true;
if ($oGet->chave == 't') {
    if (isset($oGet->sqms) && $oGet->sqms == 't') {
        $sErroUsuario = "t";
        // verifica numcgm
        $sqlCgmUsuario = " select z01_nome,\n\t\t                             z01_numcgm \n\t\t                        from cgm \n\t\t                       where z01_cgccpf = '{$cpf}' ";
        //die($sqlCgmUsuario);
        $queryCgm = pg_query($sqlCgmUsuario);
        $totalCgm = pg_num_rows($queryCgm);
        if ($totalCgm > 0) {
            db_fieldsmemory($queryCgm, 0);
        }
        //verifica se usuário já é cadastrado
        $sqlUsuario = " select login \n                         from db_usuarios \n                        where nome   = '{$z01_nome}' \n                          and login  = '******' \n                          and usuext = '1' ";
$pdf->cell(30, 5, 'Nº do CGM:', 0, 0, "L", 1);
$pdf->cell(0, 5, $z01_numcgm, 0, 1, "L", 1);
$pdf->cell(30, 5, 'Nome:', 0, 0, "L", 0);
$pdf->cell(0, 5, $z01_nome, 0, 1, "L", 0);
$pdf->cell(30, 5, 'Matricula:', 0, 0, "L", 1);
$pdf->cell(0, 5, $rh01_regist, 0, 1, "L", 1);
$sCgCcPf = trim($z01_cgccpf);
if (strlen($sCgCcPf) <= 11) {
    $sTipo = "cpf";
} else {
    $sTipo = "cnpj";
}
$pdf->cell(30, 5, 'CPF:', 0, 0, "L", 0);
$pdf->cell(0, 5, formataCpf($sCgCcPf, $sTipo), 0, 1, "L", 0);
$pdf->cell(30, 5, 'Data Nascimento:', 0, 0, "L", 1);
$pdf->cell(0, 5, formataDataNasc($z01_nasc), 0, 1, "L", 1);
if ($sEmailServ == '') {
    $pdf->cell(0, 5, '', 0, 1, "L", 0);
} else {
    $pdf->cell(30, 5, 'E-mail Informado:', 0, 0, "L", 0);
    $pdf->cell(0, 5, $sEmailServ, 0, 1, "L", 0);
}
$pdf->cell(0, 5, '', 0, 1, "L", 1);
$pdf->cell(30, 5, 'Login:', 0, 0, "L", 0);
$pdf->cell(0, 5, $z01_numcgm, 0, 1, "L", 0);
$pdf->Output();
//****************************************   	FIM PDF Servidor Público   ********************************************//
function formataDataNasc($sData)
{
    $data = str_replace("-", "", $sData);
    $datanasc_dia = substr($data, -2, 2);