예제 #1
0
파일: f600s.py 프로젝트: zrisher/luca
def fill_out(form, pdf):
    f = form
    pdf.load('us_ga.f600s--{}.pdf'.format(f.form_version))
    if f.form_version == u'2012':
        return fill_out_2012(form, pdf)

    pdf['FEIN'] = f.ein
    pdf['Title'] = pdf['Title2'] = f.name

    pdf['begin01'] = f.income_beginning
    pdf['end01'] = f.income_ending
    pdf['begin02'] = f.net_worth_beginning
    pdf['end02'] = f.net_worth_ending

    # TODO: more Boolean type-of-return fields
    pdf['Final'] = 'Yes' if f.type == 'final' else 'Off'

    pdf['Date1'] = f.incorporation_date
    pdf['WHLD.0'] = f.withholding_number
    pdf['WHLD.1'] = f.nonresident_withholding_number
    pdf['Address1'] = f.address.upper()
    pdf['State'] = f.incorporation_state
    pdf['Sales'] = f.sales_tax_number
    pdf['City'] = f.city.upper()
    pdf['State2'] = f.state
    pdf['Zip'] = f.zip
    pdf['Date2'] = f.date_admitted
    pdf['NAICS'] = f.naics_code
    pdf['Location.0'] = f.books_city.upper()
    pdf['Location.1'] = f.books_state
    pdf['Telephone'] = f.books_phone
    pdf['Business'] = f.kind_of_business.upper()
    pdf['#Non'] = f.total_shareholders  # yes, they got these two backwards
    pdf['#Share'] = f.nonresident_shareholders
    pdf['Federal Ordinary Income'] = str(dollars(f.federal_ordinary_income))
    pdf['email'] = f.email
    pdf['Email Authorization'] = 'Yes' if f.email_authorization else 'Off'
    pdf['Title5'] = f.title

    replacements = {'Sch4-1b': 'SCh4-1b', 'Sch4-9b': 'Sch-4-9b'}

    for sname in 's1 s3 s4 s7 s8 s9'.split():
        s = getattr(form, sname)
        schno = sname[1:]
        for attr, value in s.__dict__.items():
            if not attr.startswith('line'):
                continue
            lineno = attr[4:]
            fieldname = 'Sch{}-{}'.format(schno, lineno)
            fieldname = replacements.get(fieldname, fieldname)
            if fieldname == 'Sch7-2c':
                value = str(value)
            elif isinstance(value, Decimal):
                value = dstr(dollars(value))
                #value = str(dollars(value))
            pdf[fieldname] = value
예제 #2
0
파일: f600s.py 프로젝트: B-Rich/luca
def fill_out_2012(form, pdf):
    f = form
    pdf.load('us_ga.f600s--{}.pdf'.format(f.form_version))
    pdf.pattern = None

    pdf['FEIN'] = f.ein
    pdf['FEIN_COPY'] = f.ein

    pdf['CORP_NAME'] = f.name.upper()
    pdf['CORP_NAME_COPY'] = f.name.upper()

    pdf['2011_DATE_BEG'] = f.income_beginning
    pdf['2011_DATE_END'] = f.income_ending
    pdf['2012_DATE_BEG'] = f.net_worth_beginning
    pdf['2012_DATE_END'] = f.net_worth_ending
    pdf['CB_TYPEOFRETURN'] = f.type
    # TODO: Boolean "change" fields
    pdf['DATE_OF_INCORPORATION'] = f.incorporation_date
    pdf['PAYROLL_WTH_NUM'] = f.withholding_number
    pdf['NONRES_WTH_NUM'] = f.nonresident_withholding_number
    pdf['CORP_ADDRESS'] = f.address.upper()
    pdf['STATE_INCORPORATED'] = f.incorporation_state
    pdf['SALES_TAX_REG_NUM'] = f.sales_tax_number
    pdf['CITY'] = f.city.upper()
    pdf['STATE'] = f.state
    pdf['ZIP5'] = f.zip
    pdf['DATE_ADMITTED_IN_GA'] = f.date_admitted
    pdf['NAICS'] = f.naics_code
    pdf['BOOKS_CITY_LOC'] = f.books_city.upper()
    pdf['BOOKS_STATE_LOC'] = f.books_state
    pdf['PHONE'] = f.books_phone
    pdf['KIND_OF_BUSINESS'] = f.kind_of_business.upper()
    pdf['TTL_SH'] = f.total_shareholders
    pdf['TTL_NONRES_SH'] = f.nonresident_shareholders
    pdf['FED_ORD_INCOME'] = str(dollars(f.federal_ordinary_income))

    for sname in 's1 s3 s4 s8 s9'.split():
        s = getattr(form, sname)
        for attr, value in s.__dict__.items():
            if not attr.startswith('line'):
                continue
            n = attr.replace('line', '')
            if sname == 's4':
                letter = n[-1]
                n = n[:-1]
                fieldname = '{}{}.{}'.format(sname, letter, n).upper()
            else:
                fieldname = '{}.{}'.format(sname, n).upper()
            if isinstance(value, Decimal):
                value = str(dollars(value))
            pdf[fieldname] = value

    pdf.pattern = '{}'
    pdf['CREDITCODE'] = u''  # clean up pre-filled values on last page
