瀏覽代碼

wip timezone handling

3.x
Andrew Wallo 2 月之前
父節點
當前提交
f2fffa1344

+ 2
- 2
app/Filament/Company/Clusters/Settings/Pages/Localization.php 查看文件

@@ -177,7 +177,7 @@ class Localization extends Page
177 177
                         Cluster::make([
178 178
                             Select::make('fiscal_year_end_month')
179 179
                                 ->softRequired()
180
-                                ->options(array_combine(range(1, 12), array_map(static fn ($month) => now()->month($month)->monthName, range(1, 12))))
180
+                                ->options(array_combine(range(1, 12), array_map(static fn ($month) => company_today()->month($month)->monthName, range(1, 12))))
181 181
                                 ->afterStateUpdated(static fn (Set $set) => $set('fiscal_year_end_day', null))
182 182
                                 ->columnSpan(2)
183 183
                                 ->live(),
@@ -188,7 +188,7 @@ class Localization extends Page
188 188
                                 ->options(function (Get $get) {
189 189
                                     $month = (int) $get('fiscal_year_end_month');
190 190
 
191
-                                    $daysInMonth = now()->month($month)->daysInMonth;
191
+                                    $daysInMonth = company_today()->month($month)->daysInMonth;
192 192
 
193 193
                                     return array_combine(range(1, $daysInMonth), range(1, $daysInMonth));
194 194
                                 })

+ 3
- 3
app/Filament/Company/Resources/Purchases/BillResource/Widgets/BillOverview.php 查看文件

@@ -51,8 +51,8 @@ class BillOverview extends EnhancedStatsOverviewWidget
51 51
 
52 52
             $lastMonthPaid = $this->getPageTableQuery()
53 53
                 ->whereBetween('date', [
54
-                    today()->subMonth()->startOfMonth(),
55
-                    today()->subMonth()->endOfMonth(),
54
+                    company_today()->subMonth()->startOfMonth(),
55
+                    company_today()->subMonth()->endOfMonth(),
56 56
                 ])
57 57
                 ->get()
58 58
                 ->sumMoneyInDefaultCurrency('amount_paid');
@@ -85,7 +85,7 @@ class BillOverview extends EnhancedStatsOverviewWidget
85 85
 
86 86
         $amountDueWithin7Days = $unpaidBills
87 87
             ->clone()
88
-            ->whereBetween('due_date', [today(), today()->addWeek()])
88
+            ->whereBetween('due_date', [company_today(), company_today()->addWeek()])
89 89
             ->get()
90 90
             ->sumMoneyInDefaultCurrency('amount_due');
91 91
 

+ 3
- 3
app/Filament/Company/Resources/Purchases/VendorResource/Widgets/BillOverview.php 查看文件

@@ -29,7 +29,7 @@ class BillOverview extends EnhancedStatsOverviewWidget
29 29
 
30 30
         $amountDueWithin7Days = $unpaidBills
31 31
             ->clone()
32
-            ->whereBetween('due_date', [today(), today()->addWeek()])
32
+            ->whereBetween('due_date', [company_today(), company_today()->addWeek()])
33 33
             ->get()
34 34
             ->sumMoneyInDefaultCurrency('amount_due');
35 35
 
@@ -54,8 +54,8 @@ class BillOverview extends EnhancedStatsOverviewWidget
54 54
         $lastMonthTotal = $this->record->bills()
55 55
             ->where('status', BillStatus::Paid)
56 56
             ->whereBetween('date', [
57
-                today()->subMonth()->startOfMonth(),
58
-                today()->subMonth()->endOfMonth(),
57
+                company_today()->subMonth()->startOfMonth(),
58
+                company_today()->subMonth()->endOfMonth(),
59 59
             ])
60 60
             ->get()
61 61
             ->sumMoneyInDefaultCurrency('amount_paid');

+ 1
- 1
app/Filament/Company/Resources/Sales/ClientResource/Widgets/InvoiceOverview.php 查看文件

@@ -26,7 +26,7 @@ class InvoiceOverview extends EnhancedStatsOverviewWidget
26 26
             ->sumMoneyInDefaultCurrency('amount_due');
27 27
 
28 28
         $amountDueWithin30Days = $unpaidInvoices->clone()
29
-            ->whereBetween('due_date', [today(), today()->addMonth()])
29
+            ->whereBetween('due_date', [company_today(), company_today()->addMonth()])
30 30
             ->get()
31 31
             ->sumMoneyInDefaultCurrency('amount_due');
32 32
 

+ 1
- 1
app/Filament/Company/Resources/Sales/InvoiceResource/Widgets/InvoiceOverview.php 查看文件

@@ -54,7 +54,7 @@ class InvoiceOverview extends EnhancedStatsOverviewWidget
54 54
 
55 55
         $amountDueWithin30Days = $unpaidInvoices
56 56
             ->clone()
57
-            ->whereBetween('due_date', [today(), today()->addMonth()])
57
+            ->whereBetween('due_date', [company_today(), company_today()->addMonth()])
58 58
             ->get()
59 59
             ->sumMoneyInDefaultCurrency('amount_due');
60 60
 

+ 3
- 3
app/Filament/Forms/Components/DateRangeSelect.php 查看文件

@@ -88,7 +88,7 @@ class DateRangeSelect extends Select
88 88
 
89 89
     public function processFiscalYear($year, Set $set): void
90 90
     {
91
-        $currentYear = now()->year;
91
+        $currentYear = company_now()->year;
92 92
         $diff = $currentYear - $year;
93 93
         $fiscalYearStart = Carbon::parse($this->fiscalYearStartDate)->subYears($diff);
94 94
         $fiscalYearEnd = Carbon::parse($this->fiscalYearEndDate)->subYears($diff);
@@ -97,7 +97,7 @@ class DateRangeSelect extends Select
97 97
 
98 98
     public function processFiscalQuarter($quarter, $year, Set $set): void
99 99
     {
100
-        $currentYear = now()->year;
100
+        $currentYear = company_now()->year;
101 101
         $diff = $currentYear - $year;
102 102
         $fiscalYearStart = Carbon::parse($this->fiscalYearStartDate)->subYears($diff);
103 103
         $quarterStart = $fiscalYearStart->copy()->addMonths(($quarter - 1) * 3);
@@ -134,7 +134,7 @@ class DateRangeSelect extends Select
134 134
         }
135 135
 
136 136
         if ($this->endDateField) {
137
-            $set($this->endDateField, $end->isFuture() ? now()->endOfDay()->toDateTimeString() : $end->endOfDay()->toDateTimeString());
137
+            $set($this->endDateField, $end->isFuture() ? company_now()->endOfDay()->toDateTimeString() : $end->endOfDay()->toDateTimeString());
138 138
         }
139 139
     }
140 140
 }

Loading…
取消
儲存