fix: 社会保険料の端数処理を四捨五入から切り捨てに変更 (健康保険・介護保険・厚生年金・雇用保険・子育て支援金)

This commit is contained in:
admin
2026-05-18 13:30:45 +09:00
parent b9f994b1e1
commit a071a11df3
2 changed files with 12 additions and 12 deletions

View File

@@ -1,7 +1,7 @@
"""
給与計算サービス (Payroll Calculation Service)
"""
from decimal import Decimal, ROUND_HALF_UP
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN
from datetime import date
from typing import Dict, Any
from ...core.database import get_connection
@@ -381,7 +381,7 @@ class PayrollCalculationService:
if health_insurance_rate:
health_insurance = (
health_standard_salary * Decimal(str(health_insurance_rate["employee_rate"]))
).quantize(Decimal("1"), rounding=ROUND_HALF_UP)
).quantize(Decimal("1"), rounding=ROUND_DOWN)
elif calc_social_insurance:
errors.append(f"健康保険料率が見つかりません(年度: {payment_date.year}")
@@ -392,7 +392,7 @@ class PayrollCalculationService:
if care_insurance_rate:
care_insurance = (
health_standard_salary * Decimal(str(care_insurance_rate["employee_rate"]))
).quantize(Decimal("1"), rounding=ROUND_HALF_UP)
).quantize(Decimal("1"), rounding=ROUND_DOWN)
print(f"[DEBUG] 介護保険計算: {health_standard_salary} × {care_insurance_rate['employee_rate']}% = {care_insurance}")
else:
errors.append(f"介護保険料率が見つかりません(年度: {payment_date.year}") if calc_social_insurance else None
@@ -403,7 +403,7 @@ class PayrollCalculationService:
if pension_insurance_rate:
pension_insurance = (
pension_standard_salary * Decimal(str(pension_insurance_rate["employee_rate"]))
).quantize(Decimal("1"), rounding=ROUND_HALF_UP)
).quantize(Decimal("1"), rounding=ROUND_DOWN)
print(f"[DEBUG] 厚生年金計算: {pension_standard_salary} × {pension_insurance_rate['employee_rate']}% = {pension_insurance}")
elif calc_social_insurance:
errors.append(f"厚生年金保険料率が見つかりません(年度: {payment_date.year}")
@@ -423,7 +423,7 @@ class PayrollCalculationService:
if child_support_rate:
child_support = (
standard_monthly_salary * Decimal(str(child_support_rate["employee_rate"]))
).quantize(Decimal("1"), rounding=ROUND_HALF_UP)
).quantize(Decimal("1"), rounding=ROUND_DOWN)
print(f"[DEBUG] 子育て支援金: 標準報酬月額={standard_monthly_salary} × 料率={child_support_rate['employee_rate']} = {child_support}")
# 雇用保険加入対象かどうか確認
@@ -432,7 +432,7 @@ class PayrollCalculationService:
if is_employment_insurance_eligible and employment_insurance_rate:
employment_insurance = (
total_payment * Decimal(str(employment_insurance_rate["employee_rate"]))
).quantize(Decimal("1"), rounding=ROUND_HALF_UP)
).quantize(Decimal("1"), rounding=ROUND_DOWN)
elif not is_employment_insurance_eligible:
print(f"[DEBUG] この従業員は雇用保険非対象です")
elif not employment_insurance_rate and calc_social_insurance: