changed logic in invoice chart
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Laravel Pint / pint (pull_request) Successful in 3m45s
Laravel Larastan / larastan (pull_request) Failing after 4m13s

This commit is contained in:
dhanabalan
2026-01-20 16:28:46 +05:30
parent ad143d723a
commit 8cb5f5c251

View File

@@ -193,10 +193,9 @@ class InvoiceChart extends ChartWidget
}
elseif ($activeFilter == 'this_month') {
$startOfMonth = now()->startOfMonth()->setTime(8, 0, 0);
$endOfMonth = now()->endOfMonth()->addDay()->setTime(8, 0, 0); // include full last day
$endOfMonth = now()->endOfMonth()->addDay()->setTime(23, 59, 59); // include full last day
$monthName = $startOfMonth->format('M');
// Prepare weekly labels like "May(1-7)", "May(8-14)", etc.
$labels = [];
$weekStart = $startOfMonth->copy();
$importedInvoicesPerWeek = [];
@@ -204,7 +203,7 @@ class InvoiceChart extends ChartWidget
$weekIndex = 0;
while ($weekStart < $endOfMonth) {
$weekEnd = $weekStart->copy()->addDays(7);
$weekEnd = $weekStart->copy()->addDays(6);
$startDay = $weekStart->format('j');
$weekEndLimit = $weekEnd->copy()->subDay();
$actualEnd = $weekEndLimit->greaterThan($endOfMonth) ? $endOfMonth : $weekEndLimit;
@@ -298,6 +297,7 @@ class InvoiceChart extends ChartWidget
{
return 'bar';
}
public static function getDefaultName(): string
{
return 'invoice-chart';