예제 #3
0
파일: f600s.py 프로젝트: zrisher/luca
def fill_out_2012(form, pdf):
    f = form
    pdf.load('us_ga.f600s--{}.pdf'.format(f.form_version))
    pdf.pattern = None

    pdf['FEIN'] = f.ein
    pdf['FEIN_COPY'] = f.ein

    pdf['CORP_NAME'] = f.name.upper()
    pdf['CORP_NAME_COPY'] = f.name.upper()

    pdf['2011_DATE_BEG'] = f.income_beginning
    pdf['2011_DATE_END'] = f.income_ending
    pdf['2012_DATE_BEG'] = f.net_worth_beginning
    pdf['2012_DATE_END'] = f.net_worth_ending
    pdf['CB_TYPEOFRETURN'] = f.type
    # TODO: Boolean "change" fields
    pdf['DATE_OF_INCORPORATION'] = f.incorporation_date
    pdf['PAYROLL_WTH_NUM'] = f.withholding_number
    pdf['NONRES_WTH_NUM'] = f.nonresident_withholding_number
    pdf['CORP_ADDRESS'] = f.address.upper()
    pdf['STATE_INCORPORATED'] = f.incorporation_state
    pdf['SALES_TAX_REG_NUM'] = f.sales_tax_number
    pdf['CITY'] = f.city.upper()
    pdf['STATE'] = f.state
    pdf['ZIP5'] = f.zip
    pdf['DATE_ADMITTED_IN_GA'] = f.date_admitted
    pdf['NAICS'] = f.naics_code
    pdf['BOOKS_CITY_LOC'] = f.books_city.upper()
    pdf['BOOKS_STATE_LOC'] = f.books_state
    pdf['PHONE'] = f.books_phone
    pdf['KIND_OF_BUSINESS'] = f.kind_of_business.upper()
    pdf['TTL_SH'] = f.total_shareholders
    pdf['TTL_NONRES_SH'] = f.nonresident_shareholders
    pdf['FED_ORD_INCOME'] = str(dollars(f.federal_ordinary_income))

    for sname in 's1 s3 s4 s8 s9'.split():
        s = getattr(form, sname)
        for attr, value in s.__dict__.items():
            if not attr.startswith('line'):
                continue
            n = attr.replace('line', '')
            if sname == 's4':
                letter = n[-1]
                n = n[:-1]
                fieldname = '{}{}.{}'.format(sname, letter, n).upper()
            else:
                fieldname = '{}.{}'.format(sname, n).upper()
            if isinstance(value, Decimal):
                value = str(dollars(value))
            pdf[fieldname] = value

    pdf.pattern = '{}'
    pdf['CREDITCODE'] = u''  # clean up pre-filled values on last page
