Advertisement
yesamarcos

Query ...

Mar 30th, 2018
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.43 KB | None | 0 0
  1.         $this->db->select('*');
  2.         $this->db->from('eficaz_ocorrencia');
  3.         $this->db->join('eficaz_setor', 'eficaz_setor.EFICAZ_SETOR_ID = eficaz_ocorrencia.EFICAZ_OCORRENCIA_SETOR_ID');
  4.         $this->db->join('funcionarios', 'funcionarios.ID = eficaz_ocorrencia.EFICAZ_OCORRENCIA_FUNCIONARIOS_ID');
  5.         $this->db->join('eficaz_item', 'eficaz_item.EFICAZ_ITEM_ID = eficaz_ocorrencia.EFICAZ_OCORRENCIA_ITEM_ID');
  6.  
  7.         /* ####################################################################### */
  8.         if(isset($post['EFICAZ_SETOR_ID'])){                        $this->db->where_in('EFICAZ_SETOR_ID', $post['EFICAZ_SETOR_ID']); }
  9.         if(isset($post['EFICAZ_ITEM_ID'])){                         $this->db->where_in('EFICAZ_ITEM_ID', $post['EFICAZ_ITEM_ID']); }
  10.         if(isset($post['EFICAZ_OCORRENCIA_FUNCIONARIOS_ID'])){      $this->db->where('FUNC_MATR', $post['EFICAZ_OCORRENCIA_FUNCIONARIOS_ID']); }
  11.         if(isset($post['DESEMP_DATA_DESDE'])){                      $this->db->where('EFICAZ_OCORRENCIA_DT_OCORRENCIA >=', datatoDBa($post['DESEMP_DATA_DESDE'])); }
  12.         if(isset($post['DESEMP_DATA_ATE'])){                        $this->db->where('EFICAZ_OCORRENCIA_DT_OCORRENCIA <=', datatoDBp($post['DESEMP_DATA_ATE'])); }
  13.         /* ####################################################################### */
  14.  
  15.         $this->db->where('EFICAZ_OCORRENCIA_USER', $id);
  16.  
  17.         /* ####################################################################### */
  18.         if(isset($post['EFICAZ_FUNC_NOME'])){
  19.             $this->db->query("(FUNC_NOME LIKE %{$post['FUNC_NOME']}%)");
  20.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement