/**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_Customer_Report');
     $this->form->class = 'tform';
     // CSS class
     // creates a table
     $table = new TTable();
     $table->width = '100%';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $name = new TEntry('name');
     $city_id = new TDBSeekButton('city_id', 'samples', 'form_Customer_Report', 'City', 'name', 'city_id', 'city_name');
     $city_name = new TEntry('city_name');
     $category_id = new TDBCombo('category_id', 'samples', 'Category', 'id', 'name');
     $output_type = new TRadioGroup('output_type');
     $options = array('html' => 'HTML', 'pdf' => 'PDF', 'rtf' => 'RTF');
     $output_type->addItems($options);
     $output_type->setValue('pdf');
     $output_type->setLayout('horizontal');
     // define the sizes
     $name->setSize(200);
     $city_id->setSize(100);
     $category_id->setSize(100);
     $city_name->setEditable(FALSE);
     // add a row for the field name
     $row = $table->addRowSet(new TLabel('Report filters'), '');
     $row->class = 'tformtitle';
     // CSS class
     // add the fields into the table
     $table->addRowSet(new TLabel('Name' . ': '), $name);
     $table->addRowSet(new TLabel('City' . ': '), array($city_id, $city_name));
     $table->addRowSet(new TLabel('Category' . ': '), $category_id);
     $table->addRowSet(new TLabel('Output' . ': '), $output_type);
     // create an action button (save)
     $save_button = new TButton('generate');
     $save_button->setAction(new TAction(array($this, 'onGenerate')), 'Generate');
     $save_button->setImage('ico_save.png');
     // add a row for the form action
     $row = $table->addRowSet($save_button, '');
     $row->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($name, $city_id, $city_name, $category_id, $output_type, $save_button));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
 /**
  * Class constructor
  * Creates the page
  */
 public function __construct()
 {
     parent::__construct();
     // creates the customer form and add a table inside it
     $this->form = new TQuickForm('form');
     $this->form->class = 'tform';
     $this->form->setFormTitle('Customer');
     // create the form fields
     $customer_id = new TDBSeekButton('customer_id', 'samples', 'form', 'Customer', 'name', 'customer_id', 'customer_name');
     $customer_name = new TEntry('customer_name');
     $this->form->addQuickFields('Customer', array($customer_id, $customer_name));
     $this->form->addQuickAction('Check status', new TAction(array($this, 'onCheckSales')), 'ico_apply.png');
     $customer_id->setSize(50);
     $customer_name->setSize(400);
     $customer_name->setEditable(FALSE);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the form using TQuickForm class
     $this->form = new TQuickForm('form_seek_sample');
     $this->form->setFormTitle('Seek button');
     $this->form->class = 'tform';
     // create the form fields
     $city_id1 = new TSeekButton('city_id1');
     $city_name1 = new TEntry('city_name1');
     $city_id2 = new TDBSeekButton('city_id2', 'samples', 'form_seek_sample', 'City', 'name', 'city_id2', 'city_name2');
     $city_name2 = new TEntry('city_name2');
     $criteria = new TCriteria();
     $criteria->add(new TFilter('id', '>', 1));
     $criteria->add(new TFilter('id', '<', 5));
     $criteria->setProperty('order', 'name');
     $city_id3 = new TDBSeekButton('city_id3', 'samples', 'form_seek_sample', 'City', 'name', 'city_id3', 'city_name3', $criteria);
     $city_name3 = new TEntry('city_name3');
     // define the action for city_id1
     $obj = new TestCitySeek();
     $action = new TAction(array($obj, 'onReload'));
     $city_id1->setAction($action);
     $city_id1->setSize(100);
     $city_id2->setSize(100);
     $city_id3->setSize(100);
     $city_name1->setEditable(FALSE);
     $city_name2->setEditable(FALSE);
     $city_name3->setEditable(FALSE);
     $this->form->addQuickFields('Manual SeekButton', array($city_id1, $city_name1));
     $this->form->addQuickFields('Standard SeekButton', array($city_id2, $city_name2));
     $this->form->addQuickFields('Standard with filter', array($city_id3, $city_name3));
     $this->form->addQuickAction('Save', new TAction(array($this, 'onSave')), 'ico_save.png');
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
Exemplo n.º 4
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_System_user');
     $this->form->class = 'tform';
     // creates the table container
     $table = new TTable();
     $table1 = new TTable();
     $table2 = new TTable();
     $hbox1 = new THBox();
     $hbox2 = new THBox();
     $table->style = 'width: 100%';
     $table1->style = 'width: 100%';
     $table2->style = 'width: 100%';
     $this->form->add($table);
     $table->addRowSet(new TLabel(_t('User')), '', '', '')->class = 'tformtitle';
     $table->addRowSet($hbox1);
     $table->addRowSet($hbox2);
     $hbox1->add($table1);
     $hbox1->add($table2);
     // add the table inside the form
     $this->form->add($table);
     $frame_groups = new TFrame(NULL, 280);
     $frame_groups->setLegend(_t('Groups'));
     $frame_groups->style .= ';margin: 4px';
     $frame_programs = new TFrame(NULL, 280);
     $frame_programs->setLegend(_t('Programs'));
     $frame_programs->style .= ';margin: 4px';
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     $login = new TEntry('login');
     $password = new TPassword('password');
     $repassword = new TPassword('repassword');
     $email = new TEntry('email');
     $multifield_programs = new TMultiField('programs');
     $program_id = new TDBSeekButton('program_id', 'permission', 'form_System_user', 'SystemProgram', 'name', 'programs_id', 'programs_name');
     $program_name = new TEntry('program_name');
     $groups = new TDBCheckGroup('groups', 'permission', 'SystemGroup', 'id', 'name');
     $frontpage_id = new TDBSeekButton('frontpage_id', 'permission', 'form_System_user', 'SystemProgram', 'name', 'frontpage_id', 'frontpage_name');
     $frontpage_name = new TEntry('frontpage_name');
     $scroll = new TScroll();
     $scroll->setSize(290, 240);
     $scroll->add($groups);
     $frame_groups->add($scroll);
     $frame_programs->add($multifield_programs);
     // define the sizes
     $id->setSize('50%');
     $name->setSize('100%');
     $login->setSize('100%');
     $password->setSize('100%');
     $repassword->setSize('100%');
     $email->setSize('100%');
     $frontpage_id->setSize('20%');
     $multifield_programs->setHeight(140);
     // outros
     $id->setEditable(false);
     $program_name->setEditable(false);
     $frontpage_name->setEditable(false);
     // validations
     $name->addValidation(_t('Name'), new TRequiredValidator());
     $login->addValidation('Login', new TRequiredValidator());
     $email->addValidation('Email', new TEmailValidator());
     $program_id->setSize(50);
     $program_name->setSize(200);
     // configuracoes multifield
     $multifield_programs->setClass('SystemProgram');
     $multifield_programs->addField('id', 'ID', $program_id, 60);
     $multifield_programs->addField('name', _t('Name'), $program_name, 250);
     $multifield_programs->setOrientation('horizontal');
     // add a row for the field id
     $row = $table1->addRow();
     $row->addCell(new TLabel('ID:'))->style = 'width:150px';
     $row->addCell($id);
     $table1->addRowSet(new TLabel(_t('Login') . ': '), $login);
     $table1->addRowSet(new TLabel(_t('Password') . ': '), $password);
     $table1->addRowSet(new TLabel(_t('Password confirmation') . ': '), $repassword);
     $row = $table2->addRow();
     $row->addCell(new TLabel('Name:'))->style = 'width:150px';
     $row->addCell($name);
     $table2->addRowSet(new TLabel(_t('Email') . ': '), $email);
     $table2->addRowSet(new TLabel(_t('Front page') . ': '), $frontpage_id);
     $table2->addRowSet(new TLabel(_t('Page name') . ': '), $frontpage_name);
     $hbox2->add($frame_groups);
     $hbox2->add($frame_programs);
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('fa:floppy-o');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('SystemUserList', 'onReload')), _t('Back to the listing'));
     $list_button->setImage('fa:table blue');
     // define the form fields
     $this->form->setFields(array($id, $name, $login, $password, $repassword, $multifield_programs, $frontpage_id, $frontpage_name, $groups, $email, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 4;
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemUserList'));
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_FreqServList');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->style = 'width:100%';
     $table->addRowSet(new TLabel('Frequência'), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     //$id = new TEntry('ID');
     //$id->setValue(TSession::getValue('Frequencia_id'));
     $servidor_id = new TDBSeekButton('servidor_id', 'lacenrh', 'form_FreqServList', 'Servidor', 'servidor', 'servidor_id', 'servidor_nome');
     $servidor_id->setValue(TSession::getValue('Frequencia_servidor_id'));
     $servidor_nome = new TEntry('servidor_nome');
     $servidor_nome->setValue(TSession::getValue('Frequencia_servidor_nome'));
     $diames = new TDate('Data');
     $diames->setValue(TSession::getValue('Frequencia_diames'));
     //$id->setSize(40);
     $servidor_id->setSize(40);
     $servidor_nome->setSize(300);
     $diames->setSize(100);
     $diames->setMask('dd/mm/yyyy');
     // add rows for the filter fields
     //$row=$table->addRowSet(new TLabel(('ID') . ': '), $id);
     $row = $table->addRowSet(new TLabel('Servidor' . ': '), $servidor_id);
     $row = $table->addRowSet(new TLabel('Nome' . ': '), $servidor_nome);
     $row = $table->addRowSet(new TLabel('Data' . ': '), $diames);
     //$row=$table->addRowSet(new TLabel(('Unidade') . ': '), $unidade);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $clear_button = new Tbutton('clear');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('fa:search fa-lg');
     $clear_button->setAction(new TAction(array($this, 'onClear')), 'Limpar');
     $clear_button->setImage('fa:undo red fa-lg');
     $new_button->setAction(new TAction(array('FrequenciaServidorForm', 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green fa-lg');
     // define wich are the form fields
     $this->form->setFields(array($servidor_id, $servidor_nome, $diames, $find_button, $clear_button, $new_button));
     $container = new THBox();
     $container->add($find_button);
     $container->add($clear_button);
     $container->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($container);
     $cell->colspan = 2;
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $servidor_nome = new TDataGridColumn('servidor_nome', 'Nome', 'left', 200);
     $diames = new TDataGridColumn('diames', 'Data', 'center', 50);
     $entrada = new TDataGridColumn('entrada', 'Entrada', 'center', 40);
     $intervalo_inicio = new TDataGridColumn('intervalo_inicio', 'Saída', 'center', 50);
     $intervalo_fim = new TDataGridColumn('intervalo_fim', 'Entrada', 'center', 50);
     $saida = new TDataGridColumn('saida', 'Saída', 'center', 50);
     $ausencia_desc = new TDataGridColumn('ausencia_desc', 'Ausência', 'left');
     // add the columns to the DataGrid
     $this->datagrid->addColumn($servidor_nome);
     $this->datagrid->addColumn($diames);
     $this->datagrid->addColumn($entrada);
     $this->datagrid->addColumn($intervalo_inicio);
     $this->datagrid->addColumn($intervalo_fim);
     $this->datagrid->addColumn($saida);
     $this->datagrid->addColumn($ausencia_desc);
     $order_servidor_nome = new TAction(array($this, 'onReload'));
     $order_servidor_nome->setParameter('order', 'servidor_nome');
     $servidor_nome->setAction($order_servidor_nome);
     $order_diames = new TAction(array($this, 'onReload'));
     $order_diames->setParameter('order', 'diames');
     $diames->setAction($order_diames);
     // inline editing
     $servidor_entrada_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $servidor_entrada_edit->setField('id');
     $entrada->setEditAction($servidor_entrada_edit);
     $servidor_intervalo_inicio_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $servidor_intervalo_inicio_edit->setField('id');
     $intervalo_inicio->setEditAction($servidor_intervalo_inicio_edit);
     $servidor_intervalo_fim_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $servidor_intervalo_fim_edit->setField('id');
     $intervalo_fim->setEditAction($servidor_intervalo_fim_edit);
     $servidor_saida_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $servidor_saida_edit->setField('id');
     $saida->setEditAction($servidor_saida_edit);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('FrequenciaServidorForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('fa:pencil-square-o blue');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('fa:trash-o red');
     $action2->setField('id');
     $action3 = new TDataGridAction(array('FrequenciaServidorForm', 'onFrequencia'));
     $action3->setLabel('Informação');
     $action3->setImage('fa:info-circle blue');
     $action3->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action3);
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // 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());
     // creates the page structure using a table
     $table = new TTable();
     $table->style = 'width: 80%';
     $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'FrequenciaServidorList'));
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_System_user');
     $this->form->class = 'tform';
     // creates the table container
     $table = new TTable();
     $table->style = 'width: 100%';
     $table->addRowSet(new TLabel('Usuário'), '', '', '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     $frame_groups = new TFrame(NULL, 280);
     $frame_groups->setLegend('Grupos');
     $frame_groups->style .= ';margin: 4px';
     $frame_programs = new TFrame(NULL, 280);
     $frame_programs->setLegend('Programas');
     $frame_programs->style .= ';margin: 15px';
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     $login = new TEntry('login');
     $password = new TPassword('password');
     $repassword = new TPassword('repassword');
     $email = new TEntry('email');
     $multifield_programs = new TMultiField('programs');
     $program_id = new TDBSeekButton('program_id', 'esales', 'form_System_user', 'SystemProgram', 'name', 'programs_id', 'programs_name');
     $program_name = new TEntry('program_name');
     $groups = new TDBCheckGroup('groups', 'esales', 'SystemGroup', 'id', 'name');
     $frontpage_id = new TDBSeekButton('frontpage_id', 'esales', 'form_System_user', 'SystemProgram', 'name', 'frontpage_id', 'frontpage_name');
     $frontpage_name = new TEntry('frontpage_name');
     $scroll = new TScroll();
     $scroll->setSize(290, 230);
     $scroll->add($groups);
     $frame_groups->add($scroll);
     $frame_programs->add($multifield_programs);
     // define the sizes
     $id->setSize(100);
     $name->setSize(200);
     $login->setSize(150);
     $password->setSize(150);
     $email->setSize(200);
     $frontpage_id->setSize(100);
     $multifield_programs->setHeight(140);
     // outros
     $id->setEditable(false);
     $program_name->setEditable(false);
     $frontpage_name->setEditable(false);
     // validations
     $name->addValidation('Nome', new TRequiredValidator());
     $login->addValidation('Login', new TRequiredValidator());
     $email->addValidation('Email', new TEmailValidator());
     $program_id->setSize(50);
     $program_name->setSize(200);
     // configuracoes multifield
     $multifield_programs->setClass('SystemProgram');
     $multifield_programs->addField('id', 'ID', $program_id, 60);
     $multifield_programs->addField('name', 'Nome', $program_name, 250);
     $multifield_programs->setOrientation('horizontal');
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id, new TLabel('Nome' . ': '), $name);
     $table->addRowSet(new TLabel('login' . ': '), $login, new TLabel('Email' . ': '), $email);
     $table->addRowSet(new TLabel('Senha' . ': '), $password, new TLabel('Confirmar senha' . ': '), $repassword);
     $table->addRowSet(new TLabel('Página inicial' . ': '), $frontpage_id, new TLabel('Nome página' . ': '), $frontpage_name);
     $row = $table->addRow();
     $cell = $row->addCell($frame_groups);
     $cell->colspan = 2;
     $row = $table->addRow();
     $cell = $row->addCell($frame_programs);
     $cell->colspan = 2;
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), 'Salvar');
     $save_button->setImage('ico_save.png');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), 'Novo');
     $new_button->setImage('ico_new.png');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('SystemUserList', 'onReload')), 'Voltar para listagem');
     $list_button->setImage('ico_datagrid.png');
     // define the form fields
     $this->form->setFields(array($id, $name, $login, $password, $repassword, $multifield_programs, $frontpage_id, $frontpage_name, $groups, $email, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 4;
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemUserList'));
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
Exemplo n.º 7
0
 /**
  * Class constructor
  * Creates the page
  */
 public function __construct()
 {
     parent::__construct();
     new TSession();
     // creates the items form and add a table inside
     $this->form_item = new TForm('form_pos');
     $this->form_item->class = 'tform';
     $table_item = new TTable();
     $table_item->width = '100%';
     $this->form_item->add($table_item);
     // create the form fields
     $product_id = new TDBSeekButton('product_id', 'samples', 'form_pos', 'Product', 'description', 'product_id', 'product_description');
     $product_description = new TEntry('product_description');
     $sale_price = new TEntry('sale_price');
     $amount = new TEntry('amount');
     $discount = new TEntry('discount');
     $total = new TEntry('total');
     // add validators
     $product_id->addValidation('Product', new TRequiredValidator());
     $amount->addValidation('Amount', new TRequiredValidator());
     // define the exit actions
     $product_id->setExitAction(new TAction(array($this, 'onExitProduct')));
     $amount->setExitAction(new TAction(array($this, 'onUpdateTotal')));
     $discount->setExitAction(new TAction(array($this, 'onUpdateTotal')));
     // define some attributes
     $product_id->style = 'font-size: 17pt; height: 30px';
     $product_description->style = 'font-size: 17pt; height: 30px';
     $sale_price->style = 'font-size: 17pt; height: 30px';
     $amount->style = 'font-size: 17pt; height: 30px';
     $discount->style = 'font-size: 17pt; height: 30px';
     $total->style = 'font-size: 17pt; height: 30px';
     $product_id->button->style = 'height: 30px; margin-top:0px; vertical-align:top';
     // define some properties
     $product_id->setSize(50);
     $product_description->setEditable(FALSE);
     $sale_price->setEditable(FALSE);
     $total->setEditable(FALSE);
     $sale_price->setNumericMask(2, '.', ',');
     $discount->setNumericMask(2, '.', ',');
     $total->setNumericMask(2, '.', ',');
     $sale_price->setSize(100);
     $amount->setSize(100);
     $discount->setSize(100);
     $total->setSize(100);
     // add a row for the form title
     $row = $table_item->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $cell = $row->addCell(new TLabel('Point of Sales'));
     $cell->colspan = 4;
     // create the field labels
     $lab_pro = new TLabel('Product');
     $lab_des = new TLabel('Description');
     $lab_pri = new TLabel('Price');
     $lab_amo = new TLabel('Amount');
     $lab_dis = new TLabel('Discount');
     $lab_tot = new TLabel('Total');
     $lab_pro->setFontSize(17);
     $lab_des->setFontSize(17);
     $lab_pri->setFontSize(17);
     $lab_amo->setFontSize(17);
     $lab_dis->setFontSize(17);
     $lab_tot->setFontSize(17);
     $lab_pro->setFontFace('Trebuchet MS');
     $lab_des->setFontFace('Trebuchet MS');
     $lab_pri->setFontFace('Trebuchet MS');
     $lab_amo->setFontFace('Trebuchet MS');
     $lab_dis->setFontFace('Trebuchet MS');
     $lab_tot->setFontFace('Trebuchet MS');
     $lab_pro->setFontColor('red');
     $lab_amo->setFontColor('red');
     // creates the action button
     $button1 = new TButton('add');
     $button1->setAction(new TAction(array($this, 'onAddItem')), 'Add item');
     $button1->setImage('ico_add.png');
     // add the form fields
     $table_item->addRowSet($lab_pro, $product_id, $lab_des, $product_description);
     $table_item->addRowSet($lab_pri, $sale_price, $lab_amo, $amount);
     $table_item->addRowSet($lab_dis, $discount, $lab_tot, array($total, $button1));
     // define the form fields
     $this->form_item->setFields(array($product_id, $product_description, $sale_price, $amount, $discount, $total, $button1));
     // creates the customer form and add a table inside it
     $this->form_customer = new TForm('form_customer');
     $this->form_customer->class = 'tform';
     $table_customer = new TTable();
     $table_customer->width = '100%';
     $this->form_customer->add($table_customer);
     // add a row for the form title
     $row = $table_customer->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $cell = $row->addCell(new TLabel('Customer'));
     $cell->colspan = 5;
     // create the form fields
     $customer_id = new TDBSeekButton('customer_id', 'samples', 'form_customer', 'Customer', 'name', 'customer_id', 'customer_name');
     $customer_name = new TEntry('customer_name');
     // define validation and other properties
     $customer_id->addValidation('Customer', new TRequiredValidator());
     $customer_id->style = 'font-size: 17pt; height: 30px';
     $customer_name->style = 'font-size: 17pt; height: 30px';
     $customer_id->button->style = 'height: 30px; margin-top:0px; vertical-align:top';
     $customer_id->setSize(50);
     $customer_name->setEditable(FALSE);
     // create tha form labels
     $lab_cus = new TLabel('Customer');
     $lab_nam = new TLabel('Name');
     $lab_cus->setFontSize(17);
     $lab_nam->setFontSize(17);
     $lab_cus->setFontFace('Trebuchet MS');
     $lab_nam->setFontFace('Trebuchet MS');
     $lab_cus->setFontColor('red');
     // action button
     $button2 = new TButton('save');
     $button2->setAction(new TAction(array($this, 'onSave')), 'Save and finish');
     $button2->setImage('ico_save.png');
     // add the form fields inside the table
     $table_customer->addRowSet($lab_cus, $customer_id, $lab_nam, $customer_name, $button2);
     // define the form fields
     $this->form_customer->setFields(array($customer_id, $customer_name, $button2));
     // creates the grid for items
     $this->cartgrid = new TQuickGrid();
     $this->cartgrid->class = 'tdatagrid_table customized-table';
     $this->cartgrid->makeScrollable();
     $this->cartgrid->setHeight(150);
     parent::include_css('app/resources/custom-table.css');
     $this->cartgrid->addQuickColumn('ID', 'product_id', 'right', 25);
     $this->cartgrid->addQuickColumn('Description', 'product_description', 'left', 230);
     $this->cartgrid->addQuickColumn('Price', 'sale_price', 'right', 80);
     $this->cartgrid->addQuickColumn('Amount', 'amount', 'right', 70);
     $this->cartgrid->addQuickColumn('Discount', 'discount', 'right', 70);
     $this->cartgrid->addQuickColumn('Total', 'total', 'right', 100);
     $this->cartgrid->addQuickAction('Delete', new TDataGridAction(array($this, 'onDelete')), 'product_id', 'ico_delete.png');
     $this->cartgrid->createModel();
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form_item);
     $vbox->add(new TLabel('&nbsp;'));
     $vbox->add($this->cartgrid);
     $vbox->add(new TLabel('&nbsp;'));
     $vbox->add($this->form_customer);
     parent::add($vbox);
 }
Exemplo n.º 8
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_Ticket');
     $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('Ticket'))->colspan = 2;
     // create the form fields
     $id = new TEntry('id');
     $id->setMask('99999');
     $titulo = new TEntry('titulo');
     $criteria = new TCriteria();
     $criteria->add(new TFilter("ativo", "=", 1));
     $newparam['order'] = 'pessoa_nome';
     $newparam['direction'] = 'asc';
     $criteria->setProperties($newparam);
     // order, offset
     $solicitante_id = new TDBSeekButton('solicitante_id', 'atividade', 'form_search_Ticket', 'Pessoa', 'pessoa_nome', 'solicitante_id', 'solicitante_nome', $criteria);
     $solicitante_nome = new TEntry('solicitante_nome');
     $solicitante_nome->setEditable(FALSE);
     $criteria = new TCriteria();
     $criteria->add(new TFilter('enttipent', '=', 1));
     $entcodent = new TDBComboMultiValue('entcodent', 'atividade', 'Entidade', 'entcodent', array(0 => 'entcodent', 1 => 'entrazsoc'), 'entcodent', $criteria);
     $tipo_ticket_id = new TDBCombo('tipo_ticket_id', 'atividade', 'TipoTicket', 'id', 'nome');
     $status_ticket_id = new TDBCombo('status_ticket_id', 'atividade', 'StatusTicket', 'id', 'nome');
     $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);
     $prioridade_id = new TDBCombo('prioridade_id', 'atividade', 'Prioridade', 'id', 'nome');
     $sistema_id = new TDBCombo('sistema_id', 'atividade', 'Sistema', 'id', 'nome', 'nome');
     // define the sizes
     $id->setSize(50);
     $titulo->setSize(274);
     $solicitante_id->setSize(50);
     $solicitante_nome->setSize(200);
     $entcodent->setSize(274);
     $status_ticket_id->setSize(100);
     $tipo_ticket_id->setSize(200);
     $sistema_id->setSize(200);
     $responsavel_id->setSize(274);
     $prioridade_id->setSize(100);
     // add one row for each form field
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('Titulo:'), $titulo);
     $table->addRowSet(new TLabel('Cliente:'), array($solicitante_id, $solicitante_nome));
     $table->addRowSet(new TLabel('Entidade:'), $entcodent);
     $table->addRowSet(new TLabel('Responsável:'), $responsavel_id);
     $table->addRowSet(new TLabel('Tipo Ticket:'), $tipo_ticket_id);
     $table->addRowSet(new TLabel('Sistema:'), $sistema_id);
     $table->addRowSet(new TLabel('Status:'), $status_ticket_id);
     $table->addRowSet(new TLabel('Prioridade:'), $prioridade_id);
     $this->form->setFields(array($id, $titulo, $solicitante_id, $solicitante_nome, $entcodent, $status_ticket_id, $tipo_ticket_id, $responsavel_id, $prioridade_id, $sistema_id));
     // keep the form filled during navigation with session data
     $this->form->setData(TSession::getValue('Ticket_filter_data'));
     // create two action buttons to the form
     $find_button = TButton::create('find', array($this, 'onSearch'), _t('Find'), 'ico_find.png');
     $new_button = TButton::create('new', array('TicketForm', 'onEdit'), _t('New'), 'fa:plus-square green');
     $clean_button = TButton::create('clean', array($this, 'onClean'), 'Limpar', 'ico_close.png');
     $this->form->addField($find_button);
     $this->form->addField($new_button);
     $this->form->addField($clean_button);
     $buttons_box = new THBox();
     $buttons_box->add($find_button);
     $buttons_box->add($new_button);
     $buttons_box->add($clean_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
     $this->datagrid = new TDataGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $status_ticket_id = new TDataGridColumn('status_ticket_id', 'S', 'center', 20);
     $id = new TDataGridColumn('id', 'ID', 'left', 20);
     $titulo = new TDataGridColumn('titulo', 'Titulo', 'left', 250);
     $solicitante_id = new TDataGridColumn('solicitante_id', 'Cliente', 'left', 250);
     $responsavel_id = new TDataGridColumn('pessoa_responsavel->pessoa_nome', 'Responsavel', 'left', 100);
     $prioridade_id = new TDataGridColumn('prioridade->nome', 'Pri', 'right', 20);
     //get_prioridade()->nome
     $status_ticket_id->setTransformer(array($this, 'retornaStatus'));
     $solicitante_id->setTransformer(array($this, 'retornaCliente'));
     $responsavel_id->setTransformer(array($this, 'retornaPessoa'));
     $prioridade_id->setTransformer(array($this, 'retornaPrioridade'));
     // add the columns to the DataGrid
     $this->datagrid->addColumn($status_ticket_id);
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($titulo);
     $this->datagrid->addColumn($solicitante_id);
     $this->datagrid->addColumn($responsavel_id);
     $this->datagrid->addColumn($prioridade_id);
     // creates the datagrid column actions
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'id');
     $id->setAction($order_id);
     $order_titulo = new TAction(array($this, 'onReload'));
     $order_titulo->setParameter('order', 'titulo');
     $titulo->setAction($order_titulo);
     $order_status_ticket_id = new TAction(array($this, 'onReload'));
     $order_status_ticket_id->setParameter('order', 'status_ticket_id');
     $status_ticket_id->setAction($order_status_ticket_id);
     $order_prioridade_id = new TAction(array($this, 'onReload'));
     $order_prioridade_id->setParameter('order', 'prioridade->nome');
     $prioridade_id->setAction($order_prioridade_id);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('TicketForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('fa:pencil-square-o blue fa-lg');
     $action1->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     // 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());
     // create the page container
     $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation);
     $container->style = 'width: 100%;max-width: 1200px;';
     $this->datagrid->style = '  width: 100%;  max-width: 1200px;';
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     $this->string = new StringsUtil();
     // creates the form
     $this->form = new TForm('form_search_Atividade');
     $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('Atividade'))->colspan = 2;
     // create the form fields
     $id = new THidden('id');
     $data_atividade_inicial = new TDate('data_atividade_inicial');
     $data_atividade_inicial->setMask('dd/mm/yyyy');
     $data_atividade_final = new TDate('data_atividade_final');
     $data_atividade_final->setMask('dd/mm/yyyy');
     $criteria = new TCriteria();
     $criteria->add(new TFilter("origem", "=", 1));
     $criteria->add(new TFilter("codigo_cadastro_origem", "=", 100));
     $criteria->add(new TFilter("ativo", "=", 1));
     $criteria->add(new TFilter("usuario", "is not "));
     $colaborador_id = new TDBCombo('colaborador_id', 'atividade', 'Pessoa', 'pessoa_codigo', 'pessoa_nome', 'pessoa_nome', $criteria);
     $tipo_atividade_id = new TDBCombo('tipo_atividade_id', 'atividade', 'TipoAtividade', 'id', 'nome', 'nome');
     $ticket_id = new TDBMultiSearch('ticket_id', 'atividade', 'Ticket', 'id', 'titulo', 'titulo');
     $pesquisa_master = new TEntry('pesquisa_master');
     $criteria = new TCriteria();
     $criteria->add(new TFilter("ativo", "=", 1));
     $newparam['order'] = 'pessoa_nome';
     $newparam['direction'] = 'asc';
     $criteria->setProperties($newparam);
     // order, offset
     $solicitante_id = new TDBSeekButton('solicitante_id', 'atividade', 'form_search_Ticket', 'Pessoa', 'pessoa_nome', 'solicitante_id', 'solicitante_nome', $criteria);
     $solicitante_nome = new TEntry('solicitante_nome');
     $solicitante_nome->setEditable(FALSE);
     $total_atividades = new TEntry('total_atividades');
     $total_atividades->setEditable(FALSE);
     // define the sizes
     $id->setSize(50);
     $data_atividade_inicial->setSize(100);
     $data_atividade_final->setSize(100);
     $colaborador_id->setSize(300);
     $tipo_atividade_id->setSize(300);
     $ticket_id->setMinLength(0);
     $ticket_id->setMaxSize(1);
     $ticket_id->setSize(300);
     $ticket_id->setOperator('ilike');
     $solicitante_id->setSize(40);
     $solicitante_nome->setSize(235);
     $total_atividades->setSize(100);
     $pesquisa_master->setSize(300);
     // add one row for each form field
     $table->addRowSet(new TLabel('Solicitante:'), array($solicitante_id, $solicitante_nome));
     $table->addRowSet(new TLabel('Colaborador:'), $colaborador_id);
     $table->addRowSet(new TLabel('Dt. Atividades inicio:'), array($data_atividade_inicial, $label_data_fim = new TLabel('Fim:'), $data_atividade_final));
     $label_data_fim->setSize(48);
     $table->addRowSet(new TLabel('Atividade:'), $tipo_atividade_id);
     $table->addRowSet(new TLabel('Ticket:'), $ticket_id);
     $table->addRowSet(new TLabel('Pesquisa por palavra:'), $pesquisa_master);
     $table->addRowSet(new TLabel('Total horas atividades:'), $total_atividades);
     $table->addRowSet(new TLabel(''), $id);
     $this->form->setFields(array($id, $data_atividade_inicial, $data_atividade_final, $colaborador_id, $tipo_atividade_id, $ticket_id, $solicitante_id, $solicitante_nome, $pesquisa_master, $total_atividades));
     $change_data = new TAction(array($this, 'onChangeData'));
     $data_atividade_inicial->setExitAction($change_data);
     $data_atividade_final->setExitAction($change_data);
     // keep the form filled during navigation with session data
     $this->form->setData(TSession::getValue('Atividade_filter_data'));
     // create two action buttons to the form
     $find_button = TButton::create('find', array($this, 'onSearch'), _t('Find'), 'ico_find.png');
     $new_button = TButton::create('new', array('AtividadeForm', 'onEdit'), _t('New'), 'fa:plus-square green');
     $clean_button = TButton::create('clean', array($this, 'onClean'), 'Limpar', 'ico_close.png');
     $this->form->addField($find_button);
     $this->form->addField($new_button);
     $this->form->addField($clean_button);
     $buttons_box = new THBox();
     $buttons_box->add($find_button);
     $buttons_box->add($new_button);
     $buttons_box->add($clean_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
     $this->datagrid = new TDataGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $data_atividade = new TDataGridColumn('data_atividade', 'Data', 'right', 40);
     $hora_inicio = new TDataGridColumn('hora_inicio', 'Inicio', 'right', 20);
     $hora_fim = new TDataGridColumn('hora_fim', 'Fim', 'right', 20);
     $hora_qte = new TDataGridColumn('hora_qte', 'Qtde', 'right', 20);
     $colaborador_id = new TDataGridColumn('pessoa->pessoa_nome', 'Colaborador', 'left', 50);
     $tipo_atividade_id = new TDataGridColumn('tipo_atividade->nome', 'Atividade', 'left', 100);
     //get_tipo_atividade()->nome
     $sistema_id = new TDataGridColumn('sistema->nome', 'Sistema', 'left', 100);
     $ticket_id = new TDataGridColumn('ticket->titulo', 'Ticket', 'left', 200);
     // get_ticket()->titulo
     // transformers
     $colaborador_id->setTransformer(array($this, 'retornaPessoa'));
     $hora_qte->setTransformer(array($this, 'calculaDiferenca'));
     $data_atividade->setTransformer(array('StringsUtil', 'formatDateBR'));
     $hora_inicio->setTransformer(array('StringsUtil', 'retira_segundos'));
     $hora_fim->setTransformer(array('StringsUtil', 'retira_segundos'));
     // add the columns to the DataGrid
     $this->datagrid->addColumn($data_atividade);
     $this->datagrid->addColumn($hora_inicio);
     $this->datagrid->addColumn($hora_fim);
     $this->datagrid->addColumn($hora_qte);
     $this->datagrid->addColumn($colaborador_id);
     $this->datagrid->addColumn($tipo_atividade_id);
     $this->datagrid->addColumn($sistema_id);
     $this->datagrid->addColumn($ticket_id);
     // creates the datagrid column actions
     $order_data_atividade = new TAction(array($this, 'onReload'));
     $order_data_atividade->setParameter('order', 'data_atividade');
     $data_atividade->setAction($order_data_atividade);
     $order_colaborador_id = new TAction(array($this, 'onReload'));
     $order_colaborador_id->setParameter('order', 'pessoa->pessoa_nome');
     $colaborador_id->setAction($order_colaborador_id);
     $order_tipo_atividade_id = new TAction(array($this, 'onReload'));
     $order_tipo_atividade_id->setParameter('order', 'tipo_atividade->nome');
     $tipo_atividade_id->setAction($order_tipo_atividade_id);
     $order_sistema_id = new TAction(array($this, 'onReload'));
     $order_sistema_id->setParameter('order', 'sistema->nome');
     $sistema_id->setAction($order_sistema_id);
     $order_ticket_id = new TAction(array($this, 'onReload'));
     $order_ticket_id->setParameter('order', 'ticket->titulo');
     $ticket_id->setAction($order_ticket_id);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('AtividadeForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('fa:pencil-square-o blue fa-lg');
     $action1->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     // 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());
     // create the page container
     $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation);
     $container->style = 'width: 100%;max-width: 1200px;';
     $this->datagrid->style = '  width: 100%;  max-width: 1200px;';
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the notebook
     $this->notebook = new TNotebook();
     $this->notebook->setSize(700, 390);
     // creates the table container
     $tableCampos = new TTable();
     // creates the form
     $this->form = new TForm('form_System_user');
     $this->notebook->appendPage(_t('User'), $tableCampos);
     // add the notebook inside the form
     $this->form->add($this->notebook);
     $frame_groups = new TFrame(300, 250);
     $frame_groups->setLegend(_t('Groups'));
     $frame_groups->style = 'margin: 4px';
     $frame_programs = new TFrame(340, 250);
     $frame_programs->setLegend(_t('Programs'));
     $frame_programs->style = 'margin: 4px';
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     $login = new TEntry('login');
     $password = new TPassword('password');
     $repassword = new TPassword('repassword');
     $email = new TEntry('email');
     $multifield_programs = new TMultiField('programs');
     $program_id = new TDBSeekButton('program_id', 'permission', 'form_System_user', 'SystemProgram', 'name', 'programs_id', 'programs_name');
     $program_name = new TEntry('program_name');
     $groups = new TDBCheckGroup('groups', 'permission', 'SystemGroup', 'id', 'name');
     $frontpage_id = new TDBSeekButton('frontpage_id', 'permission', 'form_System_user', 'SystemProgram', 'name', 'frontpage_id', 'frontpage_name');
     $frontpage_name = new TEntry('frontpage_name');
     $scroll = new TScroll();
     $scroll->setSize(290, 230);
     $scroll->add($groups);
     $frame_groups->add($scroll);
     $frame_programs->add($multifield_programs);
     // define the sizes
     $id->setSize(100);
     $name->setSize(200);
     $login->setSize(150);
     $password->setSize(150);
     $email->setSize(200);
     $frontpage_id->setSize(100);
     $multifield_programs->setHeight(140);
     // outros
     $id->setEditable(false);
     $program_name->setEditable(false);
     $frontpage_name->setEditable(false);
     // validations
     $name->addValidation(_t('Name'), new TRequiredValidator());
     $login->addValidation('Login', new TRequiredValidator());
     $email->addValidation('Email', new TEmailValidator());
     $program_id->setSize(50);
     $program_name->setSize(200);
     // configuracoes multifield
     $multifield_programs->setClass('SystemProgram');
     $multifield_programs->addField('id', 'ID', $program_id, 60);
     $multifield_programs->addField('name', _t('Name'), $program_name, 250);
     $multifield_programs->setOrientation('horizontal');
     // add a row for the field id
     $tableCampos->addRowSet(new TLabel('ID:'), $id, new TLabel(_t('Name') . ': '), $name);
     $tableCampos->addRowSet(new TLabel(_t('Login') . ': '), $login, new TLabel(_t('Email') . ': '), $email);
     $tableCampos->addRowSet(new TLabel(_t('Password') . ': '), $password, new TLabel(_t('Password confirmation') . ': '), $repassword);
     $tableCampos->addRowSet(new TLabel(_t('Front page') . ': '), $frontpage_id, new TLabel(_t('Page name') . ': '), $frontpage_name);
     $row = $tableCampos->addRow();
     $cell = $row->addCell($frame_groups);
     $cell->colspan = 2;
     $cell = $row->addCell($frame_programs);
     $cell->colspan = 2;
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('ico_save.png');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('SystemUserList', 'onReload')), _t('Back to the listing'));
     $list_button->setImage('ico_datagrid.png');
     // define the form fields
     $this->form->setFields(array($id, $name, $login, $password, $repassword, $multifield_programs, $frontpage_id, $frontpage_name, $groups, $email, $save_button, $new_button, $list_button));
     $table_buttons = new TTable();
     $row_buttons = $table_buttons->addRow();
     $row_buttons->addCell($save_button);
     $row_buttons->addCell($new_button);
     $row_buttons->addCell($list_button);
     $container = new TTable();
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemUserList'));
     $container->addRow()->addCell($this->form);
     $container->addRow()->addCell($table_buttons);
     // add the form to the page
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_FreqServForm');
     $this->form->class = 'tform';
     // creates the table container
     $table = new TTable();
     $table->style = 'width: 100%';
     $table->addRowSet(new TLabel('Frequência'), '', '', '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     $frame_horarios = new TFrame(NULL, 210);
     $frame_horarios->setLegend('Horários');
     $frame_horarios->style .= ';margin: 15px';
     $frame_ausencia = new TFrame(NULL, 210);
     $frame_ausencia->setLegend('Ausência');
     $frame_ausencia->style .= ';margin: 15px';
     // create the form fields
     $id = new TEntry('id');
     $servidor_id = new TDBSeekButton('servidor_id', 'lacenrh', 'form_FreqServForm', 'Servidor', 'servidor', 'servidor_id', 'servidor_nome');
     $servidor_nome = new TEntry('servidor_nome');
     $diames = new TDate('diames');
     $entrada = new TEntry('entrada');
     $intervalo_inicio = new TEntry('intervalo_inicio');
     $intervalo_fim = new TEntry('intervalo_fim');
     $saida = new TEntry('saida');
     $ausencia_id = new TDBSeekButton('ausencia_id', 'lacenrh', 'form_FreqServForm', 'Ausencia', 'ausencia', 'ausencia_id', 'ausencia_desc');
     $ausencia_desc = new TEntry('ausencia_desc');
     $horas_justificadas = new TEntry('horas_justificadas');
     $justificativa = new TText('justificativa');
     $horas_trabalhadas = new TEntry('horas_trabalhadas');
     // define the sizes
     $id->setSize(40);
     $servidor_id->setSize(40);
     $servidor_nome->setSize(300);
     $diames->setSize(100);
     $entrada->setSize(50);
     $intervalo_inicio->setSize(50);
     $intervalo_fim->setSize(50);
     $saida->setSize(50);
     $ausencia_id->setSize(40);
     $ausencia_desc->setSize(200);
     $horas_justificadas->setSize(50);
     $justificativa->setSize(200, 50);
     $horas_trabalhadas->setSize(200, 50);
     // outras propriedades
     $id->setEditable(false);
     $servidor_nome->setEditable(false);
     $diames->setMask('dd/mm/yyyy');
     $entrada->setMask('99:99');
     $entrada->setValue('00:00');
     $intervalo_inicio->setMask('99:99');
     $intervalo_inicio->setValue('00:00');
     $intervalo_fim->setMask('99:99');
     $intervalo_fim->setValue('00:00');
     $saida->setMask('99:99');
     $saida->setValue('00:00');
     $ausencia_desc->setEditable(false);
     $horas_justificadas->setMask('99:99');
     $horas_justificadas->setValue('00:00');
     $horas_trabalhadas->setMask('99:99');
     // validations
     $servidor_id->addValidation('Servidor', new TRequiredValidator());
     $servidor_nome->addValidation('Nome', new TRequiredValidator());
     $diames->addValidation('Data', new TRequiredValidator());
     $table_horarios = new TTable();
     $table_horarios->addRowSet(new TLabel('Data ' . ': '), $diames);
     $table_horarios->addRowSet(new TLabel('Entrada ' . ': '), $entrada);
     $table_horarios->addRowSet(new TLabel('Intervalo - Início ' . ': '), $intervalo_inicio);
     $table_horarios->addRowSet(new TLabel('Intervalo - Fim' . ': '), $intervalo_fim);
     $table_horarios->addRowSet(new TLabel('Saída' . ': '), $saida);
     $frame_horarios->add($table_horarios);
     $table_ausencia = new TTable();
     $table_ausencia->addRowSet(new TLabel('Motivo ' . ': '), $ausencia_id);
     $table_ausencia->addRowSet(new TLabel('Descrição ' . ': '), $ausencia_desc);
     $table_ausencia->addRowSet(new TLabel('Horas Justificadas ' . ': '), $horas_justificadas);
     $table_ausencia->addRowSet(new TLabel('Justificativa ' . ': '), $justificativa);
     $frame_ausencia->add($table_ausencia);
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('Servidor' . ': '), $servidor_id);
     $table->addRowSet(new TLabel('Nome' . ': '), $servidor_nome);
     $row = $table->addRow();
     $cell = $row->addCell($frame_horarios);
     $cell->colspan = 2;
     $cell = $row->addCell($frame_ausencia);
     $cell->colspan = 2;
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('fa:floppy-o fa-lg');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green fa-lg');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('FrequenciaServidorList', 'onReload')), _t('Back to the listing'));
     $list_button->setImage('fa:table blue fa-lg');
     // define the form fields
     $this->form->setFields(array($id, $servidor_id, $servidor_nome, $diames, $entrada, $intervalo_inicio, $intervalo_fim, $saida, $ausencia_id, $ausencia_desc, $horas_justificadas, $justificativa, $horas_trabalhadas, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 4;
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'FrequenciaServidorList'));
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
Exemplo n.º 12
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_Sale');
     $this->form->class = 'tform';
     // CSS class
     parent::include_css('app/resources/custom-frame.css');
     $table_master = new TTable();
     $table_master->width = '100%';
     $table_master->addRowSet(new TLabel('Sale'), '', '')->class = 'tformtitle';
     // add a table inside form
     $table_general = new TTable();
     $table_general->width = '100%';
     $tableProduct = new TTable();
     $tableProduct->width = '100%';
     $frame_general = new TFrame();
     $frame_general->setLegend('General data');
     $frame_general->style = 'background:whiteSmoke';
     $frame_general->add($table_general);
     $table_master->addRow()->addCell($frame_general)->colspan = 2;
     $row = $table_master->addRow();
     $row->addCell($tableProduct);
     $this->form->add($table_master);
     // master fields
     $id = new TEntry('id');
     $date = new TDate('date');
     $customer_id = new TDBSeekButton('customer_id', 'samples', $this->form->getName(), 'Customer', 'name', 'customer_id', 'customer_name');
     $customer_name = new TEntry('customer_name');
     $obs = new TText('obs');
     // detail fields
     $product_id = new TDBSeekButton('product_id', 'samples', $this->form->getName(), 'Product', 'description', 'product_id', 'product_name');
     $product_name = new TEntry('product_name');
     $sale_price = new TEntry('product_price');
     $amount = new TEntry('product_amount');
     $discount = new TEntry('product_discount');
     $total = new TEntry('product_total');
     $product_id->setExitAction(new TAction(array($this, 'onProductChange')));
     $id->setSize(40);
     $date->setSize(100);
     $obs->setSize(400, 100);
     $product_id->setSize(50);
     $customer_id->setSize(50);
     $id->setEditable(false);
     $product_name->setEditable(false);
     $customer_name->setEditable(false);
     $date->addValidation('Date', new TRequiredValidator());
     $customer_id->addValidation('Customer', new TRequiredValidator());
     // pedido
     $table_general->addRowSet(new TLabel('ID'), $id);
     $table_general->addRowSet($label_date = new TLabel('Date (*)'), $date);
     $table_general->addRowSet($label_customer = new TLabel('Customer (*)'), array($customer_id, $customer_name));
     $table_general->addRowSet(new TLabel('Obs'), $obs);
     $label_date->setFontColor('#FF0000');
     // products
     $frame_product = new TFrame();
     $frame_product->setLegend('Products');
     $row = $tableProduct->addRow();
     $row->addCell($frame_product);
     $add_product = new TButton('add_product');
     $action_product = new TAction(array($this, 'onProductAdd'));
     $add_product->setAction($action_product, 'Register');
     $add_product->setImage('fa:save');
     $subtable_product = new TTable();
     $frame_product->add($subtable_product);
     $subtable_product->addRowSet($label_product = new TLabel('Product (*)'), array($product_id, $product_name));
     $subtable_product->addRowSet($label_sale_price = new TLabel('Price (*)'), $sale_price);
     $subtable_product->addRowSet($label_amount = new TLabel('Amount(*)'), $amount);
     $subtable_product->addRowSet(new TLabel('Discount'), $discount);
     $subtable_product->addRowSet($add_product);
     $label_product->setFontColor('#FF0000');
     $label_amount->setFontColor('#FF0000');
     $label_sale_price->setFontColor('#FF0000');
     $this->product_list = new TQuickGrid();
     $this->product_list->setHeight(175);
     $this->product_list->makeScrollable();
     $this->product_list->disableDefaultClick();
     $this->product_list->addQuickColumn('', 'edit', 'left', 50);
     $this->product_list->addQuickColumn('', 'delete', 'left', 50);
     $this->product_list->addQuickColumn('ID', 'product_id', 'center', 40);
     $this->product_list->addQuickColumn('Product', 'product_name', 'left', 200);
     $this->product_list->addQuickColumn('Amount', 'product_amount', 'left', 60);
     $this->product_list->addQuickColumn('Price', 'product_price', 'right', 80);
     $this->product_list->addQuickColumn('Discount', 'product_discount', 'right', 80);
     $this->product_list->createModel();
     $row = $tableProduct->addRow();
     $row->addCell($this->product_list);
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('ico_save.png');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onClear')), _t('New'));
     $new_button->setImage('ico_new.png');
     // define form fields
     $this->formFields = array($id, $date, $customer_id, $customer_name, $obs, $product_id, $product_name, $sale_price, $amount, $discount, $total, $add_product, $save_button, $new_button);
     $this->form->setFields($this->formFields);
     $table_master->addRowSet(array($save_button, $new_button), '', '')->class = 'tformaction';
     // CSS class
     // create the page container
     $container = new TVBox();
     $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->add($this->form);
     parent::add($container);
 }