Implementacion de modulo de pedidos
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?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('productos', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('linea',5);
|
||||
$table->string('codigo',50);
|
||||
$table->string('descripcion');
|
||||
// $table->string('prefijo',30);
|
||||
$table->decimal('precio_unitario');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('productos');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
<?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('pedidos', function (Blueprint $table) {
|
||||
$table->id();
|
||||
// Datos del cliente
|
||||
$table->string('pedido',30)->nullable();
|
||||
$table->string('cuenta',20);
|
||||
$table->string('telefono',15);
|
||||
// Datos del auto
|
||||
$table->string('year',4);
|
||||
$table->string('marca',40);
|
||||
$table->string('modelo',40);
|
||||
$table->string('motor',20);
|
||||
// Datos envio del producto
|
||||
$table->string('folio_proveedor')->nullable();
|
||||
$table->string('numero_remision')->nullable();
|
||||
|
||||
$table->boolean('is_venta_cerrada')->nullable();
|
||||
$table->unsignedBigInteger('venta_cerrada_user_id')->nullable();
|
||||
$table->foreign('venta_cerrada_user_id')->references('id')->on('users');
|
||||
|
||||
$table->boolean('is_venta_entregada')->nullable();
|
||||
$table->unsignedBigInteger('venta_entregada_user_id')->nullable();
|
||||
$table->foreign('venta_entregada_user_id')->references('id')->on('users');
|
||||
|
||||
|
||||
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
|
||||
$table->timestamp('venta_cerrada_at')->nullable();
|
||||
$table->timestamp('venta_entregada_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('pedidos');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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('producto_pedidos', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->unsignedBigInteger('pedido_id');
|
||||
$table->unsignedBigInteger('producto_id');
|
||||
|
||||
$table->foreign('pedido_id')->references('id')->on('pedidos');
|
||||
$table->foreign('producto_id')->references('id')->on('productos');
|
||||
$table->decimal('unidades');
|
||||
$table->decimal('precio_unitario');
|
||||
$table->boolean('is_arrivo');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('producto_pedidos');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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('impresoras', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('estacion');
|
||||
$table->string('nombre_impresora');
|
||||
$table->boolean('is_compartida');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('impresoras');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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('users', function (Blueprint $table) {
|
||||
//
|
||||
$table->unsignedBigInteger('impresora_id')->nullable();
|
||||
$table->foreign('impresora_id')->references('id')->on('impresoras')->onDelete('set null');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropForeign(['impresora_id']);
|
||||
$table->dropColumn('impresora_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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('movimientos', function (Blueprint $table) {
|
||||
$table->float('nota_credito',30)->after('pago_transferencia')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('movimientos', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('nota_credito');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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('pedidos', function (Blueprint $table) {
|
||||
$table->string('comentarios')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('pedidos', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('comentarios');
|
||||
});
|
||||
}
|
||||
};
|
||||
29
database/migrations/2023_12_19_185943_create_rutas_table.php
Normal file
29
database/migrations/2023_12_19_185943_create_rutas_table.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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('rutas', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('ruta',50);
|
||||
$table->string('prefijo',10);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('rutas');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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('productos', function (Blueprint $table) {
|
||||
//
|
||||
$table->unsignedBigInteger('ruta_id')->after('descripcion');
|
||||
$table->foreign('ruta_id')->references('id')->on('rutas');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('productos', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user