First Commit

This commit is contained in:
marco
2026-09-01 10:46:29 -03:00
commit bf96b77e9c
10000 changed files with 3508600 additions and 0 deletions
@@ -0,0 +1,83 @@
<?php
/**
* SysCMS - Content Management System
*
* Copyright (c) 2026 SysCMS Team
* All rights reserved.
*/
use Illuminate\Database\Capsule\Manager as Capsule;
class InsertFluxoCaixaProModule
{
public function up()
{
$moduleName = 'fluxocaixapro';
$moduleData = [
'modules_name' => $moduleName,
'modules_display_name' => 'Fluxo de Caixa Pró',
'modules_description' => 'Módulo avançado de gestão de fluxo de caixa com previsões inteligentes.',
'modules_version' => '1.0.0',
'modules_author' => 'SysCMS Team',
'modules_ative' => 1,
'modules_public' => 1,
'modules_blocked' => 0,
'modules_dependencies' => json_encode(['auth']),
'modules_permissions' => json_encode([
"fluxocaixapro.view",
"fluxocaixapro.manage"
]),
'modules_settings' => json_encode([
"menu" => [
"dashboard" => [
"icon" => "bi bi-cash-stack",
"label" => "Fluxo de Caixa Pró",
"route" => "admin/fluxo-caixa",
"order" => 70,
"permission" => "fluxocaixapro.view"
]
]
]),
'modules_path' => 'modules/fluxocaixapro',
'modules_namespace' => 'Modules\\FluxoCaixaPro',
'modules_icon' => 'bi bi-cash-stack',
'menu_side_bar' => 1,
'menu_nav_bar' => 0,
'modules_order' => 70,
'modules_install_date' => date('Y-m-d H:i:s'),
'modules_update_date' => date('Y-m-d H:i:s')
];
$existingModule = Capsule::table('modules')->where('modules_name', $moduleName)->first();
if (!$existingModule) {
$moduleId = Capsule::table('modules')->insertGetId($moduleData);
// Associar a todas as empresas existentes
if (Capsule::schema()->hasTable('bus')) {
$companies = Capsule::table('bus')->get();
foreach ($companies as $company) {
Capsule::table('bus_modules')->insert([
'bus_modules_bus_id' => $company->bus_id,
'bus_modules_module_id' => $moduleId,
'bus_modules_is_enabled' => 1,
'bus_modules_show_public_nav' => 0,
'bus_modules_show_dashboard_nav' => 1,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s')
]);
}
}
}
}
public function down()
{
$module = Capsule::table('modules')->where('modules_name', 'fluxocaixapro')->first();
if ($module) {
Capsule::table('bus_modules')->where('bus_modules_module_id', $module->modules_id)->delete();
Capsule::table('modules')->where('modules_id', $module->modules_id)->delete();
}
}
}
@@ -0,0 +1,113 @@
<?php
/**
* SysCMS - Content Management System
*
* Copyright (c) 2025 Marco Costa
* All rights reserved.
*
* Author: Marco Costa
* Email: contato@syspanel.com.br
* Project: SysCMS
*
* This software is licensed, not sold.
* Permission is granted to use this software
* subject to the terms of the SysCMS Commercial License.
*
* Redistribution, sublicensing, resale, or
* disclosure of this software, in whole or in part,
* is strictly prohibited without prior written permission.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
*/
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Database\Schema\Blueprint;
/**
* Migration: Create Cash Flow Tables
*/
class CreateCashFlowTables
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
// Categorias de Fluxo de Caixa
if (!Capsule::schema()->hasTable('cash_flow_categories')) {
Capsule::schema()->create('cash_flow_categories', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('idbus')->nullable();
$table->unsignedBigInteger('iduser')->nullable();
$table->string('name');
$table->enum('type', ['income', 'expense']);
$table->string('color')->default('#6c757d');
$table->string('icon')->default('bi bi-tag');
$table->boolean('is_active')->default(true);
$table->timestamps();
$table->index('idbus');
$table->index('iduser');
});
}
// Transações de Fluxo de Caixa
if (!Capsule::schema()->hasTable('cash_flow_transactions')) {
Capsule::schema()->create('cash_flow_transactions', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('idbus')->nullable();
$table->unsignedBigInteger('iduser')->nullable();
$table->unsignedBigInteger('category_id');
$table->string('description');
$table->decimal('amount', 15, 2);
$table->enum('type', ['income', 'expense']);
$table->enum('status', ['pending', 'paid', 'cancelled'])->default('pending');
$table->date('transaction_date');
$table->date('due_date')->nullable();
$table->date('payment_date')->nullable();
$table->boolean('is_personal')->default(false);
$table->text('notes')->nullable();
$table->json('metadata')->nullable();
$table->timestamps();
$table->index('idbus');
$table->index('iduser');
$table->index('category_id');
$table->index('transaction_date');
});
}
// Análises e Previsões (IA)
if (!Capsule::schema()->hasTable('cash_flow_analysis')) {
Capsule::schema()->create('cash_flow_analysis', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('idbus')->nullable();
$table->unsignedBigInteger('iduser')->nullable();
$table->date('analysis_date');
$table->json('summary_data');
$table->text('recommendations')->nullable();
$table->json('projections')->nullable();
$table->timestamps();
$table->index('idbus');
$table->index('iduser');
$table->index('analysis_date');
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Capsule::schema()->dropIfExists('cash_flow_analysis');
Capsule::schema()->dropIfExists('cash_flow_transactions');
Capsule::schema()->dropIfExists('cash_flow_categories');
}
}
@@ -0,0 +1,49 @@
<?php
/**
* Migration: Seed Default Categories for Cash Flow
*/
use Illuminate\Database\Capsule\Manager as Capsule;
class SeedDefaultCategories
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
$categories = [
['name' => 'Vendas', 'type' => 'income', 'color' => '#198754', 'icon' => 'bi bi-cart-check'],
['name' => 'Serviços', 'type' => 'income', 'color' => '#0dcaf0', 'icon' => 'bi bi-tools'],
['name' => 'Aluguel', 'type' => 'expense', 'color' => '#dc3545', 'icon' => 'bi bi-house'],
['name' => 'Salários', 'type' => 'expense', 'color' => '#fd7e14', 'icon' => 'bi bi-people'],
['name' => 'Marketing', 'type' => 'expense', 'color' => '#6f42c1', 'icon' => 'bi bi-megaphone'],
['name' => 'Impostos', 'type' => 'expense', 'color' => '#6c757d', 'icon' => 'bi bi-bank'],
['name' => 'Outros', 'type' => 'expense', 'color' => '#adb5bd', 'icon' => 'bi bi-three-dots'],
];
foreach ($categories as $cat) {
if (Capsule::table('cash_flow_categories')->where('name', $cat['name'])->count() === 0) {
Capsule::table('cash_flow_categories')->insert(array_merge($cat, [
'is_active' => true,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s')
]));
}
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
// No need to delete seeds on rollback usually, but if needed:
// Capsule::table('cash_flow_categories')->truncate();
}
}