Advertisement
Guest User

BoletoView

a guest
Sep 8th, 2014
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.10 KB | None | 0 0
  1. <?php
  2. class BoletoView extends TPage
  3. {
  4.     public function onGenerate($param)
  5.     {
  6.         $dadosboleto = $param;
  7.         $dadosboleto["numero_documento"] = $dadosboleto["nosso_numero"];
  8.         $dadosboleto["valor_boleto"] = str_replace(".", "",$dadosboleto["valor_boleto"]);
  9.         $dadosboleto["valor_boleto"] = str_replace(",", ".",$dadosboleto["valor_boleto"]);
  10.         $dadosboleto["valor_boleto"] = number_format($dadosboleto["valor_boleto"], 2, ',', '');
  11.         $dadosboleto["data_documento"] = date("d/m/Y"); // Data de emissão do Boleto
  12.         $dadosboleto["data_processamento"] = date("d/m/Y"); // Data de processamento do boleto (opcional)
  13.  
  14.         $demonstrativo = explode("\n", $dadosboleto['demonstrativo']);
  15.         for ($n=0; $n<=2; $n++)
  16.         {
  17.             $key = $n+1;
  18.             $texto = isset($demonstrativo[$n]) ? $demonstrativo[$n] : '';
  19.             $dadosboleto["demonstrativo{$key}"] = $texto;
  20.         }
  21.  
  22.         $instrucoes = explode("\n", $dadosboleto['instrucoes']);
  23.         for ($n=0; $n<=3; $n++)
  24.         {
  25.             $key = $n+1;
  26.             $texto = isset($instrucoes[$n]) ? $instrucoes[$n] : '';
  27.             $dadosboleto["instrucoes{$key}"] = $texto;
  28.         }
  29.        
  30.         // DADOS OPCIONAIS DE ACORDO COM O BANCO OU CLIENTE
  31.         $dadosboleto["quantidade"] = "";
  32.         $dadosboleto["valor_unitario"] = "";
  33.         $dadosboleto["aceite"] = "N";      
  34.         $dadosboleto["especie"] = "R$";
  35.         $dadosboleto["especie_doc"] = "DM";
  36.        
  37.        
  38.         // ---------------------- DADOS FIXOS DE CONFIGURAÇÃO DO SEU BOLETO --------------- //
  39.        
  40.         // DADOS DA SUA CONTA - BANCO DO BRASIL
  41.         $dadosboleto["agencia"] = "8888";
  42.         $dadosboleto["conta"] = "88888888";
  43.        
  44.         // DADOS PERSONALIZADOS - BANCO DO BRASIL
  45.         $dadosboleto["convenio"] = "888888";
  46.         $dadosboleto["contrato"] = "888888";
  47.         $dadosboleto["carteira"] = "88";
  48.         $dadosboleto["variacao_carteira"] = "-019";
  49.        
  50.         // TIPO DO BOLETO
  51.         $dadosboleto["formatacao_convenio"] = "7";
  52.         $dadosboleto["formatacao_nosso_numero"] = "2";
  53.  
  54.         // SEUS DADOS
  55.         $dadosboleto["identificacao"] = "Sacador";
  56.         $dadosboleto["cpf_cnpj"] = "12.222.333/0001-24";
  57.         $dadosboleto["endereco"] = "Av. Bento Gonçalves, 123. Bairro Centro - Cep 88.888-888";
  58.         $dadosboleto["cidade_uf"] = "Porto Alegre - RS";
  59.         $dadosboleto["cedente"] = "Empresa LTDA - ME";
  60.  
  61.         ob_start();
  62.         if (!isset($_GET['print']) OR ($_GET['print'] !== '1'))
  63.         {
  64.             $url = $_SERVER['QUERY_STRING'];
  65.             echo "<center> <a href='' onclick='window.open(\"engine.php?{$url}&print=1\")'> <h1>Clique aqui para Imprimir</h1></a> </center>";
  66.         }
  67.  
  68.         include("app/lib/boleto/include/funcoes_bb.php");
  69.         include("app/lib/boleto/include/layout_bb.php");
  70.         if (isset($_GET['print']) AND ($_GET['print'] === '1'))
  71.         {
  72.             echo '<script>window.print();</script>';
  73.         }
  74.         $content = ob_get_clean();
  75.        
  76.         parent::add($content);
  77.     }
  78. }
  79. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement