mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminadas tarifas cliente
This commit is contained in:
@ -183,14 +183,13 @@ class ClientePlantillaPreciosLineasModel extends \App\Models\BaseModel
|
||||
|
||||
function copy_from_cliente($cliente_id = 0, $plantilla_id = 0){
|
||||
|
||||
$session = session();
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$date_value = $datetime->format('Y-m-d H:i:s');
|
||||
|
||||
|
||||
// Se cargan los valores en la plantilla
|
||||
$clientePreciosModel = model('App\Models\Clientes\ClientePreciosModel');
|
||||
$values = $clientePreciosModel->getResource($cliente_id)->get()->getResultObject();
|
||||
$values = $clientePreciosModel->getResource([], $cliente_id)->get()->getResultObject();
|
||||
foreach ($values as $value) {
|
||||
$this->db
|
||||
->table($this->table . " t1")
|
||||
@ -201,7 +200,7 @@ class ClientePlantillaPreciosLineasModel extends \App\Models\BaseModel
|
||||
->set('tiempo_min', $value->tiempo_min)
|
||||
->set('tiempo_max', $value->tiempo_max)
|
||||
->set('margen', $value->margen)
|
||||
->set('user_updated_id', $session->id_user)
|
||||
->set('user_updated_id', auth()->user()->id)
|
||||
->set('updated_at', $date_value)
|
||||
->insert();
|
||||
}
|
||||
|
||||
@ -287,6 +287,27 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
||||
}
|
||||
}
|
||||
|
||||
public function getPlantilla($cliente_id = -1){
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.plantilla_id AS id, t2.nombre AS nombre"
|
||||
);
|
||||
|
||||
$builder->where('t1.is_deleted', 0);
|
||||
$builder->where('t1.cliente_id', $cliente_id);
|
||||
$builder->join("cliente_plantilla_precios t2", "t1.plantilla_id = t2.id", "left");
|
||||
$builder->limit(1);
|
||||
|
||||
$values = $builder->get()->getResultArray();
|
||||
if(count($values)>0){
|
||||
return $values[0];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function checkIntervals($data = [], $id_linea = null, $cliente_id = null){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user