コード例 #1
1
ファイル: GeradorBoleto.php プロジェクト: mvnp/php-boleto-pdf
 public function gerar(Boleto $boleto)
 {
     $PDF = new FPDF("P", 'mm', 'A4');
     $PDF->AddPage();
     $PDF->SetFont('Arial', '', 8);
     $PDF->Ln();
     //Select Arial bold 8
     $PDF->SetFont('Arial', 'B', 6);
     $PDF->Cell(190, 4, utf8_decode("Instrução de Impressão:"), '', 1, 'C');
     $PDF->Cell(190, 4, utf8_decode("Imprimir em impressora jato de tinta (ink jet) ou laser em qualidade normal. (Não use modo econômico)."), '', 1, 'C');
     $PDF->Cell(190, 4, utf8_decode("Utilize folha A4 (210 x 297 mm) ou carta (216 x 279 mm) - Corte na linha indicada:"), '', 1, 'C');
     $PDF->Ln();
     $PDF->SetFont('Arial', 'B', 6);
     $PDF->Cell(190, 2, 'Recibo do Sacado', '', 1, 'R');
     $PDF->SetFont('Arial', '', 12);
     $PDF->Cell(190, 2, '--------------------------------------------------------------------------------------------------------------------------------------', '', 0, 'L');
     $PDF->Ln();
     $PDF->Ln(15);
     $PDF->SetFont('Arial', '', 9);
     $PDF->Cell(50, 10, '', 'B', 0, 'L');
     $PDF->Image(Gerador::getDirImages() . $boleto->getBanco()->getLogomarca(), 10, 43, 40, 10);
     //Select Arial italic 8
     $PDF->SetFont('Arial', 'B', 14);
     $PDF->Cell(20, 10, $boleto->getBanco()->getCodigoComDigitoVerificador(), 'LBR', 0, 'C');
     $PDF->SetFont('Arial', 'B', 9);
     $PDF->Cell(120, 10, $boleto->gerarLinhaDigitavel(), 'B', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(85, 3, 'Cedente', 'LR', 0, 'L');
     $PDF->Cell(30, 3, utf8_decode('Agência/Código do Cedente'), 'R', 0, 'L');
     $PDF->Cell(15, 3, utf8_decode('Espécie'), 'R', 0, 'L');
     $PDF->Cell(20, 3, 'Quantidade', 'R', 0, 'L');
     $PDF->Cell(40, 3, utf8_decode('Carteira/Nosso número'), '', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(85, 5, utf8_decode($boleto->getSacado()->getNome()), 'BLR', 0, 'L');
     $PDF->Cell(30, 5, $boleto->getCedente()->getAgenciaComDv() . " / " . $boleto->getCedente()->getContaComDv(), 'BR', 0, 'L');
     $PDF->Cell(15, 5, $boleto->getBanco()->getEspecie(), 'BR', 0, 'L');
     $PDF->Cell(20, 5, "001", 'BR', 0, 'L');
     $PDF->Cell(40, 5, $boleto->getCarteiraENossoNumeroComDigitoVerificador(), 'B', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(60, 3, utf8_decode('Número do Documento'), 'LR', 0, 'L');
     $PDF->Cell(35, 3, 'CPF/CNPJ', 'R', 0, 'L');
     $PDF->Cell(35, 3, 'Vencimento', 'R', 0, 'L');
     $PDF->Cell(60, 3, 'Valor Documento', 'L', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(60, 5, $boleto->getNossoNumero(), 'BLR', 0, 'L');
     $PDF->Cell(35, 5, $boleto->getCedente()->getCpfCnpj(), 'BR', 0, 'L');
     $PDF->Cell(35, 5, $boleto->getDataVencimento()->format('d/m/Y'), 'BR', 0, 'L');
     $PDF->Cell(60, 5, $boleto->getValorBoleto(), 'B', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(33, 3, '(-)Desconto/Abatimentos', 'LR', 0, 'L');
     $PDF->Cell(32, 3, utf8_decode('(-)Outras deduções'), 'R', 0, 'L');
     $PDF->Cell(32, 3, '(+)Mora/Multa', 'R', 0, 'L');
     $PDF->Cell(33, 3, utf8_decode('(+)Outros acréscimos'), '', 0, 'L');
     $PDF->Cell(60, 3, '(*)Valor Cobrado', 'L', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(33, 5, '', 'BLR', 0, 'L');
     $PDF->Cell(32, 5, '', 'BR', 0, 'L');
     $PDF->Cell(32, 5, '', 'BR', 0, 'L');
     $PDF->Cell(33, 5, '', 'BR', 0, 'L');
     $PDF->Cell(60, 5, '', 'B', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(190, 3, 'Sacado', 'L', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(190, 5, utf8_decode($boleto->getSacado()->getNome()), 'L', 1, 'L');
     $PDF->Cell(190, 5, utf8_decode($boleto->getSacado()->getTipoLogradouro() . " " . $boleto->getSacado()->getEnderecoLogradouro() . ", " . $boleto->getSacado()->getNumeroLogradouro()), 'L', 1, 'L');
     $PDF->Cell(190, 5, utf8_decode($boleto->getSacado()->getCidade() . " - " . $boleto->getSacado()->getUf() . " - CEP: " . $boleto->getSacado()->getCep()), 'BL', 1, 'L');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(170, 3, utf8_decode('Instruções'), '', 0, 'L');
     $PDF->Cell(20, 3, utf8_decode('Autênticação Mecânica'), '', 1, 'R');
     $PDF->SetFont('Arial', '', 7);
     foreach ($boleto->getInstrucoes() as $instrucao) {
         $PDF->Cell(190, 5, utf8_decode($instrucao), '', 1, 'L');
     }
     $PDF->Ln();
     $PDF->SetFont('Arial', 'B', 6);
     $PDF->Cell(190, 2, 'Corte na linha pontilhada', '', 1, 'R');
     $PDF->SetFont('Arial', '', 12);
     $PDF->Cell(190, 2, '--------------------------------------------------------------------------------------------------------------------------------------', '', 0, 'L');
     $PDF->Ln(10);
     $PDF->Cell(50, 10, '', 'B', 0, 'L');
     $PDF->Image(Gerador::getDirImages() . $boleto->getBanco()->getLogomarca(), 10, 130, 40, 10);
     //Select Arial italic 8
     $PDF->SetFont('Arial', 'B', 14);
     $PDF->Cell(20, 10, $boleto->getBanco()->getCodigoComDigitoVerificador(), 'LBR', 0, 'C');
     $PDF->SetFont('Arial', 'B', 9);
     $PDF->Cell(120, 10, $boleto->gerarLinhaDigitavel(), 'B', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(130, 3, 'Local Pagamento', 'LR', 0, 'L');
     $PDF->Cell(60, 3, 'Vencimento', '', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(130, 5, utf8_decode($boleto->getBanco()->getLocalPagamento()), 'BLR', 0, 'L');
     $PDF->Cell(60, 5, $boleto->getDataVencimento()->format('d/m/Y'), 'B', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(130, 3, 'Cedente', 'LR', 0, 'L');
     $PDF->Cell(60, 3, utf8_decode('Agência/Código cedente'), '', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(130, 5, utf8_decode($boleto->getCedente()->getNome()), 'BLR', 0, 'L');
     $PDF->Cell(60, 5, $boleto->getCedente()->getAgenciaComDv() . " / " . $boleto->getCedente()->getContaComDv(), 'B', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(28, 3, 'Data Documento', 'LR', 0, 'L');
     $PDF->Cell(40, 3, utf8_decode('Número do Documento'), 'R', 0, 'L');
     $PDF->Cell(20, 3, utf8_decode('Espécie doc.'), 'R', 0, 'L');
     $PDF->Cell(20, 3, 'Aceite', 'R', 0, 'L');
     $PDF->Cell(22, 3, 'Data processamento', '', 0, 'L');
     $PDF->Cell(60, 3, utf8_decode('Carteira / Nosso número'), 'L', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(28, 5, $boleto->getDataDocumento()->format('d/m/Y'), 'BLR', 0, 'L');
     $PDF->Cell(40, 5, $boleto->getNumeroDocumento(), 'BR', 0, 'L');
     $PDF->Cell(20, 5, $boleto->getBanco()->getEspecieDocumento(), 'BR', 0, 'L');
     $PDF->Cell(20, 5, "", 'BR', 0, 'L');
     $PDF->Cell(22, 5, $boleto->getDataProcessamento()->format('d/m/Y'), 'BR', 0, 'L');
     $PDF->Cell(60, 5, $boleto->getCarteiraENossoNumeroComDigitoVerificador(), 'B', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(28, 3, 'Uso do Banco', 'LR', 0, 'L');
     $PDF->Cell(25, 3, 'Carteira', 'R', 0, 'L');
     $PDF->Cell(15, 3, utf8_decode('Espécie'), 'R', 0, 'L');
     $PDF->Cell(40, 3, 'Quantidade', 'R', 0, 'L');
     $PDF->Cell(22, 3, '(x)Valor', '', 0, 'L');
     $PDF->Cell(60, 3, '(=)Valor Documento', 'L', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(28, 5, '05/05/2014', 'BLR', 0, 'L');
     $PDF->Cell(25, 5, $boleto->getBanco()->getCarteira(), 'BR', 0, 'L');
     $PDF->Cell(15, 5, $boleto->getBanco()->getEspecie(), 'BR', 0, 'L');
     $PDF->Cell(40, 5, "001", 'BR', 0, 'L');
     $PDF->Cell(22, 5, '', 'BR', 0, 'L');
     $PDF->Cell(60, 5, $boleto->getValorBoleto(), 'B', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(130, 3, utf8_decode('Instruções'), 'L', 0, 'L');
     $PDF->Cell(60, 3, '(-)Desconto/Abatimentos', 'L', 1, 'L');
     $l = 0;
     for ($i = 0; $i < 4; $i++) {
         $instrucao = isset($boleto->getInstrucoes()[$i]) ? $boleto->getInstrucoes()[$i] : null;
         $l++;
         $PDF->Cell(130, 5, utf8_decode($instrucao), 'L', 0, 'L');
         if (1 == $l) {
             $PDF->Cell(60, 5, '', 'LB', 1, 'R');
         } else {
             if (2 == $l) {
                 $PDF->SetFont('Arial', '', 6);
                 $PDF->Cell(60, 3, utf8_decode('(-)Outras deduções'), 'L', 1, 'L');
             } else {
                 if (3 == $l) {
                     $PDF->Cell(60, 5, '', 'LB', 1, 'R');
                 } else {
                     if (4 == $l) {
                         $PDF->SetFont('Arial', '', 6);
                         $PDF->Cell(60, 3, '(+)Mora/Multa', 'L', 1, 'L');
                     }
                 }
             }
         }
     }
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(130, 5, '', 'L', 0, 'L');
     $PDF->Cell(60, 5, '', 'LB', 1, 'R');
     $PDF->Cell(130, 3, '', 'L', 0, 'L');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(60, 3, utf8_decode('(+)Outros acréscimos'), 'L', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(130, 5, '', 'L', 0, 'L');
     $PDF->Cell(60, 5, '', 'LB', 1, 'R');
     $PDF->Cell(130, 3, '', 'L', 0, 'L');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(60, 3, '(=)Valor cobrado', 'L', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(130, 5, '', 'LB', 0, 'L');
     $PDF->Cell(60, 5, '', 'LB', 1, 'R');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(190, 3, 'Sacado', 'L', 1, 'L');
     $PDF->SetFont('Arial', '', 7);
     $PDF->Cell(190, 5, utf8_decode($boleto->getSacado()->getNome()), 'L', 1, 'L');
     $PDF->Cell(190, 5, utf8_decode($boleto->getSacado()->getTipoLogradouro() . " " . $boleto->getSacado()->getEnderecoLogradouro() . ", " . $boleto->getSacado()->getNumeroLogradouro()), 'L', 1, 'L');
     $PDF->Cell(190, 5, utf8_decode($boleto->getSacado()->getCidade() . " - " . $boleto->getSacado()->getUf() . " - CEP: " . $boleto->getSacado()->getCep()), 'BL', 1, 'L');
     $PDF->SetFont('Arial', '', 6);
     $PDF->Cell(170, 3, 'Sacador/Avalista', '', 0, 'L');
     $PDF->Cell(20, 3, utf8_decode('Autênticação Mecânica - Ficha de Compensação'), '', 1, 'R');
     $this->fbarcode($boleto->getLinha(), $PDF);
     $PDF->Ln(10);
     $PDF->SetY(260);
     $PDF->SetFont('Arial', 'B', 6);
     $PDF->Cell(190, 2, 'Corte na linha pontilhada', '', 1, 'R');
     $PDF->SetFont('Arial', '', 12);
     $PDF->Cell(190, 2, '--------------------------------------------------------------------------------------------------------------------------------------', '', 0, 'L');
     return $PDF;
 }
コード例 #2
0
ファイル: Carne.php プロジェクト: mvnp/php-boleto-pdf
 /**
  * @return array
  */
 public function getBoletos()
 {
     $boletos = [];
     /**
      * @var $parcela Parcela
      */
     foreach ($this->parcelas as $parcela) {
         $boleto = new Boleto();
         $boleto->setBanco($this->getBanco());
         $boleto->setCedente($this->getCedente());
         $boleto->setSacado($this->getSacado());
         $boleto->setAvalista($this->getAvalista());
         $boleto->setNumeroDocumento($parcela->getNumeroDocumento());
         $boleto->setNossoNumero($parcela->getNossoNumero());
         $boleto->setDataVencimento($parcela->getDataVencimento());
         $boleto->setDataDocumento($this->dataDocumento);
         $boleto->setDataProcessamento($this->dataProcessamento);
         $boleto->setNumeroMoeda($this->numeroMoeda);
         $boleto->setValorBoleto($parcela->getValorBoleto());
         $boleto->setDemonstrativos($this->demonstrativos);
         $boleto->setInstrucoes($this->instrucoes);
         $boletos[] = $boleto;
     }
     return $boletos;
 }
コード例 #3
0
ファイル: Bradesco.php プロジェクト: mvnp/php-boleto-pdf
 /**
  * @param Boleto $boleto
  * @return string
  */
 public function getLinha(Boleto $boleto)
 {
     return $this->getCodigo() . $boleto->getNumeroMoeda() . $boleto->getDigitoVerificadorCodigoBarras() . $boleto->getFatorVencimento() . $boleto->getValorBoletoSemVirgula() . $boleto->getCedente()->getAgencia() . $boleto->getNossoNumeroSemDigitoVerificador() . Numero::formataNumero($boleto->getCedente()->getConta(), 7, 0) . "0";
 }
コード例 #4
0
ファイル: Caixa.php プロジェクト: mvnp/php-boleto-pdf
 /**
  * @param Boleto $boleto
  * @return string
  */
 public function getCampoLivre(Boleto $boleto)
 {
     return $boleto->getCedente()->getConta() . $boleto->getCedente()->getDvConta() . substr($this->getNossoNumeroSemDigitoVerificador($boleto), 2, 3) . $this->getCarteiraModalidade() . substr($this->getNossoNumeroSemDigitoVerificador($boleto), 5, 3) . $this->getTipoImpressao() . substr($this->getNossoNumeroSemDigitoVerificador($boleto), 8, 9);
 }
コード例 #5
0
ファイル: CodigoBarras.php プロジェクト: mvnp/php-boleto-pdf
 public function gerar(Boleto $boleto)
 {
     $generator = new BarcodeGeneratorPNG();
     echo $generator->getBarcode($boleto->getLinha(), $generator::TYPE_INTERLEAVED_2_5, 1, 49.13);
 }