This commit is contained in:
admin
2026-03-04 23:20:42 +09:00
parent 99d16d8219
commit 31a64d5b59
11 changed files with 674 additions and 201 deletions

View File

@@ -51,7 +51,9 @@ def calculate_payroll(request: schemas.PayrollCalculationRequest):
payment_date=request.payment_date,
other_allowance=request.other_allowance,
resident_tax=request.resident_tax,
other_deduction=request.other_deduction
other_deduction=request.other_deduction,
calc_income_tax=request.calc_income_tax,
calc_social_insurance=request.calc_social_insurance
)
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))
@@ -174,8 +176,10 @@ def update_payroll(payroll_id: int, request: schemas.MonthlyPayrollUpdate):
@router.post("/{payroll_id}/recalculate", response_model=schemas.MonthlyPayroll)
def recalculate_payroll(payroll_id: int):
def recalculate_payroll(payroll_id: int, request: schemas.RecalculateRequest = None):
"""給与を再計算"""
if request is None:
request = schemas.RecalculateRequest()
with get_connection() as conn:
with conn.cursor() as cur:
# 既存データを取得
@@ -204,7 +208,9 @@ def recalculate_payroll(payroll_id: int):
other_allowance=existing["other_allowance"],
resident_tax=existing["resident_tax"],
other_deduction=existing["other_deduction"],
calculated_by="recalculated"
calculated_by="recalculated",
calc_income_tax=request.calc_income_tax,
calc_social_insurance=request.calc_social_insurance
)
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))