-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
控除額を人物単位で計算できるようにする(配偶者控除, 勤労学生控除, 寡婦控除, ひとり親控除) #256
控除額を人物単位で計算できるようにする(配偶者控除, 勤労学生控除, 寡婦控除, ひとり親控除) #256
Conversation
✅ Deploy Preview for shien-yadokari canceled.
|
障害者控除と扶養控除については、改修が大きくなりそうなので別PRに分けようと思っています。 |
ひとり親控除額 = parameters(対象期間).所得.ひとり親控除額 | ||
ひとり親控除_所得制限額 = parameters(対象期間).所得.ひとり親控除_所得制限額 | ||
|
||
return ひとり親控除額 * 対象ひとり親 * (世帯高所得 < ひとり親控除_所得制限額) | ||
return 親である * ひとり親控除額 * 対象ひとり親 * (所得 < ひとり親控除_所得制限額) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
対象は親(一人)のみなので条件を追加しています。そのため世帯での合計額も変わりません。
控除対象者の配偶者である = (所得降順 == 1) * 対象人物.has_role(世帯.親) | ||
控除対象者の所得 = 所得一覧 * 控除対象者である | ||
# NOTE: 異なる人物に対する値であるため、人物ではなく世帯ごとに集計(でないと「控除対象者の所得」と要素がずれてしまい計算できない) | ||
控除対象者の配偶者の所得 = 対象人物.世帯.sum(所得一覧 * 控除対象者の配偶者である) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
控除額自体は 控除対象者である
が True
でないと0円になるため、世帯ごとの計算にしても金額が増えてしまうことはありません。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
逆に人物ごとの計算にすると計算が正確にできません。
例:
控除対象者の所得 = [5000000, 0]
控除対象者の配偶者の所得 = [0, 300000]
# 計算したいのは{対象者の所得 = 5000000, 控除対象者の配偶者の所得 = 300000 の場合} だが...
配偶者特別控除額表()[納税者の配偶者の所得区分, 納税者の所得区分] = [
{対象者の所得 = 5000000, 控除対象者の配偶者の所得 = 0 の場合},,
{対象者の所得 = 0, 控除対象者の配偶者の所得 = 300000 の場合},
]
@@ -134,22 +136,19 @@ class 住民税勤労学生控除(Variable): | |||
OpenFiscaではクラス名をアプリ全体で一意にする必要があるため、先頭に「住民税」を追加。 | |||
""" | |||
|
|||
def formula(対象世帯, 対象期間, parameters): | |||
# 勤労学生控除額は対象人数によらず定額そう | |||
# https://www.city.hirakata.osaka.jp/kosodate/0000000544.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
勤労学生控除の説明に
納税者自身が勤労学生であるときは、一定の金額の所得控除を受けることができます。
とあるので、人物ごとの控除に修正しました。
コメントにある児童手当のリンク先の説明ですが、
また、所得は世帯合算ではなく、受給者(申請者)の所得のみで判定します。
とあるため、児童手当の場合は手当を受ける本人の所得(世帯高所得)を参照し、その世帯員自身が勤労学生控除を受ける場合に控除額が適用されると考えるのが適切だと思いました。
(本人が対象となるか否かなので、この場合も表の通り控除額は定額になります)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
児童手当側の修正は障害者控除、扶養控除の分離が終わったタイミングで合わせて行います。
@SnoozingJellyfish |
修正ありがとうございます!確認しました。マージします。 |
Pull request前の確認
概要
動作確認
関連issue: #165