Created
March 7, 2013 06:41
-
-
Save draftcode/5106000 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from __future__ import division, absolute_import, print_function, unicode_literals | |
| import csv | |
| import os | |
| def calc_b(a): | |
| if a <= 1800000: | |
| return max(a*0.4, 650000) | |
| elif a <= 3600000: | |
| return a * 0.3 + 180000 | |
| elif a <= 6600000: | |
| return a * 0.2 + 540000 | |
| elif a <= 10000000: | |
| return a * 0.1 + 1200000 | |
| elif a <= 15000000: | |
| return a * 0.05 + 1700000 | |
| else: | |
| return 2450000 | |
| def calc_f(e): | |
| if e <= 1950000: | |
| return 0.05 | |
| elif e <= 3300000: | |
| return 0.1 | |
| elif e <= 6950000: | |
| return 0.2 | |
| elif e <= 9000000: | |
| return 0.23 | |
| elif e <= 18000000: | |
| return 0.33 | |
| else: | |
| return 0.40 | |
| def calc_g(e): | |
| if e<=1950000: | |
| return 0 | |
| elif e <= 3300000: | |
| return 97500 | |
| elif e <= 6950000: | |
| return 427500 | |
| elif e <= 9000000: | |
| return 636000 | |
| elif e <= 18000000: | |
| return 1536000 | |
| else: | |
| return 2796000 | |
| def calc(a): | |
| b = calc_b(a) | |
| c = a - b | |
| d = 380000 | |
| if a < 1300000: | |
| d += 270000 | |
| e = c - d | |
| f = calc_f(e) | |
| g = calc_g(e) | |
| h = max(int((e * f - g) * 0.01) * 100, 0) | |
| i = 330000 | |
| if a < 1300000: | |
| d += 260000 | |
| j = max(c - i, 0) | |
| k = 0.1 | |
| l = max(int((j * k) * 0.01) * 100, 0) | |
| m = h + l | |
| n = a - m | |
| o = int(n / 12) | |
| p = int(n / (40 * 52)) | |
| return (a, m, n, o, p) | |
| writer = csv.writer(open(os.path.expanduser("~/tax.csv"), 'wb')) | |
| for inp in range(1, 3001): | |
| a = inp * 10000 | |
| writer.writerow(calc(a)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment