/** * 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); }
/** * 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(' ')); $vbox->add($this->cartgrid); $vbox->add(new TLabel(' ')); $vbox->add($this->form_customer); parent::add($vbox); }
/** * 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); }