예제 #4
0
파일: f600s.py 프로젝트: B-Rich/luca
def fill_out(form, pdf):
    f = form
    pdf.load('us_ga.f600s--{}.pdf'.format(f.form_version))
    if f.form_version == u'2012':
        return fill_out_2012(form, pdf)

    pdf['FEIN'] = f.ein
    pdf['Title'] = pdf['Title2'] = f.name

    pdf['begin01'] = f.income_beginning
    pdf['end01'] = f.income_ending
    pdf['begin02'] = f.net_worth_beginning
    pdf['end02'] = f.net_worth_ending
    # TODO: Boolean type-of-return fields
    pdf['Date1'] = f.incorporation_date
    pdf['WHLD.0'] = f.withholding_number
    pdf['WHLD.1'] = f.nonresident_withholding_number
    pdf['Address1'] = f.address.upper()
    pdf['State'] = f.incorporation_state
    pdf['Sales'] = f.sales_tax_number
    pdf['City'] = f.city.upper()
    pdf['State2'] = f.state
    pdf['Zip'] = f.zip
    pdf['Date2'] = f.date_admitted
    pdf['NAICS'] = f.naics_code
    pdf['Location.0'] = f.books_city.upper()
    pdf['Location.1'] = f.books_state
    pdf['Telephone'] = f.books_phone
    pdf['Business'] = f.kind_of_business.upper()
    pdf['#Non'] = f.total_shareholders  # yes, they got these two backwards
    pdf['#Share'] = f.nonresident_shareholders
    pdf['Federal Ordinary Income'] = str(dollars(f.federal_ordinary_income))
    pdf['email'] = f.email
    pdf['Email Authorization'] = 'Yes' if f.email_authorization else 'Off'
    pdf['Title5'] = f.title

    replacements = {'Sch4-1b': 'SCh4-1b', 'Sch4-9b': 'Sch-4-9b'}

    for sname in 's1 s3 s4 s7 s8 s9'.split():
        s = getattr(form, sname)
        schno = sname[1:]
        for attr, value in s.__dict__.items():
            if not attr.startswith('line'):
                continue
            lineno = attr[4:]
            fieldname = 'Sch{}-{}'.format(schno, lineno)
            fieldname = replacements.get(fieldname, fieldname)
            if fieldname == 'Sch7-2c':
                value = str(value)
            elif isinstance(value, Decimal):
                value = str(dollars(value))
            pdf[fieldname] = value
예제 #5
0
def compute(form):
    f = form
    if f.form_version == u'2012':
        return compute_2012(form)

    f.line3 = dollars(f.line1 + f.line2)
    f.line4 = f.exemptions * dollars('1700')
    f.line5 = dollars(max(0, f.line3 - f.line4))
    f.line8 = dollars(max(0, f.line6 - f.line7))
    f.line10 = dollars(max(0, f.line8 - f.line9))
    f.line10a = f.line10
    f.line11_percent = (20 if f.line5 <= 25000 else 15
                        if f.line5 <= 50000 else 10 if f.line5 <= 75000 else 5)
    f.line11 = dollars(min(650, f.line10a * f.line11_percent / 100))
    f.line12 = f.line10a - f.line11
    f.line17 = max(zero, f.line12 - f.line13 - f.line14 - f.line15 - f.line16)

    f.line20 = f.line17 + f.line18 + f.line19
    f.line24 = f.line21 + f.line22 + f.line23
    if f.line24 >= f.line20:
        f.line25 = f.line24 - f.line20
        f.line28 = f.line25 - f.line26 - f.line27
        f.line29 = zero
    else:
        f.line25 = zero
        f.line28 = zero
        f.line29 = f.line20 - f.line24
    if f.line28:
        f.line31 = zero
        f.line32 = f.line28 - f.line30
    else:
        f.line31 = f.line29 + f.line30
        f.line32 = zero
예제 #6
0
파일: it1040.py 프로젝트: B-Rich/luca
def compute(form):
    f = form
    if f.form_version == u'2012':
        return compute_2012(form)

    f.line3 = dollars(f.line1 + f.line2)
    f.line4 = f.exemptions * dollars('1700')
    f.line5 = dollars(max(0, f.line3 - f.line4))
    f.line8 = dollars(max(0, f.line6 - f.line7))
    f.line10 = dollars(max(0, f.line8 - f.line9))
    f.line10a = f.line10
    f.line11_percent = (20 if f.line5 <= 25000 else
                        15 if f.line5 <= 50000 else
                        10 if f.line5 <= 75000 else 5)
    f.line11 = dollars(min(650, f.line10a * f.line11_percent / 100))
    f.line12 = f.line10a - f.line11
    f.line17 = max(zero, f.line12 - f.line13 - f.line14 - f.line15 - f.line16)

    f.line20 = f.line17 + f.line18 + f.line19
    f.line24 = f.line21 + f.line22 + f.line23
    if f.line24 >= f.line20:
        f.line25 = f.line24 - f.line20
        f.line28 = f.line25 - f.line26 - f.line27
        f.line29 = zero
    else:
        f.line25 = zero
        f.line28 = zero
        f.line29 = f.line20 - f.line24
    if f.line28:
        f.line31 = zero
        f.line32 = f.line28 - f.line30
    else:
        f.line31 = f.line29 + f.line30
        f.line32 = zero
