This commit is contained in:
Juan Felipe Duarte
2026-01-15 01:36:26 -05:00
parent a768146f65
commit 7257a2d795
39 changed files with 1769 additions and 34 deletions
@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('proveedors', function (Blueprint $table) {
// Agregar nuevos campos
$table->string('nit')->nullable()->after('nombre');
$table->string('categoria')->after('nit');
// Eliminar campos que no se usarán
$table->dropColumn(['contacto', 'correo']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('proveedors', function (Blueprint $table) {
// Restaurar columnas eliminadas
$table->string('contacto')->nullable();
$table->string('correo')->unique()->nullable();
// Eliminar columnas nuevas
$table->dropColumn(['nit', 'categoria']);
});
}
};
@@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('telas', function (Blueprint $table) {
$table->id();
$table->string('codigo');
$table->string('tipo');
$table->string('foto')->nullable();
$table->string('color')->nullable();
$table->foreignId('proveedor_id')->constrained('proveedors')->cascadeOnDelete();
$table->string('metros_comprados');
$table->string('metros_disponibles');
$table->date('fecha_compra');
$table->string('valor_total');
$table->string('costo_por_metro');
$table->text('observaciones')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('telas');
}
};
@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('orden_produccions', function (Blueprint $table) {
$table->id();
$table->string('numero_orden')->unique();
$table->string('prenda_modelo');
$table->string('referencia');
$table->integer('cantidad_total');
$table->foreignId('tela_id')
->nullable()
->constrained('telas')
->nullOnDelete();
$table->date('fecha_inicio');
$table->date('fecha_entrega_estimada');
$table->enum('estado', [
'en_corte',
'en_confeccion',
'en_tintoreria',
'en_acabados',
'finalizada'
])->default('en_corte');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('orden_produccions');
}
};
@@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('confeccions', function (Blueprint $table) {
$table->id();
// Relaciones
$table->foreignId('proveedor_id')
->constrained('proveedors')
->cascadeOnDelete();
$table->foreignId('orden_produccion_id')
->constrained('orden_produccions')
->cascadeOnDelete();
// Envío
$table->date('fecha_envio');
$table->integer('cantidad_enviada');
// Recepción
$table->date('fecha_recepcion')->nullable();
$table->integer('cantidad_recibida')->nullable();
$table->integer('prendas_defectuosas')->default(0);
// Costos
$table->decimal('valor_por_prenda', 12, 2);
$table->decimal('total_pagar', 14, 2)->default(0);
// Estado
$table->enum('estado', ['pendiente', 'parcial', 'completo'])
->default('pendiente');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('confeccions');
}
};
@@ -0,0 +1,53 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tintoreria_procesos', function (Blueprint $table) {
$table->id();
// Relaciones
$table->foreignId('proveedor_id')
->constrained('proveedors')
->cascadeOnDelete();
$table->foreignId('orden_produccion_id')
->constrained('orden_produccions')
->cascadeOnDelete();
// Proceso
$table->string('tipo_proceso');
// Envío
$table->date('fecha_envio');
$table->integer('cantidad_enviada');
// Recepción
$table->date('fecha_recepcion')->nullable();
$table->integer('cantidad_recibida')->nullable();
// Control
$table->integer('perdidas')->default(0);
$table->text('observaciones')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tintoreria_procesos');
}
};
@@ -0,0 +1,47 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('proceso_acabados', function (Blueprint $table) {
$table->id();
$table->foreignId('orden_produccion_id')
->constrained('orden_produccions')
->cascadeOnDelete();
// Proceso
$table->string('tipo_proceso');
// Responsable (opcional proveedor)
$table->foreignId('proveedor_id')
->nullable()
->constrained('proveedors')
->nullOnDelete();
$table->string('responsable_interno')->nullable();
// Cantidades
$table->integer('cantidad_enviada');
$table->integer('cantidad_recibida')->nullable();
// Fechas
$table->date('fecha_envio');
$table->date('fecha_recepcion')->nullable();
$table->text('observaciones')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('proceso_acabados');
}
};
@@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('inventario_prendas', function (Blueprint $table) {
$table->id();
$table->foreignId('orden_produccion_id')
->constrained('orden_produccions')
->cascadeOnDelete();
// Cantidades
$table->integer('cantidad_terminada');
$table->integer('cantidad_disponible');
// Control
$table->date('fecha_ingreso');
$table->enum('estado', [
'lista_despacho',
'en_bodega'
])->default('en_bodega');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('inventario_prendas');
}
};