コード例 #1
0
 /**
  * Executed when the user clicks at a tree node
  * @param $param URL parameters containing key and value
  */
 public function onSelect($param)
 {
     $obj = new StdClass();
     $obj->key = $param['key'];
     // get node key (index)
     $obj->value = $param['value'];
     // get node value (contend)
     // fill the form with this object attributes
     TForm::sendData('form_test', $obj);
 }
コード例 #2
0
 public static function onChangeAction($param)
 {
     $obj = new StdClass();
     $id = $param['tipo_material_consumo_id'];
     TTransaction::open("app");
     $entidade = new TipoMaterialConsumo($id);
     $obj->custo = $entidade->custo;
     TForm::sendData('form_MaterialConsumo', $obj);
     TTransaction::close();
 }
コード例 #3
0
 /**
  * Executed when the user chooses the record
  */
 function onSelect($param)
 {
     try {
         $key = $param['key'];
         TTransaction::open('samples');
         // load the active record
         $city = new City($key);
         // closes the transaction
         TTransaction::close();
         $object = new StdClass();
         $object->city_id1 = $city->id;
         $object->city_name1 = $city->name;
         TForm::sendData('form_seek_sample', $object);
         parent::closeWindow();
         // closes the window
     } catch (Exception $e) {
         // em caso de exceção
         // clear fields
         $object = new StdClass();
         $object->city_id1 = '';
         $object->city_name1 = '';
         TForm::sendData('form_seek_sample', $object);
         // undo pending operations
         TTransaction::rollback();
     }
 }
コード例 #4
0
 /**
  * Action to be executed when the user changes the combo_change field
  */
 public static function onChangeAction($param)
 {
     $obj = new StdClass();
     $obj->response_c = 'Resp. for opt "' . $param['combo_change'] . '" ' . date('H:m:s');
     TForm::sendData('form_interaction', $obj);
     $options = array();
     $options[1] = $param['combo_change'] . ' - one';
     $options[2] = $param['combo_change'] . ' - two';
     $options[3] = $param['combo_change'] . ' - three';
     TCombo::reload('form_interaction', 'response_b', $options);
 }
コード例 #5
0
 /**
  * Executed when the user chooses the record
  */
 function onSelect($param)
 {
     try {
         $key = $param['key'];
         TTransaction::open('tecbiz');
         // load the active record
         $pessoa = new Pessoa($key);
         // closes the transaction
         TTransaction::close();
         $object = new StdClass();
         $object->city_id1 = $pessoa->pessoa_codigo;
         $object->city_name1 = $pessoa->pessoa_nome;
         TForm::sendData('form_seek_sample', $object);
         parent::closeWindow();
         // closes the window
     } catch (Exception $e) {
         // clear fields
         $object = new StdClass();
         $object->city_id1 = '';
         $object->city_name1 = '';
         TForm::sendData('form_seek_sample', $object);
         // undo pending operations
         TTransaction::rollback();
     }
 }
コード例 #6
0
 /**
  * Executed when the user clicks at a tree node
  * @param $param URL parameters containing key and value
  */
 public function onSelect($param)
 {
     $obj = new StdClass();
     $obj->year = $param['year'];
     $obj->month = $param['month'];
     $obj->day = $param['day'];
     $date = $obj->year . '-' . $obj->month . '-' . $obj->day;
     // fill the form with this object attributes
     TForm::sendData('form_test', $obj);
     new TMessage('info', 'You have selected: ' . $date);
 }
コード例 #7
0
 /**
  * Update the total based on the sale price, amount and discount
  */
 public static function onUpdateTotal($param)
 {
     $discount = (double) str_replace(',', '', $param['discount']);
     $sale_price = (double) str_replace(',', '', $param['sale_price']);
     $amount = (double) str_replace(',', '', $param['amount']);
     $obj = new StdClass();
     $obj->total = number_format($sale_price * $amount - $discount, 2, '.', ',');
     TForm::sendData('form_pos', $obj);
 }
コード例 #8
0
 public static function onChangeData($param)
 {
     $obj = new StdClass();
     $string = new StringsUtil();
     if (strlen($param['data_inicial']) == 10 && strlen($param['data_final']) == 10) {
         if (strtotime($string->formatDate($param['data_final'])) < strtotime($string->formatDate($param['data_inicial']))) {
             $obj->data_final = '';
             new TMessage('error', 'Data de cadastro final menor que data inicial');
         } else {
             // Start date
             $date = $string->formatDate($param['data_inicial']);
             // End date
             $end_date = $string->formatDate($param['data_final']);
             while (strtotime($date) <= strtotime($end_date)) {
                 if (date("w", strtotime($date)) == 0 or date("w", strtotime($date)) == 6) {
                     $obj->data_final = '';
                     new TMessage('error', 'Existe final de semana no periodo informado');
                     break;
                 }
                 $date = date("Y-m-d", strtotime("+1 day", strtotime($date)));
             }
         }
     }
     TForm::sendData('form_Atividade', $obj, FALSE, FALSE);
 }