예제 #7
0
파일: sd100.py 프로젝트: B-Rich/luca
def compute(form):
    f = form

    if f.form_version == u'2012':
        return compute_2012(form)

    f.line2 = dollars(f.line1 * f.line2_rate / 100)
    f.line4 = f.line2 - f.line3
    f.line6 = f.line4 + f.line5
    f.line9 = f.line7 + f.line8
    if f.line9 > f.line6:
        f.line10 = f.line9 - f.line6
        f.line12 = f.line10 - f.line11
        f.line13 = zero
        f.line15 = zero
        f.line16 = f.line12 - f.line14
    else:
        f.line10 = zero
        f.line12 = zero
        f.line13 = f.line6 - f.line9
        f.line15 = f.line13 + f.line14
        f.line16 = zero
예제 #8
0
def compute(form):
    f = form

    if f.form_version == u'2012':
        return compute_2012(form)

    f.line2 = dollars(f.line1 * f.line2_rate / 100)
    f.line4 = f.line2 - f.line3
    f.line6 = f.line4 + f.line5
    f.line9 = f.line7 + f.line8
    if f.line9 > f.line6:
        f.line10 = f.line9 - f.line6
        f.line12 = f.line10 - f.line11
        f.line13 = zero
        f.line15 = zero
        f.line16 = f.line12 - f.line14
    else:
        f.line10 = zero
        f.line12 = zero
        f.line13 = f.line6 - f.line9
        f.line15 = f.line13 + f.line14
        f.line16 = zero
예제 #9
0
파일: sd100.py 프로젝트: B-Rich/luca
def fill_out_2012(form, pdf):
    f = form

    # Fields on both page 1 and page 2

    pdf['PrimarySSN'] = f.ssn
    pdf['SD#'] = f.school_district_number

    # Fields on page 1

    # pdf['F0020PrimaryDecd']
    pdf['F0030SecondarySSN'] = f.spouse_ssn
    # pdf['F0040SecondaryDecd']
    # pdf['F0050holdTaxYR']
    pdf['F0070PrimaryFirstName'] = f.first_name
    pdf['F0080PrimaryMI'] = f.middle_initial
    pdf['F0090PrimaryLastName'] = f.last_name
    pdf['F0100SpouseFirstName'] = f.spouse_first_name
    pdf['F0110SpouseMI'] = f.spouse_middle_initial
    pdf['F0120SpouseLastName'] = f.spouse_last_name
    pdf['F0130MailingAddress'] = f.address
    pdf['F0140City'] = f.city
    pdf['F0150State'] = f.state
    pdf['F0160MailingAddressZipcode'] = f.zip
    pdf['F0170MailingAddressCounty'] = f.county.upper()[:4]
    # pdf['F0180HomeAddress']
    # pdf['F0190HomeAddressZip']
    # pdf['F0200HomeAddressCounty']
    # pdf['F0210ForeignCountry']
    # pdf['F0220Foreignpostalcode']

    def yes(condition):
        return 'Yes' if condition else 'Off'

    r = f.residency
    pdf['F0230PrimaryFullYear'] = yes(r == 'full-year')
    pdf['F0240PrimaryPartYear'] = yes(r == 'part-year')
    pdf['F0250PrimaryNonresident'] = yes(r == 'nonresident')

    r = f.spouse_residency
    pdf['F0270SpouseFullYear'] = yes(r == 'full-year')
    pdf['F0280SpousePartYear'] = yes(r == 'part-year')
    pdf['F0290SpouseNonresident'] = yes(r == 'nonresident')

    # pdf['F0260primary_SDresidency_status']
    # pdf['F0300spouse_SDresidency_status']
    # pdf['F0350filing_status']

    pdf['F0310Single'] = yes(f.filing_status == 'single')
    pdf['F0320MarriedFilingJointly'] = yes(f.filing_status == 'joint')
    pdf['F0330MarriedFilingSeparately'] = yes(f.filing_status == 'separate')
    # pdf['F0340MFS SSN']

    pdf['Traditionaltax'] = yes(f.tax_type == 'traditional')
    pdf['Earnedincomeonlytax'] = yes(f.tax_type == 'earned-income')

    for attr in dir(f):
        if attr.startswith('line'):
            value = getattr(f, attr)
            if isinstance(value, Decimal):
                value = str(dollars(value)).replace('.00', '')
            pdf[attr.capitalize()] = value
