function __construct() { parent::__construct(); parent::setDatabase(APPLICATION_NAME); parent::setActiveRecord('cidade'); $this->form = new \Adianti\Widget\Wrapper\TQuickForm('form_cidade'); $this->form->class = 'tform'; $this->form->style = 'width: 100%'; $this->form->setFormTitle('Cadastro Estados (Cidade)'); $id = new \Adianti\Widget\Form\TEntry('idcidade'); $nome = new \Adianti\Widget\Form\TEntry('nome'); //******* //Entry com resultado da busca $nomeuf = new TEntry('nomeuf'); //******* //Entry com botão de busca $iduf = new TDBSeekButton('iduf', 'sobcontrole', $this->form->getName(), 'uf', 'nome', 'iduf', 'nomeuf'); $id->setEditable(FALSE); $iduf->setEditable(TRUE); $nomeuf->setEditable(FALSE); $iduf->addValidation('UF', new TRequiredValidator()); $nome->addValidation('nome', new TRequiredValidator()); $this->form->addQuickField('ID', $id, 100); $this->form->addQuickField('Nome', $nome, 100); $this->form->addQuickField('UF', $iduf, 100); $this->form->addQuickField('Estado', $nomeuf, 100); $this->form->addQuickAction('Salvar', new \Adianti\Control\TAction(array($this, 'onSave')), 'ico_save.png'); $this->form->addQuickAction('Novo', new \Adianti\Control\TAction(array($this, 'onClear')), 'ico_new.png'); $this->form->addQuickAction('Listar', new \Adianti\Control\TAction(array('CidadeDataGrid', 'onReload')), 'ico_datagrid.png'); $vbox = new \Adianti\Widget\Container\TVBox(); $vbox->add(new \Adianti\Widget\Util\TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->form); parent::add($vbox); $this->nomeuf = $nomeuf; }
function __construct() { parent::__construct(); // @todo verificar se APPLICATION_NAME realmente não funciona no hostinger parent::setDatabase(APPLICATION_NAME); parent::setActiveRecord('contabancaria'); $this->form = new \Adianti\Widget\Wrapper\TQuickForm('form_contabancaria'); $this->form->class = 'tform'; $this->form->style = 'width: 100%'; $this->form->setFormTitle('Cadastro Contas Bancárias)'); $id = new \Adianti\Widget\Form\TEntry('idcontabancaria'); $id->setEditable(FALSE); $agencia = new \Adianti\Widget\Form\TEntry('agencia'); $agencia->addValidation('agencia', new TRequiredValidator()); $conta = new \Adianti\Widget\Form\TEntry('conta'); $conta->addValidation('conta', new TRequiredValidator()); $banco_idbanco = new TDBSeekButton('banco_idbanco', 'sobcontrole', $this->form->getName(), 'banco', 'nome', 'banco_idbanco', 'nomebanco'); $banco_idbanco->setSize(50); $banco_idbanco->addValidation('banco', new TRequiredValidator()); $nomebanco = new TEntry('nomebanco'); $nomebanco->setEditable(FALSE); $tipocontabancaria_idtipocontabancaria = new TDBSeekButton('tipocontabancaria_idtipocontabancaria', 'sobcontrole', $this->form->getName(), 'tipocontabancaria', 'descricao', 'tipocontabancaria_idtipocontabancaria', 'descricaotipocontabancaria'); $tipocontabancaria_idtipocontabancaria->setSize(50); $tipocontabancaria_idtipocontabancaria->addValidation('tipocontabancaria', new TRequiredValidator()); $descricaotipocontabancaria = new TEntry('descricaotipocontabancaria'); $descricaotipocontabancaria->setEditable(FALSE); $titular = new \Adianti\Widget\Form\TEntry('titular'); //Entry com botão de busca de cidade $idcidade = new TDBSeekButton2('idcidade', 'sobcontrole', $this->form->getName(), 'cidade', 'nome', 'idcidade', 'nomecidade', NULL, 'uf->nome'); $idcidade->setSize(50); //$idcidade->addValidation('cidade', new TRequiredValidator); //Entry com resultado da buscade cidade $nomecidade = new TEntry('nomecidade'); $nomecidade->setEditable(FALSE); $this->form->addQuickField('ID', $id); $this->form->addQuickField('Agência', $agencia); $this->form->addQuickField('Conta', $conta); $this->form->addQuickFields('Banco', array($banco_idbanco, $nomebanco)); $this->form->addQuickFields('Tipo Conta', array($tipocontabancaria_idtipocontabancaria, $descricaotipocontabancaria)); $this->form->addQuickField('Titular nº', $titular, 50); $this->form->addQuickFields('Cidade', array($idcidade, $nomecidade)); $this->form->addQuickAction('Salvar', new \Adianti\Control\TAction(array($this, 'onSave')), 'ico_save.png'); $this->form->addQuickAction('Novo', new \Adianti\Control\TAction(array($this, 'onClear')), 'ico_new.png'); $this->form->addQuickAction('Listar', new \Adianti\Control\TAction(array('ContabancariaDataGrid', 'onReload')), 'ico_datagrid.png'); $vbox = new \Adianti\Widget\Container\TVBox(); $vbox->add(new \Adianti\Widget\Util\TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->form); parent::add($vbox); $this->nomecidade = $nomecidade; $this->descricaotipocontabancaria = $descricaotipocontabancaria; $this->nomebanco = $nomebanco; }
function __construct() { parent::__construct(); //cria os containers $this->form_cessao = new TForm('form_cessao'); $this->form_cessao->class = 'tform'; $this->form_itens = new TForm('form_itens'); $this->form_itens->class = 'tform'; $table_cessao = new TTable(); $table_cessao->width = '100%'; $table_itens = new TTable(); $table_itens->width = '100%'; //empacota os dados $this->form_cessao->add($table_cessao); $this->form_itens->add($table_itens); //campos da cessao; $numeroSRP = new TSeekButton('numeroSRP'); $nome = new TEntry('nome'); $numeroProcessoOrigem = new TEntry('numeroProcessoOrigem'); $uasg = new TEntry('uasg'); $validadeAta = new TEntry('validade'); $numeroCessao = new TEntry('numeroCessao'); $campusID = new TDBSeekButton('campusID', 'saciq', 'form_cessao', 'Campus', 'nome', 'campusID', 'campusNome'); $campusNome = new TEntry('campusNome'); $emissao = new TDate('emissao'); //campos do itens $numeroItem = new TSeekButton('numeroItem'); $item_id = new THidden('item_id'); $descricaoSumaria = new TEntry('descricaoSumaria'); $valorUnitario = new TEntry('valorUnitario'); $quantidade = new TEntry('quantidade'); //$prazoEntrega = new TEntry('prazoEntrega'); //$justificativa = new TEntry('justificativa'); $addItem = new TButton('addItem'); $save = new TButton('save'); $new = new TButton('new'); $list = new TButton('list'); //ações dos campos $numeroSRP->setAction(new TAction(array(new SrpSeekCessao(), 'onReload'))); $numeroCessao->setExitAction(new TAction(array($this, 'onExitNumeroProcesso'))); $campusID->setExitAction(new TAction(array($this, 'onExitCampus'))); $emissao->setExitAction(new TAction(array($this, 'onExitEmissao'))); $numeroItem->setAction(new TAction(array(new ItemSeekCessao(), 'onReload'))); $addItem->setAction(new TAction(array($this, 'onAddItem')), 'Adicionar'); $addItem->setImage('fa:plus-square-o'); $save->setAction(new TAction(array($this, 'onSave')), 'Salvar'); $save->setImage('ico_save.png'); $new->setAction(new TAction(array($this, 'onEdit')), 'Novo'); $new->setImage('ico_new.png'); $list->setAction(new TAction(array('CessaoList', 'onReload')), 'Voltar para a listagem'); $list->setImage('ico_datagrid.png'); $quantidade->setExitAction(new TAction(array($this, 'onValidaQuantidade'))); //validadores $numeroSRP->addValidation('Nº SRP', new TRequiredValidator()); $numeroItem->addValidation('Item', new TRequiredValidator()); $valorUnitario->addValidation('Preço', new TRequiredValidator()); $quantidade->addValidation('Quantidade', new TRequiredValidator()); $quantidade->addValidation('Quantidade', new TMinValueValidator(), array(1)); $quantidade->addValidation('Quantidade', new TMaxLengthValidator(), array(11)); $numeroCessao->addValidation('Nº Cessão', new TRequiredValidator()); $numeroCessao->addValidation('Nº Cessão', new TMaxLengthValidator(), array(30)); $campusID->addValidation('Câmpus', new TRequiredValidator()); $emissao->addValidation('Emissão', new TRequiredValidator()); //outras propriedades $descricaoSumaria->setEditable(false); $nome->setEditable(false); $numeroProcessoOrigem->setEditable(false); $uasg->setEditable(false); $validadeAta->setEditable(false); $valorUnitario->setEditable(false); $numeroSRP->setSize(80); $nome->setSize(300); $nome->setProperty('style', 'margin-right: 10px', false); $numeroProcessoOrigem->setSize(160); $uasg->setSize(70); $validadeAta->setSize(85); $numeroItem->setSize(60); $descricaoSumaria->setSize('100%'); $descricaoSumaria->setProperty('style', 'margin-right: 10px', false); $numeroCessao->setSize(230); $numeroCessao->setTip('Número do processo gerado no SIGA'); $campusID->setSize(50); $campusNome->setSize('100%'); $campusNome->setEditable(false); $validadeAta->setMask('dd/mm/yyyy'); $emissao->setSize(90); $emissao->setProperty('style', 'margin-right: 0px;', false); $emissao->setMask('dd/mm/yyyy'); $emissao->setValue(date('d/m/Y')); $quantidade->class = 'frm_number_only'; //$prazoEntrega->setValue('60 Dias'); //$addItem->setProperty('style', 'margin: 0 0 10px 10px;', false); $row = $table_cessao->addRow(); $row->class = 'tformtitle'; // CSS class $cell = $row->addCell(new TLabel('Cessão de quantitativo')); $cell->colspan = 4; $row = $table_cessao->addRow(); $row->addCell(new TLabel('Nº SRP:'))->width = '150px'; $row->addCell($numeroSRP); $row->addCell(new TLabel('Nome Licitação:'))->width = '150px'; $row->addCell($nome); $table_cessao->addRowSet(new TLabel('Proc. Orig:'), $numeroProcessoOrigem, new TLabel('UASG:'), $uasg); $table_cessao->addRowSet(new TLabel('Validade da Ata:'), $validadeAta, new TLabel('Nº Cessão:'), $numeroCessao); $row = $table_cessao->addRow(); $row->addCell(new TLabel('Câmpus:')); $box = new THBox(); $box->add($campusID); $box->add($campusNome)->style = 'width: 75%; display : inline-block;'; $row->addCell($box)->colspan = 3; $table_cessao->addRowSet(new TLabel('Data Emissão:'), $emissao); $row = $table_itens->addRow(); $row->class = 'tformtitle'; // CSS class $cell = $row->addCell(new TLabel('Itens')); $cell->colspan = 4; $row = $table_itens->addRow(); $row->addCell(new TLabel('Item:')); $box = new THBox(); $box->add($numeroItem); $box->add($descricaoSumaria)->style = 'width : 75%;display:inline-block;'; $box->style = 'width : 600px'; $row->addCell($box); //->style = 'width : 85%'; $table_itens->addRowSet($item_id); $table_itens->addRowSet(new TLabel('Preço:'), $valorUnitario); $table_itens->addRowSet(new TLabel('Quantidade:'), $quantidade); //$table_itens->addRowSet(new TLabel('Prazo de entrega:'), $prazoEntrega); //$table_itens->addRowSet(new TLabel('Justificativa:'), $justificativa); $row = $table_itens->addRow(); $row->class = 'tformaction'; $row->addCell($addItem)->colspan = 2; parent::include_css('app/resources/custom-table.css'); $this->datagrid = new TDataGrid(); $this->datagrid->style = 'width: 100%'; $this->datagrid->class = 'tdatagrid_table customized-table'; $this->datagrid->setHeight(175); $this->datagrid->makeScrollable(); $this->datagrid->disableDefaultClick(); $GnumeroItem = new TDataGridColumn('numeroItem', 'Item', 'center', 50); $GdescricaoSumaria = new TDataGridColumn('descricaoSumaria', 'Descrição', 'left', 230); $Gquantidade = new TDataGridColumn('quantidade', 'Quantidade', 'right', 110); $GvalorUnitario = new TDataGridColumn('valorUnitario', 'Preço', 'right', 110); $Gtotal = new TDataGridColumn('total', 'Total', 'right', 160); //transformers $GvalorUnitario->setTransformer(array($this, 'formatValor')); $Gtotal->setTransformer(array($this, 'formatValor')); $edit = new TDataGridAction(array($this, 'onEditItem')); $edit->setLabel('Editar'); $edit->setImage('ico_edit.png'); $edit->setField('numeroItem'); $delete = new TDataGridAction(array($this, 'onDeleteItem')); $delete->setLabel('Deletar'); $delete->setImage('ico_delete.png'); $delete->setField('numeroItem'); $this->datagrid->addAction($edit); $this->datagrid->addAction($delete); $this->datagrid->addColumn($GnumeroItem); $this->datagrid->addColumn($GdescricaoSumaria); $this->datagrid->addColumn($Gquantidade); $this->datagrid->addColumn($GvalorUnitario); $this->datagrid->addColumn($Gtotal); $this->datagrid->createModel(); $this->form_cessao->setFields(array($numeroSRP, $nome, $numeroProcessoOrigem, $uasg, $validadeAta, $numeroCessao, $campusID, $campusNome, $emissao, $new, $save, $list)); $this->form_itens->setFields(array($item_id, $numeroItem, $descricaoSumaria, $valorUnitario, $quantidade, $addItem)); $hbox = new THBox(); $hbox->add($save); $hbox->add($new); $hbox->add($list); $table_grid = new TTable(); $table_grid->style = 'width: 100%;border-spacing: 0px;'; $table_grid->addRowSet($this->datagrid); $row = $table_grid->addRow(); $row->class = 'tformaction'; // CSS class $row->addCell($hbox)->colspan = 2; $vbox = new TVBox(); $vbox->add($this->form_cessao); $vbox->add($this->form_itens); $vbox->add($table_grid); $vbox->add(new TLabel(' ')); parent::add($vbox); }