changed logic in invoice chart #206

Merged
jothi merged 1 commits from ranjith-dev into master 2026-01-20 10:59:15 +00:00

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';