Open Source Tax Solver - TaxSolve.c

April 14, 2008
- Project - http://sourceforge.net/projects/opentaxsolver/
- Download

OpenTaxSolver (OTS) is a free program for calculating Tax Form entries and tax-owed or refund-due, such as Federal or State personal income taxes. TaxSolver has been updated for the 2007 tax-year for:   US 1040 and Schedules A, B, C, & D, and State-Taxes for California, North Carolina, New Jersey, Pennsylvania, Virginia, Ohio, New York, and Massachusetts.     Special thanks to all contributors.

Motivations:

Introduction:

The OTS tax package was intended to be used with the Tax booklets published by your government for determining what numbers you need to enter and the rules for adding/subtracting them, and then to assist you in doing the calculations, and showing you the intermediate and final numbers. Consider it an open tax spreadsheet.

The core of OTS is a text-program. Two optional graphical front-ends exist, OTS_GUI and OTS_tclgui-0.0. You can use OTS either by editing a text file with your favorite text editor, and then processing it. Or, you can use the Graphical User Interface (GUI). Probably most people now days use the GUI, and that is the default mode, according to instructions in the package. The GUI is self-explanatory. The following focuses on documenting the workings of the core text program.

You enter your input numbers in a commented text file, and then process your text file with the TaxSolve program. It is particularly useful in combination with the new Adobe PDF Fill-In forms distributed by an ever growing list of government agencies. (This solves the otherwise costly problem of producing official updated output forms, which has been one of the major drawbacks to previous open-source tax programs.) You enter your input numbers in a commented text-file, and then process your text-file with the FedTaxSolve program. It produces output the the screen, and a xx.out file, showing what you should enter on each line.
Example:

	gedit fed1040_2007.dat
	  {enter your numbers, income, interest, etc..}

	taxsolve_usa_fed1040_2007  fed1040_2007.dat
	  {view the output lines, or print default output file fed1040_2007.out,}
	  {copy numbers onto your tax forms, mail in.}
Example:
	taxsolve_usa_fed1040_2007  my_03_fed_tax.dat my_03_fed_tax.form
	more my_03_fed_tax.form
	lpr my_03_fed_tax.form
Although originally created for US 1040 tax forms, the routines can be used to solve other tax forms, and for other countries or states. Some error checking is included.

While the OTS programs developed over the last eleven years, results have always been checked against commercial packages such as TurboTax (Intuit) and TaxCut (HR Block). The answers produced by OTS have always matched to within a dollar, differing only by rounding differences.


Example screen shot.

Usage:

After unpacking, see the 0_Readme.txt file for build and running instructions. You can use OTS either from the OTS_GUI, or directly from the command-line in text-mode. To use the GUI, invoke the appropriate Run_...{.sh/.bat} script. The GUI has become fairly self-explanatory. Select a tax program and form-data file, fill-out fields, click Compute Taxes, and print your taxes.

Alternatively, you can edit the form-data file with your favorite text editor, and invoke the tax programs from the command-line. The following sections focus mostly on direct text-mode usage of OTS, as well as how it operates.

Input Format:

