Advertisement
Guest User

BoletoForm

a guest
Sep 8th, 2014
625
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.49 KB | None | 0 0
  1. <?php
  2. class BoletoForm extends TPage
  3. {
  4.     private $form;
  5.  
  6.     function __construct()
  7.     {
  8.         parent::__construct();
  9.        
  10.         $this->form = new TQuickForm;
  11.         $this->form->class = 'tform';
  12.         $this->form->style = 'width:640px';
  13.         $this->form->setFormTitle('Gerar Boleto');
  14.        
  15.         $numero       = new TEntry('nosso_numero');
  16.         $vencimento   = new TDate('data_vencimento');
  17.         $valor        = new TEntry('valor_boleto'); // Com vírgula e sempre com duas casas depois da virgula
  18.         $sacado       = new TEntry('sacado');
  19.         $endereco1       = new TEntry('endereco1');
  20.         $endereco2       = new TEntry('endereco2');
  21.         $demonstrativo   = new TText('demonstrativo');
  22.         $instrucoes        = new TText('instrucoes');
  23.         $numero->setValue('1234');
  24.         $valor->setNumericMask(2, ',', '.');
  25.         $valor->setValue('100,00');
  26.         $vencimento->setMask('dd/mm/yyyy');
  27.         $vencimento->setValue( date('d/m/Y', mktime(0, 0, 0, date("m")  , date("d")+30, date("Y")) ));
  28.         $sacado->setValue('Pedro');
  29.         $endereco1->setValue('Rua Júlio de Castilhos');
  30.         $endereco2->setValue('Porto Alegre, CEP: 88.888-888');
  31.         $demonstrativo->setValue("Pagamento inscrição ...\nMensalidade referente a .. \nBoleto Automático");
  32.         $instrucoes->setValue("- Sr. Caixa, cobrar multa de 2% após o vencimento\n- Receber até 10 dias após o vencimento\n- Em caso de dúvidas entre em contato conosco: email@email.com");
  33.  
  34.         $this->form->addQuickField('Número',        $numero,    40);
  35.         $this->form->addQuickField('Vencimento',    $vencimento, 100);
  36.         $this->form->addQuickField('Valor',         $valor, 100);
  37.         $this->form->addQuickField('Sacado',        $sacado, 200);
  38.         $this->form->addQuickField('Endereço 1',    $endereco1, 400);
  39.         $this->form->addQuickField('Endereço 2',    $endereco2, 400);
  40.         $this->form->addQuickField('Demonstrativo', $demonstrativo, 400);
  41.         $this->form->addQuickField('Instruções',    $instrucoes, 400);
  42.         $demonstrativo->setSize(400,100);
  43.         $instrucoes->setSize(400,100);
  44.        
  45.         $this->form->addQuickAction('Gerar', new TAction(array($this, 'onGenerate')), 'ico_apply.png');
  46.  
  47.         parent::add($this->form);
  48.     }
  49.  
  50.     public function onGenerate($param)
  51.     {
  52.         $data = $this->form->getData();
  53.        
  54.         TApplication::loadPage('BoletoView', 'onGenerate', (array) $data);
  55.     }
  56. }
  57. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement