This commit is contained in:
amazuecos
2024-12-04 18:15:59 +01:00
parent ce050cf07d
commit e24839019a
9 changed files with 938 additions and 506 deletions

View File

@ -1,449 +0,0 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class OrdenTrabajoTable extends Migration
{
protected array $COLUMNS = [
"id" => [
"type" => "INT",
"unsigned" => true,
"auto_increment" => true
],
"pedido_id" => [
"type" => "INT",
"constraint" => 10,
"comment" => "Pedido asociado",
],
"user_created_id" => [
"type" => "INT",
"constraint" => 10,
],
"user_update_id" => [
"type" => "INT",
"constraint" => 10,
],
"maquina_orden_negro_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"maquina_orden_color_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"maquina_orden_portada_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"maquina_orden_cubierta_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"negro_forma_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"color_forma_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"portada_forma_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"cubierta_forma_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"tirada" => [
"type" => "DOUBLE",
],
"negro_pliegos_pedido" => [
"type" => "DOUBLE",
"null" => true
],
"color_pliegos_pedido" => [
"type" => "DOUBLE",
"null" => true
],
"portada_pliegos_pedido" => [
"type" => "DOUBLE",
"null" => true
],
"cubierta_pliegos_pedido" => [
"type" => "DOUBLE",
"null" => true
],
"negro_clicks_pedido" => [
"type" => "DOUBLE",
],
"color_clicks_pedido" => [
"type" => "DOUBLE",
],
"portada_clicks_pedido" => [
"type" => "DOUBLE",
],
"cubierta_clicks_pedido" => [
"type" => "DOUBLE",
],
"pliegos1" => [
"type" => "INT",
"constraint" => 11,
],
"paginas1" => [
"type" => "INT",
"constraint" => 11,
],
"pliegos2" => [
"type" => "INT",
"constraint" => 11,
],
"paginas2" => [
"type" => "INT",
"constraint" => 11,
],
"negro_proveedor_nombre" => [
"type" => "VARCHAR",
"constraint" => 225
],
"color_proveedor_nombre" => [
"type" => "VARCHAR",
"constraint" => 225
],
"portada_proveedor_nombre" => [
"type" => "VARCHAR",
"constraint" => 225
],
"corte_pie" => [
"type" => "DOUBLE",
],
"lomo" => [
"type" => "INT",
"constraint" => 11,
"null" => true,
],
"tipo_entrada" => [
"type" => "ENUM",
"constraint" => ["in", "out"],
"default" => "out"
],
"fecha_entrada_at" => [
"type" => "DATETIME",
"null" => true,
],
"fecha_entrega_at" => [
"type" => "DATETIME",
"null" => true,
],
"fecha_entrega_change_at" => [
"type" => "DATETIME",
"null" => true,
],
"fecha_entrega_change_user_id" =>[
"type" => "INT",
"constraint" => 11,
"null" => true,
],
"fecha_entrega_real_at" => [
"type" => "DATETIME",
"null" => true,
],
"fecha_entrega_real_warning" => [
"type" => "BOOLEAN",
"default" => false,
],
"fecha_impresion_at" => [
"type" => "DATE",
"null" => true,
],
"fecha_encuardernado_at" => [
"type" => "DATE",
"null" => true,
],
"fecha_externo_at" => [
"type" => "DATE",
"null" => true,
],
"fecha_entrega_warning" => [
"type" => "BOOLEAN",
"default" => false
],
"fecha_entrega_warning_revised" => [
"type" => "BOOLEAN",
"default" => false
],
"inaplazable_revised_change_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"pendiente_ferro_at" => [
"type" => "DATETIME",
"null" => true,
],
"ferro_en_cliente_at" => [
"type" => "DATETIME",
"null" => true,
],
"ferro_ok_at" => [
"type" => "DATETIME",
"null" => true,
],
"interior_bn_at" => [
"type" => "DATETIME",
"null" => true,
],
"interior_color_at" => [
"type" => "DATETIME",
"null" => true,
],
"preparacion_interiores_at" => [
"type" => "DATETIME",
"null" => true,
],
"cubierta_at" => [
"type" => "DATETIME",
"null" => true,
],
"plastificado_at" => [
"type" => "DATETIME",
"null" => true,
],
"encuadernacion_at" => [
"type" => "DATETIME",
"null" => true,
],
"corte_at" => [
"type" => "DATETIME",
"null" => true,
],
"embalaje_at" => [
"type" => "DATETIME",
"null" => true,
],
"envio_at" => [
"type" => "DATETIME",
"null" => true,
],
"entrada_manipulado_at" => [
"type" => "DATETIME",
"null" => true,
],
"ferro_disponible" => [
"type" => "TINYINT",
"constraint" => 4,
],
"ferro_disponible_thread_id" => [
"type" => "INT",
"constraint" => 10,
],
"ferro_disponible_hecho_at" => [
"type" => "DATETIME",
"null" => true,
],
"ferro_disponible_hecho_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"ferro_disponible_ok_at" => [
"type" => "DATETIME",
"null" => true,
],
"ferro_disponible_ok_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"ferro_entregado_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"ferro_entregado_at" => [
"type" => "DATETIME",
"null" => true,
],
"pendiente_ferro_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"ferro_en_cliente_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"ferro_ok_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"ferro_cp" => [
"type" => "VARCHAR",
"constraint" => 10,
"null" => true
],
"ferro_proveedor" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"ferro_tracking" => [
"type" => "VARCHAR",
"constraint" => 100,
"null" => true,
],
"interior_bn_user_id" => [
"type" => "INT",
"constraint" => 10,
],
"interior_color_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"preparacion_interior_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"cubierda_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"plastificado_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"encuadernacion_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"corte_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"embalaje_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"envio_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"entrada_manipulado_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"pre_formato" => [
"type" => "BOOLEAN",
"default" => false
],
"pre_formato_at" => [
"type" => "DATETIME",
"null" => true,
],
"pre_formato_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"pre_lomo" => [
"type" => "BOOLEAN",
"default" => 0,
],
"pre_lomo_at" => [
"type" => "DATETIME",
"null" => true,
],
"pre_lomo_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"pre_solapa" => [],
"pre_solapa_at" => [
"type" => "DATETIME",
"null" => true,
],
"pre_solapa_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"pre_isbn" => [],
"pre_isbn_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"pre_codbarras" => [],
"pre_codbarras_at" => [
"type" => "DATETIME",
"null" => true,
],
"pre_codbarras_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"pre_imposicion" => [],
"pre_imposicion_at" => [
"type" => "DATETIME",
"null" => true,
],
"pre_imposicion_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"pre_imprimir" => [],
"pre_imprimir_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"pre_faltan_materiales" => [],
"pre_imprimir_user_id" => [
"type" => "INT",
"constraint" => 11,
],
"pre_faltan_materiales_note" => [],
"progreso" => [],
"message_production_send" => [],
"finalizado" => [],
"comentarios" => []
];
public function up()
{
$this->forge->addField($this->COLUMNS);
$currenttime = new RawSql("CURRENT_TIMESTAMP");
$this->forge->addField([
"created_at" => [
"type" => "TIMESTAMP",
"default" => $currenttime,
],
"updated_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
"deleted_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
]);
$this->forge->createTable("ots", true);
}
public function down()
{
$this->forge->dropTable("ots");
}
}

