Пример #1
0
 function Header()
 {
     //$dados = @pg_exec("select nomeinst,ender,munic,uf,telef,email,url,logo from db_config where codigo = ".@$GLOBALS["DB_instit"]);
     //$url = @pg_result($dados,0,"url");
     //global $nomeinst;
     //$nomeinst = pg_result($dados,0,"nomeinst");
     //global $ender;
     //$ender = pg_result($dados,0,"ender");
     $sql = "select nomeinst,bairro,cgc,ender,upper(munic) as munic,uf,telef,email,url,logo, db12_extenso\n\t\tfrom db_config \n\t\tinner join db_uf on db12_uf = uf\n\t\twhere codigo = " . db_getsession("DB_instit");
     $result = pg_query($sql);
     global $nomeinst;
     global $ender;
     global $munic;
     global $cgc;
     global $bairro;
     global $uf;
     //echo $sql;
     db_fieldsmemory($result, 0);
     /// seta a margem esquerda que veio do relatorio
     $S = $this->lMargin;
     $this->SetLeftMargin(10);
     $Letra = 'Times';
     $this->Image("imagens/files/logo_boleto.png", 95, 8, 24);
     //$this->Image('imagens/files/'.$logo,2,3,30);
     $this->Ln(35);
     $this->SetFont($Letra, '', 10);
     $this->MultiCell(0, 4, $db12_extenso, 0, "C", 0);
     $this->SetFont($Letra, 'B', 13);
     $this->MultiCell(0, 6, $nomeinst, 0, "C", 0);
     $this->SetFont($Letra, 'B', 12);
     $this->MultiCell(0, 4, @$GLOBALS["head1"], 0, "C", 0);
     $this->Ln(10);
     $this->SetLeftMargin($S);
 }
 function Header()
 {
     //$dados = @pg_exec("select nomeinst,ender,munic,uf,telef,email,url,logo from db_config where codigo = ".@$GLOBALS["DB_instit"]);
     //$url = @pg_result($dados,0,"url");
     //global $nomeinst;
     //$nomeinst = pg_result($dados,0,"nomeinst");
     //global $ender;
     //$ender = pg_result($dados,0,"ender");
     $sql = "select nomeinst,ender,upper(munic) as munic,uf,telef,email,url,logo from db_config where codigo = " . db_getsession("DB_instit");
     $result = pg_query($sql);
     global $nomeinst;
     global $ender;
     global $munic;
     //echo $sql;
     db_fieldsmemory($result, 0);
     $Letra = 'Times';
     $this->Image("imagens/files/logo_boleto.png", 95, 9, 24);
     //$this->Image('imagens/files/'.$logo,2,3,30);
     $this->Ln(35);
     $this->SetFont($Letra, '', 10);
     $this->MultiCell(0, 4, "ESTADO DO RIO GRANDE DO SUL", 0, "C", 0);
     $this->SetFont($Letra, 'B', 13);
     $this->MultiCell(0, 6, $nomeinst, 0, "C", 0);
     $this->SetFont($Letra, 'B', 12);
     $this->MultiCell(0, 4, @$GLOBALS["head1"], 0, "C", 0);
     $this->Ln(10);
 }
function debitos_tipos_numcgm($numcgm)
{
    $instit = db_getsession("DB_instit");
    $sql = "select distinct t.k00_tipo,t.k00_descr,t.k00_marcado,b.k00_numcgm,t.k00_emrec,t.k00_agnum,t.k00_agpar\n          from arrenumcgm b\n                inner join arrecad a    on b.k00_numpre = a.k00_numpre\n                inner join arretipo t   on t.k00_tipo   = a.k00_tipo\n                inner join arreinstit n on n.k00_numpre = a.k00_numpre\n                  where b.k00_numcgm = {$numcgm} and n.k00_instit = {$instit}";
    // echo "<br> cgm = $sql <br> ";
    $result = pg_exec($sql) or die("Sql : " . pg_ErrorMessage());
    return pg_numrows($result) == 0 ? false : $result;
}
 function __construct($iCodigoSimulacao)
 {
     $this->setCodigoSimulacao($iCodigoSimulacao);
     $oDaoIssSimulaCalculo = db_utils::getDao("isssimulacalculo");
     $sSqlIssSimulaCalculo = $oDaoIssSimulaCalculo->sql_query_file($iCodigoSimulacao);
     $rsIssSimulacaoCalculo = $oDaoIssSimulaCalculo->sql_record($sSqlIssSimulaCalculo);
     if ($oDaoIssSimulaCalculo->numrows == 0) {
         throw new Exception("[ Erro 1 ] - Não encontrados dados para processamento do calculo de simulação");
     }
     $oDadosSimulacao = db_utils::fieldsMemory($rsIssSimulacaoCalculo, 0);
     $this->setDataCalculo(date("Y-m-d", db_getsession("DB_datausu")));
     $this->setDataInicioAtividade($oDadosSimulacao->q130_datainicio);
     $this->setAtividadeCalculo();
     $this->setParametrosISSQN($this->getAnoCalculo());
 }
 function __construct()
 {
     /**
      * Declaramos as variáveis da classe de acordo com o que está configurado no arquivo config.mail.php
      */
     include_once 'libs/config.mail.php';
     $this->sUserMail = $sUser;
     $this->sPassMail = $sPass;
     $this->sHostMail = $sHost;
     $this->sPortMail = (int) $sPort;
     $this->sClass = (int) $sClass;
     $oConfigDBpref = db_utils::getDao("configdbpref");
     $rsConfigDBpref = $oConfigDBpref->sql_record($oConfigDBpref->sql_query_file(db_getsession('DB_instit'), "w13_emailadmin"));
     $this->sEmailFrom = db_utils::fieldsMemory($rsConfigDBpref, 0)->w13_emailadmin;
 }
 function assinatura($codigo, $default = '', $pos_paragrafo = "")
 {
     //#00#//assinatura
     //#10#//Este método é usado gerar a assinatura de acordo com o cadastro de assinaturas
     //#15#//assinatura($codigo,$default)
     //#20#//codigo  : codigo do tipo de assinatura da tabela db_tipodoc
     //#20#//default : string default que será impressa caso o código não seja encontrado
     //#20#//pos_paragrafo : qual será o paragrafo retornado, se retornar somente o primeiro, seria somente o nome da pessoa
     //#20#//, por exemplo  ( nome, carlos).  0 = nome, 1 = cargo , passar este parementro sempre entre aspas simples
     //#20#//na tabela.
     $result = pg_query("select db_paragrafo.*\n      \t        \t      from db_documento\n                      \t\t    inner join db_docparag on db03_docum = db04_docum\n                      \t\t    inner join db_paragrafo on db04_idparag = db02_idparag\n                 \t   \t  where db03_tipodoc = {$codigo} and\n                       \t\t         db03_instit  = " . db_getsession('DB_instit') . "\n                 \t\t  order by db02_descr\n                 \t\t");
     //db_criatabela($result);exit;
     $ass = $default;
     if (pg_numrows($result) > 0) {
         $ass = '';
         $ar = "";
         for ($i = 0; $i < pg_numrows($result); $i++) {
             $db02_texto = pg_result($result, $i, "db02_texto");
             $ass .= $ar . $db02_texto;
             $ar = "\r\n";
         }
         /* paragrafo : qual será o paragrafo retornado, se retornar somente o primeiro, seria somente o nome da pessoa 
          * por exemplo  ( nome, carlos).  0 = nome, 1 = cargo
          * aqui sobrescrevemos as variáveis acima ( codigo pobre )
          */
         if ($pos_paragrafo != "") {
             $ass = '';
             if (pg_numrows($result) > $pos_paragrafo) {
                 $db02_texto = pg_result($result, $pos_paragrafo, "db02_texto");
                 // retorna da posição paragrafo
                 $ass = $db02_texto;
             }
         }
         //------------------------------------------ * -------------------------------------
     }
     return $ass;
 }
 function sql_query_virada_issqn($q81_codigo = null, $campos = "*", $ordem = null, $dbwhere = "")
 {
     $sql = "select ";
     if ($campos != "*") {
         $campos_sql = split("#", $campos);
         $virgula = "";
         for ($i = 0; $i < sizeof($campos_sql); $i++) {
             $sql .= $virgula . $campos_sql[$i];
             $virgula = ",";
         }
     } else {
         $sql .= $campos;
     }
     $sql .= " from tipcalc                                                            ";
     $sql .= "      inner join cadcalc     on q81_cadcalc = q85_codigo                 ";
     $sql .= "      inner join tipcalcexe  on q81_codigo  = q83_tipcalc                ";
     $sql .= "                            and q83_anousu  = " . db_getsession('DB_anousu');
     $sql .= "      inner join cadvencdesc on q83_codven  = q92_codigo                 ";
     $sql2 = "";
     if ($dbwhere == "") {
         if ($q81_codigo != null) {
             $sql2 .= " where tipcalc.q81_codigo = {$q81_codigo} ";
         }
     } else {
         if ($dbwhere != "") {
             $sql2 = " where {$dbwhere}";
         }
     }
     $sql .= $sql2;
     if ($ordem != null) {
         $sql .= " order by ";
         $campos_sql = split("#", $ordem);
         $virgula = "";
         for ($i = 0; $i < sizeof($campos_sql); $i++) {
             $sql .= $virgula . $campos_sql[$i];
             $virgula = ",";
         }
     }
     return $sql;
 }
 function excluir($q12_classe = null, $dbwhere = null)
 {
     if ($dbwhere == null || $dbwhere == "") {
         $resaco = $this->sql_record($this->sql_query_file($q12_classe));
     } else {
         $resaco = $this->sql_record($this->sql_query_file(null, "*", null, $dbwhere));
     }
     if ($resaco != false || $this->numrows != 0) {
         for ($iresaco = 0; $iresaco < $this->numrows; $iresaco++) {
             $resac = db_query("select nextval('db_acount_id_acount_seq') as acount");
             $acount = pg_result($resac, 0, 0);
             $resac = db_query("insert into db_acountacesso values({$acount}," . db_getsession("DB_acessado") . ")");
             $resac = db_query("insert into db_acountkey values({$acount},304,'{$q12_classe}','E')");
             $resac = db_query("insert into db_acount values({$acount},57,304,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q12_classe')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},57,305,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q12_descr')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},57,6390,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q12_fisica')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},57,6510,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q12_calciss')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},57,9632,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q12_integrasani')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},57,18324,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q12_alvaraautomatico')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
         }
     }
     $sql = " delete from classe\n                    where ";
     $sql2 = "";
     if ($dbwhere == null || $dbwhere == "") {
         if ($q12_classe != "") {
             if ($sql2 != "") {
                 $sql2 .= " and ";
             }
             $sql2 .= " q12_classe = {$q12_classe} ";
         }
     } else {
         $sql2 = $dbwhere;
     }
     $result = db_query($sql . $sql2);
     if ($result == false) {
         $this->erro_banco = str_replace("\n", "", @pg_last_error());
         $this->erro_sql = " nao Excluído. Exclusão Abortada.\\n";
         $this->erro_sql .= "Valores : " . $q12_classe;
         $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
         $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
         $this->erro_status = "0";
         $this->numrows_excluir = 0;
         return false;
     } else {
         if (pg_affected_rows($result) == 0) {
             $this->erro_banco = "";
             $this->erro_sql = " nao Encontrado. Exclusão não Efetuada.\\n";
             $this->erro_sql .= "Valores : " . $q12_classe;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = 0;
             return true;
         } else {
             $this->erro_banco = "";
             $this->erro_sql = "Exclusão efetuada com Sucesso\\n";
             $this->erro_sql .= "Valores : " . $q12_classe;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = pg_affected_rows($result);
             return true;
         }
     }
 }
 public function excluir($pc23_orcamforne = null, $pc23_orcamitem = null, $dbwhere = null)
 {
     $lSessaoDesativarAccount = db_getsession("DB_desativar_account", false);
     if (!isset($lSessaoDesativarAccount) || isset($lSessaoDesativarAccount) && $lSessaoDesativarAccount === false) {
         if (empty($dbwhere)) {
             $resaco = $this->sql_record($this->sql_query_file($pc23_orcamforne, $pc23_orcamitem));
         } else {
             $resaco = $this->sql_record($this->sql_query_file(null, null, "*", null, $dbwhere));
         }
         if ($resaco != false || $this->numrows != 0) {
             for ($iresaco = 0; $iresaco < $this->numrows; $iresaco++) {
                 $resac = db_query("select nextval('db_acount_id_acount_seq') as acount");
                 $acount = pg_result($resac, 0, 0);
                 $resac = db_query("insert into db_acountacesso values({$acount}," . db_getsession("DB_acessado") . ")");
                 $resac = db_query("insert into db_acountkey values({$acount},6378,'{$pc23_orcamforne}','E')");
                 $resac = db_query("insert into db_acountkey values({$acount},5517,'{$pc23_orcamitem}','E')");
                 $resac = db_query("insert into db_acount values({$acount},863,6378,'','" . AddSlashes(pg_result($resaco, $iresaco, 'pc23_orcamforne')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
                 $resac = db_query("insert into db_acount values({$acount},863,5517,'','" . AddSlashes(pg_result($resaco, $iresaco, 'pc23_orcamitem')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
                 $resac = db_query("insert into db_acount values({$acount},863,5518,'','" . AddSlashes(pg_result($resaco, $iresaco, 'pc23_valor')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
                 $resac = db_query("insert into db_acount values({$acount},863,6456,'','" . AddSlashes(pg_result($resaco, $iresaco, 'pc23_quant')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
                 $resac = db_query("insert into db_acount values({$acount},863,6831,'','" . AddSlashes(pg_result($resaco, $iresaco, 'pc23_obs')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
                 $resac = db_query("insert into db_acount values({$acount},863,7645,'','" . AddSlashes(pg_result($resaco, $iresaco, 'pc23_vlrun')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
                 $resac = db_query("insert into db_acount values({$acount},863,9205,'','" . AddSlashes(pg_result($resaco, $iresaco, 'pc23_validmin')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
                 $resac = db_query("insert into db_acount values({$acount},863,20855,'','" . AddSlashes(pg_result($resaco, $iresaco, 'pc23_percentualdesconto')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             }
         }
     }
     $sql = " delete from pcorcamval\n                    where ";
     $sql2 = "";
     if (empty($dbwhere)) {
         if (!empty($pc23_orcamforne)) {
             if (!empty($sql2)) {
                 $sql2 .= " and ";
             }
             $sql2 .= " pc23_orcamforne = {$pc23_orcamforne} ";
         }
         if (!empty($pc23_orcamitem)) {
             if (!empty($sql2)) {
                 $sql2 .= " and ";
             }
             $sql2 .= " pc23_orcamitem = {$pc23_orcamitem} ";
         }
     } else {
         $sql2 = $dbwhere;
     }
     $result = db_query($sql . $sql2);
     if ($result == false) {
         $this->erro_banco = str_replace("\n", "", @pg_last_error());
         $this->erro_sql = "Valores dos itens do orçamento nao Excluído. Exclusão Abortada.\\n";
         $this->erro_sql .= "Valores : " . $pc23_orcamforne . "-" . $pc23_orcamitem;
         $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
         $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
         $this->erro_status = "0";
         $this->numrows_excluir = 0;
         return false;
     } else {
         if (pg_affected_rows($result) == 0) {
             $this->erro_banco = "";
             $this->erro_sql = "Valores dos itens do orçamento nao Encontrado. Exclusão não Efetuada.\\n";
             $this->erro_sql .= "Valores : " . $pc23_orcamforne . "-" . $pc23_orcamitem;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = 0;
             return true;
         } else {
             $this->erro_banco = "";
             $this->erro_sql = "Exclusão efetuada com Sucesso\\n";
             $this->erro_sql .= "Valores : " . $pc23_orcamforne . "-" . $pc23_orcamitem;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = pg_affected_rows($result);
             return true;
         }
     }
 }
 function excluir($pc17_codigo = null, $dbwhere = null)
 {
     if ($dbwhere == null || $dbwhere == "") {
         $resaco = $this->sql_record($this->sql_query_file($pc17_codigo));
     } else {
         $resaco = $this->sql_record($this->sql_query_file(null, "*", null, $dbwhere));
     }
     if ($resaco != false || $this->numrows != 0) {
         for ($iresaco = 0; $iresaco < $this->numrows; $iresaco++) {
             $resac = db_query("select nextval('db_acount_id_acount_seq') as acount");
             $acount = pg_result($resac, 0, 0);
             $resac = db_query("insert into db_acountacesso values({$acount}," . db_getsession("DB_acessado") . ")");
             $resac = db_query("insert into db_acountkey values({$acount},6460,'{$pc17_codigo}','E')");
             $resac = db_query("insert into db_acount values({$acount},1061,6453,'','" . AddSlashes(pg_result($resaco, $iresaco, 'pc17_unid')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1061,6459,'','" . AddSlashes(pg_result($resaco, $iresaco, 'pc17_quant')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1061,6460,'','" . AddSlashes(pg_result($resaco, $iresaco, 'pc17_codigo')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
         }
     }
     $sql = " delete from solicitemunid\n                    where ";
     $sql2 = "";
     if ($dbwhere == null || $dbwhere == "") {
         if ($pc17_codigo != "") {
             if ($sql2 != "") {
                 $sql2 .= " and ";
             }
             $sql2 .= " pc17_codigo = {$pc17_codigo} ";
         }
     } else {
         $sql2 = $dbwhere;
     }
     $result = db_query($sql . $sql2);
     if ($result == false) {
         $this->erro_banco = str_replace("\n", "", @pg_last_error());
         $this->erro_sql = "Unidade/quantidade dos itens nao Excluído. Exclusão Abortada.\\n";
         $this->erro_sql .= "Valores : " . $pc17_codigo;
         $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
         $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
         $this->erro_status = "0";
         $this->numrows_excluir = 0;
         return false;
     } else {
         if (pg_affected_rows($result) == 0) {
             $this->erro_banco = "";
             $this->erro_sql = "Unidade/quantidade dos itens nao Encontrado. Exclusão não Efetuada.\\n";
             $this->erro_sql .= "Valores : " . $pc17_codigo;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = 0;
             return true;
         } else {
             $this->erro_banco = "";
             $this->erro_sql = "Exclusão efetuada com Sucesso\\n";
             $this->erro_sql .= "Valores : " . $pc17_codigo;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = pg_affected_rows($result);
             return true;
         }
     }
 }
 function sql_query_deb($v14_certid = null, $v14_coddiv = null, $campos = "*", $ordem = null, $dbwhere = "", $instit = "")
 {
     if ($instit == "") {
         $instit = db_getsession('DB_instit');
     }
     $sql = "select ";
     if ($campos != "*") {
         $campos_sql = split("#", $campos);
         $virgula = "";
         for ($i = 0; $i < sizeof($campos_sql); $i++) {
             $sql .= $virgula . $campos_sql[$i];
             $virgula = ",";
         }
     } else {
         $sql .= $campos;
     }
     $sql .= " from certdiv ";
     $sql .= "      inner join divida\t\t  on divida.v01_coddiv = certdiv.v14_coddiv   ";
     $sql .= "                           and v01_instit = {$instit}\t\t\t\t\t\t\t\t\t\t  ";
     $sql .= "      left  join arrematric on divida.v01_numpre = arrematric.k00_numpre";
     $sql .= "      left  join arreinscr  on divida.v01_numpre = arreinscr.k00_numpre ";
     $sql .= "      inner join certid\t\t\ton certid.v13_certid = certdiv.v14_certid   ";
     $sql .= "                           and v13_instit = {$instit}\t\t\t\t\t\t\t\t\t\t  ";
     $sql .= "      inner join cgm\t\t\t  on cgm.z01_numcgm    = divida.v01_numcgm\t  ";
     $sql .= "      inner join proced\t\t  on proced.v03_codigo = divida.v01_proced\t\t";
     $sql2 = "";
     if ($dbwhere == "") {
         if ($v14_certid != null) {
             $sql2 .= " where certdiv.v14_certid = {$v14_certid} ";
         }
         if ($v14_coddiv != null) {
             if ($sql2 != "") {
                 $sql2 .= " and ";
             } else {
                 $sql2 .= " where ";
             }
             $sql2 .= " certdiv.v14_coddiv = {$v14_coddiv} ";
         }
     } else {
         if ($dbwhere != "") {
             $sql2 = " where {$dbwhere}";
         }
     }
     $sql .= $sql2;
     if ($ordem != null) {
         $sql .= " order by ";
         $campos_sql = split("#", $ordem);
         $virgula = "";
         for ($i = 0; $i < sizeof($campos_sql); $i++) {
             $sql .= $virgula . $campos_sql[$i];
             $virgula = ",";
         }
     }
     return $sql;
 }
 function sql_query($k24_sequencia = null, $campos = "*", $ordem = null, $dbwhere = "")
 {
     $sql = "select ";
     if ($campos != "*") {
         $campos_sql = split("#", $campos);
         $virgula = "";
         for ($i = 0; $i < sizeof($campos_sql); $i++) {
             $sql .= $virgula . $campos_sql[$i];
             $virgula = ",";
         }
     } else {
         $sql .= $campos;
     }
     $sql .= " from cancdebitosprocreg ";
     $sql .= "      inner join cancdebitosreg  on  cancdebitosreg.k21_sequencia = cancdebitosprocreg.k24_cancdebitosreg";
     $sql .= "      inner join cancdebitosproc on  cancdebitosproc.k23_codigo = cancdebitosprocreg.k24_codigo";
     $sql .= "      inner join cancdebitos     on  cancdebitos.k20_codigo = cancdebitosreg.k21_codigo";
     $sql .= "                                and  cancdebitos.k20_instit = " . db_getsession("DB_instit");
     $sql .= "      inner join db_usuarios     on  db_usuarios.id_usuario = cancdebitosproc.k23_usuario";
     $sql2 = "";
     if ($dbwhere == "") {
         if ($k24_sequencia != null) {
             $sql2 .= " where cancdebitosprocreg.k24_sequencia = {$k24_sequencia} ";
         }
     } else {
         if ($dbwhere != "") {
             $sql2 = " where {$dbwhere}";
         }
     }
     $sql .= $sql2;
     if ($ordem != null) {
         $sql .= " order by ";
         $campos_sql = split("#", $ordem);
         $virgula = "";
         for ($i = 0; $i < sizeof($campos_sql); $i++) {
             $sql .= $virgula . $campos_sql[$i];
             $virgula = ",";
         }
     }
     return $sql;
 }
 function excluir($y07_sequencial = null, $dbwhere = null)
 {
     if ($dbwhere == null || $dbwhere == "") {
         $resaco = $this->sql_record($this->sql_query_file($y07_sequencial));
     } else {
         $resaco = $this->sql_record($this->sql_query_file(null, "*", null, $dbwhere));
     }
     if ($resaco != false || $this->numrows != 0) {
         for ($iresaco = 0; $iresaco < $this->numrows; $iresaco++) {
             $resac = db_query("select nextval('db_acount_id_acount_seq') as acount");
             $acount = pg_result($resac, 0, 0);
             $resac = db_query("insert into db_acountacesso values({$acount}," . db_getsession("DB_acessado") . ")");
             $resac = db_query("insert into db_acountkey values({$acount},8197,'{$y07_sequencial}','E')");
             $resac = db_query("insert into db_acount values({$acount},1380,8197,'','" . AddSlashes(pg_result($resaco, $iresaco, 'y07_sequencial')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1380,8198,'','" . AddSlashes(pg_result($resaco, $iresaco, 'y07_aidof')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1380,8199,'','" . AddSlashes(pg_result($resaco, $iresaco, 'y07_ip')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1380,8200,'','" . AddSlashes(pg_result($resaco, $iresaco, 'y07_data')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1380,8201,'','" . AddSlashes(pg_result($resaco, $iresaco, 'y07_hora')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
         }
     }
     $sql = " delete from aidofweb\n                    where ";
     $sql2 = "";
     if ($dbwhere == null || $dbwhere == "") {
         if ($y07_sequencial != "") {
             if ($sql2 != "") {
                 $sql2 .= " and ";
             }
             $sql2 .= " y07_sequencial = {$y07_sequencial} ";
         }
     } else {
         $sql2 = $dbwhere;
     }
     $result = db_query($sql . $sql2);
     if ($result == false) {
         $this->erro_banco = str_replace("\n", "", @pg_last_error());
         $this->erro_sql = "Dados da web da aidof nao Excluído. Exclusão Abortada.\\n";
         $this->erro_sql .= "Valores : " . $y07_sequencial;
         $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
         $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
         $this->erro_status = "0";
         $this->numrows_excluir = 0;
         return false;
     } else {
         if (pg_affected_rows($result) == 0) {
             $this->erro_banco = "";
             $this->erro_sql = "Dados da web da aidof nao Encontrado. Exclusão não Efetuada.\\n";
             $this->erro_sql .= "Valores : " . $y07_sequencial;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = 0;
             return true;
         } else {
             $this->erro_banco = "";
             $this->erro_sql = "Exclusão efetuada com Sucesso\\n";
             $this->erro_sql .= "Valores : " . $y07_sequencial;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = pg_affected_rows($result);
             return true;
         }
     }
 }
 function excluir($j23_anousu = null, $j23_matric = null, $dbwhere = null)
 {
     if ($dbwhere == null || $dbwhere == "") {
         $resaco = $this->sql_record($this->sql_query_file($j23_anousu, $j23_matric));
     } else {
         $resaco = $this->sql_record($this->sql_query_file(null, null, "*", null, $dbwhere));
     }
     if ($resaco != false || $this->numrows != 0) {
         for ($iresaco = 0; $iresaco < $this->numrows; $iresaco++) {
             $resac = db_query("select nextval('db_acount_id_acount_seq') as acount");
             $acount = pg_result($resac, 0, 0);
             $resac = db_query("insert into db_acountacesso values({$acount}," . db_getsession("DB_acessado") . ")");
             $resac = db_query("insert into db_acountkey values({$acount},591,'{$j23_anousu}','E')");
             $resac = db_query("insert into db_acountkey values({$acount},592,'{$j23_matric}','E')");
             $resac = db_query("insert into db_acount values({$acount},115,591,'','" . AddSlashes(pg_result($resaco, $iresaco, 'j23_anousu')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},115,592,'','" . AddSlashes(pg_result($resaco, $iresaco, 'j23_matric')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},115,593,'','" . AddSlashes(pg_result($resaco, $iresaco, 'j23_testad')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},115,594,'','" . AddSlashes(pg_result($resaco, $iresaco, 'j23_arealo')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},115,598,'','" . AddSlashes(pg_result($resaco, $iresaco, 'j23_areafr')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},115,601,'','" . AddSlashes(pg_result($resaco, $iresaco, 'j23_areaed')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},115,602,'','" . AddSlashes(pg_result($resaco, $iresaco, 'j23_m2terr')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},115,605,'','" . AddSlashes(pg_result($resaco, $iresaco, 'j23_vlrter')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},115,609,'','" . AddSlashes(pg_result($resaco, $iresaco, 'j23_aliq')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},115,618,'','" . AddSlashes(pg_result($resaco, $iresaco, 'j23_vlrisen')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},115,6834,'','" . AddSlashes(pg_result($resaco, $iresaco, 'j23_tipoim')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},115,6835,'','" . AddSlashes(pg_result($resaco, $iresaco, 'j23_manual')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},115,11024,'','" . AddSlashes(pg_result($resaco, $iresaco, 'j23_tipocalculo')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
         }
     }
     $sql = " delete from iptucalc\n                    where ";
     $sql2 = "";
     if ($dbwhere == null || $dbwhere == "") {
         if ($j23_anousu != "") {
             if ($sql2 != "") {
                 $sql2 .= " and ";
             }
             $sql2 .= " j23_anousu = {$j23_anousu} ";
         }
         if ($j23_matric != "") {
             if ($sql2 != "") {
                 $sql2 .= " and ";
             }
             $sql2 .= " j23_matric = {$j23_matric} ";
         }
     } else {
         $sql2 = $dbwhere;
     }
     $result = db_query($sql . $sql2);
     if ($result == false) {
         $this->erro_banco = str_replace("\n", "", @pg_last_error());
         $this->erro_sql = " nao Excluído. Exclusão Abortada.\\n";
         $this->erro_sql .= "Valores : " . $j23_anousu . "-" . $j23_matric;
         $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
         $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
         $this->erro_status = "0";
         $this->numrows_excluir = 0;
         return false;
     } else {
         if (pg_affected_rows($result) == 0) {
             $this->erro_banco = "";
             $this->erro_sql = " nao Encontrado. Exclusão não Efetuada.\\n";
             $this->erro_sql .= "Valores : " . $j23_anousu . "-" . $j23_matric;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = 0;
             return true;
         } else {
             $this->erro_banco = "";
             $this->erro_sql = "Exclusão efetuada com Sucesso\\n";
             $this->erro_sql .= "Valores : " . $j23_anousu . "-" . $j23_matric;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = pg_affected_rows($result);
             return true;
         }
     }
 }
 function excluir($it22_sequencial = null, $dbwhere = null)
 {
     if ($dbwhere == null || $dbwhere == "") {
         $resaco = $this->sql_record($this->sql_query_file($it22_sequencial));
     } else {
         $resaco = $this->sql_record($this->sql_query_file(null, "*", null, $dbwhere));
     }
     if ($resaco != false || $this->numrows != 0) {
         for ($iresaco = 0; $iresaco < $this->numrows; $iresaco++) {
             $resac = db_query("select nextval('db_acount_id_acount_seq') as acount");
             $acount = pg_result($resac, 0, 0);
             $resac = db_query("insert into db_acountacesso values({$acount}," . db_getsession("DB_acessado") . ")");
             $resac = db_query("insert into db_acountkey values({$acount},9001,'{$it22_sequencial}','E')");
             $resac = db_query("insert into db_acount values({$acount},1540,9001,'','" . AddSlashes(pg_result($resaco, $iresaco, 'it22_sequencial')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1540,9002,'','" . AddSlashes(pg_result($resaco, $iresaco, 'it22_itbi')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1540,9003,'','" . AddSlashes(pg_result($resaco, $iresaco, 'it22_setor')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1540,9004,'','" . AddSlashes(pg_result($resaco, $iresaco, 'it22_quadra')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1540,9005,'','" . AddSlashes(pg_result($resaco, $iresaco, 'it22_lote')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1540,9006,'','" . AddSlashes(pg_result($resaco, $iresaco, 'it22_descrlograd')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1540,9007,'','" . AddSlashes(pg_result($resaco, $iresaco, 'it22_numero')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1540,9008,'','" . AddSlashes(pg_result($resaco, $iresaco, 'it22_compl')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1540,13531,'','" . AddSlashes(pg_result($resaco, $iresaco, 'it22_matricri')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1540,13533,'','" . AddSlashes(pg_result($resaco, $iresaco, 'it22_quadrari')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1540,13534,'','" . AddSlashes(pg_result($resaco, $iresaco, 'it22_loteri')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
         }
     }
     $sql = " delete from itbidadosimovel\n                    where ";
     $sql2 = "";
     if ($dbwhere == null || $dbwhere == "") {
         if ($it22_sequencial != "") {
             if ($sql2 != "") {
                 $sql2 .= " and ";
             }
             $sql2 .= " it22_sequencial = {$it22_sequencial} ";
         }
     } else {
         $sql2 = $dbwhere;
     }
     $result = db_query($sql . $sql2);
     if ($result == false) {
         $this->erro_banco = str_replace("\n", "", @pg_last_error());
         $this->erro_sql = "Dados do imovel nao Excluído. Exclusão Abortada.\\n";
         $this->erro_sql .= "Valores : " . $it22_sequencial;
         $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
         $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
         $this->erro_status = "0";
         $this->numrows_excluir = 0;
         return false;
     } else {
         if (pg_affected_rows($result) == 0) {
             $this->erro_banco = "";
             $this->erro_sql = "Dados do imovel nao Encontrado. Exclusão não Efetuada.\\n";
             $this->erro_sql .= "Valores : " . $it22_sequencial;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = 0;
             return true;
         } else {
             $this->erro_banco = "";
             $this->erro_sql = "Exclusão efetuada com Sucesso\\n";
             $this->erro_sql .= "Valores : " . $it22_sequencial;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = pg_affected_rows($result);
             return true;
         }
     }
 }
 function excluir($q132_sequencial = null, $dbwhere = null)
 {
     if ($dbwhere == null || $dbwhere == "") {
         $resaco = $this->sql_record($this->sql_query_file($q132_sequencial));
     } else {
         $resaco = $this->sql_record($this->sql_query_file(null, "*", null, $dbwhere));
     }
     if ($resaco != false || $this->numrows != 0) {
         for ($iresaco = 0; $iresaco < $this->numrows; $iresaco++) {
             $resac = db_query("select nextval('db_acount_id_acount_seq') as acount");
             $acount = pg_result($resac, 0, 0);
             $resac = db_query("insert into db_acountacesso values({$acount}," . db_getsession("DB_acessado") . ")");
             $resac = db_query("insert into db_acountkey values({$acount},18789,'{$q132_sequencial}','E')");
             $resac = db_query("insert into db_acount values({$acount},3332,18789,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q132_sequencial')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},3332,18790,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q132_isssimulacalculo')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},3332,18791,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q132_tipcalc')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},3332,18792,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q132_parcela')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},3332,18793,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q132_vencimento')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},3332,18794,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q132_valor')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
         }
     }
     $sql = " delete from isssimulacalculotipocalculo\n                    where ";
     $sql2 = "";
     if ($dbwhere == null || $dbwhere == "") {
         if ($q132_sequencial != "") {
             if ($sql2 != "") {
                 $sql2 .= " and ";
             }
             $sql2 .= " q132_sequencial = {$q132_sequencial} ";
         }
     } else {
         $sql2 = $dbwhere;
     }
     $result = db_query($sql . $sql2);
     if ($result == false) {
         $this->erro_banco = str_replace("\n", "", @pg_last_error());
         $this->erro_sql = "Tipos de Calculo da Simulação nao Excluído. Exclusão Abortada.\\n";
         $this->erro_sql .= "Valores : " . $q132_sequencial;
         $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
         $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
         $this->erro_status = "0";
         $this->numrows_excluir = 0;
         return false;
     } else {
         if (pg_affected_rows($result) == 0) {
             $this->erro_banco = "";
             $this->erro_sql = "Tipos de Calculo da Simulação nao Encontrado. Exclusão não Efetuada.\\n";
             $this->erro_sql .= "Valores : " . $q132_sequencial;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = 0;
             return true;
         } else {
             $this->erro_banco = "";
             $this->erro_sql = "Exclusão efetuada com Sucesso\\n";
             $this->erro_sql .= "Valores : " . $q132_sequencial;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = pg_affected_rows($result);
             return true;
         }
     }
 }
 function sql_query_infoemp($m51_codordem = null, $campos = "*", $ordem = null, $dbwhere = "")
 {
     $sql = "select ";
     if ($campos != "*") {
         $campos_sql = split("#", $campos);
         $virgula = "";
         for ($i = 0; $i < sizeof($campos_sql); $i++) {
             $sql .= $virgula . $campos_sql[$i];
             $virgula = ",";
         }
     } else {
         $sql .= $campos;
     }
     $sql .= " from matordem ";
     $sql .= "      inner join matordemitem  on matordemitem.m52_codordem = matordem.m51_codordem";
     $sql .= "      inner join empempitem  \ton empempitem.e62_numemp = matordemitem.m52_numemp and  empempitem.e62_sequen = matordemitem.m52_sequen";
     $sql .= "      inner join pcmater  \ton pcmater.pc01_codmater = empempitem.e62_item";
     $sql .= "      inner join pcsubgrupo   on  pcsubgrupo.pc04_codsubgrupo = pcmater.pc01_codsubgrupo";
     $sql .= "      inner join pcgrupo      on  pcgrupo.pc03_codgrupo = pcsubgrupo.pc04_codgrupo";
     $sql .= "      inner join empempenho  \ton empempenho.e60_numemp = empempitem.e62_numemp";
     $sql .= "      inner join empempaut\ton empempaut.e61_numemp = empempenho.e60_numemp";
     $sql .= "      inner join empautoriza \ton empempaut.e61_autori = empautoriza.e54_autori ";
     $sql .= "      inner join cgm  \t\ton cgm.z01_numcgm = matordem.m51_numcgm";
     $sql .= "      inner join db_depart  \ton db_depart.coddepto = matordem.m51_depto";
     $sql .= "      inner join orcdotacao   on o58_coddot=e60_coddot";
     $sql .= "\t\tinner join orcorgao     on o40_anousu \t = " . db_getsession("DB_anousu") . " and o40_orgao = o58_orgao";
     $sql .= "\t\tinner join orcunidade   on o41_anousu \t = " . db_getsession("DB_anousu") . " and o41_orgao = o58_orgao and o41_unidade= o58_unidade";
     $sql .= "\t\tinner join orcfuncao    on o52_funcao \t = o58_funcao";
     $sql .= "\t\tinner join orcsubfuncao on o53_subfuncao = o58_subfuncao";
     $sql .= "\t\tinner join orcprograma  on o54_anousu \t = " . db_getsession("DB_anousu") . " and o54_programa = o58_programa";
     $sql .= "\t\tinner join orcprojativ  on o55_anousu \t = " . db_getsession("DB_anousu") . " and o55_projativ = o58_projativ";
     $sql .= "\t\tinner join orcelemento  on o56_codele    = o58_codele and o56_anousu = " . db_getsession("DB_anousu");
     $sql .= " \t\tinner join orctiporec   on o15_codigo    = o58_codigo";
     $sql2 = "";
     if ($dbwhere == "") {
         if ($m51_codordem != null) {
             $sql2 .= " where matordem.m51_codordem = {$m51_codordem} ";
         }
     } else {
         if ($dbwhere != "") {
             $sql2 = " where {$dbwhere}";
         }
     }
     $sql .= $sql2;
     if ($ordem != null) {
         $sql .= " order by ";
         $campos_sql = split("#", $ordem);
         $virgula = "";
         for ($i = 0; $i < sizeof($campos_sql); $i++) {
             $sql .= $virgula . $campos_sql[$i];
             $virgula = ",";
         }
     }
     return $sql;
 }
            $result = $clativid->sql_record($clativid->sql_query($pesquisa_chave, "*", "", "{$where} and {$pesquisa_chave} = q03_ativ"));
            if ($clativid->numrows != 0) {
                db_fieldsmemory($result, 0);
                echo "<script>" . $funcao_js . "('{$q03_descr}',false);</script>";
            } else {
                echo "<script>" . $funcao_js . "('Chave(" . $pesquisa_chave . ") não Encontrado',true);</script>";
            }
        } else {
            echo "<script>" . $funcao_js . "('',false);</script>";
        }
    }
    /**
     * CPF - CBO
     */
} else {
    $data_atual = date('Y-m-d', db_getsession('DB_datausu'));
    $where = "(q03_limite is null) and q12_fisica is false ";
    $campos .= ", rh70_estrutural";
    if (!isset($pesquisa_chave)) {
        //$campos = "q03_ativid, q03_descr, q12_descr";
        if (isset($chave_q03_ativ) && trim($chave_q03_ativ) != "") {
            $sql = $clativid->sql_query_cboSimulacao($chave_q03_ativ, $campos, "q03_ativ", "{$where} and  q03_ativ = {$chave_q03_ativ}");
        } else {
            if (isset($chave_q03_descr) && trim($chave_q03_descr) != "") {
                $sql = $clativid->sql_query_cboSimulacao("", $campos, "q03_descr", " q03_descr like '{$chave_q03_descr}%' and  {$where}");
            } else {
                if (isset($chave_rh70_estrutural) && trim($chave_rh70_estrutural) != "") {
                    $sql = $clativid->sql_query_cboSimulacao("", $campos, "rh70_estrutural", " rh70_estrutural like '%{$chave_rh70_estrutural}%' and  {$where}");
                } else {
                    $sql = $clativid->sql_query_cboSimulacao("", $campos, "q03_ativ", "{$where}");
                }
 }
 if (pg_result($result, $i, "k00_numpar") == @$salva_parcela) {
     $cor = $ConfCor1;
 } else {
     $cor = $ConfCor2;
     if (pg_result($result, $i, "k00_numpar") == @pg_result($result, $i + 1, "k00_numpar")) {
         $salva_parcela = "";
     } else {
         $salva_parcela = @pg_result($result, $i + 1, "k00_numpar");
     }
 }
 // unica
 if ($tipo != 3) {
     if ($elementos_numpres[$cont] == pg_result($result, $i, "k00_numpre") && $listaunica) {
         $listaunica = false;
         $resultunica = db_query("select *,\n\t\t\t\t\t\t\t         substr(fc_calcula,2,13)::float8 as uvlrhis,\n\t\t\t\t\t\t\t         substr(fc_calcula,15,13)::float8 as uvlrcor,\n\t\t\t\t\t\t\t         substr(fc_calcula,28,13)::float8 as uvlrjuros,\n\t\t\t\t\t\t\t         substr(fc_calcula,41,13)::float8 as uvlrmulta,\n\t\t\t\t\t\t\t         substr(fc_calcula,54,13)::float8 as uvlrdesconto,\n\t\t\t\t\t\t\t         (substr(fc_calcula,15,13)::float8+\n\t\t\t\t\t\t\t         substr(fc_calcula,28,13)::float8+\n\t\t\t\t\t\t\t         substr(fc_calcula,41,13)::float8-\n\t\t\t\t\t\t\t         substr(fc_calcula,54,13)::float8) as utotal\n\t\t\t\t\t\t\t                         from (\n\t\t\t\t\t\t\t                         select r.k00_numpre,r.k00_dtvenc as dtvencunic, r.k00_dtoper as dtoperunic, r.k00_percdes,\n\t\t\t\t\t\t\t                                fc_calcula(r.k00_numpre,0,0,r.k00_dtvenc,r.k00_dtvenc," . db_getsession("DB_anousu") . ")\n\t\t\t\t\t\t\t         from recibounica r\n\t\t\t\t\t\t\t                         where r.k00_numpre = " . pg_result($result, $i, "k00_numpre") . " and r.k00_dtvenc >= '" . date('Y-m-d', $DB_DATACALC) . "'\n\t\t\t\t\t\t\t                         ) as unica");
         for ($unicont = 0; $unicont < pg_numrows($resultunica); $unicont++) {
             db_fieldsmemory($resultunica, $unicont);
             if ($dtvencunic >= date('Y-m-d', $DB_DATACALC)) {
                 $dtvencunic = db_formatar($dtvencunic, 'd');
                 $dtoperunic = db_formatar($dtoperunic, 'd');
                 $corunica = "#009933";
                 $uvlrcorr = 0;
                 $histdesc = "";
                 $resulthist = db_query("select k00_dtoper as dtlhist,k00_hora, login,substr(k00_histtxt,0,80) as k00_histtxt\n\t\t\t\t\t\t\t\t\t                             from arrehist\n\t\t\t\t\t\t\t\t\t                              left outer join db_usuarios on id_usuario = k00_id_usuario\n\t\t\t\t\t\t\t\t\t                             where k00_numpre = " . pg_result($result, $i, "k00_numpre") . " and k00_numpar = 0");
                 if (pg_numrows($resulthist) > 0) {
                     for ($di = 0; $di < pg_numrows($resulthist); $di++) {
                         db_fieldsmemory($resulthist, $di);
                         $histdesc .= $dtlhist . " " . $k00_hora . " " . $login . " " . $k00_histtxt . "\n";
                     }
                 }
                echo $k00_tipo;
                ?>
&emrec=<?php 
                echo $k00_emrec;
                ?>
&agnum=<?php 
                echo $k00_agnum;
                ?>
&agpar=<?php 
                echo $k00_agpar;
                ?>
&inscr=<?php 
                echo @$q02_inscr;
                ?>
&db_datausu=<?php 
                echo date('Y-m-d', db_getsession('DB_datausu'));
                ?>
&id_usuario=<?php 
                echo @$id_usuario;
                ?>
&opcao=<?php 
                echo $opcao;
                ?>
"><img
					src="imagens/pasta2.gif" border="0"> <?php 
                echo $k00_descr;
                ?>
</a></td>
			</tr>
			
			<?php 
$this->objpdf->text(40, $xlin - 2, $this->emailpref);
//                $this->objpdf->setfillcolor(245);
$this->objpdf->Roundedrect($xcol, $xlin + 2, $xcol + 119, 20, 2, 'DF', '1234');
$this->objpdf->Setfont('Arial', '', 6);
$this->objpdf->text($xcol + 2, $xlin + 4, 'Identificação:');
$this->objpdf->Setfont('Arial', '', 8);
$this->objpdf->text($xcol + 2, $xlin + 7, 'Nome :');
$this->objpdf->text($xcol + 17, $xlin + 7, $this->nome);
$this->objpdf->text($xcol + 2, $xlin + 11, 'Endereço :');
$this->objpdf->text($xcol + 17, $xlin + 11, $this->ender);
$this->objpdf->text($xcol + 2, $xlin + 15, 'Município :');
$this->objpdf->text($xcol + 17, $xlin + 15, $this->munic);
$this->objpdf->text($xcol + 75, $xlin + 15, 'CEP :');
$this->objpdf->text($xcol + 82, $xlin + 15, $this->cep);
$this->objpdf->text($xcol + 2, $xlin + 19, 'Data :');
$this->objpdf->text($xcol + 17, $xlin + 19, date("d-m-Y", db_getsession("DB_datausu")));
$this->objpdf->text($xcol + 40, $xlin + 19, 'Hora: ' . date("H:i:s"));
$this->objpdf->text($xcol + 75, $xlin + 19, 'CNPJ/CPF:');
$this->objpdf->text($xcol + 90, $xlin + 19, db_formatar($this->cgccpf, strlen($this->cgccpf) < 12 ? 'cpf' : 'cnpj'));
//$this->objpdf->text($xcol+75,$xlin+19,'IP :');
//$this->objpdf->text($xcol+82,$xlin+19,$this->ip);
$this->objpdf->Setfont('Arial', '', 6);
$this->objpdf->Roundedrect($xcol + 126, $xlin + 2, 76, 20, 2, 'DF', '1234');
$this->objpdf->text($xcol + 128, $xlin + 4, $this->identifica_dados);
$this->objpdf->text($xcol + 128, $xlin + 7, $this->tipoinscr);
$this->objpdf->text($xcol + 145, $xlin + 7, $this->nrinscr);
//$this->objpdf->text($xcol+128,$xlin+7,$this->tipoinscr1);
//$this->objpdf->text($xcol+145,$xlin+7,$this->nrinscr1);
$this->objpdf->text($xcol + 128, $xlin + 11, $this->tipolograd);
$this->objpdf->text($xcol + 145, $xlin + 11, $this->nomepri);
$this->objpdf->text($xcol + 128, $xlin + 15, $this->tipocompl);
     $rubrica = trim(pg_result($this->recordenvelope, $ii, $this->rubrica));
     if (db_getsession("DB_instit") == 1 && strtoupper($this->municpref == 'GUAIBA') && ($rubrica == '0102' || $rubrica == '0109' || $rubrica == '0111' || $rubrica == '0195' || $rubrica == '0196' || $rubrica == '0197' || $rubrica == '0198')) {
         $margem_consignada += pg_result($this->recordenvelope, $ii, $this->valor);
     } elseif (db_getsession("DB_instit") == 1 && strtoupper($this->municpref) == 'ARAPIRACA' && ($rubrica == '0005' || $rubrica == '0006' || $rubrica == '0007' || $rubrica == '0008' || $rubrica == '0011' || $rubrica == '0014' || $rubrica == '0017' || $rubrica == '0018' || $rubrica == '0020' || $rubrica == '0021' || $rubrica == '0023' || $rubrica == '0055' || $rubrica == '0060' || $rubrica == '0061' || $rubrica == '0062' || $rubrica == '0063' || $rubrica == '0064' || $rubrica == '0065' || $rubrica == '0098' || $rubrica == '0099' || $rubrica == '0101' || $rubrica == '0104' || $rubrica == '0105' || $rubrica == '0107' || $rubrica == '0108' || $rubrica == '0112' || $rubrica == '0116' || $rubrica == '0117' || $rubrica == '0118' || $rubrica == '0121' || $rubrica == '0122' || $rubrica == '0126' || $rubrica == '0129' || $rubrica == '0131' || $rubrica == '0132' || $rubrica == '0133' || $rubrica == '0134' || $rubrica == '0135' || $rubrica == '0136' || $rubrica == '0137' || $rubrica == '0138' || $rubrica == '0150' || $rubrica == '0151' || $rubrica == '0160' || $rubrica == '0170' || $rubrica == '0190')) {
         $margem_consignada += pg_result($this->recordenvelope, $ii, $this->valor);
     }
 } elseif (pg_result($this->recordenvelope, $ii, $this->tipo) == 'D') {
     $this->objpdf->cell(5, 3, trim(pg_result($this->recordenvelope, $ii, $this->rubrica)), 0, 0, "R", 0);
     $this->objpdf->cell(5, 3, "", 0, 0, "L", 0);
     $this->objpdf->cell(93, 3, pg_result($this->recordenvelope, $ii, $this->descr_rub), 0, 0, "L", 0);
     $this->objpdf->cell(20, 3, db_formatar(pg_result($this->recordenvelope, $ii, $this->quantidade), 'f'), 0, 0, "R", 0);
     $this->objpdf->cell(22, 3, '', 0, 0, "R", 0);
     $this->objpdf->cell(22, 3, db_formatar(pg_result($this->recordenvelope, $ii, $this->valor), 'f'), 0, 1, "R", 0);
     $desconto += pg_result($this->recordenvelope, $ii, $this->valor);
     $rubrica = trim(pg_result($this->recordenvelope, $ii, $this->rubrica));
     if (db_getsession("DB_instit") == 1 && strtoupper($this->municpref) == 'ARAPIRACA') {
         if ($rubrica == 'R901' || $rubrica == 'R904' || $rubrica == 'R913' || $rubrica == '0333') {
             $margem_consignada -= pg_result($this->recordenvelope, $ii, $this->valor);
         } elseif ($rubrica == '0330' || $rubrica == '0334' || $rubrica == '0335' || $rubrica == '0336' || $rubrica == '0337' || $rubrica == '0338' || $rubrica == '0340' || $rubrica == '0341' || $rubrica == '0342' || $rubrica == '0343' || $rubrica == '0344' || $rubrica == '0345') {
             $margem_deduz += pg_result($this->recordenvelope, $ii, $this->valor);
         }
     }
 } else {
     if (pg_result($this->recordenvelope, $ii, $this->rubrica) == 'R981' || pg_result($this->recordenvelope, $ii, $this->rubrica) == 'R982') {
         $baseirrf += pg_result($this->recordenvelope, $ii, $this->valor);
     } elseif (pg_result($this->recordenvelope, $ii, $this->rubrica) == 'R992') {
         $baseprev += pg_result($this->recordenvelope, $ii, $this->valor);
     } elseif (pg_result($this->recordenvelope, $ii, $this->rubrica) == 'R991') {
         $basefgts += pg_result($this->recordenvelope, $ii, $this->valor);
     } elseif (pg_result($this->recordenvelope, $ii, $this->rubrica) == 'R803') {
         $valor_margem += pg_result($this->recordenvelope, $ii, $this->valor);
 function excluir($q85_codigo = null, $dbwhere = null)
 {
     if ($dbwhere == null || $dbwhere == "") {
         $resaco = $this->sql_record($this->sql_query_file($q85_codigo));
     } else {
         $resaco = $this->sql_record($this->sql_query_file(null, "*", null, $dbwhere));
     }
     if ($resaco != false || $this->numrows != 0) {
         for ($iresaco = 0; $iresaco < $this->numrows; $iresaco++) {
             $resac = db_query("select nextval('db_acount_id_acount_seq') as acount");
             $acount = pg_result($resac, 0, 0);
             $resac = db_query("insert into db_acountacesso values({$acount}," . db_getsession("DB_acessado") . ")");
             $resac = db_query("insert into db_acountkey values({$acount},248,'{$q85_codigo}','E')");
             $resac = db_query("insert into db_acount values({$acount},51,248,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q85_codigo')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},51,249,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q85_descr')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},51,250,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q85_uniref')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},51,251,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q85_dtoper')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},51,252,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q85_codven')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},51,253,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q85_var')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},51,254,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q85_fixmes')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},51,256,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q85_forcal')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},51,2410,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q85_perman')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},51,2486,'','" . AddSlashes(pg_result($resaco, $iresaco, 'q85_outromun')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
         }
     }
     $sql = " delete from cadcalc\n                    where ";
     $sql2 = "";
     if ($dbwhere == null || $dbwhere == "") {
         if ($q85_codigo != "") {
             if ($sql2 != "") {
                 $sql2 .= " and ";
             }
             $sql2 .= " q85_codigo = {$q85_codigo} ";
         }
     } else {
         $sql2 = $dbwhere;
     }
     $result = db_query($sql . $sql2);
     if ($result == false) {
         $this->erro_banco = str_replace("\n", "", @pg_last_error());
         $this->erro_sql = " nao Excluído. Exclusão Abortada.\\n";
         $this->erro_sql .= "Valores : " . $q85_codigo;
         $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
         $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
         $this->erro_status = "0";
         $this->numrows_excluir = 0;
         return false;
     } else {
         if (pg_affected_rows($result) == 0) {
             $this->erro_banco = "";
             $this->erro_sql = " nao Encontrado. Exclusão não Efetuada.\\n";
             $this->erro_sql .= "Valores : " . $q85_codigo;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = 0;
             return true;
         } else {
             $this->erro_banco = "";
             $this->erro_sql = "Exclusão efetuada com Sucesso\\n";
             $this->erro_sql .= "Valores : " . $q85_codigo;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = pg_affected_rows($result);
             return true;
         }
     }
 }
 function excluir($r01_anousu = null, $r01_mesusu = null, $r01_regist = null, $dbwhere = null)
 {
     if ($dbwhere == null || $dbwhere == "") {
         $resaco = $this->sql_record($this->sql_query_file($r01_anousu, $r01_mesusu, $r01_regist));
     } else {
         $resaco = $this->sql_record($this->sql_query_file(null, null, null, "*", null, $dbwhere));
     }
     if ($resaco != false || $this->numrows != 0) {
         for ($iresaco = 0; $iresaco < $this->numrows; $iresaco++) {
             $resac = db_query("select nextval('db_acount_id_acount_seq') as acount");
             $acount = pg_result($resac, 0, 0);
             $resac = db_query("insert into db_acountacesso values({$acount}," . db_getsession("DB_acessado") . ")");
             $resac = db_query("insert into db_acountkey values({$acount},4185,'{$r01_anousu}','E')");
             $resac = db_query("insert into db_acountkey values({$acount},4186,'{$r01_mesusu}','E')");
             $resac = db_query("insert into db_acountkey values({$acount},4225,'{$r01_regist}','E')");
             $resac = db_query("insert into db_acount values({$acount},573,4185,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_anousu')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4186,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_mesusu')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4187,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_numcgm')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4225,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_regist')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4188,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_admiss')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4189,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_regime')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4190,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_lotac')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4191,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_vincul')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4192,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_cbo')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4193,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_padrao')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4194,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_salari')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4195,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_tipsal')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4196,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_folha')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4197,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_fpagto')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4198,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_banco')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4199,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_agenc')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4200,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_contac')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4201,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_ctps')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4202,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_pis')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4203,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_fgts')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4204,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_bcofgt')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4205,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_agfgts')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4206,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_ccfgts')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4207,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_hrssem')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4208,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_situac')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4209,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_nasc')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4210,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_nacion')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4211,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_anoche')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4212,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_instru')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4213,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_sexo')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4214,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_recis')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4215,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_causa')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4216,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_ponto')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4217,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_alim')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4218,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_digito')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4219,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_tpvinc')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4220,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_arredn')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4221,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_progr')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4222,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_carth')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4223,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_rubric')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4224,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_tbprev')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4226,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_adia13')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4227,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_anter')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4228,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_dtafas')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4229,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_ctpsuf')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4230,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_dadi13')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4231,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_estciv')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4232,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_funcao')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4233,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_trien')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4234,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_tipadm')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4235,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_caub')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4236,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_aviso')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4237,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_hrsmen')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4238,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_rfi1')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4239,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_rfi2')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4240,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_rff1')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4241,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_rff2')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4242,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_rnd1')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4243,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_rnd2')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4244,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_r13i')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4245,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_r13f')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4246,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_rnd3')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4247,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_ndres')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4248,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_ndsal')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4249,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_prores')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4250,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_matipe')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4251,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_dtvinc')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4252,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_estado')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4253,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_dtalt')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4254,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_natura')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4255,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_tpcont')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4256,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_titele')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4257,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_zonael')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4258,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_secaoe')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4259,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_taviso')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4260,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_cc')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4261,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_ocorre')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4262,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_basefo')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4263,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_descfo')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4264,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_b13fo')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4265,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_d13fo')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4266,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_equip')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4267,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_raca')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4268,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_mremun')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4603,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_reserv')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4604,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_catres')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4605,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_propi')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4606,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_cargo')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4607,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_clas1')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4608,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_origp')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,4609,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_clas2')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,9395,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_vale')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,7468,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_instit')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,8869,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_contrato')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,9394,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_depsf')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},573,9393,'','" . AddSlashes(pg_result($resaco, $iresaco, 'r01_depirf')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
         }
     }
     $sql = " delete from pessoal\n                    where ";
     $sql2 = "";
     if ($dbwhere == null || $dbwhere == "") {
         if ($r01_anousu != "") {
             if ($sql2 != "") {
                 $sql2 .= " and ";
             }
             $sql2 .= " r01_anousu = {$r01_anousu} ";
         }
         if ($r01_mesusu != "") {
             if ($sql2 != "") {
                 $sql2 .= " and ";
             }
             $sql2 .= " r01_mesusu = {$r01_mesusu} ";
         }
         if ($r01_regist != "") {
             if ($sql2 != "") {
                 $sql2 .= " and ";
             }
             $sql2 .= " r01_regist = {$r01_regist} ";
         }
     } else {
         $sql2 = $dbwhere;
     }
     $result = db_query($sql . $sql2);
     if ($result == false) {
         $this->erro_banco = str_replace("\n", "", @pg_last_error());
         $this->erro_sql = "Cadastro de Funcionarios nao Excluído. Exclusão Abortada.\\n";
         $this->erro_sql .= "Valores : " . $r01_anousu . "-" . $r01_mesusu . "-" . $r01_regist;
         $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
         $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
         $this->erro_status = "0";
         $this->numrows_excluir = 0;
         return false;
     } else {
         if (pg_affected_rows($result) == 0) {
             $this->erro_banco = "";
             $this->erro_sql = "Cadastro de Funcionarios nao Encontrado. Exclusão não Efetuada.\\n";
             $this->erro_sql .= "Valores : " . $r01_anousu . "-" . $r01_mesusu . "-" . $r01_regist;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = 0;
             return true;
         } else {
             $this->erro_banco = "";
             $this->erro_sql = "Exclusão efetuada com Sucesso\\n";
             $this->erro_sql .= "Valores : " . $r01_anousu . "-" . $r01_mesusu . "-" . $r01_regist;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = pg_affected_rows($result);
             return true;
         }
     }
 }
 function imprime()
 {
     if ($this->modelo == 1) {
         // MODELO 1  - CARNES DE PARCELAMENTO
         if ($this->qtdcarne % 4 == 0) {
             $this->objpdf->AddPage();
         }
         $this->objpdf->SetLineWidth(0.05);
         $this->qtdcarne += 1;
         $top = $this->objpdf->GetY() - 5;
         $this->objpdf->SetFont('Arial', 'B', 8);
         $this->objpdf->SetTextColor(0, 0, 0);
         $this->objpdf->SetFillColor(250, 250, 250);
         $this->objpdf->SetX(17);
         $this->objpdf->Text(17, $top, $this->prefeitura, 0, 0, "L", 0);
         $this->objpdf->SetX(105);
         $this->objpdf->Text(105, $top, $this->prefeitura, 0, 1, "L", 0);
         $this->objpdf->SetX(170);
         $this->objpdf->SetX(17);
         $this->objpdf->SetFont('Arial', '', 7);
         $this->objpdf->Text(17, $top + 3, $this->secretaria, 0, 0, "L", 0);
         $this->objpdf->SetX(105);
         $this->objpdf->Text(105, $top + 3, $this->secretaria, 0, 1, "L", 0);
         $this->objpdf->Ln(2);
         $this->objpdf->SetFont('Arial', 'B', 8);
         $this->objpdf->SetX(10);
         $this->objpdf->Cell(90, 4, $this->tipodebito, 0, 0, "C", 0);
         $this->objpdf->SetX(105);
         $this->objpdf->Cell(90, 4, $this->tipodebito, 0, 1, "C", 0);
         $y = $this->objpdf->GetY() - 1;
         $this->objpdf->Image('imagens/files/' . $this->logo, 8, $y - 14, 8);
         $this->objpdf->Image('imagens/files/' . $this->logo, 95, $y - 14, 8);
         $this->objpdf->SetFont('Times', '', 5);
         $this->objpdf->RoundedRect(10, $y + 1, 32, 6, 2, 'DF', '1234');
         // matricula/ inscrição
         $this->objpdf->RoundedRect(43, $y + 1, 27, 6, 2, 'DF', '1234');
         // cod. de arrecadação
         $this->objpdf->RoundedRect(71, $y + 1, 20, 6, 2, 'DF', '1234');
         // parcela
         $this->objpdf->RoundedRect(10, $y + 8, 81, 12, 2, 'DF', '1234');
         // nome / endereço
         $this->objpdf->RoundedRect(10, $y + 21, 81, 14, 2, 'DF', '1234');
         // instruçoes
         $this->objpdf->RoundedRect(10, $y + 36, 39, 7, 2, 'DF', '1234');
         // vencimento
         $this->objpdf->RoundedRect(50, $y + 36, 41, 7, 2, 'DF', '1234');
         // valor
         $this->objpdf->SetFont('Arial', '', 5);
         $this->objpdf->Text(13, $y + 3, $this->titulo1);
         // matricula/ inscrição
         $this->objpdf->SetFont('Arial', 'B', 7);
         $this->objpdf->Text(13, $y + 6, $this->descr1);
         // numero da matricula ou inscricao
         $this->objpdf->SetFont('Arial', '', 5);
         $this->objpdf->Text(45, $y + 3, $this->titulo2);
         // cod. de arrecadação
         $this->objpdf->SetFont('Arial', 'B', 7);
         $this->objpdf->Text(47, $y + 6, $this->descr2);
         // numpre
         $this->objpdf->SetFont('Arial', '', 5);
         $this->objpdf->Text(73, $y + 3, $this->titulo5);
         // Parcela
         $this->objpdf->SetFont('Arial', 'B', 7);
         $this->objpdf->Text(76, $y + 6, $this->descr5);
         // Parcela inicial e total de parcelas
         $this->objpdf->SetFont('Arial', '', 5);
         $this->objpdf->Text(13, $y + 10, $this->titulo3);
         // contribuinte/endereço
         $this->objpdf->SetFont('Arial', 'B', 7);
         $this->objpdf->Text(13, $y + 13, $this->descr3_1);
         // nome do contribuinte
         $this->objpdf->Text(13, $y + 16, $this->descr3_2);
         // endereço
         $this->objpdf->SetFont('Arial', '', 5);
         $this->objpdf->Text(13, $y + 23, $this->titulo4);
         // Instruções
         $this->objpdf->SetFont('Arial', 'B', 7);
         $xx = $this->objpdf->getx();
         $yy = $this->objpdf->gety();
         $this->objpdf->setleftmargin(10);
         $this->objpdf->setrightmargin(120);
         $this->objpdf->sety($y + 23);
         $this->objpdf->multicell(0, 3, $this->descr4_1);
         // Instruções 1 - linha 1
         $this->objpdf->multicell(0, 3, $this->descr4_2);
         // Instruções 1 - linha 2
         $this->objpdf->setxy($xx, $yy);
         $this->objpdf->SetFont('Arial', '', 5);
         $this->objpdf->Text(13, $y + 38, $this->titulo6);
         // Vencimento
         $this->objpdf->SetFont('Arial', 'B', 7);
         $this->objpdf->Text(20, $y + 41, $this->descr6);
         // Data de Vencimento
         $this->objpdf->SetFont('Arial', '', 5);
         $this->objpdf->Text(53, $y + 38, $this->titulo7);
         // valor
         $this->objpdf->SetFont('Arial', 'B', 7);
         $this->objpdf->Text(56, $y + 41, $this->descr7);
         // qtd de URM ou valor
         $this->objpdf->RoundedRect(95, $y + 1, 33, 6, 2, 'DF', '1234');
         // matricula / inscricao
         $this->objpdf->RoundedRect(129, $y + 1, 27, 6, 2, 'DF', '1234');
         // cod. arrecadacao
         $this->objpdf->RoundedRect(157, $y + 1, 20, 6, 2, 'DF', '1234');
         // parcela
         $this->objpdf->RoundedRect(178, $y + 1, 31, 6, 2, 'DF', '1234');
         // livre
         $this->objpdf->RoundedRect(95, $y + 8, 82, 13, 2, 'DF', '1234');
         // nome / endereco
         $this->objpdf->RoundedRect(95, $y + 22, 114, 13, 2, 'DF', '1234');
         // instrucoes
         $this->objpdf->RoundedRect(178, $y + 8, 31, 6, 2, 'DF', '1234');
         // vencimento
         $this->objpdf->RoundedRect(178, $y + 15, 31, 6, 2, 'DF', '1234');
         // valor
         $this->objpdf->SetFont('Arial', '', 5);
         $this->objpdf->Text(97, $y + 3, $this->titulo8);
         // matricula / inscricao
         $this->objpdf->SetFont('Arial', 'B', 7);
         $this->objpdf->Text(97, $y + 6, $this->descr8);
         // numero da matricula ou inscricao
         $this->objpdf->SetFont('Arial', '', 5);
         $this->objpdf->Text(131, $y + 3, $this->titulo9);
         // cod. de arrecadação
         $this->objpdf->SetFont('Arial', 'B', 7);
         $this->objpdf->Text(133, $y + 6, $this->descr9);
         // numpre
         $this->objpdf->SetFont('Arial', '', 5);
         $this->objpdf->Text(159, $y + 3, $this->titulo10);
         // parcela
         $this->objpdf->SetFont('Arial', 'B', 7);
         $this->objpdf->Text(162, $y + 6, $this->descr10);
         // parcela e total das parcelas
         $this->objpdf->SetFont('Arial', '', 5);
         $this->objpdf->Text(180, $y + 3, $this->titulo13);
         // livre
         $this->objpdf->SetFont('Arial', 'B', 7);
         $this->objpdf->Text(183, $y + 6, $this->descr13);
         // livre
         $this->objpdf->SetFont('Arial', '', 5);
         $this->objpdf->Text(97, $y + 10, $this->titulo11);
         // contribuinte / endereço
         $this->objpdf->SetFont('Arial', 'B', 7);
         $this->objpdf->Text(97, $y + 13, $this->descr11_1);
         // nome do contribuinte
         $this->objpdf->Text(97, $y + 16, $this->descr11_2);
         // endereço
         $this->objpdf->SetFont('Arial', '', 5);
         $this->objpdf->Text(97, $y + 24, $this->titulo12);
         // instruções
         $this->objpdf->SetFont('Arial', 'B', 7);
         $xx = $this->objpdf->getx();
         $yy = $this->objpdf->gety();
         $this->objpdf->setleftmargin(97);
         $this->objpdf->setrightmargin(2);
         $this->objpdf->sety($y + 24);
         $this->objpdf->multicell(0, 3, $this->descr12_1);
         // Instruções 2 - linha 1
         $this->objpdf->multicell(0, 3, $this->descr12_2);
         // Instruções 2 - linha 2
         $this->objpdf->setxy($xx, $yy);
         $this->objpdf->SetFont('Arial', '', 5);
         $this->objpdf->Text(180, $y + 10, $this->titulo14);
         // vencimento
         $this->objpdf->SetFont('Arial', 'B', 7);
         $this->objpdf->Text(180, $y + 13, $this->descr14);
         // data de vencimento
         $this->objpdf->SetFont('Arial', '', 5);
         $this->objpdf->Text(180, $y + 17, $this->titulo15);
         // valor
         $this->objpdf->SetFont('Arial', 'B', 7);
         $this->objpdf->Text(180, $y + 20, $this->descr15);
         // total de URM ou valor
         $this->objpdf->SetLineWidth(0.05);
         $this->objpdf->SetDash(1, 1);
         //        $this->objpdf->Line(5,$y+58,205,$y+58); // linha tracejada horizontal
         $this->objpdf->Line(93, $y - 30, 93, $y + 60);
         // linha tracejada vertical
         $this->objpdf->SetDash();
         $this->objpdf->Ln(70);
         $this->objpdf->SetFillColor(0, 0, 0);
         $this->objpdf->SetFont('Arial', '', 10);
         $this->objpdf->SetFont('Arial', '', 4);
         $this->objpdf->TextWithDirection(2, $y + 30, $this->texto, 'U');
         // texto no canhoto do carne
         $this->objpdf->SetFont('Arial', '', 9);
         $this->objpdf->Text(10, $y + 46, $this->descr16_1);
         //
         $this->objpdf->Text(10, $y + 50, $this->descr16_2);
         //
         $this->objpdf->Text(10, $y + 54, $this->descr16_3);
         //
         $this->objpdf->Text(105, $y + 38, $this->linha_digitavel);
         $this->objpdf->int25(95, $y + 39, $this->codigo_barras, 15, 0.341);
         /*
                 $y = $this->objpdf->gety();
                 $this->objpdf->setleftmargin(10);
                 $this->objpdf->setrightmargin(120);
                 $this->objpdf->sety($y+28);
                 $this->objpdf->multicell(0,3,$this->descr4_1); // Instruções 1 - linha 1
                 $this->objpdf->ln(39.5);
         */
     } else {
         if ($this->modelo == 22) {
             $this->objpdf->AliasNbPages();
             $this->objpdf->AddPage();
             $this->objpdf->Setfont('Arial', 'B', 12);
             $this->objpdf->setfillcolor(245);
             $this->objpdf->roundedrect(05, 05, 200, 288, 2, 'DF', '1234');
             $this->objpdf->setfillcolor(255, 255, 255);
             $this->objpdf->roundedrect(10, 07, 190, 183, 2, 'DF', '1234');
             $this->objpdf->Image('imagens/files/' . $this->logo, 45, 9, 20);
             $this->objpdf->text(70, 15, $this->prefeitura);
             $this->objpdf->Setfont('Arial', '', 12);
             $this->objpdf->text(70, 20, $this->enderpref);
             $this->objpdf->text(70, 25, $this->municpref);
             $this->objpdf->text(70, 30, $this->telefpref);
             $this->objpdf->text(70, 35, $this->emailpref);
             $this->objpdf->setfillcolor(245);
             $this->objpdf->Roundedrect(15, 45, 110, 35, 2, 'DF', '1234');
             $this->objpdf->Setfont('Arial', '', 6);
             $this->objpdf->text(16, 47, 'Identificação:');
             $this->objpdf->Setfont('Arial', '', 8);
             $this->objpdf->text(16, 51, 'Nome :');
             $this->objpdf->text(32, 51, $this->nome);
             $this->objpdf->text(16, 56, 'Endereço :');
             $this->objpdf->text(32, 56, $this->ender);
             $this->objpdf->text(16, 60, 'Município :');
             $this->objpdf->text(32, 60, $this->munic);
             $this->objpdf->text(16, 64, 'CEP :');
             $this->objpdf->text(32, 64, $this->cep);
             $this->objpdf->text(16, 68, 'Data :');
             $this->objpdf->text(32, 68, date('d/m/Y'));
             $this->objpdf->text(50, 68, 'Hora: ' . date("H:i:s"));
             $this->objpdf->text(16, 72, $this->tipoinscr);
             $this->objpdf->text(32, 72, $this->nrinscr);
             $this->objpdf->text(16, 76, 'IP :');
             $this->objpdf->text(32, 76, $this->ip);
             $this->objpdf->Setfont('Arial', '', 6);
             $this->objpdf->Roundedrect(130, 45, 65, 35, 2, 'DF', '1234');
             $this->objpdf->text(132, 47, $this->tipoinscr);
             $this->objpdf->Setfont('Arial', '', 8);
             $this->objpdf->text(132, 50, $this->nrinscr);
             $this->objpdf->Setfont('Arial', '', 6);
             $this->objpdf->text(132, 55, 'Logradouro :');
             $this->objpdf->Setfont('Arial', '', 8);
             $this->objpdf->text(132, 58, $this->nomepri);
             $this->objpdf->Setfont('Arial', '', 6);
             $this->objpdf->text(132, 63, 'Número/Complemento :');
             $this->objpdf->Setfont('Arial', '', 8);
             $this->objpdf->text(132, 66, $this->nrpri . "      " . $this->complpri);
             $this->objpdf->Setfont('Arial', '', 6);
             $this->objpdf->text(132, 71, 'Bairro :');
             $this->objpdf->Setfont('Arial', '', 8);
             $this->objpdf->text(132, 74, $this->bairropri);
             $this->objpdf->Setfont('Arial', 'B', 11);
             $this->objpdf->text(70, 87, 'RECIBO VÁLIDO ATÉ: ' . $this->datacalc);
             $this->objpdf->setfillcolor(245);
             $this->objpdf->Roundedrect(15, 90, 180, 65, 2, 'DF', '1234');
             $this->objpdf->Setfont('Arial', '', 8);
             $this->objpdf->SetXY(17, 96);
             if ($this->taxabanc != 0) {
                 $this->objpdf->Cell(20, 4, 'Taxa Bancária', 0, 0, "L", 0);
                 $this->objpdf->Cell(20, 4, db_formatar($this->taxabanc, 'f'), 0, 1, "R", 0);
             }
             for ($i = 0; $i < $this->linhasdadospagto; $i++) {
                 $this->objpdf->setx(17);
                 $this->objpdf->cell(5, 4, trim(pg_result($this->recorddadospagto, $i, $this->receita)), 0, 0, "C", 0);
                 if (trim(pg_result($this->recorddadospagto, $i, $this->ddreceita)) == '') {
                     $this->objpdf->cell(70, 4, trim(pg_result($this->recorddadospagto, $i, $this->dreceita)), 0, 0, "L", 0);
                 } else {
                     $this->objpdf->cell(70, 4, trim(pg_result($this->recorddadospagto, $i, $this->ddreceita)), 0, 0, "L", 0);
                 }
                 $this->objpdf->cell(15, 4, db_formatar(pg_result($this->recorddadospagto, $i, $this->valor), 'f'), 0, 1, "R", 0);
             }
             $this->objpdf->SetXY(15, 158);
             $this->objpdf->multicell(0, 4, 'HISTÓRICO :   ' . $this->historico);
             $this->objpdf->setx(15);
             $this->objpdf->multicell(0, 4, $this->histparcel);
             $this->objpdf->setfillcolor(255, 255, 255);
             $this->objpdf->Roundedrect(10, 195, 190, 46, 2, 'DF', '1234');
             $this->objpdf->setfont('Arial', '', 6);
             $this->objpdf->setfillcolor(245);
             $this->objpdf->Roundedrect(40, 200, 48, 10, 2, 'DF', '1234');
             $this->objpdf->Roundedrect(93, 200, 48, 10, 2, 'DF', '1234');
             $this->objpdf->Roundedrect(146, 200, 48, 10, 2, 'DF', '1234');
             $this->objpdf->text(42, 202, 'Vencimento');
             $this->objpdf->text(95, 202, 'Código de Arrecadação');
             $this->objpdf->text(148, 202, 'Valor a Pagar');
             $this->objpdf->setfont('Arial', '', 10);
             $this->objpdf->text(48, 207, $this->dtvenc);
             $this->objpdf->text(101, 207, $this->numpre);
             $this->objpdf->text(153, 207, $this->valtotal);
             $this->objpdf->SetDash(0.8, 0.8);
             $this->objpdf->line(5, 242.5, 205, 242.5);
             $this->objpdf->SetDash();
             $this->objpdf->setfillcolor(255, 255, 255);
             $this->objpdf->Roundedrect(10, 244, 190, 46, 2, 'DF', '1234');
             $this->objpdf->setfont('Arial', '', 12);
             $this->objpdf->setfillcolor(0, 0, 0);
             $this->objpdf->Image('imagens/files/' . $this->logo, 12, 200, 25);
             $this->objpdf->text(60, 218, $this->linhadigitavel);
             $this->objpdf->int25(60, 220, $this->codigobarras, 15, 0.341);
             $this->objpdf->setfillcolor(245);
             $this->objpdf->Roundedrect(40, 250, 48, 10, 2, 'DF', '1234');
             $this->objpdf->Roundedrect(93, 250, 48, 10, 2, 'DF', '1234');
             $this->objpdf->Roundedrect(146, 250, 48, 10, 2, 'DF', '1234');
             $this->objpdf->setfont('Arial', '', 6);
             $this->objpdf->text(42, 252, 'Vencimento');
             $this->objpdf->text(95, 252, 'Código de Arrecadação');
             $this->objpdf->text(148, 252, 'Valor a Pagar');
             $this->objpdf->setfont('Arial', '', 10);
             $this->objpdf->text(48, 257, $this->dtvenc);
             $this->objpdf->text(101, 257, $this->numpre);
             $this->objpdf->text(153, 257, $this->valtotal);
             $this->objpdf->Image('imagens/files/' . $this->logo, 12, 250, 25);
             $this->objpdf->SetFont('Arial', '', 5);
             $this->objpdf->text(10, $this->objpdf->h - 2, 'Base: ' . @$GLOBALS["DB_NBASE"]);
             $this->objpdf->setfillcolor(0, 0, 0);
             $this->objpdf->setfont('Arial', '', 12);
             $this->objpdf->text(60, 268, $this->linhadigitavel);
             $this->objpdf->int25(60, 270, $this->codigobarras, 15, 0.341);
         } else {
             if ($this->modelo == 3) {
                 $this->objpdf->SetTextColor(0, 0, 0);
                 $this->objpdf->SetFont('Arial', 'B', 12);
                 $coluna = 44;
                 $linha = 35;
                 $this->objpdf->SetLineWidth(1);
                 $this->objpdf->RoundedRect(37, 0.2, 137, 195, 2, '1234');
                 $this->objpdf->SetLineWidth(0.5);
                 $this->objpdf->roundedrect(39, 2, 133, 191, 2, '1234');
                 $this->objpdf->SetLineWidth(0.2);
                 $this->objpdf->Image('imagens/files/Brasao.png', 43, 5, 20);
                 $this->objpdf->Image('imagens/files/Brasao.jpg', 60, 30, 100);
                 //	$this->objpdf->roundedrect(42,$linha+30,127,35,2,'1234');
                 //	$this->objpdf->roundedrect(42,$linha+72,127,15,2,'1234'); // obs da atividade principal
                 //  	$this->objpdf->roundedrect(42,$linha+88,127,5,2,'1234'); // descricao da atividade secundaria
                 //	$this->objpdf->roundedrect(42,$linha+94,127,15,2,'1234'); // obs da atividade secundaria
                 //	$this->objpdf->setdrawcolor(235);
                 $this->objpdf->setxy(65, 5);
                 $this->objpdf->setfont('Arial', 'B', 13);
                 $this->objpdf->Multicell(0, 8, $this->prefeitura, "C");
                 // prefeitura
                 $this->objpdf->setxy(65, 10);
                 $this->objpdf->setfont('Arial', 'B', 13);
                 $this->objpdf->setleftmargin(50);
                 $this->objpdf->setrightmargin(50);
                 $this->objpdf->Multicell(0, 8, $this->tipoalvara, 0, "C", 0);
                 // tipo de alvara
                 $this->objpdf->settextcolor(150);
                 $this->objpdf->setxy(85, 25);
                 $this->objpdf->setfont('Arial', 'B', 60);
                 $this->objpdf->Multicell(0, 8, date('Y'), "C");
                 // exercicio
                 $this->objpdf->settextcolor(0, 0, 0);
                 $this->objpdf->setxy(84, 24);
                 $this->objpdf->setfont('Arial', 'B', 60);
                 $this->objpdf->Multicell(0, 8, date('Y'), "C");
                 // exercicio
                 $this->objpdf->Ln(6);
                 //	$this->objpdf->sety(38);
                 $this->objpdf->SetFont('Arial', '', 11);
                 $this->objpdf->Multicell(0, 6, $this->texto);
                 // texto
                 $this->objpdf->SetFont('Arial', 'B', 9);
                 $this->objpdf->Text($coluna, $linha + 35, 'CCM:');
                 // atividade / inscricao
                 $this->objpdf->SetFont('Arial', '', 9);
                 $this->objpdf->Text($coluna + 40, $linha + 35, $this->ativ . ' / ' . $this->nrinscr);
                 // atividade / inscricao
                 $this->objpdf->SetFont('Arial', 'B', 9);
                 $this->objpdf->Text($coluna, $linha + 39, "NOME/RAZAO SOCIAL: ");
                 // nome
                 $this->objpdf->SetFont('Arial', '', 9);
                 $this->objpdf->Text($coluna + 40, $linha + 39, $this->nome);
                 // nome
                 $this->objpdf->SetFont('Arial', 'B', 9);
                 $this->objpdf->Text($coluna, $linha + 43, "ENDEREÇO: ");
                 // endereco
                 $this->objpdf->SetFont('Arial', '', 9);
                 $this->objpdf->Text($coluna + 40, $linha + 43, $this->ender);
                 // endereco
                 $this->objpdf->SetFont('Arial', 'B', 9);
                 $this->objpdf->Text($coluna, $linha + 47, "NÚMERO: ");
                 // endereco
                 $this->objpdf->SetFont('Arial', '', 9);
                 $this->objpdf->Text($coluna + 40, $linha + 47, $this->numero == "" ? "" : $this->numero);
                 if ($this->compl != "") {
                     $this->objpdf->SetFont('Arial', 'B', 9);
                     $this->objpdf->Text($coluna + 60, $linha + 47, "COMPLEMENTO: ");
                     // endereco
                     $this->objpdf->SetFont('Arial', '', 9);
                     $this->objpdf->Text($coluna + 90, $linha + 47, $this->compl == "" ? "" : $this->compl);
                 }
                 $this->objpdf->setx(40);
                 if ($this->q02_memo != '') {
                     $this->objpdf->SetFont('Arial', 'B', 9);
                     $this->objpdf->Text($coluna, $linha + 51, "OBSERVAÇÃO: ");
                     // observação
                     $this->objpdf->SetFont('Arial', '', 9);
                     $this->objpdf->sety($linha + 52);
                     $this->objpdf->Multicell(0, 3, $this->q02_memo);
                     // texto
                     $this->objpdf->SetFont('Arial', 'B', 10);
                     $this->objpdf->roundedrect(42, $linha + 30, 127, 35, 2, '1234');
                     $linha = 102;
                 } else {
                     $this->objpdf->roundedrect(42, $linha + 30, 127, 20, 2, '1234');
                     $linha = 87;
                 }
                 $this->objpdf->sety($linha);
                 $this->objpdf->roundedrect(42, $linha - 1, 127, 5, 2, '1234');
                 $this->objpdf->SetFont('Arial', 'B', 8);
                 $this->objpdf->Ln(0.5);
                 $this->objpdf->setx(45);
                 $this->objpdf->Multicell(0, 3, "ATIVIDADE PRINCIPAL: " . $this->descrativ);
                 // descrição da atividade principal
                 $linha += 6;
                 $obs = '';
                 if (isset($this->q03_atmemo[$this->ativ])) {
                     if ($this->q03_atmemo[$this->ativ] != '') {
                         $this->objpdf->roundedrect(42, $linha - 1, 127, 15, 2, '1234');
                         // obs da atividade principal
                         $obs = $this->q03_atmemo[$this->ativ];
                         $this->objpdf->Ln(3);
                         $this->objpdf->SetFont('Arial', '', 7);
                         $this->objpdf->Multicell(0, 3, $this->q03_atmemo[$this->ativ]);
                         // texto
                         $linha += 16;
                     }
                 }
                 $this->objpdf->sety($linha);
                 $num_outras = count($this->outrasativs);
                 $x = 105;
                 if ($num_outras > 0) {
                     $x = $x + 4;
                     reset($this->outrasativs);
                     for ($i = 0; $i < $num_outras; $i++) {
                         $yyy = $this->objpdf->gety();
                         $chave = key($this->outrasativs);
                         $obs = '';
                         if (isset($this->q03_atmemo[$chave])) {
                             $obs = $this->q03_atmemo[$chave];
                         }
                         $this->objpdf->SetFont('Arial', 'B', 8);
                         //             $this->objpdf->roundedrect(42,$yyy-1,127,5,2,'1234'); // descricao da atividade secundaria
                         $this->objpdf->Ln(0.5);
                         $this->objpdf->setx(45);
                         $this->objpdf->Multicell(0, 3, "ATIVIDADE SECUNDÁRIA: " . $this->outrasativs[$chave]);
                         // texto
                         $linha += 6;
                         if ($obs != "") {
                             $this->objpdf->roundedrect(42, $linha - 1, 127, 15, 2, '1234');
                             // obs da atividade secundaria
                             $this->objpdf->Ln(3);
                             $this->objpdf->SetFont('Arial', '', 7);
                             $this->objpdf->Multicell(0, 3, $obs);
                             // texto
                             $linha += 16;
                         }
                         $x = $x + 4;
                         next($this->outrasativs);
                         //             $this->objpdf->ln(2.5);
                         $this->objpdf->sety($linha);
                     }
                 }
                 $x = 64;
                 //        if($this->q02_obs!=''){
                 //	  $this->objpdf->Text($coluna,$linha+$x,"OBSERVAÇÃO: "); // descrição da atividade principal
                 //	  $this->objpdf->Text($coluna + 45,$linha+$x,$this->q02_obs); // descrição da atividade principal
                 //	  $x=$x+4;
                 //	}
                 //        $linha = $this->objpdf->gety();
                 $this->objpdf->SetFont('Arial', 'B', 12);
                 $this->objpdf->Text($coluna + 55, $linha + 5, "Sapiranga, " . date('d') . " de " . db_mes(date('m')) . " de " . date('Y') . ".");
                 // data
                 $this->objpdf->sety(125);
                 $this->objpdf->SetFont('Arial', '', 9);
                 $this->objpdf->Multicell(0, 6, $this->obs);
                 // observação
                 $this->objpdf->setfont('arial', '', 6);
                 $this->objpdf->SetXY($coluna - 18, 165);
                 $this->objpdf->MultiCell(90, 4, '..........................................................................................' . "\n" . 'SECRETÁRIO DA IND. COM. E TURISMO', 0, "C", 0);
                 $this->objpdf->SetXY($coluna + 50, 165);
                 $this->objpdf->MultiCell(90, 4, '..........................................................................................', 0, "C", 0);
                 //        $this->objpdf->SetXY($coluna-35,160);
                 //        $this->objpdf->MultiCell(90,4,'..........................................................................................'."\n".'SECRETÁRIO DA IND. COM. E TURISMO',0,"C",0);
                 //        $this->objpdf->SetXY($coluna+35,160);
                 //        $this->objpdf->MultiCell(90,4,'..........................................................................................',0,"C",0);
                 $this->objpdf->sety(180);
                 $this->objpdf->setfont('arial', 'B', 12);
                 $this->objpdf->multicell(0, 8, 'FIXAR EM LUGAR VISÍVEL', 1, "C");
                 $this->objpdf->SetFont('Arial', 'B', 10);
             } else {
                 if ($this->modelo == 4) {
                     // BOLETO BANCÁRIO
                     $linha = 186;
                     $pdf->Line(47, $linha, 47, $linha + 9);
                     $pdf->Line(63, $linha, 63, $linha + 9);
                     $pdf->SetLineWidth(0.6);
                     $pdf->Line(10, $linha + 9, 195, $linha + 9);
                     $pdf->SetLineWidth(0.2);
                     $pdf->Line(10, $linha + 17, 195, $linha + 17);
                     $pdf->Line(10, $linha + 25, 195, $linha + 25);
                     $pdf->Line(10, $linha + 33, 195, $linha + 33);
                     $pdf->Line(10, $linha + 41, 195, $linha + 41);
                     $pdf->Line(149, $linha + 49, 195, $linha + 49);
                     $pdf->Line(149, $linha + 57, 195, $linha + 57);
                     $pdf->Line(149, $linha + 65, 195, $linha + 65);
                     $pdf->Line(149, $linha + 73, 195, $linha + 73);
                     $pdf->Line(10, $linha + 81, 195, $linha + 81);
                     $pdf->Line(149, $linha + 9, 149, $linha + 81);
                     $pdf->Line(169, $linha + 9, 169, $linha + 17);
                     $pdf->Line(40, $linha + 25, 40, $linha + 33);
                     $pdf->Line(86, $linha + 25, 86, $linha + 33);
                     $pdf->Line(112, $linha + 25, 112, $linha + 33);
                     $pdf->Line(125, $linha + 25, 125, $linha + 33);
                     $pdf->Line(45, $linha + 33, 45, $linha + 41);
                     $pdf->Line(65, $linha + 33, 65, $linha + 41);
                     $pdf->Line(91, $linha + 33, 91, $linha + 41);
                     $pdf->Line(121, $linha + 33, 121, $linha + 41);
                     $pdf->Line(10, $linha + 93, 195, $linha + 93);
                     //codigo de barras
                     $this->objpdf->SetFillColor(0, 0, 0);
                     $this->objpdf->int25(10, $linha + 94, $this->codigo_barras, 20, 0.341);
                     // quadrado inferior //
                     $this->objpdf->Image('imagens/files/Brasao.png', 10, 187, 35, 7);
                     $this->objpdf->SetFont('Arial', 'b', 14);
                     $this->objpdf->Text(49, $linha + 7, $this->numbanco);
                     // numero do banco
                     $this->objpdf->SetFont('Arial', 'b', 11);
                     $this->objpdf->Text(70, $linha + 7, $this->linha_digitavel);
                     $this->objpdf->SetFont('Arial', 'b', 5);
                     $this->objpdf->Text(13, $linha + 11, "Local de Pagamento");
                     $this->objpdf->Text(151, $linha + 11, "Parcela");
                     $this->objpdf->Text(171, $linha + 11, "Vencimento");
                     $this->objpdf->Text(13, $linha + 19, "Cedente");
                     $this->objpdf->Text(151, $linha + 19, "Agência/Código Cedente");
                     $this->objpdf->Text(13, $linha + 27, "Data do Documento");
                     $this->objpdf->Text(42, $linha + 27, "Número do Documento");
                     $this->objpdf->Text(88, $linha + 27, "Espécie Doc.");
                     $this->objpdf->Text(114, $linha + 27, "Aceite");
                     $this->objpdf->Text(127, $linha + 27, "Data do Processamento");
                     $this->objpdf->Text(151, $linha + 27, "Nosso Número");
                     $this->objpdf->Text(13, $linha + 35, "Código do Cedente");
                     $this->objpdf->Text(47, $linha + 35, "Carteira");
                     $this->objpdf->Text(67, $linha + 35, "Espécie");
                     $this->objpdf->Text(93, $linha + 35, "Quantidade");
                     $this->objpdf->Text(123, $linha + 35, "Valor");
                     $this->objpdf->Text(151, $linha + 35, "( = ) Valor do Documento");
                     $this->objpdf->Text(13, $linha + 43, "Instruções");
                     $this->objpdf->Text(151, $linha + 43, "( - ) Desconto / Abatimento");
                     $this->objpdf->Text(151, $linha + 51, "( - ) Outras Deduções");
                     $this->objpdf->Text(151, $linha + 59, "( + ) Mora / Multa");
                     $this->objpdf->Text(151, $linha + 67, "( + ) Outros Acrécimos");
                     $this->objpdf->Text(151, $linha + 75, "( = ) Valor Cobrado");
                     $this->objpdf->Text(13, $linha + 83, "Sacado");
                     $this->objpdf->Text(13, $linha + 91, "Sacador/Avalista");
                     $this->objpdf->Text(160, $linha + 99, "Autenticação Mecânica");
                     $this->objpdf->SetFont('Arial', 'b', 8);
                     $this->objpdf->Text(13, $linha + 15, $this->localpagamento);
                     // local de pagamento
                     $this->objpdf->SetFont('Arial', '', 10);
                     $this->objpdf->Text(151, $linha + 15, $this->parcela);
                     // parcela
                     $this->objpdf->Text(171, $linha + 15, $this->dtvenc);
                     // vencimento
                     $this->objpdf->Text(13, $linha + 23, $this->cedente);
                     // cedente
                     $this->objpdf->Text(151, $linha + 23, $this->agencia_cedente);
                     // agencia do cedente
                     $this->objpdf->Text(13, $linha + 31, $this->data_documento);
                     // data do documento
                     $this->objpdf->Text(42, $linha + 31, $this->numero_documento);
                     // numero do documento
                     $this->objpdf->Text(88, $linha + 31, $this->especie_doc);
                     // especie do documento
                     $this->objpdf->Text(114, $linha + 31, $this->aceite);
                     // aceite
                     $this->objpdf->Text(127, $linha + 31, $this->data_processamento);
                     // data do processamento
                     $this->objpdf->Text(151, $linha + 31, $this->nosso_numero);
                     // nosso numero
                     $this->objpdf->Text(13, $linha + 39, $this->codigo_cedente);
                     // codigo do cedente
                     $this->objpdf->Text(47, $linha + 39, $this->carteira);
                     // carteira
                     $this->objpdf->Text(67, $linha + 39, $this->especie);
                     // especie
                     $this->objpdf->Text(93, $linha + 39, $this->quantidade);
                     // quantidade
                     $this->objpdf->Text(123, $linha + 39, $this->valor);
                     // valor
                     $this->objpdf->Text(151, $linha + 39, $this->valor_documento);
                     // valor do documento
                     $this->objpdf->Text(20, $linha + 54, $this->instrucoes1);
                     // instrucoes 1
                     $this->objpdf->Text(20, $linha + 58, $this->instrucoes2);
                     // instrucoes 2
                     $this->objpdf->Text(20, $linha + 62, $this->instrucoes3);
                     // instrucoes 3
                     $this->objpdf->Text(15, $linha + 70, $this->instrucoes4);
                     // instrucoes 4
                     $this->objpdf->Text(20, $linha + 74, $this->instrucoes5);
                     // instrucoes 5
                     $this->objpdf->Text(151, $linha + 47, $this->desconto_abatimento);
                     // desconto/abatimento
                     $this->objpdf->Text(151, $linha + 55, $this->outras_deducoes);
                     // outras deducoes
                     $this->objpdf->Text(151, $linha + 63, $this->mora_multa);
                     // multa
                     $this->objpdf->Text(151, $linha + 71, $this->outros_acrecimos);
                     // outros acrescimos
                     $this->objpdf->Text(151, $linha + 79, $this->valor_cobrado);
                     // valor cobrado
                     $this->objpdf->Text(29, $linha + 85, $this->sacado1);
                     // sacado 1
                     $this->objpdf->Text(29, $linha + 88, $this->sacado2);
                     // sacado 2
                     $this->objpdf->Text(29, $linha + 91, $this->sacado3);
                     // sacado 3
                 } else {
                     if ($this->modelo == 2) {
                         //// RECIBO
                         $this->objpdf->AliasNbPages();
                         $this->objpdf->AddPage();
                         $this->objpdf->settopmargin(1);
                         $this->objpdf->line(2, 148.5, 208, 148.5);
                         $xlin = 20;
                         $xcol = 4;
                         for ($i = 0; $i < 2; $i++) {
                             $this->objpdf->setfillcolor(245);
                             $this->objpdf->roundedrect($xcol - 2, $xlin - 18, 206, 144.5, 2, 'DF', '1234');
                             $this->objpdf->setfillcolor(255, 255, 255);
                             //		$this->objpdf->roundedrect(10,07,190,183,2,'DF','1234');
                             $this->objpdf->Setfont('Arial', 'B', 11);
                             $this->objpdf->text(150, $xlin - 13, 'RECIBO VÁLIDO ATÉ: ');
                             $this->objpdf->text(159, $xlin - 8, $this->datacalc);
                             $this->objpdf->Image('imagens/files/' . $this->logo, 15, $xlin - 17, 12);
                             $this->objpdf->Setfont('Arial', 'B', 9);
                             $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                             $this->objpdf->Setfont('Arial', '', 9);
                             $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                             $this->objpdf->text(40, $xlin - 8, $this->municpref);
                             $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                             $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                             //		$this->objpdf->setfillcolor(245);
                             $this->objpdf->Roundedrect($xcol, $xlin + 2, $xcol + 119, 20, 2, 'DF', '1234');
                             $this->objpdf->Setfont('Arial', '', 6);
                             $this->objpdf->text($xcol + 2, $xlin + 4, 'Identificação:');
                             $this->objpdf->Setfont('Arial', '', 8);
                             $this->objpdf->text($xcol + 2, $xlin + 7, $this->tipoinscr);
                             $this->objpdf->text($xcol + 17, $xlin + 7, $this->nrinscr);
                             $this->objpdf->text($xcol + 30, $xlin + 7, 'Nome :');
                             $this->objpdf->text($xcol + 40, $xlin + 7, $this->nome);
                             $this->objpdf->text($xcol + 2, $xlin + 11, 'Endereço :');
                             $this->objpdf->text($xcol + 17, $xlin + 11, $this->ender);
                             $this->objpdf->text($xcol + 2, $xlin + 15, 'Município :');
                             $this->objpdf->text($xcol + 17, $xlin + 15, $this->munic);
                             $this->objpdf->text($xcol + 75, $xlin + 15, 'CEP :');
                             $this->objpdf->text($xcol + 82, $xlin + 15, $this->cep);
                             $this->objpdf->text($xcol + 2, $xlin + 19, 'Data :');
                             $this->objpdf->text($xcol + 17, $xlin + 19, date("d-m-Y", db_getsession("DB_datausu")));
                             $this->objpdf->text($xcol + 40, $xlin + 19, 'Hora: ' . date("H:i:s"));
                             $this->objpdf->text($xcol + 75, $xlin + 19, 'IP :');
                             $this->objpdf->text($xcol + 82, $xlin + 19, $this->ip);
                             $this->objpdf->Setfont('Arial', '', 6);
                             $this->objpdf->Roundedrect($xcol + 126, $xlin + 2, 76, 20, 2, 'DF', '1234');
                             $this->objpdf->text($xcol + 128, $xlin + 7, $this->tipoinscr1);
                             $this->objpdf->text($xcol + 145, $xlin + 7, $this->nrinscr1);
                             $this->objpdf->text($xcol + 128, $xlin + 11, $this->tipolograd);
                             $this->objpdf->text($xcol + 145, $xlin + 11, $this->nomepri);
                             $this->objpdf->text($xcol + 128, $xlin + 15, $this->tipocompl);
                             $this->objpdf->text($xcol + 145, $xlin + 15, $this->nrpri . "      " . $this->complpri);
                             $this->objpdf->text($xcol + 128, $xlin + 19, $this->tipobairro);
                             $this->objpdf->text($xcol + 145, $xlin + 19, $this->bairropri);
                             //		$this->objpdf->setfillcolor(245);
                             $this->objpdf->Roundedrect($xcol, $xlin + 24, 202, 45, 2, 'DF', '1234');
                             $this->objpdf->sety($xlin + 24);
                             $maiscol = 0;
                             $yy = $this->objpdf->gety();
                             for ($ii = 0; $ii < $this->linhasdadospagto; $ii++) {
                                 if ($ii == 14) {
                                     $maiscol = 100;
                                     $this->objpdf->sety($yy);
                                 }
                                 if ($ii == 0 || $ii == 14) {
                                     $this->objpdf->setx($xcol + 3 + $maiscol);
                                     $this->objpdf->cell(5, 3, "Rec", 0, 0, "L", 0);
                                     $this->objpdf->cell(7, 3, "Reduz", 0, 0, "L", 0);
                                     $this->objpdf->cell(63, 3, "Descrição", 0, 0, "L", 0);
                                     $this->objpdf->cell(15, 3, "Valor", 0, 1, "R", 0);
                                 }
                                 $this->objpdf->setx($xcol + 3 + $maiscol);
                                 $this->objpdf->cell(5, 3, trim(pg_result($this->recorddadospagto, $ii, $this->receita)), 0, 0, "R", 0);
                                 $this->objpdf->cell(7, 3, "(" . trim(pg_result($this->recorddadospagto, $ii, $this->receitared)) . ")", 0, 0, "R", 0);
                                 if (trim(pg_result($this->recorddadospagto, $ii, $this->ddreceita)) == '') {
                                     $this->objpdf->cell(63, 3, trim(pg_result($this->recorddadospagto, $ii, $this->dreceita)), 0, 0, "L", 0);
                                 } else {
                                     $this->objpdf->cell(63, 3, trim(pg_result($this->recorddadospagto, $ii, $this->ddreceita)), 0, 0, "L", 0);
                                 }
                                 $this->objpdf->cell(15, 3, db_formatar(pg_result($this->recorddadospagto, $ii, $this->valor), 'f'), 0, 1, "R", 0);
                             }
                             $this->objpdf->Roundedrect($xcol, $xlin + 71, 202, 30, 2, 'DF', '1234');
                             $this->objpdf->SetY($xlin + 72);
                             $this->objpdf->SetX($xcol + 3);
                             $this->objpdf->multicell(0, 4, 'HISTÓRICO :   ' . $this->historico);
                             $this->objpdf->SetX($xcol + 3);
                             $this->objpdf->multicell(0, 4, $this->histparcel);
                             $this->objpdf->Setfont('Arial', '', 6);
                             $this->objpdf->setx(15);
                             $this->objpdf->Roundedrect(128, $xlin + 103, 38, 10, 2, 'DF', '1234');
                             $this->objpdf->Roundedrect(168, $xlin + 103, 38, 10, 2, 'DF', '1234');
                             $this->objpdf->Roundedrect(146, $xlin + 115, 40, 10, 2, 'DF', '1234');
                             $this->objpdf->text(130, $xlin + 105, 'Vencimento');
                             $this->objpdf->text(170, $xlin + 105, 'Código de Arrecadação');
                             $this->objpdf->text(148, $xlin + 118, 'Valor a Pagar');
                             $this->objpdf->setfont('Arial', '', 10);
                             $this->objpdf->text(135, $xlin + 110, $this->dtvenc);
                             $this->objpdf->text(170, $xlin + 110, $this->numpre);
                             $this->objpdf->text(155, $xlin + 123, $this->valtotal);
                             $this->objpdf->setfillcolor(0, 0, 0);
                             $this->objpdf->SetFont('Arial', '', 4);
                             //	        $this->objpdf->TextWithDirection(1.5,$xlin+60,$this->texto,'U'); // texto no canhoto do carne
                             $this->objpdf->TextWithDirection(1.5, $xlin + 60, $this->texto . ' - ' . ($i == 1 ? '2ª VIA' : '1ª VIA'), 'U');
                             // texto no canhoto do carne
                             $this->objpdf->setfont('Arial', '', 11);
                             $this->objpdf->text(10, $xlin + 108, $this->linhadigitavel);
                             $this->objpdf->int25(10, $xlin + 110, $this->codigobarras, 15, 0.341);
                             $xlin = 169;
                         }
                     } else {
                         if ($this->modelo == 5) {
                             ////////// MODELO 5  -  AUTORIZACAO DE EMPENHO
                             if (strtoupper(trim($this->municpref)) == 'GUAIBA') {
                                 $this->objpdf->AliasNbPages();
                                 $this->objpdf->AddPage();
                                 $this->objpdf->settopmargin(1);
                                 $pagina = 1;
                                 $xlin = 20;
                                 $xcol = 4;
                                 $this->objpdf->setfillcolor(245);
                                 $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                 $this->objpdf->setfillcolor(255, 255, 255);
                                 $this->objpdf->Setfont('Arial', 'B', 9);
                                 $this->objpdf->text(130, $xlin - 13, 'AUTORIZAÇÃO DE EMPENHO N' . CHR(176));
                                 $this->objpdf->text(185, $xlin - 13, db_formatar($this->numaut, 's', '0', 6, 'e'));
                                 $this->objpdf->text(137.5, $xlin - 8, 'PROCESSO DE COMPRA N' . CHR(176));
                                 $this->objpdf->text(185, $xlin - 8, db_formatar(pg_result($this->recorddositens, 0, $this->Snumeroproc), 's', '0', 6, 'e'));
                                 $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                 //.$this->logo
                                 $this->objpdf->Setfont('Arial', 'B', 9);
                                 $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                 $this->objpdf->Setfont('Arial', '', 7);
                                 $this->objpdf->text(40, $xlin - 12, $this->enderpref);
                                 $this->objpdf->text(40, $xlin - 9, $this->municpref);
                                 $this->objpdf->text(40, $xlin - 6, $this->telefpref);
                                 $this->objpdf->text(40, $xlin - 3, $this->emailpref);
                                 $this->objpdf->text(40, $xlin, db_formatar($this->cgcpref, 'cnpj'));
                                 $this->objpdf->rect($xcol, $xlin + 2, $xcol + 100, 28, 2, 'DF', '1234');
                                 $this->objpdf->Setfont('Arial', '', 6);
                                 $this->objpdf->text($xcol + 2, $xlin + 4, 'Dados da Compra');
                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                 $this->objpdf->text($xcol + 2, $xlin + 8, 'Licitação');
                                 $this->objpdf->text($xcol + 2, $xlin + 12, 'Tipo de Compra');
                                 $this->objpdf->text($xcol + 2, $xlin + 16, 'Prazo de Entrega');
                                 $this->objpdf->text($xcol + 2, $xlin + 20, 'Observações');
                                 $this->objpdf->text($xcol + 2, $xlin + 24, 'Cond.de Pagto');
                                 $this->objpdf->text($xcol + 2, $xlin + 28, 'Outras Condições');
                                 $this->objpdf->Setfont('Arial', '', 8);
                                 $this->objpdf->text($xcol + 27, $xlin + 8, ':  ' . $this->num_licitacao . '  -  ' . $this->descr_licitacao);
                                 $this->objpdf->text($xcol + 27, $xlin + 12, ':  ' . $this->descr_tipocompra);
                                 $this->objpdf->text($xcol + 27, $xlin + 16, ':  ' . $this->prazo_ent);
                                 $this->objpdf->text($xcol + 27, $xlin + 20, ':  ' . $this->obs);
                                 $this->objpdf->text($xcol + 27, $xlin + 24, ':  ' . $this->cond_pag);
                                 $this->objpdf->text($xcol + 27, $xlin + 28, ':  ' . $this->out_cond);
                                 $this->objpdf->rect($xcol + 106, $xlin + 2, 96, 28, 2, 'DF', '1234');
                                 $this->objpdf->Setfont('Arial', '', 6);
                                 $this->objpdf->text($xcol + 110, $xlin + 4, 'Dados da Dotação');
                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                 $this->objpdf->text($xcol + 108, $xlin + 8, 'Dotação');
                                 $this->objpdf->text($xcol + 108, $xlin + 11.5, 'Órgão');
                                 $this->objpdf->text($xcol + 108, $xlin + 15, 'Unidade');
                                 $this->objpdf->text($xcol + 108, $xlin + 18.5, 'Proj/Ativ');
                                 $this->objpdf->text($xcol + 108, $xlin + 22, 'Elemento');
                                 $this->objpdf->text($xcol + 108, $xlin + 25.5, 'Recurso');
                                 $this->objpdf->text($xcol + 178, $xlin + 25.5, 'Reduz');
                                 $this->objpdf->text($xcol + 108, $xlin + 29, 'Destino');
                                 $this->objpdf->Setfont('Arial', '', 8);
                                 $this->objpdf->text($xcol + 122, $xlin + 8, ':  ' . $this->dotacao);
                                 $this->objpdf->text($xcol + 122, $xlin + 11.5, ':  ' . db_formatar($this->orgao, 'orgao') . ' - ' . $this->descr_orgao);
                                 $this->objpdf->text($xcol + 122, $xlin + 15, ':  ' . db_formatar($this->orgao, 'orgao') . db_formatar($this->unidade, 'unidade') . ' - ' . $this->descr_unidade);
                                 $this->objpdf->text($xcol + 122, $xlin + 18.5, ':  ' . db_formatar($this->projativ, 'projativ') . ' - ' . $this->descr_projativ);
                                 $this->objpdf->text($xcol + 122, $xlin + 22, ':  ' . $this->descrdotacao);
                                 $this->objpdf->text($xcol + 122, $xlin + 25.5, ':  ' . $this->recurso . ' - ' . $this->descr_recurso);
                                 $this->objpdf->text($xcol + 188, $xlin + 25.5, ':  ' . $this->coddot . '-' . db_CalculaDV($this->coddot));
                                 $this->objpdf->text($xcol + 122, $xlin + 29, ':  ' . $this->destino);
                                 $this->objpdf->rect($xcol, $xlin + 32, $xcol + 198, 20, 2, 'DF', '1234');
                                 $this->objpdf->Setfont('Arial', '', 6);
                                 $this->objpdf->text($xcol + 2, $xlin + 34, 'Dados do Credor');
                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                 $this->objpdf->text($xcol + 109, $xlin + 38, 'Numcgm');
                                 $this->objpdf->text($xcol + 150, $xlin + 38, strlen($this->cnpj) == 11 ? 'CPF' : 'CNPJ');
                                 $this->objpdf->text($xcol + 2, $xlin + 38, 'Nome');
                                 $this->objpdf->text($xcol + 2, $xlin + 42, 'Endereço');
                                 $this->objpdf->text($xcol + 102, $xlin + 42, 'Complemento');
                                 $this->objpdf->text($xcol + 2, $xlin + 46, 'Município');
                                 $this->objpdf->text($xcol + 115, $xlin + 46, 'CEP');
                                 $this->objpdf->text($xcol + 2, $xlin + 50, 'Contato');
                                 $this->objpdf->text($xcol + 110, $xlin + 50, 'Telefone');
                                 $this->objpdf->Setfont('Arial', '', 8);
                                 $this->objpdf->text($xcol + 159, $xlin + 38, ':  ' . (strlen($this->cnpj) == 11 ? db_formatar($this->cnpj, 'cpf') : db_formatar($this->cnpj, 'cnpj')));
                                 $this->objpdf->text($xcol + 122, $xlin + 38, ':  ' . $this->numcgm);
                                 $this->objpdf->text($xcol + 18, $xlin + 38, ':  ' . $this->nome);
                                 $this->objpdf->text($xcol + 18, $xlin + 42, ':  ' . $this->ender);
                                 $this->objpdf->text($xcol + 122, $xlin + 42, ':  ' . $this->compl);
                                 $this->objpdf->text($xcol + 18, $xlin + 46, ':  ' . $this->munic . '-' . $this->uf);
                                 $this->objpdf->text($xcol + 122, $xlin + 46, ':  ' . $this->cep);
                                 $this->objpdf->text($xcol + 18, $xlin + 50, ':  ' . $this->contato);
                                 $this->objpdf->text($xcol + 122, $xlin + 50, ':  ' . $this->telefone);
                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                 //	$this->objpdf->Roundedrect($xcol,$xlin+54,202,80,2,'DF','1234');
                                 $this->objpdf->rect($xcol, $xlin + 54, 15, 6, 2, 'DF', '12');
                                 $this->objpdf->rect($xcol + 15, $xlin + 54, 20, 6, 2, 'DF', '12');
                                 $this->objpdf->rect($xcol + 35, $xlin + 54, 107, 6, 2, 'DF', '12');
                                 $this->objpdf->rect($xcol + 142, $xlin + 54, 30, 6, 2, 'DF', '12');
                                 $this->objpdf->rect($xcol + 172, $xlin + 54, 30, 6, 2, 'DF', '12');
                                 $this->objpdf->rect($xcol, $xlin + 60, 15, 122, 2, 'DF', '34');
                                 $this->objpdf->rect($xcol + 15, $xlin + 60, 20, 122, 2, 'DF', '34');
                                 $this->objpdf->rect($xcol + 35, $xlin + 60, 107, 122, 2, 'DF', '34');
                                 $this->objpdf->rect($xcol + 142, $xlin + 60, 30, 155, 2, 'DF', '');
                                 $this->objpdf->rect($xcol + 172, $xlin + 60, 30, 155, 2, 'DF', '34');
                                 $this->objpdf->rect($xcol, $xlin + 205, 142, 10, 2, 'DF', '34');
                                 $this->objpdf->rect($xcol + 142, $xlin + 205, 30, 10, 2, 'DF', '34');
                                 $this->objpdf->rect($xcol + 172, $xlin + 205, 30, 10, 2, 'DF', '34');
                                 $this->objpdf->text($xcol + 120, $xlin + 211, 'T O T A L');
                                 $this->objpdf->SetXY(172, $xlin + 205);
                                 $this->objpdf->cell(30, 10, db_formatar($this->valtotal, 'f'), 0, 0, "R");
                                 $this->objpdf->rect($xcol, $xlin + 182, 142, 23, 2, 'DF', '');
                                 $this->objpdf->sety($xlin + 28);
                                 $alt = 4;
                                 $this->objpdf->text($xcol + 4, $xlin + 58, 'ITEM');
                                 $this->objpdf->text($xcol + 15.5, $xlin + 58, 'QUANTIDADE');
                                 $this->objpdf->text($xcol + 70, $xlin + 58, 'MATERIAL OU SERVIÇO');
                                 $this->objpdf->text($xcol + 145, $xlin + 58, 'VALOR UNITÁRIO');
                                 $this->objpdf->text($xcol + 176, $xlin + 58, 'VALOR TOTAL');
                                 $maiscol = 0;
                                 $this->objpdf->SetWidths(array(10, 22, 105, 30, 30));
                                 $this->objpdf->SetAligns(array('C', 'C', 'L', 'R', 'R'));
                                 $this->objpdf->setleftmargin(8);
                                 $this->objpdf->sety($xlin + 61);
                                 $ele = 0;
                                 $xtotal = 0;
                                 for ($ii = 0; $ii < $this->linhasdositens; $ii++) {
                                     db_fieldsmemory($this->recorddositens, $ii);
                                     if ($this->usa_sub == 'f') {
                                         $this->objpdf->Setfont('Arial', 'B', 7);
                                         if ($ele != pg_result($this->recorddositens, $ii, $this->analitico)) {
                                             $this->objpdf->cell(32, 4, '', 0, 0, "C", 0);
                                             $this->objpdf->cell(137, 4, db_formatar(pg_result($this->recorddositens, $ii, $this->analitico), 'elemento') . ' - ' . pg_result($this->recorddositens, $ii, $this->descr_analitico), 0, 1, "L", 0);
                                             $ele = pg_result($this->recorddositens, $ii, $this->analitico);
                                         }
                                     }
                                     $descricaoitem = pg_result($this->recorddositens, $ii, $this->descricaoitem);
                                     if (pg_result($this->recorddositens, $ii, $this->Snumero) != "") {
                                         $descricaoitem = pg_result($this->recorddositens, $ii, $this->descricaoitem) . "\n" . 'SOLICITAÇÃO: ' . pg_result($this->recorddositens, $ii, $this->Snumero);
                                     }
                                     $this->objpdf->Setfont('Arial', '', 7);
                                     $this->objpdf->Row(array(pg_result($this->recorddositens, $ii, $this->item), pg_result($this->recorddositens, $ii, $this->quantitem), $descricaoitem . "\n" . pg_result($this->recorddositens, $ii, $this->observacaoitem), db_formatar(pg_result($this->recorddositens, $ii, $this->valoritem) / pg_result($this->recorddositens, $ii, $this->quantitem), 'f'), db_formatar(pg_result($this->recorddositens, $ii, $this->valoritem), 'f')), 3, false, 4);
                                     $xtotal += pg_result($this->recorddositens, $ii, $this->valoritem);
                                     $this->objpdf->Setfont('Arial', 'B', 8);
                                     /////// troca de pagina
                                     if ($this->objpdf->gety() > $this->objpdf->h - 100 && $pagina == 1 || $this->objpdf->gety() > $this->objpdf->h - 30 && $pagina != 1) {
                                         if ($this->objpdf->PageNo() == 1) {
                                             $this->objpdf->text(110, $xlin + 214, 'Continua na Página ' . ($this->objpdf->PageNo() + 1));
                                             $this->objpdf->rect($xcol, $xlin + 217, 202, 55, 2, 'DF', '1234');
                                             $y = 260;
                                             //// ASSINATURAS DA AUTORIZACAO
                                             $cont = "AUTORIZO" . "\n\n\n" . "__________________________________";
                                             $ord = "AUTORIZO" . "\n\n\n" . "__________________________________";
                                             $visto = "VISTO";
                                             //	       $ass_cont   = $this->assinatura(1006,$cont);
                                             //	       $ass_ord    = $this->assinatura(1002,$ord);
                                             if (strtoupper(trim($this->municpref)) != 'SAPIRANGA') {
                                                 $ass_cont = $this->assinatura(1006, $cont);
                                                 $ass_ord = $this->assinatura(1002, $ord);
                                                 $ass_visto = $this->assinatura(5000, $visto);
                                             } else {
                                                 $ass_cont = $this->assinatura(51006, $cont);
                                                 $ass_ord = $this->assinatura(51002, $ord);
                                                 $ass_visto = $this->assinatura(5000, $visto);
                                             }
                                             $this->objpdf->SetXY(2, $y);
                                             $this->objpdf->MultiCell(70, 4, $ass_cont, 0, "C", 0);
                                             $this->objpdf->SetXY(72, $y);
                                             $this->objpdf->MultiCell(70, 4, $ass_ord, 0, "C", 0);
                                             $this->objpdf->SetXY(137, $y);
                                             $this->objpdf->MultiCell(70, 4, $ass_visto, 0, "C", 0);
                                             //////
                                             $this->objpdf->setfillcolor(0, 0, 0);
                                             $this->objpdf->text($xcol + 10, $xlin + 223, $this->municpref . ', ' . date('d') . ' DE ' . strtoupper(db_mes(date('m'))) . ' DE ' . db_getsession("DB_anousu") . '.');
                                             $this->objpdf->SetFont('Arial', '', 4);
                                             $this->objpdf->TextWithDirection(1.5, $xlin + 60, $this->texto, 'U');
                                             // texto no canhoto do carne
                                             $this->objpdf->setfont('Arial', '', 11);
                                             if ($pagina == 1) {
                                                 $this->objpdf->setxy($xcol + 1, $xlin + 187);
                                                 $this->objpdf->text($xcol + 2, $xlin + 186, 'RESUMO : ', 0, 1, 'L', 0);
                                                 $this->objpdf->Setfont('Arial', '', 7);
                                                 $this->objpdf->multicell(140, 3.5, $this->resumo);
                                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                             }
                                         } else {
                                             $this->objpdf->text(110, $xlin + 320, 'Continua na Página ' . ($this->objpdf->PageNo() + 1));
                                         }
                                         $this->objpdf->addpage();
                                         $pagina += 1;
                                         $this->objpdf->settopmargin(1);
                                         $xlin = 20;
                                         $xcol = 4;
                                         $this->objpdf->setfillcolor(245);
                                         $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                         $this->objpdf->setfillcolor(255, 255, 255);
                                         $this->objpdf->Setfont('Arial', 'B', 9);
                                         $this->objpdf->text(130, $xlin - 13, 'AUTORIZAÇÃO DE EMPENHO N' . CHR(176));
                                         $this->objpdf->text(185, $xlin - 13, db_formatar($this->numaut, 's', '0', 6, 'e'));
                                         $this->objpdf->text(137.5, $xlin - 8, 'PROCESSO DE COMPRA N' . CHR(176));
                                         $this->objpdf->text(185, $xlin - 8, db_formatar(pg_result($this->recorddositens, 0, $this->Snumeroproc), 's', '0', 6, 'e'));
                                         $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                         //.$this->logo
                                         $this->objpdf->Setfont('Arial', 'B', 9);
                                         $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                         $this->objpdf->Setfont('Arial', '', 9);
                                         $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                         $this->objpdf->text(40, $xlin - 8, $this->municpref);
                                         $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                                         $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                                         $xlin = -30;
                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                         $this->objpdf->rect($xcol, $xlin + 54, 15, 6, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 15, $xlin + 54, 20, 6, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 35, $xlin + 54, 107, 6, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 142, $xlin + 54, 30, 6, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 172, $xlin + 54, 30, 6, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol, $xlin + 60, 15, 262, 2, 'DF', '34');
                                         $this->objpdf->rect($xcol + 15, $xlin + 60, 20, 262, 2, 'DF', '34');
                                         $this->objpdf->rect($xcol + 35, $xlin + 60, 107, 262, 2, 'DF', '34');
                                         $this->objpdf->rect($xcol + 142, $xlin + 60, 30, 262, 2, 'DF', '34');
                                         $this->objpdf->rect($xcol + 172, $xlin + 60, 30, 262, 2, 'DF', '34');
                                         $this->objpdf->sety($xlin + 66);
                                         $alt = 4;
                                         $this->objpdf->text($xcol + 4, $xlin + 58, 'ITEM');
                                         $this->objpdf->text($xcol + 15.5, $xlin + 58, 'QUANTIDADE');
                                         $this->objpdf->text($xcol + 70, $xlin + 58, 'MATERIAL OU SERVIÇO');
                                         $this->objpdf->text($xcol + 145, $xlin + 58, 'VALOR UNITÁRIO');
                                         $this->objpdf->text($xcol + 176, $xlin + 58, 'VALOR TOTAL');
                                         $this->objpdf->text($xcol + 38, $xlin + 63, 'Continuação da Página ' . ($this->objpdf->PageNo() - 1));
                                         $maiscol = 0;
                                     }
                                 }
                                 if ($pagina == 1) {
                                     $this->objpdf->setxy($xcol + 1, $xlin + 187);
                                     $this->objpdf->text($xcol + 2, $xlin + 186, 'RESUMO : ', 0, 1, 'L', 0);
                                     $this->objpdf->Setfont('Arial', '', 7);
                                     $this->objpdf->multicell(140, 3.5, $this->resumo);
                                     $this->objpdf->Setfont('Arial', 'B', 8);
                                 }
                                 //	$this->objpdf->SetXY(172,$xlin+205);
                                 //	$this->objpdf->cell(30 ,10,db_formatar($xtotal,'f'),0,0,"R");
                                 //	echo $this->numaut."<br>";
                                 //	echo $pagina;exit;
                                 if ($pagina == 1) {
                                     $this->objpdf->rect($xcol, $xlin + 217, 100, 55, 2, 'DF', '1234');
                                     $this->objpdf->rect($xcol + 102, $xlin + 217, 100, 55, 2, 'DF', '1234');
                                     //		$this->objpdf->rect($xcol+136,$xlin+217,66,55,2,'DF','1234');
                                     $this->objpdf->setfillcolor(0, 0, 0);
                                     $y = 260;
                                     $this->objpdf->Setfont('Arial', '', 6);
                                     //// ASSINATURAS DA AUTORIZACAO
                                     $cont = "__________________________________";
                                     $ord = "ORDENADOR DA DESPESA";
                                     $visto = "";
                                     if (strtoupper(trim($this->municpref)) != 'SAPIRANGA') {
                                         $ass_cont = $this->assinatura(1006, $cont);
                                         $ass_ord = $this->assinatura(51002, $ord);
                                         $ass_visto = $this->assinatura(5000, $visto);
                                     } else {
                                         $ass_cont = $this->assinatura(51006, $cont);
                                         $ass_ord = $this->assinatura(51002, $ord);
                                         $ass_visto = $this->assinatura(5000, $visto);
                                     }
                                     $this->objpdf->SetXY(20, $y);
                                     $this->objpdf->MultiCell(70, 2, "\n\n\n\n\n\n" . $ass_cont, 0, "C", 0);
                                     $this->objpdf->SetXY(122, $y);
                                     $this->objpdf->MultiCell(70, 2, "\n\n\n\n\n\n" . $ass_ord, 0, "C", 0);
                                     $this->objpdf->SetXY(137, $y);
                                     //               $this->objpdf->MultiCell(70,2,$ass_visto,0,"C",0);
                                     //////
                                     $this->objpdf->Setfont('Arial', 'B', 8);
                                     $this->objpdf->setfillcolor(0, 0, 0);
                                     $this->objpdf->text($xcol + 10, $xlin + 223, strtoupper($this->municpref) . ', ' . substr($this->emissao, 8, 2) . ' DE ' . strtoupper(db_mes(substr($this->emissao, 5, 2))) . ' DE ' . substr($this->emissao, 0, 4) . '.');
                                     //	   $this->objpdf->SetFont('Arial','',4);
                                     //         $this->objpdf->TextWithDirection(1.5,$xlin+60,$this->texto,'U'); // texto no canhoto do carne
                                     //	   $this->objpdf->setfont('Arial','',11);
                                     //         $xlin = 169;
                                 }
                             } else {
                                 $this->objpdf->AliasNbPages();
                                 $this->objpdf->AddPage();
                                 $this->objpdf->settopmargin(1);
                                 $pagina = 1;
                                 $xlin = 20;
                                 $xcol = 4;
                                 $this->objpdf->setfillcolor(245);
                                 $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                 $this->objpdf->setfillcolor(255, 255, 255);
                                 $this->objpdf->Setfont('Arial', 'B', 9);
                                 $this->objpdf->text(130, $xlin - 13, 'AUTORIZAÇÃO DE EMPENHO N' . CHR(176));
                                 $this->objpdf->text(185, $xlin - 13, db_formatar($this->numaut, 's', '0', 6, 'e'));
                                 $this->objpdf->text(137.5, $xlin - 8, 'PROCESSO DE COMPRA N' . CHR(176));
                                 $this->objpdf->text(185, $xlin - 8, db_formatar(pg_result($this->recorddositens, 0, $this->Snumeroproc), 's', '0', 6, 'e'));
                                 $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                 //.$this->logo
                                 $this->objpdf->Setfont('Arial', 'B', 9);
                                 $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                 $this->objpdf->Setfont('Arial', '', 7);
                                 $this->objpdf->text(40, $xlin - 12, $this->enderpref);
                                 $this->objpdf->text(40, $xlin - 9, $this->municpref);
                                 $this->objpdf->text(40, $xlin - 6, $this->telefpref);
                                 $this->objpdf->text(40, $xlin - 3, $this->emailpref);
                                 $this->objpdf->text(40, $xlin, db_formatar($this->cgcpref, 'cnpj'));
                                 $this->objpdf->rect($xcol, $xlin + 2, $xcol + 100, 28, 2, 'DF', '1234');
                                 $this->objpdf->Setfont('Arial', '', 6);
                                 $this->objpdf->text($xcol + 2, $xlin + 4, 'Dados da Compra');
                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                 $this->objpdf->text($xcol + 2, $xlin + 8, 'Licitação');
                                 $this->objpdf->text($xcol + 2, $xlin + 12, 'Tipo de Compra');
                                 $this->objpdf->text($xcol + 2, $xlin + 16, 'Prazo de Entrega');
                                 $this->objpdf->text($xcol + 2, $xlin + 20, 'Observações');
                                 $this->objpdf->text($xcol + 2, $xlin + 24, 'Cond.de Pagto');
                                 $this->objpdf->text($xcol + 2, $xlin + 28, 'Outras Condições');
                                 $this->objpdf->Setfont('Arial', '', 8);
                                 $this->objpdf->text($xcol + 27, $xlin + 8, ':  ' . $this->num_licitacao . '  -  ' . $this->descr_licitacao);
                                 $this->objpdf->text($xcol + 27, $xlin + 12, ':  ' . $this->descr_tipocompra);
                                 $this->objpdf->text($xcol + 27, $xlin + 16, ':  ' . $this->prazo_ent);
                                 $this->objpdf->text($xcol + 27, $xlin + 20, ':  ' . $this->obs);
                                 $this->objpdf->text($xcol + 27, $xlin + 24, ':  ' . $this->cond_pag);
                                 $this->objpdf->text($xcol + 27, $xlin + 28, ':  ' . $this->out_cond);
                                 $this->objpdf->rect($xcol + 106, $xlin + 2, 96, 28, 2, 'DF', '1234');
                                 $this->objpdf->Setfont('Arial', '', 6);
                                 $this->objpdf->text($xcol + 110, $xlin + 4, 'Dados da Dotação');
                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                 $this->objpdf->text($xcol + 108, $xlin + 8, 'Dotação');
                                 $this->objpdf->text($xcol + 108, $xlin + 11.5, 'Órgão');
                                 $this->objpdf->text($xcol + 108, $xlin + 15, 'Unidade');
                                 $this->objpdf->text($xcol + 108, $xlin + 18.5, 'Proj/Ativ');
                                 $this->objpdf->text($xcol + 108, $xlin + 22, 'Elemento');
                                 $this->objpdf->text($xcol + 108, $xlin + 25.5, 'Recurso');
                                 $this->objpdf->text($xcol + 178, $xlin + 25.5, 'Reduz');
                                 $this->objpdf->text($xcol + 108, $xlin + 29, 'Destino');
                                 $this->objpdf->Setfont('Arial', '', 8);
                                 $this->objpdf->text($xcol + 122, $xlin + 8, ':  ' . $this->dotacao);
                                 $this->objpdf->text($xcol + 122, $xlin + 11.5, ':  ' . db_formatar($this->orgao, 'orgao') . ' - ' . $this->descr_orgao);
                                 $this->objpdf->text($xcol + 122, $xlin + 15, ':  ' . db_formatar($this->orgao, 'orgao') . db_formatar($this->unidade, 'unidade') . ' - ' . $this->descr_unidade);
                                 $this->objpdf->text($xcol + 122, $xlin + 18.5, ':  ' . db_formatar($this->projativ, 'projativ') . ' - ' . $this->descr_projativ);
                                 $this->objpdf->text($xcol + 122, $xlin + 22, ':  ' . $this->descrdotacao);
                                 $this->objpdf->text($xcol + 122, $xlin + 25.5, ':  ' . $this->recurso . ' - ' . $this->descr_recurso);
                                 $this->objpdf->text($xcol + 188, $xlin + 25.5, ':  ' . $this->coddot . '-' . db_CalculaDV($this->coddot));
                                 $this->objpdf->text($xcol + 122, $xlin + 29, ':  ' . $this->destino);
                                 $this->objpdf->rect($xcol, $xlin + 32, $xcol + 198, 20, 2, 'DF', '1234');
                                 $this->objpdf->Setfont('Arial', '', 6);
                                 $this->objpdf->text($xcol + 2, $xlin + 34, 'Dados do Credor');
                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                 $this->objpdf->text($xcol + 109, $xlin + 38, 'Numcgm');
                                 $this->objpdf->text($xcol + 150, $xlin + 38, strlen($this->cnpj) == 11 ? 'CPF' : 'CNPJ');
                                 $this->objpdf->text($xcol + 2, $xlin + 38, 'Nome');
                                 $this->objpdf->text($xcol + 2, $xlin + 42, 'Endereço');
                                 $this->objpdf->text($xcol + 102, $xlin + 42, 'Complemento');
                                 $this->objpdf->text($xcol + 2, $xlin + 46, 'Município');
                                 $this->objpdf->text($xcol + 115, $xlin + 46, 'CEP');
                                 $this->objpdf->text($xcol + 2, $xlin + 50, 'Contato');
                                 $this->objpdf->text($xcol + 110, $xlin + 50, 'Telefone');
                                 $this->objpdf->Setfont('Arial', '', 8);
                                 $this->objpdf->text($xcol + 159, $xlin + 38, ':  ' . (strlen($this->cnpj) == 11 ? db_formatar($this->cnpj, 'cpf') : db_formatar($this->cnpj, 'cnpj')));
                                 $this->objpdf->text($xcol + 122, $xlin + 38, ':  ' . $this->numcgm);
                                 $this->objpdf->text($xcol + 18, $xlin + 38, ':  ' . $this->nome);
                                 $this->objpdf->text($xcol + 18, $xlin + 42, ':  ' . $this->ender);
                                 $this->objpdf->text($xcol + 122, $xlin + 42, ':  ' . $this->compl);
                                 $this->objpdf->text($xcol + 18, $xlin + 46, ':  ' . $this->munic . '-' . $this->uf);
                                 $this->objpdf->text($xcol + 122, $xlin + 46, ':  ' . $this->cep);
                                 $this->objpdf->text($xcol + 18, $xlin + 50, ':  ' . $this->contato);
                                 $this->objpdf->text($xcol + 122, $xlin + 50, ':  ' . $this->telefone);
                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                 //	$this->objpdf->Roundedrect($xcol,$xlin+54,202,80,2,'DF','1234');
                                 $this->objpdf->rect($xcol, $xlin + 54, 15, 6, 2, 'DF', '12');
                                 $this->objpdf->rect($xcol + 15, $xlin + 54, 20, 6, 2, 'DF', '12');
                                 $this->objpdf->rect($xcol + 35, $xlin + 54, 107, 6, 2, 'DF', '12');
                                 $this->objpdf->rect($xcol + 142, $xlin + 54, 30, 6, 2, 'DF', '12');
                                 $this->objpdf->rect($xcol + 172, $xlin + 54, 30, 6, 2, 'DF', '12');
                                 $this->objpdf->rect($xcol, $xlin + 60, 15, 122, 2, 'DF', '34');
                                 $this->objpdf->rect($xcol + 15, $xlin + 60, 20, 122, 2, 'DF', '34');
                                 $this->objpdf->rect($xcol + 35, $xlin + 60, 107, 122, 2, 'DF', '34');
                                 $this->objpdf->rect($xcol + 142, $xlin + 60, 30, 155, 2, 'DF', '');
                                 $this->objpdf->rect($xcol + 172, $xlin + 60, 30, 155, 2, 'DF', '34');
                                 $this->objpdf->rect($xcol, $xlin + 205, 142, 10, 2, 'DF', '34');
                                 $this->objpdf->rect($xcol + 142, $xlin + 205, 30, 10, 2, 'DF', '34');
                                 $this->objpdf->rect($xcol + 172, $xlin + 205, 30, 10, 2, 'DF', '34');
                                 $this->objpdf->text($xcol + 120, $xlin + 211, 'T O T A L');
                                 $this->objpdf->rect($xcol, $xlin + 182, 142, 23, 2, 'DF', '');
                                 $this->objpdf->sety($xlin + 28);
                                 $alt = 4;
                                 $this->objpdf->text($xcol + 4, $xlin + 58, 'ITEM');
                                 $this->objpdf->text($xcol + 15.5, $xlin + 58, 'QUANTIDADE');
                                 $this->objpdf->text($xcol + 70, $xlin + 58, 'MATERIAL OU SERVIÇO');
                                 $this->objpdf->text($xcol + 145, $xlin + 58, 'VALOR UNITÁRIO');
                                 $this->objpdf->text($xcol + 176, $xlin + 58, 'VALOR TOTAL');
                                 $maiscol = 0;
                                 $this->objpdf->SetWidths(array(10, 22, 105, 30, 30));
                                 $this->objpdf->SetAligns(array('C', 'C', 'L', 'R', 'R'));
                                 $this->objpdf->setleftmargin(8);
                                 $this->objpdf->sety($xlin + 61);
                                 $ele = 0;
                                 $xtotal = 0;
                                 for ($ii = 0; $ii < $this->linhasdositens; $ii++) {
                                     db_fieldsmemory($this->recorddositens, $ii);
                                     if ($this->usa_sub == 'f') {
                                         $this->objpdf->Setfont('Arial', 'B', 7);
                                         if ($ele != pg_result($this->recorddositens, $ii, $this->analitico)) {
                                             $this->objpdf->cell(32, 4, '', 0, 0, "C", 0);
                                             $this->objpdf->cell(137, 4, db_formatar(pg_result($this->recorddositens, $ii, $this->analitico), 'elemento') . ' - ' . pg_result($this->recorddositens, $ii, $this->descr_analitico), 0, 1, "L", 0);
                                             $ele = pg_result($this->recorddositens, $ii, $this->analitico);
                                         }
                                     }
                                     $descricaoitem = pg_result($this->recorddositens, $ii, $this->descricaoitem);
                                     if (pg_result($this->recorddositens, $ii, $this->Snumero) != "") {
                                         $descricaoitem = pg_result($this->recorddositens, $ii, $this->descricaoitem) . "\n" . 'SOLICITAÇÃO: ' . pg_result($this->recorddositens, $ii, $this->Snumero);
                                     }
                                     $this->objpdf->Setfont('Arial', '', 7);
                                     $this->objpdf->Row(array(pg_result($this->recorddositens, $ii, $this->item), pg_result($this->recorddositens, $ii, $this->quantitem), $descricaoitem . "\n" . pg_result($this->recorddositens, $ii, $this->observacaoitem), db_formatar(pg_result($this->recorddositens, $ii, $this->valoritem) / pg_result($this->recorddositens, $ii, $this->quantitem), 'f'), db_formatar(pg_result($this->recorddositens, $ii, $this->valoritem), 'f')), 3, false, 4);
                                     $xtotal += pg_result($this->recorddositens, $ii, $this->valoritem);
                                     $this->objpdf->Setfont('Arial', 'B', 8);
                                     /////// troca de pagina
                                     if ($this->objpdf->gety() > $this->objpdf->h - 100 && $pagina == 1 || $this->objpdf->gety() > $this->objpdf->h - 30 && $pagina != 1) {
                                         if ($this->objpdf->PageNo() == 1) {
                                             $this->objpdf->text(110, $xlin + 214, 'Continua na Página ' . ($this->objpdf->PageNo() + 1));
                                             $this->objpdf->rect($xcol, $xlin + 217, 202, 55, 2, 'DF', '1234');
                                             $this->objpdf->SetXY(172, $xlin + 205);
                                             $this->objpdf->cell(30, 10, db_formatar($this->valtotal, 'f'), 0, 0, "R");
                                             $y = 260;
                                             //// ASSINATURAS DA AUTORIZACAO
                                             $cont = "AUTORIZO" . "\n\n\n" . "__________________________________";
                                             $ord = "AUTORIZO" . "\n\n\n" . "__________________________________";
                                             $visto = "VISTO";
                                             //	       $ass_cont   = $this->assinatura(1006,$cont);
                                             //	       $ass_ord    = $this->assinatura(1002,$ord);
                                             if (strtoupper(trim($this->municpref)) == 'SAPIRANGA') {
                                                 $cont = "AUTORIZO" . "\n\n\n" . "__________________________________";
                                                 $ord = "AUTORIZO" . "\n\n\n" . "__________________________________";
                                                 $visto = "VISTO";
                                                 $ass_cont = $this->assinatura(51006, $cont);
                                                 $ass_ord = $this->assinatura(51002, $ord);
                                                 $ass_visto = $this->assinatura(5000, $visto);
                                                 $ass_usu = $this->assinatura_usuario();
                                                 /// primeiro quadro
                                                 $this->objpdf->SetXY(2, $y - 20);
                                                 $this->objpdf->MultiCell(70, 4, $ass_usu, 0, "C", 0);
                                                 $this->objpdf->SetXY(2, $y + 5);
                                                 $this->objpdf->MultiCell(70, 4, $ass_cont, 0, "C", 0);
                                                 $this->objpdf->SetXY(72, $y);
                                                 $this->objpdf->MultiCell(70, 4, $ass_ord, 0, "C", 0);
                                                 $this->objpdf->SetXY(137, $y);
                                                 $this->objpdf->MultiCell(70, 4, $ass_visto, 0, "C", 0);
                                                 $this->objpdf->setfillcolor(0, 0, 0);
                                                 $this->objpdf->text($xcol + 10, $xlin + 223, $this->municpref . ', ' . date('d') . ' DE ' . strtoupper(db_mes(date('m'))) . ' DE ' . db_getsession("DB_anousu") . '.');
                                             } elseif (strtoupper(trim($this->municpref)) == 'ALEGRETE') {
                                                 $ass_cont = $this->assinatura(1006, $cont);
                                                 $ass_ord = $this->assinatura(1002, $ord);
                                                 $ass_visto = $this->assinatura(5000, $visto);
                                                 $this->objpdf->SetXY(2, $y);
                                                 $this->objpdf->MultiCell(70, 2, "AUTORIZO" . "\n\n\n\n\n\nDIRETOR DE COMPRAS", 0, "C", 0);
                                                 $this->objpdf->SetXY(72, $y);
                                                 $this->objpdf->MultiCell(70, 2, "AUTORIZO" . "\n\n\n\n\n\nSECRETÁRIO DE FINANÇAS", 0, "C", 0);
                                                 $this->objpdf->SetXY(137, $y);
                                                 $this->objpdf->MultiCell(70, 4, $ass_visto, 0, "C", 0);
                                                 $this->objpdf->setfillcolor(0, 0, 0);
                                                 $this->objpdf->text($xcol + 10, $xlin + 223, $this->municpref . ', ' . date('d') . ' DE ' . strtoupper(db_mes(date('m'))) . ' DE ' . db_getsession("DB_anousu") . '.');
                                             } else {
                                                 $ass_cont = $this->assinatura(1006, $cont);
                                                 $ass_ord = $this->assinatura(1002, $ord);
                                                 $ass_visto = $this->assinatura(5000, $visto);
                                                 $this->objpdf->SetXY(2, $y);
                                                 $this->objpdf->MultiCell(70, 4, $ass_cont, 0, "C", 0);
                                                 $this->objpdf->SetXY(72, $y);
                                                 $this->objpdf->MultiCell(70, 4, $ass_ord, 0, "C", 0);
                                                 $this->objpdf->SetXY(137, $y);
                                                 $this->objpdf->MultiCell(70, 4, $ass_visto, 0, "C", 0);
                                                 $this->objpdf->setfillcolor(0, 0, 0);
                                                 $this->objpdf->text($xcol + 10, $xlin + 223, $this->municpref . ', ' . date('d') . ' DE ' . strtoupper(db_mes(date('m'))) . ' DE ' . db_getsession("DB_anousu") . '.');
                                             }
                                             /* 
                                             		 if(strtoupper(trim($this->municpref)) != 'SAPIRANGA'){
                                             		    $ass_cont   = $this->assinatura(1006,$cont);
                                             		    $ass_ord    = $this->assinatura(1002,$ord);
                                             		    $ass_visto  = $this->assinatura(5000,$visto);
                                             		 }else{
                                             		    $ass_cont   = $this->assinatura(51006,$cont);
                                             		    $ass_ord    = $this->assinatura(51002,$ord);
                                             		    $ass_visto  = $this->assinatura(5000,$visto);
                                             		 }
                                             																			       
                                             		 $this->objpdf->SetXY(2,$y);
                                             
                                             		 if(strtoupper(trim($this->municpref)) == 'ALEGRETE'){
                                               		   $this->objpdf->MultiCell(70,2,"AUTORIZO"."\n\n\n\n\n\nDIRETOR DE COMPRAS",0,"C",0);
                                             		 } else {
                                             		   $this->objpdf->MultiCell(70,4,$ass_cont,0,"C",0);
                                             		 }
                                             		 
                                             		 
                                             		 $this->objpdf->SetXY(72,$y);
                                             		 if(strtoupper(trim($this->municpref)) == 'ALEGRETE'){
                                               		   $this->objpdf->MultiCell(70,2,"AUTORIZO"."\n\n\n\n\n\nSECRETÁRIO DE FINANÇAS",0,"C",0);
                                             		 } else {
                                             		   $this->objpdf->MultiCell(70,4,$ass_ord,0,"C",0);
                                             		 }
                                             		 
                                             		 $this->objpdf->SetXY(137,$y);
                                             		 $this->objpdf->MultiCell(70,4,$ass_visto,0,"C",0);
                                             		 /////
                                             		 
                                             		 $this->objpdf->setfillcolor(0,0,0);
                                             		 $this->objpdf->text($xcol+10,$xlin+223,$this->municpref.', '.date('d').' DE '.strtoupper(db_mes(date('m'))).' DE '.db_getsession("DB_anousu").'.');
                                             */
                                             $this->objpdf->SetFont('Arial', '', 4);
                                             $this->objpdf->TextWithDirection(1.5, $xlin + 60, $this->texto, 'U');
                                             // texto no canhoto do carne
                                             $this->objpdf->setfont('Arial', '', 11);
                                             if ($pagina == 1) {
                                                 $this->objpdf->setxy($xcol + 1, $xlin + 187);
                                                 $this->objpdf->text($xcol + 2, $xlin + 186, 'RESUMO : ', 0, 1, 'L', 0);
                                                 $this->objpdf->Setfont('Arial', '', 7);
                                                 $this->objpdf->multicell(140, 3.5, $this->resumo);
                                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                             }
                                         } else {
                                             $this->objpdf->text(110, $xlin + 320, 'Continua na Página ' . ($this->objpdf->PageNo() + 1));
                                         }
                                         $this->objpdf->addpage();
                                         $pagina += 1;
                                         $this->objpdf->settopmargin(1);
                                         $xlin = 20;
                                         $xcol = 4;
                                         $this->objpdf->setfillcolor(245);
                                         $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                         $this->objpdf->setfillcolor(255, 255, 255);
                                         $this->objpdf->Setfont('Arial', 'B', 9);
                                         $this->objpdf->text(130, $xlin - 13, 'AUTORIZAÇÃO DE EMPENHO N' . CHR(176));
                                         $this->objpdf->text(185, $xlin - 13, db_formatar($this->numaut, 's', '0', 6, 'e'));
                                         $this->objpdf->text(137.5, $xlin - 8, 'PROCESSO DE COMPRA N' . CHR(176));
                                         $this->objpdf->text(185, $xlin - 8, db_formatar(pg_result($this->recorddositens, 0, $this->Snumeroproc), 's', '0', 6, 'e'));
                                         $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                         //.$this->logo
                                         $this->objpdf->Setfont('Arial', 'B', 9);
                                         $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                         $this->objpdf->Setfont('Arial', '', 9);
                                         $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                         $this->objpdf->text(40, $xlin - 8, $this->municpref);
                                         $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                                         $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                                         $xlin = -30;
                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                         $this->objpdf->rect($xcol, $xlin + 54, 15, 6, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 15, $xlin + 54, 20, 6, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 35, $xlin + 54, 107, 6, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 142, $xlin + 54, 30, 6, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 172, $xlin + 54, 30, 6, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol, $xlin + 60, 15, 262, 2, 'DF', '34');
                                         $this->objpdf->rect($xcol + 15, $xlin + 60, 20, 262, 2, 'DF', '34');
                                         $this->objpdf->rect($xcol + 35, $xlin + 60, 107, 262, 2, 'DF', '34');
                                         $this->objpdf->rect($xcol + 142, $xlin + 60, 30, 262, 2, 'DF', '34');
                                         $this->objpdf->rect($xcol + 172, $xlin + 60, 30, 262, 2, 'DF', '34');
                                         $this->objpdf->sety($xlin + 66);
                                         $alt = 4;
                                         $this->objpdf->text($xcol + 4, $xlin + 58, 'ITEM');
                                         $this->objpdf->text($xcol + 15.5, $xlin + 58, 'QUANTIDADE');
                                         $this->objpdf->text($xcol + 70, $xlin + 58, 'MATERIAL OU SERVIÇO');
                                         $this->objpdf->text($xcol + 145, $xlin + 58, 'VALOR UNITÁRIO');
                                         $this->objpdf->text($xcol + 176, $xlin + 58, 'VALOR TOTAL');
                                         $this->objpdf->text($xcol + 38, $xlin + 63, 'Continuação da Página ' . ($this->objpdf->PageNo() - 1));
                                         $maiscol = 0;
                                     }
                                 }
                                 if ($pagina == 1) {
                                     $this->objpdf->setxy($xcol + 1, $xlin + 187);
                                     $this->objpdf->text($xcol + 2, $xlin + 186, 'RESUMO : ', 0, 1, 'L', 0);
                                     $this->objpdf->Setfont('Arial', '', 7);
                                     $this->objpdf->multicell(140, 3.5, $this->resumo);
                                     $this->objpdf->Setfont('Arial', 'B', 8);
                                 }
                                 //	  $this->objpdf->SetXY(172,$xlin+205);
                                 //	  $this->objpdf->cell(30 ,10,db_formatar($xtotal,'f'),0,0,"R");
                                 //	echo $this->numaut."<br>";
                                 //	echo $pagina;exit;
                                 if ($pagina == 1) {
                                     $this->objpdf->SetXY(172, $xlin + 205);
                                     $this->objpdf->cell(30, 10, db_formatar($this->valtotal, 'f'), 0, 0, "R");
                                     $this->objpdf->rect($xcol, $xlin + 217, 66, 55, 2, 'DF', '1234');
                                     $this->objpdf->rect($xcol + 68, $xlin + 217, 66, 55, 2, 'DF', '1234');
                                     $this->objpdf->rect($xcol + 136, $xlin + 217, 66, 55, 2, 'DF', '1234');
                                     $this->objpdf->setfillcolor(0, 0, 0);
                                     $y = 260;
                                     $this->objpdf->Setfont('Arial', '', 6);
                                     //// ASSINATURAS DA AUTORIZACAO
                                     //		 $cont =  "__________________________________";
                                     //		 $ord =   "__________________________________";
                                     //		 $visto =  "VISTO";
                                     //// ASSINATURAS DA AUTORIZACAO
                                     $cont = "AUTORIZO" . "\n\n\n" . "__________________________________";
                                     $ord = "AUTORIZO" . "\n\n\n" . "__________________________________";
                                     $visto = "VISTO";
                                     //	       $ass_cont   = $this->assinatura(1006,$cont);
                                     //	       $ass_ord    = $this->assinatura(1002,$ord);
                                     if (strtoupper(trim($this->municpref)) == 'SAPIRANGA') {
                                         $cont = "__________________________________" . "\n" . "CONTABILIDADE";
                                         $pref = "__________________________________" . "\n" . "PREFEITO MUNICIPAL";
                                         $ord = "AUTORIZO" . "\n\n\n" . "__________________________________";
                                         $visto = "VISTO";
                                         $ch_compras = "__________________________________" . "\n" . "CHEFE COMPRAS";
                                         $ass_pref = $this->assinatura(1000, $pref);
                                         $ass_secfaz = $this->assinatura(1002, $ord);
                                         $ass_visto = $this->assinatura(5000, $visto);
                                         $ass_usu = $this->assinatura_usuario();
                                         /// primeiro quadro
                                         $this->objpdf->SetXY(2, $y - 15);
                                         $this->objpdf->MultiCell(70, 3, "__________________________________" . "\n" . $ass_usu, 0, "C", 0);
                                         $this->objpdf->SetXY(2, $y + 8);
                                         $this->objpdf->MultiCell(70, 3, $ch_compras, 0, "C", 0);
                                         $this->objpdf->setfillcolor(0, 0, 0);
                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                         $this->objpdf->text($xcol + 10, $xlin + 270, $this->municpref . ', ' . date('d') . ' DE ' . strtoupper(db_mes(date('m'))) . ' DE ' . db_getsession("DB_anousu") . '.');
                                         /// segundo quadro
                                         $this->objpdf->Setfont('Arial', '', 6);
                                         $this->objpdf->SetXY(72, $y - 15);
                                         $this->objpdf->MultiCell(65, 3, $cont, 0, "C", 0);
                                         $this->objpdf->SetXY(72, $y);
                                         $this->objpdf->MultiCell(65, 3, "HÁ RECURSOS FINANCEIROS:", 0, "C", 0);
                                         $this->objpdf->SetXY(72, $y + 8);
                                         $this->objpdf->MultiCell(65, 3, $ass_secfaz, 0, "C", 0);
                                         $this->objpdf->setfillcolor(0, 0, 0);
                                         //	            $this->objpdf->Setfont('Arial','B',8);
                                         $this->objpdf->text($xcol + 95, $xlin + 263, 'CONFERIDO');
                                         $this->objpdf->text($xcol + 91, $xlin + 270, '______/______/______');
                                         /// terceiro quadro
                                         $this->objpdf->Setfont('Arial', '', 6);
                                         $this->objpdf->SetXY(137, $y);
                                         $this->objpdf->MultiCell(70, 3, $ass_pref, 0, "C", 0);
                                         $this->objpdf->text($xcol + 165, $xlin + 263, 'AUTORIZA');
                                         $this->objpdf->text($xcol + 161, $xlin + 270, '______/______/______');
                                     } elseif (strtoupper(trim($this->municpref)) == 'ALEGRETE') {
                                         $ass_cont = $this->assinatura(1006, $cont);
                                         $ass_ord = $this->assinatura(1002, $ord);
                                         $ass_visto = $this->assinatura(5000, $visto);
                                         $this->objpdf->SetXY(2, $y);
                                         $this->objpdf->MultiCell(70, 2, "AUTORIZO" . "\n\n\n\n\n\nDIRETOR DE COMPRAS", 0, "C", 0);
                                         $this->objpdf->SetXY(72, $y);
                                         $this->objpdf->MultiCell(70, 2, "AUTORIZO" . "\n\n\n\n\n\nSECRETÁRIO DE FINANÇAS", 0, "C", 0);
                                         $this->objpdf->SetXY(137, $y);
                                         $this->objpdf->MultiCell(70, 4, $ass_visto, 0, "C", 0);
                                         $this->objpdf->setfillcolor(0, 0, 0);
                                         $this->objpdf->text($xcol + 10, $xlin + 223, $this->municpref . ', ' . date('d') . ' DE ' . strtoupper(db_mes(date('m'))) . ' DE ' . db_getsession("DB_anousu") . '.');
                                     } else {
                                         $ass_cont = $this->assinatura(1006, $cont);
                                         $ass_ord = $this->assinatura(1002, $ord);
                                         $ass_visto = $this->assinatura(5000, $visto);
                                         $this->objpdf->SetXY(2, $y);
                                         $this->objpdf->MultiCell(70, 4, $ass_cont, 0, "C", 0);
                                         $this->objpdf->SetXY(72, $y);
                                         $this->objpdf->MultiCell(70, 4, $ass_ord, 0, "C", 0);
                                         $this->objpdf->SetXY(137, $y);
                                         $this->objpdf->MultiCell(70, 4, $ass_visto, 0, "C", 0);
                                         $this->objpdf->setfillcolor(0, 0, 0);
                                         $this->objpdf->text($xcol + 10, $xlin + 223, $this->municpref . ', ' . date('d') . ' DE ' . strtoupper(db_mes(date('m'))) . ' DE ' . db_getsession("DB_anousu") . '.');
                                     }
                                     /*
                                     		 if(strtoupper(trim($this->municpref)) != 'SAPIRANGA'){
                                     		    $ass_cont   = $this->assinatura(1006,$cont);
                                     		    $ass_ord    = $this->assinatura(1002,$ord);
                                     		    $ass_visto  = $this->assinatura(5000,$visto);
                                     		 }else{
                                     		    $ass_cont   = $this->assinatura(51006,$cont);
                                     		    $ass_ord    = $this->assinatura(51002,$ord);
                                     		    $ass_visto  = $this->assinatura(5000,$visto);
                                     		 }
                                     
                                     		 $this->objpdf->SetXY(2,$y);
                                     		 
                                     		 if(strtoupper(trim($this->municpref)) == 'ALEGRETE'){
                                       		   $this->objpdf->MultiCell(70,2,"AUTORIZO"."\n\n\n\n\n\nDIRETOR DE COMPRAS",0,"C",0);
                                     		 } else {
                                       		   $this->objpdf->MultiCell(70,2,"AUTORIZO"."\n\n\n\n\n\n".$ass_cont,0,"C",0);
                                     		 }
                                     		 
                                     		 $this->objpdf->SetXY(72,$y);
                                     		 if(strtoupper(trim($this->municpref)) == 'ALEGRETE'){
                                       		   $this->objpdf->MultiCell(70,2,"AUTORIZO"."\n\n\n\n\n\nSECRETÁRIO DE FINANÇAS",0,"C",0);
                                     		 } else {
                                       		   $this->objpdf->MultiCell(70,2,"AUTORIZO"."\n\n\n\n\n\n".$ass_ord,0,"C",0);
                                     		 }
                                     		 
                                     		 $this->objpdf->SetXY(137,$y);
                                     		 $this->objpdf->MultiCell(70,2,$ass_visto,0,"C",0);
                                     		 //////
                                     		  
                                     		 
                                     	     $this->objpdf->Setfont('Arial','B',8);
                                     	     $this->objpdf->setfillcolor(0,0,0);
                                     	     $this->objpdf->text($xcol+10,$xlin+223,strtoupper($this->municpref).', '.substr($this->emissao,8,2).' DE '.strtoupper(db_mes(substr($this->emissao,5,2))).' DE '.substr($this->emissao,0,4).'.');
                                     */
                                     //	   $this->objpdf->SetFont('Arial','',4);
                                     //         $this->objpdf->TextWithDirection(1.5,$xlin+60,$this->texto,'U'); // texto no canhoto do carne
                                     //	   $this->objpdf->setfont('Arial','',11);
                                     //         $xlin = 169;
                                 }
                             }
                         } else {
                             if ($this->modelo == 6) {
                                 ////////// MODELO 6  -  NOTA DE EMPENHO
                                 if (strtoupper(trim($this->municpref)) == 'GUAIBA') {
                                     $assinatura2 = 'CONTADORA';
                                     $assinatura3 = 'JORGE ANTONIO POKORSKI';
                                     $assinaturaprefeito = 'MANOEL STRINGHINI';
                                     for ($xxx = 0; $xxx < $this->nvias; $xxx++) {
                                         $this->objpdf->AliasNbPages();
                                         $this->objpdf->AddPage();
                                         $this->objpdf->settopmargin(1);
                                         $pagina = 1;
                                         $xlin = 20;
                                         $xcol = 4;
                                         $this->objpdf->setfillcolor(245);
                                         $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                         $this->objpdf->setfillcolor(255, 255, 255);
                                         $this->objpdf->Setfont('Arial', 'B', 10);
                                         $this->objpdf->text(128, $xlin - 13, 'NOTA DE EMPENHO N' . CHR(176) . ': ');
                                         $this->objpdf->text(175, $xlin - 13, db_formatar($this->codemp, 's', '0', 6, 'e'));
                                         $this->objpdf->text(134, $xlin - 8, 'DATA DE EMISSÃO : ');
                                         $this->objpdf->text(175, $xlin - 8, $this->emissao);
                                         $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                         //.$this->logo
                                         $this->objpdf->Setfont('Arial', 'B', 9);
                                         $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                         $this->objpdf->Setfont('Arial', '', 7);
                                         $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                         $this->objpdf->text(40, $xlin - 8, $this->municpref);
                                         $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                                         $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                                         $this->objpdf->text(40, $xlin, db_formatar($this->cgcpref, 'cnpj'));
                                         /// retangulo dos dados da dotação
                                         $this->objpdf->rect($xcol, $xlin + 2, $xcol + 100, 50, 2, 'DF', '1234');
                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                         $this->objpdf->text($xcol + 2, $xlin + 7, 'Órgao');
                                         $this->objpdf->text($xcol + 2, $xlin + 10.5, 'Unidade');
                                         $this->objpdf->text($xcol + 2, $xlin + 14, 'Função');
                                         $this->objpdf->text($xcol + 2, $xlin + 20.5, 'Proj/Ativ');
                                         $this->objpdf->text($xcol + 2, $xlin + 27, 'Rubrica');
                                         $this->objpdf->text($xcol + 2, $xlin + 35, 'Recurso');
                                         if ($this->banco != "") {
                                             $this->objpdf->text($xcol + 2, $xlin + 38.5, 'Banco');
                                             $this->objpdf->text($xcol + 30, $xlin + 38.5, 'Agencia:');
                                             $this->objpdf->text($xcol + 60, $xlin + 38.5, 'Conta:');
                                         }
                                         $this->objpdf->text($xcol + 2, $xlin + 42.5, 'Reduzido');
                                         $this->objpdf->text($xcol + 2, $xlin + 48, 'Licitação');
                                         $this->objpdf->Setfont('Arial', '', 8);
                                         $this->objpdf->text($xcol + 17, $xlin + 7, ':  ' . db_formatar($this->orgao, 'orgao') . ' - ' . $this->descr_orgao);
                                         $this->objpdf->text($xcol + 17, $xlin + 10.5, ':  ' . db_formatar($this->unidade, 'unidade') . ' - ' . $this->descr_unidade);
                                         $this->objpdf->text($xcol + 17, $xlin + 14, ':  ' . db_formatar($this->funcao, 'funcao') . ' - ' . $this->descr_funcao);
                                         $this->objpdf->text($xcol + 17, $xlin + 20.5, ':  ' . db_formatar($this->projativ, 'projativ') . ' - ' . $this->descr_projativ);
                                         $this->objpdf->text($xcol + 17, $xlin + 27, ':  ' . db_formatar($this->sintetico, 'elemento'));
                                         $this->objpdf->setxy($xcol + 18, $xlin + 28);
                                         $this->objpdf->multicell(90, 3, $this->descr_sintetico, 0, "L");
                                         $this->objpdf->text($xcol + 17, $xlin + 35, ':  ' . $this->recurso . ' - ' . $this->descr_recurso);
                                         if ($this->banco != "") {
                                             $this->objpdf->text($xcol + 17, $xlin + 38.5, ':  ' . $this->banco);
                                             $this->objpdf->text($xcol + 47, $xlin + 38.5, $this->agencia);
                                             $this->objpdf->text($xcol + 77, $xlin + 38.5, $this->conta);
                                         }
                                         $this->objpdf->text($xcol + 17, $xlin + 42.5, ':  ' . $this->coddot);
                                         $this->objpdf->text($xcol + 17, $xlin + 48, ':  ' . $this->descr_licitacao);
                                         //// retangulo dos dados do credor
                                         $this->objpdf->rect($xcol + 106, $xlin + 2, 96, 18, 2, 'DF', '1234');
                                         $this->objpdf->Setfont('Arial', '', 6);
                                         $this->objpdf->text($xcol + 108, $xlin + 4, 'Dados do Credor:');
                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                         $this->objpdf->text($xcol + 107, $xlin + 7, 'Numcgm');
                                         $this->objpdf->text($xcol + 140, $xlin + 7, strlen($this->cnpj) == 11 ? 'CPF' : 'CNPJ');
                                         $this->objpdf->text($xcol + 107, $xlin + 11, 'Nome');
                                         $this->objpdf->text($xcol + 107, $xlin + 15, 'Endereço');
                                         $this->objpdf->text($xcol + 107, $xlin + 19, 'Município');
                                         $this->objpdf->Setfont('Arial', '', 8);
                                         $this->objpdf->text($xcol + 124, $xlin + 7, ': ' . $this->numcgm);
                                         $this->objpdf->text($xcol + 149, $xlin + 7, ':  ' . (strlen($this->cnpj) == 11 ? db_formatar($this->cnpj, 'cpf') : db_formatar($this->cnpj, 'cnpj')) . '   Fone: ' . $this->telefone);
                                         $this->objpdf->text($xcol + 124, $xlin + 11, ': ' . $this->nome);
                                         $this->objpdf->text($xcol + 124, $xlin + 15, ': ' . $this->ender . '  ' . $this->compl);
                                         $this->objpdf->text($xcol + 124, $xlin + 19, ': ' . $this->munic . '-' . $this->uf . '    CEP : ' . $this->cep);
                                         ///// retangulo dos valores
                                         $this->objpdf->rect($xcol + 106, $xlin + 21.5, 96, 9, 2, 'DF', '1234');
                                         $this->objpdf->rect($xcol + 106, $xlin + 32.0, 47, 9, 2, 'DF', '1234');
                                         $this->objpdf->rect($xcol + 155, $xlin + 32.0, 47, 9, 2, 'DF', '1234');
                                         $this->objpdf->rect($xcol + 106, $xlin + 42.5, 47, 9, 2, 'DF', '1234');
                                         $this->objpdf->rect($xcol + 155, $xlin + 42.5, 47, 9, 2, 'DF', '1234');
                                         $this->objpdf->Setfont('Arial', '', 6);
                                         $this->objpdf->text($xcol + 108, $xlin + 34.0, 'Valor Orçado');
                                         $this->objpdf->text($xcol + 157, $xlin + 34.0, 'Saldo Anterior');
                                         $this->objpdf->text($xcol + 108, $xlin + 44.5, 'Valor Empenhado');
                                         $this->objpdf->text($xcol + 157, $xlin + 44.5, 'Saldo Atual');
                                         $this->objpdf->Setfont('Arial', '', 8);
                                         $this->objpdf->text($xcol + 108, $xlin + 27, 'AUTORIZAÇÃO N' . chr(176) . ' ' . db_formatar($this->numaut, 's', '0', 5, 'e'));
                                         $this->objpdf->text($xcol + 150, $xlin + 27, 'SEQ. DO EMPENHO N' . chr(176) . ' ' . db_formatar($this->numemp, 's', '0', 6, 'e'));
                                         //	$this->objpdf->text($xcol+108,$xlin+26.5,$this->texto);
                                         $this->objpdf->text($xcol + 130, $xlin + 38.0, db_formatar($this->orcado, 'f'));
                                         $this->objpdf->text($xcol + 180, $xlin + 38.0, db_formatar($this->saldo_ant, 'f'));
                                         $this->objpdf->text($xcol + 130, $xlin + 47.5, db_formatar($this->empenhado, 'f'));
                                         $this->objpdf->text($xcol + 180, $xlin + 47.5, db_formatar($this->saldo_ant - $this->empenhado, 'f'));
                                         /// retangulo do corpo do empenho
                                         $this->objpdf->rect($xcol, $xlin + 60, 15, 100, 2, 'DF', '');
                                         $this->objpdf->rect($xcol + 15, $xlin + 60, 137, 100, 2, 'DF', '');
                                         $this->objpdf->rect($xcol + 152, $xlin + 60, 25, 123, 2, 'DF', '');
                                         $this->objpdf->rect($xcol + 177, $xlin + 60, 25, 123, 2, 'DF', '');
                                         $this->objpdf->rect($xcol, $xlin + 160, 152, 23, 2, 'DF', '');
                                         // resumo
                                         //// retangulos do titulo do corpo do empenho
                                         $this->objpdf->Setfont('Arial', 'B', 7);
                                         $this->objpdf->rect($xcol, $xlin + 54, 15, 6, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 15, $xlin + 54, 137, 6, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 152, $xlin + 54, 25, 6, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 177, $xlin + 54, 25, 6, 2, 'DF', '12');
                                         //// título do corpo do empenho
                                         $this->objpdf->text($xcol + 2, $xlin + 58, 'QUANT');
                                         $this->objpdf->text($xcol + 70, $xlin + 58, 'MATERIAL OU SERVIÇO');
                                         $this->objpdf->text($xcol + 154, $xlin + 58, 'VALOR UNITÁRIO');
                                         $this->objpdf->text($xcol + 181, $xlin + 58, 'VALOR TOTAL');
                                         $maiscol = 0;
                                         /// monta os dados para itens do empenho
                                         $this->objpdf->SetWidths(array(15, 137, 25, 25));
                                         $this->objpdf->SetAligns(array('C', 'L', 'R', 'R'));
                                         $this->objpdf->setleftmargin(4);
                                         $this->objpdf->sety($xlin + 62);
                                         $this->objpdf->Setfont('Arial', '', 7);
                                         $ele = 0;
                                         $xtotal = 0;
                                         for ($ii = 0; $ii < $this->linhasdositens; $ii++) {
                                             db_fieldsmemory($this->recorddositens, $ii);
                                             $this->objpdf->Setfont('Arial', 'B', 7);
                                             if ($ele != pg_result($this->recorddositens, $ii, $this->analitico)) {
                                                 $this->objpdf->cell(15, 4, '', 0, 0, "C", 0);
                                                 $this->objpdf->cell(137, 4, db_formatar(pg_result($this->recorddositens, $ii, $this->analitico), 'elemento') . ' - ' . pg_result($this->recorddositens, $ii, $this->descr_analitico), 0, 1, "L", 0);
                                                 $ele = pg_result($this->recorddositens, $ii, $this->analitico);
                                             }
                                             $this->objpdf->Setfont('Arial', '', 7);
                                             $this->objpdf->Row(array(pg_result($this->recorddositens, $ii, $this->quantitem), pg_result($this->recorddositens, $ii, $this->descricaoitem), db_formatar(pg_result($this->recorddositens, $ii, $this->valoritem) / pg_result($this->recorddositens, $ii, $this->quantitem), 'f'), db_formatar(pg_result($this->recorddositens, $ii, $this->valoritem), 'f')), 3, false, 4);
                                             $xtotal += pg_result($this->recorddositens, $ii, $this->valoritem);
                                             /////// troca de pagina
                                             if ($this->objpdf->gety() > $this->objpdf->h - 125 && $pagina == 1 || $this->objpdf->gety() > $this->objpdf->h - 22 && $pagina != 1) {
                                                 $proxima_pagina = $pagina + 1;
                                                 $this->objpdf->Row(array('', "Continua na página {$proxima_pagina}", '', ''), 3, false, 4);
                                                 if ($pagina == 1) {
                                                     $this->objpdf->rect($xcol, $xlin + 183, 152, 6, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol + 152, $xlin + 183, 25, 6, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol + 177, $xlin + 183, 25, 6, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol, $xlin + 197, 60, 47, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol + 60, $xlin + 197, 60, 47, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol + 120, $xlin + 197, 82, 47, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol + 120, $xlin + 216, 32, 28, 2, 'DF', '4');
                                                     //	   $this->objpdf->setfillcolor(0,0,0);
                                                     $this->objpdf->SetFont('Arial', '', 7);
                                                     $this->objpdf->text($xcol + 2, $xlin + 187, 'DESTINO : ', 0, 1, 'L', 0);
                                                     $this->objpdf->text($xcol + 30, $xlin + 187, $this->destino, 0, 1, 'L', 0);
                                                     $this->objpdf->setxy($xcol + 1, $xlin + 165);
                                                     $this->objpdf->text($xcol + 2, $xlin + 164, 'RESUMO : ', 0, 1, 'L', 0);
                                                     $this->objpdf->multicell(147, 3.5, $this->resumo);
                                                     $this->objpdf->text($xcol + 159, $xlin + 187, 'T O T A L', 0, 1, 'L', 0);
                                                     $this->objpdf->setxy($xcol + 185, $xlin + 182);
                                                     $this->objpdf->cell(30, 10, db_formatar($this->empenhado, 'f'), 0, 0, 'f');
                                                     $this->objpdf->rect($xcol, $xlin + 191, 60, 6, 2, 'DF', '12');
                                                     $this->objpdf->rect($xcol + 60, $xlin + 191, 60, 6, 2, 'DF', '12');
                                                     $this->objpdf->rect($xcol + 120, $xlin + 191, 82, 6, 2, 'DF', '12');
                                                     $this->objpdf->text($xcol + 15, $xlin + 195, 'CONTADORIA GERAL');
                                                     $this->objpdf->text($xcol + 82, $xlin + 195, 'PAGUE-SE');
                                                     $this->objpdf->text($xcol + 150, $xlin + 195, 'TESOURARIA');
                                                     if ($this->assinatura1 != "") {
                                                         //               $this->objpdf->line($xcol+5,$xlin+211,$xcol+54,$xlin+211);
                                                     }
                                                     if ($assinatura2 != "") {
                                                         $this->objpdf->line($xcol + 5, $xlin + 215, $xcol + 54, $xlin + 225);
                                                     }
                                                     if ($assinatura3 != "") {
                                                         $this->objpdf->line($xcol + 5, $xlin + 235, $xcol + 54, $xlin + 238);
                                                     }
                                                     $this->objpdf->line($xcol + 65, $xlin + 225, $xcol + 114, $xlin + 225);
                                                     $this->objpdf->SetFont('Arial', '', 6);
                                                     //         $this->objpdf->text($xcol+12,$xlin+199,'EMPENHADO E CONFERIDO');
                                                     $this->objpdf->text($xcol + 27 - strlen($this->assinatura1) / 2, $xlin + 218, $this->assinatura1);
                                                     $this->objpdf->text($xcol + 27 - strlen($assinatura2) / 2, $xlin + 238, $assinatura2);
                                                     $this->objpdf->text($xcol + 27 - strlen($assinatura3) / 2, $xlin + 241, $assinatura3);
                                                     //           $this->objpdf->text($xcol+66,$xlin+212,'DATA  ____________/____________/____________');
                                                     $this->objpdf->text($xcol + 88 - strlen($assinaturaprefeito) / 2, $xlin + 228, $assinaturaprefeito);
                                                     $this->objpdf->text($xcol + 88 - strlen("PREFEITO MUNICIPAL") / 2, $xlin + 231, "PREFEITO MUNICIPAL");
                                                     //	   $this->objpdf->text($xcol+66,$xlin+212,'DATA  ____________/____________/____________');
                                                     //  $this->objpdf->text($xcol+76,$xlin+227,'PREFEITO MUNICIPAL');
                                                     $this->objpdf->text($xcol + 122, $xlin + 207, 'CHEQUE N' . chr(176));
                                                     $this->objpdf->text($xcol + 170, $xlin + 207, 'DATA');
                                                     $this->objpdf->text($xcol + 122, $xlin + 215, 'BANCO N' . chr(176));
                                                     $this->objpdf->text($xcol + 127, $xlin + 218, 'DOCUMENTO N' . chr(176));
                                                     $this->objpdf->line($xcol + 155, $xlin + 240, $xcol + 200, $xlin + 240);
                                                     $this->objpdf->text($xcol + 170, $xlin + 242, 'TESOUREIRO');
                                                     $this->objpdf->rect($xcol, $xlin + 246, 202, 26, 2, 'DF', '1234');
                                                     $this->objpdf->SetFont('Arial', '', 7);
                                                     $this->objpdf->text($xcol + 90, $xlin + 249, 'R E C I B O');
                                                     $this->objpdf->text($xcol + 45, $xlin + 253, 'RECEBI(EMOS) DO MUNICÍPIO DE ' . $this->municpref . ', A IMPORTÂNCIA ABAIXO ESPECIFICADA, REFERENTE À:');
                                                     $this->objpdf->text($xcol + 2, $xlin + 257, '(     ) PARTE DO VALOR EMPENHADO');
                                                     $this->objpdf->text($xcol + 102, $xlin + 257, '(     ) SALDO/TOTAL EMPENHADO');
                                                     $this->objpdf->text($xcol + 2, $xlin + 261, 'R$');
                                                     $this->objpdf->text($xcol + 102, $xlin + 261, 'R$');
                                                     $this->objpdf->text($xcol + 2, $xlin + 265, 'EM ________/________/________', 0, 0, 'C', 0);
                                                     $this->objpdf->text($xcol + 42, $xlin + 265, '_________________________________________', 0, 0, 'C', 0);
                                                     $this->objpdf->text($xcol + 102, $xlin + 265, 'EM ________/________/________', 0, 0, 'C', 0);
                                                     $this->objpdf->text($xcol + 142, $xlin + 265, '_________________________________________', 0, 1, 'C', 0);
                                                     $this->objpdf->SetFont('Arial', '', 6);
                                                     $this->objpdf->text($xcol + 62, $xlin + 269, 'CREDOR', 0, 0, 'C', 0);
                                                     $this->objpdf->text($xcol + 162, $xlin + 269, 'CREDOR', 0, 1, 'C', 0);
                                                     $this->objpdf->SetFont('Arial', '', 4);
                                                     $this->objpdf->Text(2, 296, $this->texto);
                                                     // texto no canhoto do carne
                                                     $this->objpdf->setfont('Arial', '', 11);
                                                     $xlin = 169;
                                                 }
                                                 $this->objpdf->addpage();
                                                 $pagina += 1;
                                                 $this->objpdf->settopmargin(1);
                                                 $xlin = 20;
                                                 $xcol = 4;
                                                 $this->objpdf->setfillcolor(245);
                                                 $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                                 $this->objpdf->setfillcolor(255, 255, 255);
                                                 $this->objpdf->Setfont('Arial', 'B', 11);
                                                 $this->objpdf->text(128, $xlin - 13, 'NOTA DE EMPENHO N' . CHR(176) . ': ');
                                                 $this->objpdf->text(175, $xlin - 13, db_formatar($this->codemp, 's', '0', 6, 'e'));
                                                 $this->objpdf->text(134, $xlin - 8, 'DATA DE EMISSÃO : ');
                                                 $this->objpdf->text(175, $xlin - 8, $this->emissao);
                                                 $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                                 //.$this->logo
                                                 $this->objpdf->Setfont('Arial', 'B', 9);
                                                 $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                                 $this->objpdf->Setfont('Arial', '', 9);
                                                 $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                                 $this->objpdf->text(40, $xlin - 8, $this->municpref);
                                                 $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                                                 $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                                                 $xlin = -30;
                                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                                 //  	    $this->objpdf->Roundedrect($xcol,$xlin+54,15,6,2,'DF','12');
                                                 $this->objpdf->rect($xcol, $xlin + 54, 15, 6, 2, 'DF', '12');
                                                 $this->objpdf->rect($xcol + 15, $xlin + 54, 127, 6, 2, 'DF', '12');
                                                 $this->objpdf->rect($xcol + 142, $xlin + 54, 35, 6, 2, 'DF', '12');
                                                 $this->objpdf->rect($xcol + 177, $xlin + 54, 25, 6, 2, 'DF', '12');
                                                 //  	    $this->objpdf->Roundedrect($xcol,$xlin+60,15,262,2,'DF','34');
                                                 $this->objpdf->rect($xcol, $xlin + 60, 15, 262, 2, 'DF', '34');
                                                 $this->objpdf->rect($xcol + 15, $xlin + 60, 127, 262, 2, 'DF', '34');
                                                 $this->objpdf->rect($xcol + 142, $xlin + 60, 35, 262, 2, 'DF', '34');
                                                 $this->objpdf->rect($xcol + 177, $xlin + 60, 25, 262, 2, 'DF', '34');
                                                 $this->objpdf->sety($xlin + 66);
                                                 $alt = 4;
                                                 //	    $this->objpdf->text($xcol+4,$xlin+58,'ITEM');
                                                 $this->objpdf->text($xcol + 0.5, $xlin + 58, 'QUANT');
                                                 $this->objpdf->text($xcol + 65, $xlin + 58, 'MATERIAL OU SERVIÇO');
                                                 $this->objpdf->text($xcol + 145, $xlin + 58, 'VALOR UNITÁRIO');
                                                 $this->objpdf->text($xcol + 179, $xlin + 58, 'VALOR TOTAL');
                                                 $this->objpdf->text($xcol + 38, $xlin + 63, 'Continuação da Página ' . ($this->objpdf->PageNo() - 1));
                                                 $maiscol = 0;
                                             }
                                         }
                                         if ($pagina == 1) {
                                             $this->objpdf->rect($xcol, $xlin + 183, 152, 6, 2, 'DF', '34');
                                             $this->objpdf->rect($xcol + 152, $xlin + 183, 25, 6, 2, 'DF', '34');
                                             $this->objpdf->rect($xcol + 177, $xlin + 183, 25, 6, 2, 'DF', '34');
                                             //	   $this->objpdf->setfillcolor(0,0,0);
                                             $this->objpdf->SetFont('Arial', '', 7);
                                             $this->objpdf->text($xcol + 2, $xlin + 187, 'DESTINO : ', 0, 1, 'L', 0);
                                             $this->objpdf->text($xcol + 30, $xlin + 187, $this->destino, 0, 1, 'L', 0);
                                             $this->objpdf->setxy($xcol + 1, $xlin + 165);
                                             $this->objpdf->text($xcol + 2, $xlin + 164, 'RESUMO : ', 0, 1, 'L', 0);
                                             $this->objpdf->multicell(147, 3.5, $this->resumo);
                                             $this->objpdf->text($xcol + 159, $xlin + 187, 'T O T A L', 0, 1, 'L', 0);
                                             $this->objpdf->setxy($xcol + 185, $xlin + 182);
                                             $this->objpdf->cell(30, 10, db_formatar($this->empenhado, 'f'), 0, 0, 'f');
                                             //	   $this->rodape($mod_rodape);
                                             $this->objpdf->rect($xcol, $xlin + 197, 60, 47, 2, 'DF', '34');
                                             $this->objpdf->rect($xcol + 60, $xlin + 197, 60, 47, 2, 'DF', '34');
                                             $this->objpdf->rect($xcol + 120, $xlin + 197, 82, 47, 2, 'DF', '34');
                                             $this->objpdf->rect($xcol + 120, $xlin + 216, 32, 28, 2, 'DF', '4');
                                             $this->objpdf->rect($xcol, $xlin + 191, 60, 6, 2, 'DF', '12');
                                             $this->objpdf->rect($xcol + 60, $xlin + 191, 60, 6, 2, 'DF', '12');
                                             $this->objpdf->rect($xcol + 120, $xlin + 191, 82, 6, 2, 'DF', '12');
                                             $this->objpdf->text($xcol + 15, $xlin + 195, 'CONTADORIA GERAL');
                                             $this->objpdf->text($xcol + 82, $xlin + 195, 'PAGUE-SE');
                                             $this->objpdf->text($xcol + 150, $xlin + 195, 'TESOURARIA');
                                             if ($this->assinatura1 != "") {
                                                 //////////               $this->objpdf->line($xcol+5,$xlin+211,$xcol+54,$xlin+211);
                                             }
                                             if ($assinatura2 != "") {
                                                 $this->objpdf->line($xcol + 5, $xlin + 215, $xcol + 54, $xlin + 215);
                                             }
                                             if ($assinatura3 != "") {
                                                 $this->objpdf->line($xcol + 5, $xlin + 235, $xcol + 54, $xlin + 235);
                                                 //////////
                                             }
                                             $this->objpdf->line($xcol + 65, $xlin + 225, $xcol + 114, $xlin + 225);
                                             $this->objpdf->SetFont('Arial', '', 6);
                                             //         $this->objpdf->text($xcol+12,$xlin+199,'EMPENHADO E CONFERIDO');
                                             //////////           $this->objpdf->text($xcol+27-(strlen($this->assinatura1)/2),$xlin+213,$this->assinatura1);
                                             $this->objpdf->text($xcol + 27 - strlen($assinatura2) / 2, $xlin + 218, $assinatura2);
                                             $this->objpdf->text($xcol + 27 - strlen($assinatura3) / 2, $xlin + 238, $assinatura3);
                                             //////////
                                             $this->objpdf->text($xcol + 27 - strlen($this->assinatura4) / 2, $xlin + 241, $this->assinatura4);
                                             //////////
                                             ////           $this->objpdf->text($xcol+66,$xlin+212,'DATA  ____________/____________/____________');
                                             $this->objpdf->text($xcol + 88 - strlen($assinaturaprefeito) / 2, $xlin + 228, $assinaturaprefeito);
                                             $this->objpdf->text($xcol + 88 - strlen("PREFEITO MUNICIPAL") / 2, $xlin + 231, "PREFEITO MUNICIPAL");
                                             $this->objpdf->text($xcol + 122, $xlin + 207, 'CHEQUE N' . chr(176));
                                             $this->objpdf->text($xcol + 170, $xlin + 207, 'DATA');
                                             $this->objpdf->text($xcol + 122, $xlin + 215, 'BANCO N' . chr(176));
                                             $this->objpdf->text($xcol + 127, $xlin + 218, 'DOCUMENTO N' . chr(176));
                                             $this->objpdf->line($xcol + 155, $xlin + 240, $xcol + 200, $xlin + 240);
                                             $this->objpdf->text($xcol + 170, $xlin + 242, 'TESOUREIRO');
                                             $this->objpdf->rect($xcol, $xlin + 246, 202, 26, 2, 'DF', '1234');
                                             //////	   $this->objpdf->text($xcol+2,$xlin+250,'RESUMO: ',0,1,'L',0);
                                             //////	   $this->objpdf->setxy($xcol+1,$xlin+252);
                                             ////// 	   $this->objpdf->multicell(147,3.5,$this->resumo);
                                             /*
                                             	     
                                             	     $this->objpdf->SetFont('Arial','',7);
                                             
                                             	     $this->objpdf->text($xcol+90,$xlin+249,'R E C I B O');
                                             	     $this->objpdf->text($xcol+45,$xlin+253,'RECEBI(EMOS) DO MUNICÍPIO DE '.$this->municpref.', A IMPORTÂNCIA ABAIXO ESPECIFICADA, REFERENTE À:');
                                             	     $this->objpdf->text($xcol+2,$xlin+257,'(     ) PARTE DO VALOR EMPENHADO');
                                             	     $this->objpdf->text($xcol+102,$xlin+257,'(     ) SALDO/TOTAL EMPENHADO');
                                             	     $this->objpdf->text($xcol+2,$xlin+261,'R$');
                                             	     $this->objpdf->text($xcol+102,$xlin+261,'R$');
                                             	     $this->objpdf->text($xcol+2,$xlin+265,'EM ________/________/________',0,0,'C',0);
                                             	     $this->objpdf->text($xcol+42,$xlin+265,'_________________________________________',0,0,'C',0);
                                             	     $this->objpdf->text($xcol+102,$xlin+265,'EM ________/________/________',0,0,'C',0);
                                             	     $this->objpdf->text($xcol+142,$xlin+265,'_________________________________________',0,1,'C',0);
                                             	     $this->objpdf->SetFont('Arial','',6);
                                             	     $this->objpdf->text($xcol+62,$xlin+269,'CREDOR',0,0,'C',0);
                                             	     $this->objpdf->text($xcol+162,$xlin+269,'CREDOR',0,1,'C',0);
                                             	     
                                             	     $this->objpdf->SetFont('Arial','',4);
                                             	     $this->objpdf->Text(2,296,$this->texto); // texto no canhoto do carne
                                             	     $this->objpdf->SetFont('Arial','',6);
                                             	     $this->objpdf->Text(200,296,($xxx+1).' via'); // texto no canhoto do carne
                                             	     $this->objpdf->setfont('Arial','',11);
                                             */
                                             $xlin = 169;
                                         }
                                     }
                                 } else {
                                     for ($xxx = 0; $xxx < $this->nvias; $xxx++) {
                                         $this->objpdf->AliasNbPages();
                                         $this->objpdf->AddPage();
                                         $this->objpdf->settopmargin(1);
                                         $pagina = 1;
                                         $xlin = 20;
                                         $xcol = 4;
                                         $this->objpdf->setfillcolor(245);
                                         $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                         $this->objpdf->setfillcolor(255, 255, 255);
                                         $this->objpdf->Setfont('Arial', 'B', 10);
                                         $this->objpdf->text(128, $xlin - 13, 'NOTA DE EMPENHO N' . CHR(176) . ': ');
                                         $this->objpdf->text(175, $xlin - 13, db_formatar($this->codemp, 's', '0', 6, 'e'));
                                         $this->objpdf->text(134, $xlin - 8, 'DATA DE EMISSÃO : ');
                                         $this->objpdf->text(175, $xlin - 8, $this->emissao);
                                         $this->objpdf->text(159, $xlin - 3, 'TIPO : ');
                                         $this->objpdf->text(175, $xlin - 3, $this->emptipo);
                                         $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                         //.$this->logo
                                         $this->objpdf->Setfont('Arial', 'B', 9);
                                         $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                         $this->objpdf->Setfont('Arial', '', 7);
                                         $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                         $this->objpdf->text(40, $xlin - 8, $this->municpref);
                                         $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                                         $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                                         $this->objpdf->text(40, $xlin + 1, db_formatar($this->cgcpref, 'cnpj'));
                                         /// retangulo dos dados da dotação
                                         $this->objpdf->rect($xcol, $xlin + 2, $xcol + 100, 50, 2, 'DF', '1234');
                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                         $this->objpdf->text($xcol + 2, $xlin + 7, 'Órgao');
                                         $this->objpdf->text($xcol + 2, $xlin + 10.5, 'Unidade');
                                         $this->objpdf->text($xcol + 2, $xlin + 14, 'Função');
                                         $this->objpdf->text($xcol + 2, $xlin + 20.5, 'Proj/Ativ');
                                         $this->objpdf->text($xcol + 2, $xlin + 27, 'Rubrica');
                                         $this->objpdf->text($xcol + 2, $xlin + 35, 'Recurso');
                                         if ($this->banco != "") {
                                             $this->objpdf->text($xcol + 2, $xlin + 38.5, 'Banco');
                                             $this->objpdf->text($xcol + 30, $xlin + 38.5, 'Agencia:');
                                             $this->objpdf->text($xcol + 60, $xlin + 38.5, 'Conta:');
                                         }
                                         $this->objpdf->text($xcol + 2, $xlin + 42.5, 'Reduzido');
                                         $this->objpdf->text($xcol + 2, $xlin + 48, 'Licitação');
                                         $this->objpdf->Setfont('Arial', '', 8);
                                         $this->objpdf->text($xcol + 17, $xlin + 7, ':  ' . db_formatar($this->orgao, 'orgao') . ' - ' . $this->descr_orgao);
                                         $this->objpdf->text($xcol + 17, $xlin + 10.5, ':  ' . db_formatar($this->unidade, 'unidade') . ' - ' . $this->descr_unidade);
                                         $this->objpdf->text($xcol + 17, $xlin + 14, ':  ' . db_formatar($this->funcao, 'funcao') . ' - ' . $this->descr_funcao);
                                         $this->objpdf->text($xcol + 17, $xlin + 20.5, ':  ' . db_formatar($this->projativ, 'projativ') . ' - ' . $this->descr_projativ);
                                         $this->objpdf->text($xcol + 17, $xlin + 27, ':  ' . db_formatar($this->sintetico, 'elemento'));
                                         $this->objpdf->setxy($xcol + 18, $xlin + 28);
                                         $this->objpdf->multicell(90, 3, $this->descr_sintetico, 0, "L");
                                         $this->objpdf->text($xcol + 17, $xlin + 35, ':  ' . $this->recurso . ' - ' . $this->descr_recurso);
                                         if ($this->banco != "") {
                                             $this->objpdf->text($xcol + 17, $xlin + 38.5, ':  ' . $this->banco);
                                             $this->objpdf->text($xcol + 47, $xlin + 38.5, $this->agencia);
                                             $this->objpdf->text($xcol + 77, $xlin + 38.5, $this->conta);
                                         }
                                         $this->objpdf->text($xcol + 17, $xlin + 42.5, ':  ' . $this->coddot);
                                         $this->objpdf->text($xcol + 17, $xlin + 48, ':  ' . ($this->num_licitacao != null ? $this->num_licitacao . ' - ' : '') . $this->descr_licitacao);
                                         //// retangulo dos dados do credor
                                         $this->objpdf->rect($xcol + 106, $xlin + 2, 96, 18, 2, 'DF', '1234');
                                         $this->objpdf->Setfont('Arial', '', 6);
                                         $this->objpdf->text($xcol + 108, $xlin + 4, 'Dados do Credor:');
                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                         $this->objpdf->text($xcol + 107, $xlin + 7, 'Numcgm');
                                         $this->objpdf->text($xcol + 135, $xlin + 7, strlen($this->cnpj) == 11 ? 'CPF' : 'CNPJ');
                                         $this->objpdf->text($xcol + 107, $xlin + 11, 'Nome');
                                         $this->objpdf->text($xcol + 107, $xlin + 15, 'Endereço');
                                         $this->objpdf->text($xcol + 107, $xlin + 19, 'Município');
                                         $this->objpdf->Setfont('Arial', '', 8);
                                         $this->objpdf->text($xcol + 124, $xlin + 7, ': ' . $this->numcgm);
                                         $this->objpdf->text($xcol + 143, $xlin + 7, ': ' . (strlen($this->cnpj) == 11 ? db_formatar($this->cnpj, 'cpf') : db_formatar($this->cnpj, 'cnpj')) . ' - Fone: ' . $this->telefone);
                                         $this->objpdf->text($xcol + 124, $xlin + 11, ': ' . $this->nome);
                                         $this->objpdf->text($xcol + 124, $xlin + 15, ': ' . $this->ender . '  ' . $this->compl);
                                         $this->objpdf->text($xcol + 124, $xlin + 19, ': ' . $this->munic . '-' . $this->uf . '    CEP : ' . $this->cep);
                                         ///// retangulo dos valores
                                         $this->objpdf->rect($xcol + 106, $xlin + 21.5, 96, 9, 2, 'DF', '1234');
                                         $this->objpdf->rect($xcol + 106, $xlin + 32.0, 47, 9, 2, 'DF', '1234');
                                         $this->objpdf->rect($xcol + 155, $xlin + 32.0, 47, 9, 2, 'DF', '1234');
                                         $this->objpdf->rect($xcol + 106, $xlin + 42.5, 47, 9, 2, 'DF', '1234');
                                         $this->objpdf->rect($xcol + 155, $xlin + 42.5, 47, 9, 2, 'DF', '1234');
                                         $this->objpdf->Setfont('Arial', '', 6);
                                         $this->objpdf->text($xcol + 108, $xlin + 34.0, 'Valor Orçado');
                                         $this->objpdf->text($xcol + 157, $xlin + 34.0, 'Saldo Anterior');
                                         $this->objpdf->text($xcol + 108, $xlin + 44.5, 'Valor Empenhado');
                                         $this->objpdf->text($xcol + 157, $xlin + 44.5, 'Saldo Atual');
                                         $this->objpdf->Setfont('Arial', '', 8);
                                         $this->objpdf->text($xcol + 108, $xlin + 27, 'AUTORIZAÇÃO N' . chr(176) . ' ' . db_formatar($this->numaut, 's', '0', 5, 'e'));
                                         $this->objpdf->text($xcol + 150, $xlin + 27, 'SEQ. DO EMPENHO N' . chr(176) . ' ' . db_formatar($this->numemp, 's', '0', 6, 'e'));
                                         //	$this->objpdf->text($xcol+108,$xlin+26.5,$this->texto);
                                         $this->objpdf->text($xcol + 130, $xlin + 38.0, db_formatar($this->orcado, 'f'));
                                         $this->objpdf->text($xcol + 180, $xlin + 38.0, db_formatar($this->saldo_ant, 'f'));
                                         $this->objpdf->text($xcol + 130, $xlin + 47.5, db_formatar($this->empenhado, 'f'));
                                         $this->objpdf->text($xcol + 180, $xlin + 47.5, db_formatar($this->saldo_ant - $this->empenhado, 'f'));
                                         /// retangulo do corpo do empenho
                                         $this->objpdf->rect($xcol, $xlin + 60, 15, 100, 2, 'DF', '');
                                         $this->objpdf->rect($xcol + 15, $xlin + 60, 137, 100, 2, 'DF', '');
                                         $this->objpdf->rect($xcol + 152, $xlin + 60, 25, 123, 2, 'DF', '');
                                         $this->objpdf->rect($xcol + 177, $xlin + 60, 25, 123, 2, 'DF', '');
                                         $this->objpdf->rect($xcol, $xlin + 160, 152, 23, 2, 'DF', '');
                                         //// retangulos do titulo do corpo do empenho
                                         $this->objpdf->Setfont('Arial', 'B', 7);
                                         $this->objpdf->rect($xcol, $xlin + 54, 15, 6, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 15, $xlin + 54, 137, 6, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 152, $xlin + 54, 25, 6, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 177, $xlin + 54, 25, 6, 2, 'DF', '12');
                                         //// título do corpo do empenho
                                         $this->objpdf->text($xcol + 2, $xlin + 58, 'QUANT');
                                         $this->objpdf->text($xcol + 70, $xlin + 58, 'MATERIAL OU SERVIÇO');
                                         $this->objpdf->text($xcol + 154, $xlin + 58, 'VALOR UNITÁRIO');
                                         $this->objpdf->text($xcol + 181, $xlin + 58, 'VALOR TOTAL');
                                         $maiscol = 0;
                                         /// monta os dados para itens do empenho
                                         $this->objpdf->SetWidths(array(15, 137, 25, 25));
                                         $this->objpdf->SetAligns(array('C', 'L', 'R', 'R'));
                                         $this->objpdf->setleftmargin(4);
                                         $this->objpdf->sety($xlin + 62);
                                         $this->objpdf->Setfont('Arial', '', 7);
                                         $ele = 0;
                                         $xtotal = 0;
                                         for ($ii = 0; $ii < $this->linhasdositens; $ii++) {
                                             db_fieldsmemory($this->recorddositens, $ii);
                                             $this->objpdf->Setfont('Arial', 'B', 7);
                                             if ($ele != pg_result($this->recorddositens, $ii, $this->analitico)) {
                                                 $this->objpdf->cell(15, 4, '', 0, 0, "C", 0);
                                                 $this->objpdf->cell(137, 4, db_formatar(pg_result($this->recorddositens, $ii, $this->analitico), 'elemento') . ' - ' . pg_result($this->recorddositens, $ii, $this->descr_analitico), 0, 1, "L", 0);
                                                 $ele = pg_result($this->recorddositens, $ii, $this->analitico);
                                             }
                                             $this->objpdf->Setfont('Arial', '', 7);
                                             $this->objpdf->Row(array(pg_result($this->recorddositens, $ii, $this->quantitem), pg_result($this->recorddositens, $ii, $this->descricaoitem), db_formatar(pg_result($this->recorddositens, $ii, $this->valoritem) / pg_result($this->recorddositens, $ii, $this->quantitem), 'f'), db_formatar(pg_result($this->recorddositens, $ii, $this->valoritem), 'f')), 3, false, 4);
                                             $xtotal += pg_result($this->recorddositens, $ii, $this->valoritem);
                                             /////// troca de pagina
                                             if ($this->objpdf->gety() > $this->objpdf->h - 125 && $pagina == 1 || $this->objpdf->gety() > $this->objpdf->h - 22 && $pagina != 1) {
                                                 $proxima_pagina = $pagina + 1;
                                                 $this->objpdf->Row(array('', "Continua na página {$proxima_pagina}", '', ''), 3, false, 4);
                                                 if ($pagina == 1) {
                                                     $this->objpdf->rect($xcol, $xlin + 183, 152, 6, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol + 152, $xlin + 183, 25, 6, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol + 177, $xlin + 183, 25, 6, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol, $xlin + 197, 60, 47, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol + 60, $xlin + 197, 60, 47, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol + 120, $xlin + 197, 82, 47, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol + 120, $xlin + 216, 32, 28, 2, 'DF', '4');
                                                     //	   $this->objpdf->setfillcolor(0,0,0);
                                                     $this->objpdf->SetFont('Arial', '', 7);
                                                     $this->objpdf->text($xcol + 2, $xlin + 187, 'DESTINO : ', 0, 1, 'L', 0);
                                                     $this->objpdf->text($xcol + 30, $xlin + 187, $this->destino, 0, 1, 'L', 0);
                                                     $this->objpdf->setxy($xcol + 1, $xlin + 165);
                                                     $this->objpdf->text($xcol + 2, $xlin + 164, 'RESUMO : ', 0, 1, 'L', 0);
                                                     $this->objpdf->multicell(147, 3.5, $this->resumo);
                                                     $this->objpdf->text($xcol + 159, $xlin + 187, 'T O T A L', 0, 1, 'L', 0);
                                                     $this->objpdf->setxy($xcol + 185, $xlin + 182);
                                                     $this->objpdf->cell(30, 10, db_formatar($this->empenhado, 'f'), 0, 0, 'f');
                                                     $this->objpdf->rect($xcol, $xlin + 191, 60, 6, 2, 'DF', '12');
                                                     $this->objpdf->rect($xcol + 60, $xlin + 191, 60, 6, 2, 'DF', '12');
                                                     $this->objpdf->rect($xcol + 120, $xlin + 191, 82, 6, 2, 'DF', '12');
                                                     $this->objpdf->text($xcol + 15, $xlin + 195, 'CONTADORIA GERAL');
                                                     $this->objpdf->text($xcol + 82, $xlin + 195, 'PAGUE-SE');
                                                     $this->objpdf->text($xcol + 150, $xlin + 195, 'TESOURARIA');
                                                     if ($this->assinatura1 != "") {
                                                         $this->objpdf->line($xcol + 5, $xlin + 211, $xcol + 54, $xlin + 211);
                                                     }
                                                     if ($this->assinatura2 != "") {
                                                         $this->objpdf->line($xcol + 5, $xlin + 225, $xcol + 54, $xlin + 225);
                                                     }
                                                     if ($this->assinatura3 != "") {
                                                         $this->objpdf->line($xcol + 5, $xlin + 238, $xcol + 54, $xlin + 238);
                                                     }
                                                     $this->objpdf->line($xcol + 65, $xlin + 225, $xcol + 114, $xlin + 225);
                                                     $this->objpdf->SetFont('Arial', '', 6);
                                                     //         $this->objpdf->text($xcol+12,$xlin+199,'EMPENHADO E CONFERIDO');
                                                     $this->objpdf->text($xcol + 27 - strlen($this->assinatura1) / 2, $xlin + 213, $this->assinatura1);
                                                     $this->objpdf->text($xcol + 27 - strlen($this->assinatura2) / 2, $xlin + 227, $this->assinatura2);
                                                     $this->objpdf->text($xcol + 27 - strlen($this->assinatura3) / 2, $xlin + 240, $this->assinatura3);
                                                     $this->objpdf->text($xcol + 66, $xlin + 212, 'DATA  ____________/____________/____________');
                                                     $this->objpdf->text($xcol + 88 - strlen($this->assinaturaprefeito) / 2, $xlin + 227, $this->assinaturaprefeito);
                                                     $this->objpdf->text($xcol + 66, $xlin + 212, 'DATA  ____________/____________/____________');
                                                     //  $this->objpdf->text($xcol+76,$xlin+227,'PREFEITO MUNICIPAL');
                                                     $this->objpdf->text($xcol + 122, $xlin + 207, 'CHEQUE N' . chr(176));
                                                     $this->objpdf->text($xcol + 170, $xlin + 207, 'DATA');
                                                     $this->objpdf->text($xcol + 122, $xlin + 215, 'BANCO N' . chr(176));
                                                     $this->objpdf->text($xcol + 127, $xlin + 218, 'DOCUMENTO N' . chr(176));
                                                     $this->objpdf->line($xcol + 155, $xlin + 240, $xcol + 200, $xlin + 240);
                                                     $this->objpdf->text($xcol + 170, $xlin + 242, 'TESOUREIRO');
                                                     $this->objpdf->rect($xcol, $xlin + 246, 202, 26, 2, 'DF', '1234');
                                                     $this->objpdf->SetFont('Arial', '', 7);
                                                     $this->objpdf->text($xcol + 90, $xlin + 249, 'R E C I B O');
                                                     $this->objpdf->text($xcol + 45, $xlin + 253, 'RECEBI(EMOS) DO MUNICÍPIO DE ' . $this->municpref . ', A IMPORTÂNCIA ABAIXO ESPECIFICADA, REFERENTE À:');
                                                     $this->objpdf->text($xcol + 2, $xlin + 257, '(     ) PARTE DO VALOR EMPENHADO');
                                                     $this->objpdf->text($xcol + 102, $xlin + 257, '(     ) SALDO/TOTAL EMPENHADO');
                                                     $this->objpdf->text($xcol + 2, $xlin + 261, 'R$');
                                                     $this->objpdf->text($xcol + 102, $xlin + 261, 'R$');
                                                     $this->objpdf->text($xcol + 2, $xlin + 265, 'EM ________/________/________', 0, 0, 'C', 0);
                                                     $this->objpdf->text($xcol + 42, $xlin + 265, '_________________________________________', 0, 0, 'C', 0);
                                                     $this->objpdf->text($xcol + 102, $xlin + 265, 'EM ________/________/________', 0, 0, 'C', 0);
                                                     $this->objpdf->text($xcol + 142, $xlin + 265, '_________________________________________', 0, 1, 'C', 0);
                                                     $this->objpdf->SetFont('Arial', '', 6);
                                                     $this->objpdf->text($xcol + 62, $xlin + 269, 'CREDOR', 0, 0, 'C', 0);
                                                     $this->objpdf->text($xcol + 162, $xlin + 269, 'CREDOR', 0, 1, 'C', 0);
                                                     $this->objpdf->SetFont('Arial', '', 4);
                                                     $this->objpdf->Text(2, 296, $this->texto);
                                                     // texto no canhoto do carne
                                                     $this->objpdf->setfont('Arial', '', 11);
                                                     $xlin = 169;
                                                 }
                                                 $this->objpdf->addpage();
                                                 $pagina += 1;
                                                 $this->objpdf->settopmargin(1);
                                                 $xlin = 20;
                                                 $xcol = 4;
                                                 $this->objpdf->setfillcolor(245);
                                                 $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                                 $this->objpdf->setfillcolor(255, 255, 255);
                                                 $this->objpdf->Setfont('Arial', 'B', 11);
                                                 $this->objpdf->text(128, $xlin - 13, 'NOTA DE EMPENHO N' . CHR(176) . ': ');
                                                 $this->objpdf->text(175, $xlin - 13, db_formatar($this->codemp, 's', '0', 6, 'e'));
                                                 $this->objpdf->text(134, $xlin - 8, 'DATA DE EMISSÃO : ');
                                                 $this->objpdf->text(175, $xlin - 8, $this->emissao);
                                                 $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                                 //.$this->logo
                                                 $this->objpdf->Setfont('Arial', 'B', 9);
                                                 $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                                 $this->objpdf->Setfont('Arial', '', 9);
                                                 $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                                 $this->objpdf->text(40, $xlin - 8, $this->municpref);
                                                 $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                                                 $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                                                 $xlin = -30;
                                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                                 //  	    $this->objpdf->Roundedrect($xcol,$xlin+54,15,6,2,'DF','12');
                                                 $this->objpdf->rect($xcol, $xlin + 54, 15, 6, 2, 'DF', '12');
                                                 $this->objpdf->rect($xcol + 15, $xlin + 54, 127, 6, 2, 'DF', '12');
                                                 $this->objpdf->rect($xcol + 142, $xlin + 54, 35, 6, 2, 'DF', '12');
                                                 $this->objpdf->rect($xcol + 177, $xlin + 54, 25, 6, 2, 'DF', '12');
                                                 //  	    $this->objpdf->Roundedrect($xcol,$xlin+60,15,262,2,'DF','34');
                                                 $this->objpdf->rect($xcol, $xlin + 60, 15, 262, 2, 'DF', '34');
                                                 $this->objpdf->rect($xcol + 15, $xlin + 60, 127, 262, 2, 'DF', '34');
                                                 $this->objpdf->rect($xcol + 142, $xlin + 60, 35, 262, 2, 'DF', '34');
                                                 $this->objpdf->rect($xcol + 177, $xlin + 60, 25, 262, 2, 'DF', '34');
                                                 $this->objpdf->sety($xlin + 66);
                                                 $alt = 4;
                                                 //	    $this->objpdf->text($xcol+4,$xlin+58,'ITEM');
                                                 $this->objpdf->text($xcol + 0.5, $xlin + 58, 'QUANT');
                                                 $this->objpdf->text($xcol + 65, $xlin + 58, 'MATERIAL OU SERVIÇO');
                                                 $this->objpdf->text($xcol + 145, $xlin + 58, 'VALOR UNITÁRIO');
                                                 $this->objpdf->text($xcol + 179, $xlin + 58, 'VALOR TOTAL');
                                                 $this->objpdf->text($xcol + 38, $xlin + 63, 'Continuação da Página ' . ($this->objpdf->PageNo() - 1));
                                                 $maiscol = 0;
                                             }
                                         }
                                         if ($pagina == 1) {
                                             $this->objpdf->rect($xcol, $xlin + 183, 152, 6, 2, 'DF', '34');
                                             $this->objpdf->rect($xcol + 152, $xlin + 183, 25, 6, 2, 'DF', '34');
                                             $this->objpdf->rect($xcol + 177, $xlin + 183, 25, 6, 2, 'DF', '34');
                                             //	   $this->objpdf->setfillcolor(0,0,0);
                                             $this->objpdf->SetFont('Arial', '', 7);
                                             $this->objpdf->text($xcol + 2, $xlin + 187, 'DESTINO : ', 0, 1, 'L', 0);
                                             $this->objpdf->text($xcol + 30, $xlin + 187, $this->destino, 0, 1, 'L', 0);
                                             $this->objpdf->setxy($xcol + 1, $xlin + 165);
                                             $this->objpdf->text($xcol + 2, $xlin + 164, 'RESUMO : ', 0, 1, 'L', 0);
                                             $this->objpdf->multicell(147, 3.5, $this->resumo);
                                             $this->objpdf->text($xcol + 159, $xlin + 187, 'T O T A L', 0, 1, 'L', 0);
                                             $this->objpdf->setxy($xcol + 185, $xlin + 182);
                                             $this->objpdf->cell(30, 10, db_formatar($this->empenhado, 'f'), 0, 0, 'f');
                                             //	   $this->rodape($mod_rodape);
                                             $this->objpdf->rect($xcol, $xlin + 197, 60, 47, 2, 'DF', '34');
                                             $this->objpdf->rect($xcol + 60, $xlin + 197, 60, 47, 2, 'DF', '34');
                                             $this->objpdf->rect($xcol + 120, $xlin + 197, 82, 47, 2, 'DF', '34');
                                             $this->objpdf->rect($xcol + 120, $xlin + 216, 32, 28, 2, 'DF', '4');
                                             $this->objpdf->rect($xcol, $xlin + 191, 60, 6, 2, 'DF', '12');
                                             $this->objpdf->rect($xcol + 60, $xlin + 191, 60, 6, 2, 'DF', '12');
                                             $this->objpdf->rect($xcol + 120, $xlin + 191, 82, 6, 2, 'DF', '12');
                                             $this->objpdf->text($xcol + 15, $xlin + 195, 'CONTADORIA GERAL');
                                             $this->objpdf->text($xcol + 82, $xlin + 195, 'PAGUE-SE');
                                             $this->objpdf->text($xcol + 150, $xlin + 195, 'TESOURARIA');
                                             if ($this->assinatura1 != "") {
                                                 $this->objpdf->line($xcol + 5, $xlin + 211, $xcol + 54, $xlin + 211);
                                             }
                                             if ($this->assinatura2 != "") {
                                                 $this->objpdf->line($xcol + 5, $xlin + 225, $xcol + 54, $xlin + 225);
                                             }
                                             if ($this->assinatura3 != "") {
                                                 $this->objpdf->line($xcol + 5, $xlin + 238, $xcol + 54, $xlin + 238);
                                             }
                                             $this->objpdf->line($xcol + 65, $xlin + 225, $xcol + 114, $xlin + 225);
                                             $this->objpdf->SetFont('Arial', '', 6);
                                             //         $this->objpdf->text($xcol+12,$xlin+199,'EMPENHADO E CONFERIDO');
                                             $this->objpdf->text($xcol + 27 - strlen($this->assinatura1) / 2, $xlin + 213, $this->assinatura1);
                                             $this->objpdf->text($xcol + 27 - strlen($this->assinatura2) / 2, $xlin + 227, $this->assinatura2);
                                             $this->objpdf->text($xcol + 27 - strlen($this->assinatura3) / 2, $xlin + 240, $this->assinatura3);
                                             $this->objpdf->text($xcol + 66, $xlin + 212, 'DATA  ____________/____________/____________');
                                             $this->objpdf->text($xcol + 88 - strlen($this->assinaturaprefeito) / 2, $xlin + 227, $this->assinaturaprefeito);
                                             $this->objpdf->text($xcol + 122, $xlin + 207, 'CHEQUE N' . chr(176));
                                             $this->objpdf->text($xcol + 170, $xlin + 207, 'DATA');
                                             $this->objpdf->text($xcol + 122, $xlin + 215, 'BANCO N' . chr(176));
                                             $this->objpdf->text($xcol + 127, $xlin + 218, 'DOCUMENTO N' . chr(176));
                                             $this->objpdf->line($xcol + 155, $xlin + 240, $xcol + 200, $xlin + 240);
                                             $this->objpdf->text($xcol + 170, $xlin + 242, 'TESOUREIRO');
                                             $this->objpdf->rect($xcol, $xlin + 246, 202, 26, 2, 'DF', '1234');
                                             $this->objpdf->SetFont('Arial', '', 7);
                                             $this->objpdf->text($xcol + 90, $xlin + 249, 'R E C I B O');
                                             $this->objpdf->text($xcol + 45, $xlin + 253, 'RECEBI(EMOS) DO MUNICÍPIO DE ' . $this->municpref . ', A IMPORTÂNCIA ABAIXO ESPECIFICADA, REFERENTE À:');
                                             $this->objpdf->text($xcol + 2, $xlin + 257, '(     ) PARTE DO VALOR EMPENHADO');
                                             $this->objpdf->text($xcol + 102, $xlin + 257, '(     ) SALDO/TOTAL EMPENHADO');
                                             $this->objpdf->text($xcol + 2, $xlin + 261, 'R$');
                                             $this->objpdf->text($xcol + 102, $xlin + 261, 'R$');
                                             $this->objpdf->text($xcol + 2, $xlin + 265, 'EM ________/________/________', 0, 0, 'C', 0);
                                             $this->objpdf->text($xcol + 42, $xlin + 265, '_________________________________________', 0, 0, 'C', 0);
                                             $this->objpdf->text($xcol + 102, $xlin + 265, 'EM ________/________/________', 0, 0, 'C', 0);
                                             $this->objpdf->text($xcol + 142, $xlin + 265, '_________________________________________', 0, 1, 'C', 0);
                                             $this->objpdf->SetFont('Arial', '', 6);
                                             $this->objpdf->text($xcol + 62, $xlin + 269, 'CREDOR', 0, 0, 'C', 0);
                                             $this->objpdf->text($xcol + 162, $xlin + 269, 'CREDOR', 0, 1, 'C', 0);
                                             $this->objpdf->SetFont('Arial', '', 4);
                                             $this->objpdf->Text(2, 296, $this->texto);
                                             // texto no canhoto do carne
                                             $this->objpdf->SetFont('Arial', '', 6);
                                             $this->objpdf->Text(200, 296, $xxx + 1 . ' via');
                                             // texto no canhoto do carne
                                             $this->objpdf->setfont('Arial', '', 11);
                                             $xlin = 169;
                                         }
                                     }
                                 }
                             } else {
                                 if ($this->modelo == 7) {
                                     ////////// MODELO 7  -  ORDEM DE PAGAMENTO
                                     for ($xxx = 0; $xxx < $this->nvias; $xxx++) {
                                         $this->objpdf->AliasNbPages();
                                         $this->objpdf->AddPage();
                                         $this->objpdf->settopmargin(1);
                                         $pagina = 1;
                                         $xlin = 20;
                                         $xcol = 4;
                                         $ano = $this->ano;
                                         $this->objpdf->setfillcolor(245);
                                         $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                         $this->objpdf->setfillcolor(255, 255, 255);
                                         $this->objpdf->Setfont('Arial', 'B', 10);
                                         $this->objpdf->text(128, $xlin - 13, 'ORDEM DE PAGAMENTO N' . CHR(176) . ': ');
                                         $this->objpdf->text(177, $xlin - 13, db_formatar($this->ordpag, 's', '0', 6, 'e'));
                                         $this->objpdf->text(134, $xlin - 8, 'DATA DE EMISSÃO : ');
                                         $this->objpdf->text(175, $xlin - 8, $this->emissao);
                                         $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                         //.$this->logo
                                         $this->objpdf->Setfont('Arial', 'B', 9);
                                         $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                         $this->objpdf->Setfont('Arial', '', 9);
                                         $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                         $this->objpdf->text(40, $xlin - 8, $this->municpref);
                                         $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                                         $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                                         /// retangulo dos dados da dotação
                                         $this->objpdf->rect($xcol, $xlin + 2, $xcol + 100, 39, 2, 'DF', '1234');
                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                         //if($ano < 2005){
                                         //  $this->objpdf->text($xcol+2,$xlin+19,'RESTOS A PAGAR ');
                                         //}else{
                                         $this->objpdf->text($xcol + 2, $xlin + 7, 'Órgao');
                                         $this->objpdf->text($xcol + 2, $xlin + 11, 'Unidade');
                                         $this->objpdf->text($xcol + 2, $xlin + 15, 'Função');
                                         $this->objpdf->text($xcol + 2, $xlin + 19, 'Proj/Ativ');
                                         $this->objpdf->text($xcol + 2, $xlin + 23, 'Dotação');
                                         $this->objpdf->text($xcol + 2, $xlin + 27, 'Elemento');
                                         $this->objpdf->text($xcol + 2, $xlin + 34, 'Recurso');
                                         $this->objpdf->Setfont('Arial', '', 8);
                                         $this->objpdf->text($xcol + 17, $xlin + 7, ':  ' . db_formatar($this->orgao, 'orgao') . ' - ' . $this->descr_orgao);
                                         $this->objpdf->text($xcol + 17, $xlin + 11, ':  ' . db_formatar($this->unidade, 'unidade') . ' - ' . $this->descr_unidade);
                                         $this->objpdf->text($xcol + 17, $xlin + 15, ':  ' . db_formatar($this->funcao, 'funcao') . ' - ' . $this->descr_funcao);
                                         $this->objpdf->text($xcol + 17, $xlin + 19, ':  ' . db_formatar($this->projativ, 'projativ') . ' - ' . $this->descr_projativ);
                                         $this->objpdf->text($xcol + 17, $xlin + 23, ':  ' . $this->dotacao);
                                         $this->objpdf->text($xcol + 17, $xlin + 27, ':  ' . db_formatar($this->elemento, 'elemento'));
                                         $this->objpdf->text($xcol + 17, $xlin + 30, '   ' . $this->descr_elemento);
                                         $this->objpdf->text($xcol + 17, $xlin + 34, ':  ' . $this->recurso . ' - ' . $this->descr_recurso);
                                         //}
                                         if ($ano < db_getsession("DB_anousu")) {
                                             $this->objpdf->text($xcol + 2, $xlin + 38, 'RESTOS A PAGAR ');
                                         }
                                         //// retangulo dos dados do credor
                                         $this->objpdf->rect($xcol + 106, $xlin + 2, 96, 27, 2, 'DF', '1234');
                                         $this->objpdf->Setfont('Arial', '', 6);
                                         $this->objpdf->text($xcol + 108, $xlin + 4, 'Dados do Credor:');
                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                         $this->objpdf->text($xcol + 107, $xlin + 9, 'Numcgm');
                                         $this->objpdf->text($xcol + 150, $xlin + 9, strlen($this->cnpj) == 11 ? 'CPF' : 'CNPJ');
                                         $this->objpdf->text($xcol + 107, $xlin + 13, 'Nome');
                                         $this->objpdf->text($xcol + 107, $xlin + 17, 'Endereço');
                                         $this->objpdf->text($xcol + 107, $xlin + 21, 'Município');
                                         $this->objpdf->text($xcol + 107, $xlin + 25, 'Banco/Ag./Conta');
                                         $this->objpdf->Setfont('Arial', '', 8);
                                         $this->objpdf->text($xcol + 124, $xlin + 9, ': ' . $this->numcgm);
                                         $this->objpdf->text($xcol + 157, $xlin + 9, ' :  ' . $this->cnpj);
                                         $this->objpdf->text($xcol + 124, $xlin + 13, ': ' . $this->nome);
                                         $this->objpdf->text($xcol + 124, $xlin + 17, ': ' . $this->ender . '  ' . $this->compl);
                                         $this->objpdf->text($xcol + 124, $xlin + 21, ': ' . $this->munic . '-' . $this->uf . '    CEP : ' . $this->cep);
                                         if ($this->banco != null) {
                                             $this->objpdf->text($xcol + 131, $xlin + 25, ': ' . $this->banco . ' / ' . $this->agencia . ' / ' . $this->conta);
                                         }
                                         ///// retangulo do empenho
                                         $this->objpdf->rect($xcol + 106, $xlin + 32, 47, 9, 2, 'DF', '1234');
                                         $this->objpdf->rect($xcol + 155, $xlin + 32, 47, 9, 2, 'DF', '1234');
                                         ///// retangulo dos itens
                                         $this->objpdf->rect($xcol + 102, $xlin + 98, 25, 7, 2, 'DF', '');
                                         $this->objpdf->rect($xcol + 127, $xlin + 98, 25, 7, 2, 'DF', '');
                                         $this->objpdf->rect($xcol + 152, $xlin + 98, 25, 7, 2, 'DF', '');
                                         $this->objpdf->rect($xcol + 177, $xlin + 98, 25, 7, 2, 'DF', '');
                                         $this->objpdf->rect($xcol + 00, $xlin + 98, 102, 24, 2, 'DF', '34');
                                         $this->objpdf->rect($xcol + 00, $xlin + 48, 102, 50, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 102, $xlin + 48, 25, 50, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 127, $xlin + 48, 25, 50, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 152, $xlin + 48, 25, 50, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 177, $xlin + 48, 25, 50, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 102, $xlin + 105, 75, 17, 2, 'DF', '34');
                                         $this->objpdf->rect($xcol + 177, $xlin + 105, 25, 17, 2, 'DF', '34');
                                         ///// retangulo das retenções
                                         $this->objpdf->rect($xcol + 177, $xlin + 179, 25, 8, 2, 'DF', '34');
                                         $this->objpdf->rect($xcol + 177, $xlin + 171, 25, 8, 2, 'DF', '');
                                         $this->objpdf->rect($xcol + 00, $xlin + 133, 75, 46, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 00, $xlin + 179, 75, 8, 2, 'DF', '34');
                                         $this->objpdf->rect($xcol + 75, $xlin + 133, 25, 46, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 75, $xlin + 179, 25, 8, 2, 'DF', '34');
                                         $this->objpdf->rect($xcol + 102, $xlin + 133, 75, 38, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 102, $xlin + 171, 75, 8, 2, 'DF', '');
                                         $this->objpdf->rect($xcol + 102, $xlin + 179, 75, 8, 2, 'DF', '34');
                                         $this->objpdf->rect($xcol + 177, $xlin + 133, 25, 38, 2, 'DF', '12');
                                         //        $this->objpdf->Roundedrect($xcol+177,$xlin+179, 25,5,2,'DF','34');
                                         $this->objpdf->Setfont('Arial', '', 6);
                                         $this->objpdf->text($xcol + 108, $xlin + 34, 'Empenho N' . chr(176));
                                         $this->objpdf->text($xcol + 157, $xlin + 34, 'Valor do Empenho');
                                         $this->objpdf->Setfont('Arial', '', 8);
                                         $this->objpdf->text($xcol + 130, $xlin + 38, db_formatar($this->numemp, 's', '0', 6, 'e'));
                                         $this->objpdf->text($xcol + 180, $xlin + 38, db_formatar($this->empenhado, 'f'));
                                         //// retangulos do titulo do corpo do empenho
                                         //	$this->objpdf->line($xcol,$xlin+42,$xcol+202,$xlin+42);
                                         $this->objpdf->Setfont('Arial', 'B', 10);
                                         $this->objpdf->text($xcol + 2, $xlin + 46, 'Dados da Ordem de Pagto.');
                                         $this->objpdf->Setfont('Arial', 'B', 6);
                                         //// título do corpo do empenho
                                         $maiscol = 0;
                                         /// monta os dados dos elementos da ordem de compra
                                         $this->objpdf->SetWidths(array(20, 80, 25, 25, 25, 25));
                                         $this->objpdf->SetAligns(array('L', 'L', 'R', 'R', 'R', 'R'));
                                         $this->objpdf->setleftmargin(4);
                                         $this->objpdf->sety($xlin + 48);
                                         $this->objpdf->cell(20, 4, 'ELEMENTO', 0, 0, "L");
                                         $this->objpdf->cell(80, 4, 'DESCRIÇÃO', 0, 0, "L");
                                         $this->objpdf->cell(25, 4, 'VALOR', 0, 0, "R");
                                         $this->objpdf->cell(25, 4, 'ANULADO', 0, 0, "R");
                                         $this->objpdf->cell(25, 4, 'PAGO', 0, 0, "R");
                                         $this->objpdf->cell(25, 4, 'SALDO', 0, 1, "R");
                                         $this->objpdf->Setfont('Arial', '', 7);
                                         $total_pag = 0;
                                         $total_emp = 0;
                                         $total_anu = 0;
                                         $total_sal = 0;
                                         for ($ii = 0; $ii < $this->linhasdositens; $ii++) {
                                             db_fieldsmemory($this->recorddositens, $ii);
                                             $this->objpdf->Setfont('Arial', '', 7);
                                             $this->objpdf->Row(array(pg_result($this->recorddositens, $ii, $this->elementoitem), pg_result($this->recorddositens, $ii, $this->descr_elementoitem), db_formatar(pg_result($this->recorddositens, $ii, $this->vlremp), 'f'), db_formatar(pg_result($this->recorddositens, $ii, $this->vlranu), 'f'), db_formatar(pg_result($this->recorddositens, $ii, $this->vlrpag), 'f'), db_formatar(pg_result($this->recorddositens, $ii, $this->vlrsaldo), 'f')), 3, false, 3);
                                             $total_emp += pg_result($this->recorddositens, $ii, $this->vlremp);
                                             $total_anu += pg_result($this->recorddositens, $ii, $this->vlranu);
                                             $total_pag += pg_result($this->recorddositens, $ii, $this->vlrpag);
                                             $total_sal += pg_result($this->recorddositens, $ii, $this->vlrsaldo);
                                         }
                                         /// monta os dados das retenções da ordem de compra
                                         $this->objpdf->SetWidths(array(10, 62, 25));
                                         $this->objpdf->SetAligns(array('C', 'L', 'R'));
                                         $this->objpdf->setleftmargin(4);
                                         $this->objpdf->setxy($xcol + 102, $xlin + 134);
                                         $this->objpdf->Setfont('Arial', 'B', 10);
                                         $this->objpdf->text($xcol + 104, $xlin + 131, 'Dados das Retenções');
                                         $this->objpdf->text($xcol + 2, $xlin + 131, 'Repasses');
                                         $this->objpdf->Setfont('Arial', 'b', 7);
                                         $this->objpdf->cell(10, 4, 'REC.', 0, 0, "L");
                                         $this->objpdf->cell(62, 4, 'DESCRIÇÃO', 0, 0, "L");
                                         $this->objpdf->cell(25, 4, 'VALOR', 0, 1, "R");
                                         $this->objpdf->Setfont('Arial', '', 7);
                                         $total_ret = 0;
                                         for ($ii = 0; $ii < $this->linhasretencoes; $ii++) {
                                             $this->objpdf->setx($xcol + 102);
                                             db_fieldsmemory($this->recordretencoes, $ii);
                                             $this->objpdf->Setfont('Arial', '', 7);
                                             $this->objpdf->Row(array(pg_result($this->recordretencoes, $ii, $this->receita), pg_result($this->recordretencoes, $ii, $this->dreceita), db_formatar(pg_result($this->recordretencoes, $ii, $this->vlrrec), 'f')), 3, false, 3);
                                             $total_ret += pg_result($this->recordretencoes, $ii, $this->vlrrec);
                                         }
                                         $this->objpdf->Setfont('Arial', 'B', 7);
                                         $this->objpdf->setxy($xcol + 100, $xlin + 100);
                                         $this->objpdf->Setfont('Arial', '', 7);
                                         $this->objpdf->cell(25, 4, db_formatar($total_emp, 'f'), 0, 0, "R");
                                         $this->objpdf->cell(25, 4, db_formatar($total_anu, 'f'), 0, 0, "R");
                                         $this->objpdf->cell(25, 4, db_formatar($total_pag, 'f'), 0, 0, "R");
                                         $this->objpdf->cell(25, 4, db_formatar($total_sal, 'f'), 0, 1, "R");
                                         $this->objpdf->setxy($xcol + 127, $xlin + 107);
                                         $this->objpdf->Setfont('Arial', 'B', 7);
                                         $this->objpdf->cell(50, 5, 'TOTAL DA ORDEM', 0, 0, "R");
                                         $this->objpdf->cell(23, 5, db_formatar($total_emp - $total_anu, 'f'), 0, 1, "R");
                                         $this->objpdf->setx($xcol + 127);
                                         $this->objpdf->cell(50, 5, 'OUTRAS ORDENS', 0, 0, "R");
                                         $this->objpdf->cell(23, 4, db_formatar($this->outrasordens, 'f'), 0, 1, "R");
                                         $this->objpdf->setx($xcol + 127);
                                         $this->objpdf->cell(50, 5, 'VALOR RESTANTE', 0, 0, "R");
                                         $this->objpdf->cell(23, 4, db_formatar($this->empenhado - $this->outrasordens - $total_emp - $total_anu, 'f'), 0, 1, "R");
                                         $this->objpdf->Setfont('Arial', 'b', 8);
                                         $this->objpdf->text($xcol + 2, $xlin + 102, 'OBSERVAÇÕES :');
                                         $this->objpdf->Setfont('Arial', '', 7);
                                         $this->objpdf->setxy($xcol, $xlin + 103);
                                         $this->objpdf->Setfont('Arial', '', 7);
                                         $this->objpdf->multicell(102, 4, $this->obs);
                                         /// total das retenções
                                         $this->objpdf->setxy($xcol + 127, $xlin + 172);
                                         $this->objpdf->Setfont('Arial', 'B', 7);
                                         $this->objpdf->cell(50, 5, 'TOTAL ', 0, 0, "R");
                                         $this->objpdf->cell(23, 5, db_formatar($total_ret, 'f'), 0, 1, "R");
                                         /// total dos repasses
                                         $this->objpdf->setxy($xcol, $xlin + 181);
                                         $this->objpdf->Setfont('Arial', 'B', 7);
                                         $this->objpdf->cell(75, 5, 'TOTAL ', 0, 0, "R");
                                         $this->objpdf->cell(23, 5, db_formatar(0, 'f'), 0, 1, "R");
                                         /// liquido da ordem de compra
                                         $this->objpdf->setxy($xcol + 127, $xlin + 181);
                                         $this->objpdf->Setfont('Arial', 'B', 7);
                                         $this->objpdf->cell(50, 5, 'LÍQUIDO DA ORDEM DE PAGTO. ', 0, 0, "R");
                                         $this->objpdf->cell(23, 5, db_formatar($total_sal - $total_ret, 'f'), 0, 1, "R");
                                         $this->objpdf->rect($xcol, $xlin + 197, 60, 47, 2, 'DF', '34');
                                         $this->objpdf->rect($xcol + 60, $xlin + 197, 60, 47, 2, 'DF', '34');
                                         $this->objpdf->rect($xcol + 120, $xlin + 197, 82, 47, 2, 'DF', '34');
                                         $this->objpdf->rect($xcol + 120, $xlin + 216, 32, 28, 2, 'DF', '');
                                         $this->objpdf->rect($xcol, $xlin + 191, 60, 6, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 60, $xlin + 191, 60, 6, 2, 'DF', '12');
                                         $this->objpdf->rect($xcol + 120, $xlin + 191, 82, 6, 2, 'DF', '12');
                                         $this->objpdf->text($xcol + 15, $xlin + 195, 'CONTADORIA GERAL');
                                         $this->objpdf->text($xcol + 82, $xlin + 195, 'PAGUE-SE');
                                         $this->objpdf->text($xcol + 150, $xlin + 195, 'TESOURARIA');
                                         if ($this->municpref == "GUAIBA") {
                                             $this->objpdf->SetFont('Arial', '', 6);
                                             $this->objpdf->line($xcol + 12, $xlin + 221, $xcol + 43, $xlin + 221);
                                             $this->objpdf->line($xcol + 74, $xlin + 221, $xcol + 100, $xlin + 221);
                                             $this->objpdf->text($xcol + 13, $xlin + 224, 'JORGE ANTONIO POKORSKI');
                                             $this->objpdf->text($xcol + 76, $xlin + 224, 'MANOEL STRINGHINI');
                                             $this->objpdf->text($xcol + 76, $xlin + 227, 'PREFEITO MUNICIPAL');
                                             $this->objpdf->text($xcol + 13, $xlin + 227, 'SECRETÁRIO DA FAZENDA');
                                         } else {
                                             $this->objpdf->line($xcol + 5, $xlin + 211, $xcol + 54, $xlin + 211);
                                             $this->objpdf->line($xcol + 5, $xlin + 238, $xcol + 54, $xlin + 238);
                                             $this->objpdf->line($xcol + 65, $xlin + 225, $xcol + 114, $xlin + 225);
                                             $this->objpdf->SetFont('Arial', '', 6);
                                             $this->objpdf->text($xcol + 12, $xlin + 199, 'EMPENHADO E CONFERIDO');
                                             $this->objpdf->text($xcol + 26, $xlin + 213, 'VISTO');
                                             if (strtoupper(trim($this->municpref)) != 'SAPIRANGA') {
                                                 $this->objpdf->line($xcol + 5, $xlin + 225, $xcol + 54, $xlin + 225);
                                                 $this->objpdf->text($xcol + 19, $xlin + 227, 'TÉCNICO CONTÁBIL');
                                                 $this->objpdf->text($xcol + 13, $xlin + 240, 'SECRETÁRIO(A) DA FAZENDA');
                                             }
                                             $this->objpdf->text($xcol + 66, $xlin + 212, 'DATA  ____________/____________/____________');
                                             $this->objpdf->text($xcol + 76, $xlin + 227, 'PREFEITO MUNICIPAL');
                                         }
                                         $this->objpdf->text($xcol + 122, $xlin + 207, 'CHEQUE N' . chr(176));
                                         $this->objpdf->text($xcol + 170, $xlin + 207, 'DATA');
                                         $this->objpdf->text($xcol + 122, $xlin + 215, 'BANCO N' . chr(176));
                                         $this->objpdf->text($xcol + 127, $xlin + 218, 'DOCUMENTO N' . chr(176));
                                         $this->objpdf->line($xcol + 155, $xlin + 240, $xcol + 200, $xlin + 240);
                                         $this->objpdf->text($xcol + 170, $xlin + 242, 'TESOUREIRO');
                                         $this->objpdf->rect($xcol, $xlin + 246, 202, 26, 2, 'DF', '1234');
                                         $this->objpdf->SetFont('Arial', '', 7);
                                         $this->objpdf->text($xcol + 90, $xlin + 249, 'R E C I B O');
                                         $this->objpdf->text($xcol + 45, $xlin + 253, 'RECEBI(EMOS) DO MUNICÍPIO DE ' . $this->municpref . ', A IMPORTÂNCIA ABAIXO ESPECIFICADA, REFERENTE À:');
                                         $this->objpdf->text($xcol + 2, $xlin + 257, '(     ) PARTE DO VALOR EMPENHADO');
                                         $this->objpdf->text($xcol + 102, $xlin + 257, '(     ) SALDO/TOTAL EMPENHADO');
                                         $this->objpdf->text($xcol + 2, $xlin + 261, 'R$');
                                         $this->objpdf->text($xcol + 102, $xlin + 261, 'R$');
                                         $this->objpdf->text($xcol + 2, $xlin + 265, 'EM ________/________/________', 0, 0, 'C', 0);
                                         $this->objpdf->text($xcol + 42, $xlin + 265, '_________________________________________', 0, 0, 'C', 0);
                                         $this->objpdf->text($xcol + 102, $xlin + 265, 'EM ________/________/________', 0, 0, 'C', 0);
                                         $this->objpdf->text($xcol + 142, $xlin + 265, '_________________________________________', 0, 1, 'C', 0);
                                         $this->objpdf->SetFont('Arial', '', 6);
                                         $this->objpdf->text($xcol + 62, $xlin + 269, 'CREDOR', 0, 0, 'C', 0);
                                         $this->objpdf->text($xcol + 162, $xlin + 269, 'CREDOR', 0, 1, 'C', 0);
                                         $this->objpdf->SetFont('Arial', '', 4);
                                         $this->objpdf->Text(2, 296, $this->texto);
                                         // texto no canhoto do carne
                                         $this->objpdf->SetFont('Arial', '', 6);
                                         $this->objpdf->Text(200, 296, $xxx + 1 . ' via');
                                         // texto no canhoto do carne
                                         $this->objpdf->setfont('Arial', '', 11);
                                         $xlin = 169;
                                     }
                                 } else {
                                     if ($this->modelo == 8) {
                                         //// Ficha de transferencia de bens
                                         $this->objpdf->AliasNbPages();
                                         //	$this->objpdf->AddPage();
                                         $this->objpdf->settopmargin(1);
                                         $this->objpdf->line(2, 148.5, 208, 148.5);
                                         $xlin = 20;
                                         $xcol = 4;
                                         $comeco = 0;
                                         $passada = 0;
                                         if ($this->linhasbens < 40) {
                                             $vias = 2;
                                         } elseif ($this->linhasbens < 80) {
                                             $vias = 4;
                                         } elseif ($this->linhasbens < 120) {
                                             $vias = 6;
                                         } elseif ($this->linhasbens < 160) {
                                             $vias = 8;
                                         } elseif ($this->linhasbens < 200) {
                                             $vias = 10;
                                         }
                                         for ($i = 0; $i < $vias; $i++) {
                                             if ($i % 2 == 0) {
                                                 $this->objpdf->AddPage();
                                             }
                                             $this->objpdf->setfillcolor(245);
                                             $this->objpdf->roundedrect($xcol - 2, $xlin - 18, 206, 144.5, 2, 'DF', '1234');
                                             $this->objpdf->setfillcolor(255, 255, 255);
                                             //		$this->objpdf->roundedrect(10,07,190,183,2,'DF','1234');
                                             $this->objpdf->Setfont('Arial', 'B', 11);
                                             $this->objpdf->text(150, $xlin - 13, 'TRANSFERÊNCIA N' . chr(176) . '  ' . $this->codtransf);
                                             $this->objpdf->text(159, $xlin - 8, $this->datacalc);
                                             $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                             $this->objpdf->Setfont('Arial', 'B', 9);
                                             $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                             $this->objpdf->Setfont('Arial', '', 9);
                                             $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                             $this->objpdf->text(40, $xlin - 8, $this->municpref);
                                             $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                                             $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                                             //		$this->objpdf->setfillcolor(245);
                                             $this->objpdf->Roundedrect($xcol, $xlin + 2, $xcol + 98, 20, 2, 'DF', '1234');
                                             $this->objpdf->Setfont('Arial', '', 8);
                                             $this->objpdf->text($xcol + 2, $xlin + 5, 'Origem:');
                                             $this->objpdf->Setfont('Arial', 'b', 8);
                                             $this->objpdf->text($xcol + 2, $xlin + 9, 'Departamento ');
                                             $this->objpdf->Setfont('Arial', '', 8);
                                             $this->objpdf->text($xcol + 22, $xlin + 9, ':  ' . $this->origem);
                                             $this->objpdf->Setfont('Arial', 'b', 8);
                                             $this->objpdf->text($xcol + 2, $xlin + 16, 'Usuario');
                                             $this->objpdf->Setfont('Arial', '', 8);
                                             $this->objpdf->text($xcol + 22, $xlin + 16, ':  ' . $this->usuario);
                                             $this->objpdf->Setfont('Arial', '', 6);
                                             $this->objpdf->Roundedrect($xcol + 104, $xlin + 2, 98, 20, 2, 'DF', '1234');
                                             $this->objpdf->Setfont('Arial', '', 8);
                                             $this->objpdf->text($xcol + 106, $xlin + 5, 'Destino:');
                                             $this->objpdf->Setfont('Arial', 'b', 8);
                                             $this->objpdf->text($xcol + 106, $xlin + 9, 'Departamento');
                                             $this->objpdf->Setfont('Arial', '', 8);
                                             $this->objpdf->text($xcol + 128, $xlin + 9, ':  ' . $this->destino);
                                             //		$this->objpdf->setfillcolor(245);
                                             $this->objpdf->Roundedrect($xcol, $xlin + 24, 202, 70, 2, 'DF', '1234');
                                             $this->objpdf->Setfont('Arial', '', 8);
                                             $this->objpdf->text($xcol + 2, $xlin + 27, 'Itens a Transmitir :');
                                             $this->objpdf->Setfont('Arial', 'b', 8);
                                             $this->objpdf->text($xcol + 2, $xlin + 30, 'BEM');
                                             $this->objpdf->text($xcol + 25, $xlin + 30, 'DESCRIÇÃO');
                                             $this->objpdf->text($xcol + 75, $xlin + 30, 'CLASSIFICAÇÃO');
                                             $this->objpdf->text($xcol + 102, $xlin + 30, 'BEM');
                                             $this->objpdf->text($xcol + 125, $xlin + 30, 'DESCRIÇÃO');
                                             $this->objpdf->text($xcol + 175, $xlin + 30, 'CLASSIFICAÇÃO');
                                             $this->objpdf->Setfont('Arial', '', 8);
                                             $this->objpdf->sety($xlin + 31);
                                             $maiscol = 0;
                                             $yy = $this->objpdf->gety();
                                             for ($ii = $comeco; $ii < $this->linhasbens; $ii++) {
                                                 if ($ii % 40 == 0 && $ii > 0 && $passada == 0) {
                                                     $maiscol = 0;
                                                     $passada++;
                                                     $comeco = $ii;
                                                     break;
                                                 } elseif ($ii % 20 == 0 && $ii > 0 && $ii % 40 != 0) {
                                                     $maiscol = 100;
                                                     $this->objpdf->sety($yy);
                                                 }
                                                 $this->objpdf->setx($xcol + 3 + $maiscol);
                                                 $this->objpdf->cell(5, 3, trim(pg_result($this->recordbens, $ii, $this->bem)), 0, 0, "R", 0);
                                                 $this->objpdf->cell(70, 3, trim(pg_result($this->recordbens, $ii, $this->descr_bem)), 0, 0, "L", 0);
                                                 $this->objpdf->cell(15, 3, pg_result($this->recordbens, $ii, $this->class_bem), 0, 1, "R", 0);
                                                 if ($ii + 1 == $this->linhasbens) {
                                                     $comeco = 0;
                                                     $passada = 0;
                                                     break;
                                                 }
                                             }
                                             $this->objpdf->line($xcol + 10, $xlin + 116, $xcol + 70, $xlin + 116);
                                             $this->objpdf->text($xcol + 30, $xlin + 120, 'TRANSMITENTE');
                                             $this->objpdf->line($xcol + 135, $xlin + 116, $xcol + 195, $xlin + 116);
                                             $this->objpdf->text($xcol + 155, $xlin + 120, 'RECEBEDOR');
                                             if ($i % 2 == 0) {
                                                 $xlin = 169;
                                             } else {
                                                 $xlin = 20;
                                             }
                                         }
                                     } else {
                                         if ($this->modelo == 9) {
                                             $this->objpdf->SetTextColor(0, 0, 0);
                                             $this->objpdf->SetFont('Arial', 'B', 12);
                                             $coluna = 44;
                                             $linha = 20;
                                             $this->objpdf->SetLineWidth(1);
                                             $this->objpdf->RoundedRect(37, 0.2, 137, 195, 2, '1234');
                                             $this->objpdf->SetLineWidth(0.5);
                                             $this->objpdf->roundedrect(39, 2, 133, 191, 2, '1234');
                                             $this->objpdf->SetLineWidth(0.2);
                                             $this->objpdf->Image('imagens/files/Brasao.png', 43, 5, 20);
                                             $this->objpdf->Image('imagens/files/Brasao.jpg', 60, 30, 100);
                                             //	$this->objpdf->roundedrect(42,$linha+30,127,35,2,'1234');
                                             //	$this->objpdf->roundedrect(42,$linha+72,127,15,2,'1234'); // obs da atividade principal
                                             //  	$this->objpdf->roundedrect(42,$linha+88,127,5,2,'1234'); // descricao da atividade secundaria
                                             //	$this->objpdf->roundedrect(42,$linha+94,127,15,2,'1234'); // obs da atividade secundaria
                                             //	$this->objpdf->setdrawcolor(235);
                                             $this->objpdf->setxy(65, 8);
                                             $this->objpdf->setfont('Arial', 'B', 13);
                                             $this->objpdf->Multicell(0, 8, $this->prefeitura, "C");
                                             // prefeitura
                                             $this->objpdf->setxy(65, 15);
                                             $this->objpdf->setfont('Arial', 'B', 13);
                                             $this->objpdf->setleftmargin(50);
                                             $this->objpdf->setrightmargin(50);
                                             $this->objpdf->Multicell(0, 8, $this->tipoalvara, 0, "C", 0);
                                             // tipo de alvara
                                             $this->objpdf->Ln(6);
                                             $this->objpdf->sety(28);
                                             $this->objpdf->SetFont('Arial', '', 11);
                                             $this->objpdf->multicell(0, 5, db_geratexto($this->texto), 0, "J", 0, 20);
                                             $this->objpdf->SetFont('Arial', 'B', 9);
                                             $this->objpdf->Text($coluna, $linha + 35, 'INSCRIÇÃO:');
                                             // inscricao
                                             if ($this->processo > 0) {
                                                 $this->objpdf->Text($coluna + 70, $linha + 35, 'PROCESSO:');
                                                 // inscricao
                                             }
                                             $this->objpdf->SetFont('Arial', '', 9);
                                             $this->objpdf->Text($coluna + 40, $linha + 35, $this->nrinscr);
                                             // inscricao
                                             if ($this->processo > 0) {
                                                 $this->objpdf->Text($coluna + 90, $linha + 35, $this->processo);
                                                 // processo
                                             }
                                             $this->objpdf->SetFont('Arial', 'B', 9);
                                             $this->objpdf->Text($coluna, $linha + 39, "NOME/RAZAO SOCIAL: ");
                                             // nome
                                             $this->objpdf->SetFont('Arial', '', 9);
                                             $this->objpdf->Text($coluna + 40, $linha + 39, $this->nome);
                                             // nome
                                             $this->objpdf->SetFont('Arial', 'B', 9);
                                             $this->objpdf->Text($coluna, $linha + 43, "CNPJ/CPF: ");
                                             $this->objpdf->SetFont('Arial', '', 9);
                                             $this->objpdf->Text($coluna + 40, $linha + 43, $this->cnpjcpf);
                                             $this->objpdf->SetFont('Arial', 'B', 9);
                                             $this->objpdf->Text($coluna, $linha + 47, "ENDEREÇO: ");
                                             // endereco
                                             $this->objpdf->SetFont('Arial', '', 9);
                                             $this->objpdf->Text($coluna + 40, $linha + 47, $this->ender);
                                             // endereco
                                             $this->objpdf->SetFont('Arial', 'B', 9);
                                             $this->objpdf->Text($coluna, $linha + 51, "NÚMERO: ");
                                             // endereco
                                             $this->objpdf->SetFont('Arial', '', 9);
                                             $this->objpdf->Text($coluna + 40, $linha + 51, $this->numero == "" ? "" : $this->numero);
                                             if ($this->compl != "") {
                                                 $this->objpdf->SetFont('Arial', 'B', 9);
                                                 $this->objpdf->Text($coluna + 60, $linha + 51, "COMPLEMENTO: ");
                                                 // endereco
                                                 $this->objpdf->SetFont('Arial', '', 9);
                                                 $this->objpdf->Text($coluna + 90, $linha + 51, $this->compl == "" ? "" : $this->compl);
                                             }
                                             $this->objpdf->SetFont('Arial', 'B', 9);
                                             $this->objpdf->Text($coluna, $linha + 55, "DATA DE INCLUSAO: ");
                                             if ($this->datafim != "") {
                                                 $this->objpdf->Text($coluna + 60, $linha + 55, "VALIDADE ATÉ: ");
                                             }
                                             $this->objpdf->SetFont('Arial', '', 9);
                                             $this->objpdf->Text($coluna + 40, $linha + 55, db_formatar($this->datainc, 'd'));
                                             if ($this->datafim != "") {
                                                 $this->objpdf->Text($coluna + 85, $linha + 55, db_formatar($this->datafim, 'd'));
                                             }
                                             $this->objpdf->setx(40);
                                             if ($this->q02_memo != '') {
                                                 $this->objpdf->SetFont('Arial', 'B', 9);
                                                 $this->objpdf->Text($coluna, $linha + 59, "OBSERVAÇÃO: ");
                                                 // observação
                                                 $this->objpdf->SetFont('Arial', '', 9);
                                                 $this->objpdf->sety($linha + 60);
                                                 $this->objpdf->Multicell(0, 3, $this->q02_memo);
                                                 // texto
                                                 $this->objpdf->SetFont('Arial', 'B', 10);
                                                 $this->objpdf->roundedrect(42, $linha + 30, 127, 38, 2, '1234');
                                                 $linha = 90;
                                             } else {
                                                 $this->objpdf->roundedrect(42, $linha + 30, 127, 27, 2, '1234');
                                                 $linha = 79;
                                             }
                                             $this->objpdf->sety($linha);
                                             $this->objpdf->roundedrect(42, $linha - 1, 127, 5, 2, '1234');
                                             $this->objpdf->SetFont('Arial', 'B', 8);
                                             $this->objpdf->Ln(0.5);
                                             $this->objpdf->setx(45);
                                             $this->objpdf->Multicell(0, 3, "ATIVIDADE PRINCIPAL: " . $this->descrativ);
                                             // descrição da atividade principal
                                             $linha += 6;
                                             $yyy = $this->objpdf->gety();
                                             $obs = '';
                                             if (isset($this->q03_atmemo[$this->ativ])) {
                                                 if ($this->q03_atmemo[$this->ativ] != '') {
                                                     $obs = $this->q03_atmemo[$this->ativ];
                                                     $this->objpdf->Ln(3);
                                                     $this->objpdf->SetFont('Arial', '', 7);
                                                     $this->objpdf->Multicell(0, 3, $this->q03_atmemo[$this->ativ]);
                                                     // texto
                                                     //		 $linha += 16;
                                                     $yyyatual = $this->objpdf->gety();
                                                     $this->objpdf->roundedrect(42, $linha - 1, 127, $yyyatual - $yyy, 2, '1234');
                                                     // obs da atividade principal
                                                 }
                                             }
                                             $yyy = $this->objpdf->gety();
                                             $linha = $this->objpdf->gety() + 2;
                                             $this->objpdf->sety($linha);
                                             //        $this->objpdf->sety($linha);
                                             $num_outras = count($this->outrasativs);
                                             $x = 105;
                                             $y = $linha + 1;
                                             if ($num_outras > 0) {
                                                 $x = $x + 4;
                                                 reset($this->outrasativs);
                                                 $this->objpdf->Ln(2);
                                                 $this->objpdf->setx(45);
                                                 $yyy = $this->objpdf->gety() + 7;
                                                 $this->objpdf->SetFont('Arial', 'B', 8);
                                                 //           $this->objpdf->roundedrect(42,$yyy-1,127,5,2,'1234'); // descricao da atividade secundaria
                                                 $this->objpdf->Multicell(0, 3, "ATIVIDADE" . ($num_outras > 1 ? "S" : "") . " SECUNDÁRIA" . ($num_outras > 1 ? "S" : "") . ":");
                                                 $linha += 6;
                                                 $this->objpdf->Ln(2);
                                                 $this->objpdf->roundedrect(42, $y, 127, 5, 2, '1234');
                                                 // descricao da atividade secundaria
                                                 for ($i = 0; $i < $num_outras; $i++) {
                                                     $yyy = $this->objpdf->gety();
                                                     $chave = key($this->outrasativs);
                                                     $obs = '';
                                                     if (isset($this->q03_atmemo[$chave])) {
                                                         $obs = $this->q03_atmemo[$chave];
                                                     }
                                                     $this->objpdf->SetFont('Arial', '', 8);
                                                     //             $this->objpdf->roundedrect(42,$yyy-1,127,5,2,'1234'); // descricao da atividade secundaria
                                                     $this->objpdf->Ln(0.5);
                                                     $this->objpdf->setx(45);
                                                     // 	     $this->objpdf->Multicell(0,3,"ATIVIDADE SECUNDÁRIA: " . $this->outrasativs[$chave]); // texto
                                                     $this->objpdf->Multicell(0, 3, $this->outrasativs[$chave]);
                                                     // texto
                                                     $linha += 4;
                                                     if ($obs != "") {
                                                         $yyyant = $this->objpdf->gety();
                                                         //               $this->objpdf->Ln(1);
                                                         $this->objpdf->SetFont('Arial', 'B', 7);
                                                         $this->objpdf->Multicell(0, 3, $obs);
                                                         // texto
                                                         $yyyatual = $this->objpdf->gety();
                                                         //               $this->objpdf->roundedrect(42,$linha-1,127,$yyyatual-$yyyant+1,2,'1234'); // obs da atividade secundaria
                                                         $linha += $yyyatual - $yyyant;
                                                     }
                                                     $x = $x + 4;
                                                     next($this->outrasativs);
                                                     //             $this->objpdf->ln(2.5);
                                                     $this->objpdf->sety($linha);
                                                     $yyyatual = $this->objpdf->gety();
                                                     //	     if  ($i >= 5) break;
                                                     if ($yyyatual >= 130) {
                                                         break;
                                                     }
                                                 }
                                                 $this->objpdf->roundedrect(42, $y, 127, $linha - $y, 2, '1234');
                                                 // descricao da atividade secundaria
                                             }
                                             $x = 64;
                                             //	$this->objpdf->sety(135);
                                             $this->objpdf->SetFont('Arial', '', 9);
                                             $this->objpdf->Multicell(0, 4, $this->obs);
                                             // observação
                                             //        if($this->q02_obs!=''){
                                             //	  $this->objpdf->Text($coluna,$linha+$x,"OBSERVAÇÃO: "); // descrição da atividade principal
                                             //	  $this->objpdf->Text($coluna + 45,$linha+$x,$this->q02_obs); // descrição da atividade principal
                                             //	  $x=$x+4;
                                             //	}
                                             $this->objpdf->ln(10);
                                             $this->objpdf->SetFont('Arial', 'B', 9);
                                             $this->objpdf->cell($coluna, 5, '', 0, 0, "L", 0);
                                             $this->objpdf->cell(60, 5, "DATA DE EMISSÃO DESTE DOCUMENTO.", 0, 1, "L", 0);
                                             $this->objpdf->cell($coluna, 5, '', 0, 0, "L", 0);
                                             $this->objpdf->cell(60, 5, $this->municpref . ", " . date('d') . " DE " . strtoupper(db_mes(date('m'))) . " DE " . date('Y') . ".", 0, 1, "L", 0);
                                             // data
                                             global $db02_texto;
                                             $sqlparag = "select db02_texto \n\t\t     from db_documento \n\t\t     inner join db_docparag on db03_docum = db04_docum \n\t\t     inner join db_paragrafo on db04_idparag = db02_idparag \n\t\t     where db03_docum = 26 and db02_descr ilike '%Assinatura Secretario%' and db03_instit = " . db_getsession("DB_instit");
                                             $resparag = pg_query($sqlparag);
                                             if (pg_numrows($resparag) == 0) {
                                                 db_redireciona('db_erros.php?fechar=true&db_erro=Configure o documento 26 com os paragrafos do alvara!');
                                                 exit;
                                             }
                                             db_fieldsmemory($resparag, 0);
                                             $this->objpdf->setfont('arial', '', 6);
                                             $this->objpdf->SetXY($coluna - 18, 170);
                                             $this->objpdf->MultiCell(90, 4, '..........................................................................................' . "\n" . $db02_texto, 0, "C", 0);
                                             $this->objpdf->SetXY($coluna + 50, 170);
                                             $this->objpdf->MultiCell(90, 4, '..........................................................................................', 0, "C", 0);
                                             //        $this->objpdf->SetXY($coluna-35,160);
                                             //        $this->objpdf->MultiCell(90,4,'..........................................................................................'."\n".'SECRETÁRIO DA IND. COM. E TURISMO',0,"C",0);
                                             //        $this->objpdf->SetXY($coluna+35,160);
                                             //        $this->objpdf->MultiCell(90,4,'..........................................................................................',0,"C",0);
                                             $this->objpdf->sety(185);
                                             $this->objpdf->setfont('arial', 'B', 12);
                                             $this->objpdf->multicell(0, 6, 'FIXAR EM LUGAR VISÍVEL', 1, "C");
                                             $this->objpdf->SetFont('Arial', 'B', 10);
                                         } else {
                                             if ($this->modelo == 10) {
                                                 ////////// MODELO 10  -  ORDEM DE COMPRA
                                                 $this->objpdf->AliasNbPages();
                                                 $this->objpdf->AddPage();
                                                 $this->objpdf->settopmargin(1);
                                                 $this->objpdf->setleftmargin(4);
                                                 $pagina = 1;
                                                 $xlin = 20;
                                                 $xcol = 4;
                                                 $this->objpdf->setfillcolor(245);
                                                 $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                                 $this->objpdf->setfillcolor(255, 255, 255);
                                                 $this->objpdf->Setfont('Arial', 'B', 9);
                                                 $this->objpdf->text(130, $xlin - 13, 'ORDEM DE COMPRA N' . CHR(176));
                                                 $this->objpdf->text(185, $xlin - 13, db_formatar($this->numordem, 's', '0', 6, 'e'));
                                                 $this->objpdf->text(130, $xlin - 10, 'DATA :');
                                                 $this->objpdf->text(185, $xlin - 10, db_formatar($this->dataordem, 'd'));
                                                 $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                                 //.$this->logo
                                                 $this->objpdf->Setfont('Arial', 'B', 9);
                                                 $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                                 $this->objpdf->Setfont('Arial', '', 9);
                                                 $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                                 //	$this->objpdf->text(40,$xlin- 7,$this->municpref);
                                                 $this->objpdf->text(40, $xlin - 7, "FONE: " . $this->telefpref);
                                                 $this->objpdf->text(40, $xlin - 3, $this->emailpref);
                                                 $this->objpdf->text(40, $xlin + 1, $this->url . " - CNPJ:" . db_formatar($this->cgc, 'cnpj'));
                                                 $this->objpdf->rect($xcol, $xlin + 2, $xcol + 198, 20, 2, 'DF', '1234');
                                                 $this->objpdf->Setfont('Arial', '', 6);
                                                 $this->objpdf->text($xcol + 2, $xlin + 4.5, 'Dados do Fornecedor');
                                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                                 $this->objpdf->text($xcol + 109, $xlin + 8, 'Numcgm');
                                                 $this->objpdf->text($xcol + 150, $xlin + 8, strlen($this->cnpj) == 11 ? 'CPF' : 'CNPJ');
                                                 $this->objpdf->text($xcol + 2, $xlin + 8, 'Nome');
                                                 $this->objpdf->text($xcol + 2, $xlin + 12, 'Endereço');
                                                 $this->objpdf->text($xcol + 102, $xlin + 12, 'Complemento');
                                                 $this->objpdf->text($xcol + 2, $xlin + 16, 'Município');
                                                 $this->objpdf->text($xcol + 115, $xlin + 16, 'CEP');
                                                 $this->objpdf->text($xcol + 2, $xlin + 20, 'Contato');
                                                 $this->objpdf->text($xcol + 110, $xlin + 20, 'Telefone');
                                                 $this->objpdf->text($xcol + 155, $xlin + 20, 'FAX');
                                                 $this->objpdf->Setfont('Arial', '', 8);
                                                 $this->objpdf->text($xcol + 157, $xlin + 8, ' :  ' . $this->cnpj);
                                                 $this->objpdf->text($xcol + 122, $xlin + 8, ':  ' . $this->numcgm);
                                                 $this->objpdf->text($xcol + 18, $xlin + 8, ':  ' . $this->nome);
                                                 $this->objpdf->text($xcol + 18, $xlin + 12, ':  ' . $this->ender);
                                                 $this->objpdf->text($xcol + 122, $xlin + 12, ':  ' . $this->compl);
                                                 $this->objpdf->text($xcol + 18, $xlin + 16, ':  ' . $this->munic . '-' . $this->uf);
                                                 $this->objpdf->text($xcol + 122, $xlin + 16, ':  ' . $this->cep);
                                                 $this->objpdf->text($xcol + 18, $xlin + 20, ':  ' . $this->contato);
                                                 $this->objpdf->text($xcol + 122, $xlin + 20, ':  ' . $this->telef_cont);
                                                 $this->objpdf->text($xcol + 162, $xlin + 20, ':  ' . $this->telef_fax);
                                                 global $ordemdecompra1;
                                                 global $ordemdecompra2;
                                                 global $descrtexto;
                                                 global $conteudotexto;
                                                 $sqltexto = "select * from db_config where codigo = " . db_getsession("DB_instit");
                                                 $resulttexto = pg_exec($sqltexto);
                                                 db_fieldsmemory($resulttexto, 0, true);
                                                 $sqltexto = "select * from db_usuarios where id_usuario = " . db_getsession("DB_id_usuario");
                                                 $resulttexto = pg_exec($sqltexto);
                                                 db_fieldsmemory($resulttexto, 0, true);
                                                 $sqltexto = "select * from db_textos where id_instit = " . db_getsession("DB_instit") . " and ( descrtexto like 'ordemdecompra%')";
                                                 $resulttexto = pg_exec($sqltexto);
                                                 for ($xx = 0; $xx < pg_numrows($resulttexto); $xx++) {
                                                     db_fieldsmemory($resulttexto, $xx, true);
                                                     $text = $descrtexto;
                                                     ${$text} = db_geratexto($conteudotexto);
                                                 }
                                                 $texto1 = @$ordemdecompra1;
                                                 $texto2 = @$ordemdecompra2;
                                                 $result_endent = pg_exec("select * from db_departender inner join ruas on j14_codigo = codlograd inner join bairro on j13_codi = codbairro where coddepto = " . $this->depto);
                                                 if (pg_numrows($result_endent) > 0) {
                                                     db_fieldsmemory($result_endent, 0, true);
                                                     global $j14_nome;
                                                     global $numero;
                                                     global $compl;
                                                     global $j13_descr;
                                                     $this->objpdf->sety($xlin + 24);
                                                     $posicao_atual = $this->objpdf->gety();
                                                     $this->objpdf->Setfont('Arial', 'B', 8);
                                                     $this->objpdf->multicell(202, 4, "{$texto1}", 1);
                                                     $this->objpdf->multicell(202, 4, "ENDERECO DE ENTREGA: {$j14_nome}, {$numero} - {$compl}\nBAIRRO: {$j13_descr}", 1);
                                                     $posicao_depois = $this->objpdf->gety();
                                                     $xlin += $posicao_depois - $posicao_atual + 2;
                                                 }
                                                 $this->objpdf->sety($xlin + 24);
                                                 $posicao_atual = $this->objpdf->gety();
                                                 $this->objpdf->multicell(202, 4, "PRAZO DE ENTREGA: " . $this->prazoent . " DIAS A CONTAR DA DATA DO RECEBIMENTO DESTA ORDEM DE COMPRA", 1);
                                                 $this->objpdf->multicell(202, 4, "CONDICOES DE PAGAMENTO: " . pg_result($this->recorddositens, 0, $this->condpag), 1);
                                                 $this->objpdf->multicell(202, 4, "DESTINO: " . pg_result($this->recorddositens, 0, $this->destino), 1);
                                                 $posicao_depois = $this->objpdf->gety();
                                                 $xlin += $posicao_depois - $posicao_atual + 2;
                                                 if ($this->obs != "") {
                                                     $this->objpdf->sety($xlin + 24);
                                                     $posicao_atual = $this->objpdf->gety();
                                                     $this->objpdf->multicell(202, 4, "OBSERVAÇÕES:  " . $this->obs, 1);
                                                     $posicao_depois = $this->objpdf->gety();
                                                     $xlin += $posicao_depois - $posicao_atual + 2;
                                                 }
                                                 $this->objpdf->sety($xlin + 24);
                                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                                 $this->objpdf->rect($xcol, $xlin + 24, 12, 6, 2, 'DF', '12');
                                                 $this->objpdf->rect($xcol + 12, $xlin + 24, 15, 6, 2, 'DF', '12');
                                                 $this->objpdf->rect($xcol + 27, $xlin + 24, 11, 6, 2, 'DF', '12');
                                                 $this->objpdf->rect($xcol + 38, $xlin + 24, 104, 6, 2, 'DF', '12');
                                                 $this->objpdf->rect($xcol + 142, $xlin + 24, 30, 6, 2, 'DF', '12');
                                                 $this->objpdf->rect($xcol + 172, $xlin + 24, 30, 6, 2, 'DF', '12');
                                                 $this->objpdf->rect($xcol, $xlin + 30, 12, 205 - $xlin, 2, 'DF', '34');
                                                 $this->objpdf->rect($xcol + 12, $xlin + 30, 15, 205 - $xlin, 2, 'DF', '34');
                                                 $this->objpdf->rect($xcol + 27, $xlin + 30, 11, 205 - $xlin, 2, 'DF', '34');
                                                 $this->objpdf->rect($xcol + 38, $xlin + 30, 104, 205 - $xlin, 2, 'DF', '34');
                                                 $this->objpdf->rect($xcol + 142, $xlin + 30, 30, 205 - $xlin, 2, 'DF', '');
                                                 $this->objpdf->rect($xcol + 172, $xlin + 30, 30, 205 - $xlin, 2, 'DF', '34');
                                                 //	$this->objpdf->rect($xcol,$xlin+182,142,23,2,'DF','');
                                                 $this->objpdf->sety($xlin + 28);
                                                 $alt = 4;
                                                 $this->objpdf->text($xcol + 2, $xlin + 28, 'ITEM');
                                                 $this->objpdf->text($xcol + 12.5, $xlin + 28, 'EMPENHO');
                                                 $this->objpdf->text($xcol + 27.5, $xlin + 28, 'QUANT');
                                                 $this->objpdf->text($xcol + 70, $xlin + 28, 'MATERIAL OU SERVIÇO');
                                                 $this->objpdf->text($xcol + 145, $xlin + 28, 'VALOR UNITÁRIO');
                                                 $this->objpdf->text($xcol + 176, $xlin + 28, 'VALOR TOTAL');
                                                 $maiscol = 0;
                                                 $this->objpdf->setfillcolor(0, 0, 0);
                                                 $this->objpdf->text($xcol + 10, 290, strtoupper($this->municpref) . ', ' . substr($this->emissao, 8, 2) . ' DE ' . strtoupper(db_mes(substr($this->emissao, 5, 2))) . ' DE ' . substr($this->emissao, 0, 4) . '.');
                                                 $this->objpdf->text($xcol + 120, 290, '___________________________________________');
                                                 $this->objpdf->SetWidths(array(12, 16, 10, 104, 30, 30));
                                                 $this->objpdf->SetAligns(array('C', 'C', 'C', 'L', 'R', 'R'));
                                                 $this->objpdf->setleftmargin(4);
                                                 $this->objpdf->sety($xlin + 32);
                                                 $xtotal = 0;
                                                 $item = 1;
                                                 for ($ii = 0; $ii < $this->linhasdositens; $ii++) {
                                                     db_fieldsmemory($this->recorddositens, $ii);
                                                     $this->objpdf->Setfont('Arial', '', 8);
                                                     $this->objpdf->Row(array(pg_result($this->recorddositens, $ii, $this->codmater), pg_result($this->recorddositens, $ii, $this->empempenho) . "/" . pg_result($this->recorddositens, $ii, $this->anousuemp), pg_result($this->recorddositens, $ii, $this->quantitem), pg_result($this->recorddositens, $ii, $this->descricaoitem) . "\n" . pg_result($this->recorddositens, $ii, $this->observacaoitem), db_formatar(pg_result($this->recorddositens, $ii, $this->valoritem) / pg_result($this->recorddositens, $ii, $this->quantitem), 'f'), db_formatar(pg_result($this->recorddositens, $ii, $this->valoritem), 'f')), 3, false, 4);
                                                     $xtotal += pg_result($this->recorddositens, $ii, $this->valoritem);
                                                     $item++;
                                                     $this->objpdf->Setfont('Arial', 'B', 8);
                                                     /////// troca de pagina
                                                     if ($this->objpdf->gety() > $this->objpdf->h - 85 && $pagina == 1 || $this->objpdf->gety() > $this->objpdf->h - 40 && $pagina != 1) {
                                                         if ($this->objpdf->PageNo() == 1) {
                                                             if ($this->obs != "") {
                                                                 $this->objpdf->text(110, 268 - $xlin, 'Continua na Página ' . ($pagina + 1));
                                                                 //$this->objpdf->rect($xcol,$xlin+217,202,55,2,'DF','1234');
                                                             } else {
                                                                 $this->objpdf->text(110, $xlin + 243, 'Continua na Página ' . ($pagina + 1));
                                                             }
                                                         } else {
                                                             $this->objpdf->text(110, $xlin + 320, 'Continua na Página ' . ($pagina + 1));
                                                         }
                                                         if ($pagina == 1) {
                                                             $xlin = 20;
                                                             $xcol = 4;
                                                             $this->objpdf->rect($xcol, $xlin + 205, 142, 10, 2, 'DF', '34');
                                                             $this->objpdf->rect($xcol + 142, $xlin + 205, 30, 10, 2, 'DF', '34');
                                                             $this->objpdf->rect($xcol + 172, $xlin + 205, 30, 10, 2, 'DF', '34');
                                                             $this->objpdf->text($xcol + 100, $xlin + 211, 'T O T A L   D A   P Á G I N A');
                                                             $this->objpdf->SetXY(172, $xlin + 205);
                                                             $this->objpdf->cell(30, 10, db_formatar($xtotal, 'f'), 0, 0, "R");
                                                             $this->objpdf->SetXY(4, $xlin + 217);
                                                             $this->objpdf->multicell(202, 4, $texto2, 1);
                                                         }
                                                         $this->objpdf->addpage();
                                                         $pagina += 1;
                                                         $this->objpdf->settopmargin(1);
                                                         $xlin = 20;
                                                         $xcol = 4;
                                                         $this->objpdf->setfillcolor(245);
                                                         $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                                         $this->objpdf->setfillcolor(255, 255, 255);
                                                         $this->objpdf->Setfont('Arial', 'B', 9);
                                                         $this->objpdf->text(130, $xlin - 13, 'ORDEM DE COMPRA N' . CHR(176));
                                                         $this->objpdf->text(185, $xlin - 13, db_formatar($this->numordem, 's', '0', 6, 'e'));
                                                         $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                                         //.$this->logo
                                                         $this->objpdf->Setfont('Arial', 'B', 9);
                                                         $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                                         $this->objpdf->Setfont('Arial', '', 9);
                                                         $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                                         $this->objpdf->text(40, $xlin - 8, $this->municpref);
                                                         $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                                                         $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                                                         $xlin = -30;
                                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                                         $this->objpdf->rect($xcol, $xlin + 54, 12, 6, 2, 'DF', '12');
                                                         $this->objpdf->rect($xcol + 12, $xlin + 54, 15, 6, 2, 'DF', '12');
                                                         $this->objpdf->rect($xcol + 27, $xlin + 54, 11, 6, 2, 'DF', '12');
                                                         $this->objpdf->rect($xcol + 38, $xlin + 54, 104, 6, 2, 'DF', '12');
                                                         $this->objpdf->rect($xcol + 142, $xlin + 54, 30, 6, 2, 'DF', '12');
                                                         $this->objpdf->rect($xcol + 172, $xlin + 54, 30, 6, 2, 'DF', '12');
                                                         $this->objpdf->rect($xcol, $xlin + 60, 12, 252, 2, 'DF', '34');
                                                         $this->objpdf->rect($xcol + 12, $xlin + 60, 15, 252, 2, 'DF', '34');
                                                         $this->objpdf->rect($xcol + 27, $xlin + 60, 11, 252, 2, 'DF', '34');
                                                         $this->objpdf->rect($xcol + 38, $xlin + 60, 104, 252, 2, 'DF', '34');
                                                         $this->objpdf->rect($xcol + 142, $xlin + 60, 30, 252, 2, 'DF', '');
                                                         $this->objpdf->rect($xcol + 172, $xlin + 60, 30, 252, 2, 'DF', '34');
                                                         $this->objpdf->sety($xlin + 66);
                                                         $alt = 4;
                                                         $this->objpdf->text($xcol + 2, $xlin + 59, 'ITEM');
                                                         $this->objpdf->text($xcol + 12.5, $xlin + 59, 'EMPENHO');
                                                         $this->objpdf->text($xcol + 27.5, $xlin + 59, 'QUANT');
                                                         $this->objpdf->text($xcol + 70, $xlin + 59, 'MATERIAL OU SERVIÇO');
                                                         $this->objpdf->text($xcol + 145, $xlin + 59, 'VALOR UNITÁRIO');
                                                         $this->objpdf->text($xcol + 176, $xlin + 59, 'VALOR TOTAL');
                                                         $this->objpdf->text($xcol + 40, $xlin + 63, 'Continuação da Página ' . ($pagina - 1));
                                                         $maiscol = 0;
                                                     }
                                                 }
                                                 if ($pagina == 1) {
                                                     $xlin = 20;
                                                     $xcol = 4;
                                                     $this->objpdf->rect($xcol, $xlin + 205, 142, 10, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol + 142, $xlin + 205, 30, 10, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol + 172, $xlin + 205, 30, 10, 2, 'DF', '34');
                                                     $this->objpdf->text($xcol + 100, $xlin + 211, 'T O T A L   G E R A L');
                                                     $this->objpdf->SetXY(172, $xlin + 205);
                                                     $this->objpdf->cell(30, 10, db_formatar($xtotal, 'f'), 0, 0, "R");
                                                     $this->objpdf->SetXY(4, $xlin + 217);
                                                     $this->objpdf->multicell(202, 4, $texto2, 1);
                                                 } else {
                                                     $this->objpdf->rect($xcol, $xlin + 312, 12, 10, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol + 12, $xlin + 312, 15, 10, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol + 27, $xlin + 312, 11, 10, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol + 38, $xlin + 312, 104, 10, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol + 142, $xlin + 312, 30, 10, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol + 172, $xlin + 312, 30, 10, 2, 'DF', '34');
                                                     /*
                                                     	  $this->objpdf->rect($xcol,    $xlin+295,142, 10,2,'DF','34');
                                                     	  $this->objpdf->rect($xcol+142,$xlin+295,30, 10,2,'DF','34');
                                                     	  $this->objpdf->rect($xcol+172,$xlin+295,30, 10,2,'DF','34');
                                                     */
                                                     $this->objpdf->text($xcol + 100, $xlin + 319, 'T O T A L   G E R A L');
                                                     $this->objpdf->text($xcol + 172, $xlin + 319, db_formatar($xtotal, 'f'));
                                                 }
                                                 //	$this->objpdf->multicell(202,4,"A) PARA INFORMAÇÕES SOBRE O PRESENTE ORDEM, FAVOR ENTRAR EM CONTATO COM MARA, PELO TELEFONE (055) 3961 1616, OU EM NOSSA SEDE: MAJOR JOÃO CEZIMBRA JACQUES, 200\n",1);
                                                 //	$this->objpdf->multicell(202,4,"B) AS NOTAS FISCAIS DEVEM SER ENCAMMINHADAS AO SETOR DE ALMOXARIFADO CENTRAL - CAM, EM 2 VIAS COM NUMERO DE EMPENHO E CONTA BANCARIA.",1);
                                                 //	$this->objpdf->multicell(202,4,"NAO SERAO ACEITAS NOTAS FISCAIS CONTENDO ITENS DE MAIS DE UMA ORDEM DE COMPRA",1);
                                                 //	$this->objpdf->multicell(202,4,"OS PRODUTOS DEVERAO SER ENTREGUES NO ALMOXARIFADO CENTRAL - CAM - CENTRO ADM MUNICIPAL NO PRAZO MAXIMO DE " . $this->prazoent. " DIAS A CONTAR DA DATA DO RECEBIMENTO DESTA ORDEM DE COMPRA",1);
                                                 $posicao_depois = $this->objpdf->gety();
                                                 $xlin += $posicao_depois - $posicao_atual + 2;
                                             } else {
                                                 if ($this->modelo == 11) {
                                                     global $contapagina;
                                                     $contapagina = 1;
                                                     if (!in_array("cl_orcreservasol", get_declared_classes())) {
                                                         include "classes/db_orcreservasol_classe.php";
                                                     }
                                                     $clorcreservasol = new cl_orcreservasol();
                                                     ////////// MODELO 11  -  SOLICITAÇÃO DE COMPRA
                                                     $this->objpdf->AliasNbPages();
                                                     $this->objpdf->AddPage();
                                                     $this->objpdf->settopmargin(1);
                                                     $pagina = 1;
                                                     $xlin = 20;
                                                     $xcol = 4;
                                                     // Imprime caixa externa
                                                     $this->objpdf->setfillcolor(245);
                                                     $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                                     // Imprime o cabeçalho com dados sobre a prefeitura
                                                     $this->objpdf->setfillcolor(255, 255, 255);
                                                     $this->objpdf->Setfont('Arial', 'B', 9);
                                                     $this->objpdf->text(130, $xlin - 13, 'SOLICITAÇÃO DE COMPRA N' . CHR(176));
                                                     $this->objpdf->text(185, $xlin - 13, db_formatar($this->Snumero, 's', '0', 6, 'e'));
                                                     $this->objpdf->Setfont('Arial', 'B', 7);
                                                     $this->objpdf->text(130, $xlin - 9, 'ORGÃO');
                                                     $this->objpdf->text(142, $xlin - 9, ': ' . substr($this->Sorgao, 0, 35));
                                                     $this->objpdf->text(130, $xlin - 5, 'UNIDADE');
                                                     $this->objpdf->text(142, $xlin - 5, ': ' . substr($this->Sunidade, 0, 35));
                                                     $this->objpdf->text(130, $xlin - 1, 'USUÁRIO');
                                                     $this->objpdf->text(142, $xlin - 1, ': ' . substr($this->Susuarioger, 0, 35));
                                                     $this->objpdf->Setfont('Arial', 'B', 9);
                                                     $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                                     $this->objpdf->Setfont('Arial', 'B', 9);
                                                     $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                                     $this->objpdf->Setfont('Arial', '', 9);
                                                     $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                                     $this->objpdf->text(40, $xlin - 8, $this->municpref);
                                                     $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                                                     $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                                                     $this->objpdf->text(40, $xlin + 1, db_formatar($this->cgcpref, 'cnpj'));
                                                     $this->objpdf->Setfont('Arial', 'B', 8);
                                                     // caixa para frases
                                                     $this->objpdf->rect($xcol, $xlin + 3, $xcol + 198, 9, 2, 'DF', '1234');
                                                     $this->objpdf->SetXY(4, $xlin + 4);
                                                     $this->objpdf->MultiCell(202, 4, 'QUANDO NECESSÁRIO FRETE, O MESMO CORRERÁ POR CONTA DO FORNECEDOR', 0, "C", 0);
                                                     $this->objpdf->SetXY(4, $xlin + 8);
                                                     $this->objpdf->MultiCell(202, 4, 'TODO FRETE DEVERÁ SER PAGO PELA EMPRESA REMETENTE - O MATERIAL DEVERÁ SER DE PRIMEIRA QUALIDADE', 0, "C", 0);
                                                     $this->objpdf->Setfont('Arial', '', 8);
                                                     // Caixa com dados da solicitação
                                                     $this->objpdf->rect($xcol, $xlin + 13, $xcol + 198, 10, 2, 'DF', '1234');
                                                     $this->objpdf->Setfont('Arial', '', 6);
                                                     $this->objpdf->text($xcol + 2, $xlin + 15, 'Dados do Solicitação');
                                                     $this->objpdf->Setfont('Arial', 'B', 8);
                                                     $this->objpdf->text($xcol + 2, $xlin + 18, 'Departamento');
                                                     $this->objpdf->text($xcol + 109, $xlin + 18, 'Tipo');
                                                     $this->objpdf->text($xcol + 2, $xlin + 22, 'Data');
                                                     $this->objpdf->text($xcol + 109, $xlin + 22, 'Val. Aprox.');
                                                     // Imprime dados da solicitação
                                                     $this->objpdf->text($xcol + 23, $xlin + 18, ':  ' . $this->Sdepart);
                                                     if (isset($this->Sdata) && trim($this->Sdata) != "") {
                                                         $this->Sdata = db_formatar($this->Sdata, 'd');
                                                     }
                                                     if (isset($this->Svalor) && trim($this->Svalor) != "") {
                                                         $this->Svalor = db_formatar($this->Svalor, 'f');
                                                     }
                                                     $this->objpdf->text($xcol + 125, $xlin + 18, ':  ' . $this->Stipcom);
                                                     $this->objpdf->text($xcol + 23, $xlin + 22, ':  ' . $this->Sdata);
                                                     $this->objpdf->text($xcol + 125, $xlin + 22, ':  R$ ' . $this->Svalor);
                                                     $this->objpdf->text($xcol + 2, $xlin + 27, 'Resumo');
                                                     $this->objpdf->setxy($xcol + 22, $xlin + 24);
                                                     $this->objpdf->cell(3, 4, ':  ', 0, 0, "L", 0);
                                                     $this->objpdf->setxy($xcol + 24.5, $xlin + 24);
                                                     $posini = $this->objpdf->gety();
                                                     $this->objpdf->multicell(175, 4, trim(AddSlashes($this->Sresumo)), 0, "j");
                                                     $setaut = $this->objpdf->gety();
                                                     $oldsetaut = $setaut;
                                                     $setaut += 8;
                                                     $newsetaut = $setaut;
                                                     if ($setaut > 64) {
                                                         $newsetaut = $setaut - 8;
                                                         $tiramenos = $setaut - 64;
                                                         $setaut = $setaut - $posini;
                                                     } else {
                                                         if ($setaut == 64) {
                                                             $newsetaut = $setaut - 8;
                                                             $setaut -= 8;
                                                         } else {
                                                             if ($setaut == 60) {
                                                                 $newsetaut = $setaut - 4;
                                                                 $setaut -= 4;
                                                             }
                                                         }
                                                     }
                                                     //	db_msgbox($setaut.' -- '.$posini);
                                                     $this->objpdf->rect($xcol, $xlin + 24, $xcol + 198, $newsetaut - $posini, 2, 'DF', '1234');
                                                     $getdoy = 32;
                                                     $contafornec = 0;
                                                     if ($this->linhasdosfornec > 0) {
                                                         $x = $this->muda_pag($pagina, $xlin, $xcol, "true", $contapagina);
                                                         for ($i = 0; $i < $this->linhasdosfornec; $i++) {
                                                             $contafornec += 4;
                                                         }
                                                         $onze = 11;
                                                         if ($oldsetaut + 8 > 64) {
                                                             $setaut += 36;
                                                         }
                                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                                         // Caixa de texto para labels
                                                         $this->objpdf->rect($xcol, $setaut + 0.8, 202, 6, 2, 'DF', '12');
                                                         $this->objpdf->text($xcol + 4, $setaut + 4.2, 'FORNECEDORES SUGERIDOS ');
                                                         $this->objpdf->rect($xcol, $setaut + 6.8, 15, 6, 2, 'DF', '12');
                                                         $this->objpdf->rect($xcol + 15, $setaut + 6.8, 64, 6, 2, 'DF', '12');
                                                         $this->objpdf->rect($xcol + 79, $setaut + 6.8, 63, 6, 2, 'DF', '12');
                                                         $this->objpdf->rect($xcol + 142, $setaut + 6.8, 40, 6, 2, 'DF', '12');
                                                         $this->objpdf->rect($xcol + 182, $setaut + 6.8, 20, 6, 2, 'DF', '12');
                                                         $this->objpdf->rect($xcol, $setaut + 12.8, 15, $contafornec + 1, 2, 'DF', '34');
                                                         $this->objpdf->rect($xcol + 15, $setaut + 12.8, 64, $contafornec + 1, 2, 'DF', '34');
                                                         $this->objpdf->rect($xcol + 79, $setaut + 12.8, 63, $contafornec + 1, 2, 'DF', '34');
                                                         $this->objpdf->rect($xcol + 142, $setaut + 12.8, 40, $contafornec + 1, 2, 'DF', '34');
                                                         $this->objpdf->rect($xcol + 182, $setaut + 12.8, 20, $contafornec + 1, 2, 'DF', '34');
                                                         $this->objpdf->sety($xlin + 66);
                                                         // Label das colunas
                                                         $this->objpdf->text($xcol + 4, $setaut + 11, 'CGM');
                                                         $this->objpdf->text($xcol + 30.5, $setaut + 11, 'NOME/RAZÃO SOCIAL');
                                                         $this->objpdf->text($xcol + 103, $setaut + 11, 'ENDEREÇO');
                                                         $this->objpdf->text($xcol + 155, $setaut + 11, 'MUNICÍPIO');
                                                         $this->objpdf->text($xcol + 184.5, $setaut + 11, 'TELEFONE');
                                                         // Seta altura nova para impressão dos dados
                                                         $this->objpdf->sety($setaut + 13.8);
                                                         $this->objpdf->setx($xcol);
                                                         $this->objpdf->setleftmargin(4);
                                                         $this->objpdf->Setfont('Arial', '', 7);
                                                         $this->objpdf->SetAligns(array('C', 'L', 'L', 'L', 'C'));
                                                         $this->objpdf->SetWidths(array(15, 64, 63, 40, 20));
                                                         for ($i = 0; $i < $this->linhasdosfornec; $i++) {
                                                             db_fieldsmemory($this->recorddosfornec, $i);
                                                             $cgmforn = trim(pg_result($this->recorddosfornec, $i, $this->cgmforn));
                                                             $nomeforn = trim(pg_result($this->recorddosfornec, $i, $this->nomeforn));
                                                             $enderforn = trim(pg_result($this->recorddosfornec, $i, $this->enderforn));
                                                             $numforn = trim(pg_result($this->recorddosfornec, $i, $this->numforn));
                                                             $municforn = trim(pg_result($this->recorddosfornec, $i, $this->municforn));
                                                             $foneforn = trim(pg_result($this->recorddosfornec, $i, $this->foneforn));
                                                             $this->objpdf->Row(array($cgmforn, $nomeforn, $enderforn . ", " . $numforn, $municforn, $foneforn), 4, false, 4);
                                                         }
                                                         $getdoy = $this->objpdf->gety();
                                                         $getdoy += 0.8;
                                                         $getdoy = $getdoy - $xlin;
                                                         $contafornec += 8;
                                                     } else {
                                                         $getdoy += 4.8;
                                                         if ($oldsetaut + 8 > 64) {
                                                             $getdoy += 8;
                                                         }
                                                     }
                                                     // Caixas dos label's
                                                     $this->objpdf->rect($xcol, $xlin + $getdoy, 10, 6, 2, 'DF', '12');
                                                     $this->objpdf->rect($xcol + 10, $xlin + $getdoy, 12, 6, 2, 'DF', '12');
                                                     $this->objpdf->rect($xcol + 22, $xlin + $getdoy, 22, 6, 2, 'DF', '12');
                                                     $this->objpdf->rect($xcol + 44, $xlin + $getdoy, 98, 6, 2, 'DF', '12');
                                                     $this->objpdf->rect($xcol + 142, $xlin + $getdoy, 30, 6, 2, 'DF', '12');
                                                     $this->objpdf->rect($xcol + 172, $xlin + $getdoy, 30, 6, 2, 'DF', '12');
                                                     $menos = 16.9;
                                                     if ($this->linhasdosfornec == 0) {
                                                         $menos = 11;
                                                     }
                                                     if (isset($tiramenos)) {
                                                         $menos = $menos + $tiramenos;
                                                         if ($menos < 0) {
                                                             $menos = -$menos;
                                                         }
                                                     }
                                                     // Caixa dos itens
                                                     $this->objpdf->rect($xcol, $xlin + $getdoy + 6, 10, 193 - $contafornec - $menos, 2, 'DF', '34');
                                                     // Caixa da quantidade
                                                     $this->objpdf->rect($xcol + 10, $xlin + $getdoy + 6, 12, 193 - $contafornec - $menos, 2, 'DF', '34');
                                                     $this->objpdf->rect($xcol + 22, $xlin + $getdoy + 6, 22, 193 - $contafornec - $menos, 2, 'DF', '34');
                                                     // Caixa dos materiais ou serviços
                                                     $this->objpdf->rect($xcol + 44, $xlin + $getdoy + 6, 98, 193 - $contafornec - $menos, 2, 'DF', '34');
                                                     // Caixa dos valores unitários
                                                     $this->objpdf->rect($xcol + 142, $xlin + $getdoy + 6, 30, 193 - $contafornec - $menos, 2, 'DF', '');
                                                     // Caixa dos valores totais dos itens
                                                     $this->objpdf->rect($xcol + 172, $xlin + $getdoy + 6, 30, 193 - $contafornec - $menos, 2, 'DF', '34');
                                                     $this->objpdf->sety($xlin + 28);
                                                     // Label das colunas
                                                     $this->objpdf->Setfont('Arial', 'B', 8);
                                                     $this->objpdf->text($xcol + 2, $xlin + $getdoy + 4, 'ITEM');
                                                     $this->objpdf->text($xcol + 11, $xlin + $getdoy + 4, 'QUANT');
                                                     $this->objpdf->text($xcol + 30, $xlin + $getdoy + 4, 'REF');
                                                     $this->objpdf->text($xcol + 70, $xlin + $getdoy + 4, 'MATERIAL OU SERVIÇO');
                                                     $this->objpdf->text($xcol + 145, $xlin + $getdoy + 4, 'VALOR UNITÁRIO');
                                                     $this->objpdf->text($xcol + 176, $xlin + $getdoy + 4, 'VALOR TOTAL');
                                                     $maiscol = 0;
                                                     $this->objpdf->setleftmargin(3);
                                                     $this->objpdf->sety($xlin + $getdoy + 7);
                                                     $xtotal = 0;
                                                     $muda_pag = false;
                                                     $index = 0;
                                                     for ($ii = 0; $ii < $this->linhasdositens; $ii++) {
                                                         $itemant = "";
                                                         $pass = false;
                                                         $this->objpdf->SetWidths(array(10, 12, 24, 95, 30, 30));
                                                         $this->objpdf->SetAligns(array('C', 'C', 'C', 'J', 'R', 'R'));
                                                         $pagina = $this->objpdf->PageNo();
                                                         db_fieldsmemory($this->recorddositens, $ii);
                                                         if ($ii != 0 && $muda_pag == false) {
                                                             $muda_pag = false;
                                                             $this->objpdf->ln(0.3);
                                                             $this->objpdf->rect(4, $this->objpdf->gety(), 202, 0, 1, 'DF', '1234');
                                                             $this->objpdf->ln(1.3);
                                                         }
                                                         $codigo = pg_result($this->recorddositens, $ii, "pc11_codigo");
                                                         $item = pg_result($this->recorddositens, $ii, $this->item);
                                                         $quantitem = pg_result($this->recorddositens, $ii, $this->quantitem);
                                                         $descricaoitem = pg_result($this->recorddositens, $ii, $this->descricaoitem);
                                                         $valoritem = db_formatar(pg_result($this->recorddositens, $ii, $this->valoritem), "f");
                                                         $valtot = pg_result($this->recorddositens, $ii, $this->svalortot);
                                                         $valimp = db_formatar($valtot, 'f');
                                                         $prazo = pg_result($this->recorddositens, $ii, $this->sprazo);
                                                         $pgto = pg_result($this->recorddositens, $ii, $this->spgto);
                                                         $resum = pg_result($this->recorddositens, $ii, $this->sresum);
                                                         $just = pg_result($this->recorddositens, $ii, $this->sjust);
                                                         $unid = pg_result($this->recorddositens, $ii, $this->sunidade);
                                                         $abrevunid = pg_result($this->recorddositens, $ii, $this->sabrevunidade);
                                                         $servico = pg_result($this->recorddositens, $ii, $this->sservico);
                                                         $quantunid = pg_result($this->recorddositens, $ii, $this->squantunid);
                                                         $susaquant = pg_result($this->recorddositens, $ii, $this->susaquant);
                                                         $scodpcmater = pg_result($this->recorddositens, $ii, $this->scodpcmater);
                                                         $selemento = pg_result($this->recorddositens, $ii, $this->selemento);
                                                         $sdelemento = pg_result($this->recorddositens, $ii, $this->sdelemento);
                                                         $xtotal += $valtot;
                                                         if (isset($descricaoitem) && (trim($descricaoitem) == "" || $descricaoitem == null) || !isset($descricaoitem)) {
                                                             $descricaoitem = $resum;
                                                             unset($resum);
                                                         }
                                                         if (isset($scodpcmater) && trim($scodpcmater) != "") {
                                                             $scodpcmater = trim($scodpcmater) . " - ";
                                                         }
                                                         if (isset($prazo) && trim($prazo) != "") {
                                                             $prazo = "\nPRAZO: " . trim($prazo);
                                                         }
                                                         if (isset($pgto) && trim($pgto) != "") {
                                                             $pgto = "\nCONDIÇÃO: " . trim($pgto);
                                                         }
                                                         if (isset($resum) && trim($resum) != "") {
                                                             $resum = "\nRESUMO: " . trim($resum);
                                                         }
                                                         if (isset($just) && trim($just) != "") {
                                                             $just = "\nJUSTIFICATIVA: " . trim($just);
                                                         }
                                                         if (isset($servico) && (trim($servico) == "f" || trim($servico) == "") || !isset($servico)) {
                                                             $unid = trim(substr($unid, 0, 10));
                                                             if ($susaquant == "t") {
                                                                 $unid .= " \n{$quantunid} UNIDADES\n";
                                                             }
                                                         } else {
                                                             $unid = "SERVIÇO";
                                                         }
                                                         //	  $descricaoitem .= " - ".$unid;
                                                         $distanciar = 0;
                                                         if (isset($prazo) && trim($prazo) == "" && (isset($pgto) && trim($pgto) == "") && (isset($resum) && trim($resum) == "") && (isset($just) && trim($just) == "")) {
                                                             $distanciar = 4;
                                                         } else {
                                                         }
                                                         $this->objpdf->Setfont('Arial', 'B', 7);
                                                         if (isset($selemento) && trim($selemento) != "") {
                                                             $this->objpdf->Row(array('', '', '', db_formatar($selemento, 'elemento') . " - " . $sdelemento, '', ''), 3, false, 4);
                                                         }
                                                         $this->objpdf->Row(array($item, $quantitem, $unid, $scodpcmater . $descricaoitem, $valoritem, $valimp), 3, false, $distanciar);
                                                         $dist = 2.7;
                                                         $x = $this->muda_pag($pagina, $xlin, $xcol, "false", $contapagina);
                                                         //	  if(isset($unid) && $unid!=""){
                                                         //	    $this->objpdf->Row(array('','',$unid,'',''),3,false,$dist);
                                                         //	    $x = $this->muda_pag($pagina,$xlin,$xcol,"false",$contapagina);
                                                         //	  }
                                                         $this->objpdf->Setfont('Arial', '', 7);
                                                         $mostraunid = false;
                                                         if (isset($prazo) && $prazo != "") {
                                                             $this->objpdf->Row(array('', '', $unid, $prazo, '', ''), 3, false, $dist);
                                                             $x = $this->muda_pag($pagina, $xlin, $xcol, "false", $contapagina);
                                                         }
                                                         if (isset($pgto) && $pgto != "") {
                                                             $this->objpdf->Row(array('', '', '', $pgto, '', ''), 3, false, $dist);
                                                             $x = $this->muda_pag($pagina, $xlin, $xcol, "false", $contapagina);
                                                         }
                                                         if (isset($resum) && $resum != "" && (isset($scodpcmater) && trim($scodpcmater) != "")) {
                                                             $this->objpdf->Row(array('', '', '', $resum, '', ''), 3, false, $dist);
                                                             $x = $this->muda_pag($pagina, $xlin, $xcol, "false", $contapagina);
                                                         }
                                                         if (isset($just) && $just != "") {
                                                             $this->objpdf->Row(array('', '', '', $just, '', ''), 3, false, $dist);
                                                             $x = $this->muda_pag($pagina, $xlin, $xcol, "false", $contapagina);
                                                         }
                                                         $this->objpdf->SetWidths(array(10, 12, 24, 95, 30, 30));
                                                         $this->objpdf->SetWidths(array(10, 12, 24, 23.7, 23.7, 23.7, 23.7, 0.2, 30, 30));
                                                         $arr_dotac = array();
                                                         for ($i = 0; $i < $this->linhasdasdotac; $i++) {
                                                             db_fieldsmemory($this->recorddasdotac, $i);
                                                             if (pg_result($this->recorddasdotac, $i, $this->dcodigo) == $codigo && !in_array(pg_result($this->recorddasdotac, $i, $this->dcoddot), $arr_dotac)) {
                                                                 if ($item != $itemant) {
                                                                     $pass = true;
                                                                     $this->objpdf->Setfont('Arial', 'B', 7);
                                                                     $distc = 3.5;
                                                                     $distb = 3;
                                                                     $this->objpdf->SetAligns(array('C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'R', 'R'));
                                                                     $this->objpdf->Row(array('', '', "\n", '', ''), 3, false, $dist);
                                                                     $this->objpdf->Row(array('', '', '', "DOTAÇÃO", "ANO", "ELEMENTO", "RESERVADO", '', ''), 3, false, $dist);
                                                                     $itemant = $item;
                                                                 }
                                                                 $this->objpdf->Setfont('Arial', '', 7);
                                                                 $this->objpdf->SetAligns(array('C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'R', 'R'));
                                                                 $dquant = pg_result($this->recorddasdotac, $i, $this->dquant);
                                                                 $danousu = pg_result($this->recorddasdotac, $i, $this->danousu);
                                                                 $dcoddot = pg_result($this->recorddasdotac, $i, $this->dcoddot);
                                                                 $dvalor = pg_result($this->recorddasdotac, $i, $this->dvalor);
                                                                 $delemento = pg_result($this->recorddasdotac, $i, $this->delemento);
                                                                 //	      $dreserva = pg_result($this->recorddasdotac,$i,$this->dreserva);
                                                                 array_push($arr_dotac, $dcoddot);
                                                                 if (isset($dcoddot) && trim($dcoddot) != "") {
                                                                     $result_orcreservasol = $clorcreservasol->sql_record($clorcreservasol->sql_query_orcreserva(null, null, "o82_codres as codigodareserva,o80_valor as valorreserva", "", "o82_solicitem={$codigo} and o80_coddot={$dcoddot}"));
                                                                     $ddvalor = "NÃO";
                                                                     if ($clorcreservasol->numrows > 0) {
                                                                         db_fieldsmemory($result_orcreservasol, 0);
                                                                         global $valorreserva;
                                                                         $valorreserva = db_formatar($valorreserva, "f");
                                                                         if ($valorreserva == $valimp) {
                                                                             $ddvalor = "TOTAL";
                                                                         } else {
                                                                             $ddvalor = $valorreserva;
                                                                         }
                                                                     }
                                                                     $x = $this->muda_pag($pagina, $xlin, $xcol, "false", $contapagina);
                                                                     $this->objpdf->Row(array('', $dquant, '', $dcoddot, $danousu, $delemento, $ddvalor, '', db_formatar($dvalor / $dquant, "f"), db_formatar($dvalor, "f")), $distc, false, $distb);
                                                                 }
                                                             } else {
                                                                 $pass = false;
                                                             }
                                                         }
                                                     }
                                                     $this->objpdf->Setfont('Arial', 'B', 8);
                                                     $maislin = 248;
                                                     if ($contapagina == 1) {
                                                         $maislin = 211;
                                                     }
                                                     $this->objpdf->text(180, $xlin + $maislin + 20, db_formatar($xtotal, 'f'));
                                                     if ($contapagina == 1) {
                                                         $this->objpdf->rect($xcol, $xlin + 224.7, 142, 10.8, 2, 'DF', '34');
                                                         $this->objpdf->rect($xcol + 142, $xlin + 224.7, 30, 10.8, 2, 'DF', '34');
                                                         $this->objpdf->rect($xcol + 172, $xlin + 224.7, 30, 10.8, 2, 'DF', '34');
                                                         $this->objpdf->text($xcol + 120, $xlin + 230.7, 'T O T A L');
                                                         if (strtoupper(trim($this->municpref)) != 'SAPIRANGA') {
                                                             $this->objpdf->rect($xcol, $xlin + 237, 66, 35, 2, 'DF', '1234');
                                                             $this->objpdf->rect($xcol + 68, $xlin + 237, 66, 35, 2, 'DF', '1234');
                                                             $this->objpdf->rect($xcol + 136, $xlin + 237, 66, 35, 2, 'DF', '1234');
                                                             $this->objpdf->setfillcolor(0, 0, 0);
                                                             $this->objpdf->setfillcolor(0, 0, 0);
                                                             $this->objpdf->text($xcol + 5, $xlin + 244, strtoupper($this->municpref) . ', ' . substr($this->emissao, 8, 2) . ' DE ' . strtoupper(db_mes(substr($this->emissao, 5, 2))) . ' DE ' . substr($this->emissao, 0, 4) . '.');
                                                             $this->objpdf->text($xcol + 20, $xlin + 256, "AUTORIZO", 0, 4);
                                                             $this->objpdf->text($xcol + 5, $xlin + 268, substr($this->Sorgao, 0, 35));
                                                             $this->objpdf->setfillcolor(0, 0, 0);
                                                             $this->objpdf->text($xcol + 93, $xlin + 256, "AUTORIZO", 0, 4);
                                                             if (strtoupper(trim($this->municpref)) != 'GUAIBA') {
                                                                 $this->objpdf->text($xcol + 83, $xlin + 268, 'DIV. DE ABASTECIMENTO', 0, 40);
                                                             }
                                                             $this->objpdf->setfillcolor(0, 0, 0);
                                                             $this->objpdf->text($xcol + 150, $xlin + 256, "ORDENADOR DA DESPESA", 0, 4);
                                                         } else {
                                                             $this->objpdf->Setfont('Arial', 'B', 7);
                                                             $this->objpdf->rect($xcol, $xlin + 227, 66, 45, 2, 'DF', '1234');
                                                             $this->objpdf->rect($xcol + 68, $xlin + 227, 66, 45, 2, 'DF', '1234');
                                                             $this->objpdf->rect($xcol + 136, $xlin + 227, 66, 45, 2, 'DF', '1234');
                                                             $this->objpdf->SetXY($xcol + 00, $xlin + 238);
                                                             $this->objpdf->multicell(66, 4, "SOLICITANTE", 0, "C");
                                                             $this->objpdf->SetXY($xcol + 00, $xlin + 243.5);
                                                             $this->objpdf->multicell(66, 0.5, "_________________________________", 0, "C");
                                                             $this->objpdf->SetXY($xcol + 00, $xlin + 249.5);
                                                             //   SECRETÁRIO(A) DA SECRETARIA QUE SOLICITOU   //
                                                             $this->objpdf->multicell(66, 4, "SECRETÁRIO", 0, "C");
                                                             $this->objpdf->text($xcol + 10, $xlin + 254.5, substr($this->Sorgao, 0, 30), 0, 4);
                                                             ///////////////////////////////////////////////////
                                                             $this->objpdf->text($xcol + 10, $xlin + 260, "_________________________________", 0, 4);
                                                             //	    $this->objpdf->multicell(66,0.5,"_________________________________",0,"C");
                                                             $this->objpdf->text($xcol + 10, $xlin + 270, strtoupper($this->municpref) . ', ' . substr($this->emissao, 8, 2) . ' DE ' . strtoupper(db_mes(substr($this->emissao, 5, 2))) . ' DE ' . substr($this->emissao, 0, 4) . '.');
                                                             //	    $this->objpdf->SetXY($xcol+68,$xlin+243.5);
                                                             //	    $this->objpdf->multicell(66,0.5,"_________________________________",0,"C");
                                                             $this->objpdf->SetXY($xcol + 68, $xlin + 238);
                                                             $this->objpdf->multicell(66, 4, "CONTABILIDADE", 0, "C");
                                                             $this->objpdf->SetXY($xcol + 68, $xlin + 249);
                                                             $this->objpdf->multicell(66, 4, "HÁ RECURSOS FINANCEIROS", 0, "C");
                                                             $tamanho = strlen($this->secfaz);
                                                             $posicao = strpos($this->secfaz, "\n");
                                                             $secretaria = $this->secfaz;
                                                             $deque = "";
                                                             if ($posicao != "" && $posicao != 0) {
                                                                 $secretaria = substr($this->secfaz, 0, $posicao);
                                                                 $deque = substr($this->secfaz, $posicao, $tamanho);
                                                             }
                                                             $this->objpdf->text($xcol + 85, $xlin + 257, $secretaria, 0, 4);
                                                             $this->objpdf->text($xcol + 84.5, $xlin + 259.5, $deque, 0, 4);
                                                             $this->objpdf->text($xcol + 92, $xlin + 264, "CONFERIDO", 0, 4);
                                                             $this->objpdf->text($xcol + 83.5, $xlin + 270, "________/________/________", 0, 4);
                                                             $this->objpdf->SetXY($xcol + 136, $xlin + 240);
                                                             $this->objpdf->multicell(66, 4, $this->nompre, 0, "C");
                                                             $this->objpdf->SetXY($xcol + 136, $xlin + 252);
                                                             $this->objpdf->multicell(66, 4, "AUTORIZO", 0, "C");
                                                             $this->objpdf->text($xcol + 150.5, $xlin + 270, "________/________/________", 0, 4);
                                                             //	    $this->objpdf->text($xcol+14,$xlin+247,"________/________/________",0,4);
                                                             /*
                                                             $this->objpdf->text($xcol+20,$xlin+241,strtoupper($this->municpref).', '.substr($this->emissao,8,2).' DE '.strtoupper(db_mes(substr($this->emissao,5,2))).' DE '.substr($this->emissao,0,4).'.');
                                                             $this->objpdf->rect($xcol,$xlin+237,100,35,2,'DF','1234');
                                                             $this->objpdf->rect($xcol+102,$xlin+237,100,35,2,'DF','1234');
                                                             
                                                             $this->objpdf->text($xcol+40,$xlin+256,"AUTORIZO",0,4);
                                                             $this->objpdf->text($xcol+20,$xlin+264,substr($this->Srespdepart,0,35));
                                                             $this->objpdf->text($xcol+20,$xlin+268,substr($this->Sdepart,0,35));
                                                             $this->objpdf->text($xcol+145,$xlin+256,"VISTO",0,4);
                                                             */
                                                         }
                                                     } else {
                                                         $this->objpdf->rect($xcol, $xlin + 262, 142, 10, 2, 'DF', '34');
                                                         $this->objpdf->rect($xcol + 142, $xlin + 262, 30, 10, 2, 'DF', '34');
                                                         $this->objpdf->rect($xcol + 172, $xlin + 262, 30, 10, 2, 'DF', '34');
                                                         $this->objpdf->text($xcol + 120, $xlin + 268, 'T O T A L');
                                                     }
                                                 } else {
                                                     if ($this->modelo == 111) {
                                                         global $contapagina;
                                                         $contapagina = 1;
                                                         if (!in_array("cl_orcreservasol", get_declared_classes())) {
                                                             include "classes/db_orcreservasol_classe.php";
                                                         }
                                                         $clorcreservasol = new cl_orcreservasol();
                                                         ////////// MODELO 111  -  SOLICITAÇÃO DE COMPRA
                                                         $this->objpdf->AliasNbPages();
                                                         $this->objpdf->AddPage();
                                                         $this->objpdf->settopmargin(1);
                                                         $pagina = 1;
                                                         $xlin = 20;
                                                         $xcol = 4;
                                                         // Imprime caixa externa
                                                         $this->objpdf->setfillcolor(245);
                                                         $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                                         // Imprime o cabeçalho com dados sobre a prefeitura
                                                         $this->objpdf->setfillcolor(255, 255, 255);
                                                         $this->objpdf->Setfont('Arial', 'B', 9);
                                                         $this->objpdf->text(130, $xlin - 13, 'SOLICITAÇÃO DE COMPRA N' . CHR(176));
                                                         $this->objpdf->text(185, $xlin - 13, db_formatar($this->Snumero, 's', '0', 6, 'e'));
                                                         $this->objpdf->Setfont('Arial', 'B', 7);
                                                         $this->objpdf->text(130, $xlin - 9, 'ORGAO');
                                                         $this->objpdf->text(142, $xlin - 9, ': ' . substr($this->Sorgao, 0, 35));
                                                         $this->objpdf->text(130, $xlin - 5, 'UNIDADE');
                                                         $this->objpdf->text(142, $xlin - 5, ': ' . substr($this->Sunidade, 0, 35));
                                                         $this->objpdf->Setfont('Arial', 'B', 9);
                                                         $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                                         $this->objpdf->Setfont('Arial', 'B', 9);
                                                         $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                                         $this->objpdf->Setfont('Arial', '', 9);
                                                         $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                                         $this->objpdf->text(40, $xlin - 8, $this->municpref);
                                                         $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                                                         $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                                         // caixa para frases
                                                         $this->objpdf->rect($xcol, $xlin + 3, $xcol + 198, 9, 2, 'DF', '1234');
                                                         $this->objpdf->SetXY(4, $xlin + 4);
                                                         $this->objpdf->MultiCell(202, 4, 'QUANDO NECESSÁRIO FRETE, O MESMO CORRERÁ POR CONTA DO FORNECEDOR', 0, "C", 0);
                                                         $this->objpdf->SetXY(4, $xlin + 8);
                                                         $this->objpdf->MultiCell(202, 4, 'TODO FRETE DEVERÁ SER PAGO PELA EMPRESA REMETENTE - O MATERIAL DEVERÁ SER DE PRIMEIRA QUALIDADE', 0, "C", 0);
                                                         $this->objpdf->Setfont('Arial', '', 8);
                                                         // Caixa com dados da solicitação
                                                         $this->objpdf->rect($xcol, $xlin + 13, $xcol + 198, 10, 2, 'DF', '1234');
                                                         $this->objpdf->Setfont('Arial', '', 6);
                                                         $this->objpdf->text($xcol + 2, $xlin + 15, 'Dados do Solicitação');
                                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                                         $this->objpdf->text($xcol + 2, $xlin + 18, 'Departamento');
                                                         $this->objpdf->text($xcol + 109, $xlin + 18, 'Tipo');
                                                         $this->objpdf->text($xcol + 2, $xlin + 22, 'Data');
                                                         $this->objpdf->text($xcol + 109, $xlin + 22, 'Val. Aprox.');
                                                         // Imprime dados da solicitação
                                                         $this->objpdf->text($xcol + 23, $xlin + 18, ':  ' . $this->Sdepart);
                                                         if (isset($this->Sdata) && trim($this->Sdata) != "") {
                                                             $this->Sdata = db_formatar($this->Sdata, 'd');
                                                         }
                                                         if (isset($this->Svalor) && trim($this->Svalor) != "") {
                                                             $this->Svalor = db_formatar($this->Svalor, 'f');
                                                         }
                                                         $this->objpdf->text($xcol + 125, $xlin + 18, ':  ' . $this->Stipcom);
                                                         $this->objpdf->text($xcol + 23, $xlin + 22, ':  ' . $this->Sdata);
                                                         $this->objpdf->text($xcol + 125, $xlin + 22, ':  R$ ' . $this->Svalor);
                                                         $this->objpdf->text($xcol + 2, $xlin + 27, 'Resumo');
                                                         $this->objpdf->setxy($xcol + 22, $xlin + 24);
                                                         $this->objpdf->cell(3, 4, ':  ', 0, 0, "L", 0);
                                                         $this->objpdf->setxy($xcol + 24.5, $xlin + 24);
                                                         $posini = $this->objpdf->gety();
                                                         $this->objpdf->multicell(175, 4, trim(AddSlashes($this->Sresumo)), 0, "j");
                                                         $setaut = $this->objpdf->gety();
                                                         $this->objpdf->rect($xcol, $xlin + 24, $xcol + 198, $setaut - $posini, 2, 'DF', '1234');
                                                         $getdoy = 32;
                                                         $contafornec = 0;
                                                         if ($this->linhasdosfornec > 0) {
                                                             $x = $this->muda_pag($pagina, $xlin, $xcol, "true", $contapagina);
                                                             for ($i = 0; $i < $this->linhasdosfornec; $i++) {
                                                                 $contafornec += 4;
                                                             }
                                                             $this->objpdf->Setfont('Arial', 'B', 8);
                                                             // Caixa de texto para labels
                                                             $this->objpdf->rect($xcol, $setaut + 0.8, 202, 6, 2, 'DF', '12');
                                                             $this->objpdf->text($xcol + 4, $setaut + 4.2, 'FORNECEDORES SUGERIDOS ');
                                                             $this->objpdf->rect($xcol, $setaut + 6.8, 15, 6, 2, 'DF', '12');
                                                             $this->objpdf->rect($xcol + 15, $setaut + 6.8, 64, 6, 2, 'DF', '12');
                                                             $this->objpdf->rect($xcol + 79, $setaut + 6.8, 63, 6, 2, 'DF', '12');
                                                             $this->objpdf->rect($xcol + 142, $setaut + 6.8, 40, 6, 2, 'DF', '12');
                                                             $this->objpdf->rect($xcol + 182, $setaut + 6.8, 20, 6, 2, 'DF', '12');
                                                             $this->objpdf->rect($xcol, $setaut + 12.8, 15, $contafornec + 1, 2, 'DF', '34');
                                                             $this->objpdf->rect($xcol + 15, $setaut + 12.8, 64, $contafornec + 1, 2, 'DF', '34');
                                                             $this->objpdf->rect($xcol + 79, $setaut + 12.8, 63, $contafornec + 1, 2, 'DF', '34');
                                                             $this->objpdf->rect($xcol + 142, $setaut + 12.8, 40, $contafornec + 1, 2, 'DF', '34');
                                                             $this->objpdf->rect($xcol + 182, $setaut + 12.8, 20, $contafornec + 1, 2, 'DF', '34');
                                                             $this->objpdf->sety($xlin + 66);
                                                             // Label das colunas
                                                             $this->objpdf->text($xcol + 4, $setaut + 11, 'CGM');
                                                             $this->objpdf->text($xcol + 30.5, $setaut + 11, 'NOME/RAZÃO SOCIAL');
                                                             $this->objpdf->text($xcol + 103, $setaut + 11, 'ENDEREÇO');
                                                             $this->objpdf->text($xcol + 155, $setaut + 11, 'MUNICÍPIO');
                                                             $this->objpdf->text($xcol + 184.5, $setaut + 11, 'TELEFONE');
                                                             // Seta altura nova para impressão dos dados
                                                             $this->objpdf->sety($setaut + 13.8);
                                                             $this->objpdf->setx($xcol);
                                                             $this->objpdf->setleftmargin(4);
                                                             $this->objpdf->Setfont('Arial', '', 7);
                                                             $this->objpdf->SetAligns(array('C', 'L', 'L', 'L', 'C'));
                                                             $this->objpdf->SetWidths(array(15, 64, 63, 40, 20));
                                                             for ($i = 0; $i < $this->linhasdosfornec; $i++) {
                                                                 db_fieldsmemory($this->recorddosfornec, $i);
                                                                 $cgmforn = trim(pg_result($this->recorddosfornec, $i, $this->cgmforn));
                                                                 $nomeforn = trim(pg_result($this->recorddosfornec, $i, $this->nomeforn));
                                                                 $enderforn = trim(pg_result($this->recorddosfornec, $i, $this->enderforn));
                                                                 $numforn = trim(pg_result($this->recorddosfornec, $i, $this->numforn));
                                                                 $municforn = trim(pg_result($this->recorddosfornec, $i, $this->municforn));
                                                                 $foneforn = trim(pg_result($this->recorddosfornec, $i, $this->foneforn));
                                                                 $this->objpdf->Row(array($cgmforn, $nomeforn, $enderforn . ", " . $numforn, $municforn, $foneforn), 4, false, 4);
                                                             }
                                                             $getdoy = $this->objpdf->gety();
                                                             $getdoy += 0.8;
                                                             $getdoy = $getdoy - $xlin;
                                                             $contafornec += 8;
                                                         } else {
                                                             $getdoy += 4.8;
                                                         }
                                                         // Caixas dos label's
                                                         $this->objpdf->rect($xcol, $xlin + $getdoy, 15, 6, 2, 'DF', '12');
                                                         $this->objpdf->rect($xcol + 15, $xlin + $getdoy, 20, 6, 2, 'DF', '12');
                                                         $this->objpdf->rect($xcol + 35, $xlin + $getdoy, 107, 6, 2, 'DF', '12');
                                                         $this->objpdf->rect($xcol + 142, $xlin + $getdoy, 30, 6, 2, 'DF', '12');
                                                         $this->objpdf->rect($xcol + 172, $xlin + $getdoy, 30, 6, 2, 'DF', '12');
                                                         // Caixa dos itens
                                                         $this->objpdf->rect($xcol, $xlin + $getdoy + 6, 15, 193 - $contafornec, 2, 'DF', '34');
                                                         // Caixa da quantidade
                                                         $this->objpdf->rect($xcol + 15, $xlin + $getdoy + 6, 20, 193 - $contafornec, 2, 'DF', '34');
                                                         // Caixa dos materiais ou serviços
                                                         $this->objpdf->rect($xcol + 35, $xlin + $getdoy + 6, 107, 193 - $contafornec, 2, 'DF', '34');
                                                         // Caixa dos valores unitários
                                                         $this->objpdf->rect($xcol + 142, $xlin + $getdoy + 6, 30, 193 - $contafornec, 2, 'DF', '');
                                                         // Caixa dos valores totais dos itens
                                                         $this->objpdf->rect($xcol + 172, $xlin + $getdoy + 6, 30, 193 - $contafornec, 2, 'DF', '34');
                                                         $this->objpdf->sety($xlin + 28);
                                                         // Label das colunas
                                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                                         $this->objpdf->text($xcol + 4, $xlin + $getdoy + 4, 'ITEM');
                                                         $this->objpdf->text($xcol + 15.5, $xlin + $getdoy + 4, 'QUANTIDADE');
                                                         $this->objpdf->text($xcol + 70, $xlin + $getdoy + 4, 'MATERIAL OU SERVIÇO');
                                                         $this->objpdf->text($xcol + 145, $xlin + $getdoy + 4, 'VALOR UNITÁRIO');
                                                         $this->objpdf->text($xcol + 176, $xlin + $getdoy + 4, 'VALOR TOTAL');
                                                         $maiscol = 0;
                                                         $this->objpdf->setleftmargin(8);
                                                         $this->objpdf->sety($xlin + $getdoy + 7);
                                                         $xtotal = 0;
                                                         $muda_pag = false;
                                                         $index = 0;
                                                         for ($ii = 0; $ii < $this->linhasdositens; $ii++) {
                                                             $this->objpdf->SetWidths(array(10, 22, 22, 95, 30, 30));
                                                             $this->objpdf->SetAligns(array('C', 'C', 'C', 'J', 'R', 'R'));
                                                             $pagina = $this->objpdf->PageNo();
                                                             db_fieldsmemory($this->recorddositens, $ii);
                                                             if ($ii != 0 && $muda_pag == false) {
                                                                 $muda_pag = false;
                                                                 $this->objpdf->ln(0.3);
                                                                 $this->objpdf->rect(4, $this->objpdf->gety(), 202, 0, 1, 'DF', '1234');
                                                                 $this->objpdf->ln(1.3);
                                                             }
                                                             $codigo = pg_result($this->recorddositens, $ii, "pc11_codigo");
                                                             $item = pg_result($this->recorddositens, $ii, $this->item);
                                                             $quantitem = pg_result($this->recorddositens, $ii, $this->quantitem);
                                                             $descricaoitem = pg_result($this->recorddositens, $ii, $this->descricaoitem);
                                                             $valoritem = db_formatar(pg_result($this->recorddositens, $ii, $this->valoritem), "f");
                                                             $valtot = pg_result($this->recorddositens, $ii, $this->svalortot);
                                                             $valimp = db_formatar($valtot, 'f');
                                                             $prazo = pg_result($this->recorddositens, $ii, $this->sprazo);
                                                             $pgto = pg_result($this->recorddositens, $ii, $this->spgto);
                                                             $resum = pg_result($this->recorddositens, $ii, $this->sresum);
                                                             $just = pg_result($this->recorddositens, $ii, $this->sjust);
                                                             $unid = pg_result($this->recorddositens, $ii, $this->sunidade);
                                                             $servico = pg_result($this->recorddositens, $ii, $this->sservico);
                                                             $quantunid = pg_result($this->recorddositens, $ii, $this->squantunid);
                                                             $susaquant = pg_result($this->recorddositens, $ii, $this->susaquant);
                                                             $scodpcmater = pg_result($this->recorddositens, $ii, $this->scodpcmater);
                                                             $xtotal += $valtot;
                                                             if (isset($descricaoitem) && (trim($descricaoitem) == "" || $descricaoitem == null) || !isset($descricaoitem)) {
                                                                 $descricaoitem = $resum;
                                                             }
                                                             if (isset($scodpcmater) && trim($scodpcmater) != "") {
                                                                 $scodpcmater = trim($scodpcmater) . " - ";
                                                             }
                                                             if (isset($prazo) && trim($prazo) != "") {
                                                                 $prazo = "\nPRAZO: " . trim($prazo);
                                                             }
                                                             if (isset($pgto) && trim($pgto) != "") {
                                                                 $pgto = "\nCONDIÇÃO: " . trim($pgto);
                                                             }
                                                             if (isset($resum) && trim($resum) != "") {
                                                                 $resum = "\nRESUMO: " . trim($resum);
                                                             }
                                                             if (isset($just) && trim($just) != "") {
                                                                 $just = "\nJUSTIFICATIVA: " . trim($just);
                                                             }
                                                             $barran = "";
                                                             if (strlen($scodpcmater . $descricaoitem) > 53) {
                                                                 $barran = "\n";
                                                             }
                                                             if (isset($servico) && (trim($servico) == "f" || trim($servico) == "") || !isset($servico)) {
                                                                 $unid = $barran . "\n" . trim($unid);
                                                                 if ($susaquant == "t") {
                                                                     $unid .= " ({$quantunid} UNIDADES)\n";
                                                                 }
                                                             } else {
                                                                 $unid = $barran . "\nSERVIÇO";
                                                             }
                                                             $descricaoitem .= " - " . $unid;
                                                             $distanciar = 0;
                                                             if (isset($prazo) && trim($prazo) == "" && (isset($pgto) && trim($pgto) == "") && (isset($resum) && trim($resum) == "") && (isset($just) && trim($just) == "")) {
                                                                 $distanciar = 4;
                                                             }
                                                             $this->objpdf->Setfont('Arial', 'B', 9);
                                                             $this->objpdf->Row(array($item, $quantitem, $scodpcmater . $descricaoitem, $valoritem, $valimp), 3, false, $distanciar);
                                                             $dist = 2.7;
                                                             $x = $this->muda_pag($pagina, $xlin, $xcol, "false", $contapagina);
                                                             if (isset($unid) && $unid != "") {
                                                                 $this->objpdf->Row(array('', '', $unid, '', ''), 3, false, $dist);
                                                                 $x = $this->muda_pag($pagina, $xlin, $xcol, "false", $contapagina);
                                                             }
                                                             $this->objpdf->Setfont('Arial', '', 7);
                                                             if (isset($prazo) && $prazo != "") {
                                                                 $this->objpdf->Row(array('', '', $prazo, '', ''), 3, false, $dist);
                                                                 $x = $this->muda_pag($pagina, $xlin, $xcol, "false", $contapagina);
                                                             }
                                                             if (isset($pgto) && $pgto != "") {
                                                                 $this->objpdf->Row(array('', '', $pgto, '', ''), 3, false, $dist);
                                                                 $x = $this->muda_pag($pagina, $xlin, $xcol, "false", $contapagina);
                                                             }
                                                             if (isset($resum) && $resum != "") {
                                                                 $this->objpdf->Row(array('', '', $resum, '', ''), 3, false, $dist);
                                                                 $x = $this->muda_pag($pagina, $xlin, $xcol, "false", $contapagina);
                                                             }
                                                             if (isset($just) && $just != "") {
                                                                 $this->objpdf->Row(array('', '', $just, '', ''), 3, false, $dist);
                                                                 $x = $this->muda_pag($pagina, $xlin, $xcol, "false", $contapagina);
                                                             }
                                                             $this->objpdf->SetWidths(array(10, 22, 26, 26, 26, 26, '1', 30, 30));
                                                             $pass = false;
                                                             $arr_dotac = array();
                                                             for ($i = 0; $i < $this->linhasdasdotac; $i++) {
                                                                 db_fieldsmemory($this->recorddasdotac, $i);
                                                                 if (pg_result($this->recorddasdotac, $i, $this->dcodigo) == $codigo && !in_array(pg_result($this->recorddasdotac, $i, $this->dcoddot), $arr_dotac)) {
                                                                     if ($pass == false) {
                                                                         $pass = true;
                                                                         $this->objpdf->Setfont('Arial', 'B', 7);
                                                                         $distc = 3.5;
                                                                         $distb = 3;
                                                                         $this->objpdf->SetAligns(array('C', 'C', 'C', 'C', 'C', 'C', 'C', 'R', 'R'));
                                                                         $this->objpdf->Row(array('', '', "\n", '', ''), 3, false, $dist);
                                                                         $this->objpdf->Row(array('', '', "DOTAÇÃO", "ANO", "ELEMENTO", "RESERVADO", '', ''), 3, false, $dist);
                                                                     }
                                                                     $this->objpdf->Setfont('Arial', '', 7);
                                                                     $this->objpdf->SetAligns(array('C', 'C', 'C', 'C', 'C', 'C', 'C', 'R', 'R'));
                                                                     $dquant = pg_result($this->recorddasdotac, $i, $this->dquant);
                                                                     $danousu = pg_result($this->recorddasdotac, $i, $this->danousu);
                                                                     $dcoddot = pg_result($this->recorddasdotac, $i, $this->dcoddot);
                                                                     $dvalor = pg_result($this->recorddasdotac, $i, $this->dvalor);
                                                                     $delemento = pg_result($this->recorddasdotac, $i, $this->delemento);
                                                                     //	      $dreserva = pg_result($this->recorddasdotac,$i,$this->dreserva);
                                                                     array_push($arr_dotac, $dcoddot);
                                                                     if (isset($dcoddot) && trim($dcoddot) != "") {
                                                                         $result_orcreservasol = $clorcreservasol->sql_record($clorcreservasol->sql_query_orcreserva(null, null, "o82_codres as codigodareserva", "", "o82_solicitem={$codigo} and o80_coddot={$dcoddot}"));
                                                                         $ddvalor = "NÃO";
                                                                         if ($clorcreservasol->numrows > 0) {
                                                                             $ddvalor = "SIM";
                                                                         }
                                                                         $x = $this->muda_pag($pagina, $xlin, $xcol, "false", $contapagina);
                                                                         $this->objpdf->Row(array('', $dquant, $dcoddot, $danousu, $delemento, $ddvalor, '', db_formatar($dvalor / $dquant, "f"), db_formatar($dvalor, "f")), $distc, false, $distb);
                                                                     }
                                                                 } else {
                                                                     $pass = false;
                                                                 }
                                                             }
                                                         }
                                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                                         $maislin = 248;
                                                         if ($contapagina == 1) {
                                                             $maislin = 211;
                                                         }
                                                         $this->objpdf->text(180, $xlin + $maislin + 20, db_formatar($xtotal, 'f'));
                                                         if ($contapagina == 1) {
                                                             $this->objpdf->rect($xcol, $xlin + 224.7, 142, 10.8, 2, 'DF', '34');
                                                             $this->objpdf->rect($xcol + 142, $xlin + 224.7, 30, 10.8, 2, 'DF', '34');
                                                             $this->objpdf->rect($xcol + 172, $xlin + 224.7, 30, 10.8, 2, 'DF', '34');
                                                             $this->objpdf->text($xcol + 120, $xlin + 230.7, 'T O T A L');
                                                             $this->objpdf->rect($xcol, $xlin + 237, 66, 35, 2, 'DF', '1234');
                                                             $this->objpdf->rect($xcol + 68, $xlin + 237, 66, 35, 2, 'DF', '1234');
                                                             $this->objpdf->rect($xcol + 136, $xlin + 237, 66, 35, 2, 'DF', '1234');
                                                             $this->objpdf->setfillcolor(0, 0, 0);
                                                             $this->objpdf->setfillcolor(0, 0, 0);
                                                             $this->objpdf->text($xcol + 5, $xlin + 244, strtoupper($this->municpref) . ', ' . substr($this->emissao, 8, 2) . ' DE ' . strtoupper(db_mes(substr($this->emissao, 5, 2))) . ' DE ' . substr($this->emissao, 0, 4) . '.');
                                                             $this->objpdf->text($xcol + 20, $xlin + 256, "AUTORIZO", 0, 4);
                                                             $this->objpdf->text($xcol + 5, $xlin + 268, substr($this->Sorgao, 0, 35));
                                                             $this->objpdf->setfillcolor(0, 0, 0);
                                                             $this->objpdf->text($xcol + 93, $xlin + 256, "AUTORIZO", 0, 4);
                                                             if (strtoupper(trim($this->municpref)) != 'GUAIBA') {
                                                                 $this->objpdf->text($xcol + 83, $xlin + 268, 'DIV. DE ABASTECIMENTO', 0, 40);
                                                             }
                                                             $this->objpdf->setfillcolor(0, 0, 0);
                                                             $this->objpdf->text($xcol + 150, $xlin + 256, "ORDENADOR DA DESPESA", 0, 4);
                                                         } else {
                                                             $this->objpdf->rect($xcol, $xlin + 262, 142, 10, 2, 'DF', '34');
                                                             $this->objpdf->rect($xcol + 142, $xlin + 262, 30, 10, 2, 'DF', '34');
                                                             $this->objpdf->rect($xcol + 172, $xlin + 262, 30, 10, 2, 'DF', '34');
                                                             $this->objpdf->text($xcol + 120, $xlin + 268, 'T O T A L');
                                                         }
                                                     } else {
                                                         if ($this->modelo == 12) {
                                                             ////////// MODELO 12  -  ANULAÇÃO DE EMPENHO
                                                             $this->objpdf->AliasNbPages();
                                                             $this->objpdf->AddPage();
                                                             $this->objpdf->settopmargin(1);
                                                             $pagina = 1;
                                                             $xlin = 20;
                                                             $xcol = 4;
                                                             $this->objpdf->setfillcolor(245);
                                                             $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                                             $this->objpdf->setfillcolor(255, 255, 255);
                                                             $this->objpdf->Setfont('Arial', 'B', 10);
                                                             $this->objpdf->text(126, $xlin - 13, 'NOTA DE ANULAÇÃO N' . CHR(176) . ': ');
                                                             $this->objpdf->text(175, $xlin - 13, db_formatar($this->notaanulacao, 's', '0', 6, 'e'));
                                                             $this->objpdf->text(134, $xlin - 8, 'DATA DE EMISSÃO : ');
                                                             $this->objpdf->text(175, $xlin - 8, $this->emissao);
                                                             $this->objpdf->text(134, $xlin - 3, '        EMPENHO : ');
                                                             $this->objpdf->text(175, $xlin - 3, trim($this->codemp) . "/" . $this->anousu);
                                                             $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                                             //.$this->logo
                                                             $this->objpdf->Setfont('Arial', 'B', 9);
                                                             $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                                             $this->objpdf->Setfont('Arial', '', 9);
                                                             $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                                             $this->objpdf->text(40, $xlin - 8, $this->municpref);
                                                             $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                                                             $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                                                             /// retangulo dos dados da dotação
                                                             $this->objpdf->rect($xcol, $xlin + 2, $xcol + 100, 50, 2, 'DF', '1234');
                                                             $this->objpdf->Setfont('Arial', 'B', 8);
                                                             $this->objpdf->text($xcol + 2, $xlin + 7, 'Órgao');
                                                             $this->objpdf->text($xcol + 2, $xlin + 11, 'Unidade');
                                                             $this->objpdf->text($xcol + 2, $xlin + 15, 'Função');
                                                             $this->objpdf->text($xcol + 2, $xlin + 22, 'Proj/Ativ');
                                                             $this->objpdf->text($xcol + 2, $xlin + 30, 'Rubrica');
                                                             $this->objpdf->text($xcol + 2, $xlin + 42, 'Recurso');
                                                             $this->objpdf->text($xcol + 2, $xlin + 48, 'Licitação');
                                                             $this->objpdf->Setfont('Arial', '', 8);
                                                             $this->objpdf->text($xcol + 17, $xlin + 7, ':  ' . db_formatar($this->orgao, 'orgao') . ' - ' . $this->descr_orgao);
                                                             $this->objpdf->text($xcol + 17, $xlin + 11, ':  ' . db_formatar($this->unidade, 'unidade') . ' - ' . $this->descr_unidade);
                                                             $this->objpdf->text($xcol + 17, $xlin + 15, ':  ' . db_formatar($this->funcao, 'funcao') . ' - ' . $this->descr_funcao);
                                                             $this->objpdf->text($xcol + 17, $xlin + 22, ':  ' . db_formatar($this->projativ, 'projativ') . ' - ' . $this->descr_projativ);
                                                             $this->objpdf->text($xcol + 17, $xlin + 30, ':  ' . db_formatar($this->sintetico, 'elemento'));
                                                             $this->objpdf->setxy($xcol + 18, $xlin + 31);
                                                             $this->objpdf->multicell(90, 3, $this->descr_sintetico, 0, "L");
                                                             $this->objpdf->text($xcol + 17, $xlin + 42, ':  ' . $this->recurso . ' - ' . $this->descr_recurso);
                                                             $this->objpdf->text($xcol + 17, $xlin + 48, ':  ' . $this->descr_licitacao);
                                                             //// retangulo dos dados do credor
                                                             $this->objpdf->rect($xcol + 106, $xlin + 2, 96, 18, 2, 'DF', '1234');
                                                             $this->objpdf->Setfont('Arial', '', 6);
                                                             $this->objpdf->text($xcol + 108, $xlin + 4, 'Dados do Credor:');
                                                             $this->objpdf->Setfont('Arial', 'B', 8);
                                                             $this->objpdf->text($xcol + 107, $xlin + 7, 'Numcgm');
                                                             $this->objpdf->text($xcol + 107, $xlin + 11, 'Nome');
                                                             $this->objpdf->text($xcol + 107, $xlin + 15, 'Endereço');
                                                             $this->objpdf->text($xcol + 107, $xlin + 19, 'Município');
                                                             $this->objpdf->Setfont('Arial', '', 8);
                                                             $this->objpdf->text($xcol + 124, $xlin + 7, ': ' . $this->numcgm);
                                                             $this->objpdf->text($xcol + 124, $xlin + 11, ': ' . $this->nome);
                                                             $this->objpdf->text($xcol + 124, $xlin + 15, ': ' . $this->ender . '  ' . $this->compl);
                                                             $this->objpdf->text($xcol + 124, $xlin + 19, ': ' . $this->munic . '-' . $this->uf . '    CEP : ' . $this->cep);
                                                             ///// retangulo dos valores
                                                             $this->objpdf->rect($xcol + 106, $xlin + 21.5, 47, 9, 2, 'DF', '1234');
                                                             $this->objpdf->rect($xcol + 155, $xlin + 21.5, 47, 9, 2, 'DF', '1234');
                                                             $this->objpdf->rect($xcol + 106, $xlin + 32.0, 47, 9, 2, 'DF', '1234');
                                                             $this->objpdf->rect($xcol + 155, $xlin + 32.0, 47, 9, 2, 'DF', '1234');
                                                             $this->objpdf->rect($xcol + 106, $xlin + 42.5, 47, 9, 2, 'DF', '1234');
                                                             $this->objpdf->rect($xcol + 155, $xlin + 42.5, 47, 9, 2, 'DF', '1234');
                                                             $this->objpdf->Setfont('Arial', '', 6);
                                                             $this->objpdf->text($xcol + 157, $xlin + 23.5, 'Valor Empenhado');
                                                             $this->objpdf->text($xcol + 108, $xlin + 34.0, 'Valor Orçado');
                                                             $this->objpdf->text($xcol + 157, $xlin + 34.0, 'Saldo Anterior');
                                                             $this->objpdf->text($xcol + 108, $xlin + 44.5, 'Valor Anulado');
                                                             $this->objpdf->text($xcol + 157, $xlin + 44.5, 'Saldo Atual');
                                                             $this->objpdf->Setfont('Arial', '', 8);
                                                             $this->objpdf->text($xcol + 108, $xlin + 27, 'SEQ. EMP. N' . chr(176) . ' ' . db_formatar($this->numemp, 's', '0', 6, 'e'));
                                                             //	$this->objpdf->text($xcol+108,$xlin+26.5,$this->texto);
                                                             $this->objpdf->text($xcol + 180, $xlin + 27.5, db_formatar($this->empenhado, 'f'));
                                                             $this->objpdf->text($xcol + 130, $xlin + 38.0, db_formatar($this->orcado, 'f'));
                                                             $this->objpdf->text($xcol + 180, $xlin + 38.0, db_formatar($this->saldo_ant, 'f'));
                                                             $this->objpdf->text($xcol + 130, $xlin + 47.5, db_formatar($this->anulado, 'f'));
                                                             $this->objpdf->text($xcol + 180, $xlin + 47.5, db_formatar($this->saldo_ant + $this->anulado, 'f'));
                                                             /// retangulo do corpo do empenho
                                                             $this->objpdf->rect($xcol, $xlin + 60, 15, 130, 2, 'DF', '');
                                                             $this->objpdf->rect($xcol + 15, $xlin + 60, 137, 130, 2, 'DF', '');
                                                             $this->objpdf->rect($xcol + 152, $xlin + 60, 25, 163, 2, 'DF', '');
                                                             $this->objpdf->rect($xcol + 177, $xlin + 60, 25, 163, 2, 'DF', '');
                                                             $this->objpdf->rect($xcol, $xlin + 190, 152, 33, 2, 'DF', '');
                                                             //// retangulos do titulo do corpo do empenho
                                                             $this->objpdf->Setfont('Arial', 'B', 7);
                                                             $this->objpdf->rect($xcol, $xlin + 54, 15, 6, 2, 'DF', '12');
                                                             $this->objpdf->rect($xcol + 15, $xlin + 54, 137, 6, 2, 'DF', '12');
                                                             $this->objpdf->rect($xcol + 152, $xlin + 54, 25, 6, 2, 'DF', '12');
                                                             $this->objpdf->rect($xcol + 177, $xlin + 54, 25, 6, 2, 'DF', '12');
                                                             //// título do corpo do empenho
                                                             $this->objpdf->text($xcol + 2, $xlin + 58, 'QUANT');
                                                             $this->objpdf->text($xcol + 70, $xlin + 58, 'MATERIAL OU SERVIÇO');
                                                             $this->objpdf->text($xcol + 154, $xlin + 58, 'VALOR UNITÁRIO');
                                                             $this->objpdf->text($xcol + 181, $xlin + 58, 'VALOR TOTAL');
                                                             $maiscol = 0;
                                                             /// monta os dados para itens do empenho
                                                             $this->objpdf->SetWidths(array(15, 137, 25, 25));
                                                             $this->objpdf->SetAligns(array('C', 'L', 'R', 'R'));
                                                             $this->objpdf->setleftmargin(4);
                                                             $this->objpdf->sety($xlin + 62);
                                                             $this->objpdf->Setfont('Arial', '', 7);
                                                             $ele = 0;
                                                             $xtotal = 0;
                                                             for ($ii = 0; $ii < $this->linhasdositens; $ii++) {
                                                                 db_fieldsmemory($this->recorddositens, $ii);
                                                                 $this->objpdf->Setfont('Arial', 'B', 7);
                                                                 $this->objpdf->Row(array('', db_formatar(pg_result($this->recorddositens, $ii, $this->analitico), 'elemento') . ' - ' . pg_result($this->recorddositens, $ii, $this->descr_analitico), '', db_formatar(pg_result($this->recorddositens, $ii, $this->valoritem), 'f')), 3, false, 4);
                                                                 $xtotal += pg_result($this->recorddositens, $ii, $this->valoritem);
                                                                 /////// troca de pagina
                                                             }
                                                             if ($pagina == 1) {
                                                                 $this->objpdf->rect($xcol, $xlin + 223, 152, 6, 2, 'DF', '34');
                                                                 $this->objpdf->rect($xcol + 152, $xlin + 223, 25, 6, 2, 'DF', '34');
                                                                 $this->objpdf->rect($xcol + 177, $xlin + 223, 25, 6, 2, 'DF', '34');
                                                                 //           $this->objpdf->rect($xcol,$xlin+197,60,47,2,'DF','34');
                                                                 //           $this->objpdf->rect($xcol+60,$xlin+197,60,47,2,'DF','34');
                                                                 //           $this->objpdf->rect($xcol+120,$xlin+197,82,47,2,'DF','34');
                                                                 //           $this->objpdf->rect($xcol+120,$xlin+216,32,28,2,'DF','4');
                                                                 //	   $this->objpdf->setfillcolor(0,0,0);
                                                                 $this->objpdf->SetFont('Arial', '', 7);
                                                                 $this->objpdf->text($xcol + 2, $xlin + 227, 'DESTINO : ', 0, 1, 'L', 0);
                                                                 $this->objpdf->text($xcol + 30, $xlin + 227, $this->destino, 0, 1, 'L', 0);
                                                                 $this->objpdf->setxy($xcol + 1, $xlin + 195);
                                                                 $this->objpdf->text($xcol + 2, $xlin + 194, 'MOTIVO : ', 0, 1, 'L', 0);
                                                                 $this->objpdf->multicell(147, 3.5, $this->resumo);
                                                                 $this->objpdf->text($xcol + 159, $xlin + 227, 'T O T A L', 0, 1, 'L', 0);
                                                                 $this->objpdf->setxy($xcol + 185, $xlin + 222);
                                                                 $this->objpdf->cell(30, 10, db_formatar($this->empenhado - $xtotal, 'f'), 0, 0, 'f');
                                                                 /*
                                                                            $this->objpdf->rect($xcol,$xlin+191,60,6,2,'DF','12');
                                                                            $this->objpdf->rect($xcol+60,$xlin+191,60,6,2,'DF','12');
                                                                            $this->objpdf->rect($xcol+120,$xlin+191,82,6,2,'DF','12');
                                                                 	   $this->objpdf->text($xcol+15,$xlin+195,'CONTADORIA GERAL');
                                                                 	   $this->objpdf->text($xcol+82,$xlin+195,'PAGUE-SE');
                                                                 	   $this->objpdf->text($xcol+150,$xlin+195,'TESOURARIA');
                                                                 	   
                                                                 	   $this->objpdf->line($xcol+5,$xlin+211,$xcol+54,$xlin+211);
                                                                 	   $this->objpdf->line($xcol+5,$xlin+225,$xcol+54,$xlin+225);
                                                                 	   $this->objpdf->line($xcol+5,$xlin+238,$xcol+54,$xlin+238);
                                                                 	   
                                                                 	   $this->objpdf->line($xcol+65,$xlin+225,$xcol+114,$xlin+225);
                                                                 	   
                                                                 	   $this->objpdf->SetFont('Arial','',6);
                                                                 	   $this->objpdf->text($xcol+12,$xlin+199,'EMPENHADO E CONFERIDO');
                                                                 	   $this->objpdf->text($xcol+26,$xlin+213,'VISTO');
                                                                 	   $this->objpdf->text($xcol+19,$xlin+227,'TÉCNICO CONTÁBIL');
                                                                 	   $this->objpdf->text($xcol+13,$xlin+240,'SECRETÁRIO(A) DA FAZENDA');
                                                                 	   
                                                                 	   $this->objpdf->text($xcol+66,$xlin+212,'DATA  ____________/____________/____________');
                                                                 	   $this->objpdf->text($xcol+76,$xlin+227,'PREFEITO MUNICIPAL');
                                                                 	  
                                                                 	   $this->objpdf->text($xcol+122,$xlin+207,'CHEQUE N'.chr(176));
                                                                 	   $this->objpdf->text($xcol+170,$xlin+207,'DATA');
                                                                 	   $this->objpdf->text($xcol+122,$xlin+215,'BANCO N'.chr(176));
                                                                 	   $this->objpdf->text($xcol+127,$xlin+218,'DOCUMENTO N'.chr(176));
                                                                 	   $this->objpdf->line($xcol+155,$xlin+240,$xcol+200,$xlin+240);
                                                                 	   $this->objpdf->text($xcol+170,$xlin+242,'TESOUREIRO');
                                                                 	  
                                                                            $this->objpdf->rect($xcol,$xlin+246,202,26,2,'DF','1234');
                                                                 	   
                                                                 	   $this->objpdf->SetFont('Arial','',7);
                                                                 	   $this->objpdf->text($xcol+90,$xlin+249,'R E C I B O');
                                                                 	   $this->objpdf->text($xcol+45,$xlin+253,'RECEBI(EMOS) DO MUNICÍPIO DE '.$this->municpref.', A IMPORTÂNCIA ABAIXO ESPECIFICADA, REFERENTE À:');
                                                                 	   $this->objpdf->text($xcol+2,$xlin+257,'(     ) PARTE DO VALOR EMPENHADO');
                                                                 	   $this->objpdf->text($xcol+102,$xlin+257,'(     ) SALDO/TOTAL EMPENHADO');
                                                                 	   $this->objpdf->text($xcol+2,$xlin+261,'R$');
                                                                 	   $this->objpdf->text($xcol+102,$xlin+261,'R$');
                                                                 	   $this->objpdf->text($xcol+2,$xlin+265,'EM ________/________/________',0,0,'C',0);
                                                                 	   $this->objpdf->text($xcol+42,$xlin+265,'_________________________________________',0,0,'C',0);
                                                                 	   $this->objpdf->text($xcol+102,$xlin+265,'EM ________/________/________',0,0,'C',0);
                                                                 	   $this->objpdf->text($xcol+142,$xlin+265,'_________________________________________',0,1,'C',0);
                                                                 	   $this->objpdf->SetFont('Arial','',6);
                                                                 	   $this->objpdf->text($xcol+62,$xlin+269,'CREDOR',0,0,'C',0);
                                                                 	   $this->objpdf->text($xcol+162,$xlin+269,'CREDOR',0,1,'C',0);
                                                                 	   
                                                                 	   $this->objpdf->SetFont('Arial','',4);
                                                                            $this->objpdf->Text(2,296,$this->texto); // texto no canhoto do carne
                                                                 	   $this->objpdf->setfont('Arial','',11);
                                                                 */
                                                                 $xlin = 169;
                                                             }
                                                         } else {
                                                             if ($this->modelo == 13) {
                                                                 ////////// MODELO 13  -  SOLICITAÇÃO DE ORÇAMENTO
                                                                 $this->objpdf->AliasNbPages();
                                                                 $this->objpdf->AddPage();
                                                                 $this->objpdf->settopmargin(1);
                                                                 $pagina = 1;
                                                                 $xlin = 20;
                                                                 $xcol = 4;
                                                                 $this->objpdf->setfillcolor(245);
                                                                 $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                                                 $this->objpdf->setfillcolor(255, 255, 255);
                                                                 $this->objpdf->Setfont('Arial', 'B', 9);
                                                                 $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                                                 //.$this->logo
                                                                 $this->objpdf->text(130, $xlin - 13, "ORÇAMENTO N" . CHR(176));
                                                                 $this->objpdf->text(185, $xlin - 13, db_formatar($this->orccodigo, 's', '0', 6, 'e'));
                                                                 $this->objpdf->text(130, $xlin - 9, $this->labdados . CHR(176));
                                                                 $this->objpdf->text(185, $xlin - 9, db_formatar($this->Snumero, 's', '0', 6, 'e'));
                                                                 $this->objpdf->Setfont('Arial', 'B', 9);
                                                                 $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                                                 $this->objpdf->Setfont('Arial', '', 7);
                                                                 $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                                                 $this->objpdf->text(40, $xlin - 8, $this->municpref);
                                                                 $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                                                                 $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                                                                 $this->objpdf->text(40, $xlin + 1, db_formatar($this->cgcpref, 'cnpj'));
                                                                 // Caixa com dados do orçamento e solicitação
                                                                 $this->objpdf->rect($xcol, $xlin + 3, $xcol + 198, 27, 2, 'DF', '1234');
                                                                 $this->objpdf->Setfont('Arial', '', 6);
                                                                 $this->objpdf->text($xcol + 2, $xlin + 5, 'Dados do Orçamento/' . $this->labtitulo);
                                                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                                                 $this->objpdf->text($xcol + 2, $xlin + 8, 'Orçamento');
                                                                 $this->objpdf->text($xcol + 109, $xlin + 8, 'Data Limite');
                                                                 $this->objpdf->text($xcol + 150, $xlin + 8, 'Hora Limite');
                                                                 $this->objpdf->text($xcol + 2, $xlin + 13, $this->labtitulo);
                                                                 $this->objpdf->text($xcol + 2, $xlin + 21, 'Departamento');
                                                                 $this->objpdf->text($xcol + 109, $xlin + 17, $this->labtipo);
                                                                 $this->objpdf->text($xcol + 2, $xlin + 17, 'Data');
                                                                 $this->objpdf->text($xcol + 2, $xlin + 25, 'Resumo');
                                                                 $this->objpdf->Setfont('Arial', '', 8);
                                                                 // Imprime dados do orçamento e solicitação
                                                                 $this->objpdf->text($xcol + 23, $xlin + 8, ':  ' . $this->orccodigo);
                                                                 $this->objpdf->text($xcol + 125, $xlin + 8, ':  ' . $this->orcdtlim);
                                                                 $this->objpdf->text($xcol + 166, $xlin + 8, ':  ' . $this->orchrlim);
                                                                 $this->objpdf->text($xcol + 23, $xlin + 13, ':  ' . $this->Snumero);
                                                                 $this->objpdf->text($xcol + 23, $xlin + 21, ':  ' . $this->Sdepart);
                                                                 if (isset($this->Sdata) && trim($this->Sdata) != "") {
                                                                     $this->Sdata = db_formatar($this->Sdata, 'd');
                                                                 }
                                                                 if (trim($this->labtipo) != "") {
                                                                     $this->objpdf->text($xcol + 125, $xlin + 17, ':  ' . $this->Stipcom);
                                                                 }
                                                                 $this->objpdf->text($xcol + 23, $xlin + 17, ':  ' . $this->Sdata);
                                                                 $this->objpdf->setxy($xcol + 22, $xlin + 22);
                                                                 $this->objpdf->cell(3, 4, ':  ', 0, 0, "L", 0);
                                                                 $this->objpdf->setxy($xcol + 24.5, $xlin + 22);
                                                                 $Sresumo = $this->Sresumo;
                                                                 $Sresumo = str_replace("\n", ". ", $Sresumo);
                                                                 $Sresumo = str_replace("\r", "", $Sresumo);
                                                                 $this->objpdf->multicell(175, 4, $Sresumo, 0, "J");
                                                                 // Caixa com dados dos fornecedores
                                                                 $this->objpdf->rect($xcol, $xlin + 32, $xcol + 198, 16, 2, 'DF', '1234');
                                                                 $this->objpdf->Setfont('Arial', '', 6);
                                                                 $this->objpdf->text($xcol + 2, $xlin + 34, 'Dados do Fornecedor');
                                                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                                                 $this->objpdf->text($xcol + 109, $xlin + 38, 'Numcgm');
                                                                 $this->objpdf->text($xcol + 150, $xlin + 38, strlen($this->cnpj) == 11 ? 'CPF' : 'CNPJ');
                                                                 $this->objpdf->text($xcol + 2, $xlin + 38, 'Nome');
                                                                 $this->objpdf->text($xcol + 2, $xlin + 42, 'Endereço');
                                                                 $this->objpdf->text($xcol + 102, $xlin + 42, 'Complemento');
                                                                 $this->objpdf->text($xcol + 2, $xlin + 46, 'Município');
                                                                 $this->objpdf->text($xcol + 115, $xlin + 46, 'CEP');
                                                                 $this->objpdf->text($xcol + 150, $xlin + 46, 'Telefone');
                                                                 $this->objpdf->Setfont('Arial', '', 8);
                                                                 // Imprime dados dos fornecedores
                                                                 $this->objpdf->text($xcol + 18, $xlin + 38, ':  ' . $this->nome);
                                                                 $this->objpdf->text($xcol + 122, $xlin + 38, ':  ' . $this->numcgm);
                                                                 $this->objpdf->text($xcol + 163, $xlin + 38, ':  ' . (strlen($this->cnpj) == 11 ? db_formatar($this->cnpj, 'cpf') : db_formatar($this->cnpj, 'cnpj')));
                                                                 $this->objpdf->text($xcol + 18, $xlin + 42, ':  ' . $this->ender);
                                                                 $this->objpdf->text($xcol + 122, $xlin + 42, ':  ' . $this->compl);
                                                                 $this->objpdf->text($xcol + 18, $xlin + 46, ':  ' . $this->munic . '-' . $this->uf);
                                                                 $this->objpdf->text($xcol + 122, $xlin + 46, ':  ' . $this->cep);
                                                                 $this->objpdf->text($xcol + 163, $xlin + 46, ':  ' . $this->telefone);
                                                                 $getdoy = 50;
                                                                 $contadepart = 0;
                                                                 $alturaini = 216;
                                                                 if ($this->linhasdosdepart > 0) {
                                                                     for ($i = 0; $i < $this->linhasdosdepart; $i++) {
                                                                         $contadepart += 4;
                                                                     }
                                                                     $setaut = $xlin + $getdoy;
                                                                     $alturaini -= $contadepart + 15;
                                                                     $this->objpdf->Setfont('Arial', 'B', 8);
                                                                     // Caixa de texto para labels
                                                                     $this->objpdf->rect($xcol, $setaut, 202, 6, 2, 'DF', '12');
                                                                     $this->objpdf->text($xcol + 4, $setaut + 4, 'DEPARTAMENTOS DAS SOLICITAÇÕES');
                                                                     $this->objpdf->rect($xcol, $setaut + 6, 30, 6, 2, 'DF', '12');
                                                                     $this->objpdf->rect($xcol + 30, $setaut + 6, 30, 6, 2, 'DF', '12');
                                                                     $this->objpdf->rect($xcol + 60, $setaut + 6, 142, 6, 2, 'DF', '12');
                                                                     $this->objpdf->rect($xcol, $setaut + 12, 30, $contadepart + 1, 2, 'DF', '34');
                                                                     $this->objpdf->rect($xcol + 30, $setaut + 12, 30, $contadepart + 1, 2, 'DF', '34');
                                                                     $this->objpdf->rect($xcol + 60, $setaut + 12, 142, $contadepart + 1, 2, 'DF', '34');
                                                                     $this->objpdf->sety($xlin + 66);
                                                                     // Label das colunas
                                                                     $this->objpdf->text($xcol + 6, $setaut + 11, 'SOLICITAÇÃO');
                                                                     $this->objpdf->text($xcol + 39, $setaut + 11, 'CÓDIGO');
                                                                     $this->objpdf->text($xcol + 125, $setaut + 11, 'DESCRIÇÃO');
                                                                     // Seta altura nova para impressão dos dados
                                                                     $this->objpdf->sety($setaut + 13);
                                                                     $this->objpdf->setx($xcol);
                                                                     $this->objpdf->setleftmargin(4);
                                                                     $this->objpdf->Setfont('Arial', '', 7);
                                                                     $this->objpdf->SetAligns(array('C', 'C', 'L'));
                                                                     $this->objpdf->SetWidths(array(30, 30, 142));
                                                                     for ($i = 0; $i < $this->linhasdosdepart; $i++) {
                                                                         db_fieldsmemory($this->recorddosdepart, $i);
                                                                         $solicita = trim(pg_result($this->recorddosdepart, $i, $this->Snumdepart));
                                                                         $codigodep = trim(pg_result($this->recorddosdepart, $i, $this->Scoddepto));
                                                                         $descrdep = trim(pg_result($this->recorddosdepart, $i, $this->Sdescrdepto));
                                                                         $this->objpdf->Row(array($solicita, $codigodep, $descrdep), 4, false, 4);
                                                                     }
                                                                     $getdoy = $this->objpdf->gety() + 2 - $xlin;
                                                                 }
                                                                 // Caixa com Labels item, quantidade, descrição, valor
                                                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                                                 $this->objpdf->rect($xcol, $xlin + $getdoy, 14, 6, 2, 'DF', '12');
                                                                 $this->objpdf->rect($xcol + 14, $xlin + $getdoy, 12, 6, 2, 'DF', '12');
                                                                 $this->objpdf->rect($xcol + 26, $xlin + $getdoy, 22, 6, 2, 'DF', '12');
                                                                 $this->objpdf->rect($xcol + 48, $xlin + $getdoy, 98, 6, 2, 'DF', '12');
                                                                 $this->objpdf->rect($xcol + 146, $xlin + $getdoy, 28, 6, 2, 'DF', '12');
                                                                 $this->objpdf->rect($xcol + 174, $xlin + $getdoy, 28, 6, 2, 'DF', '12');
                                                                 $menos = 16.9;
                                                                 if ($this->linhasdosfornec == 0) {
                                                                     $menos = 11;
                                                                 }
                                                                 if (isset($tiramenos)) {
                                                                     $menos = $menos + $tiramenos;
                                                                     if ($menos < 0) {
                                                                         $menos = -$menos;
                                                                     }
                                                                 }
                                                                 // Caixa dos itens
                                                                 $this->objpdf->rect($xcol, $xlin + $getdoy + 6, 14, $alturaini, 2, 'DF', '34');
                                                                 // Caixa da quantidade
                                                                 $this->objpdf->rect($xcol + 14, $xlin + $getdoy + 6, 12, $alturaini, 2, 'DF', '34');
                                                                 $this->objpdf->rect($xcol + 26, $xlin + $getdoy + 6, 22, $alturaini, 2, 'DF', '34');
                                                                 // Caixa dos materiais ou serviços
                                                                 $this->objpdf->rect($xcol + 48, $xlin + $getdoy + 6, 98, $alturaini, 2, 'DF', '34');
                                                                 // Caixa dos valores unitários
                                                                 $this->objpdf->rect($xcol + 146, $xlin + $getdoy + 6, 28, $alturaini, 2, 'DF', '');
                                                                 // Caixa dos valores totais dos itens
                                                                 $this->objpdf->rect($xcol + 174, $xlin + $getdoy + 6, 28, $alturaini, 2, 'DF', '34');
                                                                 $this->objpdf->sety($xlin + 48);
                                                                 $alt = 4;
                                                                 // Label das colunas
                                                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                                                 $this->objpdf->text($xcol + 4, $xlin + $getdoy + 4, 'ITEM');
                                                                 $this->objpdf->text($xcol + 15, $xlin + $getdoy + 4, 'QUANT');
                                                                 $this->objpdf->text($xcol + 34, $xlin + $getdoy + 4, 'REF');
                                                                 $this->objpdf->text($xcol + 74, $xlin + $getdoy + 4, 'MATERIAL OU SERVIÇO');
                                                                 $this->objpdf->text($xcol + 148, $xlin + $getdoy + 4, 'VALOR UNITÁRIO');
                                                                 $this->objpdf->text($xcol + 179, $xlin + $getdoy + 4, 'VALOR TOTAL');
                                                                 $maiscol = 0;
                                                                 $this->objpdf->SetWidths(array(14, 12, 22, 95, 28, 28));
                                                                 $this->objpdf->SetAligns(array('C', 'C', 'C', 'J', 'R', 'R'));
                                                                 $this->objpdf->setleftmargin(4);
                                                                 $this->objpdf->sety($xlin + $getdoy + 7);
                                                                 $this->objpdf->setfillcolor(235);
                                                                 $xtotal = 0;
                                                                 $muda_pagina = false;
                                                                 $pag = 1;
                                                                 for ($ii = 0; $ii < $this->linhasdositens; $ii++) {
                                                                     if ($ii != 0 && $muda_pagina != true) {
                                                                         $this->objpdf->rect(4, $this->objpdf->gety(), 202, 0, 1, 'DF', '1234');
                                                                     }
                                                                     $this->objpdf->ln(2);
                                                                     db_fieldsmemory($this->recorddositens, $ii);
                                                                     $prazo = "";
                                                                     $pgto = "";
                                                                     $resumo = "";
                                                                     $descricaoitem = trim(pg_result($this->recorddositens, $ii, $this->descricaoitem));
                                                                     if (trim(pg_result($this->recorddositens, $ii, $this->sprazo)) != "") {
                                                                         $prazo = pg_result($this->recorddositens, $ii, $this->sprazo);
                                                                         $prazo = "PRAZO: " . trim($prazo);
                                                                     }
                                                                     if (trim(pg_result($this->recorddositens, $ii, $this->spgto)) != "") {
                                                                         $pgto = pg_result($this->recorddositens, $ii, $this->spgto);
                                                                         $pgto = "CONDIÇÃO: " . trim($pgto);
                                                                     }
                                                                     if (trim(pg_result($this->recorddositens, $ii, $this->sresum) != "")) {
                                                                         $resumo = "RESUMO: " . pg_result($this->recorddositens, $ii, $this->sresum);
                                                                         if ($descricaoitem == "" || $descricaoitem == null) {
                                                                             $descricaoitem = trim(pg_result($this->recorddositens, $ii, $this->sresum));
                                                                             $resumo = "";
                                                                         }
                                                                     }
                                                                     if ($muda_pagina == true) {
                                                                         $muda_pagina = false;
                                                                         $this->objpdf->sety($xlin + 12);
                                                                     }
                                                                     $unid = pg_result($this->recorddositens, $ii, $this->sunidade);
                                                                     $codunid = pg_result($this->recorddositens, $ii, $this->scodunid);
                                                                     $servico = pg_result($this->recorddositens, $ii, $this->sservico);
                                                                     $quantunid = pg_result($this->recorddositens, $ii, $this->squantunid);
                                                                     $susaquant = pg_result($this->recorddositens, $ii, $this->susaquant);
                                                                     $dist = 2.7;
                                                                     if (trim($codunid) != "") {
                                                                         $unid = trim(substr($unid, 0, 10));
                                                                         if ($susaquant == "t") {
                                                                             $unid .= " \n{$quantunid} UNIDADES\n";
                                                                             $resumo = str_replace("\n", "", $resumo);
                                                                         }
                                                                     } else {
                                                                         if ($servico == "t") {
                                                                             $unid = "SERVIÇO";
                                                                         }
                                                                     }
                                                                     $this->objpdf->Setfont('Arial', '', 8);
                                                                     $this->objpdf->Row(array(pg_result($this->recorddositens, $ii, $this->item), pg_result($this->recorddositens, $ii, $this->quantitem), $unid, $descricaoitem, '', ''), 3, false, 3);
                                                                     if (isset($resumo) && $resumo != "") {
                                                                         $this->objpdf->Row(array('', '', '', $resumo, '', ''), $dist, false, 2.7);
                                                                     }
                                                                     if (isset($prazo) && $prazo != "") {
                                                                         $this->objpdf->Row(array('', '', '', $prazo, '', ''), $dist, false, 2.7);
                                                                     }
                                                                     if (isset($pgto) && $pgto != "") {
                                                                         $this->objpdf->Row(array('', '', '', $pgto, '', ''), $dist, false, 2.7);
                                                                     }
                                                                     $this->objpdf->Setfont('Arial', 'B', 8);
                                                                     /////// troca de pagina
                                                                     if ($this->objpdf->gety() > $this->objpdf->h - 30) {
                                                                         if ($ii + 1 != $this->linhasdositens) {
                                                                             $pag++;
                                                                             $muda_pagina = true;
                                                                             $this->objpdf->Setfont('Arial', '', 7);
                                                                             if ($pag != 1) {
                                                                                 $this->objpdf->Setfont('Arial', 'B', 7);
                                                                                 $this->objpdf->rect($xcol, $xlin + 262, 146, 10, 2, 'DF', '34');
                                                                                 $this->objpdf->rect($xcol + 146, $xlin + 262, 28, 10, 2, 'DF', '34');
                                                                                 $this->objpdf->rect($xcol + 174, $xlin + 262, 28, 10, 2, 'DF', '34');
                                                                                 $this->objpdf->text($xcol + 118, $xlin + 268, 'T O T A L   P Á G I N A');
                                                                                 $this->objpdf->Setfont('Arial', '', 7);
                                                                             }
                                                                             $this->objpdf->addpage();
                                                                             $pagina += 1;
                                                                             $this->objpdf->settopmargin(1);
                                                                             $xlin = 20;
                                                                             $xcol = 4;
                                                                             $this->objpdf->setfillcolor(245);
                                                                             $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                                                             $this->objpdf->setfillcolor(255, 255, 255);
                                                                             $this->objpdf->Setfont('Arial', 'B', 9);
                                                                             $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                                                             //.$this->logo
                                                                             $this->objpdf->text(130, $xlin - 13, "ORÇAMENTO N" . CHR(176));
                                                                             $this->objpdf->text(185, $xlin - 13, db_formatar($this->orccodigo, 's', '0', 6, 'e'));
                                                                             $this->objpdf->text(130, $xlin - 9, $this->labdados . CHR(176));
                                                                             $this->objpdf->text(185, $xlin - 9, db_formatar($this->Snumero, 's', '0', 6, 'e'));
                                                                             $this->objpdf->Setfont('Arial', 'B', 9);
                                                                             $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                                                             $this->objpdf->Setfont('Arial', '', 7);
                                                                             $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                                                             $this->objpdf->text(40, $xlin - 8, $this->municpref);
                                                                             $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                                                                             $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                                                                             $this->objpdf->text(40, $xlin + 1, db_formatar($this->cgcpref, 'cnpj'));
                                                                             $xlin = -30;
                                                                             $this->objpdf->Setfont('Arial', 'B', 8);
                                                                             // Caixas dos label's
                                                                             $this->objpdf->rect($xcol, $xlin + 54, 14, 6, 2, 'DF', '12');
                                                                             $this->objpdf->rect($xcol + 14, $xlin + 54, 12, 6, 2, 'DF', '12');
                                                                             $this->objpdf->rect($xcol + 26, $xlin + 54, 22, 6, 2, 'DF', '12');
                                                                             $this->objpdf->rect($xcol + 48, $xlin + 54, 98, 6, 2, 'DF', '12');
                                                                             $this->objpdf->rect($xcol + 146, $xlin + 54, 28, 6, 2, 'DF', '12');
                                                                             $this->objpdf->rect($xcol + 174, $xlin + 54, 28, 6, 2, 'DF', '12');
                                                                             $this->objpdf->rect($xcol, $xlin + 54, 14, 268, 2, 'DF', '34');
                                                                             $this->objpdf->rect($xcol + 14, $xlin + 54, 12, 268, 2, 'DF', '34');
                                                                             $this->objpdf->rect($xcol + 26, $xlin + 54, 22, 268, 2, 'DF', '34');
                                                                             $this->objpdf->rect($xcol + 48, $xlin + 54, 98, 268, 2, 'DF', '34');
                                                                             $this->objpdf->rect($xcol + 146, $xlin + 54, 28, 268, 2, 'DF', '34');
                                                                             $this->objpdf->rect($xcol + 174, $xlin + 54, 28, 268, 2, 'DF', '34');
                                                                             $this->objpdf->sety($xlin + 66);
                                                                             $alt = 4;
                                                                             // Label das colunas
                                                                             $this->objpdf->Setfont('Arial', 'B', 8);
                                                                             $this->objpdf->text($xcol + 4, $xlin + 58, 'ITEM');
                                                                             $this->objpdf->text($xcol + 15, $xlin + 58, 'QUANT');
                                                                             $this->objpdf->text($xcol + 34, $xlin + 58, 'REF');
                                                                             $this->objpdf->text($xcol + 74, $xlin + 58, 'MATERIAL OU SERVIÇO');
                                                                             $this->objpdf->text($xcol + 148, $xlin + 58, 'VALOR UNITÁRIO');
                                                                             $this->objpdf->text($xcol + 179, $xlin + 58, 'VALOR TOTAL');
                                                                             /*
                                                                             	      $this->objpdf->text($xcol+   4,$xlin+58,'ITEM');
                                                                             	      $this->objpdf->text($xcol+15.5,$xlin+58,'QUANTIDADE');
                                                                             	      $this->objpdf->text($xcol+  70,$xlin+58,'MATERIAL OU SERVIÇO');
                                                                             	      $this->objpdf->text($xcol+ 145,$xlin+58,'VALOR UNITÁRIO');
                                                                             	      $this->objpdf->text($xcol+ 176,$xlin+58,'VALOR TOTAL');
                                                                             */
                                                                             $maiscol = 0;
                                                                             $xlin = 20;
                                                                         }
                                                                         $this->objpdf->ln(2);
                                                                         if ($ii + 1 == $this->linhasdositens) {
                                                                             $this->objpdf->rect(4, $this->objpdf->gety(), 202, 0, 1, 'DF', '1234');
                                                                         }
                                                                     }
                                                                 }
                                                                 // caixas para total
                                                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                                                 $this->objpdf->rect($xcol, $xlin + 262, 146, 10, 2, 'DF', '34');
                                                                 $this->objpdf->rect($xcol + 146, $xlin + 262, 28, 10, 2, 'DF', '34');
                                                                 $this->objpdf->rect($xcol + 174, $xlin + 262, 28, 10, 2, 'DF', '34');
                                                                 $this->objpdf->text($xcol + 113, $xlin + 268, 'T O T A L   G E R A L');
                                                                 //	echo $this->numaut."<br>";
                                                                 //	echo $pagina;exit;
                                                             } else {
                                                                 if ($this->modelo == 133) {
                                                                     ////////// MODELO 13  -  SOLICITAÇÃO DE ORÇAMENTO
                                                                     $this->objpdf->AliasNbPages();
                                                                     $this->objpdf->AddPage();
                                                                     $this->objpdf->settopmargin(1);
                                                                     $pagina = 1;
                                                                     $xlin = 20;
                                                                     $xcol = 4;
                                                                     $this->objpdf->setfillcolor(245);
                                                                     $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                                                     $this->objpdf->setfillcolor(255, 255, 255);
                                                                     $this->objpdf->Setfont('Arial', 'B', 9);
                                                                     $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                                                     //.$this->logo
                                                                     $this->objpdf->text(130, $xlin - 13, "ORÇAMENTO N" . CHR(176));
                                                                     $this->objpdf->text(185, $xlin - 13, db_formatar($this->orccodigo, 's', '0', 6, 'e'));
                                                                     $this->objpdf->text(130, $xlin - 9, $this->labdados . CHR(176));
                                                                     $this->objpdf->text(185, $xlin - 9, db_formatar($this->Snumero, 's', '0', 6, 'e'));
                                                                     $this->objpdf->Setfont('Arial', 'B', 9);
                                                                     $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                                                     $this->objpdf->Setfont('Arial', '', 7);
                                                                     $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                                                     $this->objpdf->text(40, $xlin - 8, $this->municpref);
                                                                     $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                                                                     $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                                                                     $this->objpdf->text(40, $xlin + 1, db_formatar($this->cgcpref, 'cnpj'));
                                                                     // Caixa com dados do orçamento e solicitação
                                                                     $this->objpdf->rect($xcol, $xlin + 3, $xcol + 198, 27, 2, 'DF', '1234');
                                                                     $this->objpdf->Setfont('Arial', '', 6);
                                                                     $this->objpdf->text($xcol + 2, $xlin + 5, 'Dados do Orçamento/' . $this->labtitulo);
                                                                     $this->objpdf->Setfont('Arial', 'B', 8);
                                                                     $this->objpdf->text($xcol + 2, $xlin + 8, 'Orçamento');
                                                                     $this->objpdf->text($xcol + 109, $xlin + 8, 'Data Limite');
                                                                     $this->objpdf->text($xcol + 150, $xlin + 8, 'Hora Limite');
                                                                     $this->objpdf->text($xcol + 2, $xlin + 13, $this->labtitulo);
                                                                     $this->objpdf->text($xcol + 2, $xlin + 21, 'Departamento');
                                                                     $this->objpdf->text($xcol + 109, $xlin + 17, $this->labtipo);
                                                                     $this->objpdf->text($xcol + 2, $xlin + 17, 'Data');
                                                                     $this->objpdf->text($xcol + 2, $xlin + 25, 'Resumo');
                                                                     $this->objpdf->Setfont('Arial', '', 8);
                                                                     // Imprime dados do orçamento e solicitação
                                                                     $this->objpdf->text($xcol + 23, $xlin + 8, ':  ' . $this->orccodigo);
                                                                     $this->objpdf->text($xcol + 125, $xlin + 8, ':  ' . $this->orcdtlim);
                                                                     $this->objpdf->text($xcol + 166, $xlin + 8, ':  ' . $this->orchrlim);
                                                                     $this->objpdf->text($xcol + 23, $xlin + 13, ':  ' . $this->Snumero);
                                                                     $this->objpdf->text($xcol + 23, $xlin + 21, ':  ' . $this->Sdepart);
                                                                     if (isset($this->Sdata) && trim($this->Sdata) != "") {
                                                                         $this->Sdata = db_formatar($this->Sdata, 'd');
                                                                     }
                                                                     if (trim($this->labtipo) != "") {
                                                                         $this->objpdf->text($xcol + 125, $xlin + 17, ':  ' . $this->Stipcom);
                                                                     }
                                                                     $this->objpdf->text($xcol + 23, $xlin + 17, ':  ' . $this->Sdata);
                                                                     $this->objpdf->setxy($xcol + 22, $xlin + 22);
                                                                     $this->objpdf->cell(3, 4, ':  ', 0, 0, "L", 0);
                                                                     $this->objpdf->setxy($xcol + 24.5, $xlin + 22);
                                                                     $Sresumo = $this->Sresumo;
                                                                     $Sresumo = str_replace("\n", ". ", $Sresumo);
                                                                     $Sresumo = str_replace("\r", "", $Sresumo);
                                                                     $this->objpdf->multicell(175, 4, $Sresumo, 0, "J");
                                                                     // Caixa com dados dos fornecedores
                                                                     $this->objpdf->rect($xcol, $xlin + 32, $xcol + 198, 16, 2, 'DF', '1234');
                                                                     $this->objpdf->Setfont('Arial', '', 6);
                                                                     $this->objpdf->text($xcol + 2, $xlin + 34, 'Dados do Fornecedor');
                                                                     $this->objpdf->Setfont('Arial', 'B', 8);
                                                                     $this->objpdf->text($xcol + 109, $xlin + 38, 'Numcgm');
                                                                     $this->objpdf->text($xcol + 150, $xlin + 38, strlen($this->cnpj) == 11 ? 'CPF' : 'CNPJ');
                                                                     $this->objpdf->text($xcol + 2, $xlin + 38, 'Nome');
                                                                     $this->objpdf->text($xcol + 2, $xlin + 42, 'Endereço');
                                                                     $this->objpdf->text($xcol + 102, $xlin + 42, 'Complemento');
                                                                     $this->objpdf->text($xcol + 2, $xlin + 46, 'Município');
                                                                     $this->objpdf->text($xcol + 115, $xlin + 46, 'CEP');
                                                                     $this->objpdf->text($xcol + 150, $xlin + 46, 'Telefone');
                                                                     $this->objpdf->Setfont('Arial', '', 8);
                                                                     // Imprime dados dos fornecedores
                                                                     $this->objpdf->text($xcol + 18, $xlin + 38, ':  ' . $this->nome);
                                                                     $this->objpdf->text($xcol + 122, $xlin + 38, ':  ' . $this->numcgm);
                                                                     $this->objpdf->text($xcol + 163, $xlin + 38, ':  ' . (strlen($this->cnpj) == 11 ? db_formatar($this->cnpj, 'cpf') : db_formatar($this->cnpj, 'cnpj')));
                                                                     $this->objpdf->text($xcol + 18, $xlin + 42, ':  ' . $this->ender);
                                                                     $this->objpdf->text($xcol + 122, $xlin + 42, ':  ' . $this->compl);
                                                                     $this->objpdf->text($xcol + 18, $xlin + 46, ':  ' . $this->munic . '-' . $this->uf);
                                                                     $this->objpdf->text($xcol + 122, $xlin + 46, ':  ' . $this->cep);
                                                                     $this->objpdf->text($xcol + 163, $xlin + 46, ':  ' . $this->telefone);
                                                                     $getdoy = 50;
                                                                     $contadepart = 0;
                                                                     $alturaini = 216;
                                                                     if ($this->linhasdosdepart > 0) {
                                                                         for ($i = 0; $i < $this->linhasdosdepart; $i++) {
                                                                             $contadepart += 4;
                                                                         }
                                                                         $setaut = $xlin + $getdoy;
                                                                         $alturaini -= $contadepart + 15;
                                                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                                                         // Caixa de texto para labels
                                                                         $this->objpdf->rect($xcol, $setaut, 202, 6, 2, 'DF', '12');
                                                                         $this->objpdf->text($xcol + 4, $setaut + 4, 'DEPARTAMENTOS DAS SOLICITAÇÕES');
                                                                         $this->objpdf->rect($xcol, $setaut + 6, 30, 6, 2, 'DF', '12');
                                                                         $this->objpdf->rect($xcol + 30, $setaut + 6, 30, 6, 2, 'DF', '12');
                                                                         $this->objpdf->rect($xcol + 60, $setaut + 6, 142, 6, 2, 'DF', '12');
                                                                         $this->objpdf->rect($xcol, $setaut + 12, 30, $contadepart + 1, 2, 'DF', '34');
                                                                         $this->objpdf->rect($xcol + 30, $setaut + 12, 30, $contadepart + 1, 2, 'DF', '34');
                                                                         $this->objpdf->rect($xcol + 60, $setaut + 12, 142, $contadepart + 1, 2, 'DF', '34');
                                                                         $this->objpdf->sety($xlin + 66);
                                                                         // Label das colunas
                                                                         $this->objpdf->text($xcol + 6, $setaut + 11, 'SOLICITAÇÃO');
                                                                         $this->objpdf->text($xcol + 39, $setaut + 11, 'CÓDIGO');
                                                                         $this->objpdf->text($xcol + 125, $setaut + 11, 'DESCRIÇÃO');
                                                                         // Seta altura nova para impressão dos dados
                                                                         $this->objpdf->sety($setaut + 13);
                                                                         $this->objpdf->setx($xcol);
                                                                         $this->objpdf->setleftmargin(4);
                                                                         $this->objpdf->Setfont('Arial', '', 7);
                                                                         $this->objpdf->SetAligns(array('C', 'C', 'L'));
                                                                         $this->objpdf->SetWidths(array(30, 30, 142));
                                                                         for ($i = 0; $i < $this->linhasdosdepart; $i++) {
                                                                             db_fieldsmemory($this->recorddosdepart, $i);
                                                                             $solicita = trim(pg_result($this->recorddosdepart, $i, $this->Snumdepart));
                                                                             $codigodep = trim(pg_result($this->recorddosdepart, $i, $this->Scoddepto));
                                                                             $descrdep = trim(pg_result($this->recorddosdepart, $i, $this->Sdescrdepto));
                                                                             $this->objpdf->Row(array($solicita, $codigodep, $descrdep), 4, false, 4);
                                                                         }
                                                                         $getdoy = $this->objpdf->gety() + 2 - $xlin;
                                                                     }
                                                                     // Caixa com Labels item, quantidade, descrição, valor
                                                                     $this->objpdf->Setfont('Arial', 'B', 8);
                                                                     // Caixas dos label's
                                                                     $this->objpdf->rect($xcol, $xlin + $getdoy, 10, 6, 2, 'DF', '12');
                                                                     $this->objpdf->rect($xcol + 10, $xlin + $getdoy, 12, 6, 2, 'DF', '12');
                                                                     $this->objpdf->rect($xcol + 22, $xlin + $getdoy, 22, 6, 2, 'DF', '12');
                                                                     $this->objpdf->rect($xcol + 44, $xlin + $getdoy, 98, 6, 2, 'DF', '12');
                                                                     $this->objpdf->rect($xcol + 142, $xlin + $getdoy, 30, 6, 2, 'DF', '12');
                                                                     $this->objpdf->rect($xcol + 172, $xlin + $getdoy, 30, 6, 2, 'DF', '12');
                                                                     $menos = 16.9;
                                                                     if ($this->linhasdosfornec == 0) {
                                                                         $menos = 11;
                                                                     }
                                                                     if (isset($tiramenos)) {
                                                                         $menos = $menos + $tiramenos;
                                                                         if ($menos < 0) {
                                                                             $menos = -$menos;
                                                                         }
                                                                     }
                                                                     // Caixa dos itens
                                                                     $this->objpdf->rect($xcol, $xlin + $getdoy + 6, 10, $alturaini, 2, 'DF', '34');
                                                                     // Caixa da quantidade
                                                                     $this->objpdf->rect($xcol + 10, $xlin + $getdoy + 6, 12, $alturaini, 2, 'DF', '34');
                                                                     $this->objpdf->rect($xcol + 22, $xlin + $getdoy + 6, 22, $alturaini, 2, 'DF', '34');
                                                                     // Caixa dos materiais ou serviços
                                                                     $this->objpdf->rect($xcol + 44, $xlin + $getdoy + 6, 98, $alturaini, 2, 'DF', '34');
                                                                     // Caixa dos valores unitários
                                                                     $this->objpdf->rect($xcol + 142, $xlin + $getdoy + 6, 30, $alturaini, 2, 'DF', '');
                                                                     // Caixa dos valores totais dos itens
                                                                     $this->objpdf->rect($xcol + 172, $xlin + $getdoy + 6, 30, $alturaini, 2, 'DF', '34');
                                                                     $this->objpdf->sety($xlin + 48);
                                                                     $alt = 4;
                                                                     // Label das colunas
                                                                     $this->objpdf->Setfont('Arial', 'B', 8);
                                                                     $this->objpdf->text($xcol + 2, $xlin + $getdoy + 4, 'ITEM');
                                                                     $this->objpdf->text($xcol + 11, $xlin + $getdoy + 4, 'QUANT');
                                                                     $this->objpdf->text($xcol + 30, $xlin + $getdoy + 4, 'REF');
                                                                     $this->objpdf->text($xcol + 70, $xlin + $getdoy + 4, 'MATERIAL OU SERVIÇO');
                                                                     $this->objpdf->text($xcol + 145, $xlin + $getdoy + 4, 'VALOR UNITÁRIO');
                                                                     $this->objpdf->text($xcol + 176, $xlin + $getdoy + 4, 'VALOR TOTAL');
                                                                     $maiscol = 0;
                                                                     $this->objpdf->SetWidths(array(10, 12, 22, 95, 30, 30));
                                                                     $this->objpdf->SetAligns(array('C', 'C', 'C', 'J', 'R', 'R'));
                                                                     $this->objpdf->setleftmargin(4);
                                                                     $this->objpdf->sety($xlin + $getdoy + 7);
                                                                     $this->objpdf->setfillcolor(235);
                                                                     $xtotal = 0;
                                                                     $muda_pagina = false;
                                                                     $pag = 1;
                                                                     for ($ii = 0; $ii < $this->linhasdositens; $ii++) {
                                                                         if ($ii != 0 && $muda_pagina != true) {
                                                                             $this->objpdf->rect(4, $this->objpdf->gety(), 202, 0, 1, 'DF', '1234');
                                                                         }
                                                                         $this->objpdf->ln(2);
                                                                         db_fieldsmemory($this->recorddositens, $ii);
                                                                         $prazo = "";
                                                                         $pgto = "";
                                                                         $resumo = "";
                                                                         $descricaoitem = trim(pg_result($this->recorddositens, $ii, $this->descricaoitem));
                                                                         if (trim(pg_result($this->recorddositens, $ii, $this->sprazo)) != "") {
                                                                             $prazo = pg_result($this->recorddositens, $ii, $this->sprazo);
                                                                             $prazo = "PRAZO: " . trim($prazo);
                                                                         }
                                                                         if (trim(pg_result($this->recorddositens, $ii, $this->spgto)) != "") {
                                                                             $pgto = pg_result($this->recorddositens, $ii, $this->spgto);
                                                                             $pgto = "CONDIÇÃO: " . trim($pgto);
                                                                         }
                                                                         if (trim(pg_result($this->recorddositens, $ii, $this->sresum) != "")) {
                                                                             $resumo = "RESUMO: " . pg_result($this->recorddositens, $ii, $this->sresum);
                                                                             if ($descricaoitem == "" || $descricaoitem == null) {
                                                                                 $descricaoitem = trim(pg_result($this->recorddositens, $ii, $this->sresum));
                                                                                 $resumo = "";
                                                                             }
                                                                         }
                                                                         if ($muda_pagina == true) {
                                                                             $muda_pagina = false;
                                                                             $this->objpdf->sety($xlin + 12);
                                                                         }
                                                                         $unid = pg_result($this->recorddositens, $ii, $this->sunidade);
                                                                         $codunid = pg_result($this->recorddositens, $ii, $this->scodunid);
                                                                         $servico = pg_result($this->recorddositens, $ii, $this->sservico);
                                                                         $quantunid = pg_result($this->recorddositens, $ii, $this->squantunid);
                                                                         $susaquant = pg_result($this->recorddositens, $ii, $this->susaquant);
                                                                         $dist = 2.7;
                                                                         if (trim($codunid) != "") {
                                                                             $unid = trim(substr($unid, 0, 10));
                                                                             if ($susaquant == "t") {
                                                                                 $unid .= " \n{$quantunid} UNIDADES\n";
                                                                                 $resumo = str_replace("\n", "", $resumo);
                                                                             }
                                                                         } else {
                                                                             if ($servico == "t") {
                                                                                 $unid = "SERVIÇO";
                                                                             }
                                                                         }
                                                                         $this->objpdf->Setfont('Arial', '', 8);
                                                                         $this->objpdf->Row(array(pg_result($this->recorddositens, $ii, $this->item), pg_result($this->recorddositens, $ii, $this->quantitem), $unid, $descricaoitem, '', ''), 3, false, 3);
                                                                         if (isset($resumo) && $resumo != "") {
                                                                             $this->objpdf->Row(array('', '', '', $resumo, '', ''), $dist, false, 2.7);
                                                                         }
                                                                         if (isset($prazo) && $prazo != "") {
                                                                             $this->objpdf->Row(array('', '', '', $prazo, '', ''), $dist, false, 2.7);
                                                                         }
                                                                         if (isset($pgto) && $pgto != "") {
                                                                             $this->objpdf->Row(array('', '', '', $pgto, '', ''), $dist, false, 2.7);
                                                                         }
                                                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                                                         /////// troca de pagina
                                                                         if ($this->objpdf->gety() > $this->objpdf->h - 30) {
                                                                             $pag++;
                                                                             $muda_pagina = true;
                                                                             $this->objpdf->Setfont('Arial', '', 7);
                                                                             if ($pag != 1) {
                                                                                 $this->objpdf->Setfont('Arial', 'B', 7);
                                                                                 $this->objpdf->rect($xcol, $xlin + 262, 142, 10, 2, 'DF', '34');
                                                                                 $this->objpdf->rect($xcol + 142, $xlin + 262, 30, 10, 2, 'DF', '34');
                                                                                 $this->objpdf->rect($xcol + 172, $xlin + 262, 30, 10, 2, 'DF', '34');
                                                                                 $this->objpdf->text($xcol + 114, $xlin + 268, 'T O T A L   P Á G I N A');
                                                                                 $this->objpdf->Setfont('Arial', '', 7);
                                                                             }
                                                                             $this->objpdf->addpage();
                                                                             $pagina += 1;
                                                                             $this->objpdf->settopmargin(1);
                                                                             $xlin = 20;
                                                                             $xcol = 4;
                                                                             $this->objpdf->setfillcolor(245);
                                                                             $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                                                             $this->objpdf->setfillcolor(255, 255, 255);
                                                                             $this->objpdf->Setfont('Arial', 'B', 9);
                                                                             $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                                                             //.$this->logo
                                                                             $this->objpdf->text(130, $xlin - 13, "ORÇAMENTO N" . CHR(176));
                                                                             $this->objpdf->text(185, $xlin - 13, db_formatar($this->orccodigo, 's', '0', 6, 'e'));
                                                                             $this->objpdf->text(130, $xlin - 9, $this->labdados . CHR(176));
                                                                             $this->objpdf->text(185, $xlin - 9, db_formatar($this->Snumero, 's', '0', 6, 'e'));
                                                                             $this->objpdf->Setfont('Arial', 'B', 9);
                                                                             $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                                                             $this->objpdf->Setfont('Arial', '', 7);
                                                                             $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                                                             $this->objpdf->text(40, $xlin - 8, $this->municpref);
                                                                             $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                                                                             $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                                                                             $this->objpdf->text(40, $xlin + 1, db_formatar($this->cgcpref, 'cnpj'));
                                                                             $xlin = -30;
                                                                             $this->objpdf->Setfont('Arial', 'B', 8);
                                                                             $this->objpdf->rect($xcol, $xlin + 54, 15, 6, 2, 'DF', '12');
                                                                             $this->objpdf->rect($xcol + 15, $xlin + 54, 20, 6, 2, 'DF', '12');
                                                                             $this->objpdf->rect($xcol + 35, $xlin + 54, 107, 6, 2, 'DF', '12');
                                                                             $this->objpdf->rect($xcol + 142, $xlin + 54, 30, 6, 2, 'DF', '12');
                                                                             $this->objpdf->rect($xcol + 172, $xlin + 54, 30, 6, 2, 'DF', '12');
                                                                             $this->objpdf->rect($xcol, $xlin + 60, 15, 262, 2, 'DF', '34');
                                                                             $this->objpdf->rect($xcol + 15, $xlin + 60, 20, 262, 2, 'DF', '34');
                                                                             $this->objpdf->rect($xcol + 35, $xlin + 60, 107, 262, 2, 'DF', '34');
                                                                             $this->objpdf->rect($xcol + 142, $xlin + 60, 30, 262, 2, 'DF', '34');
                                                                             $this->objpdf->rect($xcol + 172, $xlin + 60, 30, 262, 2, 'DF', '34');
                                                                             $this->objpdf->sety($xlin + 66);
                                                                             $alt = 4;
                                                                             $this->objpdf->text($xcol + 4, $xlin + 58, 'ITEM');
                                                                             $this->objpdf->text($xcol + 15.5, $xlin + 58, 'QUANTIDADE');
                                                                             $this->objpdf->text($xcol + 70, $xlin + 58, 'MATERIAL OU SERVIÇO');
                                                                             $this->objpdf->text($xcol + 145, $xlin + 58, 'VALOR UNITÁRIO');
                                                                             $this->objpdf->text($xcol + 176, $xlin + 58, 'VALOR TOTAL');
                                                                             $maiscol = 0;
                                                                             $xlin = 20;
                                                                         }
                                                                         $this->objpdf->ln(2);
                                                                         if ($ii + 1 == $this->linhasdositens) {
                                                                             $this->objpdf->rect(4, $this->objpdf->gety(), 202, 0, 1, 'DF', '1234');
                                                                         }
                                                                     }
                                                                     // caixas para total
                                                                     $this->objpdf->Setfont('Arial', 'B', 8);
                                                                     $this->objpdf->rect($xcol, $xlin + 262, 142, 10, 2, 'DF', '34');
                                                                     $this->objpdf->rect($xcol + 142, $xlin + 262, 30, 10, 2, 'DF', '34');
                                                                     $this->objpdf->rect($xcol + 172, $xlin + 262, 30, 10, 2, 'DF', '34');
                                                                     $this->objpdf->text($xcol + 113, $xlin + 268, 'T O T A L   G E R A L');
                                                                     //	echo $this->numaut."<br>";
                                                                     //	echo $pagina;exit;
                                                                 } else {
                                                                     if ($this->modelo == 14) {
                                                                         ////////// MODELO 14  -  AIDOF
                                                                         $this->objpdf->AliasNbPages();
                                                                         $this->objpdf->AddPage();
                                                                         $this->objpdf->settopmargin(1);
                                                                         $this->objpdf->setleftmargin(4);
                                                                         $pagina = 1;
                                                                         $xlin = 30;
                                                                         $xcol = 4;
                                                                         $this->objpdf->setfillcolor(245);
                                                                         $this->objpdf->rect($xcol - 2, $xlin - 28, 206, 292, 2, 'DF', '1234');
                                                                         $this->objpdf->Setfont('Arial', 'B', 9);
                                                                         $this->objpdf->text(130, $xlin - 13, 'AUTORIZAÇÃO  N' . CHR(176));
                                                                         $this->objpdf->text(165, $xlin - 13, db_formatar($this->codaidof, 's', '0', 6, 'e'));
                                                                         $this->objpdf->text(180, $xlin - 13, "/" . $this->ano);
                                                                         $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                                                         //.$this->logo
                                                                         $this->objpdf->Setfont('Arial', 'B', 9);
                                                                         $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                                                         $this->objpdf->Setfont('Arial', '', 9);
                                                                         $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                                                         $this->objpdf->text(40, $xlin - 8, $this->municpref);
                                                                         $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                                                                         $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                                                                         $this->objpdf->Setfont('Arial', 'b', 12);
                                                                         $this->objpdf->text($xcol + 50, $xlin + 6, "AUTORIZAÇÃO DE IMPRESSÃO DE DOCUMENTOS");
                                                                         $this->objpdf->text($xcol + 60, $xlin + 12, "FISCAIS DO IMPOSTO SOBRE SERVIÇOS");
                                                                         $this->objpdf->Setfont('Arial', 'b', 8);
                                                                         $this->objpdf->text($xcol + 80, $xlin + 19, "ESTABELECIMENTO GRÁFICO");
                                                                         $this->objpdf->rect($xcol, $xlin + 20, $xcol + 198, 30, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol, $xlin + 20, $xcol + 198, 10, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol, $xlin + 30, $xcol + 198, 10, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol, $xlin + 40, $xcol + 96, 10, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol + 100, $xlin + 40, $xcol + 98, 10, 2, '', '1234');
                                                                         $this->objpdf->Setfont('Arial', 'b', 8);
                                                                         $this->objpdf->text($xcol + 2, $xlin + 28, "NOME:");
                                                                         $this->objpdf->text($xcol + 2, $xlin + 38, "ENDEREÇO:");
                                                                         $this->objpdf->text($xcol + 2, $xlin + 48, "INSCRIÇÃO MUNICIPAL:");
                                                                         $this->objpdf->text($xcol + 102, $xlin + 48, "INSCRIÇÃO DO CNPJ:");
                                                                         $this->objpdf->Setfont('Arial', '', 8);
                                                                         $this->objpdf->text($xcol + 12, $xlin + 28, $this->nome_graf);
                                                                         $this->objpdf->text($xcol + 22, $xlin + 38, $this->ender_graf);
                                                                         $this->objpdf->text($xcol + 38, $xlin + 48, $this->inscr_graf);
                                                                         $this->objpdf->text($xcol + 138, $xlin + 48, $this->cnpj_graf);
                                                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                                                         $this->objpdf->text($xcol + 81, $xlin + 54, "ESTABELECIMENTO USUÁRIO");
                                                                         $this->objpdf->rect($xcol, $xlin + 55, $xcol + 198, 30, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol, $xlin + 55, $xcol + 198, 10, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol, $xlin + 65, $xcol + 198, 10, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol + 100, $xlin + 75, $xcol + 98, 10, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol, $xlin + 75, $xcol + 96, 10, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol + 100, $xlin + 75, $xcol + 98, 10, 2, '', '1234');
                                                                         $this->objpdf->text($xcol + 2, $xlin + 63, "NOME:");
                                                                         $this->objpdf->text($xcol + 2, $xlin + 73, "ENDEREÇO:");
                                                                         $this->objpdf->text($xcol + 2, $xlin + 83, "INSCRIÇÃO MUNICIPAL:");
                                                                         $this->objpdf->text($xcol + 102, $xlin + 83, "INSCRIÇÃO DO CNPJ:");
                                                                         $this->objpdf->Setfont('Arial', '', 8);
                                                                         $this->objpdf->text($xcol + 12, $xlin + 63, $this->nome_usu);
                                                                         $this->objpdf->text($xcol + 22, $xlin + 73, $this->ender_usu);
                                                                         $this->objpdf->text($xcol + 38, $xlin + 83, $this->inscr_usu);
                                                                         $this->objpdf->text($xcol + 138, $xlin + 83, $this->cnpj_usu);
                                                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                                                         $this->objpdf->text($xcol + 80, $xlin + 89, "DOCUMENTO A SER IMPRESSO");
                                                                         $this->objpdf->rect($xcol, $xlin + 90, $xcol + 198, 50, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol, $xlin + 90, $xcol + 198, 10, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol, $xlin + 100, $xcol + 198, 10, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol, $xlin + 90, $xcol + 65, 20, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol + 110, $xlin + 90, $xcol + 88, 20, 2, '', '1234');
                                                                         $this->objpdf->text($xcol + 25, $xlin + 96, "NUMERAÇÃO");
                                                                         $this->objpdf->Setfont('Arial', '', 8);
                                                                         $this->objpdf->text($xcol + 20, $xlin + 108, $this->notaini . "   A   " . $this->notafin);
                                                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                                                         $this->objpdf->text($xcol + 78, $xlin + 96, "QUANTIDADE");
                                                                         $this->objpdf->text($xcol + 150, $xlin + 96, "ESPÉCIE");
                                                                         $this->objpdf->text($xcol + 2, $xlin + 115, "OBSERVAÇÕES:");
                                                                         $this->objpdf->Setfont('Arial', '', 8);
                                                                         $this->objpdf->text($xcol + 85, $xlin + 108, $this->quant);
                                                                         $this->objpdf->text($xcol + 115, $xlin + 108, $this->especie);
                                                                         $this->objpdf->SetXY($xcol + 2, $xlin + 117);
                                                                         $this->objpdf->Setfont('Arial', '', 7);
                                                                         $this->objpdf->multicell(198, 4, $this->obs, 0, "L");
                                                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                                                         $this->objpdf->text($xcol + 40, $xlin + 144, "PEDIDO");
                                                                         $this->objpdf->rect($xcol, $xlin + 145, $xcol + 95, 80, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol, $xlin + 145, $xcol + 95, 8, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol, $xlin + 153, $xcol + 95, 16, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol, $xlin + 169, $xcol + 95, 8, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol, $xlin + 177, $xcol + 95, 24, 2, '', '1234');
                                                                         $this->objpdf->text($xcol + 140, $xlin + 144, "ENTREGA");
                                                                         $this->objpdf->rect($xcol + 103, $xlin + 145, $xcol + 95, 48, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol + 103, $xlin + 145, $xcol + 95, 8, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol + 103, $xlin + 153, $xcol + 95, 8, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol + 103, $xlin + 153, $xcol + 47, 8, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol + 103, $xlin + 161, $xcol + 95, 8, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol + 103, $xlin + 169, $xcol + 95, 8, 2, '', '1234');
                                                                         $this->objpdf->rect($xcol + 103, $xlin + 177, $xcol + 95, 16, 2, '', '1234');
                                                                         $this->objpdf->text($xcol + 137, $xlin + 197, "REPARTIÇÃO FISCAL");
                                                                         $this->objpdf->text($xcol + 141, $xlin + 203, "AUTORIZAMOS");
                                                                         $this->objpdf->rect($xcol + 103, $xlin + 198, $xcol + 95, 27, 2, '', '1234');
                                                                         $this->objpdf->Setfont('Arial', '', 7);
                                                                         $this->objpdf->text($xcol + 2, $xlin + 151, "DATA:________________DE______________________________DE_____________");
                                                                         $this->objpdf->text($xcol + 1, $xlin + 156, "NOME DO RESPONSÁVEL PELO ESTABELECIMENTO USUÁRIO");
                                                                         $this->objpdf->text($xcol + 3, $xlin + 165, "___________________________________________________________________");
                                                                         $this->objpdf->text($xcol + 1, $xlin + 172, "DOCUMENTO DE IDENTIDADE");
                                                                         $this->objpdf->text($xcol + 1, $xlin + 200, "ASSINATURA DO RESPONSÁVEL PELO ESTABELECIMENTO USUÁRIO");
                                                                         $this->objpdf->text($xcol + 1, $xlin + 224, "ASSINATURA DO RESPONSÁVEL PELO ESTABELECIMENTO GRÁFICO");
                                                                         $this->objpdf->text($xcol + 105, $xlin + 151, "DATA:________________DE______________________________DE_____________");
                                                                         $this->objpdf->text($xcol + 104, $xlin + 156, "DOC. FISCAL N°.:");
                                                                         $this->objpdf->text($xcol + 155, $xlin + 156, "SÉRIE:");
                                                                         $this->objpdf->text($xcol + 104, $xlin + 164, "RECEBIDO POR");
                                                                         $this->objpdf->text($xcol + 104, $xlin + 172, "DOCUMENTO DE IDENTIDADE");
                                                                         $this->objpdf->text($xcol + 116, $xlin + 192, "ASSINATURA DO RESPONSÁVEL PELO RECEBIMENTO");
                                                                         $this->objpdf->text($xcol + 105, $xlin + 211, "EM________________DE______________________________DE_____________");
                                                                         $this->objpdf->text($xcol + 115, $xlin + 224, "ASSINATURA E CARIMBO DA AUTORIDADE COMPETENTE");
                                                                         $this->objpdf->Setfont('Arial', 'B', 8);
                                                                         $this->objpdf->text($xcol + 90, $xlin + 229, "IMPORTANTE");
                                                                         $this->objpdf->rect($xcol, $xlin + 230, $xcol + 198, 30, 2, '', '1234');
                                                                         $this->objpdf->Setfont('Arial', 'b', 7);
                                                                         $this->objpdf->text($xcol + 10, $xlin + 236, "NO RODAPÉ DAS NOTAS FISCAIS DEVERÁ CONSTAR OBRIGATORIAMENTE:");
                                                                         $this->objpdf->text($xcol + 10, $xlin + 242, "- A QUANTIDADE DE TALÕES IMPRESSOS:");
                                                                         $this->objpdf->text($xcol + 10, $xlin + 246, "- A NUMERAÇÃO:");
                                                                         $this->objpdf->text($xcol + 10, $xlin + 250, "- O NUMERO DA AUTORIZAÇÃO PARA IMPRESSÃO:");
                                                                         $this->objpdf->text($xcol + 10, $xlin + 254, "- O CNPJ E O NÚMERO DE INSCRIÇÃO MUNICIPAL DA GRÁFICA:");
                                                                     } else {
                                                                         if ($this->modelo == 15) {
                                                                             ////////// MODELO 15  -  ESTORNO DE EMPENHO
                                                                             for ($xxx = 0; $xxx < $this->nvias; $xxx++) {
                                                                                 $this->objpdf->AliasNbPages();
                                                                                 $this->objpdf->AddPage();
                                                                                 $this->objpdf->settopmargin(1);
                                                                                 $pagina = 1;
                                                                                 $xlin = 20;
                                                                                 $xcol = 4;
                                                                                 $this->objpdf->setfillcolor(245);
                                                                                 $this->objpdf->rect($xcol - 2, $xlin - 18, 206, 292, 2, 'DF', '1234');
                                                                                 $this->objpdf->setfillcolor(255, 255, 255);
                                                                                 $this->objpdf->Setfont('Arial', 'B', 10);
                                                                                 $this->objpdf->text(117, $xlin - 13, 'ESTORNO DE PAGAMENTO N' . CHR(176) . ': ');
                                                                                 $this->objpdf->text(175, $xlin - 13, db_formatar($this->anulado, 's', '0', 6, 'e'));
                                                                                 $this->objpdf->text(134, $xlin - 8, 'DATA DE EMISSÃO : ');
                                                                                 $this->objpdf->text(175, $xlin - 8, $this->emissao);
                                                                                 $this->objpdf->text(128, $xlin - 3, 'NOTA DE EMPENHO N' . CHR(176) . ': ');
                                                                                 $this->objpdf->text(175, $xlin - 3, db_formatar($this->codemp, 's', '0', 6, 'e'));
                                                                                 $this->objpdf->Image('imagens/files/logo_boleto.png', 15, $xlin - 17, 12);
                                                                                 //.$this->logo
                                                                                 $this->objpdf->Setfont('Arial', 'B', 9);
                                                                                 $this->objpdf->text(40, $xlin - 15, $this->prefeitura);
                                                                                 $this->objpdf->Setfont('Arial', '', 7);
                                                                                 $this->objpdf->text(40, $xlin - 11, $this->enderpref);
                                                                                 $this->objpdf->text(40, $xlin - 8, $this->municpref);
                                                                                 $this->objpdf->text(40, $xlin - 5, $this->telefpref);
                                                                                 $this->objpdf->text(40, $xlin - 2, $this->emailpref);
                                                                                 $this->objpdf->text(40, $xlin, db_formatar($this->cgcpref, 'cnpj'));
                                                                                 /// retangulo dos dados da dotação
                                                                                 $this->objpdf->rect($xcol, $xlin + 2, $xcol + 100, 50, 2, 'DF', '1234');
                                                                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                                                                 $this->objpdf->text($xcol + 2, $xlin + 7, 'Órgao');
                                                                                 $this->objpdf->text($xcol + 2, $xlin + 10.5, 'Unidade');
                                                                                 $this->objpdf->text($xcol + 2, $xlin + 14, 'Função');
                                                                                 $this->objpdf->text($xcol + 2, $xlin + 20.5, 'Proj/Ativ');
                                                                                 $this->objpdf->text($xcol + 2, $xlin + 27, 'Rubrica');
                                                                                 $this->objpdf->text($xcol + 2, $xlin + 35, 'Recurso');
                                                                                 if ($this->banco != "") {
                                                                                     $this->objpdf->text($xcol + 2, $xlin + 38.5, 'Banco');
                                                                                     $this->objpdf->text($xcol + 30, $xlin + 38.5, 'Agencia:');
                                                                                     $this->objpdf->text($xcol + 60, $xlin + 38.5, 'Conta:');
                                                                                 }
                                                                                 $this->objpdf->text($xcol + 2, $xlin + 42.5, 'Reduzido');
                                                                                 $this->objpdf->text($xcol + 2, $xlin + 48, 'Licitação');
                                                                                 $this->objpdf->Setfont('Arial', '', 8);
                                                                                 $this->objpdf->text($xcol + 17, $xlin + 7, ':  ' . db_formatar($this->orgao, 'orgao') . ' - ' . $this->descr_orgao);
                                                                                 $this->objpdf->text($xcol + 17, $xlin + 10.5, ':  ' . db_formatar($this->unidade, 'unidade') . ' - ' . $this->descr_unidade);
                                                                                 $this->objpdf->text($xcol + 17, $xlin + 14, ':  ' . db_formatar($this->funcao, 'funcao') . ' - ' . $this->descr_funcao);
                                                                                 $this->objpdf->text($xcol + 17, $xlin + 20.5, ':  ' . db_formatar($this->projativ, 'projativ') . ' - ' . $this->descr_projativ);
                                                                                 $this->objpdf->text($xcol + 17, $xlin + 27, ':  ' . db_formatar($this->sintetico, 'elemento'));
                                                                                 $this->objpdf->setxy($xcol + 18, $xlin + 28);
                                                                                 $this->objpdf->multicell(90, 3, $this->descr_sintetico, 0, "L");
                                                                                 $this->objpdf->text($xcol + 17, $xlin + 35, ':  ' . $this->recurso . ' - ' . $this->descr_recurso);
                                                                                 if ($this->banco != "") {
                                                                                     $this->objpdf->text($xcol + 17, $xlin + 38.5, ':  ' . $this->banco);
                                                                                     $this->objpdf->text($xcol + 47, $xlin + 38.5, $this->agencia);
                                                                                     $this->objpdf->text($xcol + 77, $xlin + 38.5, $this->conta);
                                                                                 }
                                                                                 $this->objpdf->text($xcol + 17, $xlin + 42.5, ':  ' . $this->coddot);
                                                                                 $this->objpdf->text($xcol + 17, $xlin + 48, ':  ' . $this->descr_licitacao);
                                                                                 //// retangulo dos dados do credor
                                                                                 $this->objpdf->rect($xcol + 106, $xlin + 2, 96, 18, 2, 'DF', '1234');
                                                                                 $this->objpdf->Setfont('Arial', '', 6);
                                                                                 $this->objpdf->text($xcol + 108, $xlin + 4, 'Dados do Credor:');
                                                                                 $this->objpdf->Setfont('Arial', 'B', 8);
                                                                                 $this->objpdf->text($xcol + 107, $xlin + 7, 'Numcgm');
                                                                                 $this->objpdf->text($xcol + 140, $xlin + 7, strlen($this->cnpj) == 11 ? 'CPF' : 'CNPJ');
                                                                                 $this->objpdf->text($xcol + 107, $xlin + 11, 'Nome');
                                                                                 $this->objpdf->text($xcol + 107, $xlin + 15, 'Endereço');
                                                                                 $this->objpdf->text($xcol + 107, $xlin + 19, 'Município');
                                                                                 $this->objpdf->Setfont('Arial', '', 8);
                                                                                 $this->objpdf->text($xcol + 124, $xlin + 7, ': ' . $this->numcgm);
                                                                                 $this->objpdf->text($xcol + 149, $xlin + 7, ':  ' . (strlen($this->cnpj) == 11 ? db_formatar($this->cnpj, 'cpf') : db_formatar($this->cnpj, 'cnpj')) . '   Fone: ' . $this->telefone);
                                                                                 $this->objpdf->text($xcol + 124, $xlin + 11, ': ' . $this->nome);
                                                                                 $this->objpdf->text($xcol + 124, $xlin + 15, ': ' . $this->ender . '  ' . $this->compl);
                                                                                 $this->objpdf->text($xcol + 124, $xlin + 19, ': ' . $this->munic . '-' . $this->uf . '    CEP : ' . $this->cep);
                                                                                 ///// retangulo dos valores
                                                                                 $this->objpdf->rect($xcol + 106, $xlin + 21.5, 96, 9, 2, 'DF', '1234');
                                                                                 $this->objpdf->rect($xcol + 106, $xlin + 32.0, 47, 9, 2, 'DF', '1234');
                                                                                 $this->objpdf->rect($xcol + 155, $xlin + 32.0, 47, 9, 2, 'DF', '1234');
                                                                                 $this->objpdf->rect($xcol + 106, $xlin + 42.5, 47, 9, 2, 'DF', '1234');
                                                                                 $this->objpdf->rect($xcol + 155, $xlin + 42.5, 47, 9, 2, 'DF', '1234');
                                                                                 $this->objpdf->Setfont('Arial', '', 6);
                                                                                 $this->objpdf->text($xcol + 108, $xlin + 34.0, 'Valor Empenhado');
                                                                                 $this->objpdf->text($xcol + 157, $xlin + 34.0, 'Data do Empenho');
                                                                                 $this->objpdf->text($xcol + 108, $xlin + 44.5, 'Valor Estorno');
                                                                                 $this->objpdf->text($xcol + 157, $xlin + 44.5, 'Data do Estorno');
                                                                                 $this->objpdf->Setfont('Arial', '', 8);
                                                                                 $this->objpdf->text($xcol + 108, $xlin + 27, 'AUTORIZAÇÃO N' . chr(176) . ' ' . db_formatar($this->numaut, 's', '0', 5, 'e'));
                                                                                 $this->objpdf->text($xcol + 150, $xlin + 27, 'SEQ. DO EMPENHO N' . chr(176) . ' ' . db_formatar($this->numemp, 's', '0', 6, 'e'));
                                                                                 //	$this->objpdf->text($xcol+108,$xlin+26.5,$this->texto);
                                                                                 $this->objpdf->text($xcol + 130, $xlin + 38.0, db_formatar($this->empenhado, 'f'));
                                                                                 $this->objpdf->text($xcol + 180, $xlin + 38.0, $this->emissao, 'd');
                                                                                 $this->objpdf->text($xcol + 130, $xlin + 47.5, db_formatar($this->vlr_anul, 'f'));
                                                                                 $this->objpdf->text($xcol + 180, $xlin + 47.5, db_formatar($this->data_est, 'd'));
                                                                                 /// retangulo do corpo do empenho
                                                                                 $this->objpdf->rect($xcol, $xlin + 60, 202, 55, 2, 'DF', '');
                                                                                 $this->objpdf->rect($xcol, $xlin + 117, 202, 55, 2, 'DF', '');
                                                                                 $maiscol = 0;
                                                                                 $this->objpdf->rect($xcol, $xlin + 178, 202, 6, 2, 'DF', '34');
                                                                                 $this->objpdf->SetFont('Arial', '', 7);
                                                                                 $this->objpdf->setxy($xcol + 1, $xlin + 68);
                                                                                 $this->objpdf->text($xcol + 2, $xlin + 64, 'Histórico do Estorno : ', 0, 1, 'L', 0);
                                                                                 $this->objpdf->multicell(195, 3.5, $this->descr_anu);
                                                                                 $this->objpdf->text($xcol + 2, $xlin + 120, 'Histórico do Empenho : ', 0, 1, 'L', 0);
                                                                                 $this->objpdf->setxy($xcol + 1, $xlin + 124);
                                                                                 $this->objpdf->multicell(147, 3.5, $this->resumo);
                                                                                 $this->objpdf->text($xcol + 2, $xlin + 182, 'DESTINO : ', 0, 1, 'L', 0);
                                                                                 $this->objpdf->text($xcol + 30, $xlin + 182, $this->destino, 0, 1, 'L', 0);
                                                                                 $this->objpdf->rect($xcol, $xlin + 197, 67, 47, 2, 'DF', '34');
                                                                                 $this->objpdf->rect($xcol + 67, $xlin + 197, 67, 47, 2, 'DF', '34');
                                                                                 $this->objpdf->rect($xcol + 134, $xlin + 197, 68, 47, 2, 'DF', '34');
                                                                                 $this->objpdf->rect($xcol, $xlin + 191, 67, 6, 2, 'DF', '12');
                                                                                 $this->objpdf->rect($xcol + 67, $xlin + 191, 67, 6, 2, 'DF', '12');
                                                                                 $this->objpdf->rect($xcol + 134, $xlin + 191, 68, 6, 2, 'DF', '12');
                                                                                 $this->objpdf->text($xcol + 19, $xlin + 195, 'CONTADORIA GERAL');
                                                                                 $this->objpdf->text($xcol + 84, $xlin + 195, 'GABINETE DO PREFEITO');
                                                                                 $this->objpdf->text($xcol + 158, $xlin + 195, 'TESOURARIA');
                                                                                 if ($this->assinatura3 != "") {
                                                                                     $this->objpdf->line($xcol + 8, $xlin + 225, $xcol + 58, $xlin + 225);
                                                                                 }
                                                                                 if (strtoupper(trim($this->municpref)) == 'SAPIRANGA') {
                                                                                     $this->objpdf->line($xcol + 10, $xlin + 210, $xcol + 55, $xlin + 210);
                                                                                     $this->objpdf->SetFont('Arial', '', 6);
                                                                                     $this->objpdf->text($xcol + 29 - strlen($this->assinatura2) / 2, $xlin + 212, $this->assinatura2);
                                                                                 }
                                                                                 $this->objpdf->line($xcol + 73, $xlin + 225, $xcol + 125, $xlin + 225);
                                                                                 $this->objpdf->SetFont('Arial', '', 6);
                                                                                 $this->objpdf->text($xcol + 29 - strlen($this->assinatura3) / 2, $xlin + 227, $this->assinatura3);
                                                                                 $this->objpdf->text($xcol + 99 - strlen($this->assinaturaprefeito) / 2, $xlin + 227, $this->assinaturaprefeito);
                                                                                 $this->objpdf->line($xcol + 141, $xlin + 225, $xcol + 195, $xlin + 225);
                                                                                 $this->objpdf->text($xcol + 160, $xlin + 227, 'TESOUREIRO');
                                                                                 //           $this->objpdf->rect($xcol,$xlin+246,202,26,2,'DF','1234');
                                                                                 $this->objpdf->SetFont('Arial', '', 4);
                                                                                 $this->objpdf->Text(2, 296, $this->texto);
                                                                                 // texto no canhoto do carne
                                                                                 $this->objpdf->SetFont('Arial', '', 6);
                                                                                 $this->objpdf->Text(200, 296, $xxx + 1 . ' via');
                                                                                 // texto no canhoto do carne
                                                                                 $this->objpdf->setfont('Arial', '', 11);
                                                                                 $xlin = 169;
                                                                             }
                                                                         } else {
                                                                             echo "<script>alert('Modelo No. {$this->modelo} não definido no sistema. Contate suporte.')</script>";
                                                                             exit;
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 function Footer()
 {
     //#00#//footer
     //#10#//Este método é usado para criar o rodapé da página. Ele é automaticamente chamado por |addPage|
     //#10#//e |close| e não deve ser chamado diretamente pela aplicação. A  implementação  em  FPDF  está
     //#10#//vazia, então você  deve  criar  uma  subclasse  e  sobrepor  o  método  se  você  quiser   um
     //#10#//processamento específico.
     //#15#//footer()
     //#99#//Exemplo:
     //#99#//class PDF extends FPDF
     //#99#//{
     //#99#//  function Footer()
     //#99#//  {
     //#99#//    Vai para 1.5 cm da borda inferior
     //#99#//      $this->SetY(-15);
     //#99#//    Seleciona Arial itálico 8
     //#99#//      $this->SetFont('Arial','I',8);
     //#99#//    Imprime o número da página centralizado
     //#99#//      $this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');
     //#99#//  }
     //#99#//}
     global $url;
     //Position at 1.5 cm from bottom
     $this->SetFont('Arial', '', 5);
     $this->text(10, $this->h - 8, 'Base: ' . @$GLOBALS["DB_NBASE"]);
     $this->SetFont('Arial', 'I', 8);
     $this->SetY(-10);
     $nome = @$GLOBALS["HTTP_SERVER_VARS"]["PHP_SELF"];
     $nome = substr($nome, strrpos($nome, "/") + 1);
     $this->Cell(0, 10, $nome . '     Emissor: ' . @$GLOBALS["DB_login"] . '     Exercício: ' . db_getsession("DB_anousu") . '    Data: ' . date("d-m-Y - H:i:s"), "T", 0, 'C');
     $this->Cell(0, 10, 'Página ' . $this->PageNo() . ' de {nb}', 0, 1, 'R');
 }
 function excluir($e63_numemp = null, $dbwhere = null)
 {
     if ($dbwhere == null || $dbwhere == "") {
         $resaco = $this->sql_record($this->sql_query_file($e63_numemp));
     } else {
         $resaco = $this->sql_record($this->sql_query_file(null, "*", null, $dbwhere));
     }
     if ($resaco != false || $this->numrows != 0) {
         for ($iresaco = 0; $iresaco < $this->numrows; $iresaco++) {
             $resac = db_query("select nextval('db_acount_id_acount_seq') as acount");
             $acount = pg_result($resac, 0, 0);
             $resac = db_query("insert into db_acountacesso values({$acount}," . db_getsession("DB_acessado") . ")");
             $resac = db_query("insert into db_acountkey values({$acount},5672,'{$e63_numemp}','E')");
             $resac = db_query("insert into db_acount values({$acount},892,5672,'','" . AddSlashes(pg_result($resaco, $iresaco, 'e63_numemp')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},892,5673,'','" . AddSlashes(pg_result($resaco, $iresaco, 'e63_codhist')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
         }
     }
     $sql = " delete from empemphist\n                    where ";
     $sql2 = "";
     if ($dbwhere == null || $dbwhere == "") {
         if ($e63_numemp != "") {
             if ($sql2 != "") {
                 $sql2 .= " and ";
             }
             $sql2 .= " e63_numemp = {$e63_numemp} ";
         }
     } else {
         $sql2 = $dbwhere;
     }
     $result = db_query($sql . $sql2);
     if ($result == false) {
         $this->erro_banco = str_replace("\n", "", @pg_last_error());
         $this->erro_sql = "Históricos dos Empenhos nao Excluído. Exclusão Abortada.\\n";
         $this->erro_sql .= "Valores : " . $e63_numemp;
         $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
         $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
         $this->erro_status = "0";
         $this->numrows_excluir = 0;
         return false;
     } else {
         if (pg_affected_rows($result) == 0) {
             $this->erro_banco = "";
             $this->erro_sql = "Históricos dos Empenhos nao Encontrado. Exclusão não Efetuada.\\n";
             $this->erro_sql .= "Valores : " . $e63_numemp;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = 0;
             return true;
         } else {
             $this->erro_banco = "";
             $this->erro_sql = "Exclusão efetuada com Sucesso\\n";
             $this->erro_sql .= "Valores : " . $e63_numemp;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = pg_affected_rows($result);
             return true;
         }
     }
 }
 function excluir($w15_sequencial = null, $dbwhere = null)
 {
     if ($dbwhere == null || $dbwhere == "") {
         $resaco = $this->sql_record($this->sql_query_file($w15_sequencial));
     } else {
         $resaco = $this->sql_record($this->sql_query_file(null, "*", null, $dbwhere));
     }
     if ($resaco != false || $this->numrows != 0) {
         for ($iresaco = 0; $iresaco < $this->numrows; $iresaco++) {
             $resac = db_query("select nextval('db_acount_id_acount_seq') as acount");
             $acount = pg_result($resac, 0, 0);
             $resac = db_query("insert into db_acountacesso values({$acount}," . db_getsession("DB_acessado") . ")");
             $resac = db_query("insert into db_acountkey values({$acount},9131,'{$w15_sequencial}','E')");
             $resac = db_query("insert into db_acount values({$acount},1563,9131,'','" . AddSlashes(pg_result($resaco, $iresaco, 'w15_sequencial')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1563,9132,'','" . AddSlashes(pg_result($resaco, $iresaco, 'w15_dai')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1563,9133,'','" . AddSlashes(pg_result($resaco, $iresaco, 'w15_mes')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1563,9135,'','" . AddSlashes(pg_result($resaco, $iresaco, 'w15_valreceita')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1563,9137,'','" . AddSlashes(pg_result($resaco, $iresaco, 'w15_cnpj')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1563,9175,'','" . AddSlashes(pg_result($resaco, $iresaco, 'w15_nota')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1563,9176,'','" . AddSlashes(pg_result($resaco, $iresaco, 'w15_serie')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
             $resac = db_query("insert into db_acount values({$acount},1563,9177,'','" . AddSlashes(pg_result($resaco, $iresaco, 'w15_data')) . "'," . db_getsession('DB_datausu') . "," . db_getsession('DB_id_usuario') . ")");
         }
     }
     $sql = " delete from db_dairetido\n                    where ";
     $sql2 = "";
     if ($dbwhere == null || $dbwhere == "") {
         if ($w15_sequencial != "") {
             if ($sql2 != "") {
                 $sql2 .= " and ";
             }
             $sql2 .= " w15_sequencial = {$w15_sequencial} ";
         }
     } else {
         $sql2 = $dbwhere;
     }
     $result = db_query($sql . $sql2);
     if ($result == false) {
         $this->erro_banco = str_replace("\n", "", @pg_last_error());
         $this->erro_sql = "Valores retidos de minha empresa nao Excluído. Exclusão Abortada.\\n";
         $this->erro_sql .= "Valores : " . $w15_sequencial;
         $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
         $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
         $this->erro_status = "0";
         $this->numrows_excluir = 0;
         return false;
     } else {
         if (pg_affected_rows($result) == 0) {
             $this->erro_banco = "";
             $this->erro_sql = "Valores retidos de minha empresa nao Encontrado. Exclusão não Efetuada.\\n";
             $this->erro_sql .= "Valores : " . $w15_sequencial;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = 0;
             return true;
         } else {
             $this->erro_banco = "";
             $this->erro_sql = "Exclusão efetuada com Sucesso\\n";
             $this->erro_sql .= "Valores : " . $w15_sequencial;
             $this->erro_msg = "Usuário: \\n\\n " . $this->erro_sql . " \\n\\n";
             $this->erro_msg .= str_replace('"', "", str_replace("'", "", "Administrador: \\n\\n " . $this->erro_banco . " \\n"));
             $this->erro_status = "1";
             $this->numrows_excluir = pg_affected_rows($result);
             return true;
         }
     }
 }
">
<?php 
if (db_getsession("DB_login") == "") {
    echo "<form name=\"form1\" action=\"\" method=\"post\">";
    echo "<table bgcolor=\"" . $w01_corbody . "\" style=\"border:0 " . $w01_estilomenu . " " . $w01_corbordamenu . "\" class=\"texto\">\r\n            <tr align=\"left\">\r\n             <td>Login: </td>\r\n             <td><input name=\"login\" type=\"text\" size=\"10\"> </td>\r\n            </tr>\r\n            <tr align=\"left\">\r\n             <td>Senha:</td>\r\n             <td><input name=\"senha\" onKeyUp=\"js_alapucha(event)\" type=\"password\" size=\"10\"> </td>\r\n            </tr>\r\n            <tr align=\"center\">\r\n             <td colspan=\"2\" ><input name=\"Submit\" type=\"button\" class=\"botao\" onClick=\"js_submeter()\" value=\"Acessar\"></td>\r\n            </tr>\r\n           </table>\r\n           <input type='hidden' name='DB_senha'>\r\n           <input type='hidden' name='DB_login'>\r\n           </form>\r\n           ";
}
?>
</body>
</html>
<?php 
if (isset($erroscripts) && !isset($DB_LOGADO)) {
    if (@$erroscripts == 1) {
        echo "<script>alert('Login Inválido UOUU');</script>\n";
    } elseif (@$erroscripts == 2) {
        echo "<script>alert('Senha Inválida');</script>\n";
    } elseif (@$erroscripts == 3) {
        echo "<script>alert('Acesso a rotina inválido.');</script>\n";
    } elseif (@$erroscripts == 4) {
        echo "<script>alert('Sem permissão de acesso, Contate a Prefeitura.');</script>\n";
    } elseif (@$erroscripts == 5) {
        echo "<script>alert('Usuário com Login Desativado, Contate a Prefeitura.');</script>\n";
    }
}
?>
<script>
<?php 
if (!isset($DB_LOGADO) && db_getsession("DB_login") == "") {
    echo "\r\n  function js_foco(){\r\n    document.form1.login.focus();\r\n  }\r\n    ";
}
?>
</script>
echo $Le60_numemp;
?>
</td>
  <td width="15%" align="left" nowrap><?php 
db_input("e60_numemp", 15, "", true, "text", 3);
?>
 </td>
  <td width="*%" align="left" nowrap title="<?php 
echo $Te60_codemp;
?>
"><?php 
echo $Le60_codemp;
?>
   <?php 
db_input("e60_codemp", 15, "", true, "text", 3);
if ($e60_anousu != db_getsession("DB_anousu")) {
    echo "<font color='red'><b>RESTOS À PAGAR</b></font>";
}
?>
  </td>
 </tr>
 <tr>
  <td align="right" nowrap title="<?php 
echo $Te61_autori;
?>
">
   <?php 
echo $Le61_autori;
?>
</td>
  <td align="left" nowrap><?php