コード例 #9
0
 public static function onChangeAction($param)
 {
     $obj = new StdClass();
     $hora = $param['qtde_horas'];
     $minutos = str_pad($param['qtde_minutos'], 2, 0, STR_PAD_LEFT);
     $hora_fim = $hora . ':' . $minutos . ':00';
     $HoraEntrada = new DateTime($param['hora_inicio']);
     $HoraSaida = new DateTime($hora_fim);
     $diffHoras = $HoraSaida->diff($HoraEntrada)->format('%H:%I:%S');
     TButton::enableField('form_Atividade', 'save');
     if ($HoraEntrada > $HoraSaida) {
         new TMessage('error', 'Hora final menor que a Hora inicial!');
         TButton::disableField('form_Atividade', 'save');
         $horario = explode(':', $param['hora_inicio']);
         $obj->qtde_horas = $horario[0];
         $obj->qtde_minutos = $horario[1];
     } else {
         $obj->hora_fim = $hora_fim;
         $obj->tempo_atividade = $diffHoras;
     }
     TForm::sendData('form_Atividade', $obj, FALSE, FALSE);
 }
コード例 #10
0
 public static function onTotalAtividades($param)
 {
     $obj = new StdClass();
     $obj->total_atividades = $param;
     TForm::sendData('form_search_Atividade', $obj, FALSE, FALSE);
 }
コード例 #11
0
 public static function onSearch($param)
 {
     $obj = new StdClass();
     $data = new PCepProgs($param['cep']);
     $obj->logradouro = $data->getRua();
     $obj->cidade = $data->getCidade();
     $obj->bairro = $data->getBairro();
     $obj->uf = $data->getUf();
     TForm::sendData('form_Clientes', $obj);
 }
コード例 #12
0
 /**
  * method onSelect()
  * Selects the record
  */
 public function onSelect($param)
 {
     try {
         $key = $param['key'];
         TTransaction::open('samples');
         $city = new City($key);
         // close the transaction
         TTransaction::close();
         $object = new StdClass();
         $object->city_id = $city->id;
         $object->city_name = $city->name;
         TForm::sendData('form_customer', $object);
         parent::closeWindow();
         // close the window
     } catch (Exception $e) {
         // clear fields
         $object = new StdClass();
         $object->city_id = '';
         $object->city_name = '';
         TForm::sendData('form_customer', $object);
         // undo pending operations
         TTransaction::rollback();
     }
 }
コード例 #13
0
 /**
  * Executed when the user chooses the record
  */
 function onSelect($param)
 {
     try {
         $key = $param['key'];
         TTransaction::open('atividade');
         // load the active record
         $pessoa = new Pessoa($key);
         $object = new StdClass();
         $object->solicitante_id = $pessoa->pessoa_codigo;
         $object->solicitante_nome = $pessoa->pessoa_nome;
         $object->origem_nome = $pessoa->origem_nome;
         // closes the transaction
         TTransaction::close();
         TForm::sendData('form_Ticket', $object);
         parent::closeWindow();
         // closes the window
     } catch (Exception $e) {
         // clear fields
         $object = new StdClass();
         $object->solicitante_id = '';
         $object->solicitante_nome = '';
         $object->origem_nome = '';
         TForm::sendData('form_Ticket', $object);
         // undo pending operations
         TTransaction::rollback();
     }
 }
コード例 #14
0
 /**
  * On product change
  */
 static function onProductChange($params)
 {
     if (isset($params['product_id']) && $params['product_id']) {
         try {
             TTransaction::open('samples');
             $product = new Product($params['product_id']);
             $fill_data = new StdClass();
             $fill_data->product_price = $product->sale_price;
             TForm::sendData('form_Sale', $fill_data);
             TTransaction::close();
         } catch (Exception $e) {
             new TMessage('error', '<b>Error</b> ' . $e->getMessage());
             TTransaction::rollback();
         }
     }
 }