예제 #10
0
def compute_2012(form):
    f = form

    # Schedule A

    f.line34 = f.line31 + f.line32 + sum(f['line33', x] for x in 'abcdefg')
    f.line46 = sum(f['line', number] for number in deductions)
    f.line47 = f.line34 - f.line46

    # Schedule B

    f.line57 = sum(f['line', number] for number in nonbusiness_credits)

    # Start of main page

    f.line2 = f.line47
    f.line3 = f.line1 + f.line2
    f.line4 = f.exemptions * dollars('1700')
    f.line5 = max(zero, f.line3 - f.line4)
    f.line7 = f.line57
    f.line8 = max(zero, f.line6 - f.line7)
    f.line9 = f.exemptions * dollars('20')
    f.line10 = max(zero, f.line8 - f.line9)
    f.line10a = f.line10
    f.line11 = min(dollars('650'), dollars(f.line10a * f.line11_percent / 100))
    f.line12 = f.line10a - f.line11

    # Schedule C

    f.line59 = f.line3
    f.line60_factor = (f.line58 / f.line59).quantize(Decimal('0.0001'))
    f.line60 = dollars(f.line12 * f.line60_factor)
    f.line62 = min(f.line60, f.line61)

    # Schedule D

    f.line64 = f.line3
    f.line65_factor = (f.line63 / f.line64).quantize(Decimal('0.0001'))
    f.line65 = dollars(f.line12 * f.line65_factor)

    # Summary of credits

    f.line66 = zero
    f.line67 = f.line62
    f.line68 = f.line65
    f.line69 = f.line66 + f.line67 + f.line68

    # Main page continued

    f.line13 = f.line69
    f.line15 = max(zero, f.line12 - f.line13 - f.line14)
    f.line18 = f.line15 + f.line16 + f.line17
    f.line22 = (f.line19 + f.line20 + f.line21a + f.line21b + f.line21c +
                f.line21d)

    if f.line22 > f.line18:
        f.line23 = max(zero, f.line22 - f.line18)
        f.line26 = (f.line23 - f.line24 - f.line25a - f.line25b - f.line25c -
                    f.line25d)
        f.line27 = zero
        f.line29 = zero
        f.line30 = f.line26 - f.line28
    else:
        f.line23 = zero
        f.line26 = zero
        f.line27 = f.line18 - f.line22
        f.line29 = f.line27 + f.line28
        f.line30 = zero
예제 #11
0
파일: f600s.py 프로젝트: B-Rich/luca
def defaults(form):
    f = form
    f.income_beginning = u''
    f.income_ending = u''
    f.net_worth_beginning = u''
    f.net_worth_ending = u''
    f.type = 'original'
    # TODO: Boolean "change" fields
    f.ein = u''
    f.name = u''
    f.incorporation_date = u''
    f.withholding_number = u''
    f.nonresident_withholding_number = u''
    f.address = u''
    f.incorporation_state = u''
    f.sales_tax_number = u''
    f.city = u''
    f.state = u''
    f.zip = u''
    f.date_admitted = u''
    f.naics_code = u''
    f.books_city = u''
    f.books_state = u''
    f.books_phone = u''
    f.kind_of_business = u''
    f.total_shareholders = u''
    f.nonresident_shareholders = u''
    f.federal_ordinary_income = zero
    # TODO: latest taxable year

    f.s1 = s1 = Form()
    # TODO: schedule 2
    f.s3 = s3 = Form()
    f.s4 = s4 = Form()
    # TODO: schedule 5
    # TODO: schedule 6
    # TODO: schedule 7
    f.s8 = s8 = Form()
    f.s9 = s9 = Form()
    # TODO: schedule 10
    # TODO: schedule 11

    s1.line1 = zero

    s3.line1 = zero
    s3.line2 = zero
    s3.line3 = zero
    s3.line5 = Decimal('1.00')
    s3.line7 = zero  # TODO: do tax table lookup automatically

    s4.line2c = zero
    s4.line3c = zero  # TODO: implement Schedule 10?
    s4.line4c = zero

    if f.form_version >= u'2013':
        f.s7 = s7 = Form()
        s7.line1a = dollars(100)
        s7.line1b = dollars(100)

    s8.line1 = zero
    s8.line2 = zero
    s8.line3a = zero
    s8.line3b = zero
    s8.line4a = zero
    s8.line4b = zero
    s8.line4c = zero
    s8.line4d = zero
    s8.line4e = zero
    s8.line4f = zero
    s8.line5 = zero
    s8.line6 = zero

    s9.line2 = zero
    s9.line4 = Decimal('1.00')
    s9.line6 = zero

    # Fields added in 2013:

    f.email = u''
    f.email_authorization = False
    f.title = u''
