void worksheet4() /*Tax Computation Worksheet 4 (pg 51) */ { double ws[100]; ws[1] = L[33]; ws[2] = L[38]; ws[3] = 0.0882 * ws[2]; if (ws[1] >= 2142800.0) ws[11] = ws[3]; else { ws[4] = TaxRateFunction( ws[2], status ); ws[5] = ws[3] - ws[4]; if (ws[2] <= 156900.0) ws[6] = 662.0; else if (ws[2] <= 313850.0) ws[6] = 976.0; else ws[6] = 1604.0; ws[7] = ws[5] - ws[6]; ws[8] = ws[1] - 2092800.0; /* Divide by 50k and round to forth decimal place. */ ws[9] = 0.0001 * (double)Round( 10000.0 * (ws[8] / 50000.0) ); ws[10] = ws[7] * ws[9]; ws[11] = ws[4] + ws[6] + ws[10]; } L[39] = ws[11]; }
double TaxRateLookup( double income, int status ) { double tax, dx; int m; if (income < 25.0) dx = 12.5; else if (income < 50.0) dx = 25.0; else dx = 50.0; /* Round and truncate results from tax-function to approximate table lookup. */ m = income / dx; /* Round income to nearest $50. */ income = (double)m * dx + 0.5 * dx; /* Place into center of a $50 bracket. */ tax = TaxRateFunction( income, status ); return (int)(tax + 0.5); }
void worksheet8() /*Tax Computation Worksheet 8 (pg 53) */ { double ws[100]; ws[1] = L[33]; ws[2] = L[38]; ws[3] = 0.0665 * ws[2]; if (ws[1] >= 154600.0) ws[9] = ws[3]; else { ws[4] = TaxRateFunction( ws[2], status ); ws[5] = ws[3] - ws[4]; ws[6] = ws[1] - 104600.0; /* Divide by 50k and round to forth decimal place. */ ws[7] = 0.0001 * (double)Round( 10000.0 * (ws[6] / 50000.0) ); ws[8] = ws[5] * ws[7]; ws[9] = ws[4] + ws[8]; } L[39] = ws[9]; }
void worksheet6() /*Tax Computation Worksheet 6 (pg 52) */ { double ws[100]; ws[1] = L[33]; ws[2] = L[38]; ws[3] = 0.0685 * ws[2]; if (ws[1] >= 259250.0) ws[11] = ws[3]; else { ws[4] = TaxRateFunction( ws[2], status ); ws[5] = ws[3] - ws[4]; ws[6] = 487.0; ws[7] = ws[5] - ws[6]; ws[8] = ws[1] - 209250.0; /* Divide by 50k and round to forth decimal place. */ ws[9] = 0.0001 * (double)Round( 10000.0 * (ws[8] / 50000.0) ); ws[10] = ws[7] * ws[9]; ws[11] = ws[4] + ws[6] + ws[10]; } L[39] = ws[11]; }
void worksheet10() /*Tax Computation Worksheet 10 (pg 53) */ { double ws[100]; ws[1] = L[33]; ws[2] = L[38]; ws[3] = 0.0882 * ws[2]; if (ws[1] >= 1619550.0) ws[11] = ws[3]; else { ws[4] = TaxRateFunction( ws[2], status ); ws[5] = ws[3] - ws[4]; if (ws[2] <= 261550.0) ws[6] = 706.0; else ws[6] = 1229.0; ws[7] = ws[5] - ws[6]; ws[8] = ws[1] - 1569550.0; /* Divide by 50k and round to forth decimal place. */ ws[9] = 0.0001 * (double)Round( 10000.0 * (ws[8] / 50000.0) ); ws[10] = ws[7] * ws[9]; ws[11] = ws[4] + ws[6] + ws[10]; } L[39] = ws[11]; }
int main( int argc, char *argv[] ) { int i, j, k; char word[1000], outfname[4000], nj1040_outfname[4000], nj1040_sched_a_outfname[4000]; int status=0; time_t now; int L12a=0, L12b=0; double L27a=0.0, L27b=0.0, L29a=0.0, L29b=0.0, L37a=0.0; double Ab[10], A9a=0.0, proptxcredit; double F[10], Fb[10]; /* Schedule F, added by BWB. */ double I[10], Ib[10]; /* Schedule I. */ /* Intercept any command-line arguments. */ printf("NJ 1040 2014 - v%3.1f\n", thisversion); i = 1; k=1; while (i < argc) { if (strcmp(argv[i],"-verbose")==0) verbose = 1; else if (k==1) { infile = fopen(argv[i],"r"); if (infile==0) { printf("ERROR: Parameter file '%s' could not be opened.\n", argv[i]); exit(1); } k = 2; /* Base name of output file on input file. */ strcpy(outfname,argv[i]); strcpy(nj1040_outfname,argv[i]); strcpy(nj1040_sched_a_outfname,argv[i]); j = strlen(outfname)-1; while ((j>=0) && (outfname[j]!='.')) j--; if (j<0) { strcat(outfname,"_out.txt"); strcat(nj1040_outfname,"_nj1040.xfdf"); strcat(nj1040_sched_a_outfname,"nj1040abc.xfdf"); } else { strcpy(&(outfname[j]),"_out.txt"); strcpy(&(nj1040_outfname[j]),"_nj1040.xfdf"); strcpy(&(nj1040_sched_a_outfname[j]),"_nj1040abc.xfdf"); } outfile = fopen(outfname,"w"); if (outfile==0) { printf("ERROR: Output file '%s' could not be opened.\n", outfname); exit(1); } printf("Writing results to file: %s\n", outfname); } else { printf("Unknown command-line parameter '%s'\n", argv[i]); exit(1); } i = i + 1; } if (infile==0) { printf("Error: No input file on command line.\n"); exit(1); } /* Pre-initialize all lines to zeros. */ for (i=0; i<MAX_LINES; i++) { L[i] = 0.0; A[i] = 0.0; S[i] = 0.0; E[i] = 0.0; } /* Accept parameters from input file. */ /* Expect NJ-1040 lines, something like: Title: NJ 1040 1999 Return L14 {Wages} L15a {Interest} L16 {Dividends} L18 {Capital Gains} S1 {Property Tax} L42 {Witheld tax, from W-2} */ /* Accept Form's "Title" line, and put out with date-stamp for records. */ read_line( infile, word ); now = time(0); fprintf(outfile,"\n%s %s\n", word, ctime( &now )); /* get_parameter(infile, kind, x, mesage ) */ get_parameter( infile, 's', word, "Status" ); get_parameter( infile, 'l', word, "Status ?"); if (strncasecmp(word,"Single",4)==0) { status = SINGLE; L["Single"] = 1; } else if (strncasecmp(word,"Married/Joint",13)==0) { status = MARRIED_FILLING_JOINTLY; L["MFJ"] = 1; } else if (strncasecmp(word,"Married/Sep",11)==0) { status = MARRIED_FILLING_SEPARAT; L["MFS"] = 1; } else if (strncasecmp(word,"Head_of_House",4)==0) { status = HEAD_OF_HOUSEHOLD; L["HOH"] = 1; } else if (strncasecmp(word,"Widow",4)==0) { status = WIDOW; L["QW"] = 1; } else { printf("Error: unrecognized status '%s'. Must be: Single, Married/joint, Married/sep, Head_of_house, Widow(er)\nExiting.\n", word); fprintf(outfile,"Error: unrecognized status '%s'. Must be: Single, Married/joint, Married/sep, Head_of_house, Widow(er)\nExiting.\n", word); exit(1); } switch (status) { case SINGLE: fprintf(outfile,"Status = Single (%d)\n", status); break; case MARRIED_FILLING_JOINTLY: fprintf(outfile,"Status = Married/Joint (%d)\n", status); break; case MARRIED_FILLING_SEPARAT: fprintf(outfile,"Status = Married/Sep (%d)\n", status); break; case HEAD_OF_HOUSEHOLD: fprintf(outfile,"Status = Head_of_Household (%d)\n", status); break; case WIDOW: fprintf(outfile,"Status = Widow(er) (%d)\n", status); break; } get_parameter( infile, 's', word, "L6" ); /* Exemptions, self/spouse. */ get_parameter( infile, 'i', &j, "L6"); L[6] = j; shownum(6); get_parameter( infile, 's', word, "L7" ); /* Exemptions, Over 65. */ get_parameter( infile, 'i', &j, "L7"); L[7] = j; shownum(7); get_parameter( infile, 's', word, "L8" ); /* Exemptions, Blind/disabled. */ get_parameter( infile, 'i', &j, "L8"); L[8] = j; shownum(8); get_parameter( infile, 's', word, "L9" ); /* Exemptions, children. */ get_parameter( infile, 'i', &j, "L9"); L[9] = j; shownum(9); get_parameter( infile, 's', word, "L10" ); /* Exemptions, other dependents. */ get_parameter( infile, 'i', &j, "L10"); L[10] = j; shownum(10); get_parameter( infile, 's', word, "L11" ); /* Exemptions, college kids. */ get_parameter( infile, 'i', &j, "L11"); L[11] = j; shownum(11); L12a = L[6] + L[7] + L[8] + L[11]; L["12a"] = L12a; fprintf(outfile,"L12a = %d\n", L12a); L12b = L[9] + L[10]; L["12b"] = L12b; fprintf(outfile,"L12b = %d\n", L12b); GetLineF( "L14", &L[14] ); /* Wages. */ GetLineF( "L15a", &L[15] ); /* Taxable Interest. */ /* Form asks for tax-exempt income, but does not use it. */ GetLineF( "L16", &L[16] ); /* Dividends. */ GetLine( "L17", &L[17] ); /* Business profits, Fed Sched C. */ if (L[17] < 0.0) L[17] = 0.0; showline(17); GetLine( "L18", &L[18] ); /* Capital Gains . */ if (L[18] < 0.0) L[18] = 0.0; showline(18); GetLineF( "L19", &L[19] ); /* Pensions, Annuities, and IRA Withdrawals (pg 20). */ GetLineF( "L20", &L[20] ); /* Partnership income. (See pg 24.) */ GetLineF( "L21", &L[21] ); /* S Corporation income. (See pg 24.) */ GetLineF( "L22", &L[22] ); /* Rent, royalty, patents income. (Sched NJ-BUS-1, Part IV, Line 4.) */ GetLineF( "L23", &L[23] ); /* Net gambling winnings. */ GetLineF( "L24", &L[24] ); /* Alimony and maintenance payments RECEIVED. */ GetLineF( "L25", &L[25] ); /* Other (See pg 24). */ L[26] = L[14] + L[15] + L[16] + L[17] + L[18] + L[19] + L[20] + L[21] + L[22] + L[23] + L[24] + L[25]; showline_wmsg(26,"Total Income"); /* Total Income. */ GetLineF( "L27a", &L27a ); /* Pension Exclusion (See pg 26). */ GetLineF( "L27b", &L27b ); /* Other Retirement Income Exclusion (See worksheet pg 26). */ L["27a"] = L27a; L["27b"] = L27b; L[27] = L27a + L27b; L["27c"] = L[27]; showline(27); L[28] = L[26] - L[27]; showline_wmsg(28,"NJ Gross Income"); if ((status == SINGLE) || (status == MARRIED_FILLING_SEPARAT)) { if (L[28] < 10000.0) fprintf(outfile," --- You do not need to file, (except to get refund). Income < $10,000. ---\n"); } else { if (L[28] < 20000.0) fprintf(outfile," --- You do not need to file, (except to get refund). Income < $20,000. ---\n"); } L29a = L12a * 1000.0; fprintf(outfile," L29a = %6.2f\n", L29a ); L29b = L12b * 1500.0; fprintf(outfile," L29b = %6.2f\n", L29b ); L[29] = L29a + L29b; fprintf(outfile,"L29c = %6.2f Total Exemption Amount\n", L[29] ); fprintf(outfile,"\n"); GetLine( "E1", &E[1] ); /* Medical Expenses (See pg 27). */ showline_wrksht('E',1,E); E[2] = 0.02 * L[28]; showline_wrksht('E',2,E); E[3] = NotLessThanZero( E[1] - E[2] ); showline_wrksht('E',3,E); GetLine( "E4", &E[4] ); /* Qualified Archer MSA contributions from Federal Form 8853 */ showline_wrksht('E',4,E); GetLine( "E5", &E[5] ); /* Amount of self-employed health insurance deduction */ showline_wrksht('E',5,E); E[6] = NotLessThanZero( E[3] + E[4] + E[5] ); showline_wrksht('E',6,E); fprintf(outfile,"\n"); L[30] = E[6]; if (L[30] != 0.0) showline_wmsg(30," Medical Expenses Worksheet E (See pg 27)"); /* end of Worksheet E */ GetLineF( "L31", &L[31] ); /* Alimony and maintenance payments PAYED. */ GetLineF( "L32", &L[32] ); /* Qualified Conservation Contribution. */ GetLineF( "L33", &L[33] ); /* Health Enterprise Zone Deduction. */ GetLineF( "L34", &L[34] ); /* Alternative Business Calc Adj (Sched NJ-BUS-2, Line 11). */ L[35] = L[29] + L[30] + L[31] + L[32] + L[33] + L[34]; showline_wmsg(35,"Total Exemptions and Deductions"); /* Taxable income. */ L[36] = L[28] - L[35]; if (L[36] > 0.0) showline_wmsg(36, "(Taxable Income)"); GetLineF( "L37a", &L37a ); /* Property Tax Paid. */ L[37] = L37a; GetLine( "A1", &A[1] ); /* Income taxed by other jurisdictions, if any. */ GetLine( "A9a", &A9a ); /* Tax paid to other jurisdictions on that income, if any. */ fprintf(outfile,"\n"); /* Tax deduction worksheet F (pg 34). */ F[1] = L37a; showline_wrksht('F',1,F); if (status != MARRIED_FILLING_SEPARAT) F[2] = smallerof( F[1], 10000.0 ); else F[2] = smallerof( F[1], 5000.0 ); showline_wrksht('F',2,F); if (status != MARRIED_FILLING_SEPARAT) proptxcredit = 50.0; else proptxcredit = 25.0; if (A9a == 0.0) { /*Worksheet-F*/ F[3] = L[36]; Fb[3] = L[36]; fprintf(outfile," F3a = %6.2f F3b = %6.2f\n", F[3], Fb[3]); F[4] = F[2]; Fb[4] = 0.0; fprintf(outfile," F4a = %6.2f F4b = %6.2f\n", F[4], Fb[4]); F[5] = F[3] - F[4]; Fb[5] = Fb[3] - Fb[4]; fprintf(outfile," F5a = %6.2f F5b = %6.2f\n", F[5], Fb[5]); F[6] = TaxRateFunction( F[5], status ); Fb[6] = TaxRateFunction( Fb[5], status ); fprintf(outfile," F6a = %6.2f F6b = %6.2f\n", F[6], Fb[6]); F[7] = Fb[6] - F[6]; showline_wrksht('F',7,F); if (F[7] >= proptxcredit) { /*yes*/ fprintf(outfile," F8. Yes. (Take Property Tax Deduction.)\n"); L[38] = F[4]; L[39] = F[5]; L[40] = F[6]; L[49] = 0.0; } /*yes*/ else { /*no*/ fprintf(outfile," F8. No. (Take Property Tax Credit.)\n"); L[38] = 0.0; L[39] = Fb[5]; L[40] = Fb[6]; L[49] = proptxcredit; } /*no*/ } /*Worksheet-F*/ else { /*SchedA+Worksheet-I*/ fprintf(outfile,"\nSchedule A:\n"); fprintf(outfile," %c%d = %6.2f\n", 'A', 1, A[1]); A[2] = L[28]; fprintf(outfile," %c%d = %6.2f\n", 'A', 2, A[2]); A[3] = smallerof( 1.0, (A[1] / A[2]) ); fprintf(outfile," A3 = %6.2f %%\n", 100.0 * A[3] ); A["3p"] = 100.0*A[3]; A[4] = L[36]; A["4a"] = L[36]; A["4b"] = L[36]; fprintf(outfile," A4a = %6.2f A4b = %6.2f\n", A[4], A[4] ); fprintf(outfile," (5a = %6.2f)\n", F[1] ); A["5a"] = F[1]; A[5] = F[2]; A["5aa"] = F[2]; fprintf(outfile," A5a = %6.2f A5b = %6.2f\n", A[5], 0.0); A[6] = A[4] - A[5]; A["6a"] = A[6]; Ab[6] = A[4] - 0.0; A["6b"] = Ab[6]; fprintf(outfile," A6a = %6.2f A6b = %6.2f\n", A[6], Ab[6]); A[7] = TaxRateFunction( A[6], status ); A["7a"] = A[7]; Ab[7] = TaxRateFunction( Ab[6], status ); A["7b"] = Ab[7]; fprintf(outfile," A7a = %6.2f A7b = %6.2f\n", A[7], Ab[7] ); A[8] = A[3] * A[7]; A["8a"] = A[8]; Ab[8] = A[3] * Ab[7]; A["8b"] = Ab[8]; fprintf(outfile," A8a = %6.2f A8b = %6.2f\n", A[8], Ab[8] ); fprintf(outfile," (9a = %6.2f)\n", A9a ); A["9a"] = A9a; A[9] = smallerof( smallerof( A9a, A[8] ), A[7] ); A["9aa"] = A[8]; Ab[9] = smallerof( smallerof( A9a, Ab[8] ), Ab[7] ); A["9ab"] = Ab[9]; fprintf(outfile," A9a = %6.2f A9b = %6.2f\n", A[9], Ab[9] ); fprintf(outfile,"\nWorksheet I:\n"); I[1] = A[7]; Ib[1] = Ab[7]; fprintf(outfile," I1a = %6.2f I1b = %6.2f\n", I[1], Ib[1] ); I[2] = A[9]; Ib[2] = Ab[9]; fprintf(outfile," I2a = %6.2f I2b = %6.2f\n", I[2], Ib[2] ); I[3] = I[1] - I[2]; Ib[3] = Ib[1] - Ib[2]; fprintf(outfile," I3a = %6.2f I3b = %6.2f\n", I[3], Ib[3] ); Ib[4] = Ib[3] - I[3]; showline_wrksht('I', 4, Ib); if (Ib[4] >= proptxcredit) { fprintf(outfile," Sched-I, Yes: Take PropTax Deduction\n\n"); L[38] = A[5]; // fprintf(outfile,"L36c = %6.2f\n", L[36]); L[39] = A[6]; L[40] = A[7]; L[41] = I[2]; L[49] = 0.0; } else { fprintf(outfile," Sched-I, No: Take PropTax Credit\n\n"); L[38] = 0.0; L[39] = Ab[6]; L[40] = Ab[7]; L[41] = Ib[2]; L[49] = proptxcredit; } } /*SchedA+Worksheet-I*/ /* If no property tax was paid, ensure prop.tax credit is set to 0 */ if ( L37a == 0.0 ) L[49] = 0.0; if (L[37] > 0.0) fprintf(outfile, "L37c = %6.2f\n", L[37]); showline(39); fprintf(outfile,"\n"); /* NJ Taxable Income.*/ // L[39] = L[36] - L[38]; /* Handled above in Sched-1. */ if (L[39] > 0.0) showline_wmsg(39, "NJ Taxable Income"); // L[40] = TaxRateFunction( L[39], status ); /* Handled above in Schedules+Worksheets, A, F, H. */ showline_wmsg(40, "TAX"); if (A[1] > 0.0) showline_wmsg(41, "( Credit for Taxes paid to other jurisdictions. )\n"); L[42] = L[40] - L[41]; showline_wmsg(42, "( Balance of Tax )"); GetLineF( "L43", &L[43] ); /* Sheltered Workshop Tax Credit. */ L[44] = L[42] - L[43]; showline(44); GetLineF( "L45", &L[45] ); /* Use Tax Due on Out-of-State Purchases (pg 35). */ GetLineF( "L46", &L[46] ); /* Penalty for underpayment of estimated tax. */ L[47] = L[44] + L[45] + L[46]; showline(47); /* Total Tax + Penalty. */ GetLine( "L48", &L[48] ); showline_wmsg(48, "Total NJ Income Tax Withheld"); showline_wmsg(49, "Property tax Credit"); GetLineF( "L50", &L[50] ); /* NJ Estimated Tax Payments/Credit from last year's return. */ GetLineF( "L51", &L[51] ); /* NJ Earned Income Tax Credit. (See Sched pg 38.) */ GetLineF( "L52", &L[52] ); /* EXCESS NJ UI/HC/WD Withheld, (See pg 38.) */ GetLineF( "L53", &L[53] ); /* EXCESS NJ Disability Insurance Withheld, (See pg 38.) */ GetLineF( "L54", &L[54] ); /* EXCESS NJ Family Leave Insurance Withheld, (See pg 38.) */ L[55] = L[48] + L[49] + L[50] + L[51] + L[52] + L[53] + L[54]; showline_wmsg(55,"Total Payments/Credits"); if (L[55] < L[47]) { L[56] = L[47] - L[55]; fprintf(outfile, "L56 = %6.2f YOU OWE !!!\n", L[56] ); } else { L[57] = L[55] - L[47]; fprintf(outfile, "L57 = %6.2f Overpayment\n", L[57] ); L[65] = 0.0; showline_wmsg(65, "( Total Contributions from overpayment )"); L[66] = L[57] - L[65]; showline_wmsg(66, "Refund !!!"); } fclose(infile); fclose(outfile); outfile = fopen(nj1040_outfname,"w"); output_xfdf_form_data(outfile, nj1040_2014, L); fclose(outfile); outfile = fopen(nj1040_sched_a_outfname,"w"); output_xfdf_form_data(outfile, nj_schedule_a_2014, A); fclose(outfile); Display_File( outfname ); printf("\nResults written to file: %s\n", outfname); return 0; }
int main( int argc, char *argv[] ) { int i, j, k; char word[1000], outfname[1000], it1040_xfdf_outfname[1000]; int status=0, exemptions=0, qualify_jfc=0; time_t now; double factor62, factor67, limit; double L35a=0.0, L35b=0.0, L35c=0.0, L35d=0.0, L35e=0.0, L35f=0.0, L35g=0.0; double L37a=0.0, L37b=0.0, L39a=0.0, L39b=0.0; double L40a=0.0, L40b=0.0, L40c=0.0; double L44a=0.0, L44b=0.0; double L46a=0.0, L46b=0.0, L46c=0.0; double L72a=0.0, L72b=0.0, L72c=0.0, L72d=0.0, L72e=0.0; double jfc, exemption_amnt; /* Intercept any command-line arguments. */ printf("OH IT1040 2014 - v%3.1f\n", thisversion); i = 1; k=1; while (i < argc) { if (strcmp(argv[i],"-verbose")==0) verbose = 1; else if (k==1) { infile = fopen(argv[i],"r"); if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", argv[i]); exit(1);} k = 2; /* Base name of output file on input file. */ strcpy(outfname,argv[i]); strcpy(it1040_xfdf_outfname,argv[i]); j = strlen(outfname)-1; while ((j>=0) && (outfname[j]!='.')) j--; if (j<0) { strcat(outfname,"_out.txt"); strcat(it1040_xfdf_outfname,"_it1040.xfdf"); } else { strcpy(&(outfname[j]),"_out.txt"); strcpy(&(it1040_xfdf_outfname[j]),"_it1040.xfdf"); } outfile = fopen(outfname,"w"); if (outfile==0) {printf("ERROR: Output file '%s' could not be opened.\n", outfname); exit(1);} printf("Writing results to file: %s\n", outfname); } else {printf("Unknown command-line parameter '%s'\n", argv[i]); exit(1);} i = i + 1; } if (infile==0) {printf("Error: No input file on command line.\n"); exit(1);} /* Pre-initialize all lines to zeros. */ for (i=0; i<MAX_LINES; i++) { L[i] = 0.0; } /* Accept parameters from input file. */ /* Expect OH IT1040 lines, something like: Title: OH IT1040 1999 Return L1 {Wages} */ /* Accept Form's "Title" line, and put out with date-stamp for records. */ read_line( infile, word ); now = time(0); fprintf(outfile,"\n%s %s\n", word, ctime( &now )); /* get_parameter(infile, kind, x, emssg ) */ get_parameter( infile, 's', word, "Status" ); get_parameter( infile, 'l', word, "Status ?"); if (strncasecmp(word,"Single",4)==0) { status = SINGLE; L["Single"] = 1; } else if (strncasecmp(word,"Married/Joint",11)==0) { status = MARRIED_FILLING_JOINTLY; L["MFJ"] = 1; }else if (strncasecmp(word,"Married/Sep",11)==0) { status = MARRIED_FILLING_SEPARAT; L["MFS"] = 1; }else if (strncasecmp(word,"Head_of_House",4)==0) { status = HEAD_OF_HOUSEHOLD; L["HOH"] = 1; } else { printf("Error: unrecognized status '%s'. Must be: Single, Married/joint, Married/sep, Head_of_house.\nExiting.\n", word); fprintf(outfile,"Error: unrecognized status '%s'. Must be: Single, Married/joint, Married/sep, Head_of_house.\nExiting.\n", word); exit(1); } fprintf(outfile,"Status = %s (%d)\n", word, status); GetLine( "L1", &L[1] ); /* Federal Adjusted Gross Income */ get_parameter( infile, 's', word, "Exemptions" ); /* Exemptions, self/depend. */ get_parameters( infile, 'i', &exemptions, "Exemptions"); /* Answer YES only if Married Filing Jointly, and you and your spouse */ /* each have qualifying Ohio adjusted gross income of at least $500. */ get_parameter( infile, 's', word, "JointCredit" ); get_parameter( infile, 'b', &qualify_jfc, "JointCredit ?"); GetLine( "L14", &L[14] ); /* Earned income credit (see the worksheet on page 20). */ GetLine( "L15", &L[15] ); /* Ohio adoption credit ($1,500 per child adopted during the year). */ GetLine( "L16", &L[16] ); /* Manufacturing equipment grant. */ GetLine( "L19", &L[19] ); /* Unpaid Ohio Use Tax */ GetLine( "L21", &L[21] ); /* Ohio Tax Withheld (box 17 on your W-2) */ GetLine( "L22", &L[22] ); /* 1040ES payments, IT 40P extension payments for 2014, 2013 overpayments ... */ /* Additions - add to extent not included in fed adjusted gross income (line 1). */ GetLine( "L33", &L[33] ); /* Non-Ohio state or local gov't interest, dividends. */ GetLine( "L34", &L[34] ); /* Pass-through Entity addback. */ GetLine( "L35a", &L35a ); /* Fed int+div subject to state tax & misc. fed adj. */ L["35a"] = L35a; GetLine( "L35b", &L35b ); /* Reimbursed college tuit. fees deducted prev yrs. */ L["35b"] = L35b; GetLine( "L35c", &L35c ); /* Losses, sale of Ohio Public Obligations. */ L["35c"] = L35c; GetLine( "L35d", &L35d ); /* Nonmedical withdrawals OH Med. Savings Acct. */ L["35d"] = L35d; GetLine( "L35e", &L35e ); /* Reimb. exp. prev. deducted, if reimb. not in FAGI .*/ L["35e"] = L35e; GetLine( "L35f", &L35f ); /* Lump sum distribution add-back + misc. fed income tax adjustments */ L["35f"] = L35f; GetLine( "L35g", &L35g ); /* Adjustment for IRC section 168(k) and 179 depreciation expense */ L["35g"] = L35g; L[35] = L35a + L35b + L35c + L35d + L35e + L35f + L35g; /* Deductions - see limitations in instructions. */ GetLine( "L37a", &L37a ); /* Fed int + div exempt from state taxation. */ L["37a"] = L37a; GetLine( "L37b", &L37b ); /* Adjustment for Internal Revenue Code sections 168(k) + 179 deprec. expense */ L["37b"] = L37b; L[37] = L37a + L37b; GetLine( "L38", &L[38] ); /* Employee compensation earned in OH by non-residents. */ GetLine( "L39a", &L39a ); /* Military pay. */ L["39a"] = L39a; GetLine( "L39b", &L39b ); /* Military Retirement Income. */ L["39b"] = L39b; L[39] = L39a + L39b; GetLine( "L40a", &L40a ); /* State/municipal income tax overpayments. */ L["40a"] = L40a; GetLine( "L40b", &L40b ); /* Refund or reimbursements shown on IRS form 1040, line 21 */ L["40b"] = L40b; GetLine( "L40c", &L40c ); /* Repayment of income reported in a prior year, ... */ L["40c"] = L40c; L[40] = L40a + L40b + L40c; GetLine( "L41", &L[41] ); /* Small business investor income deduction */ GetLine( "L42", &L[42] ); /* Disab. & survivor benef. */ GetLine( "L43", &L[43] ); /* Qualifying soc. sec. + railroad benefits. */ GetLine( "L44a", &L44a ); /* Education: Ohio 529 contributions */ L["44a"] = L40a; GetLine( "L44b", &L44b ); /* Education: Ohio 529 contributions */ L["44b"] = L40b; L[44] = L44a + L44b; GetLine( "L45", &L[45] ); /* Ohio National Guard reimbursements */ GetLine( "L46a", &L46a ); /* Unreimbursed health insurance ... */ L["46a"] = L40a; GetLine( "L46b", &L46b ); /* Funds deposited into, and earnings of, a medical savings account */ L["46b"] = L40b; GetLine( "L46c", &L46c ); /* Qualified organ donor expenses */ L["46c"] = L40c; L[46] = L46a + L46b + L46c; GetLine( "L47", &L[47] ); /* Wage expense not deducted */ GetLine( "L48", &L[48] ); /* Interest income from Ohio Public Obligations ... */ GetLine( "L51", &L[51] ); /* Retirement Income Credit (see instructions for credit table) (Limit $200) */ if (L[51] > 200.0) L[51] = 200.0; GetLine( "L52", &L[52] ); /* Senior Citizen Credit (Limit $50 per return) */ if (L[52] > 50.0) L[52] = 50.0; GetLine( "L53", &L[53] ); /* Lump Sum Distribution Credit (you must be 65 years of age or older to claim this credit) */ GetLine( "L54", &L[54] ); /* Child and Dependent Care Credit (see instructions and worksheet) */ GetLine( "L55", &L[55] ); /* Lump Sum Retirement Credit */ GetLine( "L57", &L[57] ); /* Displaced worker credit (Limit $500 single; $1,000 joint, if both spouses qualify) */ if (status == MARRIED_FILLING_JOINTLY) limit = 2.0 * 500.0; else limit = 500.0; L[57] = smallerof( L[57], limit ); GetLine( "L58", &L[58] ); /* Ohio Political Contributions Credit (Limit $50 single; $100 joint) */ if (status == MARRIED_FILLING_JOINTLY) limit = 2.0 * 50.0; else limit = 50.0; L[58] = smallerof( L[58], limit ); GetLine( "L60", &L[60] ); /* Portion of line 3 subjected to tax by other states. */ GetLine( "L63", &L[63] ); /* 2014 income tax paid to other states ... */ /* For non-residents only. */ GetLine( "L65", &L[65] ); /* Portion Ohio Adj. Gross Income not earned in Oh. */ GetLine( "L68", &L[68] ); /* Nonrefundable Business Credits, Sched-E line 10 */ GetLine( "L72a", &L72a ); /* Refundable Business Jobs Credits, */ L[72] = L72a; GetLine( "L72b", &L72b ); /* Refundable Pass-through Entity Credits, */ L["72b"] = L72b; GetLine( "L72c", &L72c ); /* Refundable Histroic Preservation Credits, */ L["72c"] = L72c; GetLine( "L72d", &L72d ); /* Refundable Motion Picture Credits */ L["72d"] = L72d; GetLine( "L72e", &L72e ); /* Financial Institutions Tax (FIT) credit */ L["72e"] = L72e; L[73] = L72a + L72b + L72c + L72d + L72e; L[23] = L[73]; /* ---- Do Calculations. ---- */ L[36] = L[33] + L[34] + L[35]; for (j = 37; j <= 48; j++) L[49] = L[49] + L[j]; L[50] = L[36] - L[49]; L[2] = L[50]; L[3] = L[1] + L[2]; if (L[3] <= 40000.0) exemption_amnt = 2200.0; else if (L[3] <= 80000.0) exemption_amnt = 1950.0; else exemption_amnt = 1700.0; L[4] = exemption_amnt * exemptions; L[5] = NotLessThanZero( L[3] - L[4] ); L[6] = TaxRateFunction( L[5], status ); if (L[5] <= 10000.0) L[56] = 88.0; for (j = 51; j <= 58; j++) L[59] = L[59] + L[j]; L[7] = L[59]; L[8] = NotLessThanZero( L[6] - L[7] ); if (L[5] < 30000) L[9] = 20.0 * exemptions; L[10] = NotLessThanZero( L[8] - L[9] ); if ((status == MARRIED_FILLING_JOINTLY) && (qualify_jfc)) { /*Joint_Filing_Credit*/ if (L[5] < 25000) jfc = 0.20; else if (L[5] < 50000) jfc = 0.15; else if (L[5] < 75000) jfc = 0.10; else jfc = 0.05; L[11] = smallerof( jfc * L[10], 650.0 ); L["11p"] = jfc*100.0; } /*Joint_Filing_Credit*/ L[12] = L[10] - L[11]; /* L[13] computed below, which depends on L[71] and the following prior lines. */ L[61] = L[3]; factor62 = 0.0001 * (int)(10000.0 * (L[60] / L[61])); /* 4-digits right of decimal-pt. */ L["62p"] = factor62; L[62] = factor62 * L[12]; L[64] = smallerof( L[62], L[63] ); L[69] = L[64]; L[66] = L[3]; factor67 = 0.0001 * (int)(10000.0 * (L[65] / L[66])); /* 4-digits right of decimal-pt. */ L["67p"] = factor67; L[67] = factor67 * L[12]; L[70] = L[67]; L[71] = L[68] + L[69] + L[70]; L[13] = L[71]; /* Resuming now with calculations at line 17. */ L[17] = NotLessThanZero( L[12] - (L[13] + L[14] + L[15] + L[16]) ); L[20] = L[17] + L[18] + L[19]; L[24] = L[21] + L[22] + L[23]; if ((status == SINGLE) && (L[1] <= 12200.0) && (L[50] == 0.0)) fprintf(outfile, "You do not need to file Ohio tax return (Fed AGI < minimum).\n"); if ((status == MARRIED_FILLING_JOINTLY) && (L[1] <= 14400.0) && (L[50] == 0.0)) fprintf(outfile, "You do not need to file Ohio tax return (Fed AGI < minimum).\n"); if ((L[4] >= L[3]) && (L[50] == 0.0)) fprintf(outfile, "You do not need to file Ohio tax return (L[4] >= L[3]).\n"); /* Output the Results. */ showline(1); showline(2); showline(3); fprintf(outfile,"Exemptions = %d\n", exemptions ); for (j = 4; j <= 10; j++) showline(j); fprintf(outfile, "L10a = %6.2f\n", L[10]); for (j = 11; j <= 19; j++) showline(j); showline_wmsg( 20, "Total Ohio Tax" ); showline_wmsg( 21, "Amount Withheld" ); showline(22); showline(23); showline_wmsg( 24, "Total Payments" ); if (L[24] > L[20]) { L[25] = L[24] - L[20]; showline_wmsg( 25, "AMOUNT OVERPAID" ); } else { L[29] = L[20] - L[24]; showline_wmsg( 29, "AMOUNT DUE" ); } showline(33); showline(34); showline_wlabel( "L35a", L35a ); showline_wlabel( "L35b", L35b ); showline_wlabel( "L35c", L35c ); showline_wlabel( "L35d", L35d ); showline_wlabel( "L35e", L35e ); showline_wlabel( "L35f", L35f ); showline_wlabel( "L35g", L35g ); showline_wmsg( 36, "Total additions" ); showline_wlabel( "L37a", L37a ); showline_wlabel( "L37b", L37b ); showline(38); showline_wlabel( "L39a", L39a ); showline_wlabel( "L39b", L39b ); showline_wlabel( "L40a", L40a ); showline_wlabel( "L40b", L40b ); showline_wlabel( "L40c", L40c ); showline(41); showline(42); showline(43); showline_wlabel( "L44a", L44a ); showline_wlabel( "L44b", L44b ); showline(45); showline_wlabel( "L46a", L46a ); showline_wlabel( "L46b", L46b ); showline_wlabel( "L46c", L46c ); showline(47); showline(48); showline_wmsg( 49, "Total Deductions" ); showline_wmsg( 50, "Net adjustments" ); for (j = 51; j <= 58; j++) showline(j); showline_wmsg(59,"Total Schedule B Credits"); showline(60); showline(61); fprintf(outfile," (L62 [%g]) \t", factor62 ); for (j = 62; j <= 66; j++) showline(j); fprintf(outfile," (L67 [%g]) \t", factor67 ); for (j = 67; j <= 73; j++) showline(j); fclose(infile); fclose(outfile); outfile = fopen(it1040_xfdf_outfname,"w"); output_xfdf_form_data(outfile, it1040_2014, L); fclose(outfile); Display_File( outfname ); printf("\nResults written to file: %s\n", outfname); return 0; }