mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
arraglado solapas en servicios manipulado por defecto
This commit is contained in:
@ -50,8 +50,8 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
|
||||
|
||||
public function initPresupuesto($tipo_presupuesto, $solapas, $tirada, $paginas, $ancho, $alto, $POD){
|
||||
|
||||
$model = model('App\Models\Presupuestos\TipoPresupuestoTarifaEncuadernacionModel');
|
||||
$tarifas_procesar = $model->get_tarifas($tipo_presupuesto,$solapas);
|
||||
$model = model('App\Models\Presupuestos\TipoPresupuestoServiciosDefectoModel');
|
||||
$tarifas_procesar = $model->get_tarifas($tipo_presupuesto,$solapas, "encuadernacion");
|
||||
|
||||
$modelTarifa = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||
$tarifas = [];
|
||||
@ -59,11 +59,11 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
|
||||
|
||||
foreach($tarifas_procesar as $tarifa){
|
||||
|
||||
if($modelTarifa->isTarifaPorHoras($tarifa['tarifa_encuadernacion_id'])){
|
||||
if($modelTarifa->isTarifaPorHoras($tarifa['tarifa_id'])){
|
||||
|
||||
$tiempo = $this->calcularTiempo(16, $paginas, $tirada); // ID fija. Cambiar cuando se metan maquinas de corte. Velocidad en minutos
|
||||
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoEncuadernacionHoras($tarifa['tarifa_encuadernacion_id'], $tiempo, $tirada);
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoEncuadernacionHoras($tarifa['tarifa_id'], $tiempo, $tirada);
|
||||
if (count($tarifa_value)>0) {
|
||||
|
||||
$result_data[0] = floatval(1.0* $tarifa_value[0]->precio_hora* $tiempo / $tirada);
|
||||
@ -73,7 +73,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
|
||||
}
|
||||
array_push($tarifas,
|
||||
(object)[
|
||||
'tarifa_id'=> $tarifa['tarifa_encuadernacion_id'],
|
||||
'tarifa_id'=> $tarifa['tarifa_id'],
|
||||
'tarifa_nombre'=> $tarifa_value[0]->tarifa_enc_nombre,
|
||||
'precio_unidad'=> $result_data[0],
|
||||
'total'=> $result_data[1],
|
||||
@ -84,8 +84,8 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
|
||||
else{
|
||||
array_push($tarifas,
|
||||
(object)[
|
||||
'tarifa_id'=> $tarifa['tarifa_encuadernacion_id'],
|
||||
'tarifa_nombre'=> $tarifa['tarifa_encuadernacion_nombre'],
|
||||
'tarifa_id'=> $tarifa['tarifa_id'],
|
||||
'tarifa_nombre'=> $tarifa['tarifa_nombre'],
|
||||
'proveedor' => lang('Presupuestos.no_disponible'),
|
||||
'precio_unidad'=> 0,
|
||||
'total'=> 0,
|
||||
@ -93,12 +93,12 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
|
||||
}
|
||||
}
|
||||
else{
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoEncuadernacion($tarifa['tarifa_encuadernacion_id'], $paginas, $tirada, $ancho, $alto);
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoEncuadernacion($tarifa['tarifa_id'], $paginas, $tirada, $ancho, $alto);
|
||||
if (count($tarifa_value)>0) {
|
||||
$result_data = $this->calcularTarifa($tarifa_value[0], $paginas, $POD<$tirada?false:true);
|
||||
array_push($tarifas,
|
||||
(object)[
|
||||
'tarifa_id'=> $tarifa['tarifa_encuadernacion_id'],
|
||||
'tarifa_id'=> $tarifa['tarifa_id'],
|
||||
'tarifa_nombre'=> $tarifa_value[0]->tarifa_enc_nombre,
|
||||
'precio_unidad'=> $result_data[0],
|
||||
'total'=> $result_data[1],
|
||||
@ -109,8 +109,8 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
|
||||
else{
|
||||
array_push($tarifas,
|
||||
(object)[
|
||||
'tarifa_id'=> $tarifa['tarifa_encuadernacion_id'] ,
|
||||
'tarifa_nombre'=> $tarifa['tarifa_encuadernacion_nombre'],
|
||||
'tarifa_id'=> $tarifa['tarifa_id'] ,
|
||||
'tarifa_nombre'=> $tarifa['tarifa_nombre'],
|
||||
'proveedor' => lang('Presupuestos.no_disponible'),
|
||||
'precio_unidad'=> 0,
|
||||
'total'=> 0,
|
||||
|
||||
@ -140,6 +140,43 @@ class PresupuestoManipuladosModel extends \App\Models\GoBaseModel
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function initPresupuesto($tipo_presupuesto, $solapas, $tirada, $POD){
|
||||
|
||||
$model = model('App\Models\Presupuestos\TipoPresupuestoServiciosDefectoModel');
|
||||
$tarifas_procesar = $model->get_tarifas($tipo_presupuesto, $solapas, "manipulado");
|
||||
|
||||
$modelTarifa = model('App\Models\Tarifas\TarifaManipuladoModel');
|
||||
$tarifas = [];
|
||||
|
||||
|
||||
foreach($tarifas_procesar as $tarifa){
|
||||
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoManipulado($tarifa['tarifa_id'], $tirada);
|
||||
if (count($tarifa_value)>0) {
|
||||
$result_data = $this->calcularTarifa($tarifa_value[0], $tirada, $POD<$tirada?false:true);
|
||||
array_push($tarifas, (object)[
|
||||
'tarifa_id'=> $tarifa_value[0]->tarifa_manipulado_id,
|
||||
'tarifa_nombre'=> $tarifa_value[0]->tarifa_manipulado_nombre,
|
||||
'precio_unidad'=> $result_data[0],
|
||||
'total'=> $result_data[1],
|
||||
]);
|
||||
}
|
||||
else{
|
||||
array_push($tarifas,
|
||||
(object)[
|
||||
'tarifa_id'=> $tarifa['tarifa_id'] ,
|
||||
'tarifa_nombre'=> $tarifa['tarifa_nombre'],
|
||||
'precio_unidad' => 0,
|
||||
'total'=> 0,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $tarifas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get resource data.
|
||||
*
|
||||
|
||||
89
ci4/app/Models/Presupuestos/TipoPresupuestoServiciosDefectoModel.php
Executable file
89
ci4/app/Models/Presupuestos/TipoPresupuestoServiciosDefectoModel.php
Executable file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Presupuestos;
|
||||
|
||||
class TipoPresupuestoServiciosDefectoModel extends \App\Models\GoBaseModel
|
||||
{
|
||||
protected $table = "tipos_presupuestos_servicios_defecto";
|
||||
|
||||
/**
|
||||
* Whether primary key uses auto increment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
protected $allowedFields = [
|
||||
"tipo_presupuesto_id",
|
||||
"tarifa_id",
|
||||
"solapas",
|
||||
"is_servicio_encuadernacion",
|
||||
"is_servicio_acabado",
|
||||
"is_servicio_manipulado",
|
||||
"is_servicio_preimpresion",
|
||||
"is_deleted"];
|
||||
protected $returnType = "App\Entities\Presupuestos\TipoPresupuestoServiciosDefecto";
|
||||
|
||||
protected $useTimestamps = true;
|
||||
protected $useSoftDeletes = false;
|
||||
|
||||
protected $createdField = "created_at";
|
||||
protected $updatedField = "updated_at";
|
||||
|
||||
public static $labelField = "tipo_presupuesto_id";
|
||||
|
||||
public function get_tarifas($tipo_presupuesto=-1, $solapas=0, $tipo=""){
|
||||
|
||||
$where = "(t1.solapas=2) OR (t1.solapas=" . $solapas . ")";
|
||||
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->where("t1.tipo_presupuesto_id", $tipo_presupuesto);
|
||||
|
||||
if(strcmp($tipo, "encuadernacion")==0){
|
||||
|
||||
$builder->join("tarifa_encuadernacion t2", "t1.tarifa_id = t2.id", "left");
|
||||
$builder->where("is_servicio_encuadernacion", 1);
|
||||
$builder->where("is_servicio_acabado", 0);
|
||||
$builder->where("is_servicio_manipulado", 0);
|
||||
$builder->where("is_servicio_preimpresion", 0);
|
||||
}
|
||||
else if(strcmp($tipo, "acabado")==0){
|
||||
|
||||
$builder->join("lg_tarifa_acabado t2", "t1.tarifa_id = t2.id", "left");
|
||||
$builder->where("is_servicio_acabado", 1);
|
||||
$builder->where("is_servicio_encuadernacion", 0);
|
||||
$builder->where("is_servicio_manipulado", 0);
|
||||
$builder->where("is_servicio_preimpresion", 0);
|
||||
}
|
||||
else if(strcmp($tipo, "manipulado")==0){
|
||||
|
||||
$builder->join("lg_tarifa_manipulado t2", "t1.tarifa_id = t2.id", "left");
|
||||
$builder->where("is_servicio_manipulado", 1);
|
||||
$builder->where("is_servicio_encuadernacion", 0);
|
||||
$builder->where("is_servicio_acabado", 0);
|
||||
$builder->where("is_servicio_preimpresion", 0);
|
||||
|
||||
}
|
||||
else if(strcmp($tipo, "preimpresion")==0){
|
||||
|
||||
$builder->join("lg_tarifa_preimpresion t2", "t1.tarifa_id = t2.id", "left");
|
||||
$builder->where("is_servicio_preimpresion", 1);
|
||||
$builder->where("is_servicio_encuadernacion", 0);
|
||||
$builder->where("is_servicio_acabado", 0);
|
||||
$builder->where("is_servicio_manipulado", 0);
|
||||
|
||||
}
|
||||
else{
|
||||
return [];
|
||||
}
|
||||
|
||||
$where = "t1.solapas IS NULL OR t1.solapas='" . $solapas . "'";
|
||||
$builder->where($where);
|
||||
|
||||
$builder->where("t2.is_deleted", 0);
|
||||
$builder->select("t1.tarifa_id AS tarifa_id, t2.nombre AS tarifa_nombre");
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Presupuestos;
|
||||
|
||||
class TipoPresupuestoTarifaEncuadernacionModel extends \App\Models\GoBaseModel
|
||||
{
|
||||
protected $table = "tipos_presupuestos_tarifas_encuadernacion";
|
||||
|
||||
/**
|
||||
* Whether primary key uses auto increment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
protected $allowedFields = ["tipo_presupuesto_id", "tarifa_encuadernacion_id", "solapas", "is_deleted"];
|
||||
protected $returnType = "App\Entities\Presupuestos\TipoPresupuestoTarifaEncuadernacionEntity";
|
||||
|
||||
protected $useTimestamps = true;
|
||||
protected $useSoftDeletes = false;
|
||||
|
||||
protected $createdField = "created_at";
|
||||
protected $updatedField = "updated_at";
|
||||
|
||||
public static $labelField = "tipo_presupuesto_id";
|
||||
|
||||
public function get_tarifas($tipo_presupuesto=-1, $solapas=0){
|
||||
|
||||
$where = "t1.solapas IS NULL OR t1.solapas='" . $solapas . "'";
|
||||
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select("t1.tarifa_encuadernacion_id AS tarifa_encuadernacion_id, t2.nombre AS tarifa_encuadernacion_nombre")
|
||||
->join("tarifa_encuadernacion t2", "t1.tarifa_encuadernacion_id = t2.id", "left")
|
||||
->where("t1.tipo_presupuesto_id", $tipo_presupuesto)
|
||||
|
||||
->where($where);
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user