浏览代码

Add group by company_id to InvoiceOverview and BillOverview to resolve group by SQL error

3.x
maina-m 6 个月前
父节点
当前提交
8fd4a7b0c2
没有帐户链接到提交者的电子邮件

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

@@ -32,6 +32,7 @@ class BillOverview extends EnhancedStatsOverviewWidget
32 32
             $averagePaymentTime = $this->getPageTableQuery()
33 33
                 ->whereNotNull('paid_at')
34 34
                 ->selectRaw('AVG(TIMESTAMPDIFF(DAY, date, paid_at)) as avg_days')
35
+                ->groupBy('company_id')
35 36
                 ->value('avg_days');
36 37
 
37 38
             $averagePaymentTimeFormatted = Number::format($averagePaymentTime ?? 0, maxPrecision: 1);

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

@@ -78,6 +78,7 @@ class InvoiceOverview extends EnhancedStatsOverviewWidget
78 78
             $averagePaymentTime = $this->getPageTableQuery()
79 79
                 ->whereNotNull('paid_at')
80 80
                 ->selectRaw('AVG(TIMESTAMPDIFF(DAY, approved_at, paid_at)) as avg_days')
81
+                ->groupBy('company_id')
81 82
                 ->value('avg_days');
82 83
 
83 84
             $averagePaymentTimeFormatted = Number::format($averagePaymentTime ?? 0, maxPrecision: 1);

正在加载...
取消
保存