View File

@ -0,0 +1,53 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class TareasServicioTable extends Migration
{
protected array $COLUMNS = [
"id" => [
"type" => "INT",
"unsigned" => true,
"autoincrement" => true
],
"tarifa_acabado_id" => [
"type" => "INT",
"unsigned" => true,
],
"tarifa_manipulado_id" => [
"type" => "INT",
"unsigned" => true,
]
];
public function up()
{
$this->forge->addField($this->COLUMNS);
$currenttime = new RawSql("CURRENT_TIMESTAMP");
$this->forge->addField([
"created_at" => [
"type" => "TIMESTAMP",
"default" => $currenttime,
],
"updated_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
"deleted_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
]);
$this->forge->createTable("tareas_servicio", true);
}
public function down()
{
$this->forge->dropTable("tareas_servicio");
}
}

View File

@ -0,0 +1,299 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class OrdenTrabajoTable extends Migration
{
protected array $COLUMNS = [
"id" => [
"type" => "INT",
"unsigned" => true,
"auto_increment" => true
],
"pedido_id" => [
"type" => "INT",
"constraint" => 10,
"comment" => "Pedido asociado",
],
"user_created_id" => [
"type" => "INT",
"constraint" => 10,
],
"user_update_id" => [
"type" => "INT",
"constraint" => 10,
],
"maquina_orden_negro_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"maquina_orden_color_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"maquina_orden_portada_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"maquina_orden_cubierta_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"negro_forma_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"color_forma_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"portada_forma_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"cubierta_forma_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"tirada" => [
"type" => "DOUBLE",
],
"negro_pliegos_pedido" => [
"type" => "DOUBLE",
"null" => true
],
"color_pliegos_pedido" => [
"type" => "DOUBLE",
"null" => true
],
"portada_pliegos_pedido" => [
"type" => "DOUBLE",
"null" => true
],
"cubierta_pliegos_pedido" => [
"type" => "DOUBLE",
"null" => true
],
"negro_clicks_pedido" => [
"type" => "DOUBLE",
],
"color_clicks_pedido" => [
"type" => "DOUBLE",
],
"portada_clicks_pedido" => [
"type" => "DOUBLE",
],
"cubierta_clicks_pedido" => [
"type" => "DOUBLE",
],
"pliegos1" => [
"type" => "INT",
"constraint" => 11,
],
"paginas1" => [
"type" => "INT",
"constraint" => 11,
],
"pliegos2" => [
"type" => "INT",
"constraint" => 11,
],
"paginas2" => [
"type" => "INT",
"constraint" => 11,
],
"negro_proveedor_nombre" => [
"type" => "VARCHAR",
"constraint" => 225
],
"color_proveedor_nombre" => [
"type" => "VARCHAR",
"constraint" => 225
],
"portada_proveedor_nombre" => [
"type" => "VARCHAR",
"constraint" => 225
],
"corte_pie" => [
"type" => "DOUBLE",
],
"lomo" => [
"type" => "INT",
"constraint" => 11,
"null" => true,
],
"tipo_entrada" => [
"type" => "ENUM",
"constraint" => ["in", "out"],
"default" => "out"
],
"fecha_entrega_real_warning" => [
"type" => "BOOLEAN",
"default" => false,
],
"fecha_entrega_warning" => [
"type" => "BOOLEAN",
"default" => false
],
"fecha_entrega_warning_revised" => [
"type" => "BOOLEAN",
"default" => false
],
"ferro_disponible" => [
"type" => "TINYINT",
"constraint" => 4,
],
"ferro_disponible_thread_id" => [
"type" => "INT",
"constraint" => 10,
],
"ferro_cp" => [
"type" => "VARCHAR",
"constraint" => 10,
"null" => true
],
"ferro_proveedor" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"ferro_tracking" => [
"type" => "VARCHAR",
"constraint" => 100,
"null" => true,
],
"pre_formato" => [
"type" => "BOOLEAN",
"default" => false
],
"pre_lomo" => [
"type" => "BOOLEAN",
"default" => 0,
],
"pre_solapa" => [
"type" => "BOOLEAN",
"default" => 0,
],
"pre_isbn" => [
"type" => "BOOLEAN",
"default" => 0,
],
"pre_codbarras" => [
"type" => "BOOLEAN",
"default" => 0,
],
"pre_imposicion" => [
"type" => "BOOLEAN",
"default" => 0,
],
"pre_imprimir" => [
"type" => "BOOLEAN",
"default" => 0,
],
"pre_faltan_materiales" => [
"type" => "BOOLEAN",
"default" => 0,
],
"pre_faltan_materiales_note" => [
"type" => "TEXT",
"null" => true,
],
"progreso" => [
"type" => "DOUBLE",
"default" => 0.00,
],
"message_production_send" => [
"type" => "BOOLEAN",
"default" => 0,
],
"finalizado" => [
"type" => "BOOLEAN",
"default" => 0,
],
"comentarios" => [
"type" => "TEXT",
"null" => true,
]
];
public function up()
{
$this->forge->addField($this->COLUMNS);
$currenttime = new RawSql("CURRENT_TIMESTAMP");
$this->forge->addField([
"created_at" => [
"type" => "TIMESTAMP",
"default" => $currenttime,
],
"updated_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
"deleted_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
]);
$this->forge->addPrimaryKey("id");
// $this->forge->addForeignKey(["maquina_orden_portada_id"],"lg_maquinas",["id"]);
// $this->forge->addForeignKey(["maquina_orden_negro_id"],"lg_maquinas",["id"]);
// $this->forge->addForeignKey(["maquina_orden_cubierta_id"],"lg_maquinas",["id"]);
// $this->forge->addForeignKey(["maquina_orden_color_id"],"lg_maquinas",["id"]);
$this->forge->createTable("ordenes_trabajo", true);
}
public function down()
{
$this->forge->dropTable("ordenes_trabajo");
}
}

