mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
fechas pedido and imposiciones
This commit is contained in:
@ -6,9 +6,11 @@ use App\Entities\Produccion\OrdenTrabajoEntity;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
|
||||
use App\Entities\Clientes\ClienteEntity;
|
||||
use App\Entities\Configuracion\UbicacionesEntity;
|
||||
use App\Entities\Usuarios\UserEntity;
|
||||
use App\Models\Clientes\ClienteModel;
|
||||
use App\Models\Pedidos\PedidoLineaModel;
|
||||
use App\Models\Presupuestos\PresupuestoModel;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class PedidoEntity extends \CodeIgniter\Entity\Entity
|
||||
@ -40,6 +42,12 @@ class PedidoEntity extends \CodeIgniter\Entity\Entity
|
||||
protected $casts = [
|
||||
"total_precio" => "float",
|
||||
"total_tirada" => "float",
|
||||
"inaplazable" => "bool",
|
||||
"fecha_entrega_real_change_user_id" => "?integer",
|
||||
"fecha_impresion_change_user_id" => "?integer",
|
||||
"fecha_encuadernado_change_user_id" => "?integer",
|
||||
"fecha_entrega_change_externo_user_id" => "?integer",
|
||||
"inaplazable_change_user_id" => "?integer",
|
||||
];
|
||||
/**
|
||||
* Devuelve la entidad `PedidoEntity` con sus relaciones
|
||||
@ -91,4 +99,16 @@ class PedidoEntity extends \CodeIgniter\Entity\Entity
|
||||
$pre = $pm->find($pedido_linea->presupuesto_id);
|
||||
return $m->find($pre->cliente_id);
|
||||
}
|
||||
public function userBy(string $key): ?UserEntity
|
||||
{
|
||||
$user = null;
|
||||
if (isset($this->attributes[$key])) {
|
||||
|
||||
if ($this->attributes[$key]) {
|
||||
$m = model(UserModel::class);
|
||||
$user = $m->find($this->attributes[$key]);
|
||||
}
|
||||
}
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,4 +225,8 @@ class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity
|
||||
{
|
||||
return in_array($this->attributes['tipo'],['lp_rot_color','lp_rot_bn']);
|
||||
}
|
||||
public function isColor():bool {
|
||||
return in_array($this->attributes['tipo'],['lp_color','lp_colorhq','lp_rot_color']);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,10 +134,10 @@ class OrdenTrabajoEntity extends Entity
|
||||
{
|
||||
return $this->pedidoEsperaBy();
|
||||
}
|
||||
public function getPortadaPath(): ?string
|
||||
public function getFullPath(): ?string
|
||||
{
|
||||
helper('filesystem');
|
||||
$path = $this->attributes["portada_path"];
|
||||
$path = WRITEPATH . 'uploads/' . $this->attributes["portada_path"];
|
||||
$portada_path = null;
|
||||
if($path){
|
||||
if(file_exists($path)){
|
||||
|
||||
@ -110,7 +110,11 @@ class OrdenTrabajoTareaEntity extends Entity
|
||||
public function imposicion() : ?Imposicion
|
||||
{
|
||||
$m = model(ImposicionModel::class);
|
||||
return $m->find($this->attributes["imposicion_id"]);
|
||||
$imposicion = null;
|
||||
if($this->attributes["imposicion_id"]){
|
||||
$imposicion = $m->find($this->attributes["imposicion_id"]);
|
||||
}
|
||||
return $imposicion;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user