예제 #12
0
파일: it1040.py 프로젝트: B-Rich/luca
def compute_2012(form):
    f = form

    # Schedule A

    f.line34 = f.line31 + f.line32 + sum(f['line33', x] for x in 'abcdefg')
    f.line46 = sum(f['line', number] for number in deductions)
    f.line47 = f.line34 - f.line46

    # Schedule B

    f.line57 = sum(f['line', number] for number in nonbusiness_credits)

    # Start of main page

    f.line2 = f.line47
    f.line3 = f.line1 + f.line2
    f.line4 = f.exemptions * dollars('1700')
    f.line5 = max(zero, f.line3 - f.line4)
    f.line7 = f.line57
    f.line8 = max(zero, f.line6 - f.line7)
    f.line9 = f.exemptions * dollars('20')
    f.line10 = max(zero, f.line8 - f.line9)
    f.line10a = f.line10
    f.line11 = min(dollars('650'), dollars(f.line10a * f.line11_percent / 100))
    f.line12 = f.line10a - f.line11

    # Schedule C

    f.line59 = f.line3
    f.line60_factor = (f.line58 / f.line59).quantize(Decimal('0.0001'))
    f.line60 = dollars(f.line12 * f.line60_factor)
    f.line62 = min(f.line60, f.line61)

    # Schedule D

    f.line64 = f.line3
    f.line65_factor = (f.line63 / f.line64).quantize(Decimal('0.0001'))
    f.line65 = dollars(f.line12 * f.line65_factor)

    # Summary of credits

    f.line66 = zero
    f.line67 = f.line62
    f.line68 = f.line65
    f.line69 = f.line66 + f.line67 + f.line68

    # Main page continued

    f.line13 = f.line69
    f.line15 = max(zero,
                   f.line12 - f.line13 - f.line14)
    f.line18 = f.line15 + f.line16 + f.line17
    f.line22 = (f.line19 + f.line20 + f.line21a
                + f.line21b + f.line21c
                + f.line21d)

    if f.line22 > f.line18:
        f.line23 = max(zero, f.line22 - f.line18)
        f.line26 = (f.line23 - f.line24 - f.line25a
                    - f.line25b - f.line25c
                    - f.line25d)
        f.line27 = zero
        f.line29 = zero
        f.line30 = f.line26 - f.line28
    else:
        f.line23 = zero
        f.line26 = zero
        f.line27 = f.line18 - f.line22
        f.line29 = f.line27 + f.line28
        f.line30 = zero
