Skip to content

Commit

Permalink
Corrigindo buscas por cpf, autocomplete com cpf (#2375)
Browse files Browse the repository at this point in the history
* Corringido para Buscar tambem CPF, autocomplete cliente com CPF

* Corrigindo buscas por CPF, autocomplete com CPF
  • Loading branch information
cabralwms authored Apr 7, 2024
1 parent 50986e2 commit e9acf9a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions application/models/Mapos_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public function pesquisar($termo)
$this->db->like('nomeCliente', $termo);
$this->db->or_like('telefone', $termo);
$this->db->or_like('celular', $termo);
$this->db->or_like('documento', $termo);
$this->db->limit(15);
$data['clientes'] = $this->db->get('clientes')->result();

Expand Down
18 changes: 10 additions & 8 deletions application/models/Os_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public function getOs($table, $fields, $where = [], $perpage = 0, $start = 0, $o
if (array_key_exists('pesquisa', $where)) {
$this->db->select('idClientes');
$this->db->like('nomeCliente', $where['pesquisa']);
$this->db->limit(5);
$this->db->like('documento', $where['pesquisa']);
$this->db->limit(25);
$clientes = $this->db->get('clientes')->result();

foreach ($clientes as $c) {
Expand Down Expand Up @@ -182,7 +183,7 @@ public function count($table)
public function autoCompleteProduto($q)
{
$this->db->select('*');
$this->db->limit(5);
$this->db->limit(25);
$this->db->like('codDeBarra', $q);
$this->db->or_like('descricao', $q);
$query = $this->db->get('produtos');
Expand All @@ -197,7 +198,7 @@ public function autoCompleteProduto($q)
public function autoCompleteProdutoSaida($q)
{
$this->db->select('*');
$this->db->limit(5);
$this->db->limit(25);
$this->db->like('codDeBarra', $q);
$this->db->or_like('descricao', $q);
$this->db->where('saida', 1);
Expand All @@ -213,14 +214,15 @@ public function autoCompleteProdutoSaida($q)
public function autoCompleteCliente($q)
{
$this->db->select('*');
$this->db->limit(5);
$this->db->limit(25);
$this->db->like('nomeCliente', $q);
$this->db->or_like('telefone', $q);
$this->db->or_like('celular', $q);
$this->db->or_like('documento', $q);
$query = $this->db->get('clientes');
if ($query->num_rows() > 0) {
foreach ($query->result_array() as $row) {
$row_set[] = ['label' => $row['nomeCliente'] . ' | Telefone: ' . $row['telefone'] . ' | Celular: ' . $row['celular'], 'id' => $row['idClientes']];
$row_set[] = ['label' => $row['nomeCliente'] . ' | Telefone: ' . $row['telefone'] . ' | Celular: ' . $row['celular'] . ' | Documento: ' . $row['documento'], 'id' => $row['idClientes']];
}
echo json_encode($row_set);
}
Expand All @@ -229,7 +231,7 @@ public function autoCompleteCliente($q)
public function autoCompleteUsuario($q)
{
$this->db->select('*');
$this->db->limit(5);
$this->db->limit(25);
$this->db->like('nome', $q);
$this->db->where('situacao', 1);
$query = $this->db->get('usuarios');
Expand All @@ -244,7 +246,7 @@ public function autoCompleteUsuario($q)
public function autoCompleteTermoGarantia($q)
{
$this->db->select('*');
$this->db->limit(5);
$this->db->limit(25);
$this->db->like('LOWER(refGarantia)', $q);
$query = $this->db->get('garantias');
if ($query->num_rows() > 0) {
Expand All @@ -258,7 +260,7 @@ public function autoCompleteTermoGarantia($q)
public function autoCompleteServico($q)
{
$this->db->select('*');
$this->db->limit(5);
$this->db->limit(25);
$this->db->like('nome', $q);
$query = $this->db->get('servicos');
if ($query->num_rows() > 0) {
Expand Down

0 comments on commit e9acf9a

Please sign in to comment.