View File

@ -0,0 +1,56 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class OrdenTrabajoTareasTable extends Migration
{
protected array $COLUMNS = [
"id" => [
"type" => "INT",
"unsigned" => true,
"autoincrement" => true
],
"tarea_servicio_id" => [
"type" => "INT",
"unsigned" => true,
],
"orden_trabajo_id" => [
"type" => "INT",
"unsigned" => true,
],
];
public function up()
{
$this->forge->addField($this->COLUMNS);
$currenttime = new RawSql("CURRENT_TIMESTAMP");
$this->forge->addField([
"created_at" => [
"type" => "TIMESTAMP",
"default" => $currenttime,
],
"updated_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
"deleted_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
]);
// $this->forge->addPrimaryKey("id");
// $this->forge->addForeignKey("orden_trabajo_id","ordenes_trabajo","id");
// $this->forge->addForeignKey("tarea_servicio_id","tareas_servicio","id");
$this->forge->createTable("orden_trabajo_tareas", true);
}
public function down()
{
$this->forge->dropTable("orden_trabajo_tareas");
}
}

View File

@ -0,0 +1,171 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class OrdenTrabajoDatesTable extends Migration
{
protected array $COLUMNS = [
"fecha_entrada_at" => [
"type" => "DATETIME",
"null" => true,
],
"fecha_entrega_at" => [
"type" => "DATETIME",
"null" => true,
],
"fecha_entrega_change_at" => [
"type" => "DATETIME",
"null" => true,
],
"fecha_entrega_real_at" => [
"type" => "DATETIME",
"null" => true,
],
"fecha_entrega_real_warning" => [
"type" => "BOOLEAN",
"default" => false,
],
"fecha_impresion_at" => [
"type" => "DATE",
"null" => true,
],
"fecha_encuardernado_at" => [
"type" => "DATE",
"null" => true,
],
"fecha_externo_at" => [
"type" => "DATE",
"null" => true,
],
"fecha_entrega_warning" => [
"type" => "BOOLEAN",
"default" => false
],
"fecha_entrega_warning_revised" => [
"type" => "BOOLEAN",
"default" => false
],
"pendiente_ferro_at" => [
"type" => "DATETIME",
"null" => true,
],
"ferro_en_cliente_at" => [
"type" => "DATETIME",
"null" => true,
],
"ferro_ok_at" => [
"type" => "DATETIME",
"null" => true,
],
"interior_bn_at" => [
"type" => "DATETIME",
"null" => true,
],
"interior_color_at" => [
"type" => "DATETIME",
"null" => true,
],
"preparacion_interiores_at" => [
"type" => "DATETIME",
"null" => true,
],
"cubierta_at" => [
"type" => "DATETIME",
"null" => true,
],
"plastificado_at" => [
"type" => "DATETIME",
"null" => true,
],
"encuadernacion_at" => [
"type" => "DATETIME",
"null" => true,
],
"corte_at" => [
"type" => "DATETIME",
"null" => true,
],
"embalaje_at" => [
"type" => "DATETIME",
"null" => true,
],
"envio_at" => [
"type" => "DATETIME",
"null" => true,
],
"entrada_manipulado_at" => [
"type" => "DATETIME",
"null" => true,
],
"ferro_disponible_hecho_at" => [
"type" => "DATETIME",
"null" => true,
],
"ferro_disponible_ok_at" => [
"type" => "DATETIME",
"null" => true,
],
"ferro_entregado_at" => [
"type" => "DATETIME",
"null" => true,
],
"pre_formato_at" => [
"type" => "DATETIME",
"null" => true,
],
"pre_lomo_at" => [
"type" => "DATETIME",
"null" => true,
],
"pre_solapa_at" => [
"type" => "DATETIME",
"null" => true,
],
"pre_codbarras_at" => [
"type" => "DATETIME",
"null" => true,
],
"pre_imposicion_at" => [
"type" => "DATETIME",
"null" => true,
],
];
public function up()
{
$this->forge->addField($this->COLUMNS);
$currenttime = new RawSql("CURRENT_TIMESTAMP");
$this->forge->addField([
"created_at" => [
"type" => "TIMESTAMP",
"default" => $currenttime,
],
"updated_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
"deleted_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
]);
$this->forge->createTable("orden_trabajo_dates", true);
}
public function down()
{
$this->forge->dropTable("orden_trabajo_dates");
}
}

