- Laravel 11 backend with API REST - React 18 + TypeScript + Vite frontend - Multi-parser architecture for accounting systems (CONTPAQi, Aspel, SAP) - 27+ financial metrics calculation - PDF report generation with Browsershot - Complete documentation (10 documents) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
143 lines
6.2 KiB
PHP
143 lines
6.2 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\ReglaMapeo;
|
|
use App\Models\ReporteContable;
|
|
use App\Models\CategoriaContable;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class ReglasMapeeoContpaqiSeeder extends Seeder
|
|
{
|
|
public function run(): void
|
|
{
|
|
$balanceGeneral = ReporteContable::where('nombre', 'Balance General')->first();
|
|
$estadoResultados = ReporteContable::where('nombre', 'Estado de Resultados')->first();
|
|
|
|
// Obtener categorías
|
|
$activosCirculantes = CategoriaContable::where('nombre', 'Activos Circulantes')->first();
|
|
$activosNoCirculantes = CategoriaContable::where('nombre', 'Activos No Circulantes')->first();
|
|
$pasivoCirculante = CategoriaContable::where('nombre', 'Pasivo Circulante')->first();
|
|
$pasivoNoCirculante = CategoriaContable::where('nombre', 'Pasivo No Circulante')->first();
|
|
$capitalSocial = CategoriaContable::where('nombre', 'Capital Social')->first();
|
|
$perdidasAnteriores = CategoriaContable::where('nombre', 'Pérdidas Ejercicios Anteriores')->first();
|
|
$utilidadesAnteriores = CategoriaContable::where('nombre', 'Utilidades Ejercicios Anteriores')->first();
|
|
$ingresos = CategoriaContable::where('nombre', 'Ingresos')->first();
|
|
$costoVenta = CategoriaContable::where('nombre', 'Costo de Venta')->first();
|
|
$gastosOperativos = CategoriaContable::where('nombre', 'Gastos Operativos')->first();
|
|
$otrosGastos = CategoriaContable::where('nombre', 'Otros Gastos')->first();
|
|
$gastosFinancieros = CategoriaContable::where('nombre', 'Gastos Financieros')->first();
|
|
|
|
$reglas = [
|
|
// Activos Circulantes: 001-100-000, hijos 101-000-000 a 154-999-999
|
|
[
|
|
'sistema_origen' => 'contpaqi',
|
|
'cuenta_padre_codigo' => '001-100-000',
|
|
'rango_inicio' => '101-000-000',
|
|
'rango_fin' => '154-999-999',
|
|
'reporte_contable_id' => $balanceGeneral->id,
|
|
'categoria_contable_id' => $activosCirculantes->id,
|
|
'prioridad' => 10,
|
|
],
|
|
// Activos No Circulantes: 001-200-000, hijos 155-000-000 a 199-999-999
|
|
[
|
|
'sistema_origen' => 'contpaqi',
|
|
'cuenta_padre_codigo' => '001-200-000',
|
|
'rango_inicio' => '155-000-000',
|
|
'rango_fin' => '199-999-999',
|
|
'reporte_contable_id' => $balanceGeneral->id,
|
|
'categoria_contable_id' => $activosNoCirculantes->id,
|
|
'prioridad' => 10,
|
|
],
|
|
// Pasivo Circulante: 002-100-000, hijos 200-000-000 a 209-999-999
|
|
[
|
|
'sistema_origen' => 'contpaqi',
|
|
'cuenta_padre_codigo' => '002-100-000',
|
|
'rango_inicio' => '200-000-000',
|
|
'rango_fin' => '209-999-999',
|
|
'reporte_contable_id' => $balanceGeneral->id,
|
|
'categoria_contable_id' => $pasivoCirculante->id,
|
|
'prioridad' => 10,
|
|
],
|
|
// Pasivo No Circulante: 002-200-000, hijos 210-000-000 a 220-999-999
|
|
[
|
|
'sistema_origen' => 'contpaqi',
|
|
'cuenta_padre_codigo' => '002-200-000',
|
|
'rango_inicio' => '210-000-000',
|
|
'rango_fin' => '220-999-999',
|
|
'reporte_contable_id' => $balanceGeneral->id,
|
|
'categoria_contable_id' => $pasivoNoCirculante->id,
|
|
'prioridad' => 10,
|
|
],
|
|
// Capital Social: 300-XXX-XXX
|
|
[
|
|
'sistema_origen' => 'contpaqi',
|
|
'patron_regex' => '/^30[0-9]-/',
|
|
'reporte_contable_id' => $balanceGeneral->id,
|
|
'categoria_contable_id' => $capitalSocial->id,
|
|
'prioridad' => 10,
|
|
],
|
|
// Pérdidas Ejercicios Anteriores: 310-XXX-XXX
|
|
[
|
|
'sistema_origen' => 'contpaqi',
|
|
'patron_regex' => '/^310-/',
|
|
'reporte_contable_id' => $balanceGeneral->id,
|
|
'categoria_contable_id' => $perdidasAnteriores->id,
|
|
'prioridad' => 15,
|
|
],
|
|
// Utilidades Ejercicios Anteriores: 311-XXX-XXX
|
|
[
|
|
'sistema_origen' => 'contpaqi',
|
|
'patron_regex' => '/^311-/',
|
|
'reporte_contable_id' => $balanceGeneral->id,
|
|
'categoria_contable_id' => $utilidadesAnteriores->id,
|
|
'prioridad' => 15,
|
|
],
|
|
// Ingresos: 40X-XXX-XXX
|
|
[
|
|
'sistema_origen' => 'contpaqi',
|
|
'patron_regex' => '/^40[0-9]-/',
|
|
'reporte_contable_id' => $estadoResultados->id,
|
|
'categoria_contable_id' => $ingresos->id,
|
|
'prioridad' => 10,
|
|
],
|
|
// Costo de Venta: podría ser 410-XXX o 50X en algunos casos
|
|
[
|
|
'sistema_origen' => 'contpaqi',
|
|
'patron_regex' => '/^41[0-9]-/',
|
|
'reporte_contable_id' => $estadoResultados->id,
|
|
'categoria_contable_id' => $costoVenta->id,
|
|
'prioridad' => 10,
|
|
],
|
|
// Gastos Operativos: 5XX-XXX-XXX
|
|
[
|
|
'sistema_origen' => 'contpaqi',
|
|
'patron_regex' => '/^5[0-9]{2}-/',
|
|
'reporte_contable_id' => $estadoResultados->id,
|
|
'categoria_contable_id' => $gastosOperativos->id,
|
|
'prioridad' => 10,
|
|
],
|
|
// Otros Gastos: 6XX-XXX-XXX
|
|
[
|
|
'sistema_origen' => 'contpaqi',
|
|
'patron_regex' => '/^6[0-9]{2}-/',
|
|
'reporte_contable_id' => $estadoResultados->id,
|
|
'categoria_contable_id' => $otrosGastos->id,
|
|
'prioridad' => 10,
|
|
],
|
|
// Gastos Financieros: 7XX-XXX-XXX
|
|
[
|
|
'sistema_origen' => 'contpaqi',
|
|
'patron_regex' => '/^7[0-9]{2}-/',
|
|
'reporte_contable_id' => $estadoResultados->id,
|
|
'categoria_contable_id' => $gastosFinancieros->id,
|
|
'prioridad' => 10,
|
|
],
|
|
];
|
|
|
|
foreach ($reglas as $regla) {
|
|
ReglaMapeo::create(array_merge($regla, ['activo' => true]));
|
|
}
|
|
}
|
|
}
|