修改
This commit is contained in:
@@ -58,12 +58,15 @@ class BonusCalculationService:
|
||||
cur.execute(
|
||||
"""
|
||||
SELECT AVG(total_payment - commute_allowance) as avg_salary
|
||||
FROM monthly_payroll
|
||||
WHERE employee_id = %s
|
||||
AND payment_date < %s
|
||||
AND status IN ('approved', 'paid')
|
||||
ORDER BY payment_date DESC
|
||||
LIMIT 3
|
||||
FROM (
|
||||
SELECT total_payment, commute_allowance
|
||||
FROM monthly_payroll
|
||||
WHERE employee_id = %s
|
||||
AND payment_date < %s
|
||||
AND status IN ('approved', 'paid')
|
||||
ORDER BY payment_date DESC
|
||||
LIMIT 3
|
||||
) as recent_payroll
|
||||
""",
|
||||
(employee_id, payment_date)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user