Finalizacion de la primera version del proyecto

This commit is contained in:
Guillermo Gutierrez
2023-08-16 16:13:34 -07:00
parent 994709a3e5
commit 0946d9e951
31 changed files with 640 additions and 271 deletions

View File

@@ -11,7 +11,7 @@ return new class extends Migration
*/
public function up(): void
{
Schema::create('estado_ventas', function (Blueprint $table) {
Schema::create('estado_movimientos', function (Blueprint $table) {
$table->id();
$table->string('nombre');
$table->timestamps();
@@ -23,6 +23,6 @@ return new class extends Migration
*/
public function down(): void
{
Schema::dropIfExists('estado_ventas');
Schema::dropIfExists('estado_movimientos');
}
};

View File

@@ -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('movimientos', function (Blueprint $table) {
$table->id();
$table->string('codigo',20);
$table->float('precio_venta',30)->nullable();
$table->float('pago_efectivo',30)->nullable();
$table->float('pago_tarjeta',30)->nullable();
$table->float('pago_vales',30)->nullable();
$table->float('pago_transferencia',30)->nullable();
$table->unsignedBigInteger('estado_movimiento_id');
$table->foreign('estado_movimiento_id')->on('estado_movimientos')->references('id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('movimientos');
}
};

View File

@@ -1,38 +0,0 @@
<?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('ventas', function (Blueprint $table) {
$table->id();
$table->string('codigo',20);
$table->string('pago_efectivo',30)->nullable();
$table->string('pago_tarjeta_debito',30)->nullable();
$table->string('pago_tarjeta_credito',30)->nullable();
$table->string('pago_vales',30)->nullable();
$table->string('precio_venta')->nullable();
$table->unsignedBigInteger('estado_venta_id');
$table->foreign('estado_venta_id')->on('estado_ventas')->references('id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ventas');
}
};

View File

@@ -11,11 +11,12 @@ return new class extends Migration
*/
public function up(): void
{
Schema::table('ventas', function (Blueprint $table) {
Schema::table('movimientos', function (Blueprint $table) {
//
$table->unsignedBigInteger('user_id')->after('precio_venta');
$table->unsignedBigInteger('user_id')->after('estado_movimiento_id');
$table->foreign('user_id')->references('id')->on('users');
$table->boolean('is_liquidado')->nullable();
$table->string('motivo')->nullable();
});
}
@@ -24,7 +25,7 @@ return new class extends Migration
*/
public function down(): void
{
Schema::table('ventas', function (Blueprint $table) {
Schema::table('movimientos', function (Blueprint $table) {
//
});
}

View File

@@ -0,0 +1,28 @@
<?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('estado_caja_movimientos', function (Blueprint $table) {
$table->id();
$table->string('nombre');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('estado_caja_movimientos');
}
};

View File

@@ -0,0 +1,35 @@
<?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('caja_movimientos', function (Blueprint $table) {
$table->id();
$table->float('cantidad');
$table->unsignedBigInteger('estado_caja_movimiento_id');
$table->foreign('estado_caja_movimiento_id')->references('id')->on('estado_caja_movimientos');
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('caja_movimientos');
}
};

View File

@@ -14,7 +14,8 @@ class DatabaseSeeder extends Seeder
public function run(): void
{
$this->call([
EstadoVentaSeeder::class,
EstadoMovimientoSeeder::class,
EstadoCajaMovimientoSeeder::class,
RoleSeeder::class,
UserSeeder::class,
]);

View File

@@ -0,0 +1,30 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
class EstadoCajaMovimientoSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
DB::table('estado_caja_movimientos')->insert([
[
'nombre' => 'Caja Inicial',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now()
],
[
'nombre' => 'Retiro',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now()
],
]);
}
}

View File

@@ -7,7 +7,7 @@ use Illuminate\Database\Seeder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
class EstadoVentaSeeder extends Seeder
class EstadoMovimientoSeeder extends Seeder
{
/**
* Run the database seeds.
@@ -16,7 +16,7 @@ class EstadoVentaSeeder extends Seeder
{
//
DB::table('estado_ventas')->insert([
DB::table('estado_movimientos')->insert([
[
'nombre' => 'Venta',
'created_at' => Carbon::now(),