Ver Fonte

fix: 当班收款加operator_id过滤——只统计当前操作员的现金收款

lq há 1 mês atrás
pai
commit
7ac1ad1c31
1 ficheiros alterados com 2 adições e 2 exclusões
  1. 2 2
      internal/modules/shift/service/service.go

+ 2 - 2
internal/modules/shift/service/service.go

@@ -39,8 +39,8 @@ func (s *ShiftService) End(operatorID uint, actualCash float64, remark string) (
 	}
 
 	var collected float64
-	global.GVA_DB.Raw("SELECT COALESCE(SUM(amount),0) FROM payment_record WHERE payment_method='cash' AND paid_at >= ? AND paid_at < ?",
-		active.StartTime, time.Now()).Scan(&collected)
+	global.GVA_DB.Raw("SELECT COALESCE(SUM(amount),0) FROM payment_record WHERE payment_method='cash' AND operator_id = ? AND paid_at >= ? AND paid_at < ?",
+		operatorID, active.StartTime, time.Now()).Scan(&collected)
 
 	now := time.Now()
 	expected := active.StartingCash + collected