예제 #13
0
파일: f600s.py 프로젝트: zrisher/luca
def defaults(form):
    f = form
    f.income_beginning = u''
    f.income_ending = u''
    f.net_worth_beginning = u''
    f.net_worth_ending = u''
    f.type = 'original'
    # TODO: Boolean "change" fields
    f.ein = u''
    f.name = u''
    f.incorporation_date = u''
    f.withholding_number = u''
    f.nonresident_withholding_number = u''
    f.address = u''
    f.incorporation_state = u''
    f.sales_tax_number = u''
    f.city = u''
    f.state = u''
    f.zip = u''
    f.date_admitted = u''
    f.naics_code = u''
    f.books_city = u''
    f.books_state = u''
    f.books_phone = u''
    f.kind_of_business = u''
    f.total_shareholders = u''
    f.nonresident_shareholders = u''
    f.federal_ordinary_income = zero
    # TODO: latest taxable year

    f.s1 = s1 = Form()
    # TODO: schedule 2
    f.s3 = s3 = Form()
    f.s4 = s4 = Form()
    # TODO: schedule 5
    # TODO: schedule 6
    # TODO: schedule 7
    f.s8 = s8 = Form()
    f.s9 = s9 = Form()
    # TODO: schedule 10
    # TODO: schedule 11

    s1.line1 = zero

    s3.line1 = zero
    s3.line2 = zero
    s3.line3 = zero
    s3.line5 = Decimal('1.00')
    s3.line7 = zero  # TODO: do tax table lookup automatically

    s4.line2c = zero
    s4.line3c = zero  # TODO: implement Schedule 10?
    s4.line4c = zero

    if f.form_version >= u'2013':
        f.s7 = s7 = Form()
        s7.line1a = dollars(100)
        s7.line1b = dollars(100)

    s8.line1 = zero
    s8.line2 = zero
    s8.line3a = zero
    s8.line3b = zero
    s8.line4a = zero
    s8.line4b = zero
    s8.line4c = zero
    s8.line4d = zero
    s8.line4e = zero
    s8.line4f = zero
    s8.line5 = zero
    s8.line6 = zero

    s9.line2 = zero
    s9.line4 = Decimal('1.00')
    s9.line6 = zero

    # Fields added in 2013:

    f.email = u''
    f.email_authorization = False
    f.title = u''
예제 #14
0
def fill_out_2012(form, pdf):
    f = form

    # Fields on both page 1 and page 2

    pdf['PrimarySSN'] = f.ssn
    pdf['SD#'] = f.school_district_number

    # Fields on page 1

    # pdf['F0020PrimaryDecd']
    pdf['F0030SecondarySSN'] = f.spouse_ssn
    # pdf['F0040SecondaryDecd']
    # pdf['F0050holdTaxYR']
    pdf['F0070PrimaryFirstName'] = f.first_name
    pdf['F0080PrimaryMI'] = f.middle_initial
    pdf['F0090PrimaryLastName'] = f.last_name
    pdf['F0100SpouseFirstName'] = f.spouse_first_name
    pdf['F0110SpouseMI'] = f.spouse_middle_initial
    pdf['F0120SpouseLastName'] = f.spouse_last_name
    pdf['F0130MailingAddress'] = f.address
    pdf['F0140City'] = f.city
    pdf['F0150State'] = f.state
    pdf['F0160MailingAddressZipcode'] = f.zip
    pdf['F0170MailingAddressCounty'] = f.county.upper()[:4]

    # pdf['F0180HomeAddress']
    # pdf['F0190HomeAddressZip']
    # pdf['F0200HomeAddressCounty']
    # pdf['F0210ForeignCountry']
    # pdf['F0220Foreignpostalcode']

    def yes(condition):
        return 'Yes' if condition else 'Off'

    r = f.residency
    pdf['F0230PrimaryFullYear'] = yes(r == 'full-year')
    pdf['F0240PrimaryPartYear'] = yes(r == 'part-year')
    pdf['F0250PrimaryNonresident'] = yes(r == 'nonresident')

    r = f.spouse_residency
    pdf['F0270SpouseFullYear'] = yes(r == 'full-year')
    pdf['F0280SpousePartYear'] = yes(r == 'part-year')
    pdf['F0290SpouseNonresident'] = yes(r == 'nonresident')

    # pdf['F0260primary_SDresidency_status']
    # pdf['F0300spouse_SDresidency_status']
    # pdf['F0350filing_status']

    pdf['F0310Single'] = yes(f.filing_status == 'single')
    pdf['F0320MarriedFilingJointly'] = yes(f.filing_status == 'joint')
    pdf['F0330MarriedFilingSeparately'] = yes(f.filing_status == 'separate')
    # pdf['F0340MFS SSN']

    pdf['Traditionaltax'] = yes(f.tax_type == 'traditional')
    pdf['Earnedincomeonlytax'] = yes(f.tax_type == 'earned-income')

    for attr in dir(f):
        if attr.startswith('line'):
            value = getattr(f, attr)
            if isinstance(value, Decimal):
                value = str(dollars(value)).replace('.00', '')
            pdf[attr.capitalize()] = value