Files
zenithar/database/migrations/2025_01_05_052506_create_base_tables.php
2025-01-12 13:00:21 -03:00

127 lines
4.9 KiB
PHP

<?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('turnos', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->date('fecha');
$table->integer('numero_caja');
$table->integer('numero_turno');
$table->integer('fondo')->default(0);
$table->timestamps();
});
Schema::create('calculo_fondos', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->bigInteger('valor');
$table->text('descripcion')->nullable();
$table->foreignUlid('turno_id')->constrained('turnos')->cascadeOnDelete();
$table->timestamps();
});
Schema::create('documentos', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->text('descripcion')->nullable();
$table->bigInteger('valor');
$table->text('tipo_documento');
$table->foreignUlid('turno_id')->constrained('turnos')->cascadeOnDelete();
$table->timestamps();
});
Schema::create('efectivos', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->bigInteger('veinte_mil')->default(0);
$table->bigInteger('diez_mil')->default(0);
$table->bigInteger('cinco_mil')->default(0);
$table->bigInteger('dos_mil')->default(0);
$table->bigInteger('mil')->default(0);
$table->bigInteger('quinientos')->default(0);
$table->bigInteger('cien')->default(0);
$table->bigInteger('cincuenta')->default(0);
$table->bigInteger('diez')->default(0);
$table->foreignUlid('turno_id')->constrained('turnos')->cascadeOnDelete();
$table->timestamps();
});
Schema::create('egresos', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->text('numero')->nullable();
$table->text('descripcion')->nullable();
$table->bigInteger('valor');
$table->text('tipo_egreso');
$table->foreignUlid('turno_id')->constrained('turnos')->cascadeOnDelete();
$table->timestamps();
});
Schema::create('estados_resultado', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->date('mes');
$table->bigInteger('costo_venta');
$table->bigInteger('cuenta_corriente_factura');
$table->bigInteger('cuenta_corriente_boleta');
$table->bigInteger('cuenta_corriente_sin_respaldo');
$table->bigInteger('cuenta_corriente_partime');
$table->bigInteger('remuneraciones');
$table->bigInteger('finiquitos');
$table->bigInteger('aguinaldo');
$table->bigInteger('bonos_personal');
$table->bigInteger('honorarios_contador');
$table->bigInteger('arriendo');
$table->bigInteger('agua');
$table->bigInteger('luz');
$table->bigInteger('gas');
$table->bigInteger('telefono');
$table->bigInteger('otro_servicio');
$table->decimal('ppm', 15, 2);
$table->bigInteger('iva_a_favor');
$table->bigInteger('dias_habiles');
$table->bigInteger('dias_trabajados');
$table->timestamps();
});
Schema::create('gastos_cuenta_corriente', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->bigInteger('valor');
$table->text('descripcion');
$table->text('tipo_gasto');
$table->foreignUlid('estado_resultado_id')->constrained('estados_resultado')->cascadeOnDelete();
$table->timestamps();
});
Schema::create('ingresos', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->bigInteger('numero');
$table->bigInteger('numero_z');
$table->bigInteger('ingreso_inicial');
$table->bigInteger('ingreso_final');
$table->bigInteger('total');
$table->text('tipo_ingreso');
$table->foreignUlid('turno_id')->constrained('turnos')->cascadeOnDelete();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ingresos');
Schema::dropIfExists('gastos_cuenta_corriente');
Schema::dropIfExists('estados_resultado');
Schema::dropIfExists('egresos');
Schema::dropIfExists('efectivos');
Schema::dropIfExists('documentos');
Schema::dropIfExists('calculo_fondos');
Schema::dropIfExists('turnos');
}
};