Skip to content

Instantly share code, notes, and snippets.

@betawaffle
Created July 3, 2011 14:06
Show Gist options
  • Save betawaffle/1062251 to your computer and use it in GitHub Desktop.
Save betawaffle/1062251 to your computer and use it in GitHub Desktop.
def estimated_tax
line1 = expected_agi
line2 = deductions
line3 = line1 - line2
line4 = 3700 * exemptions
line5 = line3 - line4
line6 = tax(line5)
line7 = alt_min_tax
line8 = line6 + line7
line9 = credits
line10 = max(0, line8 - line9)
line12 = other_taxes
line13a = line10 + line11 + line12
line13b = 0 # Misc credits
line13c = max(0, line13a - line13b)
line14a = line13c * (farmer || fisherman ? 2/3 : 0.9)
line14b = 0 # Required annual payment based on prior year's tax
line14c = min(line14a, line14b)
line15 = 0 # Income tax withheld and estimated to be withheld
line16a = line14c - line15
line16b = line13c - line15
line17 = line16a / 4 - overpayment
if line16a <= 0 || line16b < 1000
return 0
end
return line17
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment