1
0
forked from poc/pds

changed logic in invoice chart

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