mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en el importador
This commit is contained in:
@ -9,7 +9,35 @@ class ImportadorModel extends \App\Models\BaseModel
|
||||
//protected $allowedFields = ['ticket_number', 'order_id', 'created_at', 'updated_at', 'deleted_at', 'check_in'];
|
||||
|
||||
// Define the alternative connection group
|
||||
protected $DBGroup = 'olderp';
|
||||
protected $DBGroup = 'old_erp';
|
||||
|
||||
public function getClientList(){
|
||||
|
||||
$db = \Config\Database::connect($this->DBGroup); // Conectar a olderp
|
||||
$builder = $db->table('customers');
|
||||
$builder->select('id, name');
|
||||
$builder->where('deleted_at', NULL);
|
||||
$query = $builder->get();
|
||||
return $query->getResultObject();
|
||||
}
|
||||
|
||||
|
||||
public function getPresupuestosList($clienteId, $search = ""){
|
||||
|
||||
$db = \Config\Database::connect($this->DBGroup); // Conectar a olderp
|
||||
$builder = $db->table('pedido_libro');
|
||||
$builder->select('id as id, CONCAT(id, " - ", titulo) as name');
|
||||
$builder->where('customer_id', $clienteId);
|
||||
$builder->where('estado', 'finalizado');
|
||||
$builder->where('deleted_at', NULL);
|
||||
|
||||
return empty($search) ?
|
||||
$builder->get()->getResultObject() :
|
||||
$builder->groupStart()->
|
||||
like('titulo', $search)->
|
||||
orLike('id', $search)->
|
||||
groupEnd()->get()->getResultObject();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user