Skip to content

Commit f67ff91

Browse files
committed
fix(finance): add missing migration and routes for Phase 131 Cash Flow Forecasts
The Phase 131 agent omitted the migration, routes, and ServiceProvider registration. All 9 CashFlowForecastCrudTest tests now pass. https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
1 parent dd658a5 commit f67ff91

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

erp/app/Modules/Finance/Providers/FinanceServiceProvider.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@
106106
use App\Modules\Finance\Policies\WriteOffPolicy;
107107
use App\Modules\Finance\Models\IntercompanyTransaction;
108108
use App\Modules\Finance\Policies\IntercompanyPolicy;
109+
use App\Modules\Finance\Models\CashFlowForecast;
110+
use App\Modules\Finance\Policies\CashFlowForecastPolicy;
109111
use Illuminate\Support\Facades\Gate;
110112
use Illuminate\Support\ServiceProvider;
111113

@@ -187,6 +189,7 @@ public function boot(): void
187189
Gate::policy(DebitNoteItem::class, DebitNotePolicy::class);
188190
Gate::policy(WriteOff::class, WriteOffPolicy::class);
189191
Gate::policy(IntercompanyTransaction::class, IntercompanyPolicy::class);
192+
Gate::policy(CashFlowForecast::class, CashFlowForecastPolicy::class);
190193
if ($this->app->runningInConsole()) {
191194
$this->commands([\App\Modules\Finance\Console\Commands\GenerateRecurringInvoices::class]);
192195
}

erp/app/Modules/Finance/routes/finance.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,3 +392,11 @@
392392
Route::post('intercompany/{intercompany}/reverse', [IntercompanyController::class, 'reverse'])->name('intercompany.reverse');
393393
Route::resource('intercompany', IntercompanyController::class)->only(['index', 'store', 'show', 'destroy']);
394394
});
395+
396+
// Cash Flow Forecasts
397+
use App\Modules\Finance\Http\Controllers\CashFlowForecastController;
398+
Route::middleware(['web', 'auth', 'verified'])->prefix('finance')->name('finance.')->group(function () {
399+
Route::post('cash-flow-forecasts/{cash_flow_forecast}/publish', [CashFlowForecastController::class, 'publish'])->name('cash-flow-forecasts.publish');
400+
Route::post('cash-flow-forecasts/{cash_flow_forecast}/archive', [CashFlowForecastController::class, 'archive'])->name('cash-flow-forecasts.archive');
401+
Route::resource('cash-flow-forecasts', CashFlowForecastController::class);
402+
});
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
public function up(): void
10+
{
11+
Schema::dropIfExists('cash_flow_forecasts');
12+
Schema::create('cash_flow_forecasts', function (Blueprint $table) {
13+
$table->id();
14+
$table->foreignId('tenant_id')->constrained()->cascadeOnDelete();
15+
$table->string('forecast_number')->nullable();
16+
$table->string('name');
17+
$table->string('period_type')->default('monthly');
18+
$table->date('period_start');
19+
$table->date('period_end');
20+
$table->decimal('opening_balance', 15, 2)->default(0);
21+
$table->decimal('projected_inflows', 15, 2)->default(0);
22+
$table->decimal('projected_outflows', 15, 2)->default(0);
23+
$table->decimal('actual_inflows', 15, 2)->default(0);
24+
$table->decimal('actual_outflows', 15, 2)->default(0);
25+
$table->string('status')->default('draft');
26+
$table->text('notes')->nullable();
27+
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
28+
$table->foreignId('approved_by')->nullable()->constrained('users')->nullOnDelete();
29+
$table->timestamp('approved_at')->nullable();
30+
$table->timestamps();
31+
$table->softDeletes();
32+
});
33+
}
34+
35+
public function down(): void
36+
{
37+
Schema::dropIfExists('cash_flow_forecasts');
38+
}
39+
};

0 commit comments

Comments
 (0)