/**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_clienteRegistro Detalhe');
     // creates a table
     $table = new TTable();
     $panel = new TPanel(480, 260);
     $notebook = new TNotebook(500, 250);
     // add the notebook inside the form
     $this->form->add($notebook);
     // add the notebook inside the form
     $this->form->add($table);
     // create the form fields
     $city_id2 = new TSeekButton('city_id2');
     $city_name2 = new TEntry('city_name2');
     $city_id2->setSize(100);
     $city_name2->setEditable(FALSE);
     //dados do cliente CRM
     TTransaction::open('db_crmbf');
     $criteria = new TCriteria();
     $criteria->add(new TFilter('cliente_id', '=', $_GET['key']));
     //
     $repository = new TRepository('CRM');
     $CRM = $repository->load($criteria);
     foreach ($CRM as $crms) {
         $codigoCRM = $crms->id;
         $tituloCRM = $crms->titulo;
         $projetoCRM = $crms->projeto_nome;
         $dataCRM = $crms->data_crm;
         $tempoCRM = $crms->tempo;
         $porcentagemCRM = $crms->porcentagem;
         $descricaoCRM = $crms->descricao;
         $solicitanteCRM = $crms->solicitante;
         $usuarioalteracaoCRM = $crms->usuarioalteracao;
         $responsavel_nomeCRM = $crms->responsavel_nome;
         $tipo_nomeCRM = $crms->tipo_nome;
         $cliente_nomeCRM = $crms->cliente_nome;
         $prioridade_nomeCRM = $crms->prioridade_nome;
         $status_nomeCRM = $crms->status_nome;
     }
     TTransaction::close();
     $notebook->appendPage('Registros CRMs', $table);
     $code = new TEntry('id');
     $crm_id = new TDBCombo('crm_id', 'db_crmbf', 'CRM', 'id', 'titulo');
     $tiporegistro_id = new TDBCombo('tiporegistro_id', 'db_crmbf', 'RegistroTipo', 'id', 'nome');
     $registro = new TText('registro');
     $temporegistro = new TEntry('tempo_registro');
     //        $temporegistro->setEditable(false);
     $dataregistro = new TDate('data_registro');
     $hora_registro = new TEntry('hora_registro');
     $numero_registro = new TEntry('numero_registro');
     // define some properties for the form fields
     $code->setEditable(FALSE);
     $code->setSize(100);
     $crm_id->setSize(320);
     $crm_id->setEditable(FALSE);
     $registro->setSize(320);
     $temporegistro->setSize(160);
     //$temporegistro->setValue(date("d/m/Y H:i:s"));
     $tiporegistro_id->setSize(160);
     //$dataregistro->setRange(0,1000,1);
     $dataregistro->setSize(90);
     // $hora_registro->setRange(0,100,1);
     $hora_registro->setSize(150);
     $hora_registro->setTip('Horario EX: 8:14');
     $numero_registro->setSize(320);
     $row = $table->addRow();
     $row->addCell(new TLabel('Code:'));
     $row->addCell($code);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel('CRM Titulo:'));
     $cell = $row->addCell($crm_id);
     // add a row for the field Telefone
     $row = $table->addRow();
     $row->addCell(new TLabel('Tipo Registro:'));
     $cell = $row->addCell($tiporegistro_id);
     // add a row for the field Email
     $row = $table->addRow();
     $row->addCell(new TLabel('Tempo:'));
     $cell = $row->addCell($temporegistro);
     // add a row for the field celular
     $row = $table->addRow();
     $row->addCell(new TLabel('Data:'));
     $cell = $row->addCell($dataregistro);
     // add a row for the field skype
     $row = $table->addRow();
     $row->addCell(new TLabel('Hora:'));
     $cell = $row->addCell($hora_registro);
     // add a row for the field endereco
     $row = $table->addRow();
     $row->addCell(new TLabel('Numero Registro:'));
     $row->addCell($numero_registro);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel('Registro:'));
     $cell = $row->addCell($registro);
     // $notebook->appendPage('Cidade', $table_contact);
     //        $notebook->appendPage('Skill (aggregation)', $table_skill);
     // create the form fields
     //        $code = new TEntry('id');
     //        $nome = new TEntry('nome');
     //        $email = new TEntry('email');
     //        $telefone = new TEntry('telefone');
     //        $celular = new TEntry('celular');
     //        $skype = new TEntry('skype');
     //        $endereco = new TEntry('endereco');
     ////        $cidade_id = new TSeekButton('cidade_id');
     //        $cidade_id = new TDBCombo('cidade_id', 'db_crmbf', 'Cidade', 'id', 'nome');
     //        $birthdate = new TDate('birthdate');
     //        $email = new TEntry('email');
     //        $gender = new TRadioGroup('gender');
     //        $status = new TCombo('status');
     //        $contacts_list = new TMultiField('contacts_list');
     // add field validators
     //        $nome->addValidation('Nome', new TRequiredValidator);
     //        $cidade_id->addValidation('Cidade', new TRequiredValidator);
     // $birthdate->addValidation('Birthdate', new TRequiredValidator);
     //        $cidade_id->addValidation('Category', new TRequiredValidator);
     //$obj = new CidadeFormList;
     //$cidade_id->setAction(new TAction(array($obj, 'onReload')));
     //        $itemGender = array();
     //        $itemGender['M'] = 'Male';
     //        $itemGender['F'] = 'Female';
     //        // add the combo options
     //        $gender->addItems($itemGender);
     //        $gender->setLayout('horizontal');
     //
     //        $itemStatus = array();
     //        $itemStatus['S'] = 'Single';
     //        $itemStatus['C'] = 'Committed';
     //        $itemStatus['M'] = 'Married';
     //        $status->addItems($itemStatus);
     // define some properties for the form fields
     //        $code->setEditable(FALSE);
     //        $code->setSize(100);
     //        $nome->setSize(320);
     //        $email->setSize(160);
     //        $telefone->setSize(160);
     //        $celular->setSize(160);
     //        $skype->setSize(160);
     //        $endereco->setSize(320);
     //        $cidade_id->setSize(150);
     //$cidade_id->setEditable(FALSE);
     // add a row for the field code
     $panel->put("CRM: ", $codigoCRM, 10, 5);
     $panel->put($tituloCRM, 10, 20);
     $panel->put($projetoCRM, 10, 40);
     $panel->put("Data de Criação: " . $dataCRM, 10, 75);
     $panel->put("Aberto por: " . $usuarioalteracaoCRM, 10, 95);
     $panel->put("Cliente: " . $cliente_nomeCRM, 10, 55);
     $panel->put("Responsavel: " . $responsavel_nomeCRM, 10, 110);
     $panel->put("Tipo: " . $tipo_nomeCRM, 10, 130);
     $panel->put("Percentual Conclusão: " . $porcentagemCRM, 10, 140);
     $panel->put("Tempo Gasto: " . $tempoCRM, 10, 160);
     $panel->put("Situação: " . $status_nomeCRM, 10, 180);
     $panel->put("Descrição: " . $descricaoCRM, 10, 200);
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Titulo:'));
     //        $row->addCell($tituloCRM);
     //
     //        // add a row for the field name
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Projeto:'));
     //        $cell = $row->addCell($projetoCRM);
     //        $cell->colspan = 3;
     //
     //        // add a row for the field Email
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('DATA:'));
     //        $cell = $row->addCell($dataCRM);
     //        $cell->colspan = 3;
     //
     //        // add a row for the field Telefone
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Tempo:'));
     //        $cell = $row->addCell($tempoCRM);
     //        $cell->colspan = 3;
     //
     //        // add a row for the field celular
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Porcentagem:'));
     //        $cell = $row->addCell($porcentagemCRM);
     //
     //        // add a row for the field skype
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Solicitação:'));
     //        $cell = $row->addCell($solicitanteCRM);
     //        // add a row for the field endereco
     //        $row = $table_data->addRow();
     //        $row->addCell(new TLabel('Endereço:'));
     //        $row->addCell($endereco);
     //
     //        // add a row for the field endereco
     //        $row = $table_data->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $row->addCell($cidade_id);
     // add a row for the field Category
     //        $row = $table_data->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $cell = $row->addCell($cidade_id);
     // add a row for the field city
     //        $row=$table_data->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $cell = $row->addCell($cidade_id);
     /*
      // add a row for the field Phone
      $row = $table_data->addRow();
      $row->addCell(new TLabel('Phone:'));
      $row->addCell($phone);
     
      // add a row for the field BirthDate
      $row->addCell(new TLabel('BirthDate:'));
      $row->addCell($birthdate);
     
      // add a row for the field status
      $row = $table_data->addRow();
      $row->addCell(new TLabel('Status:'));
      $cell = $row->addCell($status);
     
      // add a row for the field Email
      $row->addCell(new TLabel('Email:'));
      $cell = $row->addCell($email);
     
      // add a row for the field gender
      $row->addCell(new TLabel('Gender:'));
      $row->addCell($gender);
     
      $row = $table_contact->addRow();
      $cell = $row->addCell(new TLabel('<b>Contact</b>'));
      $cell->valign = 'top';
     
      // add two fields inside the multifield in the second sheet
      $contacts_list->setHeight(100);
      $contacts_list->setClass('Contact'); // define the returning class
      $contacts_list->addField('type', 'Contact Type: ', new TEntry('type'), 200);
      $contacts_list->addField('value', 'Contact Value: ', new TEntry('value'), 200);
      $row = $table_contact->addRow();
      $row->addCell($contacts_list);
     
      // create the radio button for the skills list
      $skill_list = new TDBCheckGroup('skill_list', 'samples', 'Skill', 'id', 'name');
      $table_skill->addRow()->addCell($lbl = new TLabel('Skills'));
      $table_skill->addRow()->addCell($skill_list);
      $lbl->setFontStyle('b');
     
     * 
     */
     // create an action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     // create an action button (go to list)
     $button2 = new TButton('list');
     $button2->setAction(new TAction(array('ClienteList', 'onReload')), 'Ir para Listagem');
     $button2->setImage('ico_datagrid.gif');
     // create an action button
     $button3 = new TButton('action3');
     $action3 = new TAction(array('RegistroForm', 'onEdit'));
     $action3->setParameter('fk', $codigoCRM);
     $button3->setImage('ico_save.png');
     $button3->setAction($action3, 'Inserir Registro');
     // define wich are the form fields
     $this->form->setFields(array($code, $crm_id, $registro, $temporegistro, $tiporegistro_id, $dataregistro, $hora_registro, $numero_registro, $button1, $button2, $button3));
     $subtable = new TTable();
     $row = $subtable->addRow();
     $row->addCell($button1);
     $row->addCell($button2);
     $row->addCell($button3);
     $table_layout = new TTable();
     $table_layout->addRow()->addCell($this->form);
     $table_layout->addRow()->addCell($subtable);
     //         // add a row for the field gender
     //          $row->addCell(new TLabel('Gender:'));
     //          $row->addCell($registroREG);
     //
     //        // add a row for the field Category
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $cell = $row->addCell($registroREG);
     // add the form inside the page
     parent::add($panel);
     parent::add($table_layout);
     // creates the form
     $this->form2 = new TForm('form_clienteRegistro Detalhe');
     //dados do cliente CRM
     TTransaction::open('db_crmbf');
     $criteria2 = new TCriteria();
     // $criteria->add(new TFilter('crm_id', '=', $_GET['key']));
     $criteria2->setProperty('order', 'id desc');
     $repository2 = new TRepository('Registro');
     $reg = $repository2->load($criteria2);
     foreach ($reg as $regs) {
         $row = $table->addRow();
         $row->addCell(new TLabel('ID:'));
         $cell = $row->addCell($regs->id);
         $row = $table->addRow();
         $row->addCell(new TLabel('CRM:'));
         $cell = $row->addCell($regs->crm_id);
         $row = $table->addRow();
         $row->addCell(new TLabel('CRM:'));
         $cell = $row->addCell($regs->tiporegistro_id);
         $row = $table->addRow();
         $row->addCell(new TLabel('Tempo:'));
         $cell = $row->addCell($regs->tempo_registro);
         $row = $table->addRow();
         $row->addCell(new TLabel('Data:'));
         $cell = $row->addCell($regs->data_registro);
         $row = $table->addRow();
         $row->addCell(new TLabel('Horario:'));
         $cell = $row->addCell($regs->hora_registro);
         $row = $table->addRow();
         $row->addCell(new TLabel('Numero Registro:'));
         $cell = $row->addCell($regs->numero_registro);
         $row = $table->addRow();
         $row->addCell(new TLabel('Registro:'));
         $cell = $row->addCell($regs->registro);
         $row = $table->addRow();
         $row->addCell(new TLabel(' '));
         $cell = $row->addCell(' ');
         //            $idREG = $regs->id;
         //            $crm_idREG = $regs->crm_id;
         //            $tiporegistro_idREG = $regs->tiporegistro_id;
         //            $tempoREG = $regs->tempo_registro;
         //            $dataREG = $regs->data_registro;
         //            $horaREG = $regs->hora_registro;
         //            $numRegistroREG = $regs->numero_registro;
         //            $registroREG = $regs->registro;
     }
     TTransaction::close();
 }
