Skip to content

Commit

Permalink
Merge pull request #1 from jlyons871/test_testing
Browse files Browse the repository at this point in the history
A few additional updates from the SAS code
  • Loading branch information
Amy-Xu committed Mar 2, 2015
2 parents cd53763 + 1f78912 commit dd2d1d9
Showing 1 changed file with 42 additions and 31 deletions.
73 changes: 42 additions & 31 deletions taxcalc/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@ def EI_FICA( e00900, e02100, ssmax, e00200,
@iterate_jit(parameters=["puf", "stded", "aged", "rt1", "rt2", "rt3", "rt4",
"rt5", "rt6", "rt7", "brk1", "brk2", "brk3", "brk4", "brk5",
"brk6"], nopython=True, puf=True)
def StdDed( DSI, _earned, stded, e04470,
def StdDed( DSI, _earned, stded, e04470, e00100, e60000,
MARS, MIdR, e15360, AGEP, AGES, PBI, SBI, _exact, e04200, e02400, aged,
c04470, c00100, c21060, c21040, e37717, c04600, e04805, t04470,
f6251, _feided, c02700, FDED, rt1, rt2, rt3, rt4, rt5, rt6, rt7,
brk1, brk2, brk3, brk4, brk5, brk6, puf):
brk1, brk2, brk3, brk4, brk5, brk6, puf ):
# Standard Deduction with Aged, Sched L and Real Estate #

if DSI == 1:
Expand All @@ -236,9 +236,13 @@ def StdDed( DSI, _earned, stded, e04470,

c04100 = c04100 + e15360

_numextra = AGEP + AGES + PBI + SBI
if f6251 == 0 and e04470 == 0:
x04500 = e00100 - e60000
c04500 = c00100 - x04500
else:
x04500 = 0.

if MARS == 2 or MARS == 3:
if MARS == 2 or MARS == 3 or MARS == 6:
_txpyers = 2.
else:
_txpyers = 1.
Expand Down Expand Up @@ -283,7 +287,7 @@ def StdDed( DSI, _earned, stded, e04470,

#why is this here, c60000 is reset many times?
if _standard > 0:
c60000 = c00100
c60000 = c00100 - x04500
else:
c60000 = c04500

Expand All @@ -295,7 +299,6 @@ def StdDed( DSI, _earned, stded, e04470,

if (e04470 == 0 and (t04470 > _amtstd) and f6251 == 1 and _exact == 1):
c60000 = c00100 - t04470


if (c04800 > 0 and _feided > 0):
_taxinc = c04800 + c02700
Expand Down Expand Up @@ -916,16 +919,13 @@ def NumDep(EICYB1, EICYB2, EICYB3,
rtless, e83080, e00300, e00600, e01000, e40223,
e25360, e25430, e25470, e25400, e25500, e26210,
e26340, e27200, e26205, e26320, dylim, _cmp, SOIYR,
DOBYR, SDOBYR, _agep, _ages, c59660, puf):
DOBYR, SDOBYR, _agep, _ages, c59660, _eitc, puf):

EICYB1 = max(0.0, EICYB1)
EICYB2 = max(0.0, EICYB2)
EICYB3 = max(0.0, EICYB3)

if puf == True:
_ieic = EIC
else:
_ieic = int(EICYB1 + EICYB2 + EICYB3)
_ieic = int( max(EIC, EICYB1) + EICYB2 + EICYB3)

# Modified AGI only through 2002

Expand Down Expand Up @@ -959,8 +959,6 @@ def NumDep(EICYB1, EICYB2, EICYB3,
* (max(0.,max(_modagi,c59560)-_val_ymax)))
_preeitc = min(_preeitc,c59660)

# c59660 = max(0, c59660 - rtless[_ieic]
# * (max(_modagi, c59560) - _val_ymax))

if MARS != 3 and MARS != 6 and _modagi > 0:
_val_rtbase = rtbase[_ieic] * 100
Expand All @@ -985,6 +983,8 @@ def NumDep(EICYB1, EICYB2, EICYB3,
else:
c59660 = 0.
c59560 = 0. # updated to reflect SAS code, but has no seeming affect on accuracy

_eitc = c59660

return (_ieic, EICYB1, EICYB2, EICYB3, _modagi, c59660,
_val_ymax, _preeitc, _val_rtbase, _val_rtless, _dy)
Expand Down Expand Up @@ -1272,31 +1272,44 @@ def C1040( e07400, e07180, e07200, c07220, c07230, e07250,
e07500, e07700, e08000, e07240, e08001, e07960, e07970,
SOIYR, e07980, c05800, e08800, e09900, e09400, e09800,
e10000, e10100, e09700, e10050, e10075, e09805, e09710,
c59660, puf ):
c59660, c07180, _eitc, c59680, puf ):

# Allocate credits to tax in order on the tax form
_avail = c05800
c07180 = min(c07180,_avail)
_avail = _avail - c07180
_avail = max(0,_avail - e07200)
c07300 = min(e07300,_avail)
_avail = _avail - c07300
c07230 = min(c07230,_avail)
_avail = _avail - c07230
c07240 = min(e07240,_avail)
_avail = _avail - c07240
c07220 = min(c07220,_avail)
_avail = _avail - c07220
c07600 = min(e07600,_avail)
_avail = _avail - c07600
c07260 = min(e07260,_avail)
_avail = _avail-c07260

c59680 = min(_eitc,_avail)

# Credits 1040 line 48

x07400 = e07400
c07100 = (e07180 + e07200 + c07220 + c07230 + e07250
+ e07600 + e07260 + c07970 + e07300 + x07400
+ e07500 + e07700 + e08000)

c07100 = (e07180 + e07200 + e07600 + c07300 + x07400
+ e07980 + c07220 + e07500 + e08000)

y07100 = c07100

c07100 = c07100 + e07240
c07100 = c07100 + e08001
c07100 = c07100 + e07960 + e07970
c07100 += e07700 + c07230 + c07970 + e07240 + e07260 + e08001 + e07960

if SOIYR >= 2009:
c07100 = c07100 + e07980

x07100 = c07100
c07100 = min(c07100, c05800)

# Tax After credits 1040 line 52

_eitc = c59660

c08795 = max(0., c05800 - c07100) #SAS @1277

# c08800 = c08795
Expand All @@ -1309,12 +1322,10 @@ def C1040( e07400, e07180, e07200, c07220, c07230, e07250,

# Tax before refundable credits
_othertax = e09900 + e09400 + e09800 + e10100
c09200 = c08795 + e09900 + e09400 + e09800 + e10000 + e10100
c09200 = c09200 + e09700
c09200 = c09200 + e10050
c09200 = c09200 + e10075
c09200 = c09200 + e09805
c09200 = c09200 + e09710 + e09720
c09200 = _othertax + c08795 + e10000

#assuming year (FLPDYR) > 2009
c09200 = c09200 + e09700 + e10050 + e10075 + e09805 + e09710 + e09720

return (c07100, y07100, x07100, c08795, e08795, c09200, _eitc, _othertax)

Expand Down

0 comments on commit dd2d1d9

Please sign in to comment.