2 Commits

Author SHA1 Message Date
feab063017 Merge pull request 'changed logic in invoice chart' (#207) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #207
2026-01-20 11:09:45 +00:00
dhanabalan
d9319b1ec6 changed logic in invoice chart
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 15s
Laravel Pint / pint (pull_request) Successful in 2m30s
Laravel Larastan / larastan (pull_request) Failing after 3m22s
2026-01-20 16:39:32 +05:30

View File

@@ -202,12 +202,22 @@ class InvoiceChart extends ChartWidget
$completedInvoicesPerWeek = [];
$weekIndex = 0;
while ($weekStart < $endOfMonth) {
$weekEnd = $weekStart->copy()->addDays(6);
while ($weekStart <= $endOfMonth) {
// $weekEnd = $weekStart->copy()->addDays(6);
$weekEnd = $weekStart->copy()->addDays(6)->endOfDay();
// If week end exceeds end of month, limit it
if ($weekEnd->greaterThan($endOfMonth)) {
$weekEnd = $endOfMonth->copy()->endOfDay();
}
$startDay = $weekStart->format('j');
$weekEndLimit = $weekEnd->copy()->subDay();
$actualEnd = $weekEndLimit->greaterThan($endOfMonth) ? $endOfMonth : $weekEndLimit;
$endDay = $actualEnd->format('j');
$endDay = $weekEnd->format('j');
// $startDay = $weekStart->format('j');
// $weekEndLimit = $weekEnd->copy()->subDay();
// $actualEnd = $weekEndLimit->greaterThan($endOfMonth) ? $endOfMonth : $weekEndLimit;
// $endDay = $actualEnd->format('j');
$labels[] = "{$monthName}({$startDay}-{$endDay})";
@@ -251,7 +261,8 @@ class InvoiceChart extends ChartWidget
$completedInvoicesPerWeek[$weekIndex] = $queryCompleted->count();
// Move to next week
$weekStart = $weekEnd;
// $weekStart = $weekEnd;
$weekStart = $weekEnd->copy()->addDay(1);
$weekIndex++;
}