Exemplo n.º 2
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_Ticket');
     $this->form->class = 'tform';
     // CSS class
     $table = new TTable();
     $table->style = 'width: 600px';
     $tablePagamento = new TTable();
     $tablePagamento->style = 'width: 600px';
     $notebook = new TNotebook(600, 650);
     $notebook->appendPage('Ticket - Cadastramento', $table);
     $notebook->appendPage('Ticket - Orçamento / Pagamento', $tablePagamento);
     // create the form fields
     $id = new TEntry('id');
     $id->setEditable(FALSE);
     $titulo = new TEntry('titulo');
     $origem = new TCombo('origem');
     $combo_origem = array();
     $combo_origem['I'] = 'Interno';
     $combo_origem['E'] = 'Externo';
     $origem->addItems($combo_origem);
     $origem->setDefaultOption(FALSE);
     $solicitacao_descricao = new TText('solicitacao_descricao');
     $providencia = new TText('providencia');
     $orcamento_horas = new TEntry('orcamento_horas');
     $orcamento_horas->setMask('999999');
     $orcamento_valor_hora = new TEntry('orcamento_valor_hora');
     $orcamento_valor_hora->setNumericMask(2, ',', '.');
     $valor_desconto = new TEntry('valor_desconto');
     $valor_desconto->setNumericMask(2, ',', '.');
     $valor_total = new TEntry('valor_total');
     $valor_total->setNumericMask(2, ',', '.');
     $valor_total->setEditable(FALSE);
     $forma_pagamento = new TEntry('forma_pagamento');
     $data_ultimo_pgto = new TEntry('data_ultimo_pgto');
     $data_ultimo_pgto->setEditable(FALSE);
     $valor_ultimo_pgto = new TEntry('valor_ultimo_pgto');
     $valor_ultimo_pgto->setNumericMask(2, ',', '.');
     $valor_ultimo_pgto->setEditable(FALSE);
     $valor_total_pago = new TEntry('valor_total_pago');
     $valor_total_pago->setNumericMask(2, ',', '.');
     $valor_total_pago->setEditable(FALSE);
     $data_pagamento = new TDate('data_pagamento');
     $data_pagamento->setMask('dd/mm/yyyy');
     $valor_pagamento = new TEntry('valor_pagamento');
     $valor_pagamento->setNumericMask(2, ',', '.');
     $valor_total_parcial = new TEntry('valor_total_parcial');
     $valor_total_parcial->setNumericMask(2, ',', '.');
     $valor_total_parcial->setEditable(FALSE);
     $valor_saldo = new TEntry('valor_saldo');
     $valor_saldo->setNumericMask(2, ',', '.');
     $valor_saldo->setEditable(FALSE);
     $data_cadastro = new TEntry('data_cadastro');
     $data_cadastro->setEditable(FALSE);
     $data_cadastro->setMask('dd/mm/yyyy');
     $data_cadastro->setValue(date('d/m/Y'));
     $data_inicio = new TDate('data_inicio');
     $data_inicio->setMask('dd/mm/yyyy');
     $data_inicio_oculta = new THidden('data_inicio_oculta');
     $data_cancelamento = new TDate('data_cancelamento');
     $data_cancelamento->setMask('dd/mm/yyyy');
     $data_encerramento = new TDate('data_encerramento');
     $data_encerramento->setMask('dd/mm/yyyy');
     $data_prevista = new TDate('data_prevista');
     $data_prevista->setMask('dd/mm/yyyy');
     $data_aprovacao = new TDate('data_aprovacao');
     $data_aprovacao->setMask('dd/mm/yyyy');
     $observacao = new TText('observacao');
     $nome_dtr = new TEntry('nome_dtr');
     $nome_dtr->setEditable(FALSE);
     $criteria = new TCriteria();
     $criteria->add(new TFilter("origem", "=", 1));
     $criteria->add(new TFilter("ativo", "=", 1));
     $criteria->add(new TFilter("codigo_cadastro_origem", "=", 100));
     $responsavel_id = new TDBCombo('responsavel_id', 'atividade', 'Pessoa', 'pessoa_codigo', 'pessoa_nome', 'pessoa_nome', $criteria);
     $tipo_ticket_id = new TDBCombo('tipo_ticket_id', 'atividade', 'TipoTicket', 'id', 'nome');
     $tipo_ticket_id->setDefaultOption(FALSE);
     $sistema_id = new TDBCombo('sistema_id', 'atividade', 'Sistema', 'id', 'nome');
     $status_ticket_id = new TDBCombo('status_ticket_id', 'atividade', 'StatusTicket', 'id', 'nome');
     $status_ticket_id->setValue(2);
     $status_ticket_id->setEditable(FALSE);
     $prioridade_id = new TDBCombo('prioridade_id', 'atividade', 'Prioridade', 'id', 'nome');
     $prioridade_id->setDefaultOption(FALSE);
     $prioridade_id->setValue(3);
     $combo_tipo_origens = new TCombo('tipo_origens');
     $combo_tipo_origens->addItems(array(1 => 'Entidade', 2 => 'Estabelecimento', 3 => 'Empresa'));
     $combo_codigo_origem = new TCombo('codigo_cadastro_origem');
     $combo_solicitante_id = new TCombo('solicitante_id');
     try {
         TTransaction::open('atividade');
         $logado = Pessoa::retornaUsuario();
         TTransaction::close();
     } catch (Exception $e) {
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // shows the exception error message
     }
     $logado_id = new THidden('logado_id');
     $logado_id->setValue($logado->pessoa_codigo);
     // define the sizes
     $id->setSize(100);
     $origem->setSize(200);
     $solicitacao_descricao->setSize(400, 180);
     $data_inicio->setSize(90);
     $data_encerramento->setSize(90);
     $data_cancelamento->setSize(90);
     $providencia->setSize(400, 80);
     $orcamento_horas->setSize(100);
     $orcamento_valor_hora->setSize(100);
     $valor_desconto->setSize(100);
     $valor_total->setSize(100);
     $valor_saldo->setSize(121);
     $forma_pagamento->setSize(400);
     $data_ultimo_pgto->setSize(100);
     $data_pagamento->setSize(100);
     $valor_pagamento->setSize(121);
     $valor_ultimo_pgto->setSize(100);
     $valor_total_pago->setSize(100);
     $valor_total_parcial->setSize(121);
     $data_cadastro->setSize(100);
     $data_prevista->setSize(100);
     $data_aprovacao->setSize(100);
     $observacao->setSize(400, 80);
     $nome_dtr->setSize(400);
     $titulo->setSize(390);
     $responsavel_id->setSize(390);
     $tipo_ticket_id->setSize(200);
     $sistema_id->setSize(200);
     $status_ticket_id->setSize(200);
     $prioridade_id->setSize(200);
     $combo_tipo_origens->setSize(135);
     $combo_codigo_origem->setSize(250);
     $combo_solicitante_id->setSize(390);
     // validações
     $titulo->addValidation('Titulo', new TRequiredValidator());
     $combo_solicitante_id->addValidation('Solicitante', new TRequiredValidator());
     $responsavel_id->addValidation('Responsável', new TRequiredValidator());
     $sistema_id->addValidation('Sistema', new TRequiredValidator());
     $gerar_dr = TButton::create('gerar_dr', array('RequisitoDesenvolvimentoForm', 'onEdit'), 'Gerar DTR', 'ico_add.png');
     $link_dtr = new TButton('link_dtr');
     $link_dtr->setImage('bs:edit green');
     $link_dtr->setLabel('ir para DTR');
     $link_dtr->addFunction("__adianti_load_page('index.php?class=RequisitoDesenvolvimentoForm&method=onBuscaDTR&key={$_REQUEST['key']}');");
     $this->form->addField($gerar_dr);
     $this->form->addField($link_dtr);
     TButton::disableField('form_Ticket', 'gerar_dr');
     TButton::disableField('form_Ticket', 'link_dtr');
     // add one row for each form field
     // notebook Cadastramento
     $table->addRowSet(new TLabel('Ticket:'), array($id, new TLabel('Data Cadastro'), $data_cadastro));
     $table->addRowSet($label_combo_origem = new TLabel('Origem:'), array($combo_tipo_origens, $combo_codigo_origem));
     $label_combo_origem->setFontColor('#FF0000');
     $table->addRowSet($label_solicitante = new TLabel('Solicitante:'), $combo_solicitante_id);
     $label_solicitante->setFontColor('#FF0000');
     $table->addRowSet($label_responsavel = new TLabel('Responsável:'), $responsavel_id);
     $label_responsavel->setFontColor('#FF0000');
     $table->addRowSet($label_titulo = new TLabel('Título:'), $titulo);
     $label_titulo->setFontColor('#FF0000');
     $table->addRowSet(new TLabel('Data Inicio'), array($data_inicio, $label_status = new TLabel('Status:'), $status_ticket_id));
     $label_status->setSize(70);
     $table->addRowSet(new TLabel('Data Encerramento:'), array($data_encerramento, $label_data_cancelamento = new TLabel('Data Cancelamento:'), $data_cancelamento));
     $label_data_cancelamento->setSize(160);
     $table->addRowSet(new TLabel('Prioridade:'), $prioridade_id);
     $table->addRowSet(new TLabel('Origem:'), $origem);
     $table->addRowSet(new TLabel('Tipo Ticket:'), $tipo_ticket_id);
     $table->addRowSet($label_sistema = new TLabel('Sistema:'), $sistema_id);
     $label_sistema->setFontColor('#FF0000');
     $table->addRowSet(new TLabel('Descrição Solicitação:'), $solicitacao_descricao);
     $table->addRowSet(new TLabel('DR.:'), $nome_dtr);
     $table->addRowSet(new TLabel(''), array($gerar_dr, $link_dtr));
     $table->addRowSet(new TLabel(''), $data_inicio_oculta);
     // notebook Pagamento
     $tablePagamento->addRowSet(new TLabel('Data Prevista:'), $data_prevista);
     $tablePagamento->addRowSet(new TLabel('Data Aprovação:'), $data_aprovacao);
     $tablePagamento->addRowSet(new TLabel('Qte Horas:'), $orcamento_horas);
     $tablePagamento->addRowSet(new TLabel('Valor Hora:'), $orcamento_valor_hora);
     $tablePagamento->addRowSet(new TLabel('Valor Desconto:'), $valor_desconto);
     $tablePagamento->addRowSet(new TLabel('Valor Total:'), $valor_total);
     $tablePagamento->addRowSet(new TLabel('Forma de Pgto:'), $forma_pagamento);
     $tablePagamento->addRowSet(new TLabel('Descrição Providência:'), $providencia);
     $tablePagamento->addRowSet(new TLabel('Observação:'), $observacao);
     // creates a frame
     $frame = new TFrame();
     $frame->oid = 'frame-measures';
     $frame->setLegend('Pagamentos:');
     $row = $tablePagamento->addRow();
     $cell = $row->addCell($frame);
     $cell->colspan = 2;
     $page2 = new TTable();
     $frame->add($page2);
     $page2->addRowSet(new TLabel('Valor Pgto:'), array($valor_pagamento, $tamanho_label = new TLabel('Valor Ultimo Pgto:'), $valor_ultimo_pgto));
     $tamanho_label->setSize(150);
     $page2->addRowSet(new TLabel('Data Pgto:'), array($data_pagamento, $tamanho_label = new TLabel('Data Ultimo Pgto:'), $data_ultimo_pgto));
     $tamanho_label->setSize(150);
     $page2->addRowSet(new TLabel('Valor Total:'), array($valor_total_parcial, $tamanho_label = new TLabel('Valor Total Pago: '), $valor_total_pago));
     $tamanho_label->setSize(150);
     $page2->addRowSet(new TLabel('Saldo a pagar:'), $valor_saldo);
     $tablePagamento->addRowSet(new TLabel(''), $logado_id);
     // Envia campos para o formulario
     $this->form->setFields(array($id, $titulo, $data_inicio, $data_inicio_oculta, $data_encerramento, $data_cancelamento, $origem, $solicitacao_descricao, $nome_dtr, $providencia, $orcamento_horas, $orcamento_valor_hora, $valor_desconto, $valor_total, $forma_pagamento, $data_ultimo_pgto, $valor_ultimo_pgto, $valor_total_pago, $data_cadastro, $data_prevista, $data_aprovacao, $observacao, $tipo_ticket_id, $sistema_id, $status_ticket_id, $prioridade_id, $responsavel_id, $valor_total_parcial, $valor_pagamento, $data_pagamento, $valor_saldo, $combo_tipo_origens, $combo_codigo_origem, $combo_solicitante_id, $logado_id));
     // create the form actions
     $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'fa:floppy-o');
     $new_button = TButton::create('new', array($this, 'onEdit'), _t('New'), 'fa:plus-square green');
     $del_button = TButton::create('delete', array($this, 'onDelete'), _t('Delete'), 'fa:trash-o red fa-lg');
     $list_button = TButton::create('list', array('TicketList', 'onReload'), _t('List'), 'fa:table blue');
     $enviar_email = TButton::create('email', array($this, 'onEnviaEmail'), 'Enviar Email', 'ico_email.png');
     $sincronizar = TButton::create('sincronizar', array($this, 'onSincronizarContatos'), 'Sincronizar Contatos', 'sincronizar.png');
     $this->form->addField($save_button);
     $this->form->addField($new_button);
     $this->form->addField($del_button);
     $this->form->addField($list_button);
     $this->form->addField($enviar_email);
     $this->form->addField($sincronizar);
     $subtable = new TTable();
     $row = $subtable->addRow();
     $row->addCell($save_button);
     $row->addCell($new_button);
     $row->addCell($del_button);
     $row->addCell($list_button);
     $row->addCell($enviar_email);
     $row->addCell($sincronizar);
     $pretable = new TTable();
     $pretable->style = 'width: 100%';
     $row = $pretable->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $row->addCell(new TLabel('Cadastro de Ticket'))->colspan = 2;
     $change_action = new TAction(array($this, 'onCalculaValorTotal'));
     $orcamento_horas->setExitAction($change_action);
     $orcamento_valor_hora->setExitAction($change_action);
     $valor_desconto->setExitAction($change_action);
     $change_data_action = new TAction(array($this, 'onChangeDataAction'));
     $data_aprovacao->setExitAction($change_data_action);
     $change_data_prev = new TAction(array($this, 'onChangeDataPrevista'));
     $data_prevista->setExitAction($change_data_prev);
     $change_data_pagamento = new TAction(array($this, 'onChangeDataPagamento'));
     $data_pagamento->setExitAction($change_data_pagamento);
     $change_valor = new TAction(array($this, 'onCalculaValorParcial'));
     $valor_pagamento->setExitAction($change_valor);
     $change_status = new TAction(array($this, 'onChangeDataInicio'));
     $data_inicio->setExitAction($change_status);
     $change_status = new TAction(array($this, 'onChangeDataCancelamento'));
     $data_cancelamento->setExitAction($change_status);
     $change_status = new TAction(array($this, 'onChangeDataEncerramento'));
     $data_encerramento->setExitAction($change_status);
     $change_origem = new TAction(array($this, 'onChangeOrigem'));
     $combo_tipo_origens->setChangeAction($change_origem);
     $change_tipo_origem = new TAction(array($this, 'onChangeTipoOrigem'));
     $combo_codigo_origem->setChangeAction($change_tipo_origem);
     $vbox = new TVBox();
     $vbox->add($pretable);
     $vbox->add($notebook);
     $vbox->add($subtable);
     $this->form->add($vbox);
     parent::add($this->form);
 }