コード例 #15
0
 /**
  * Select the register by ID and return the information to the main form
  *     When using onblur signal, AJAX passes all needed parameters via GET
  *     instead of calling onSetup before.
  */
 public function onSelect($param)
 {
     $key = $param['key'];
     $database = isset($param['database']) ? $param['database'] : TSession::getValue('standard_seek_database');
     $receive_key = isset($param['receive_key']) ? $param['receive_key'] : TSession::getValue('standard_seek_receive_key');
     $receive_field = isset($param['receive_field']) ? $param['receive_field'] : TSession::getValue('standard_seek_receive_field');
     $display_field = isset($param['display_field']) ? $param['display_field'] : TSession::getValue('standard_seek_display_field');
     $parent = isset($param['parent']) ? $param['parent'] : TSession::getValue('standard_seek_parent');
     try {
         TTransaction::open($database);
         // load the active record
         $model = isset($param['model']) ? $param['model'] : TSession::getValue('standard_seek_model');
         $activeRecord = new $model($key);
         TTransaction::close();
         $object = new StdClass();
         $object->{$receive_key} = $activeRecord->{'id'};
         $object->{$receive_field} = $activeRecord->{$display_field};
         TForm::sendData($parent, $object);
         parent::closeWindow();
         // closes the window
     } catch (Exception $e) {
         // clear fields
         $object = new StdClass();
         $object->{$receive_key} = '';
         $object->{$receive_field} = '';
         TForm::sendData($parent, $object);
         // undo all pending operations
         TTransaction::rollback();
     }
 }
コード例 #16
0
 /**
  * Executed when the user chooses the record
  */
 function onSelect($param)
 {
     $key = $param['key'];
     $prefix = TSession::getValue('prefix');
     try {
         $model = isset($param['model']) ? $param['model'] : TSession::getValue('model');
         TTransaction::open(TSession::getValue('banco'));
         // load the active record
         $campos = new $model($key);
         $cliente = new stdClass();
         foreach (TSession::getValue('campos') as $field => $label) {
             $cliente->{$prefix . '_' . $field} = $campos->{$field};
         }
         TForm::sendData(TSession::getValue('parent'), $cliente);
         parent::closeWindow();
         // closes the window
     } catch (Exception $e) {
         throw new Exception('Erro com a mensagem ' . $e->getMesage());
         // undo pending operations
         TTransaction::rollback();
     }
     parent::closeWindow();
 }
コード例 #17
0
 public static function onChangeData($param)
 {
     $obj = new StdClass();
     $string = new StringsUtil();
     if (strlen($param['data_atividade_inicio']) == 10 && strlen($param['data_atividade_final']) == 10) {
         if (strtotime($string->formatDate($param['data_atividade_final'])) < strtotime($string->formatDate($param['data_atividade_inicio']))) {
             $obj->data_atividade_final = '';
             new TMessage('error', 'Data de atividade final menor que data de atividade inicial');
         }
     }
     TForm::sendData('form_Ticket', $obj, FALSE, FALSE);
 }
コード例 #18
0
ファイル: ItemSeek.class.php プロジェクト: jhonleandres/crmbf
 /**
  * Executed when the user chooses the record
  */
 public function onSelect($param)
 {
     try {
         $key = $param['key'];
         TTransaction::open('library');
         // load the active record
         $rep = new TRepository('Item');
         $criteria = new TCriteria();
         $criteria->add(new TFilter('barcode', '=', $key));
         $objects = $rep->load($criteria);
         if ($objects) {
             $item = $objects[0];
             $object = new StdClass();
             $object->barcode_input = $item->barcode;
             $object->book_title_input = $item->title;
             TForm::sendData('form_Loan', $object);
         } else {
             $object = new StdClass();
             $object->barcode_input = '';
             $object->book_title_input = '';
             TForm::sendData('form_Loan', $object);
         }
         // closes the transaction
         TTransaction::close();
         parent::closeWindow();
         // closes the window
     } catch (Exception $e) {
         // exibe a mensagem gerada pela exceção
         new TMessage('error', $e->getMessage());
         // desfaz todas alterações no banco de dados
         TTransaction::rollback();
     }
 }
コード例 #19
0
 public static function onCalculaValorTotal($param)
 {
     $obj = new StdClass();
     $string = new StringsUtil();
     $horas = 0;
     $valor = 0;
     $desconto = 0;
     if (isset($param['orcamento_horas'])) {
         $horas = $param['orcamento_horas'];
     }
     if (isset($param['orcamento_valor_hora'])) {
         $valor = $string->desconverteReais($param['orcamento_valor_hora']);
     }
     if (isset($param['valor_desconto'])) {
         $desconto = $string->desconverteReais($param['valor_desconto']);
     }
     if ($desconto > $horas * $valor) {
         new TMessage('info', 'Valor de desconto maior que o valor total do Ticket');
         $desconto = 0;
         $obj->valor_desconto = 0;
     }
     $valor_total = $horas * $valor - $desconto;
     $obj->valor_total = number_format($valor_total, 2, ',', '.');
     //calcular valor_saldo
     !$param['valor_total_pago'] ? $param['valor_total_pago'] = 0 : $string->desconverteReais($param['valor_total_pago']);
     $valor_saldo = $valor_total - $param['valor_total_pago'];
     $obj->valor_saldo = number_format($valor_saldo, 2, ',', '.');
     TForm::sendData('form_Ticket', $obj, FALSE, FALSE);
 }