/**
  * Define os dados para o termo de abertura/fechamento do livro fiscal
  *
  * @param $oParametros
  * @tutorial
  *        Contribuinte_Model_Contribuinte $oParametros->oContribuinte
  *        int                             $oParametros->iAno
  *        int                             $oParametros->iCompetenciaInicialMes
  *        int                             $oParametros->iCompetenciaInicialAno
  *        int                             $oParametros->iCompetenciaFinalMes
  *        int                             $oParametros->iCompetenciaFinalAno
  *        boolean                         $oParametros->lFechamento
  */
 public function setDadosAberturaFechamento($oParametros)
 {
     $this->AddPage();
     $this->lImprimePaginas = FALSE;
     // Ignora os meses anteriores e seguintes aos meses inicial e final
     if ($oParametros->iCompetenciaInicialAno != $oParametros->iCompetenciaFinalAno) {
         if ($oParametros->iAno > $oParametros->iCompetenciaInicialAno) {
             $oParametros->iCompetenciaInicialMes = 1;
         }
         if ($oParametros->iAno < $oParametros->iCompetenciaFinalAno) {
             $oParametros->iCompetenciaFinalMes = 12;
         }
     }
     // Verifica qual o título de termo, se abertura ou fechamento
     if (isset($oParametros->lFechamento) && $oParametros->lFechamento == TRUE) {
         $sTexto = 'Termo de Fechamento';
     } else {
         $sTexto = 'Termo de Abertura';
     }
     // Converte os meses para 2 casas
     $oParametros->iCompetenciaInicialMes = str_pad($oParametros->iCompetenciaInicialMes, 2, '0', STR_PAD_LEFT);
     $oParametros->iCompetenciaFinalMes = str_pad($oParametros->iCompetenciaFinalMes, 2, '0', STR_PAD_LEFT);
     // Formata as datas inicial e final
     $oDataInicial = new DateTime();
     $oDataInicial->setDate($oParametros->iAno, $oParametros->iCompetenciaInicialMes, '01');
     $oDataFinal = new DateTime();
     $oDataFinal->setDate($oParametros->iAno, $oParametros->iCompetenciaFinalMes, '01');
     $sDataInicial = $oDataInicial->format('d/m/Y');
     $sDataFinal = $oDataFinal->format('t/m/Y');
     // Imprime os dados de abertura/fechamento
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(0, 10, utf8_decode('REGISTRO DE SERVIÇOS PRESTADOS A TERCEIROS'), 0, 0, 'C');
     $this->Ln();
     $this->SetFont('Arial', 'U', 10);
     $this->Cell(0, 10, utf8_decode($sTexto), 0, 0, 'C');
     $this->Ln(30);
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(12, 5, utf8_decode('CNPJ:'));
     $this->SetFont('Arial', '', 10);
     $this->Cell(0, 5, DBSeller_Helper_Number_Format::maskCPF_CNPJ($oParametros->oContribuinte->getCgcCpf()));
     $this->Ln();
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(25, 5, utf8_decode('Razão Social:'));
     $this->SetFont('Arial', '', 10);
     $this->Cell(0, 5, utf8_decode($oParametros->oContribuinte->getNome()));
     $this->Ln();
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(34, 5, utf8_decode('Inscrição Estadual:'));
     $this->SetFont('Arial', '', 10);
     $this->Cell(0, 5, utf8_decode($oParametros->oContribuinte->getInscricaoEstadual()));
     $this->Ln();
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(36, 5, utf8_decode('Inscrição Municipal:'));
     $this->SetFont('Arial', '', 10);
     $this->Cell(0, 5, utf8_decode($oParametros->oContribuinte->getInscricaoMunicipal()));
     $this->Ln();
     $sTexto = trim($oParametros->oContribuinte->getDescricaoLogradouro());
     $sTexto .= ", {$oParametros->oContribuinte->getLogradouroNumero()}";
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(20, 5, utf8_decode('Endereço:'));
     $this->SetFont('Arial', '', 10);
     $this->Cell(0, 5, utf8_decode($sTexto));
     $this->Ln();
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(26, 5, utf8_decode('Complemento:'));
     $this->SetFont('Arial', '', 10);
     $this->Cell(0, 5, utf8_decode($oParametros->oContribuinte->getLogradouroComplemento()));
     $this->Ln();
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(13, 5, utf8_decode('Bairro:'), 0, 0, 'L');
     $this->SetFont('Arial', '', 10);
     $this->Cell(0, 5, utf8_decode($oParametros->oContribuinte->getLogradouroBairro()));
     $this->Ln();
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(10, 5, utf8_decode('CEP:'));
     $this->SetFont('Arial', '', 10);
     $this->Cell(0, 5, utf8_decode($oParametros->oContribuinte->getCep()));
     $this->Ln();
     $sTexto = $oParametros->oContribuinte->getDescricaoMunicipio() . '/' . $oParametros->oContribuinte->getEstado();
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(20, 5, utf8_decode('Município:'));
     $this->SetFont('Arial', '', 10);
     $this->Cell(0, 5, utf8_decode($sTexto));
     $this->Ln(30);
     $this->Cell(0, 5, '_________________________________________________________________', 0, 0, 'C');
     $this->Ln();
     $sTexto = $oParametros->oContribuinte->getDescricaoMunicipio() . ', ' . DBSeller_Helper_Date_Date::getDataExtenso();
     $this->SetFont('Arial', '', 10);
     $this->Cell(0, 5, utf8_decode($sTexto), 0, 0, 'C');
     $this->Ln();
     $this->SetFont('Arial', 'I', 7);
     $this->Cell(0, 5, utf8_decode('(Assinatura do contribuinte ou seu representante legal)'), 0, 0, 'C');
     $this->Ln(20);
     $this->SetFont('Arial', '', 10);
     $sTexto = "Contém este relatório {$this->iNumeroPagina} folha(s) numerada(s) eletronicamente e seguidamente ";
     $sTexto .= "do nº 1 ao nº {$this->iNumeroPagina} e serviu para ";
     $this->Cell(0, 5, utf8_decode($sTexto), 0, 0, 'C');
     $this->Ln();
     $sTexto = " o lançamento das operações próprias no período de {$sDataInicial} a {$sDataFinal} ";
     $this->Cell(0, 5, utf8_decode($sTexto), 0, 0, 'C');
     $this->Ln();
     $sTexto = 'do estabelecimento do contribuinte abaixo identificado.';
     $this->Cell(0, 5, utf8_decode($sTexto), 0, 0, 'C');
     $this->Ln();
 }