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
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #207
This commit was merged in pull request #207.
This commit is contained in:
@@ -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++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user