The format of the input file is line oriented. The lines correspond to the lines of your tax-form. For each line requiring input from you, state the line number (L#), and then enter the amount, or list the amounts which enter into that line, followed by a semi-colon. Comments can be placed anywhere by enclosing them in squiggly brackets ({}), usually at the end of each line to note what the entry is. A template file is included in each package for convenience.

Example:

	Title:  US Fed 1040 2007 Return for Molly Weber
	L7:     28,789.34 ;	{ Income }
	L13:	    		{ Interest }  
		    45.90	{  US Bank }
		    83.11	{  Credit Union }
			;
The first line, or Title line, of your input file is simply passed straight out to the output file without parsing. It serves as a way to identify the form, whom it is for, and the date or year. After the first line, the format is free-form. You can enter things anywhere, in any column, or any line you wish. The format shown above is recommended for clarity.

All entries for a given line number before a semicolon are added together. This is helpful when multiple items add into a single line. You can show each item separately with its own comment. OTS will add them together for you.

Program Structure:

The TaxSolve programs are divided into two parts:
  1. taxsolve_routines.c - Common routines for all tax forms.
  2. taxsolve_.c - Program for specific tax form. (ex. taxsolve_usa_fed1040_2007.c)
There are many variants of the second program for specific tax-years, states, countries, and auxiliary forms.

For example, supplied in the OTS package are:

  1. src / taxsolve_routines.c
  2. src / taxsolve_fed1040_2007.c - Configured for US federal 1040 for 2007.
  3. examples_and_templates / fed1040_2007_template.dat - Starting template for your tax data. A text file to place your earnings/interest/... numbers.
  4. examples_and_templates / fed1040_2007_example.dat - Example of a properly filled out input file that works with the source files above, for testing.
The most popular 1040 forms are presently available with this version. Cases handled include, single, married filing jointly, married filing separately, head of household, widow(er), with either standard deduction or itemized. Includes calculations for Schedules A, B, C, and D to calculate interest, dividends, capital gains/losses, and business taxes. Cases that go beyond are noted by stubs with warning messages saying "not presently handled". The package covers many people with common situations. Where it does not, it may require some slight and hopefully obvious/easy extension.

As currently configured the form-specific part (ex. taxsolve_.c) includes taxsolve_routines.c (with #include) and contains the main routine. You need only compile the one program.

To Compile:

Normally, you would invoke the Build-script to compile the whole package, but you could also compile individual programs directly, as for example:
      cc   taxsolve_usa_fed1040_2007.c   -o   taxsolve_usa_fed1040_2007

To Run:

Normally, you would invoke the tax programs from the graphical interface (Run_taxsolve_GUI) , but you could also invoke individual programs directly, as for example:
      taxsolve_usa_fed1040_2007     fed1040_2007.dat

... where fed1040_2007.dat is the name of -your- tax data file. (Two tax-data files are included in OTS packages: an *example.dat and a blank *template.dat. The idea is to copy the template to a personally meaningful file-name and fill in the lines with your numbers. You can maintain returns for multiple people over multiple years this way.) A file such as fed1040_2007.out is produced and is automatically listed to the screen. You can print the file or store it for your records.

Examples:


Program Design for Tax Rules:

The program reads values from your input file into it's L[] tax-form-line variables, then adds or subtracts the items according to the tax-rules, and prints the results. To do this efficiently, several convenience functions have been provided, such as GetLine and ShowLine. GetLine checks for the named line number, and adds up any contributing entries, while parsing and ignoring any comments. ShowLine prints the resulting line value in a convenient format after the line number or name. The are several variants of the convenience routines. GetLineF is a combination of GetLine and ShowLine. It gets the line data, and prints it to the output file.

Example:

 GetLine( "L7", &L[7] );
 ShowLine(7);
 GetLine( "L9", &L[9] );
 ShowLine(9);
 L[12] = L[7] + L[9];
 showline(12);
 GetLine( "L15", &L[15] );
 if (L[15] > L[12])
  L[16] = L[15] - L[12];
 else
  L[16] = 0.0;
 ShowLine(16);

Capital Gains/Losses are Recorded as:

	buy_cost	date
	sale_value	date
Buy cost is negative; it is a cost; an outlay. Date is xx-yy-zz, where xx is the two-digit month, yy is the day, and zz is the last two digits of the year. (Yes, this is Y2K proof.)
Example:
        -3658.22        12-15-99        { 100 Shares XOM }
         4209.95         1-25-02
The dates are required to apply the proper short-term or long-term capital gains rates on Federal taxes, but are not required for State tax forms.

The US Fed 1040, version includes the Schedule-A for itemized deductions, Schedule-B for interest, and Schedule-D for capital gains calculations, as well as the Alternative Minimum Tax (AMT) worksheet calculations. Schedule-C for business taxes, is also provided as a separate program. Versions for several State Income Taxes, including California, New York, Pennsylvania, Ohio, New Jersey, Virginia, Massachussets, and North Carolina are included. As other forms are contributed, they will be posted.


Download OpenTaxSolver

OpenTaxSolver can be downloaded from:     Download OpenTaxSolver - OTS Download-Page

Both source code and compiled executables are available for download. Example form-data files are included. Typical package sizes are 20-50 KB (small, not megabytes).

Unpacking
Packages are tar-gzip (.tgz) or zip files. To unpack,   tar xfz package.tgz   or   unzip package.zip . Will unpack into a directory of the same name. (To see contents prior to unpacking, tar tfz package.tgz   or   zip -l package.zip .)

Tar packages contain precompiled executables for Linux. Zip contain precompiled executables for Microsoft PCs. Source code and compilation instructions are also provided in all versions. (Uninstall by simply deleting files in the directory. No registry entries are made.)

Other Links


Feedback welcome.

SourceForge.net Logo   .   .   .  

Aston Roberts - aston_roberts@yahoo.com