mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
ot relations
This commit is contained in:
@ -21,33 +21,37 @@ class OrdenTrabajoTable extends Migration
|
|||||||
"user_created_id" => [
|
"user_created_id" => [
|
||||||
"type" => "INT",
|
"type" => "INT",
|
||||||
"constraint" => 10,
|
"constraint" => 10,
|
||||||
|
"comment" => "Usuario que ha pasado el pedido a producción",
|
||||||
],
|
],
|
||||||
"user_update_id" => [
|
"user_update_id" => [
|
||||||
"type" => "INT",
|
"type" => "INT",
|
||||||
"constraint" => 10,
|
"constraint" => 10,
|
||||||
|
"comment" => "Usuario que ha actualizado la orden de trabajo",
|
||||||
|
|
||||||
],
|
],
|
||||||
"maquina_orden_negro_id" => [
|
"maquina_orden_negro_id" => [
|
||||||
"type" => "INT",
|
"type" => "INT",
|
||||||
"constraint" => 10,
|
"constraint" => 10,
|
||||||
"null" => true
|
"null" => true,
|
||||||
|
"comment" => "Maquina para impresion en negro",
|
||||||
],
|
],
|
||||||
"maquina_orden_color_id" => [
|
"maquina_orden_color_id" => [
|
||||||
"type" => "INT",
|
"type" => "INT",
|
||||||
"constraint" => 10,
|
"constraint" => 10,
|
||||||
"null" => true
|
"null" => true,
|
||||||
|
"comment" => "Maquina para impresion en color",
|
||||||
],
|
],
|
||||||
"maquina_orden_portada_id" => [
|
"maquina_orden_portada_id" => [
|
||||||
"type" => "INT",
|
"type" => "INT",
|
||||||
"constraint" => 10,
|
"constraint" => 10,
|
||||||
"null" => true
|
"null" => true,
|
||||||
|
"comment" => "Maquina para impresion portada",
|
||||||
],
|
],
|
||||||
"maquina_orden_cubierta_id" => [
|
"maquina_orden_cubierta_id" => [
|
||||||
"type" => "INT",
|
"type" => "INT",
|
||||||
"constraint" => 10,
|
"constraint" => 10,
|
||||||
"null" => true
|
"null" => true,
|
||||||
|
"comment" => "Maquina para impresion cubierta",
|
||||||
],
|
],
|
||||||
"negro_forma_id" => [
|
"negro_forma_id" => [
|
||||||
"type" => "INT",
|
"type" => "INT",
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Entities\Presupuestos;
|
namespace App\Entities\Presupuestos;
|
||||||
|
|
||||||
|
use App\Models\Presupuestos\PresupuestoLineaModel;
|
||||||
|
use App\Models\Presupuestos\PresupuestoModel;
|
||||||
use CodeIgniter\Entity;
|
use CodeIgniter\Entity;
|
||||||
|
|
||||||
class PresupuestoEntity extends \CodeIgniter\Entity\Entity
|
class PresupuestoEntity extends \CodeIgniter\Entity\Entity
|
||||||
@ -78,7 +81,7 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
|
|||||||
"total_margen_envios" => null,
|
"total_margen_envios" => null,
|
||||||
"total_costes" => null,
|
"total_costes" => null,
|
||||||
"total_margenes" => null,
|
"total_margenes" => null,
|
||||||
"total_antes_descuento" => null,
|
"total_antes_descuento" => null,
|
||||||
"total_descuento" => null,
|
"total_descuento" => null,
|
||||||
"total_descuentoPercent" => null,
|
"total_descuentoPercent" => null,
|
||||||
"total_precio_unidad" => null,
|
"total_precio_unidad" => null,
|
||||||
@ -165,4 +168,27 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
|
|||||||
'paginasCuadernillo' => "int",
|
'paginasCuadernillo' => "int",
|
||||||
'lomo_redondo' => "boolean",
|
'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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Models\OrdenTrabajo;
|
namespace App\Models\OrdenTrabajo;
|
||||||
|
|
||||||
use App\Entities\Presupuestos\OrdenTrabajoEntity;
|
use App\Entities\Produccion\OrdenTrabajoEntity;
|
||||||
use CodeIgniter\Database\BaseBuilder;
|
use CodeIgniter\Database\BaseBuilder;
|
||||||
use CodeIgniter\Model;
|
use CodeIgniter\Model;
|
||||||
class OrdenTrabajoModel extends Model
|
class OrdenTrabajoModel extends Model
|
||||||
|
|||||||
Reference in New Issue
Block a user