option('business_id'); $overdue = $installmentService->markOverdue($businessId ? (int) $businessId : null); $this->info("Marked {$overdue} installment(s) as overdue (penalties applied where configured)."); $query = DB::table('business'); if ($businessId) { $query->where('id', $businessId); } foreach ($query->pluck('id') as $id) { $fx = $exchangeRateService->syncForBusiness((int) $id, now()->toDateString(), true); $this->line("Business #{$id} FX sync: upserted={$fx['upserted']} api={$fx['api_fetched']}"); $health = $healthService->assess((int) $id); $this->line("Business #{$id}: score={$health['score']} status={$health['status']}"); foreach ($health['checks'] as $check) { if (! $check['ok']) { $this->warn(" - {$check['key']}: {$check['message']}"); } } if (config('accounting.rollout.location_default_mapping_sync', false)) { $mappingReport = app(\Modules\Accounting\Services\LocationDefaultMappingService::class)->assess((int) $id); $incomplete = ($mappingReport['total_locations'] ?? 0) - ($mappingReport['complete_locations'] ?? 0); if ($incomplete > 0) { $this->warn(" - location_mappings: {$incomplete} location(s) have incomplete default mappings"); } } if (config('accounting.features.consolidation', false)) { $readiness = app(\Modules\Accounting\Services\ConsolidationService::class)->readiness((int) $id); if (! $readiness['ready']) { $this->warn(' - consolidation: not ready ('.implode(', ', $readiness['issues']).')'); } } } return self::SUCCESS; } }