Lançado Adianti Framework 7.6!
Clique aqui para saber mais
Quebra de linhas Boa noite, preciso quebrar linha nesse código. Quando coloco o multicell ele buga tudo ...
LH
Quebra de linhas  
Boa noite, preciso quebrar linha nesse código. Quando coloco o multicell ele buga tudo

  1. <?php
  2. //use FDPF;
  3. use Adianti\Database\TTransaction;
  4. use Adianti\Database\TRepository;
  5. use Adianti\Database\TCriteria;
  6. use Adianti\Database\TFilter;
  7. class RelatorioNotaFiscalPDF extends FPDF{
  8.     function Header() {
  9.         TTransaction::open('database');
  10.         $id $_REQUEST['id'];
  11.         $obj = new GerarNotaRecord($id);
  12.         // ====================================================================
  13.         // INICIO LADO ESQUERDO
  14.         $this->Cell(11030utf8_decode(""), 10'L');
  15.         $this->SetFont('Arial''B'12);
  16.         $this->SetY("15");
  17.         $this->SetX("13");
  18.         $this->Cell(1000utf8_decode($obj->get_empresa('nome')), 00'C');// tenstando se chama o id ------------
  19.         $this->SetFont('Arial'''9);
  20.         $this->SetX("13");
  21.         $this->Cell(10015utf8_decode($obj->get_empresa('endereco')." - ".$obj->get_empresa('bairro')." - ".$obj->get_empresa('cidade')), 01'C');
  22.         $this->SetX("13");
  23.         $this->Cell(100, -5utf8_decode("Fone: ".$obj->get_empresa('telefone')." / ".$obj->get_empresa('celular').""), 01'C');
  24.         $this->SetX("13");
  25.         $this->Cell(10013utf8_decode($obj->get_empresa('website')), 01'C');
  26.         $this->SetX("13");
  27.         $this->Cell(100, -2utf8_decode("CNPJ: " $obj->get_empresa('cnpj') ), 01'C');
  28.         // FIM LADO ESQUERDO
  29.         // ====================================================================
  30.         // ====================================================================
  31.         // INICIO LADO DIREITO
  32.         $this->SetY("10");
  33.         $this->SetX("130");
  34.         $this->Cell(7030utf8_decode(""), 10'R');
  35.         $this->SetFont('Arial''B'12);
  36.         $this->SetY("15");
  37.         $this->SetX("130");
  38.         $this->Cell(700utf8_decode(""), 01'C');
  39.         $this->SetY("17");
  40.         $this->SetX("130");
  41.         $this->Cell(07utf8_decode("Nota de Locação"), 01'C');
  42.         $this->SetX("130");
  43.         $this->Cell(07utf8_decode("Nº: "$obj->cod), 01'C');
  44.         // FIM LADO DIREITO
  45.         // ====================================================================
  46.         TTransaction::close();
  47.         $this->Ln();
  48.         $this->ColumnHeader();
  49.         $this->Ln();
  50.     }
  51.     function ColumnHeader() {
  52.         TTransaction::open('database');
  53.         $id $_REQUEST['id'];
  54.         $obj = new GerarNotaRecord($id);
  55. //---------------------CAMPO DAS INFORMAÇÕES-----------------------------
  56.         $this->SetY("45");
  57.         $this->Cell(1905utf8_decode(""), 11'L');
  58. //---------------------FIM DO CAMPO  ------------------------------------
  59. //
  60. //------------------------------------------------------------ 
  61.         $this->SetY("45.1");
  62.         $this->SetFont('Arial''B'8);
  63.         if( strlen($obj->get_clientes_nome_empresa()) >= 70){
  64.             $this->Cell(1505utf8_decode("CLIENTE:  " $obj->get_clientes_nome_empresa() ), 00'L');
  65.         }else{
  66.             $this->Cell(1205utf8_decode("CLIENTE:  " $obj->get_clientes_nome_empresa() ), 00'L');
  67.         }
  68.         $this->Cell(05utf8_decode("CNPJ:  " $obj->get_clientes_empresa_cnpj() ), 01'L');
  69.         $this->Cell(1905utf8_decode("ENDEREÇO:  " $obj->get_clientes_empresa_endereco() ), 11'L');
  70. //------------------------------------------------------------ 
  71. //
  72. //---------------------CAMPO DAS INFORMAÇÕES-----------------------------
  73.         $this->SetY("55");
  74.         $this->Cell(1905utf8_decode(""), 11'L');
  75. //---------------------FIM DO CAMPO  ------------------------------------
  76. //
  77. //------------------------------------------------------------        
  78.         $this->SetY("55");
  79.         $this->Cell(1205utf8_decode("CIDADE:  " $obj->get_clientes_empresa_cidade()), 00'L');
  80.         $this->Cell(05utf8_decode("ESTADO:  " $obj->get_clientes_empresa_estado()), 01'L');
  81. //------------------------------------------------------------
  82. //
  83. //---------------------CAMPO DAS INFORMAÇÕES-----------------------------
  84.         $this->SetY("60");
  85.         $this->Cell(1905utf8_decode(""), 11'L');
  86. //---------------------FIM DO CAMPO  ------------------------------------
  87. //
  88. //------------------------------------------------------------        
  89.         $this->SetY("60");
  90.         $this->Cell(905utf8_decode("CNPJ(MF):  " $obj->get_clientes_empresa_cnpj()), 00'L');
  91.         if(is_null($obj->get_clientes_empresa_inscricaoestadual())){
  92.             $insc_est ' - ';
  93.         }else{
  94.             $insc_est $obj->get_clientes_empresa_inscricaoestadual();
  95.         }
  96.         if(is_null($obj->get_clientes_empresa_inscricaomunicipal())){
  97.             $insc_mun ' - ';
  98.         }else{
  99.             $insc_mun $obj->get_clientes_empresa_inscricaomunicipal();
  100.         }
  101.         $this->Cell(05utf8_decode("INSC. EST/MUN.:".$insc_est.'/'.$insc_mun), 01'L');
  102. //------------------------------------------------------------
  103. //
  104.         $this->Cell(1905utf8_decode("CONDIÇÕES DE PAGAMENTO:  "), 11'L');
  105. //
  106. //---------------------CAMPO DAS INFORMAÇÕES-----------------------------
  107.         $this->SetY("70");
  108.         $this->Cell(1908utf8_decode(""), 11'L');
  109. //---------------------FIM DO CAMPO  ------------------------------------
  110. //
  111.         //$this->SetFont('Arial', 'B', 8);
  112.         $this->SetY("73");
  113.         $this->Cell(1105utf8_decode("NATUREZA DA OPERAÇÃO: LOCAÇÃO BENS MÓVEIS "), 00'L');
  114.         $this->Cell(05strtoupper(utf8_decode($obj->get_empresa('cidade')."/".$obj->get_empresa('estado')." : ".$obj->dia." DE "$obj->mes ." DE ".$obj->ano)), 01'R');
  115.         TTransaction::close();
  116.     }
  117.     function ColumnDetail()
  118.     {
  119.         TTransaction::open('database');
  120.         $id $_REQUEST['id'];
  121.         $obj = new GerarNotaRecord($id);
  122.         $locacoes $obj->get_locacao();
  123.         $this->SetFont('Arial''B'8);
  124.         $this->Cell(2010utf8_decode("QUANT."), 10'C');
  125.         $this->Cell(2010utf8_decode("UNID."), 10'C');
  126.         $this->Cell(10010utf8_decode("DISCRIMINAÇÃO DA LOCAÇÃO"), 10'C');
  127.         $this->Cell(505utf8_decode("PREÇOS"), 11'C');
  128.         $this->SetX("150");
  129.         $this->Cell(255utf8_decode("UNITÁRIO"), 10'C');
  130.         $this->Cell(255utf8_decode("TOTAL"), 11'C');
  131.         $i 0;
  132.         $aux count($locacoes);
  133.         while ($i $aux) {
  134.             $this->SetFont('Arial''B'8);
  135.             if($i $aux){
  136.                 $dado $locacoes[$i];
  137.                 $this->Cell(205utf8_decode($dado->quantidade), 10'C');
  138.                 $this->Cell(205utf8_decode($dado->unidade), 10'C');
  139.                 $this->Cell(10050utf8_decode($dado->discriminacao), 10'C');
  140.                 $this->Cell(255utf8_decode($dado->vlunitario), 10'C');
  141.                 $this->Cell(255utf8_decode($dado->vltotal), 11'C');
  142.             }else{
  143.                 $this->Cell(205utf8_decode(""), 10'C');
  144.                 $this->Cell(205utf8_decode(""), 10'C');
  145.                 $this->Cell(1005utf8_decode(""), 10'C');
  146.                 $this->Cell(255utf8_decode(""), 10'C');
  147.                 $this->Cell(255utf8_decode(""), 11'C');
  148.             }
  149.             $i++;
  150.             # code...
  151.         }
  152.         $this->SetFont('Arial''B'10);
  153.         $this->Cell(11015utf8_decode("RECEBI DA EMPRESA ACIMA CITADA A IMPORTÂNCIA DE: "), 00'L');
  154.         $this->Cell(2015utf8_decode("TOTAL R$: "), 00'L');
  155.         $this->SetY("197.8");
  156.         $this->SetX("140");
  157.         $this->Cell(255utf8_decode(""), 11'L');
  158.         $texto "ESTE RECIBO SUBSTITUI PARA TODOS OS EFEITOS LEGAIS A NOTA FISCAL DE SERVIÇOS, POR SE TRATAR DE LOCAÇÃO DE BENS MÓVEIS, DE ACORDO COM LEGISLAÇÃO EM VIGOR (LCF Nº 116 de 31/10/2003 e LCM Nº 50 de 29/12/2003).";
  159.         
  160.         $this->SetY("208");
  161.         $this->SetFont('Arial''B'7);
  162.         $this->MultiCell(1905utf8_decode("".$texto),1,'C'false);
  163.         $this->Cell(08utf8_decode(""), 01'L');
  164.         $this->Cell(1900utf8_decode(""), 11'L');
  165.         $this->Cell(08utf8_decode(""), 01'L');
  166.         $texto2 "Recebemos da ".$obj->get_empresa('nome').", os serviços constantes desta NOTA DE LOCAÇÂO.";
  167.         $this->SetFont('Arial''B'10);
  168.         $this->MultiCell(705utf8_decode("".$texto2),1,'C'false);
  169.         $this->SetY("234");
  170.         $this->SetX("80");
  171.         $this->Cell(7015utf8_decode(""), 10'C');
  172.         $this->SetY("235");
  173.         $this->SetX("82");
  174.         $this->Cell(705utf8_decode("DATA _____/_____/_____"), 01'C');
  175.         $this->SetY("242");
  176.         $this->SetX("80");
  177.         $this->Cell(705utf8_decode("____________________________"), 01'C');
  178.         
  179.         $this->SetY("234");
  180.         $this->SetX("150");
  181.         $this->Cell(5015utf8_decode(""), 10'C'); 
  182.         
  183.         $this->SetY("238");
  184.         $this->SetX("135");
  185.         $this->Cell(807utf8_decode("Nº: ".$obj->cod), 01'C');
  186.         TTransaction::close();
  187.     }
  188.     function Footer() {
  189.     }
  190. }
  191. $pdf = new RelatorioNotaFiscalPDF("P""mm""A4");
  192. $pdf->SetTitle(utf8_decode("NOTA FISCAL LOCADORA"));
  193. $pdf->SetSubject("RELATÓRIO DE NOTA FISCAL");
  194. $pdf->AliasNbPages();
  195. $pdf->AddPage();
  196. $pdf->SetFont('Times'''12);
  197. $pdf->ColumnDetail();
  198. $file "app/reports/RelatorioNotaFiscalPDF.pdf";
  199. //abrir pdf
  200. $pdf->Output($file);
  201. ?>


Curso completo Meu Negócio Pronto
Use para si, ou transforme em um negócio: Inclui aulas e códigos-fontes
Gestor de conteúdo (SITE) + Loja Virtual (E-Commerce) + Emissor de Notas para infoprodutos


Meu negócio pronto Quero me inscrever agora!

Comentários (2)


NR

O que quer dizer com buga tudo? Provavelmente será necessário acertar a altura das demais células de acordo com a quantidade de linhas usadas pela multicell.
CM

Luis, sei que o post é antigo.
Mas poderia informar como fez para coloca a data na forma de dia , mês e ano como fez nesse código acima?

Tipo:

.$obj->dia." DE ". $obj->mes ." DE ".$obj->ano

Obrigado