diff --git a/app/Business/InvoiceQuotaPageData.php b/app/Business/InvoiceQuotaPageData.php index 371d7b7e..b4d1f7f9 100644 --- a/app/Business/InvoiceQuotaPageData.php +++ b/app/Business/InvoiceQuotaPageData.php @@ -172,21 +172,23 @@ class InvoiceQuotaPageData $authStatus = strtoupper(trim((string) ($snapshot->auth_status ?? ''))); $elapsedDays = (int) ($forecastContext['elapsed_days'] ?? 0); $daysInMonth = (int) ($forecastContext['days_in_month'] ?? 0); - $dailyAverage = $elapsedDays > 0 - ? round($outputAmount / $elapsedDays, 2) + $dailyAverageRaw = $elapsedDays > 0 + ? $outputAmount / $elapsedDays : null; - $forecastMonthly = $dailyAverage !== null && $daysInMonth > 0 - ? round($dailyAverage * $daysInMonth, 2) + $dailyAverage = $dailyAverageRaw !== null ? round($dailyAverageRaw, 2) : null; + $forecastMonthly = $dailyAverageRaw !== null && $daysInMonth > 0 + ? round($outputAmount * $daysInMonth / $elapsedDays, 2) : null; - $coverageDays = $dailyAverage !== null && $dailyAverage > 0 && $availableAmount !== null - ? round(max($availableAmount, 0) / $dailyAverage, 1) + $coverageDaysRaw = $dailyAverageRaw !== null && $dailyAverageRaw > 0 && $availableAmount !== null + ? max($availableAmount, 0) / $dailyAverageRaw : null; + $coverageDays = $coverageDaysRaw !== null ? round($coverageDaysRaw, 2) : null; $quotaWarning = (bool) ($forecastContext['is_current'] ?? false) && $authStatus === 'AUTHENTICATED' && $availableAmount !== null && $availableAmount > 0 - && $coverageDays !== null - && $coverageDays < self::QUOTA_WARNING_DAYS; + && $coverageDaysRaw !== null + && $coverageDaysRaw < self::QUOTA_WARNING_DAYS; if ($snapshot === null) { $status = '未匹配'; diff --git a/resources/views/business/pages/invoice_quota.blade.php b/resources/views/business/pages/invoice_quota.blade.php index f81746af..9d75d3a3 100644 --- a/resources/views/business/pages/invoice_quota.blade.php +++ b/resources/views/business/pages/invoice_quota.blade.php @@ -252,7 +252,7 @@ @endif