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(110, 30, utf8_decode(""), 1, 0, 'L');
  15. $this->SetFont('Arial', 'B', 12);
  16. $this->SetY("15");
  17. $this->SetX("13");
  18. $this->Cell(100, 0, utf8_decode($obj->get_empresa('nome')), 0, 0, 'C');// tenstando se chama o id ------------
  19. $this->SetFont('Arial', '', 9);
  20. $this->SetX("13");
  21. $this->Cell(100, 15, utf8_decode($obj->get_empresa('endereco')." - ".$obj->get_empresa('bairro')." - ".$obj->get_empresa('cidade')), 0, 1, 'C');
  22. $this->SetX("13");
  23. $this->Cell(100, -5, utf8_decode("Fone: ".$obj->get_empresa('telefone')." / ".$obj->get_empresa('celular').""), 0, 1, 'C');
  24. $this->SetX("13");
  25. $this->Cell(100, 13, utf8_decode($obj->get_empresa('website')), 0, 1, 'C');
  26. $this->SetX("13");
  27. $this->Cell(100, -2, utf8_decode("CNPJ: " . $obj->get_empresa('cnpj') ), 0, 1, 'C');
  28. // FIM LADO ESQUERDO
  29. // ====================================================================
  30. // ====================================================================
  31. // INICIO LADO DIREITO
  32. $this->SetY("10");
  33. $this->SetX("130");
  34. $this->Cell(70, 30, utf8_decode(""), 1, 0, 'R');
  35. $this->SetFont('Arial', 'B', 12);
  36. $this->SetY("15");
  37. $this->SetX("130");
  38. $this->Cell(70, 0, utf8_decode(""), 0, 1, 'C');
  39. $this->SetY("17");
  40. $this->SetX("130");
  41. $this->Cell(0, 7, utf8_decode("Nota de Locação"), 0, 1, 'C');
  42. $this->SetX("130");
  43. $this->Cell(0, 7, utf8_decode("Nº: ". $obj->cod), 0, 1, '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(190, 5, utf8_decode(""), 1, 1, '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(150, 5, utf8_decode("CLIENTE: " . $obj->get_clientes_nome_empresa() ), 0, 0, 'L');
  65. }else{
  66. $this->Cell(120, 5, utf8_decode("CLIENTE: " . $obj->get_clientes_nome_empresa() ), 0, 0, 'L');
  67. }
  68. $this->Cell(0, 5, utf8_decode("CNPJ: " . $obj->get_clientes_empresa_cnpj() ), 0, 1, 'L');
  69. $this->Cell(190, 5, utf8_decode("ENDEREÇO: " . $obj->get_clientes_empresa_endereco() ), 1, 1, 'L');
  70. //------------------------------------------------------------
  71. //
  72. //---------------------CAMPO DAS INFORMAÇÕES-----------------------------
  73. $this->SetY("55");
  74. $this->Cell(190, 5, utf8_decode(""), 1, 1, 'L');
  75. //---------------------FIM DO CAMPO ------------------------------------
  76. //
  77. //------------------------------------------------------------
  78. $this->SetY("55");
  79. $this->Cell(120, 5, utf8_decode("CIDADE: " . $obj->get_clientes_empresa_cidade()), 0, 0, 'L');
  80. $this->Cell(0, 5, utf8_decode("ESTADO: " . $obj->get_clientes_empresa_estado()), 0, 1, 'L');
  81. //------------------------------------------------------------
  82. //
  83. //---------------------CAMPO DAS INFORMAÇÕES-----------------------------
  84. $this->SetY("60");
  85. $this->Cell(190, 5, utf8_decode(""), 1, 1, 'L');
  86. //---------------------FIM DO CAMPO ------------------------------------
  87. //
  88. //------------------------------------------------------------
  89. $this->SetY("60");
  90. $this->Cell(90, 5, utf8_decode("CNPJ(MF): " . $obj->get_clientes_empresa_cnpj()), 0, 0, '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(0, 5, utf8_decode("INSC. EST/MUN.:".$insc_est.'/'.$insc_mun), 0, 1, 'L');
  102. //------------------------------------------------------------
  103. //
  104. $this->Cell(190, 5, utf8_decode("CONDIÇÕES DE PAGAMENTO: "), 1, 1, 'L');
  105. //
  106. //---------------------CAMPO DAS INFORMAÇÕES-----------------------------
  107. $this->SetY("70");
  108. $this->Cell(190, 8, utf8_decode(""), 1, 1, 'L');
  109. //---------------------FIM DO CAMPO ------------------------------------
  110. //
  111. //$this->SetFont('Arial', 'B', 8);
  112. $this->SetY("73");
  113. $this->Cell(110, 5, utf8_decode("NATUREZA DA OPERAÇÃO: LOCAÇÃO BENS MÓVEIS "), 0, 0, 'L');
  114. $this->Cell(0, 5, strtoupper(utf8_decode($obj->get_empresa('cidade')."/".$obj->get_empresa('estado')." : ".$obj->dia." DE ". $obj->mes ." DE ".$obj->ano)), 0, 1, '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(20, 10, utf8_decode("QUANT."), 1, 0, 'C');
  125. $this->Cell(20, 10, utf8_decode("UNID."), 1, 0, 'C');
  126. $this->Cell(100, 10, utf8_decode("DISCRIMINAÇÃO DA LOCAÇÃO"), 1, 0, 'C');
  127. $this->Cell(50, 5, utf8_decode("PREÇOS"), 1, 1, 'C');
  128. $this->SetX("150");
  129. $this->Cell(25, 5, utf8_decode("UNITÁRIO"), 1, 0, 'C');
  130. $this->Cell(25, 5, utf8_decode("TOTAL"), 1, 1, '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(20, 5, utf8_decode($dado->quantidade), 1, 0, 'C');
  138. $this->Cell(20, 5, utf8_decode($dado->unidade), 1, 0, 'C');
  139. $this->Cell(100, 50, utf8_decode($dado->discriminacao), 1, 0, 'C');
  140. $this->Cell(25, 5, utf8_decode($dado->vlunitario), 1, 0, 'C');
  141. $this->Cell(25, 5, utf8_decode($dado->vltotal), 1, 1, 'C');
  142. }else{
  143. $this->Cell(20, 5, utf8_decode(""), 1, 0, 'C');
  144. $this->Cell(20, 5, utf8_decode(""), 1, 0, 'C');
  145. $this->Cell(100, 5, utf8_decode(""), 1, 0, 'C');
  146. $this->Cell(25, 5, utf8_decode(""), 1, 0, 'C');
  147. $this->Cell(25, 5, utf8_decode(""), 1, 1, 'C');
  148. }
  149. $i++;
  150. # code...
  151. }
  152. $this->SetFont('Arial', 'B', 10);
  153. $this->Cell(110, 15, utf8_decode("RECEBI DA EMPRESA ACIMA CITADA A IMPORTÂNCIA DE: "), 0, 0, 'L');
  154. $this->Cell(20, 15, utf8_decode("TOTAL R$: "), 0, 0, 'L');
  155. $this->SetY("197.8");
  156. $this->SetX("140");
  157. $this->Cell(25, 5, utf8_decode(""), 1, 1, '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. $this->SetY("208");
  160. $this->SetFont('Arial', 'B', 7);
  161. $this->MultiCell(190, 5, utf8_decode("".$texto),1,'C', false);
  162. $this->Cell(0, 8, utf8_decode(""), 0, 1, 'L');
  163. $this->Cell(190, 0, utf8_decode(""), 1, 1, 'L');
  164. $this->Cell(0, 8, utf8_decode(""), 0, 1, 'L');
  165. $texto2 = "Recebemos da ".$obj->get_empresa('nome').", os serviços constantes desta NOTA DE LOCAÇÂO.";
  166. $this->SetFont('Arial', 'B', 10);
  167. $this->MultiCell(70, 5, utf8_decode("".$texto2),1,'C', false);
  168. $this->SetY("234");
  169. $this->SetX("80");
  170. $this->Cell(70, 15, utf8_decode(""), 1, 0, 'C');
  171. $this->SetY("235");
  172. $this->SetX("82");
  173. $this->Cell(70, 5, utf8_decode("DATA _____/_____/_____"), 0, 1, 'C');
  174. $this->SetY("242");
  175. $this->SetX("80");
  176. $this->Cell(70, 5, utf8_decode("____________________________"), 0, 1, 'C');
  177. $this->SetY("234");
  178. $this->SetX("150");
  179. $this->Cell(50, 15, utf8_decode(""), 1, 0, 'C');
  180. $this->SetY("238");
  181. $this->SetX("135");
  182. $this->Cell(80, 7, utf8_decode("Nº: ".$obj->cod), 0, 1, 'C');
  183. TTransaction::close();
  184. }
  185. function Footer() {
  186. }
  187. }
  188. $pdf = new RelatorioNotaFiscalPDF("P", "mm", "A4");
  189. $pdf->SetTitle(utf8_decode("NOTA FISCAL LOCADORA"));
  190. $pdf->SetSubject("RELATÓRIO DE NOTA FISCAL");
  191. $pdf->AliasNbPages();
  192. $pdf->AddPage();
  193. $pdf->SetFont('Times', '', 12);
  194. $pdf->ColumnDetail();
  195. $file = "app/reports/RelatorioNotaFiscalPDF.pdf";
  196. //abrir pdf
  197. $pdf->Output($file);
  198. ?>


Curso Dominando o Adianti Framework

O material mais completo de treinamento do Framework.
Curso em vídeo aulas + Livro completo + Códigos fontes do projeto ERPHouse.
Conteúdo Atualizado!


Dominando o Adianti Framework 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