Añadidos servicios preimpresion y manipulado

This commit is contained in:
imnavajas
2023-10-03 23:29:46 +02:00
parent 080bc225a1
commit a10c4a4ad8
10 changed files with 743 additions and 80 deletions

View File

@ -0,0 +1,68 @@
<?php
namespace App\Models\Presupuestos;
class PresupuestoManipuladosModel extends \App\Models\GoBaseModel
{
protected $table = "presupuesto_manipulados";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
const SORTABLE = [
0 => "t2.nombre",
1 => "t1.precio_unidad",
2 => "t1.precio_total"
];
protected $allowedFields = ["presupuesto_id", "tarifa_manipulado_id", "nombre", "precio_total", "precio_unidad"];
protected $returnType = "App\Entities\Presupuestos\PresupuestoManipuladosEntity";
protected $useTimestamps = true;
protected $useSoftDeletes = false;
protected $createdField = "created_at";
protected $updatedField = "updated_at";
public static $labelField = "nombre";
protected $validationRules = [
"precio_total" => [
"label" => "Presupuestos.precioTotal",
"rules" => "decimal|required",
],
];
protected $validationMessages = [
"precio_total" => [
"decimal" => "Presupuestos.validation.decimal",
"requerido" => "Presupuestos.validation.decimal",
],
];
/**
* Get resource data.
*
* @param string $search
*
* @return \CodeIgniter\Database\BaseBuilder
*/
public function getResource($presupuesto_id = -1)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.tarifa_manipulado_id AS tarifa_manipulado_id, t1.precio_unidad AS precio_unidad, t1.precio_total AS precio_total, t2.nombre AS nombre"
);
$builder->where('t1.presupuesto_id', $presupuesto_id);
$builder->join("lg_tarifa_manipulado t2", "t1.tarifa_manipulado_id = t2.id", "left");
return $builder;
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace App\Models\Presupuestos;
class PresupuestoPreimpresionesModel extends \App\Models\GoBaseModel
{
protected $table = "presupuesto_preimpresiones";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
const SORTABLE = [
0 => "t2.nombre",
1 => "t1.precio_unidad",
2 => "t1.precio_total"
];
protected $allowedFields = ["presupuesto_id", "tarifa_preimpresion_id", "nombre", "precio_total", "precio_unidad"];
protected $returnType = "App\Entities\Presupuestos\PresupuestoPreimpresionesEntity";
protected $useTimestamps = true;
protected $useSoftDeletes = false;
protected $createdField = "created_at";
protected $updatedField = "updated_at";
public static $labelField = "nombre";
protected $validationRules = [
"precio_total" => [
"label" => "Presupuestos.precioTotal",
"rules" => "decimal|required",
],
];
protected $validationMessages = [
"precio_total" => [
"decimal" => "Presupuestos.validation.decimal",
"requerido" => "Presupuestos.validation.decimal",
],
];
/**
* Get resource data.
*
* @param string $search
*
* @return \CodeIgniter\Database\BaseBuilder
*/
public function getResource($presupuesto_id = -1)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.tarifa_preimpresion_id AS tarifa_preimpresion_id, t1.precio_unidad AS precio_unidad, t1.precio_total AS precio_total, t2.nombre AS nombre"
);
$builder->where('t1.presupuesto_id', $presupuesto_id);
$builder->join("lg_tarifa_preimpresion t2", "t1.tarifa_preimpresion_id = t2.id", "left");
return $builder;
}
}

View File

@ -103,7 +103,7 @@ class TarifaEncuadernacionModel extends \App\Models\GoBaseModel
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id as id, t1.nombre AS nombre"
"t1.id as value, t1.nombre AS label"
)
->where("t1.is_deleted", 0)
->where("t1.mostrar_en_presupuesto", 1);

View File

@ -102,7 +102,7 @@ class TarifaManipuladoModel extends \App\Models\GoBaseModel
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id as id, t1.nombre AS nombre"
"t1.id as value, t1.nombre AS label"
)
->where("t1.is_deleted", 0)
->where("t1.mostrar_en_presupuesto", 1);

View File

@ -88,7 +88,7 @@ class TarifapreimpresionModel extends \App\Models\GoBaseModel
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id as id, t1.nombre AS nombre"
"t1.id as value, t1.nombre AS label"
)
->where("t1.is_deleted", 0)
->where("t1.mostrar_en_presupuesto", 1);