mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'main' into 'mod/presupuesto_admin'
Main See merge request jjimenez/safekat!459
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
namespace App\Entities\Clientes;
|
||||
|
||||
use App\Entities\Usuarios\UserEntity;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class ClienteEntity extends \CodeIgniter\Entity\Entity
|
||||
@ -68,4 +70,10 @@ class ClienteEntity extends \CodeIgniter\Entity\Entity
|
||||
"user_created_id" => "int",
|
||||
"user_update_id" => "int",
|
||||
];
|
||||
|
||||
public function comercial() : UserEntity
|
||||
{
|
||||
$m = model(UserModel::class);
|
||||
return $m->find($this->attributes["comercial_id"]);
|
||||
}
|
||||
}
|
||||
|
||||
59
ci4/app/Entities/Configuracion/ServicioClienteEntity.php
Normal file
59
ci4/app/Entities/Configuracion/ServicioClienteEntity.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Configuracion;
|
||||
|
||||
use CodeIgniter\Entity\Entity;
|
||||
use App\Entities\Tarifas\Acabados\TarifaAcabadoEntity;
|
||||
use App\Entities\Tarifas\TarifaManipuladoEntity;
|
||||
use App\Models\Configuracion\ServicioClienteModel;
|
||||
use CodeIgniter\Database\MySQLi\Result;
|
||||
|
||||
class ServicioClienteEntity extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"nombre" => null,
|
||||
"code" => null,
|
||||
];
|
||||
protected $casts = [
|
||||
"nombre" => "string",
|
||||
"code" => "string",
|
||||
];
|
||||
|
||||
public function withManipuladoTarifas()
|
||||
{
|
||||
$this->attributes["tarifas_manipulado"] = $this->getManipuladoTarifas();
|
||||
return $this;
|
||||
}
|
||||
public function withAcabadoTarifas()
|
||||
{
|
||||
$this->attributes["tarifas_acabado"] = $this->getAcabadoTarifas();
|
||||
return $this;
|
||||
}
|
||||
public function withAllTarifas(){
|
||||
$this->withManipuladoTarifas();
|
||||
$this->withAcabadoTarifas();
|
||||
return $this;
|
||||
}
|
||||
public function getManipuladoTarifas(): ?object
|
||||
{
|
||||
$model = model(ServicioClienteModel::class);
|
||||
return $model->builder()->select("lg_tarifa_manipulado.*")
|
||||
->join("servicio_cliente_tareas","servicio_cliente_tareas.servicio_cliente_id = servicios_cliente.id",'left')
|
||||
->join("lg_tarifa_manipulado","lg_tarifa_manipulado.id = servicio_cliente_tareas.tarifa_manipulado_id",'left')
|
||||
->where("servicio_cliente_tareas.servicio_cliente_id",$this->attributes["id"])
|
||||
->where("lg_tarifa_manipulado.id IS NOT NULL",NULL,FALSE)
|
||||
->where("servicio_cliente_tareas.deleted_at", NULL) // Exclude soft-deleted rows
|
||||
->get()->getFirstRow();
|
||||
}
|
||||
public function getAcabadoTarifas(): ?object
|
||||
{
|
||||
$model = model(ServicioClienteModel::class);
|
||||
return $model->builder()->select("lg_tarifa_acabado.*")
|
||||
->join("servicio_cliente_tareas","servicio_cliente_tareas.servicio_cliente_id = servicios_cliente.id",'left')
|
||||
->join("lg_tarifa_acabado","lg_tarifa_acabado.id = servicio_cliente_tareas.tarifa_acabado_id",'left')
|
||||
->where("servicio_cliente_tareas.servicio_cliente_id",$this->attributes["id"])
|
||||
->where("servicio_cliente_tareas.deleted_at", NULL) // Exclude soft-deleted rows
|
||||
->where("lg_tarifa_acabado.id IS NOT NULL",NULL,FALSE)
|
||||
->get()->getFirstRow();
|
||||
}
|
||||
}
|
||||
20
ci4/app/Entities/Configuracion/TareaMaquinaEntity.php
Normal file
20
ci4/app/Entities/Configuracion/TareaMaquinaEntity.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace App\Entities\Tarifas\Maquinas;
|
||||
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
|
||||
class TareaMaquinaEntity extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"id" => null,
|
||||
"name" => null,
|
||||
"description" => null,
|
||||
];
|
||||
protected $casts = [
|
||||
"id" => "integer",
|
||||
"name" => "string",
|
||||
"description" => "?string",
|
||||
];
|
||||
|
||||
}
|
||||
@ -1,7 +1,11 @@
|
||||
<?php
|
||||
namespace App\Entities\Pedidos;
|
||||
|
||||
use App\Entities\Presupuestos\PresupuestoEntity;
|
||||
use App\Entities\Produccion\OrdenTrabajoEntity;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
|
||||
use App\Entities\Clientes\ClienteEntity;
|
||||
use App\Entities\Configuracion\UbicacionesEntity;
|
||||
use App\Models\Clientes\ClienteModel;
|
||||
use App\Models\Pedidos\PedidoLineaModel;
|
||||
use App\Models\Presupuestos\PresupuestoModel;
|
||||
@ -31,6 +35,46 @@ class PedidoEntity extends \CodeIgniter\Entity\Entity
|
||||
"total_precio" => "float",
|
||||
"total_tirada" => "float",
|
||||
];
|
||||
/**
|
||||
* Devuelve la entidad `PedidoEntity` con sus relaciones
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function withAllRelations() : self
|
||||
{
|
||||
$this->attributes["pedido_lineas"] = $this->lineas();
|
||||
$this->attributes["presupuesto"] = $this->presupuesto();
|
||||
|
||||
return $this;
|
||||
}
|
||||
public function lineas(): array
|
||||
{
|
||||
$q = model(PedidoLineaModel::class);
|
||||
$q->where("pedido_id",$this->attributes["id"]);
|
||||
return $q->findAll();
|
||||
}
|
||||
public function ubicacion(): ?UbicacionesEntity
|
||||
{
|
||||
$lineas = $this->lineas();
|
||||
$ubicacion = null;
|
||||
foreach ($lineas as $key => $linea) {
|
||||
$ubicacion = $linea->ubicacion();
|
||||
}
|
||||
return $ubicacion;
|
||||
}
|
||||
public function presupuesto() : PresupuestoEntity
|
||||
{
|
||||
$q = model(PedidoLineaModel::class);
|
||||
$p = model(PresupuestoModel::class);
|
||||
$presupuesto_id = $q->where("pedido_id",$this->attributes["id"])->first()->presupuesto_id;
|
||||
return $p->find($presupuesto_id);
|
||||
}
|
||||
public function orden_trabajo() : ?OrdenTrabajoEntity
|
||||
{
|
||||
$m = model(OrdenTrabajoModel::class);
|
||||
return $m->where("pedido_id",$this->attributes["id"])->first();
|
||||
}
|
||||
|
||||
|
||||
public function cliente() : ?ClienteEntity
|
||||
{
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
namespace App\Entities\Pedidos;
|
||||
|
||||
use App\Entities\Configuracion\UbicacionesEntity;
|
||||
use App\Models\Configuracion\UbicacionesModel;
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class PedidoLineaEntity extends \CodeIgniter\Entity\Entity
|
||||
@ -22,4 +24,9 @@ class PedidoLineaEntity extends \CodeIgniter\Entity\Entity
|
||||
"presupuesto_id" => "int",
|
||||
"ubicacion_id" => "int",
|
||||
];
|
||||
public function ubicacion() : UbicacionesEntity
|
||||
{
|
||||
$m = model(UbicacionesModel::class);
|
||||
return $m->find($this->attributes["ubicacion_id"]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
<?php
|
||||
namespace App\Entities\Presupuestos;
|
||||
|
||||
use App\Entities\Tarifas\Acabados\TarifaAcabadoEntity;
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
use App\Models\Tarifas\Acabados\TarifaAcabadoModel;
|
||||
use App\Models\Tarifas\Maquinas\TarifaAcabadoMaquinaModel;
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class PresupuestoAcabadosEntity extends \CodeIgniter\Entity\Entity
|
||||
@ -28,4 +32,21 @@ class PresupuestoAcabadosEntity extends \CodeIgniter\Entity\Entity
|
||||
"cubierta" => "int",
|
||||
"sobrecubierta" => "int",
|
||||
];
|
||||
|
||||
public function maquinas() : array
|
||||
{
|
||||
$m = model(TarifaAcabadoMaquinaModel::class);
|
||||
$tarifa_maquinas = $m->where("tarifa_acabado_id",$this->attributes["tarifa_acabado_id"])->findAll();
|
||||
$maquinaModel = model(MaquinaModel::class);
|
||||
$maquinas = [];
|
||||
foreach ($tarifa_maquinas as $key => $tarifa_maquina) {
|
||||
$maquinas[] = $maquinaModel->find($tarifa_maquina->maquina_id);
|
||||
}
|
||||
return $maquinas;
|
||||
}
|
||||
public function tarifa() : TarifaAcabadoEntity
|
||||
{
|
||||
$m = model(TarifaAcabadoModel::class);
|
||||
return $m->find($this->attributes["tarifa_acabado_id"]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
namespace App\Entities\Presupuestos;
|
||||
|
||||
use App\Entities\Tarifas\TarifaEncuadernacionEntity;
|
||||
use App\Models\Tarifas\Maquinas\TarifaEncuadernacionMaquinaModel;
|
||||
use App\Models\Tarifas\TarifaEncuadernacionModel;
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class PresupuestoEncuadernacionesEntity extends \CodeIgniter\Entity\Entity
|
||||
@ -28,4 +31,14 @@ class PresupuestoEncuadernacionesEntity extends \CodeIgniter\Entity\Entity
|
||||
"precio_total" => "float",
|
||||
"margen" => "float",
|
||||
];
|
||||
public function maquinas() : array
|
||||
{
|
||||
$m = model(TarifaEncuadernacionMaquinaModel::class);
|
||||
return $m->where("tarifa_encuadernacion_id",$this->attributes["tarifa_encuadernado_id"])->findAll();
|
||||
}
|
||||
public function tarifa() : TarifaEncuadernacionEntity
|
||||
{
|
||||
$m = model(TarifaEncuadernacionModel::class);
|
||||
return $m->find($this->attributes["tarifa_encuadernado_id"]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Presupuestos;
|
||||
|
||||
use App\Entities\Clientes\ClienteEntity;
|
||||
use App\Entities\Configuracion\PapelFormatoEntity;
|
||||
use App\Models\Clientes\ClienteModel;
|
||||
use App\Models\Configuracion\PapelFormatoModel;
|
||||
use App\Models\Presupuestos\PresupuestoAcabadosModel;
|
||||
use App\Models\Presupuestos\PresupuestoEncuadernacionesModel;
|
||||
use App\Models\Presupuestos\PresupuestoLineaModel;
|
||||
use App\Models\Presupuestos\PresupuestoManipuladosModel;
|
||||
use App\Models\Presupuestos\PresupuestoModel;
|
||||
use App\Models\Presupuestos\PresupuestoPreimpresionesModel;
|
||||
use App\Models\Presupuestos\PresupuestoServiciosExtraModel;
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class PresupuestoEntity extends \CodeIgniter\Entity\Entity
|
||||
@ -78,7 +90,7 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
|
||||
"total_margen_envios" => null,
|
||||
"total_costes" => null,
|
||||
"total_margenes" => null,
|
||||
"total_antes_descuento" => null,
|
||||
"total_antes_descuento" => null,
|
||||
"total_descuento" => null,
|
||||
"total_descuentoPercent" => null,
|
||||
"total_precio_unidad" => null,
|
||||
@ -165,4 +177,111 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
|
||||
'paginasCuadernillo' => "int",
|
||||
'lomo_redondo' => "boolean",
|
||||
];
|
||||
/**
|
||||
* Devuelve la entity con un campo `presupuesto_lineas` con las lineas de presupuesto asociadas
|
||||
*
|
||||
* @return this
|
||||
*/
|
||||
public function withPresupuestoLineas()
|
||||
{
|
||||
$this->attributes["presupuesto_lineas"] = $this->presupuestoLineas();
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Obtiene las lineas de presupuesto del actual presupuesto
|
||||
*
|
||||
* @return array<PresupuestoLineaEntity>
|
||||
*/
|
||||
public function presupuestoLineas(): array
|
||||
{
|
||||
$model = model(PresupuestoLineaModel::class);
|
||||
|
||||
$q = $model->where('presupuesto_id', $this->attributes["id"])->findAll();
|
||||
|
||||
return $q;
|
||||
}
|
||||
/**
|
||||
* Obtiene las lineas de presupuesto del actual presupuesto
|
||||
*
|
||||
* @return PresupuestoLineaEntity
|
||||
*/
|
||||
public function presupuestoLineaImpresion(): PresupuestoLineaEntity
|
||||
{
|
||||
$model = model(PresupuestoLineaModel::class);
|
||||
|
||||
$q = $model->where('presupuesto_id', $this->attributes["id"])->whereIn("tipo",["lp_rot_bn","lp_rot_color","lp_color","lp_colorhq","lp_bn","lp_bnhq"])->first();
|
||||
|
||||
return $q;
|
||||
}
|
||||
/**
|
||||
* Obtiene las lineas de presupuesto del actual presupuesto
|
||||
*
|
||||
* @return PresupuestoLineaEntity
|
||||
*/
|
||||
public function presupuestoLineaCubierta(): PresupuestoLineaEntity
|
||||
{
|
||||
$model = model(PresupuestoLineaModel::class);
|
||||
|
||||
$q = $model->where('presupuesto_id', $this->attributes["id"])->whereIn("tipo",["lp_cubierta"])->first();
|
||||
|
||||
return $q;
|
||||
}
|
||||
/**
|
||||
* Obtiene las lineas de presupuesto del actual presupuesto
|
||||
*
|
||||
* @return PresupuestoLineaEntity
|
||||
*/
|
||||
public function presupuestoLineaSobreCubierta(): ?PresupuestoLineaEntity
|
||||
{
|
||||
$model = model(PresupuestoLineaModel::class);
|
||||
|
||||
$q = $model->where('presupuesto_id', $this->attributes["id"])->whereIn("tipo",["lp_sobrecubierta"])->first();
|
||||
|
||||
return $q;
|
||||
}
|
||||
public function hasSobrecubierta() : bool
|
||||
{
|
||||
$hasSobrecubierta = false;
|
||||
$model = model(PresupuestoLineaModel::class);
|
||||
$q = $model->where('presupuesto_id', $this->attributes["id"])->whereIn("tipo",["lp_sobrecubierta"])->countAllResults();
|
||||
if($q > 0){
|
||||
$hasSobrecubierta = true;
|
||||
}
|
||||
return $hasSobrecubierta;
|
||||
}
|
||||
public function cliente() : ClienteEntity
|
||||
{
|
||||
$m = model(ClienteModel::class);
|
||||
return $m->find($this->attributes["cliente_id"]);
|
||||
}
|
||||
public function encuadernaciones(): array
|
||||
{
|
||||
$m = model(PresupuestoEncuadernacionesModel::class);
|
||||
return $m->where("presupuesto_id",$this->attributes["id"])->findAll();
|
||||
}
|
||||
public function acabados(): array
|
||||
{
|
||||
$m = model(PresupuestoAcabadosModel::class);
|
||||
return $m->where("presupuesto_id",$this->attributes["id"])->findAll();
|
||||
}
|
||||
public function preimpresiones(): array
|
||||
{
|
||||
$m = model(PresupuestoPreimpresionesModel::class);
|
||||
return $m->where("presupuesto_id",$this->attributes["id"])->findAll();
|
||||
}
|
||||
public function manipulados(): array
|
||||
{
|
||||
$m = model(PresupuestoManipuladosModel::class);
|
||||
return $m->where("presupuesto_id",$this->attributes["id"])->findAll();
|
||||
}
|
||||
public function extras(): array
|
||||
{
|
||||
$m = model(PresupuestoServiciosExtraModel::class);
|
||||
return $m->where("presupuesto_id",$this->attributes["id"])->findAll();
|
||||
}
|
||||
public function papel_formato() : PapelFormatoEntity
|
||||
{
|
||||
$m = model(PapelFormatoModel::class);
|
||||
return $m->find($this->attributes["papel_formato_id"]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Presupuestos;
|
||||
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
use CodeIgniter\Entity;
|
||||
use App\Entities\Configuracion\Maquina as MaquinaEntity;
|
||||
use App\Entities\Configuracion\MaquinasTarifasImpresionEntity;
|
||||
use App\Entities\Configuracion\PapelGenerico;
|
||||
use App\Entities\Configuracion\PapelImpresion;
|
||||
use App\Entities\Tarifas\TarifapreimpresionEntity;
|
||||
use App\Models\Configuracion\MaquinasTarifasImpresionModel;
|
||||
use App\Models\Configuracion\PapelGenericoModel;
|
||||
use App\Models\Configuracion\PapelImpresionModel;
|
||||
use Config\LogoImpresion;
|
||||
|
||||
class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity
|
||||
{
|
||||
@ -141,5 +152,73 @@ class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity
|
||||
"precio_impresion" => "double",
|
||||
"total_linea" => "double",
|
||||
];
|
||||
|
||||
/**
|
||||
* Devuelve la entity MaquinaEntity asociada a esta linea de presupuesto
|
||||
*
|
||||
* @return MaquinaEntity
|
||||
*/
|
||||
public function maquina(): MaquinaEntity
|
||||
{
|
||||
$m = model(MaquinaModel::class);
|
||||
return $m->find($this->attributes["maquina_id"]);
|
||||
}
|
||||
/**
|
||||
* Devuelve la entity PapelImpresion asociada a esta linea de presupuesto.
|
||||
*
|
||||
* @return PapelImpresion
|
||||
*/
|
||||
public function papel_impresion(): PapelImpresion
|
||||
{
|
||||
$m = model(PapelImpresionModel::class);
|
||||
return $m->find($this->attributes['papel_impresion_id']);
|
||||
}
|
||||
/**
|
||||
* Devuelve la entity PapelGenerico asociada a esta linea de presupuesto.
|
||||
*
|
||||
* @return PapelGenerico
|
||||
*/
|
||||
public function papel_generico(): PapelGenerico
|
||||
{
|
||||
$m = model(PapelGenericoModel::class);
|
||||
return $m->find($this->attributes['papel_id']);
|
||||
}
|
||||
/**
|
||||
* Devuelve la entity MaquinasTarifasImpresionEntity asociada a esta linea de presupuesto.
|
||||
*
|
||||
* @return MaquinasTarifasImpresionEntity
|
||||
*/
|
||||
public function tarifa_impresion(): MaquinasTarifasImpresionEntity
|
||||
{
|
||||
$m = model(MaquinasTarifasImpresionModel::class);
|
||||
return $m->find($this->attributes['tarifa_impresion_id']);
|
||||
}
|
||||
|
||||
public function get_impresion_logo(){
|
||||
$logo = config(LogoImpresion::class);
|
||||
return $logo->get_logo_path($this->attributes["tipo"]);
|
||||
}
|
||||
public function get_nombre_tarea() : ?string
|
||||
{
|
||||
$nombre = null;
|
||||
$impresion_bn = ["lp_bn","lp_bnhq","lp_rot_bn"];
|
||||
$impresion_color = ["lp_color","lp_colorhq","lp_rot_color"];
|
||||
$impresion_cubierta = ["lp_cubierta"];
|
||||
$impresion_guardas = ["lp_guardas"];
|
||||
$impresion_sobrecubierta = ["lp_sobrecubierta"];
|
||||
|
||||
$is_bn = in_array($this->attributes["tipo"],$impresion_bn);
|
||||
$is_color = in_array($this->attributes["tipo"],$impresion_color);
|
||||
$is_impresion_cubierta = in_array($this->attributes["tipo"],$impresion_cubierta);
|
||||
$is_impresion_guarda = in_array($this->attributes["tipo"],$impresion_guardas);
|
||||
$is_impresion_sobrecubierta = in_array($this->attributes["tipo"],$impresion_sobrecubierta);
|
||||
|
||||
if($is_bn) $nombre ="Impresión B/N";
|
||||
if($is_color) $nombre ="Impresión color";
|
||||
if($is_impresion_cubierta) $nombre ="Impresión cubierta";
|
||||
if($is_impresion_guarda) $nombre ="Impresión guarda";
|
||||
if($is_impresion_sobrecubierta) $nombre ="Impresión sobrecubierta";
|
||||
|
||||
return $nombre;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
namespace App\Entities\Presupuestos;
|
||||
|
||||
use App\Entities\Tarifas\TarifaManipuladoEntity;
|
||||
use App\Models\Tarifas\Maquinas\TarifaManipuladoMaquinaModel;
|
||||
use App\Models\Tarifas\TarifaManipuladoModel;
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class PresupuestoManipuladosEntity extends \CodeIgniter\Entity\Entity
|
||||
@ -22,4 +25,14 @@ class PresupuestoManipuladosEntity extends \CodeIgniter\Entity\Entity
|
||||
"precio_total" => "float",
|
||||
"margen" => "float",
|
||||
];
|
||||
public function maquinas() : array
|
||||
{
|
||||
$m = model(TarifaManipuladoMaquinaModel::class);
|
||||
return $m->where("tarifa_manipulado_id",$this->attributes["tarifa_manipulado_id"])->findAll();
|
||||
}
|
||||
public function tarifa() : TarifaManipuladoEntity
|
||||
{
|
||||
$m = model(TarifaManipuladoModel::class);
|
||||
return $m->find($this->attributes["tarifa_manipulado_id"]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
namespace App\Entities\Presupuestos;
|
||||
|
||||
use App\Entities\Tarifas\TarifapreimpresionEntity;
|
||||
use App\Models\Tarifas\Maquinas\TarifaPreimpresionMaquinaModel;
|
||||
use App\Models\Tarifas\TarifapreimpresionModel;
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class PresupuestoPreimpresionesEntity extends \CodeIgniter\Entity\Entity
|
||||
@ -20,4 +23,14 @@ class PresupuestoPreimpresionesEntity extends \CodeIgniter\Entity\Entity
|
||||
"precio_total" => "float",
|
||||
"margen" => "float",
|
||||
];
|
||||
public function maquinas() : array
|
||||
{
|
||||
$m = model(TarifaPreimpresionMaquinaModel::class);
|
||||
return $m->where("tarifa_preimpresion_id",$this->attributes["tarifa_preimpresion_id"])->findAll();
|
||||
}
|
||||
public function tarifa() : TarifapreimpresionEntity
|
||||
{
|
||||
$m = model(TarifapreimpresionModel::class);
|
||||
return $m->find($this->attributes["tarifa_preimpresion_id"]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
namespace App\Entities\Presupuestos;
|
||||
|
||||
use App\Entities\Tarifas\TarifaextraEntity;
|
||||
use App\Models\Tarifas\Maquinas\TarifaExtraMaquinaModel;
|
||||
use App\Models\Tarifas\TarifaextraModel;
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class PresupuestoServiciosExtraEntity extends \CodeIgniter\Entity\Entity
|
||||
@ -20,4 +23,15 @@ class PresupuestoServiciosExtraEntity extends \CodeIgniter\Entity\Entity
|
||||
"precio_total" => "float",
|
||||
"margen" => "float",
|
||||
];
|
||||
|
||||
public function maquinas() : array
|
||||
{
|
||||
$m = model(TarifaExtraMaquinaModel::class);
|
||||
return $m->where("tarifa_extra_id",$this->attributes["tarifa_extra_id"])->findAll();
|
||||
}
|
||||
public function tarifa() : TarifaextraEntity
|
||||
{
|
||||
$m = model(TarifaextraModel::class);
|
||||
return $m->find($this->attributes["tarifa_extra_id"]);
|
||||
}
|
||||
}
|
||||
|
||||
62
ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php
Normal file
62
ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Produccion;
|
||||
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
class OrdenTrabajoDateEntity extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"fecha_entrada_at" => null,
|
||||
"fecha_entrega_at" => null,
|
||||
"fecha_entrega_change_at" => null,
|
||||
"fecha_entrega_real_at" => null,
|
||||
"fecha_entrega_real_warning" => null,
|
||||
"fecha_impresion_at" => null,
|
||||
"fecha_encuadernado_at" => null,
|
||||
"fecha_externo_at" => null,
|
||||
"fecha_entrega_warning" => null,
|
||||
"fecha_entrega_warning_revised" => null,
|
||||
"pendiente_ferro_at" => null,
|
||||
"ferro_en_cliente_at" => null,
|
||||
"ferro_ok_at" => null,
|
||||
"interior_bn_at" => null,
|
||||
"interior_color_at" => null,
|
||||
"preparacion_interiores_at" => null,
|
||||
"cubierta_at" => null,
|
||||
"plastificado_at" => null,
|
||||
"encuadernacion_at" => null,
|
||||
"corte_at" => null,
|
||||
"embalaje_at" => null,
|
||||
"envio_at" => null,
|
||||
"entrada_manipulado_at" => null
|
||||
|
||||
];
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
protected $casts = [
|
||||
// "fecha_entrada_at" => "?datetime",
|
||||
// "fecha_entrega_at" => "?datetime",
|
||||
// "fecha_entrega_change_at" => "?datetime",
|
||||
// "fecha_entrega_real_at" => "?datetime",
|
||||
// "fecha_entrega_real_warning" => "?bool",
|
||||
// "fecha_impresion_at" => "?datetime",
|
||||
// "fecha_encuadernado_at" => "?datetime",
|
||||
// "fecha_externo_at" => "?datetime",
|
||||
// "fecha_entrega_warning" => "?bool",
|
||||
// "fecha_entrega_warning_revised" => "?bool",
|
||||
// "pendiente_ferro_at" => "?datetime",
|
||||
// "ferro_en_cliente_at" => "?datetime",
|
||||
// "ferro_ok_at" => "?datetime",
|
||||
// "interior_bn_at" => "?datetime",
|
||||
// "interior_color_at" => "?datetime",
|
||||
// "preparacion_interiores_at" => "?datetime",
|
||||
// "cubierta_at" => "?datetime",
|
||||
// "plastificado_at" => "?datetime",
|
||||
// "encuadernacion_at" => "?datetime",
|
||||
// "corte_at" => "?datetime",
|
||||
// "embalaje_at" => "?datetime",
|
||||
// "envio_at" => "?datetime",
|
||||
// "entrada_manipulado_at" => "?datetime"
|
||||
];
|
||||
}
|
||||
104
ci4/app/Entities/Produccion/OrdenTrabajoEntity.php
Normal file
104
ci4/app/Entities/Produccion/OrdenTrabajoEntity.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Produccion;
|
||||
|
||||
use App\Controllers\Produccion\Ordentrabajo;
|
||||
use App\Database\Migrations\OrdenTrabajoDatesTable;
|
||||
use App\Entities\Pedidos\PedidoEntity;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoDate;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoTarea;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoUser;
|
||||
use App\Models\Pedidos\PedidoModel;
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
|
||||
class OrdenTrabajoEntity extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"pedido_id" => null,
|
||||
"user_created_id" => null,
|
||||
"user_updated_id" => null,
|
||||
"fecha_entrega_warning" => false,
|
||||
"fecha_entrega_warning_revised" => false,
|
||||
"total_tirada" => null,
|
||||
"total_precio" => null,
|
||||
"tipo_entrada" => "out",
|
||||
"progreso" => 0.00,
|
||||
"estado" => "I",
|
||||
"comentarios" => null,
|
||||
"revisar_formato" => false,
|
||||
"revisar_lomo" => false,
|
||||
"revisar_solapa" => false,
|
||||
"revisar_isbn" => false,
|
||||
"revisar_codigo_barras" => false,
|
||||
"realizar_imposicion" => false,
|
||||
"enviar_impresion" => false,
|
||||
];
|
||||
protected $casts = [
|
||||
"pedido_id" => "integer",
|
||||
"user_created_id" => "integer",
|
||||
"user_updated_id" => "?integer",
|
||||
"fecha_entrega_warning" => "bool",
|
||||
"fecha_entrega_warning_revised" => "bool",
|
||||
"total_tirada" => "float",
|
||||
"total_precio" => "float",
|
||||
"tipo_entrada" => "string",
|
||||
"progreso" => "float",
|
||||
"estado" => "string",
|
||||
"comentarios" => "string",
|
||||
"revisar_formato" => "bool",
|
||||
"revisar_lomo" => "bool",
|
||||
"revisar_solapa" => "bool",
|
||||
"revisar_isbn" => "bool",
|
||||
"revisar_codigo_barras" => "bool",
|
||||
"realizar_imposicion" => "bool",
|
||||
"enviar_impresion" => "bool",
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Devuelve las tareas de la orden de trabajo.
|
||||
*
|
||||
* @return array<OrdenTrabajoTarea>
|
||||
*/
|
||||
public function tareas(): array
|
||||
{
|
||||
$m = model(OrdenTrabajoTarea::class);
|
||||
return $m->where("orden_trabajo_id", $this->attributes["id"])->findAll();
|
||||
}
|
||||
/**
|
||||
* Devuelve el pedido de la orden de trabajo
|
||||
*
|
||||
* @return PedidoEntity
|
||||
*/
|
||||
public function pedido(): ?PedidoEntity
|
||||
{
|
||||
$m = model(PedidoModel::class);
|
||||
return $m->find($this->attributes["pedido_id"]);
|
||||
}
|
||||
public function dates(): ?OrdenTrabajoDateEntity
|
||||
{
|
||||
$m = model(OrdenTrabajoDate::class);
|
||||
return $m->find($this->attributes["id"]);
|
||||
}
|
||||
public function users(): ?OrdenTrabajoUserEntity
|
||||
{
|
||||
$m = model(OrdenTrabajoUser::class);
|
||||
return $m->find($this->attributes["id"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Almacena en la tabla `orden_trabajo_dates` las fechas correspondientes del pedido.
|
||||
* Se almacenan en una tabla externa porque puede haber modificaciones de estas fechas
|
||||
* en la orden del trabajo, pero en el pedido quedarán fijas.
|
||||
*
|
||||
* @todo Falta implementacion
|
||||
* @return boolean
|
||||
*/
|
||||
public function storeDates($data): self
|
||||
{
|
||||
$ot_dates = new OrdenTrabajoDateEntity();
|
||||
$this->attributes["dates"] = $ot_dates->fill($data);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Produccion;
|
||||
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
class OrdenTrabajoMaquetacionEntity extends Entity
|
||||
{
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
protected $casts = [];
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Produccion;
|
||||
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
class OrdenTrabajoMaquetacionMovimientoEntity extends Entity
|
||||
{
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
protected $casts = [];
|
||||
}
|
||||
105
ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php
Normal file
105
ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Produccion;
|
||||
|
||||
use App\Entities\Configuracion\Maquina;
|
||||
use App\Entities\Presupuestos\PresupuestoAcabadosEntity;
|
||||
use App\Entities\Presupuestos\PresupuestoLineaEntity;
|
||||
use App\Entities\Presupuestos\PresupuestoManipuladosEntity;
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
|
||||
use App\Models\Presupuestos\PresupuestoAcabadosModel;
|
||||
use App\Models\Presupuestos\PresupuestoLineaModel;
|
||||
use App\Models\Presupuestos\PresupuestoManipuladosModel;
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
class OrdenTrabajoTareaEntity extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"id" => null,
|
||||
"orden_trabajo_id" => null,
|
||||
"presupuesto_linea_id" => null,
|
||||
"nombre" => null,
|
||||
"orden" => null,
|
||||
"maquina_id" => null,
|
||||
"imposicion_id" => null,
|
||||
"tiempo_estimado" => null,
|
||||
"tiempo_real" => null,
|
||||
"comment" => null,
|
||||
];
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
protected $casts = [
|
||||
"id" => "integer",
|
||||
"orden_trabajo_id" => "integer",
|
||||
"presupuesto_linea_id" => "?integer",
|
||||
"nombre" => "string",
|
||||
"orden" => "integer",
|
||||
"maquina_id" => "?integer",
|
||||
"imposicion_id" => "?integer",
|
||||
"tiempo_estimado" => "?float",
|
||||
"tiempo_real" => "?float",
|
||||
"comment" => "?string"
|
||||
];
|
||||
|
||||
/**
|
||||
* Orden de trabajo de la tarea
|
||||
*
|
||||
* @return OrdenTrabajoEntity
|
||||
*/
|
||||
public function orden_trabajo() : OrdenTrabajoEntity
|
||||
{
|
||||
$m = model(OrdenTrabajoModel::class);
|
||||
return $m->find($this->attributes["orden_trabajo_id"]);
|
||||
}
|
||||
/**
|
||||
* Tarea orden de trabajo con orden de trabajo
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function withOrdenTrabajo() : self
|
||||
{
|
||||
$this->attributes["orden_trabajo"] = $this->orden_trabajo();
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Devuelve la maquina actual de esta tarea
|
||||
*
|
||||
* @return Maquina
|
||||
*/
|
||||
public function maquina_actual() : Maquina
|
||||
{
|
||||
$m = model(MaquinaModel::class);
|
||||
return $m->find($this->attributes["maquina_id"]);
|
||||
}
|
||||
/**
|
||||
* Devuelve el presupuesto linea origen de esta tarea
|
||||
*
|
||||
* @return PresupuestoLineaEntity
|
||||
*/
|
||||
public function presupuesto_linea() : PresupuestoLineaEntity
|
||||
{
|
||||
$m = model(PresupuestoLineaModel::class);
|
||||
return $m->find($this->attributes["presupuesto_linea_id"]);
|
||||
}
|
||||
/**
|
||||
* Devuelve la maquina original del presupuesto linea
|
||||
*
|
||||
* @return Maquina
|
||||
*/
|
||||
public function maquina_presupuesto_linea() : Maquina
|
||||
{
|
||||
return $this->presupuesto_linea()->maquina();
|
||||
}
|
||||
/**
|
||||
* Devuelve el presupuesto acabado origen de esta tarea
|
||||
*
|
||||
* @return PresupuestoAcabadosEntity
|
||||
*/
|
||||
public function presupuesto_acabado() : PresupuestoAcabadosEntity
|
||||
{
|
||||
$m = model(PresupuestoAcabadosModel::class);
|
||||
return $m->find($this->attributes["presupuesto_linea_id"]);
|
||||
}
|
||||
|
||||
}
|
||||
39
ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php
Normal file
39
ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Produccion;
|
||||
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
class OrdenTrabajoUserEntity extends Entity
|
||||
{
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
protected $casts = [];
|
||||
protected $attributes = [
|
||||
"orden_trabajo_id"=> null,
|
||||
"user_created_id"=> null,
|
||||
"user_update_id"=> null,
|
||||
"inaplazable_revised_change_user_id"=> null,
|
||||
"ferro_disponible_hecho_user_id"=> null,
|
||||
"ferro_disponible_ok_user_id"=> null,
|
||||
"ferro_entregado_user_id"=> null,
|
||||
"pendiente_ferro_user_id"=> null,
|
||||
"ferro_en_cliente_user_id"=> null,
|
||||
"ferro_ok_user_id"=> null,
|
||||
"interior_bn_user_id"=> null,
|
||||
"interior_color_user_id"=> null,
|
||||
"preparacion_interior_user_id"=> null,
|
||||
"cubierta_user_id"=> null,
|
||||
"plastificado_user_id"=> null,
|
||||
"encuadernacion_user_id"=> null,
|
||||
"corte_user_id"=> null,
|
||||
"embalaje_user_id"=> null,
|
||||
"entrada_manipulado_user_id"=> null,
|
||||
"pre_formato_user_id"=> null,
|
||||
"pre_lomo_user_id"=> null,
|
||||
"pre_solapa_user_id"=> null,
|
||||
"pre_codbarras_user_id"=> null,
|
||||
"pre_imposicion_user_id"=> null,
|
||||
"pre_imprimir_user_id" => null
|
||||
];
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace App\Entities\Tarifas\Maquinas;
|
||||
|
||||
use App\Entities\Tarifas\Acabados\TarifaAcabadoEntity;
|
||||
use App\Models\Tarifas\Acabados\TarifaAcabadoModel;
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
|
||||
class TarifaAcabadoMaquinaEntity extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"id" => null,
|
||||
"tarifa_acabado_id" => null,
|
||||
"maquina_id" => null,
|
||||
"maquina_tarea_id" => null,
|
||||
];
|
||||
protected $casts = [
|
||||
"id" => "integer",
|
||||
"tarifa_acabado_id" => "integer",
|
||||
"maquina_id" => "integer",
|
||||
"maquina_tarea_id" => "?integer",
|
||||
|
||||
];
|
||||
|
||||
public function tarifa_acabado(): TarifaAcabadoEntity
|
||||
{
|
||||
$m = model(TarifaAcabadoModel::class);
|
||||
return $m->find($this->attributes["tarifa_acabado_id"]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Tarifas\Maquinas;
|
||||
|
||||
use App\Entities\Tarifas\TarifaEncuadernacionEntity;
|
||||
use App\Models\Tarifas\TarifaEncuadernacionModel;
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
|
||||
class TarifaEncuadernacionMaquinaEntity extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"id" => null,
|
||||
"tarifa_encuadernacion_id" => null,
|
||||
"maquina_id" => null,
|
||||
"maquina_tarea_id" => null,
|
||||
|
||||
|
||||
];
|
||||
protected $casts = [
|
||||
"id" => "integer",
|
||||
"tarifa_encuadernacion_id" => "integer",
|
||||
"maquina_id" => "integer",
|
||||
"maquina_tarea_id" => "?integer",
|
||||
|
||||
|
||||
];
|
||||
|
||||
public function tarifa_encuadernacion(): TarifaEncuadernacionEntity
|
||||
{
|
||||
$m = model(TarifaEncuadernacionModel::class);
|
||||
return $m->find($this->attributes["tarifa_encuadernacion_id"]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
namespace App\Entities\Tarifas\Maquinas;
|
||||
|
||||
use App\Entities\Tarifas\Acabados\TarifaAcabadoEntity;
|
||||
use App\Entities\Tarifas\TarifaextraEntity;
|
||||
use App\Models\Tarifas\Acabados\TarifaAcabadoModel;
|
||||
use App\Models\Tarifas\TarifaextraModel;
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
|
||||
class TarifaExtraMaquinaEntity extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"id" => null,
|
||||
"tarifa_extra_id" => null,
|
||||
"maquina_id" => null,
|
||||
"maquina_tarea_id" => null,
|
||||
];
|
||||
protected $casts = [
|
||||
"id" => "integer",
|
||||
"tarifa_extra_id" => "integer",
|
||||
"maquina_id" => "integer",
|
||||
"maquina_tarea_id" => "?integer",
|
||||
|
||||
];
|
||||
|
||||
public function tarifa_extra(): TarifaextraEntity
|
||||
{
|
||||
$m = model(TarifaextraModel::class);
|
||||
return $m->find($this->attributes["tarifa_extra_id"]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
namespace App\Entities\Tarifas\Maquinas;
|
||||
|
||||
use App\Entities\Tarifas\TarifaManipuladoEntity;
|
||||
use App\Models\Tarifas\TarifaManipuladoModel;
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
|
||||
class TarifaManipuladoMaquinaEntity extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"id" => null,
|
||||
"tarifa_manipulado_id" => null,
|
||||
"maquina_id" => null,
|
||||
"maquina_tarea_id" => null,
|
||||
|
||||
];
|
||||
protected $casts = [
|
||||
"id" => "integer",
|
||||
"tarifa_manipulado_id" => "integer",
|
||||
"maquina_id" => "integer",
|
||||
"maquina_tarea_id" => "?integer",
|
||||
|
||||
];
|
||||
|
||||
public function tarifa_manipulado(): TarifaManipuladoEntity
|
||||
{
|
||||
$m = model(TarifaManipuladoModel::class);
|
||||
return $m->find($this->attributes["tarifa_manipulado_id"]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
namespace App\Entities\Tarifas\Maquinas;
|
||||
|
||||
use App\Entities\Tarifas\TarifapreimpresionEntity;
|
||||
use App\Models\Tarifas\TarifapreimpresionModel;
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
|
||||
class TarifaPreimpresionMaquinaEntity extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"id" => null,
|
||||
"tarifa_preimpresion_id" => null,
|
||||
"maquina_id" => null,
|
||||
"maquina_tarea_id" => null,
|
||||
|
||||
];
|
||||
protected $casts = [
|
||||
"id" => "integer",
|
||||
"tarifa_preimpresion_id" => "integer",
|
||||
"maquina_id" => "integer",
|
||||
"maquina_tarea_id" => "?integer",
|
||||
|
||||
];
|
||||
|
||||
public function tarifa_acabado(): TarifapreimpresionEntity
|
||||
{
|
||||
$m = model(TarifapreimpresionModel::class);
|
||||
return $m->find($this->attributes["tarifa_preimpresion_id"]);
|
||||
}
|
||||
}
|
||||
@ -31,4 +31,6 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity
|
||||
"user_updated_id" => "int",
|
||||
"is_deleted" => "int",
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
namespace App\Entities\Tarifas;
|
||||
|
||||
use CodeIgniter\Entity;
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
class TarifaEncuadernacionLinea extends \CodeIgniter\Entity\Entity
|
||||
class TarifaEncuadernacionLinea extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"id" => null,
|
||||
@ -38,4 +38,6 @@ class TarifaEncuadernacionLinea extends \CodeIgniter\Entity\Entity
|
||||
"user_updated_id" => "int",
|
||||
"is_deleted" => "int",
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user