Ruby で学ぶアメリカ税制 - 医療費控除上の被扶養者
今日は、個人所得税の項目別控除における医療費控除の対象となる、扶養者とは何なのか学びました。
医療費控除の対象になるのは、
- 申告者本人
- 配偶者
- 被扶養者
の適格医療費です。
本人も配偶者もそれほど難しいことはありません。問題は、被扶養者って誰よ、ということですね。
IRS の Pub. 502 に定義が載っています。
簡単にいうと、「適格子(Qualified Child)または適格親族(Qualified Relative)である」ということになります。しかし、残念ながら、厳密にいうとずっと複雑なんですね。では、Ruby コードを用いて表現してみましょう。
class Person attr_accessor :age attr_accessor :relation attr_accessor :full_time_student attr_accessor :permanently_and_totally_disabled attr_accessor :months_lived_together_during_the_year attr_accessor :self_support_rate attr_accessor :file_joint_return_other_than_to_claim_refund def initialize(age, relation) @age = age @relation = relation @full_time_student = false @permanently_and_totally_disabled = false end end class Child < Person def qualified?(taxpayer) test_relationship? && test_age?(taxpayer) && test_abode? && test_support? && test_joint_return? end def test_relationship? direct_relations = [:son, :daughter, :stepchild, :foster_child, :brother, :sister, :stepbrother, :stepsister] descedants = direct_relations.map do |person| ("descedant_of_" + person.to_s).to_sym end accepted_relations = direct_relations + descedants accepted_relations.include?(@relation) end def test_age?(taxpayer) return true if @age < 19 && @age < taxpayer.age return true if @age < 24 && @full_time_student && @age < taxpayer.age return true if @permanently_and_totally_disabled false end def test_abode? @months_lived_together_during_the_year > 6 end def test_support? @self_support_rate <= 0.5 end def test_joint_return? !@file_joint_return_other_than_to_claim_refund end end def main taxpayer = Person.new(48, :self) child = Child.new(23, :descedant_of_son) child.full_time_student = true #child.permanently_and_totally_disabled = true child.months_lived_together_during_the_year = 7 child.self_support_rate = 0.4 child.file_joint_return_other_than_to_claim_refund = false puts child.test_relationship? puts child.test_age?(taxpayer) puts child.test_abode? puts child.test_support? puts child.test_joint_return? puts child.qualified?(taxpayer) end main
うーん、適格子を表現するだけで、力尽きました。上のコードちゃんと動きます。Ruby の表現力は異常。すごいなー。
付記(2010年6月7日)
上の Qualified Relative において、医療費控除を考えるときには、所得テストと Joint Return テストは免除されます。(たぶん Qualified Child においても Joint Return テストは免除・・・かな?これは未確認)