示例#1
1
 /**
  * Add a column
  * @param $label  Field Label
  * @param $object Field Object
  * @param $size   Field Size
  */
 public function addQuickColumn($label, $name, $align = 'left', $size = 200, TAction $action = NULL, $param = NULL)
 {
     // creates a new column
     $object = new TDataGridColumn($name, $label, $align, $size);
     if ($action instanceof TAction) {
         // create ordering
         $action->setParameter($param[0], $param[1]);
         $object->setAction($action);
     }
     // add the column to the datagrid
     parent::addColumn($object);
     return $object;
 }
示例#2
1
 function __construct()
 {
     parent::__construct();
     //cria os containers
     $this->form_requisicao = new TForm('form_requisicao');
     $this->form_requisicao->class = 'tform';
     $this->form_itens = new TForm('form_itens');
     $this->form_itens->class = 'tform';
     $table_requisicao = new TTable();
     $table_requisicao->width = '100%';
     $table_itens = new TTable();
     $table_itens->width = '100%';
     //empacota os dados
     $this->form_requisicao->add($table_requisicao);
     $this->form_itens->add($table_itens);
     //campos da requisicao;
     $numeroSRP = new TSeekButton('numeroSRP');
     $nome = new TEntry('nome');
     $numeroProcessoOrigem = new TEntry('numeroProcessoOrigem');
     $uasg = new TEntry('uasg');
     $validadeAta = new TEntry('validade');
     $numeroProcesso = new TEntry('numeroProcesso');
     $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 SrpSeekRequisicao(), 'onReload')));
     $numeroProcesso->setExitAction(new TAction(array($this, 'onExitNumeroProcesso')));
     $emissao->setExitAction(new TAction(array($this, 'onExitEmissao')));
     $numeroItem->setAction(new TAction(array(new ItemSeekRequisicao(), '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('RequisicaoList', 'onReload')), 'Voltar para listagem');
     $list->setImage('ico_datagrid.png');
     //$onProductChange = new TAction(array($this, 'onProductChange'));
     //$item_id->setExitAction($onProductChange);
     $quantidade->setExitAction(new TAction(array($this, 'onValidaQuantidade')));
     //validadores
     $numeroSRP->addValidation('Nº SRP', new TRequiredValidator());
     $emissao->addValidation('Emissão', 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));
     $justificativa->addValidation('Justificativa', new TRequiredValidator());
     $justificativa->addValidation('Justificativa', new TMaxLengthValidator(), array(100));
     $prazoEntrega->addValidation('Prazo de entrega', new TRequiredValidator());
     $prazoEntrega->addValidation('Prazo de entrega', new TMaxLengthValidator(), array(20));
     $numeroProcesso->addValidation('Nº Processo', new TRequiredValidator());
     $numeroProcesso->addValidation('Nº Processo', new TMaxLengthValidator(), array(30));
     //outras propriedades
     $descricaoSumaria->setEditable(false);
     $nome->setEditable(false);
     $numeroProcessoOrigem->setEditable(false);
     $uasg->setEditable(false);
     $validadeAta->setEditable(false);
     $valorUnitario->setEditable(false);
     $numeroSRP->setSize(80);
     $numeroSRP->setMaxLength(10);
     $emissao->setProperty('style', 'margin-right: 0px;', false);
     $nome->setSize(300);
     $nome->setProperty('style', 'margin-right: 10px', false);
     $numeroProcessoOrigem->setSize(160);
     $uasg->setSize(70);
     $validadeAta->setSize(85);
     $numeroProcesso->setMaxLength(30);
     $numeroProcesso->setTip('Número do processo gerado no SIGA');
     $numeroItem->setSize(60);
     $numeroItem->setMaxLength(11);
     $descricaoSumaria->setSize(490);
     $descricaoSumaria->setProperty('style', 'margin-right: 10px', false);
     $prazoEntrega->setSize(90);
     $justificativa->setSize(400);
     $justificativa->setMaxLength(100);
     $emissao->setSize(90);
     $emissao->setMask('dd/mm/yyyy');
     $emissao->setValue(date('d/m/Y'));
     $validadeAta->setMask('dd/mm/yyyy');
     $quantidade->class = 'frm_number_only';
     $quantidade->setMaxLength(11);
     $prazoEntrega->setValue('60 Dias');
     $prazoEntrega->setMaxLength(20);
     //$addItem->setProperty('style', 'margin: 0 0 10px 10px;', false);
     $row = $table_requisicao->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $cell = $row->addCell(new TLabel('Requisição de quantitativo'));
     $cell->colspan = 4;
     $row = $table_requisicao->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_requisicao->addRowSet(new TLabel('Proc. Orig:'), $numeroProcessoOrigem, new TLabel('UASG:'), $uasg);
     $table_requisicao->addRowSet(new TLabel('Validade da Ata:'), $validadeAta, new TLabel('Nº Processo:'), $numeroProcesso);
     $table_requisicao->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;';
     $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;
     //$table_itens->addRowSet($addItem);
     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_requisicao->setFields(array($numeroSRP, $nome, $numeroProcessoOrigem, $uasg, $validadeAta, $numeroProcesso, $emissao, $new, $save, $list));
     $this->form_itens->setFields(array($item_id, $numeroItem, $descricaoSumaria, $valorUnitario, $quantidade, $prazoEntrega, $justificativa, $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_requisicao);
     $vbox->add($this->form_itens);
     $vbox->add($table_grid);
     $vbox->add(new TLabel(' '));
     parent::add($vbox);
 }
示例#3
0
 function __construct()
 {
     parent::__construct();
     parent::include_css('app/resources/custom-table.css');
     //criar o form
     $this->form = new TForm('form_consulta_srp');
     $this->form->class = 'tform';
     //cria a tabela
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     //adiciona uma linha na tabela para o titulo
     $row = $table->addRow();
     $row->class = 'tformtitle';
     $row->addCell(new TLabel('Consulta SRP'))->colspan = 2;
     // cria os campos do formulario
     $numeroSRP = new TEntry('numeroSRP');
     $numeroIRP = new TEntry('numeroIRP');
     $numeroProcesso = new TEntry('numeroProcesso');
     $uasg = new TEntry('uasg');
     $validade = new TDate('validade');
     $nome = new TEntry('nome');
     // define os tamanhos
     $numeroSRP->setSize(70);
     $numeroIRP->setSize(70);
     $numeroProcesso->setSize(150);
     $uasg->setSize(70);
     $validade->setSize(100);
     $validade->setProperty('style', 'margin-right : 0px');
     $nome->setSize(400);
     $validade->setMask('dd/mm/yyyy');
     // adiciona uma linha na tabela para cada campo
     $table->addRowSet(new TLabel('Nº SRP:'), $numeroSRP);
     $table->addRowSet(new TLabel('Nº IRP:'), $numeroIRP);
     $table->addRowSet(new TLabel('Proc. Orig.:'), $numeroProcesso);
     $table->addRowSet(new TLabel('Nome:'), $nome);
     $table->addRowSet(new TLabel('UASG:'), $uasg);
     $table->addRowSet(new TLabel('Validade:'), $validade);
     $this->form->setFields(array($numeroSRP, $numeroIRP, $numeroProcesso, $uasg, $validade, $nome));
     // manter o formulario preenchido durante navegação com os dados da sessao
     $this->form->setData(TSession::getValue('Srp_filter_data'));
     //cria o botão de ação
     $find_button = TButton::create('find', array($this, 'onSearch'), 'Consultar', 'ico_find.png');
     $this->form->addField($find_button);
     // adiciona uma linha para a acao do formulario
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($find_button)->colspan = 2;
     // cria o datagrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->class = 'tdatagrid_table customized-table';
     $this->datagrid->setHeight(320);
     // cria as colunas do datagrid
     $numeroSRP = new TDataGridColumn('numeroSRP', 'Nº SRP', 'left', 70);
     $numeroIRP = new TDataGridColumn('numeroIRP', 'Nº IRP', 'left', 70);
     $numeroProcesso = new TDataGridColumn('numeroProcesso', 'Proc. Orig.', 'left', 150);
     $uasg = new TDataGridColumn('uasg', 'UASG', 'left', 50);
     $validade = new TDataGridColumn('validade', 'Validade', 'left', 100);
     $nome = new TDataGridColumn('nome', 'Nome', 'left', 300);
     $validade->setTransformer(array($this, 'rowFormat'));
     // adiciona as colunas ao datagrid
     $this->datagrid->addColumn($numeroSRP);
     $this->datagrid->addColumn($numeroIRP);
     $this->datagrid->addColumn($numeroProcesso);
     $this->datagrid->addColumn($nome);
     $this->datagrid->addColumn($uasg);
     $this->datagrid->addColumn($validade);
     $srpViewAction = new TDataGridAction(array('SrpFormView', 'onViewSrp'));
     $srpViewAction->setLabel('Itens');
     $srpViewAction->setImage('fa:th-list');
     $srpViewAction->setField('id');
     $this->datagrid->addAction($srpViewAction);
     // cria o modelo no datagrid
     $this->datagrid->createModel();
     // cria o navegador de pagina
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     $container = new TTable();
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->addRow()->addCell($this->form);
     $container->addRow()->addCell($this->datagrid);
     $container->addRow()->addCell($this->pageNavigation);
     parent::add($container);
 }
示例#4
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_search_Requisicao');
     $this->form->class = 'tform';
     // CSS class
     // creates a table
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     // add a row for the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $row->addCell(new TLabel('Consulta Requisicao'))->colspan = 2;
     // create the form fields
     $numeroProcesso = new TEntry('numeroProcesso');
     // define the sizes
     $numeroProcesso->setSize(200);
     $numeroProcesso->setMaxLength(30);
     $numeroProcesso->setTip('Número do processo gerado no SIGA');
     // add one row for each form field
     $table->addRowSet(new TLabel('Nº do Processo:'), $numeroProcesso);
     $this->form->setFields(array($numeroProcesso));
     // keep the form filled during navigation with session data
     $this->form->setData(TSession::getValue('Requisicao_filter_data'));
     // create two action buttons to the form
     $find_button = TButton::create('find', array($this, 'onSearch'), 'Buscar', 'ico_find.png');
     $new_button = TButton::create('new', array('RequisicaoForm', 'onEdit'), 'Novo', 'ico_new.png');
     $this->form->addField($find_button);
     $this->form->addField($new_button);
     $buttons_box = new THBox();
     $buttons_box->add($find_button);
     $buttons_box->add($new_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     // creates a Datagrid
     parent::include_css('app/resources/custom-table.css');
     $this->datagrid = new TDataGrid();
     $this->datagrid->class = 'tdatagrid_table customized-table';
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'right', 80);
     $srp = new TDataGridColumn('numeroSRP', 'Nº SRP', 'left', 100);
     $numeroProcesso = new TDataGridColumn('numeroProcesso', 'Nº do processo', 'left', 250);
     $data = new TDataGridColumn('emissao', 'Data', 'left', 100);
     $id->setTransformer(array($this, 'rowFormat'));
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($srp);
     $this->datagrid->addColumn($numeroProcesso);
     $this->datagrid->addColumn($data);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('RequisicaoForm', 'onEdit'));
     //$action1 = new TDataGridAction(array($this, 'onCheckValidadeSRP'));
     $action1->setLabel('Editar');
     $action1->setImage('ico_edit.png');
     $action1->setField('id');
     $action1->setDisplayCondition(array($this, 'onDisplayConditionEdit'));
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel('Excluir');
     $action2->setImage('ico_delete.png');
     $action2->setField('id');
     $actAprovar = new TDataGridAction(array($this, 'onQuestionAprovarRequisicao'));
     $actAprovar->setLabel('Aprovar Requisição');
     $actAprovar->setImage('fa:check fa-fw');
     $actAprovar->setField('id');
     $actAprovar->setDisplayCondition(array($this, 'onDisplayConditionEdit'));
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     $this->datagrid->addAction($actAprovar);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     //limpar a sessao com detalhes de itens e requisicao
     TSession::delValue('requisicao_itens');
     TSession::delValue('SRP_id');
     TSession::delValue('form_requisicao');
     // create the page container
     //$container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation);
     $container = new TTable();
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->addRow()->addCell($this->form);
     $container->addRow()->addCell($this->datagrid);
     $container->addRow()->addCell($this->pageNavigation);
     parent::add($container);
 }
示例#5
0
 /**
  * Add a Column to the DataGrid
  * @param $object A TDataGridColumn object
  */
 public function addColumn(TDataGridColumn $column)
 {
     if ($this->modelCreated) {
         throw new Exception(AdiantiCoreTranslator::translate('You must call ^1 before ^2', __METHOD__, 'createModel'));
     } else {
         $renderers = $column->get_cell_renderers();
         $cell_renderer = $renderers[0];
         $column->add_attribute($cell_renderer, 'text', $this->count);
         $column->set_cell_data_func($cell_renderer, array($this, 'formatZebra'));
         $this->view->append_column($column);
         $this->types[] = GObject::TYPE_STRING;
         $this->columns[] = $column;
         if ($column->getWidth()) {
             $this->width += $column->getWidth();
             $width = $this->width + count($this->columns) * 10;
             $this->view->set_size_request($width, -1);
         }
         $this->count++;
     }
 }