mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
añadidas tarifas encuadernacion por horas para los cosidos
This commit is contained in:
@ -29,6 +29,7 @@ class TarifaEncuadernacionModel extends \App\Models\GoBaseModel
|
||||
"mostrar_en_presupuesto",
|
||||
"tipo_encuadernacion",
|
||||
"servicio_encuadernacion",
|
||||
"por_horas",
|
||||
"deleted_at",
|
||||
"is_deleted",
|
||||
"user_created_id",
|
||||
@ -87,7 +88,8 @@ class TarifaEncuadernacionModel extends \App\Models\GoBaseModel
|
||||
{
|
||||
$builder = $this->db->table($this->table . " t1")->select("t1.id AS id, t1.nombre AS nombre,
|
||||
t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo, t1.mostrar_en_presupuesto AS mostrar_en_presupuesto,
|
||||
t1.tipo_encuadernacion AS tipo_encuadernacion, t1.servicio_encuadernacion AS servicio_encuadernacion");
|
||||
t1.tipo_encuadernacion AS tipo_encuadernacion, t1.servicio_encuadernacion AS servicio_encuadernacion,
|
||||
t1.por_horas AS por_horas");
|
||||
|
||||
//JJO
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
@ -167,5 +169,50 @@ class TarifaEncuadernacionModel extends \App\Models\GoBaseModel
|
||||
}
|
||||
|
||||
return $builder->get()->getResultObject();
|
||||
}
|
||||
}
|
||||
|
||||
public function getTarifaPresupuestoEncuadernacionHoras($tarifa_id, $horas, $tirada, $proveedor_id=-1){
|
||||
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS tarifa_enc_id, t1.nombre AS tarifa_enc_nombre, t1.precio_min AS tarifa_precio_min, t1.importe_fijo AS tarifa_importe_fijo,
|
||||
t2.id AS tarifa_tirada_id, t2.proveedor_id AS proveedor_id, t5.nombre AS proveedor_nombre, t2.tirada_min AS tirada_min, t2.tirada_max AS tirada_max,
|
||||
t3.id AS tarifa_linea_id, t3.tiempo_min AS tiempo_min, t3.tiempo_max AS tiempo_max, t3.precio_hora AS precio_hora, t3.margen AS margen"
|
||||
)
|
||||
->join("tarifa_encuadernacion_tiradas t2", "t1.id = t2.tarifa_encuadernacion_id", "left")
|
||||
->join("tarifa_encuadernacion_lineas_horas t3", "t2.id = t3.tirada_encuadernacion_id", "left")
|
||||
->join("lg_proveedores t5", "t2.proveedor_id = t5.id", "left")
|
||||
->where("t1.is_deleted", 0)
|
||||
//->where("t1.mostrar_en_presupuesto", 1)
|
||||
->where("t2.is_deleted", 0)
|
||||
->where("t3.is_deleted", 0);
|
||||
|
||||
$builder->where('t1.id =', $tarifa_id);
|
||||
$builder->where('t2.tirada_min <=', $tirada);
|
||||
$builder->where('t2.tirada_max >', $tirada);
|
||||
$builder->where('t3.tiempo_min <=', $horas);
|
||||
$builder->where('t3.tiempo_max >', $horas);
|
||||
|
||||
if($proveedor_id != -1){
|
||||
$builder->where('t2.proveedor_id', $proveedor_id);
|
||||
}
|
||||
|
||||
return $builder->get()->getResultObject();
|
||||
}
|
||||
|
||||
public function isTarifaPorHoras($tarifa_id){
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select('t1.por_horas AS por_horas')
|
||||
->where('id', $tarifa_id);
|
||||
|
||||
$resultObject = $builder->get()->getResultObject();
|
||||
|
||||
if(count($resultObject)>0)
|
||||
return intval($resultObject[0]->por_horas)==0?false:true;
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user