View File

@ -0,0 +1,190 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class OrdenTrabajoUsers extends Migration
{
protected array $COLUMNS = [
"user_created_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"user_update_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"inaplazable_revised_change_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"ferro_disponible_hecho_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"ferro_disponible_ok_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"ferro_entregado_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"pendiente_ferro_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"ferro_en_cliente_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"ferro_ok_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"interior_bn_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"interior_color_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"preparacion_interior_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"cubierda_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"plastificado_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"encuadernacion_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"corte_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"embalaje_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"envio_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"entrada_manipulado_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"pre_formato_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"pre_lomo_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"pre_solapa_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"pre_codbarras_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"pre_imposicion_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"pre_imprimir_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"pre_imprimir_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
];
public function up()
{
$this->forge->addField($this->COLUMNS);
$currenttime = new RawSql("CURRENT_TIMESTAMP");
$this->forge->addField([
"created_at" => [
"type" => "TIMESTAMP",
"default" => $currenttime,
],
"updated_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
"deleted_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
]);
foreach ($this->COLUMNS as $key => $value) {
$this->forge->addForeignKey([$key],"users",["id"]);
}
$this->forge->createTable("orden_trabajo_users", true);
}
public function down()
{
$this->forge->dropTable("orden_trabajo_users");
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class OrdenTrabajoMaquetacionesTable extends Migration
{
protected array $COLUMNS = [
"id" => [
"type" => "INT",
"unsigned" => true,
"auto_increment" => true
],
"pedido_maquetacion_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"user_created_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"user_update_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"entrada_at" => [
"type" => "DATETIME",
"default" => null
],
"salida_at" => [
"type" => "DATETIME",
"default" => null
],
"progreso" => [
"type" => "DOUBLE",
"default" => 0
],
"finalizado" => [
"type" => "BOOLEAN",
"default" => 0
]
];
public function up()
{
$this->forge->addField($this->COLUMNS);
$currenttime = new RawSql("CURRENT_TIMESTAMP");
$this->forge->addField([
"created_at" => [
"type" => "TIMESTAMP",
"default" => $currenttime,
],
"updated_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
"deleted_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
]);
$this->forge->addPrimaryKey("id");
$this->forge->createTable("orden_trabajo_maquetaciones", true);
}
public function down()
{
$this->forge->dropTable("orden_trabajo_maquetaciones");
}
}

View File

@ -0,0 +1,63 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class OrdenTrabajoMaquetacionMovimientosTable extends Migration
{
protected array $COLUMNS = [
"id" => [
"type" => "INT",
"unsigned" => true,
"auto_increment" => true
],
"orden_trabajo_maquetacion_id" => [
"type" => "INT",
"unsigned" => true,
"null" => true,
],
"orden_trabajo_maquetacion_id" => [
"type" => "INT",
"unsigned" => true,
"null" => true,
],
"file_id" => [
"type" => "INT",
"unsigned" => true,
"null" => true,
],
];
public function up()
{
$this->forge->addField($this->COLUMNS);
$currenttime = new RawSql("CURRENT_TIMESTAMP");
$this->forge->addField([
"created_at" => [
"type" => "TIMESTAMP",
"default" => $currenttime,
],
"updated_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
"deleted_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
]);
$this->forge->addPrimaryKey("id");
$this->forge->createTable("orden_trabajo_maquetacion_movimientos", true);
}
public function down()
{
$this->forge->dropTable("orden_trabajo_maquetacion_movimientos");
}
}

View File

@ -2,6 +2,7 @@
namespace App\Models\OrdenTrabajo;
use CodeIgniter\Database\BaseBuilder;
use CodeIgniter\Model;
class OrdenTrabajoModel extends Model
@ -13,8 +14,7 @@ class OrdenTrabajoModel extends Model
protected $useSoftDeletes = true;
protected $protectFields = true;
protected $allowedFields = [
"user_created_id",
"user_update_id",
"pedido_id",
"maquina_orden_negro_id",
"maquina_orden_color_id",
"maquina_orden_portada_id",
@ -42,77 +42,22 @@ class OrdenTrabajoModel extends Model
"corte_pie",
"lomo",
"tipo_entrada",
"fecha_entrada_at",
"fecha_entrega_at",
"fecha_entrega_change_at",
"fecha_entrega_change_user_id",
"fecha_entrega_real_at",
"fecha_entrega_real_warning",
"fecha_impresion_at",
"fecha_encuardernado_at",
"fecha_externo_at",
"fecha_entrega_warning",
"fecha_entrega_warning_revised",
"fecha_entrega_warning_revised",
"inaplazable_revised_change_user_id",
"pendiente_ferro_at",
"ferro_en_cliente_at",
"ferro_ok_at",
"interior_bn_at",
"interior_color_at",
"preparacion_interiores_at",
"cubierta_at",
"plastificado_at",
"encuadernacion_at",
"corte_at",
"embalaje_at",
"envio_at",
"entrada_manipulado_at",
"ferro_disponible",
"ferro_disponible_thread_id",
"ferro_disponible_hecho_at",
"ferro_disponible_hecho_user_id",
"ferro_disponible_ok_at",
"ferro_disponible_ok_user_id",
"ferro_entregado_user_id",
"ferro_entregado_at",
"pendiente_ferro_user_id",
"ferro_en_cliente_user_id",
"ferro_ok_user_id",
"ferro_cp",
"ferro_proveedor",
"ferro_tracking",
"interior_bn_user_id",
"interior_color_user_id",
"preparacion_interior_user_id",
"cubierda_user_id",
"plastificado_user_id",
"encuadernacion_user_id",
"corte_user_id",
"embalaje_user_id",
"envio_user_id",
"entrada_manipulado_user_id",
"pre_formato",
"pre_formato_at",
"pre_formato_user_id",
"pre_lomo",
"pre_lomo_at",
"pre_lomo_user_id",
"pre_solapa",
"pre_solapa_at",
"pre_solapa_user_id",
"pre_isbn",
"pre_isbn_user_id",
"pre_codbarras",
"pre_codbarras_at",
"pre_codbarras_user_id",
"pre_imposicion",
"pre_imposicion_at",
"pre_imposicion_user_id",
"pre_imprimir",
"pre_imprimir_user_id",
"pre_faltan_materiales",
"pre_imprimir_user_id",
"pre_faltan_materiales_note",
"progreso",
"message_production_send",
@ -149,4 +94,31 @@ class OrdenTrabajoModel extends Model
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
public function getDatatableQuery() : BaseBuilder
{
$q = $this->builder("ordenes_trabajo ot")
->select([
"pedidos.id",
"orden_trabajo_dates.fecha_encuadernado_at",
"clientes.nombre as client_name",
"presupuestos.titulo as presupuesto_title",
"tp.codigo as tipo_presupuesto_impresion",
"ubicaciones.nombre as ubicacion_name",
])
->join("orden_trabajo_dates otdates","otdates.orden_trabajo_id = ot.id","left")
->join("pedidos","pedidos.id = ot.pedido_id","left")
->join("pedidos_linea","pedidos.id = pedidos_linea.pedido_id","left")
->join("presupuestos","presupuestos.id = pedidos_linea.presupuesto_id","left")
->join("clientes","clientes.id = presupuestos.cliente_id","left")
->join("tipos_presupuestos tp","presupuestos.tipo_impresion_id = tp.id","left")
->join("ubicaciones","ubicaciones.id = pedidos_linea.ubicacion_id","left")
->groupBy("ot.id")
;
return $q;
}
}