update total sales in dashboard
This commit is contained in:
parent
3e0d75a4d0
commit
cd784624c9
@ -207,7 +207,7 @@ func (r *AnalyticsRepositoryImpl) GetDashboardOverview(ctx context.Context, orga
|
||||
query := r.db.WithContext(ctx).
|
||||
Table("orders o").
|
||||
Select(`
|
||||
COALESCE(SUM(CASE WHEN o.is_void = false THEN o.total_amount ELSE 0 END), 0) as total_sales,
|
||||
COALESCE(SUM(CASE WHEN o.is_void = false AND o.is_refund = false AND o.payment_status = 'completed' THEN o.total_amount ELSE 0 END), 0) as total_sales,
|
||||
COUNT(CASE WHEN o.is_void = false THEN o.id END) as total_orders,
|
||||
CASE
|
||||
WHEN COUNT(CASE WHEN o.is_void = false THEN o.id END) > 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user