修正
This commit is contained in:
33
fix_jan2026.py
Normal file
33
fix_jan2026.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import psycopg2
|
||||
import requests
|
||||
|
||||
conn = psycopg2.connect(host='192.168.0.61', port=55432, dbname='njts_acct', user='njts_app', password='njts_app2025')
|
||||
cur = conn.cursor()
|
||||
|
||||
# 一時的に承認解除
|
||||
cur.execute("UPDATE monthly_payroll SET status='calculated' WHERE payroll_id IN (10,11)")
|
||||
conn.commit()
|
||||
conn.close()
|
||||
print("承認解除完了")
|
||||
|
||||
# 再計算
|
||||
for pid in [10, 11]:
|
||||
r = requests.post('http://192.168.0.61:18000/payroll/calculation/' + str(pid) + '/recalculate', json={})
|
||||
d = r.json()
|
||||
if 'detail' in d:
|
||||
print('id=' + str(pid) + ' ERROR: ' + str(d['detail']))
|
||||
else:
|
||||
keys = ['health_insurance', 'care_insurance', 'pension_insurance',
|
||||
'employment_insurance', 'child_support', 'income_tax', 'resident_tax', 'other_deduction']
|
||||
comp = sum(float(d.get(k) or 0) for k in keys)
|
||||
td = float(d.get('total_deduction') or 0)
|
||||
print('id=' + str(pid) +
|
||||
' health=' + str(d['health_insurance']) +
|
||||
' care=' + str(d['care_insurance']) +
|
||||
' income_tax=' + str(d['income_tax']) +
|
||||
' total_ded=' + str(td) +
|
||||
' SUM=' + str(comp) +
|
||||
' DIFF=' + str(td - comp) +
|
||||
' net=' + str(d['net_payment']))
|
||||
|
||||
print("完了")
|
||||
Reference in New Issue
Block a user