mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
ot pliegos
This commit is contained in:
@ -68,7 +68,7 @@ class OrdenTrabajoEntity extends Entity
|
||||
/**
|
||||
* Devuelve las tareas de la orden de trabajo.
|
||||
*
|
||||
* @return array<OrdenTrabajoTarea>
|
||||
* @return array<OrdenTrabajoTareaEntity>
|
||||
*/
|
||||
public function tareas(): array
|
||||
{
|
||||
|
||||
@ -34,8 +34,11 @@ class OrdenTrabajoTareaEntity extends Entity
|
||||
"comment" => null,
|
||||
"click_init" => null,
|
||||
"click_end" => null,
|
||||
"pliego_1" => null,
|
||||
"pliego_1_total" => null,
|
||||
"pliego_2" => null,
|
||||
"pliego_2_total" => null,
|
||||
];
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
protected $casts = [
|
||||
"id" => "integer",
|
||||
@ -52,6 +55,10 @@ class OrdenTrabajoTareaEntity extends Entity
|
||||
"comment" => "?string",
|
||||
"click_init" => "integer",
|
||||
"click_end" => "integer",
|
||||
"pliego_1" => "integer",
|
||||
"pliego_1_total" => "integer",
|
||||
"pliego_2" => "integer",
|
||||
"pliego_2_total" => "integer",
|
||||
];
|
||||
|
||||
/**
|
||||
@ -113,6 +120,20 @@ class OrdenTrabajoTareaEntity extends Entity
|
||||
$m = model(PresupuestoAcabadosModel::class);
|
||||
return $m->find($this->attributes["presupuesto_linea_id"]);
|
||||
}
|
||||
/**
|
||||
* Devuelve el presupuesto acabado origen de esta tarea
|
||||
*
|
||||
* @return ?PresupuestoManipuladosEntity
|
||||
*/
|
||||
public function presupuesto_manipulado(): ?PresupuestoManipuladosEntity
|
||||
{
|
||||
$m = model(PresupuestoManipuladosModel::class);
|
||||
$p = null;
|
||||
if ($this->attributes['presupuesto_manipulado_id']) {
|
||||
$p = $m->find($this->attributes["presupuesto_manipulado_id"]);
|
||||
}
|
||||
return $p;
|
||||
}
|
||||
public function imposicion(): ?Imposicion
|
||||
{
|
||||
$m = model(ImposicionModel::class);
|
||||
@ -152,5 +173,13 @@ class OrdenTrabajoTareaEntity extends Entity
|
||||
{
|
||||
return $this->attributes['click_end'] - $this->attributes['click_init'];
|
||||
}
|
||||
|
||||
public function isCosido(): bool
|
||||
{
|
||||
$isTareaCosido = false;
|
||||
$pm = $this->presupuesto_manipulado();
|
||||
if ($pm) {
|
||||
$isTareaCosido = $pm->tarifa()->isCosido();
|
||||
}
|
||||
return $isTareaCosido;
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,4 +33,9 @@ class TarifaManipuladoEntity extends \CodeIgniter\Entity\Entity
|
||||
"user_updated_id" => "int",
|
||||
"is_deleted" => "int",
|
||||
];
|
||||
|
||||
public function isCosido(): bool
|
||||
{
|
||||
return in_array($this->attributes['id'], [3, 17]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user