瀏覽代碼

wip timezone handling

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

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

177
                         Cluster::make([
177
                         Cluster::make([
178
                             Select::make('fiscal_year_end_month')
178
                             Select::make('fiscal_year_end_month')
179
                                 ->softRequired()
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
                                 ->afterStateUpdated(static fn (Set $set) => $set('fiscal_year_end_day', null))
181
                                 ->afterStateUpdated(static fn (Set $set) => $set('fiscal_year_end_day', null))
182
                                 ->columnSpan(2)
182
                                 ->columnSpan(2)
183
                                 ->live(),
183
                                 ->live(),
188
                                 ->options(function (Get $get) {
188
                                 ->options(function (Get $get) {
189
                                     $month = (int) $get('fiscal_year_end_month');
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
                                     return array_combine(range(1, $daysInMonth), range(1, $daysInMonth));
193
                                     return array_combine(range(1, $daysInMonth), range(1, $daysInMonth));
194
                                 })
194
                                 })

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

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

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

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

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

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

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

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

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

88
 
88
 
89
     public function processFiscalYear($year, Set $set): void
89
     public function processFiscalYear($year, Set $set): void
90
     {
90
     {
91
-        $currentYear = now()->year;
91
+        $currentYear = company_now()->year;
92
         $diff = $currentYear - $year;
92
         $diff = $currentYear - $year;
93
         $fiscalYearStart = Carbon::parse($this->fiscalYearStartDate)->subYears($diff);
93
         $fiscalYearStart = Carbon::parse($this->fiscalYearStartDate)->subYears($diff);
94
         $fiscalYearEnd = Carbon::parse($this->fiscalYearEndDate)->subYears($diff);
94
         $fiscalYearEnd = Carbon::parse($this->fiscalYearEndDate)->subYears($diff);
97
 
97
 
98
     public function processFiscalQuarter($quarter, $year, Set $set): void
98
     public function processFiscalQuarter($quarter, $year, Set $set): void
99
     {
99
     {
100
-        $currentYear = now()->year;
100
+        $currentYear = company_now()->year;
101
         $diff = $currentYear - $year;
101
         $diff = $currentYear - $year;
102
         $fiscalYearStart = Carbon::parse($this->fiscalYearStartDate)->subYears($diff);
102
         $fiscalYearStart = Carbon::parse($this->fiscalYearStartDate)->subYears($diff);
103
         $quarterStart = $fiscalYearStart->copy()->addMonths(($quarter - 1) * 3);
103
         $quarterStart = $fiscalYearStart->copy()->addMonths(($quarter - 1) * 3);
134
         }
134
         }
135
 
135
 
136
         if ($this->endDateField) {
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…
取消
儲存