/** * Define os dados do contribuinte * * @param Contribuinte_Model_Contribuinte $oContribuinte * @param $iMesCompetencia * @param $iAnoCompetencia * @param bool $lLivroFiscal */ public function setDadosContribuinte(Contribuinte_Model_Contribuinte $oContribuinte, $iMesCompetencia, $iAnoCompetencia, $lLivroFiscal = TRUE) { if (!$lLivroFiscal) { $this->AddPage(); } // Mês e ano da competnência por extenso $sCompetencia = DBSeller_Helper_Date_Date::mesExtenso($iMesCompetencia) . "/{$iAnoCompetencia}"; $sCompetencia = utf8_decode($sCompetencia); // Mostra os campos referentes à guia somente para contribuintes NFSe if ($oContribuinte->getTipoEmissao() == Contribuinte_Model_Contribuinte::TIPO_EMISSAO_NOTA || !$lLivroFiscal) { // Situação da Guia $sDataFechamentoGuia = '-'; $sSituacaoGuia = 'Em aberto'; $oGuia = new Contribuinte_Model_Guia(); $aGuia = $oGuia->getByCompetenciaAndContribuinte($iAnoCompetencia, $iMesCompetencia, $oContribuinte, Contribuinte_Model_Guia::$PRESTADOR); if (count($aGuia) > 0) { $oGuia = $aGuia[0]->getEntity(); $sDataFechamentoGuia = $oGuia->getDataFechamento()->format('d/m/Y'); $sSituacaoGuia = Contribuinte_Model_Guia::$SITUACAO[$oGuia->getSituacao()]; } $aLarguraCelulas = array(57, 55, 55, 55, 55, 45, 50); $this->SetFont('Arial', 'B', 8); if ($lLivroFiscal) { // Mostra CGM ou Inscrição Municipal if ($oContribuinte->getCgm()) { $this->Cell($aLarguraCelulas[0], 5, utf8_decode('CGM / Inscrição Municipal:'), 1); } else { $this->Cell($aLarguraCelulas[0], 5, utf8_decode('Inscrição Municipal:'), 1); } $this->Cell($aLarguraCelulas[1], 5, utf8_decode('CPF / CNPJ:'), 1); $this->Cell($aLarguraCelulas[2], 5, utf8_decode('Mês Referência:'), 1); $this->Cell($aLarguraCelulas[3], 5, utf8_decode('Situação:'), 1); $this->Cell($aLarguraCelulas[4], 5, utf8_decode('Encerramento:'), 1); $this->Ln(); $this->SetFont('Arial', NULL, 8); // Mostra CGM ou Inscrição Municipal if ($oContribuinte->getCgm()) { $this->Cell($aLarguraCelulas[0], 5, $oContribuinte->getCgm(), 1); } else { $this->Cell($aLarguraCelulas[0], 5, $oContribuinte->getInscricaoMunicipal(), 1); } $sCpfCnpjContribuinte = DBSeller_Helper_Number_Format::maskCPF_CNPJ($oContribuinte->getCgcCpf()); $this->Cell($aLarguraCelulas[1], 5, $sCpfCnpjContribuinte, 1); $this->Cell($aLarguraCelulas[2], 5, $sCompetencia, 1); $this->Cell($aLarguraCelulas[3], 5, $sSituacaoGuia, 1); $this->Cell($aLarguraCelulas[4], 5, $sDataFechamentoGuia, 1); $this->Ln(6); } else { // Mostra CGM ou Inscrição Municipal if ($oContribuinte->getCgm()) { $this->Cell($aLarguraCelulas[1], 5, utf8_decode('CGM / Inscrição Municipal:'), 1); } else { $this->Cell($aLarguraCelulas[1], 5, utf8_decode('Inscrição Municipal:'), 1); } $this->Cell($aLarguraCelulas[6], 5, utf8_decode('CPF / CNPJ:'), 1); $this->Cell($aLarguraCelulas[5], 5, utf8_decode('Competencia Inicial:'), 1); $this->Cell($aLarguraCelulas[5], 5, utf8_decode('Competencia Final:'), 1); $this->Cell($aLarguraCelulas[5], 5, utf8_decode('Situação:'), 1); $this->Cell(0, 5, utf8_decode('Encerramento:'), 1); $this->Ln(); $this->SetFont('Arial', NULL, 8); // Mostra CGM ou Inscrição Municipal if ($oContribuinte->getCgm()) { $this->Cell($aLarguraCelulas[1], 5, $oContribuinte->getCgm(), 1); } else { $this->Cell($aLarguraCelulas[1], 5, $oContribuinte->getInscricaoMunicipal(), 1); } $sCpfCnpjContribuinte = DBSeller_Helper_Number_Format::maskCPF_CNPJ($oContribuinte->getCgcCpf()); $sCompetenciaInicial = $iMesCompetencia['inicial'] . '/' . $iAnoCompetencia['inicial']; $sCompetenciaFinal = $iMesCompetencia['final'] . '/' . $iAnoCompetencia['final']; $this->Cell($aLarguraCelulas[6], 5, $sCpfCnpjContribuinte, 1); $this->Cell($aLarguraCelulas[5], 5, $sCompetenciaInicial, 1); $this->Cell($aLarguraCelulas[5], 5, $sCompetenciaFinal, 1); $this->Cell($aLarguraCelulas[5], 5, $sSituacaoGuia, 1); $this->Cell(0, 5, $sDataFechamentoGuia, 1); $this->Ln(6); } } else { $aLarguraCelulas = array(93, 92, 92); $this->SetFont('Arial', 'B', 8); // Mostra CGM ou Inscrição Municipal if ($oContribuinte->getCgm()) { $this->Cell($aLarguraCelulas[0], 5, utf8_decode('CGM / Inscrição Municipal:'), 1); } else { $this->Cell($aLarguraCelulas[0], 5, utf8_decode('Inscrição Municipal:'), 1); } $this->Cell($aLarguraCelulas[1], 5, utf8_decode('CPF / CNPJ:'), 1); $this->Cell($aLarguraCelulas[2], 5, utf8_decode('Mês Referência:'), 1); $this->Ln(); $this->SetFont('Arial', NULL, 8); // Mostra CGM ou Inscrição Municipal if ($oContribuinte->getCgm()) { $this->Cell($aLarguraCelulas[0], 5, $oContribuinte->getCgm(), 1); } else { $this->Cell($aLarguraCelulas[0], 5, $oContribuinte->getInscricaoMunicipal(), 1); } $this->Cell($aLarguraCelulas[1], 5, DBSeller_Helper_Number_Format::maskCPF_CNPJ($oContribuinte->getCgcCpf()), 1); $this->Cell($aLarguraCelulas[2], 5, $sCompetencia, 1); $this->Ln(6); } $this->SetFont('Arial', 'B', 8); $this->Cell(0, 5, utf8_decode('Razão Social:'), 1); $this->Ln(); $this->SetFont('Arial', NULL, 8); $this->Cell(0, 5, utf8_decode($oContribuinte->getNome()), 1); $this->Ln(6); $this->SetFont('Arial', 'B', 8); $this->Cell(242, 5, utf8_decode('Endereço:'), 1); $this->Cell(35, 5, utf8_decode('Número:'), 1); $this->Ln(); $this->SetFont('Arial', NULL, 8); $this->Cell(242, 5, utf8_decode($oContribuinte->getDescricaoLogradouro()), 1); $this->Cell(35, 5, utf8_decode($oContribuinte->getLogradouroNumero()), 1); $this->Ln(6); $this->SetFont('Arial', 'B', 8); $this->Cell(90, 5, utf8_decode('Complemento:'), 1); $this->Cell(80, 5, utf8_decode('Bairro:'), 1); $this->Cell(72, 5, utf8_decode('Cidade:'), 1); $this->Cell(35, 5, utf8_decode('Estado:'), 1); $this->Ln(); $this->SetFont('Arial', NULL, 8); $this->Cell(90, 5, utf8_decode($oContribuinte->getLogradouroComplemento()), 1); $this->Cell(80, 5, utf8_decode($oContribuinte->getLogradouroBairro()), 1); $this->Cell(72, 5, utf8_decode($oContribuinte->getDescricaoMunicipio()), 1); $this->Cell(35, 5, utf8_decode($oContribuinte->getEstado()), 1); $this->Ln(6); $oDataAtual = new DateTime(); $sEnderecoIp = $_SERVER['REMOTE_ADDR']; $this->SetFont('Arial', 'B', 8); $this->Cell(139, 5, utf8_decode("Endereço IP: {$sEnderecoIp}"), 1); $this->Cell(138, 5, utf8_decode("Data da impressão: {$oDataAtual->format('d/m/Y H:i:s')}"), 1); $this->Ln(7); }