diff --git a/TaxForms/2022/2022-Form-f8995.pdf b/TaxForms/2022/2022-Form-f8995.pdf new file mode 100755 index 0000000..20864aa Binary files /dev/null and b/TaxForms/2022/2022-Form-f8995.pdf differ diff --git a/TaxForms/2022/2022-ScheduleC-f1040sc.pdf b/TaxForms/2022/2022-ScheduleC-f1040sc.pdf new file mode 100755 index 0000000..3ccc8a7 Binary files /dev/null and b/TaxForms/2022/2022-ScheduleC-f1040sc.pdf differ diff --git a/TaxForms/2022/2022-ScheduleSelfEmployment-f1040sse.pdf b/TaxForms/2022/2022-ScheduleSelfEmployment-f1040sse.pdf new file mode 100755 index 0000000..6ae7070 Binary files /dev/null and b/TaxForms/2022/2022-ScheduleSelfEmployment-f1040sse.pdf differ diff --git a/TaxForms/2023/2023-Form-f8995.pdf b/TaxForms/2023/2023-Form-f8995.pdf new file mode 100755 index 0000000..13fb517 Binary files /dev/null and b/TaxForms/2023/2023-Form-f8995.pdf differ diff --git a/TaxForms/2023/2023-ScheduleC-f1040sc.pdf b/TaxForms/2023/2023-ScheduleC-f1040sc.pdf new file mode 100755 index 0000000..ef2a04c Binary files /dev/null and b/TaxForms/2023/2023-ScheduleC-f1040sc.pdf differ diff --git a/TaxForms/2023/2023-ScheduleSelfEmployment-f1040sse.pdf b/TaxForms/2023/2023-ScheduleSelfEmployment-f1040sse.pdf new file mode 100755 index 0000000..e2d9005 Binary files /dev/null and b/TaxForms/2023/2023-ScheduleSelfEmployment-f1040sse.pdf differ diff --git a/TaxForms/2024/2024-1040Schedule1-f1040s1.pdf b/TaxForms/2024/2024-1040Schedule1-f1040s1.pdf new file mode 100755 index 0000000..d5eadb0 Binary files /dev/null and b/TaxForms/2024/2024-1040Schedule1-f1040s1.pdf differ diff --git a/TaxForms/2024/2024-1040Schedule2-f1040s2.pdf b/TaxForms/2024/2024-1040Schedule2-f1040s2.pdf new file mode 100755 index 0000000..2fceae5 Binary files /dev/null and b/TaxForms/2024/2024-1040Schedule2-f1040s2.pdf differ diff --git a/TaxForms/2024/2024-1040Schedule3-f1040s3.pdf b/TaxForms/2024/2024-1040Schedule3-f1040s3.pdf new file mode 100755 index 0000000..a4eb297 Binary files /dev/null and b/TaxForms/2024/2024-1040Schedule3-f1040s3.pdf differ diff --git a/TaxForms/2024/2024-Form-f8995.pdf b/TaxForms/2024/2024-Form-f8995.pdf new file mode 100755 index 0000000..ce0b168 Binary files /dev/null and b/TaxForms/2024/2024-Form-f8995.pdf differ diff --git a/TaxForms/2024/2024-ScheduleC-f1040sc.pdf b/TaxForms/2024/2024-ScheduleC-f1040sc.pdf new file mode 100755 index 0000000..dca5e73 Binary files /dev/null and b/TaxForms/2024/2024-ScheduleC-f1040sc.pdf differ diff --git a/TaxForms/2024/2024-ScheduleSelfEmployment-f1040sse.pdf b/TaxForms/2024/2024-ScheduleSelfEmployment-f1040sse.pdf new file mode 100755 index 0000000..c078b33 Binary files /dev/null and b/TaxForms/2024/2024-ScheduleSelfEmployment-f1040sse.pdf differ diff --git a/TaxForms/2024/2024-f1040.pdf b/TaxForms/2024/2024-f1040.pdf new file mode 100755 index 0000000..0758dd4 Binary files /dev/null and b/TaxForms/2024/2024-f1040.pdf differ diff --git a/TaxInstructions/2022/i1040gi--2022.pdf b/TaxInstructions/2022/i1040gi--2022.pdf new file mode 100755 index 0000000..175bdbb Binary files /dev/null and b/TaxInstructions/2022/i1040gi--2022.pdf differ diff --git a/TaxInstructions/2022/i1040sc--2022.pdf b/TaxInstructions/2022/i1040sc--2022.pdf new file mode 100755 index 0000000..c2e7593 Binary files /dev/null and b/TaxInstructions/2022/i1040sc--2022.pdf differ diff --git a/TaxInstructions/2022/i1040sse--2022.pdf b/TaxInstructions/2022/i1040sse--2022.pdf new file mode 100755 index 0000000..214d3c2 Binary files /dev/null and b/TaxInstructions/2022/i1040sse--2022.pdf differ diff --git a/TaxInstructions/2022/i8995--2022.pdf b/TaxInstructions/2022/i8995--2022.pdf new file mode 100755 index 0000000..3068449 Binary files /dev/null and b/TaxInstructions/2022/i8995--2022.pdf differ diff --git a/TaxInstructions/2023/i1040gi--2023.pdf b/TaxInstructions/2023/i1040gi--2023.pdf new file mode 100755 index 0000000..43b3ab8 Binary files /dev/null and b/TaxInstructions/2023/i1040gi--2023.pdf differ diff --git a/TaxInstructions/2023/i1040sc--2023.pdf b/TaxInstructions/2023/i1040sc--2023.pdf new file mode 100755 index 0000000..e2f9d5a Binary files /dev/null and b/TaxInstructions/2023/i1040sc--2023.pdf differ diff --git a/TaxInstructions/2023/i1040sse--2023.pdf b/TaxInstructions/2023/i1040sse--2023.pdf new file mode 100755 index 0000000..39c09db Binary files /dev/null and b/TaxInstructions/2023/i1040sse--2023.pdf differ diff --git a/TaxInstructions/2023/i8995--2023.pdf b/TaxInstructions/2023/i8995--2023.pdf new file mode 100755 index 0000000..264dd9e Binary files /dev/null and b/TaxInstructions/2023/i8995--2023.pdf differ diff --git a/TaxInstructions/2024/i1040gi.pdf b/TaxInstructions/2024/i1040gi.pdf new file mode 100755 index 0000000..62c22ec Binary files /dev/null and b/TaxInstructions/2024/i1040gi.pdf differ diff --git a/TaxInstructions/2024/i1040sc.pdf b/TaxInstructions/2024/i1040sc.pdf new file mode 100755 index 0000000..c399816 Binary files /dev/null and b/TaxInstructions/2024/i1040sc.pdf differ diff --git a/TaxInstructions/2024/i1040sse.pdf b/TaxInstructions/2024/i1040sse.pdf new file mode 100755 index 0000000..e20ab4c Binary files /dev/null and b/TaxInstructions/2024/i1040sse.pdf differ diff --git a/TaxInstructions/2024/i8995.pdf b/TaxInstructions/2024/i8995.pdf new file mode 100755 index 0000000..1554551 Binary files /dev/null and b/TaxInstructions/2024/i8995.pdf differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin.zip b/TaxSoftware/OpenTaxSolver2024_22.07_mswin.zip new file mode 100755 index 0000000..a9aa528 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin.zip differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/0_README.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/0_README.txt new file mode 100755 index 0000000..0c401c7 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/0_README.txt @@ -0,0 +1,148 @@ +Open Tax Solver - Package +-------------------------- + +April 28, 2025 v22.07 - For Tax-Year 2024. + +See project homepage: http://opentaxsolver.sourceforge.net/ + +OpenTaxSolver (OTS) is a set of programs and templates for helping you +fill out your income tax forms. It performs the tedious arithmetic. +OTS is intended to assist those who normally prepare their tax forms +themselves, and who generally know on which lines to enter their numbers. +It is meant to be used in combination with the instruction booklet +corresponding to a given form. + +This package contains programs and templates for: + - US-1040 - which also does the Schedules A, B, D, and forms 8949. + - Schedule C for US-1040. + - State Income Taxes for Ohio, New Jersey, Virginia, Pennsylvania, + Massachusetts, North Carolina, and California taxes updated for + the 2024 Tax-Year. +Also contains an Automatic PDF Form-Fillout function: + - Supports all Federal Forms and State Forms. + Saves time by filling out many of the numbers. + You may still need to enter some information or check boxes + that are not handled by OTS. + Tested to work properly with many PDF viewers. + - You can edit your forms with Libre-Office. + +----------------------------------------------------------- +--- This package contains executables for MS-Windows. --- +----------------------------------------------------------- + (Compiled on MS-Windows-11) + (Works on MS-Windows 10 and 11. ) + +History: + * v22.07 (4/28/2025) - Improved result-rounding, now controlable from + the OTS GUI, or directly from individual files, which only affects PDF + Form fill-outs, and works uniformly for all forms. In Fed Form 1040, + added switch for Qualified Charitable Distributions (QCD) after line 4b. + Fixed Fed-1040 tax-breaakpoint for Head-of-Household. + In NY State Form, added special limit for MFJ on line 29. + Fixes to Sched-SE, added Minister checkbox, and now prints line 3. + Provided visibility of STA_VAGI in Virginia PDF form. + * v22.06 (3/15/2025) - Switched formatting of Fed-1040, and related + Federal Forms to Round-to-Whole dollars. Added ability to fill-in + PIN numbers in Fed-1040. Added ability to check request for Health + info on the CA-540 PDF Form. Updated the Form 8829 template. + Added initial version of Oregon State tax form program. + * v22.05 (3/6/2025) - Promoted the new MI State form to front GUI panel. + Fixed the new MI State form line 34. In OH State form's optional + information section, added second address line, and county-code. + In AZ State form, now sets line 29a limit according to the number + of tax-payers. Removed quotes around Dependent names in Form-1040 + output to ease parsing in new form programs using 1040 output. + * v22.04 (2/28/2025) - The PDF fill-out program can now suppress + negative signs for form-lines enclosed in parenthesis, which + are expected to be negative (by accounting notation). + As for example on Schedule-D, lines 14 and 21. + Added Fed-1040 Sched-D lines 1a and 8a, for those who receive + Forms 1099-B on some transactions. + * v22.03 (2/12/2025) - Fixed stray comma in Fed 1040 and 2210 tax-table. + Added click-able instructions for forms 8602, 8812, 8895, 8959, and 8960. + Added option in GUI to set a custom save-directory instead of the default, + Invoke ots_gui with command-line option '-help' to see the option(s). + * v22.02 (2/6/2025) - Added initial preliminary version of Michigan + State tax form. + - Added options to Run_taxsolve_GUI for enlarging window and text + for Hi-DPI screens. (Invoke Run_taxsolve_GUI with '-large'.) + - Added entries for fed-1040 to enter refund direct deposit info. + * v22.01 (1/30/2025) - Added the NY State PDF form. + - Updated Federal Form F2210, and CA-540 State programs. + * v22.00 (1/27/2025) - Preliminary release for Tax-Year 2024. + - Includes updates for many of the run-able forms. + - Although the tax-program for NY State has been updated, we are + still waiting for Dept of Taxation to post NY's PDF Form. + - Please check back for more updates. + +Usage: + Invoke by running: Run_taxsolve_GUI + (Located in the top directory.) + + For Auto-Fillout of PDF Forms, click the "Print" button, and select + "Automatically Fill-out PDF Tax-Form", then click "Print". + You can set your preferred PDF viewer by the (Set PDF Viewer) button, + or by setting the environment variable: PDF_VIEWER + The Auto-Fillout feature is tested to work properly with the PDF + viewers "Google-Chrome", "Firefox", "LibreOffice", "Atril", "Xpdf", + "Safari", "IE", "Edge", and "Acrobat Reader". + You can edit your filled-out PDF forms with LibreOffice. + +General: +Example tax-data files and blank starting templates are included under +the "tax_form_files" directory. For each filer, save filled-out +template to a new name, such as "fed1040_2024.txt". After filling-in the +lines, then run the tax solver on it. From the GUI, this is done by +pressing "Compute Tax" button. +Or solvers can be run from the command-line, for example, as: + bin/taxsolve_usfed1040_2024 Fed1040_2024.txt +Where "Fed1040_2024.txt" is the name of -your- tax-data file, which +you can edit with your favorite text-editor to fill it in or print +it out. Output results are saved to "..._out.txt" files +(eg. Fed1040_2024_out.txt), and can be printed out directly too. + +For updates and further information, see: + http://sourceforge.net/projects/opentaxsolver/ +Documentation: + http://opentaxsolver.sourceforge.net/ + +Re-compiling: + Unix/Linux/Mac: + Pre-compiled executables for Unix/Linux are normally in bin directory. + However to build the binaries in the bin/ directory: + cd OpenTaxSolver2024_22.xx ( cd into top directory. ) + rm ./bin/* Run_taxsolve_GUI ( Clears executables. ) + src/Build_taxsolve_packages.sh ( Creates executables. ) + + MS-Windows: + Pre-compiled executables are normally in bin directory. + For compiling OTS on MSwindows, MinGW with Msys is recommended. + From Msys terminal window: + cd OpenTaxSolver2024_18.xx ( cd into top directory. ) + rm ./bin/* Run_taxsolve_GUI.exe ( Clears executables. ) + src/Build_taxsolve_packages.sh ( Creates executables. ) + +Directory Structure: +OpenTaxSolver2024 ...................................... 25.246-KB + |-- src ................................................. 217.555-KB + | |-- Gui_gtk ......................................... 141.807-KB + | + |-- tax_form_files ...................................... 49.152-KB + | |-- VA_760 .......................................... 11.038-KB + | |-- US_1040_Sched_C ................................. 12.803-KB + | |-- US_1040 ......................................... 21.351-KB + | |-- PA_40 ........................................... 11.562-KB + | |-- OH_1040 ......................................... 14.860-KB + | |-- NY_IT201 ........................................ 14.686-KB + | |-- NJ_1040 ......................................... 14.124-KB + | |-- NC_400 .......................................... 12.251-KB + | |-- MA_1 ............................................ 13.844-KB + | |-- CA_540 .......................................... 13.166-KB + | + |-- bin ................................................. 351.033-KB +16 Directories. + +--------------------------------------------------------------------------------- +Aston Roberts (aston_roberts@yahoo.com) +File Organization and Makefiles by: Krish Krothapalli, David Masterson, & Jesse Becker +Programs contain contributions by many others. See OTS credits webpage. diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/Run_taxsolve_GUI.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/Run_taxsolve_GUI.exe new file mode 100755 index 0000000..d183d96 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/Run_taxsolve_GUI.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/Run_taxsolve_GUI_DarkTheme.bat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/Run_taxsolve_GUI_DarkTheme.bat new file mode 100755 index 0000000..7a71fd3 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/Run_taxsolve_GUI_DarkTheme.bat @@ -0,0 +1,3 @@ +set GTK_THEME=Adwaita:dark +set path=bin;%PATH% +ots_gui3.exe diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/Run_taxsolve_GUI_Large.bat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/Run_taxsolve_GUI_Large.bat new file mode 100755 index 0000000..b166eca --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/Run_taxsolve_GUI_Large.bat @@ -0,0 +1 @@ +Run_taxsolve_GUI.exe -large diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/convert_results2xfdf.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/convert_results2xfdf.exe new file mode 100755 index 0000000..1cf963c Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/convert_results2xfdf.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libatk-1.0-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libatk-1.0-0.dll new file mode 100755 index 0000000..732ab0d Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libatk-1.0-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libbrotlicommon.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libbrotlicommon.dll new file mode 100755 index 0000000..6e49a79 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libbrotlicommon.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libbrotlidec.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libbrotlidec.dll new file mode 100755 index 0000000..c67e14b Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libbrotlidec.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libbz2-1.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libbz2-1.dll new file mode 100755 index 0000000..6f7db48 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libbz2-1.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libcairo-2.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libcairo-2.dll new file mode 100755 index 0000000..d04270a Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libcairo-2.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libcairo-gobject-2.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libcairo-gobject-2.dll new file mode 100755 index 0000000..90dbec7 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libcairo-gobject-2.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libdatrie-1.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libdatrie-1.dll new file mode 100755 index 0000000..672e292 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libdatrie-1.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libepoxy-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libepoxy-0.dll new file mode 100755 index 0000000..dda4f29 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libepoxy-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libexpat-1.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libexpat-1.dll new file mode 100755 index 0000000..78cd67b Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libexpat-1.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libffi-8.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libffi-8.dll new file mode 100755 index 0000000..77212de Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libffi-8.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libfontconfig-1.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libfontconfig-1.dll new file mode 100755 index 0000000..42edff5 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libfontconfig-1.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libfreetype-6.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libfreetype-6.dll new file mode 100755 index 0000000..0b4250e Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libfreetype-6.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libfribidi-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libfribidi-0.dll new file mode 100755 index 0000000..d2ab618 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libfribidi-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgcc_s_seh-1.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgcc_s_seh-1.dll new file mode 100755 index 0000000..42ecb3a Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgcc_s_seh-1.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgdk-3-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgdk-3-0.dll new file mode 100755 index 0000000..17506aa Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgdk-3-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgdk-win32-2.0-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgdk-win32-2.0-0.dll new file mode 100755 index 0000000..864ddde Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgdk-win32-2.0-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgdk_pixbuf-2.0-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgdk_pixbuf-2.0-0.dll new file mode 100755 index 0000000..4a0d9bf Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgdk_pixbuf-2.0-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgio-2.0-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgio-2.0-0.dll new file mode 100755 index 0000000..3eca0dd Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgio-2.0-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libglib-2.0-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libglib-2.0-0.dll new file mode 100755 index 0000000..e87fb87 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libglib-2.0-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgmodule-2.0-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgmodule-2.0-0.dll new file mode 100755 index 0000000..169bfbd Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgmodule-2.0-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgobject-2.0-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgobject-2.0-0.dll new file mode 100755 index 0000000..97fc34f Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgobject-2.0-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgraphite2.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgraphite2.dll new file mode 100755 index 0000000..9b5178a Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgraphite2.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgtk-3-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgtk-3-0.dll new file mode 100755 index 0000000..2a17f63 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgtk-3-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgtk-win32-2.0-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgtk-win32-2.0-0.dll new file mode 100755 index 0000000..8a28140 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libgtk-win32-2.0-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libharfbuzz-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libharfbuzz-0.dll new file mode 100755 index 0000000..f238974 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libharfbuzz-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libiconv-2.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libiconv-2.dll new file mode 100755 index 0000000..34abf65 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libiconv-2.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libintl-8.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libintl-8.dll new file mode 100755 index 0000000..2aed7ad Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libintl-8.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpango-1.0-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpango-1.0-0.dll new file mode 100755 index 0000000..e86c4cf Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpango-1.0-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpangocairo-1.0-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpangocairo-1.0-0.dll new file mode 100755 index 0000000..cd072eb Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpangocairo-1.0-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpangoft2-1.0-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpangoft2-1.0-0.dll new file mode 100755 index 0000000..8b17f74 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpangoft2-1.0-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpangowin32-1.0-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpangowin32-1.0-0.dll new file mode 100755 index 0000000..a4fe820 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpangowin32-1.0-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpcre2-8-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpcre2-8-0.dll new file mode 100755 index 0000000..0349abf Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpcre2-8-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpixman-1-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpixman-1-0.dll new file mode 100755 index 0000000..535ea7c Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpixman-1-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpng16-16.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpng16-16.dll new file mode 100755 index 0000000..4e7c3ac Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libpng16-16.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libstdc++-6.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libstdc++-6.dll new file mode 100755 index 0000000..141034a Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libstdc++-6.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libthai-0.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libthai-0.dll new file mode 100755 index 0000000..b931aad Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libthai-0.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libwinpthread-1.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libwinpthread-1.dll new file mode 100755 index 0000000..6a416f7 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/libwinpthread-1.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/notify_popup.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/notify_popup.exe new file mode 100755 index 0000000..a7893e2 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/notify_popup.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/notify_popup3.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/notify_popup3.exe new file mode 100755 index 0000000..2525216 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/notify_popup3.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/ots_gui2.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/ots_gui2.exe new file mode 100755 index 0000000..072f96a Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/ots_gui2.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/ots_gui3.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/ots_gui3.exe new file mode 100755 index 0000000..4ba5c04 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/ots_gui3.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_AZ_140_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_AZ_140_2024.exe new file mode 100755 index 0000000..7d1d9f1 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_AZ_140_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_CA_540_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_CA_540_2024.exe new file mode 100755 index 0000000..6d20387 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_CA_540_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_CA_5805_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_CA_5805_2024.exe new file mode 100755 index 0000000..deaa588 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_CA_5805_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_HSA_f8889.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_HSA_f8889.exe new file mode 100755 index 0000000..3ceb3b0 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_HSA_f8889.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_MA_1_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_MA_1_2024.exe new file mode 100755 index 0000000..72cfecf Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_MA_1_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_MI_1040_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_MI_1040_2024.exe new file mode 100755 index 0000000..9e034f9 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_MI_1040_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_NC_D400_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_NC_D400_2024.exe new file mode 100755 index 0000000..358fcb6 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_NC_D400_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_NJ_1040_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_NJ_1040_2024.exe new file mode 100755 index 0000000..3cb315f Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_NJ_1040_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_NY_IT201_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_NY_IT201_2024.exe new file mode 100755 index 0000000..9df36fd Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_NY_IT201_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_OH_IT1040_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_OH_IT1040_2024.exe new file mode 100755 index 0000000..f621699 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_OH_IT1040_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_OR_40_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_OR_40_2024.exe new file mode 100755 index 0000000..eb422fc Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_OR_40_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_PA_40_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_PA_40_2024.exe new file mode 100755 index 0000000..275c83e Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_PA_40_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_US_1040_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_US_1040_2024.exe new file mode 100755 index 0000000..265f703 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_US_1040_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_US_1040_Sched_C_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_US_1040_Sched_C_2024.exe new file mode 100755 index 0000000..28dd537 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_US_1040_Sched_C_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_US_1040_Sched_SE_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_US_1040_Sched_SE_2024.exe new file mode 100755 index 0000000..ebbe271 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_US_1040_Sched_SE_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_VA_760_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_VA_760_2024.exe new file mode 100755 index 0000000..af859b1 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_VA_760_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f2210_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f2210_2024.exe new file mode 100755 index 0000000..09a885d Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f2210_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f8606.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f8606.exe new file mode 100755 index 0000000..18bdb68 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f8606.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f8812_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f8812_2024.exe new file mode 100755 index 0000000..a80a0f1 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f8812_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f8829_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f8829_2024.exe new file mode 100755 index 0000000..4a5675f Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f8829_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f8959_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f8959_2024.exe new file mode 100755 index 0000000..9509b51 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f8959_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f8960_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f8960_2024.exe new file mode 100755 index 0000000..e512dd5 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f8960_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f8995_2024.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f8995_2024.exe new file mode 100755 index 0000000..8aa246f Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/taxsolve_f8995_2024.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/universal_pdf_file_modifier.exe b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/universal_pdf_file_modifier.exe new file mode 100755 index 0000000..7782bf5 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/universal_pdf_file_modifier.exe differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/zlib1.dll b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/zlib1.dll new file mode 100755 index 0000000..93c94c5 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/bin/zlib1.dll differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Build_taxsolve_packages.sh b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Build_taxsolve_packages.sh new file mode 100755 index 0000000..0dda24f --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Build_taxsolve_packages.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +TAXSOLVEDIR=${PWD}/`dirname $0` + +if [ ! -d ${TAXSOLVEDIR}/../bin ] ; then + mkdir ${TAXSOLVEDIR}/../bin +fi + +cd ${TAXSOLVEDIR}/Gui_gtk/ + make + +cd "${TAXSOLVEDIR}" +make + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/Readme.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/Readme.txt new file mode 100755 index 0000000..f9f7bd8 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/Readme.txt @@ -0,0 +1,13 @@ +OTS_GUI2.c - This directory contains source code for a new alternate version +of the Open Tax Solver (OTS) Graphical User Interface (GUI). This version +is based on the GIMP Tool Kit (Gtk) widget library. Gtk supports modern +platforms from a single source code program with a modern look and feel. + +The environment variable "PDF_VIEWER" can be used to set which PDF-Viewer +the the OTS-GUI will use, as well as the path to it. + + +OTS_GUI3.c - Upcoming version for the OTS-GUI for compilation under the +newer Gtk-3 graphics library. Included for initial testing and development. +To compile: + make -f make_gtk3 diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/backcompat.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/backcompat.c new file mode 100755 index 0000000..77b7c6c --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/backcompat.c @@ -0,0 +1,24 @@ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA. */ +/* */ + +void gtk_menu_item_set_label( void *menu_item, char *word ) {;} + +int cairo_format_stride_for_width( int x, int wdth ) +{ + return 4 * wdth; // + wdth % 4; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/gtk_file_browser.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/gtk_file_browser.c new file mode 100755 index 0000000..7cd621e --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/gtk_file_browser.c @@ -0,0 +1,1074 @@ +/* ------------------------ Begin File Browser --------------------------*/ +/* (The Default Gtk file browser widget was confusing for users, and did not + offer the file filtering and date-display flexibility we need. So we built + a better one here, which does exactly what we need it to.) +*/ +#include + +#define FB_DEBUG if (0) +#define MXLEN 8192 +#define SHOWFILESIZE 0 + +#if (SHOWFILESIZE == 1) + #define FB_COLUMNS 4 +#else + #define FB_COLUMNS 3 +#endif + +GtkWidget *fbwindow=0, *fbcrdirwin=0; +GtkEntry *fb_filename_formbox, *fb_wildcard_formbox; +int fb_maxlen, fb_dirsonly, fb_allowfiles=1, fb_showdotfiles=0, fb_selection_count; +char fb_filename[MXLEN], fb_dirname[MXLEN], fb_wildcard[MXLEN], fb_wildcard_default[MXLEN]="", *fb_prompt; +char *fb_fnptr, *fb_dnptr, *fb_wcptr, fb_Selected[2][MXLEN]={"",""}; +void (*fb_callback)(char *fname); /* Callback function for filebrowser. */ + + +struct fb_data_rec + { + char *prompt, *directory, *wildcards, *filename; + int maxlength; + void (*callback)(char *fname); + } fbdata; + + +struct fb_word_list_item + { + char *word; + struct fb_word_list_item *nxt; + } *fb_altdirs=0, /* List of alternate directories or files to suggest. */ + *fb_banned=0, /* List of file-names to ignore (filter-out). */ + *fb_banned_dir=0; /* List of directory-names to ignore (filter-out). */ + +void fb_clear_word_list( struct fb_word_list_item **list ) +{ struct fb_word_list_item *item; + while (*list != 0) + { + item = *list; + *list = item->nxt; + free( item->word ); + free( item ); + } +} + + +int fb_strcasestr( char *haystack, char *needle ) +{ + int j=0; + char *thaystack, *tneedle, *ret; + thaystack = strdup( haystack ); + while (thaystack[j] != '\0') + { + thaystack[j] = toupper( thaystack[j] ); + j++; + } + tneedle = strdup( needle ); + j = 0; + while (tneedle[j] != '\0') + { + tneedle[j] = toupper( tneedle[j] ); + j++; + } + ret = strstr( thaystack, tneedle ); + free( thaystack ); + free( tneedle ); + if (ret != 0) + return 1; + else + return 0; +} + + +char *strdup_padded( char *instr ) +{ /* Duplicate string with some extra space to allow expansion. */ + int j; + char *outstr; + j = strlen( instr ); + outstr = (char *)malloc( j + j/4 + 128 ); + strcpy( outstr, instr ); + return outstr; +} + + +void fb_add_word_to_end_of_list( struct fb_word_list_item **list, char *word ) +{ + struct fb_word_list_item *newitem, *lastitem; + newitem = (struct fb_word_list_item *)malloc( sizeof(struct fb_word_list_item) ); + newitem->word = strdup(word); + newitem->nxt = 0; + if (*list == 0) + *list = newitem; + else + { + lastitem = *list; + while (lastitem->nxt != 0) lastitem = lastitem->nxt; + lastitem->nxt = newitem; + } +} + + +void fb_add_optional_dirfile( char *dir_or_file ) /* Provides method to suggest alternate directory(s) via pull-down. */ +{ + struct fb_word_list_item *item; + item = fb_altdirs; /* First make sure directory is not already on the list. */ + while ((item != 0) && (strcmp( item->word, dir_or_file ) != 0)) + item = item->nxt; + if (item == 0) + fb_add_word_to_end_of_list( &fb_altdirs, dir_or_file ); +} + +void fb_clear_optional_dirfiles() /* Clears all previous list entries. */ +{ fb_clear_word_list( &fb_altdirs ); } + +void fb_clear_last_selected() { fb_Selected[0][0] = '\0'; } + +void cancel_fbwindow( GtkWidget *widget, gpointer data ) +{ + if (fbwindow != 0) gtk_widget_destroy( fbwindow ); + fbwindow = 0; + fb_Selected[0][0] = '\0'; + if (fbcrdirwin) close_any_window( widget, &fbcrdirwin ); +} + + +void fb_ban_files( char *banstr ) +{ + fb_add_word_to_end_of_list( &fb_banned, banstr ); +} + + +void fb_ban_dirs( char *banstr ) +{ + fb_add_word_to_end_of_list( &fb_banned_dir, banstr ); +} + + +void fb_clear_banned_files() +{ + struct fb_word_list_item *olditem; + while (fb_banned) + { + olditem = fb_banned; + fb_banned = fb_banned->nxt; + free( olditem->word ); + free( olditem ); + } +} + + +int not_banned( char *name ) +{ /* Returns 1 if filename is not on the banned list, else returns 0. */ + struct fb_word_list_item *item; + item = fb_banned; + while (item && (fb_strcasestr( name, item->word ) == 0)) + item = item->nxt; + if (item) + return 0; + else + return 1; +} + + +int not_banned_dir( char *name ) +{ /* Returns 1 if dir-name is not on list of banned directory names, else returns 0. */ + struct fb_word_list_item *item; + item = fb_banned_dir; + while (item && (fb_strcasestr( name, item->word ) == 0)) + item = item->nxt; + if (item) + return 0; + else + return 1; +} + + +void BrowseFiles0( char *prompt, int maxlength, char *directory, char *wildcards, char *filename, void (*callback)(char *fname) ); /* Prototype. */ + +void fb_wildcard_accept( GtkWidget *widget, gpointer data ) +{ + get_formbox_text( fb_wildcard_formbox, fb_wildcard, 500 ); + FB_DEBUG printf("accpted wildcard '%s'\n", fb_wildcard); + BrowseFiles0( fb_prompt, fb_maxlen, fb_dirname, fb_wildcard, fb_filename, fb_callback ); +} + + +void fb_wildcard_clear( GtkWidget *widget, gpointer data ) +{ + fb_wildcard[0] = '\0'; + modify_formbox( fb_wildcard_formbox, fb_wildcard ); + FB_DEBUG printf("cleared wildcard '%s'\n", fb_wildcard ); + BrowseFiles0( fb_prompt, fb_maxlen, fb_dirname, fb_wildcard, fb_filename, fb_callback ); +} + + +void fb_wildcard_restore( GtkWidget *widget, gpointer data ) +{ + strcpy( fb_wildcard, fb_wildcard_default ); + modify_formbox( fb_wildcard_formbox, fb_wildcard ); + FB_DEBUG printf("cleared wildcard '%s'\n", fb_wildcard ); + BrowseFiles0( fb_prompt, fb_maxlen, fb_dirname, fb_wildcard, fb_filename, fb_callback ); +} + + + +void fb_next_word( char *line, char *word, char *delim ) +{ + int i=0, j=0, m=0, nodelim=1; + while ((line[i]!='\0') && (nodelim)) /* Consume any preceding white-space. */ + { + j = 0; + while ((delim[j]!='\0') && (line[i]!=delim[j])) j = j + 1; + if (line[i]==delim[j]) { i = i + 1; } else nodelim = 0; + } + while ((line[i]!='\0') && (!nodelim)) /* Copy the word until the next delimiter. */ + { + word[m++] = line[i++]; + if (line[i]!='\0') + { + j = 0; + while ((delim[j]!='\0') && (line[i]!=delim[j])) j = j + 1; + if (line[i]==delim[j]) nodelim = 1; + } + } + j = 0; /* Shorten line. */ + while (line[i]!='\0') { line[j++] = line[i++]; } + /* Terminate the char-strings. */ + line[j] = '\0'; + word[m] = '\0'; +} + + +#ifndef __MINGW32__ + #define FB_DIRSEP_CHR '/' /* POSIX File directory delimiter. */ + #define FB_DIRSEP_STR "/" + #define FB_RTN_CHR '\n' /* Character returned by carriage-return key. */ +#else + #define FB_DIRSEP_CHR '\\' /* MS-win File directory delimiter. */ + #define FB_DIRSEP_STR "\\" + #define FB_RTN_CHR '\n' /* Character returned by carriage-return key. */ +#endif + + +void fb_shorten_string_at_front( char *string, int n ) +{ int k=0; + do { string[k] = string[k+n]; k++; } + while (string[k-1] != '\0'); +} + +void fb_eliminate_leading_dot( char *fname ) /* Remove leading dot-slash (./), not needed. */ +{ + while ((fname[0] == '.') && (fname[1] == FB_DIRSEP_CHR)) + fb_shorten_string_at_front( &(fname[0]), 2 ); +} + + +#include +#include +#include +#include +#include + +void fb_unify_slashes( char *name, char oldslash, char newslash ) +{ + int j=0; + while (name[j] != '\0') + { if (name[j] == oldslash) name[j] = newslash; j++; } +} + + +void fb_reduce_pathname( char *fname ) +{ + int j, k=0, nsegs=0; + char *twrd, *dseg[400]; + + if (fname[0] == '\0') return; + FB_DEBUG printf("REDUCING '%s'\n", fname); + fb_unify_slashes( fname, '\\', '/' ); /* Unify to a single type of slash (dir-separator) for sanity. */ + + if (strcmp(fname,".")==0) fname[0] = '\0'; /* Do not need dot (.) explicitly for current directory. */ + + while ( strstr(fname, "//") ) /* Remove any double-slashes. */ + { fb_shorten_string_at_front( strstr(fname, "//"), 1 ); } + + while ((fname[0] == '.') && (fname[1] == '/')) + fb_shorten_string_at_front( &(fname[0]), 2 ); + + k = strlen( fname ) - 1; /* Check for and remove any trailing slash. */ + #ifdef __MINGW32__ + if ((k == 1) && (fname[k] == ':')) { strcat(fname, "\\"); return; } + if ((k == 2) && (fname[k-1] == ':') && (fname[k] == '/')) + { fname[k] = '\\'; return; } + #endif + if ((k > 0) && (fname[k] == '/')) fname[k] = '\0'; + if (fname[0] == '\0') return; + + /* Separate path into segments. */ + twrd = (char *)malloc( MXLEN ); + k = 0; + while ((fname[k] != '\0') && (nsegs < 400)) + { + j = 0; + while ((fname[k] != '\0') && (fname[k] != '/') && (j < MXLEN-1)) + twrd[j++] = fname[k++]; + if ((nsegs == 0) && (j == 0) && (fname[k] == '/')) twrd[j++] = fname[k]; + twrd[j] = '\0'; + dseg[nsegs++] = strdup( twrd ); + if (fname[k] == '/') k++; + } + free( twrd ); + + /* Reconstruct path name from the segments, but skip any 'aa/..' pairs, where 'aa' is not '..'. */ + k = 0; + strcpy( fname, dseg[k++] ); + if ((fname[0] != '\0') && (fname[1] == ':') && (fname[2] == '\0')) strcat( fname, "/" ); + while (k < nsegs) + { + if ((k < nsegs - 1) && ((strcmp( dseg[k+1], "..") == 0) && (strcmp( dseg[k], "..") != 0))) + k = k + 2; + else + { + j = strlen(fname) - 1; + if ((j >= 0) && (fname[j] != '/')) strcat( fname, "/" ); + strcat( fname, dseg[k++] ); + } + } + twrd = &(fname[0]); + #ifdef __MINGW32__ + if ((fname[0] != '\0') && (fname[1] == ':')) twrd = &(fname[2]); + #endif + if (strcmp( twrd, "/.." ) == 0) strcpy( twrd, "/"); + + #ifdef __MINGW32__ + fb_unify_slashes( fname, '/', '\\' ); /* Make slashes be appropriate to platform. */ + if ((fname[0] != '\0') && (fname[1] == ':') && (fname[2] == '\0')) + strcat( fname, "\\" ); + #endif +} + + +void fb_EnvironVarFilter( char *fname ) +{ /* Intercept and replace any defined environment variables in file-names. */ + int k=0, j, m, n, p, seppt=1; + char twrd[2048], *evar; + + if (strchr(fname,'$') == 0) return; + while ((k < 2048-1) && (fname[k] != '\0')) + { /*lookfor$*/ + if ((seppt) && (fname[k] == '$')) + { /*replace_envvar*/ + k++; /* Grab just the env-var name. */ + j = 0; m = k; + while ((m < 2048-1) && (fname[m] != '/') && (fname[m] != '\\') && (fname[m] != '\0')) + { twrd[j++] = fname[m++]; } + twrd[j] = '\0'; + evar = getenv(twrd); + if (evar) + { + k--; + n = strlen(evar); + p = n - m + k; + if (p > 0) + { /*expand string*/ + n = strlen(fname); + while (n >= m) { fname[n+p] = fname[n]; n--; } + } + else + if (p < 0) + { /*shrink string.*/ + n = m + p; + do { fname[n] = fname[n-p]; n++; } while (fname[n-1] != '\0'); + } + p = 0; /* Copy evar into position. */ + while (evar[p] != '\0') fname[k++] = evar[p++]; + } + else + k = m; + } /*replace_envvar*/ + else + { + if ((fname[k] == '/') || (fname[k] == '\\')) seppt = 1; else seppt = 0; + k++; + } + } /*lookfor$*/ +} + + +void fb_accept( GtkWidget *widget, void *data ) /* Determine if selected file is a directory or regular file. */ +{ /* If it is a directory, then open browser to that directory, otherwise return file's-name. */ + char *pathname; + struct stat buf; + int k, erno; + + get_formbox_text( fb_filename_formbox, fb_filename, MXLEN ); + FB_DEBUG printf("accepted file '%s/%s'\n", fb_dirname, fb_filename); + + if (strcmp(fb_filename,".") == 0) { fb_dirname[0] = '\0'; } + fb_EnvironVarFilter( fb_filename ); + fb_reduce_pathname( fb_filename ); + + if ((fb_filename[0] == FB_DIRSEP_CHR) || ((fb_filename[0] != '\0') && (fb_filename[1] == ':'))) + fb_dirname[0] = '\0'; /* If filename contains full absolute path, then erase old path from dirname. */ + else /* Otherwise, a relative path was given. */ + fb_eliminate_leading_dot( fb_filename ); + + /* Construct the new full-path name of the file or directory that was selected. */ + pathname = (char *)malloc(MXLEN); + strcpy_safe( pathname, fb_dirname, MXLEN); + k = strlen(pathname) - 1; /* Remove the trailing slash from the directory name, if any. */ + if ((k > 0) && (pathname[k] == FB_DIRSEP_CHR)) pathname[k] = '\0'; + if (pathname[0] != '\0') strcat(pathname, FB_DIRSEP_STR); /* Add trailing slash to directory name. */ + strcat( pathname, fb_filename ); /* Append the file-name portion to create full path name. */ + fb_eliminate_leading_dot( pathname ); + fb_reduce_pathname( pathname ); + FB_DEBUG printf("Returning0 filename '%s'\n", pathname ); + + erno = stat( pathname, &buf ); + FB_DEBUG printf(" Erno = %d, Regular? = %d\n", erno, S_ISREG(buf.st_mode) ); + if ((erno == 0) && (S_ISDIR(buf.st_mode)) && ((fb_dirsonly == 0) || (data != 0))) + { /*Traverse directories*/ + // printf("Traversing directory\n"); + FB_DEBUG printf("Traversing directory\n"); + cancel_fbwindow(0,0); /* Close the fbrowser window. */ + strcpy_safe(fb_dirname, pathname, fb_maxlen); + strcpy_safe(fb_filename,"", fb_maxlen); + BrowseFiles0( fb_prompt, fb_maxlen, fb_dirname, fb_wildcard, fb_filename, fb_callback ); + } + else + { /*Regular_file*/ + if (erno != 0) printf("File does not exist: '%s'\n", pathname ); + FB_DEBUG printf("Returning1 filename '%s'\n", pathname ); + if ((erno == 0) && (fb_dirsonly) && (!S_ISDIR(buf.st_mode)) && (! fb_allowfiles)) + { free(pathname); return; } + FB_DEBUG printf("Returning2 filename '%s'\n", pathname ); + cancel_fbwindow(0,0); /* Close the fbrowser window. */ + FB_DEBUG printf("Returning3 filename '%s'\n", pathname ); + /* Separate directory path-name and 'potential' file-name, into appropriate parts. */ + k = strlen( pathname ) - 1; /* Find last slash, if any. */ + while ((k >= 0) && (pathname[k] != FB_DIRSEP_CHR)) k--; + if (k < 1) /* If no slash(es) after leading position. */ + { fb_dirname[0] = '\0'; strcpy( fb_filename, pathname ); } /* Place all in filename. */ + else + { strcpy( fb_dirname, pathname ); fb_dirname[k] = '\0'; strcpy( fb_filename, &(pathname[k+1]) ); } + // printf("fb_dirname='%s', fb_filename='%s', pathname='%s'\n", fb_dirname, fb_filename, fb_filename ); + strcpy_safe( fb_fnptr, fb_filename, fb_maxlen ); + strcpy_safe( fb_dnptr, fb_dirname, fb_maxlen ); + strcpy_safe( fb_wcptr, fb_wildcard, fb_maxlen ); + FB_DEBUG printf("Returning filename '%s'\n", pathname ); + // printf("Returning filename '%s'\n", pathname ); + + fb_callback( pathname ); + free(pathname); + } +} + + + +void fb_select( GtkWidget *wdg, void *data ) +{ char *fname; + GtkTreeIter iter; + GtkTreeModel *model; + + if (wdg == 0) + { + fname = (char *)data; + modify_formbox( fb_filename_formbox, fname ); + } + else + { + if (gtk_tree_selection_get_selected( GTK_TREE_SELECTION(wdg), &model, &iter )) + { + fb_selection_count++; + gtk_tree_model_get( model, &iter, FB_COLUMNS - 1, &fname, -1 ); + FB_DEBUG printf("selected file item '%s'\n", fname ); + if (fname[0] == '\0') return; + modify_formbox( fb_filename_formbox, fname ); + } + } +} + + +void fb_select_and_go( GtkWidget *widget, gpointer fname ) +{ + char *name=(char *)fname; + modify_formbox( fb_filename_formbox, name ); + strcpy( fb_Selected[1], fb_Selected[0] ); + strcpy( fb_Selected[0], name ); + fb_dirname[0] = '\0'; + fb_select( 0, fname ); + fb_accept( 0, "x" ); /* The "x" give non-null argument allowing immediate fb-redraw. */ +} + + +void fb_truncate_fname( char *truncname, char *origfname, int n ) /* Limit file names to no longer than n characters. */ +{ + if (strlen(origfname) > n) + { + strcpy_safe( truncname, origfname, n - 2 ); /* Truncate and add ".." indication that is was truncated. */ + strcat(truncname, ".." ); + } + else strcpy( truncname, origfname ); +} + + + +struct fb_directory_item + { + char *filename; + time_t file_date; + unsigned long long sz; + struct fb_directory_item *nxt; + }; + +void fb_format_minutes( int value, char *buf ) +{ + if (value < 10) + { char buf2[30]; + sprintf(buf2,"%d", value); + strcpy(buf,"0"); strcat(buf,buf2); + } else sprintf(buf,"%2d", value); +} + +int fb_current_day=0; + + +struct fb_directory_item *fb_new_dirlist_item( char *fname, unsigned long long sz, time_t filedate ) +{ + struct fb_directory_item *newitem; + + newitem = (struct fb_directory_item *)malloc( sizeof(struct fb_directory_item) ); + newitem->filename = strdup_padded( fname ); + newitem->sz = sz; + newitem->file_date = filedate; + return newitem; +} + + +int fb_wildcard_match( char *fname, char *wildcards[] ) +{ + int j=0; + while ((wildcards[j] != 0) && (fb_strcasestr(fname, wildcards[j]) == 0)) j++; + if (wildcards[j] != 0) return 1; else return 0; +} + + + +void spread2rightjustify( char *wrd ) +{ + int j=0, k=0, stop=0; + char twrd[100]; + strcpy( twrd, wrd ); + while (!stop) + { + if (twrd[j] == ' ') { wrd[k++] = ' '; wrd[k++] = ' '; } + else + { + wrd[k++] = twrd[j]; + if (twrd[j] == '\0') stop = 1; + } + j++; + } +} + + + +GtkWidget *fbrowser_frame; +int fbwinwidth, fbwinheight; +char *fb_prior_directory=0; +GtkEntry *fb_crdir_formbox; + +/* Prototype. */ +void renderBrowseFiles0( char *prompt, int maxlength, char *directory, char *wildcards, + char *filename, void (*callback)(char *fname) ); + + +void pastuerize( char *word, char replace ) +{ + int j=0; + while (word[j] != '\0') + { + if ((word[j] < '.') || (word[j] > 'z') || (word[j] == '/')) + word[j] = replace; + else + if ((word[j] > '9') && (word[j] < 'A')) + word[j] = replace; + else + if ((word[j] > 'Z') && (word[j] < 'a')) + word[j] = replace; + j++; + } +} + +void fb_add_new_dir( GtkWidget *wdg, void *data ) +{ + int errs; + char *newname, *newdirname, *fullname; +printf("CurDir = '%s'\n", fbdata.directory ); + newname = get_formbox( fb_crdir_formbox ); + if (newname[0] != '\0') + { + newdirname = strdup_padded( newname ); + pastuerize( newdirname, '_' ); + fullname = (char *)malloc( strlen( fbdata.directory ) + strlen( newdirname ) + 128 ); + strcpy( fullname, fbdata.directory ); + if (strlen(fullname) > 0) + strcat( fullname, "/" ); + strcat( fullname, newdirname ); + printf("Creating new directory: '%s'.\n", fullname ); + #ifndef __MINGW32__ + errs = mkdir( fullname, 0755 ); /* Posix */ + #else + errs = mkdir( fullname ); /* MsWin */ + #endif + if (errs) + { + printf("Error: Could not create the named directory '%s'.\n", fullname ); + } + free( fullname ); + renderBrowseFiles0( fbdata.prompt, fbdata.maxlength, fbdata.directory, fbdata.wildcards, fbdata.filename, fbdata.callback ); + } + close_any_window( wdg, &fbcrdirwin ); +} + + +void fb_create_new_dir( GtkWidget *wdg, void *data ) +{ + int winwd=450, winht=89; + GtkWidget *panel; + #ifdef __MINGW32__ + char *title="Create New Folder"; + #else + char *title="Create New Directory"; + #endif + + panel = make_window( winwd, winht, title, &fbcrdirwin ); + make_label( panel, 2, 1, title ); + fb_crdir_formbox = make_formbox( panel, 5, 20, 50, "", fbdata.maxlength, fb_add_new_dir, 0 ); + make_button( panel, 10, winht - 35, " Create ", fb_add_new_dir, 0 ); + make_button( panel, winwd - 80, winht - 35, " Cancel ", close_any_window, &fbcrdirwin ); + show_wind( fbcrdirwin ); +} + + +int fb_sort_state=0; + +void fb_set_sort_method( int by_date_not_alpha ) +{ /* Call with 0 to sort by file-names alphabetically, or 1 to sort by date. */ + fb_sort_state = by_date_not_alpha; +} + +void fb_re_sort_alpha( GtkWidget *wdg, void *data ) +{ + if (fb_sort_state == 0) /* If no change, then just return. */ + return; + fb_sort_state = 0; + renderBrowseFiles0( fb_prompt, fb_maxlen, fb_dirname, fb_wildcard, fb_filename, fb_callback ); +} + +void fb_re_sort_bydate( GtkWidget *wdg, void *data ) +{ + if (fb_sort_state == 1) /* If no change, then just return. */ + return; + fb_sort_state = 1; + renderBrowseFiles0( fb_prompt, fb_maxlen, fb_dirname, fb_wildcard, fb_filename, fb_callback ); +} + + + +void renderBrowseFiles0( char *prompt, int maxlength, char *directory, char *wildcards, char *filename, void (*callback)(char *fname) ) +{ + int frmbx_wdth_pix, j=0; + GtkWidget *pulldown, *btn, *radio_sort_by_alpha, *radio_sort_by_date; + GtkTreeStore *mylist; + int ypos=20, erno; + float posx1; + char *line, *word, *pathname, *wildcard_array[200], *twrd1, *dir_row[4]; + #if (SHOWFILESIZE == 1) + const char *headings[4]={ " ", " Size ", " Date", " File Name " }; + #else + const char *headings[4]={ " ", " Date ", " File Name " }; + #endif + + line = (char *)malloc(MXLEN); + word = (char *)malloc(MXLEN); + twrd1 = (char *)malloc(MXLEN); + pathname = (char *)malloc(MXLEN); + fb_reduce_pathname( directory ); + if (directory[0] == '\0') strcpy( directory, "." ); + + sprintf(line,"Directory: %s", directory ); + make_label( fbrowser_frame, 5, 5, line ); + + strcpy_safe( fb_dirname, directory, MXLEN ); + + /* Filter any '*' from wildcards, and parse into an array. */ + strcpy_safe( line, wildcards, 500 ); + fb_next_word( line, word, " \t*" ); + while ((word[0] != '\0') && (j < 18)) + { + wildcard_array[j++] = strdup( word ); + fb_next_word( line, word, " \t*" ); + } + wildcard_array[j] = 0; /* Terminate wild-card list. */ + + if (fb_current_day == 0) + { /*Get current date.*/ + const struct tm *tm; + #ifdef __MINGW32__ + time_t T; + T = time(0); + tm = localtime( &T ); + #else + struct timeval tp; + gettimeofday(&tp,0); + tm = localtime( &(tp.tv_sec) ); + #endif + /* Compute days since 1900, assuming all months have 31 days. */ + fb_current_day = tm->tm_year * (12 * 31) + tm->tm_mon * 31 + tm->tm_mday; + } + + fb_selection_count = 0; + mylist = make_multicolumn_selection_list( fbrowser_frame, 5, 26, fbwinwidth - 10, fbwinheight - 145, + FB_COLUMNS, headings, fb_select, fb_accept, 0 ); + for (j=0; j < FB_COLUMNS; j++) dir_row[j] = (char *)calloc( 1, 200 ); + + { /*listdirectory*/ + DIR *dirpt; + struct stat buf; + struct dirent *dir_entry; + struct tm *time_struct; + char month_name[13][4]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","BAD"}; + int month_value, day, n_entries=0, column; + struct fb_directory_item *dir_sublist_hd, *dir_filelist_hd, *newitem, *flstptr, *olditem, *previtem; + char minfrmt[30], yeartime[50]; + + // printf("Listing dir: %s\n", directory ); + dir_sublist_hd = 0; + dir_filelist_hd = 0; + dirpt = opendir( directory ); + if (dirpt == 0) {printf("Error: Could not open directory '%s'.\n", directory ); /* exit(1); */ } + else + { /*ok*/ + dir_entry = readdir(dirpt); + if (dir_entry == 0) + { + strcpy_safe( directory, fb_prior_directory, MXLEN ); + dirpt = opendir( directory ); + dir_entry = readdir(dirpt); + } + else + { + if (fb_prior_directory) free(fb_prior_directory); + fb_prior_directory = strdup_padded(directory); + } + while (dir_entry != 0) + { /*direntry*/ + if ((fb_showdotfiles) || ((dir_entry->d_name[0] != '.') || (strcmp(dir_entry->d_name,"..") == 0))) + if (strcmp(dir_entry->d_name,".") != 0) + { /*fileorsubdir*/ + strcpy_safe(pathname, directory, MXLEN-100); strcat(pathname,"/"); + strcat( pathname, dir_entry->d_name ); + erno = stat( pathname, &buf ); + if (erno) + printf("Bad file name %s\n", pathname ); + else + if (S_ISDIR(buf.st_mode)) /* If subdirectory, then */ + { /*dir*/ /* Enqueue onto subdirectory list. */ + if (not_banned_dir( dir_entry->d_name )) + { /*ok*/ + newitem = fb_new_dirlist_item( dir_entry->d_name, buf.st_size, buf.st_mtime ); + previtem = 0; /* Insert in sorted order. */ + flstptr = dir_sublist_hd; + if (fb_sort_state == 0) + { /* Insert in alphabetic-sorted order. */ + while ((flstptr != 0) && (strcmp(flstptr->filename, dir_entry->d_name) < 0 )) + { previtem = flstptr; flstptr = flstptr->nxt; } + } + else + { /* Insert in date-sorted rder. */ + while ((flstptr != 0) && (flstptr->file_date > buf.st_mtime)) + { previtem = flstptr; flstptr = flstptr->nxt; } + } + if (previtem == 0) { dir_sublist_hd = newitem; } + else { previtem->nxt = newitem; } + newitem->nxt = flstptr; + } /*ok*/ + } /*dir*/ + else + if (not_banned(dir_entry->d_name) && ((wildcard_array[0] == 0) || (fb_wildcard_match( dir_entry->d_name, wildcard_array )))) + { /* Otherwise, Enqueue on regular files list. */ + newitem = fb_new_dirlist_item( dir_entry->d_name, buf.st_size, buf.st_mtime ); + previtem = 0; /* Insert in sorted order. */ + flstptr = dir_filelist_hd; + if (fb_sort_state == 0) + { /* Insert in alphabetic-sorted order. */ + while ((flstptr != 0) && (strcmp(flstptr->filename, dir_entry->d_name) < 0 )) + { previtem = flstptr; flstptr = flstptr->nxt; } + } + else + { /* Insert in date-sorted order. */ + while ((flstptr != 0) && ( flstptr->file_date > buf.st_mtime )) + { previtem = flstptr; flstptr = flstptr->nxt; } + } + if (previtem == 0) { dir_filelist_hd = newitem; } + else { previtem->nxt = newitem; } + newitem->nxt = flstptr; + } + + } /*fileorsubdir*/ + dir_entry = readdir(dirpt); + } /*direntry*/ + closedir( dirpt ); + } /*ok*/ + + /* First add an empty item at top of list, because it is always pre-selected. */ + for (j=0; j < FB_COLUMNS; j++) dir_row[j][0] = '\0'; + add_multicolumn_selection_item( mylist, FB_COLUMNS, dir_row ); + + /* First list the directories at this level. */ + flstptr = dir_sublist_hd; + while (flstptr != 0) + { + // fb_truncate_fname( word, flstptr->filename, 46 ); /* Limit file names to no longer than 45 characters. */ + /* If file is older than six months, list year, else list time of day. */ + time_struct = localtime( &(flstptr->file_date) ); + day = time_struct->tm_year * (12 * 31) + time_struct->tm_mon * 31 + time_struct->tm_mday; + if (fb_current_day - day > 6 * 31) + sprintf(yeartime,"%d", time_struct->tm_year + 1900 ); + else + { + fb_format_minutes( time_struct->tm_min, minfrmt ); + sprintf(yeartime,"%2d:%s", time_struct->tm_hour, minfrmt ); + } + month_value = time_struct->tm_mon; + if ((month_value < 0) || (month_value > 11)) { printf("ERROR: BAD MONTH %d for file %s\n", month_value, pathname ); month_value = 12; } + column = 0; + strcpy( dir_row[column++],"d"); + #if (SHOWFILESIZE == 1) + // sprintf( dir_row[1], "%7d", (int)((double)(flstptr->sz) / 1000.0 + 0.5) ); + sprintf( dir_row[column], "%7ld", flstptr->sz ); + spread2rightjustify( dir_row[column++] ); + #endif + strcpy( dir_row[column], month_name[month_value] ); + sprintf(twrd1," %2d ", time_struct->tm_mday ); + strcat( dir_row[column], twrd1 ); + sprintf(twrd1,"%5s", yeartime ); + strcat( dir_row[column++], twrd1 ); + free( dir_row[column] ); + dir_row[column] = strdup( flstptr->filename ); + // sprintf(line, "d %8ld %s %2d %5s %s", flstptr->sz, month_name[month_value], time_struct->tm_mday, yeartime, flstptr->filename ); + add_multicolumn_selection_item( mylist, FB_COLUMNS, dir_row ); + n_entries++; + olditem = flstptr; + flstptr = flstptr->nxt; /* Free file entries as we list them. */ + free( olditem ); + } + + /* Second list the regular files at this level. */ + flstptr = dir_filelist_hd; + while (flstptr != 0) + { + // fb_truncate_fname( word, flstptr->filename, 46.0 ); /* Limit file names to no longer than 45 characters. */ + /* If file is older than six months, list year, else list time of day. */ + time_struct = localtime( &(flstptr->file_date) ); + day = time_struct->tm_year * (12 * 31) + time_struct->tm_mon * 31 + time_struct->tm_mday; + if (fb_current_day - day > 6 * 31) + sprintf(yeartime,"%d", time_struct->tm_year + 1900 ); + else + { + fb_format_minutes( time_struct->tm_min, minfrmt ); + sprintf(yeartime,"%2d:%s", time_struct->tm_hour, minfrmt ); + } + month_value = time_struct->tm_mon; + if ((month_value < 0) || (month_value > 11)) { printf("ERROR: BAD MONTH %d for file %s\n", month_value, pathname ); month_value = 12; } + if ((!fb_dirsonly) || (fb_allowfiles)) + { + column = 0; + strcpy( dir_row[column++]," "); + #if (SHOWFILESIZE == 1) + // sprintf( dir_row[column], "%7d", (int)((double)(flstptr->sz) / 1000.0 + 0.5) ); + sprintf( dir_row[column], "%7ld", flstptr->sz ); + spread2rightjustify( dir_row[column++] ); + #endif + strcpy( dir_row[column], month_name[month_value] ); + sprintf(twrd1," %2d ", time_struct->tm_mday ); + strcat( dir_row[column], twrd1 ); + sprintf(twrd1,"%5s", yeartime ); + strcat( dir_row[column++], twrd1 ); + free( dir_row[column] ); + dir_row[column] = strdup( flstptr->filename ); + add_multicolumn_selection_item( mylist, FB_COLUMNS, dir_row ); + n_entries++; + } + olditem = flstptr; + flstptr = flstptr->nxt; /* Free file entries as we list them. */ + free( olditem ); + } + } /*listdirectory*/ + + /* Cleanup any temporary wildcards. */ + j = 0; + while (wildcard_array[j] != 0) { free(wildcard_array[j]); j++; } + + ypos = fbwinheight - 95; + make_label( fbrowser_frame, 296, ypos - 11, "Sort by:" ); + if (fb_sort_state) + { + radio_sort_by_date = make_radio_button( fbrowser_frame, 0, 427, ypos-13, "Dates", fb_re_sort_bydate, "Dates" ); + radio_sort_by_alpha = make_radio_button( fbrowser_frame, radio_sort_by_date, 353, ypos-13, "Names", fb_re_sort_alpha, "Alpha" ); + } + else + { + radio_sort_by_alpha = make_radio_button( fbrowser_frame, 0, 353, ypos-13, "Names", fb_re_sort_alpha, "Alpha" ); + radio_sort_by_date = make_radio_button( fbrowser_frame, radio_sort_by_alpha, 427, ypos-13, "Dates", fb_re_sort_bydate, "Dates" ); + } + + make_label( fbrowser_frame, 2, ypos, prompt ); + #ifdef __MINGW32__ + make_button( fbrowser_frame, fbwinwidth - 100, ypos - 15, "New Folder", fb_create_new_dir, 0 ); + #else + make_button( fbrowser_frame, fbwinwidth - 78, ypos - 15, "New Dir", fb_create_new_dir, 0 ); + #endif + ypos = ypos + 20; + if (fb_altdirs) /* If alternate-directories list is populated, then place selector button. */ + { struct fb_word_list_item *altdir=fb_altdirs; + pulldown = make_menu_button( fbrowser_frame, fbwinwidth - 30, ypos, "v" ); + add_tool_tip( most_recent_menu, "Jump to alternate or recent directories." ); + while (altdir != 0) + { + add_menu_item( pulldown, altdir->word, fb_select_and_go, altdir->word ); + altdir = altdir->nxt; + } + frmbx_wdth_pix = fbwinwidth - 30 - 25; + } + else + frmbx_wdth_pix = fbwinwidth - 30; + fb_filename_formbox = make_formbox_bypix( fbrowser_frame, 25, ypos, frmbx_wdth_pix, filename, maxlength, fb_accept, 0 ); + + make_button( fbrowser_frame, 10, fbwinheight - 38, " OK ", fb_accept, 0 ); + + posx1 = 0.38; + make_label( fbrowser_frame, posx1 * fbwinwidth - 72, fbwinheight - 36, "File Types:" ); + frmbx_wdth_pix = 100; + fb_wildcard_formbox = make_formbox_bypix( fbrowser_frame, posx1 * fbwinwidth, fbwinheight - 39, frmbx_wdth_pix, wildcards, 500, fb_wildcard_accept, 0 ); + btn = make_button( fbrowser_frame, posx1 * fbwinwidth + 102, fbwinheight - 40, "Filter", fb_wildcard_accept, 0 ); + add_tool_tip( btn, "Refresh file listing showing only files matching the current filter strings." ); + btn = make_button( fbrowser_frame, posx1 * fbwinwidth + 152, fbwinheight - 40, "Clr", fb_wildcard_clear, 0 ); + add_tool_tip( btn, "Clear filter wildcards to Show All File Types." ); + btn = make_button( fbrowser_frame, posx1 * fbwinwidth + 188, fbwinheight - 40, "Res", fb_wildcard_restore, 0 ); + add_tool_tip( btn, "Restore the normal file filter types." ); + + make_button( fbrowser_frame, fbwinwidth - 70, fbwinheight - 38, "Cancel ", cancel_fbwindow, 0 ); + for (j=0; j < FB_COLUMNS; j++) free(dir_row[j]); + free(pathname); + free(twrd1); + free(word); + free(line); + show_wind( fbwindow ); +} + + + +void fb_extract_path_fname( char *fullname, char *path, char *fname ) +{ + int j, k; + j = strlen( fullname ) - 1; + while ((j >= 0) && (fullname[j] != '/') && (fullname[j] != '\\')) + j--; + if (j < 0) + { /*No slashes in fullname. Assume it is a filename only.*/ + path[0] = '\0'; + strcpy( fname, fullname ); + } + else + { + k = 0; + while (k <= j) + { path[k] = fullname[k]; k++; } + path[k] = '\0'; + k = 0; j++; + while (fullname[j] != '\0') + fname[k++] = fullname[j++]; + fname[k] = '\0'; + } +} + + + +GtkWidget *fbwinframe; + +static gboolean fb_expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer data ) +{ + int new_width, new_height; + gtk_window_get_size( GTK_WINDOW( fbwindow ), &new_width, &new_height ); + if ((new_width != fbwinwidth) || (new_height != fbwinheight)) + { + fbwinwidth = new_width; + fbwinheight = new_height; + gtk_widget_destroy( fbrowser_frame ); + fbrowser_frame = gtk_fixed_new(); + gtk_container_add( GTK_CONTAINER( fbwinframe ), fbrowser_frame ); + renderBrowseFiles0( fbdata.prompt, fbdata.maxlength, fbdata.directory, fbdata.wildcards, fbdata.filename, fbdata.callback ); + } + return 0; +} + + +void BrowseFiles0( char *prompt, int maxlength, char *directory, char *wildcards, char *filename, void (*callback)(char *fname) ) +{ + fbwinwidth = 600; + if (SHOWFILESIZE) + fbwinheight = 500; + else + fbwinheight = 450; + fbdata.prompt = strdup( prompt ); + fbdata.maxlength = maxlength; + fbdata.directory = strdup_padded( directory ); + fbdata.wildcards = strdup( wildcards ); + fbdata.filename = strdup( filename ); + fbdata.callback = callback; + fbwinframe = make_window( fbwinwidth, fbwinheight, "File Browser", &fbwindow ); + gtk_window_set_resizable( GTK_WINDOW( fbwindow ), 1 ); + g_signal_connect( fbwindow, "expose-event", G_CALLBACK(fb_expose_event), NULL); + fbrowser_frame = gtk_fixed_new(); + gtk_container_add( GTK_CONTAINER( fbwinframe ), fbrowser_frame ); + renderBrowseFiles0( prompt, maxlength, directory, wildcards, filename, callback ); +} + + +void Browse_Files( char *prompt, int maxlength, char *directory, char *wildcards, char *filename, void (*callback)(char *fname) ) +{ + fb_callback = callback; + fb_prompt = strdup( prompt ); + fb_maxlen = maxlength; + fb_dnptr = directory; + strcpy_safe( fb_wildcard_default, wildcards, 500 ); + strcpy_safe( fb_wildcard, wildcards, 500 ); + fb_wcptr = wildcards; + fb_fnptr = filename; + fb_dirsonly = 0; + BrowseFiles0( fb_prompt, maxlength, directory, wildcards, filename, callback ); +} + + +void Browse_Dirs( char *prompt, int maxlength, char *directory, char *wildcards, char *dirname, void (*callback)(char *fdname) ) +{ + fb_callback = callback; + fb_prompt = strdup( prompt ); + fb_maxlen = maxlength; + fb_dnptr = directory; + strcpy_safe( fb_wildcard_default, wildcards, 500 ); + strcpy_safe( fb_wildcard, wildcards, 500 ); + fb_wcptr = wildcards; + fb_fnptr = dirname; + fb_dirsonly = 1; + BrowseFiles0( fb_prompt, maxlength, directory, wildcards, dirname, callback ); +} + +void fb_allow_files( int state ) /* Sets whether Browse_Dirs can return path */ +{ /* to a regular file, or only directories. */ + fb_allowfiles = state; /* Zero=false (no-files, dirs-only), 1=true (allow files or directories). */ +} + +void fb_show_dotfiles( int state ) /* Sets whether file-browser shows files beginning with dot. */ +{ fb_showdotfiles = state; } /* 0=no. 1=yes. */ + +/* ------------------------ End File Browser --------------------------*/ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/gtk_file_browser3.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/gtk_file_browser3.c new file mode 100755 index 0000000..4a0a644 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/gtk_file_browser3.c @@ -0,0 +1,1093 @@ +/* ------------------------ Begin File Browser --------------------------*/ +/* (The Default Gtk file browser widget was confusing for users, and did not + offer the file filtering and date-display flexibility we need. So we built + a better one here, which does exactly what we need it to.) +*/ + +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA. */ +/* */ + +#include + +#define FB_DEBUG if (0) +#define MXLEN 8192 +#define SHOWFILESIZE 0 + +#if (SHOWFILESIZE == 1) + #define FB_COLUMNS 4 +#else + #define FB_COLUMNS 3 +#endif + +GtkWidget *fbwindow=0, *fbcrdirwin=0; +GtkEntry *fb_filename_formbox, *fb_wildcard_formbox; +int fb_maxlen, fb_dirsonly, fb_allowfiles=1, fb_showdotfiles=0, fb_selection_count; +char fb_filename[MXLEN], fb_dirname[MXLEN], fb_wildcard[MXLEN], fb_wildcard_default[MXLEN]="", *fb_prompt; +char *fb_fnptr, *fb_dnptr, *fb_wcptr, fb_Selected[2][MXLEN]={"",""}; +void (*fb_callback)(char *fname); /* Callback function for filebrowser. */ + + +struct fb_data_rec + { + char *prompt, *directory, *wildcards, *filename; + int maxlength; + void (*callback)(char *fname); + } fbdata; + + +struct fb_word_list_item + { + char *word; + struct fb_word_list_item *nxt; + } *fb_altdirs=0, /* List of alternate directories or files to suggest. */ + *fb_banned=0, /* List of file-names to ignore (filter-out). */ + *fb_banned_dir=0; /* List of directory-names to ignore (filter-out). */ + +void fb_clear_word_list( struct fb_word_list_item **list ) +{ struct fb_word_list_item *item; + while (*list != 0) + { + item = *list; + *list = item->nxt; + free( item->word ); + free( item ); + } +} + + +int fb_strcasestr( char *haystack, char *needle ) +{ + int j=0; + char *thaystack, *tneedle, *ret; + thaystack = strdup( haystack ); + while (thaystack[j] != '\0') + { + thaystack[j] = toupper( thaystack[j] ); + j++; + } + tneedle = strdup( needle ); + j = 0; + while (tneedle[j] != '\0') + { + tneedle[j] = toupper( tneedle[j] ); + j++; + } + ret = strstr( thaystack, tneedle ); + free( thaystack ); + free( tneedle ); + if (ret != 0) + return 1; + else + return 0; +} + + +char *strdup_padded( char *instr ) +{ /* Duplicate string with some extra space to allow expansion. */ + int j; + char *outstr; + j = strlen( instr ); + outstr = (char *)malloc( j + j/4 + 128 ); + strcpy( outstr, instr ); + return outstr; +} + + +void fb_add_word_to_end_of_list( struct fb_word_list_item **list, char *word ) +{ + struct fb_word_list_item *newitem, *lastitem; + newitem = (struct fb_word_list_item *)malloc( sizeof(struct fb_word_list_item) ); + newitem->word = strdup(word); + newitem->nxt = 0; + if (*list == 0) + *list = newitem; + else + { + lastitem = *list; + while (lastitem->nxt != 0) lastitem = lastitem->nxt; + lastitem->nxt = newitem; + } +} + + +void fb_add_optional_dirfile( char *dir_or_file ) /* Provides method to suggest alternate directory(s) via pull-down. */ +{ + struct fb_word_list_item *item; + item = fb_altdirs; /* First make sure directory is not already on the list. */ + while ((item != 0) && (strcmp( item->word, dir_or_file ) != 0)) + item = item->nxt; + if (item == 0) + fb_add_word_to_end_of_list( &fb_altdirs, dir_or_file ); +} + +void fb_clear_optional_dirfiles() /* Clears all previous list entries. */ +{ fb_clear_word_list( &fb_altdirs ); } + +void fb_clear_last_selected() { fb_Selected[0][0] = '\0'; } + +void cancel_fbwindow( GtkWidget *widget, gpointer data ) +{ + if (fbwindow != 0) gtk_widget_destroy( fbwindow ); + fbwindow = 0; + fb_Selected[0][0] = '\0'; + if (fbcrdirwin) close_any_window( widget, &fbcrdirwin ); +} + + +void fb_ban_files( char *banstr ) +{ + fb_add_word_to_end_of_list( &fb_banned, banstr ); +} + + +void fb_ban_dirs( char *banstr ) +{ + fb_add_word_to_end_of_list( &fb_banned_dir, banstr ); +} + + +void fb_clear_banned_files() +{ + struct fb_word_list_item *olditem; + while (fb_banned) + { + olditem = fb_banned; + fb_banned = fb_banned->nxt; + free( olditem->word ); + free( olditem ); + } +} + + +int not_banned( char *name ) +{ /* Returns 1 if filename is not on the banned list, else returns 0. */ + struct fb_word_list_item *item; + item = fb_banned; + while (item && (fb_strcasestr( name, item->word ) == 0)) + item = item->nxt; + if (item) + return 0; + else + return 1; +} + + +int not_banned_dir( char *name ) +{ /* Returns 1 if dir-name is not on list of banned directory names, else returns 0. */ + struct fb_word_list_item *item; + item = fb_banned_dir; + while (item && (fb_strcasestr( name, item->word ) == 0)) + item = item->nxt; + if (item) + return 0; + else + return 1; +} + + +void BrowseFiles0( char *prompt, int maxlength, char *directory, char *wildcards, char *filename, void (*callback)(char *fname) ); /* Prototype. */ + +void fb_wildcard_accept( GtkWidget *widget, gpointer data ) +{ + get_formbox_text( fb_wildcard_formbox, fb_wildcard, 500 ); + FB_DEBUG printf("accpted wildcard '%s'\n", fb_wildcard); + BrowseFiles0( fb_prompt, fb_maxlen, fb_dirname, fb_wildcard, fb_filename, fb_callback ); +} + + +void fb_wildcard_clear( GtkWidget *widget, gpointer data ) +{ + fb_wildcard[0] = '\0'; + modify_formbox( fb_wildcard_formbox, fb_wildcard ); + FB_DEBUG printf("cleared wildcard '%s'\n", fb_wildcard ); + BrowseFiles0( fb_prompt, fb_maxlen, fb_dirname, fb_wildcard, fb_filename, fb_callback ); +} + + +void fb_wildcard_restore( GtkWidget *widget, gpointer data ) +{ + strcpy( fb_wildcard, fb_wildcard_default ); + modify_formbox( fb_wildcard_formbox, fb_wildcard ); + FB_DEBUG printf("cleared wildcard '%s'\n", fb_wildcard ); + BrowseFiles0( fb_prompt, fb_maxlen, fb_dirname, fb_wildcard, fb_filename, fb_callback ); +} + + + +void fb_next_word( char *line, char *word, char *delim ) +{ + int i=0, j=0, m=0, nodelim=1; + while ((line[i]!='\0') && (nodelim)) /* Consume any preceding white-space. */ + { + j = 0; + while ((delim[j]!='\0') && (line[i]!=delim[j])) j = j + 1; + if (line[i]==delim[j]) { i = i + 1; } else nodelim = 0; + } + while ((line[i]!='\0') && (!nodelim)) /* Copy the word until the next delimiter. */ + { + word[m++] = line[i++]; + if (line[i]!='\0') + { + j = 0; + while ((delim[j]!='\0') && (line[i]!=delim[j])) j = j + 1; + if (line[i]==delim[j]) nodelim = 1; + } + } + j = 0; /* Shorten line. */ + while (line[i]!='\0') { line[j++] = line[i++]; } + /* Terminate the char-strings. */ + line[j] = '\0'; + word[m] = '\0'; +} + + +#ifndef __MINGW32__ + #define FB_DIRSEP_CHR '/' /* POSIX File directory delimiter. */ + #define FB_DIRSEP_STR "/" + #define FB_RTN_CHR '\n' /* Character returned by carriage-return key. */ +#else + #define FB_DIRSEP_CHR '\\' /* MS-win File directory delimiter. */ + #define FB_DIRSEP_STR "\\" + #define FB_RTN_CHR '\n' /* Character returned by carriage-return key. */ +#endif + + +void fb_shorten_string_at_front( char *string, int n ) +{ int k=0; + do { string[k] = string[k+n]; k++; } + while (string[k-1] != '\0'); +} + +void fb_eliminate_leading_dot( char *fname ) /* Remove leading dot-slash (./), not needed. */ +{ + while ((fname[0] == '.') && (fname[1] == FB_DIRSEP_CHR)) + fb_shorten_string_at_front( &(fname[0]), 2 ); +} + + +#include +#include +#include +#include +#include + +void fb_unify_slashes( char *name, char oldslash, char newslash ) +{ + int j=0; + while (name[j] != '\0') + { if (name[j] == oldslash) name[j] = newslash; j++; } +} + + +void fb_reduce_pathname( char *fname ) +{ + int j, k=0, nsegs=0; + char *twrd, *dseg[400]; + + if (fname[0] == '\0') return; + FB_DEBUG printf("REDUCING '%s'\n", fname); + fb_unify_slashes( fname, '\\', '/' ); /* Unify to a single type of slash (dir-separator) for sanity. */ + + if (strcmp(fname,".")==0) fname[0] = '\0'; /* Do not need dot (.) explicitly for current directory. */ + + while ( strstr(fname, "//") ) /* Remove any double-slashes. */ + { fb_shorten_string_at_front( strstr(fname, "//"), 1 ); } + + while ((fname[0] == '.') && (fname[1] == '/')) + fb_shorten_string_at_front( &(fname[0]), 2 ); + + k = strlen( fname ) - 1; /* Check for and remove any trailing slash. */ + #ifdef __MINGW32__ + if ((k == 1) && (fname[k] == ':')) { strcat(fname, "\\"); return; } + if ((k == 2) && (fname[k-1] == ':') && (fname[k] == '/')) + { fname[k] = '\\'; return; } + #endif + if ((k > 0) && (fname[k] == '/')) fname[k] = '\0'; + if (fname[0] == '\0') return; + + /* Separate path into segments. */ + twrd = (char *)malloc( MXLEN ); + k = 0; + while ((fname[k] != '\0') && (nsegs < 400)) + { + j = 0; + while ((fname[k] != '\0') && (fname[k] != '/') && (j < MXLEN-1)) + twrd[j++] = fname[k++]; + if ((nsegs == 0) && (j == 0) && (fname[k] == '/')) twrd[j++] = fname[k]; + twrd[j] = '\0'; + dseg[nsegs++] = strdup( twrd ); + if (fname[k] == '/') k++; + } + free( twrd ); + + /* Reconstruct path name from the segments, but skip any 'aa/..' pairs, where 'aa' is not '..'. */ + k = 0; + strcpy( fname, dseg[k++] ); + if ((fname[0] != '\0') && (fname[1] == ':') && (fname[2] == '\0')) strcat( fname, "/" ); + while (k < nsegs) + { + if ((k < nsegs - 1) && ((strcmp( dseg[k+1], "..") == 0) && (strcmp( dseg[k], "..") != 0))) + k = k + 2; + else + { + j = strlen(fname) - 1; + if ((j >= 0) && (fname[j] != '/')) strcat( fname, "/" ); + strcat( fname, dseg[k++] ); + } + } + twrd = &(fname[0]); + #ifdef __MINGW32__ + if ((fname[0] != '\0') && (fname[1] == ':')) twrd = &(fname[2]); + #endif + if (strcmp( twrd, "/.." ) == 0) strcpy( twrd, "/"); + + #ifdef __MINGW32__ + fb_unify_slashes( fname, '/', '\\' ); /* Make slashes be appropriate to platform. */ + if ((fname[0] != '\0') && (fname[1] == ':') && (fname[2] == '\0')) + strcat( fname, "\\" ); + #endif +} + + +void fb_EnvironVarFilter( char *fname ) +{ /* Intercept and replace any defined environment variables in file-names. */ + int k=0, j, m, n, p, seppt=1; + char twrd[2048], *evar; + + if (strchr(fname,'$') == 0) return; + while ((k < 2048-1) && (fname[k] != '\0')) + { /*lookfor$*/ + if ((seppt) && (fname[k] == '$')) + { /*replace_envvar*/ + k++; /* Grab just the env-var name. */ + j = 0; m = k; + while ((m < 2048-1) && (fname[m] != '/') && (fname[m] != '\\') && (fname[m] != '\0')) + { twrd[j++] = fname[m++]; } + twrd[j] = '\0'; + evar = getenv(twrd); + if (evar) + { + k--; + n = strlen(evar); + p = n - m + k; + if (p > 0) + { /*expand string*/ + n = strlen(fname); + while (n >= m) { fname[n+p] = fname[n]; n--; } + } + else + if (p < 0) + { /*shrink string.*/ + n = m + p; + do { fname[n] = fname[n-p]; n++; } while (fname[n-1] != '\0'); + } + p = 0; /* Copy evar into position. */ + while (evar[p] != '\0') fname[k++] = evar[p++]; + } + else + k = m; + } /*replace_envvar*/ + else + { + if ((fname[k] == '/') || (fname[k] == '\\')) seppt = 1; else seppt = 0; + k++; + } + } /*lookfor$*/ +} + + +void fb_accept( GtkWidget *widget, void *data ) /* Determine if selected file is a directory or regular file. */ +{ /* If it is a directory, then open browser to that directory, otherwise return file's-name. */ + char *pathname; + struct stat buf; + int k, erno; + + get_formbox_text( fb_filename_formbox, fb_filename, MXLEN ); + FB_DEBUG printf("accepted file '%s/%s'\n", fb_dirname, fb_filename); + + if (strcmp(fb_filename,".") == 0) { fb_dirname[0] = '\0'; } + fb_EnvironVarFilter( fb_filename ); + fb_reduce_pathname( fb_filename ); + + if ((fb_filename[0] == FB_DIRSEP_CHR) || ((fb_filename[0] != '\0') && (fb_filename[1] == ':'))) + fb_dirname[0] = '\0'; /* If filename contains full absolute path, then erase old path from dirname. */ + else /* Otherwise, a relative path was given. */ + fb_eliminate_leading_dot( fb_filename ); + + /* Construct the new full-path name of the file or directory that was selected. */ + pathname = (char *)malloc(MXLEN); + strcpy_safe( pathname, fb_dirname, MXLEN); + k = strlen(pathname) - 1; /* Remove the trailing slash from the directory name, if any. */ + if ((k > 0) && (pathname[k] == FB_DIRSEP_CHR)) pathname[k] = '\0'; + if (pathname[0] != '\0') strcat(pathname, FB_DIRSEP_STR); /* Add trailing slash to directory name. */ + strcat( pathname, fb_filename ); /* Append the file-name portion to create full path name. */ + fb_eliminate_leading_dot( pathname ); + fb_reduce_pathname( pathname ); + FB_DEBUG printf("Returning0 filename '%s'\n", pathname ); + + erno = stat( pathname, &buf ); + FB_DEBUG printf(" Erno = %d, Regular? = %d\n", erno, S_ISREG(buf.st_mode) ); + if ((erno == 0) && (S_ISDIR(buf.st_mode)) && ((fb_dirsonly == 0) || (data != 0))) + { /*Traverse directories*/ + // printf("Traversing directory\n"); + FB_DEBUG printf("Traversing directory\n"); + cancel_fbwindow(0,0); /* Close the fbrowser window. */ + strcpy_safe(fb_dirname, pathname, fb_maxlen); + strcpy_safe(fb_filename,"", fb_maxlen); + BrowseFiles0( fb_prompt, fb_maxlen, fb_dirname, fb_wildcard, fb_filename, fb_callback ); + } + else + { /*Regular_file*/ + if (erno != 0) printf("File does not exist: '%s'\n", pathname ); + FB_DEBUG printf("Returning1 filename '%s'\n", pathname ); + if ((erno == 0) && (fb_dirsonly) && (!S_ISDIR(buf.st_mode)) && (! fb_allowfiles)) + { free(pathname); return; } + FB_DEBUG printf("Returning2 filename '%s'\n", pathname ); + cancel_fbwindow(0,0); /* Close the fbrowser window. */ + FB_DEBUG printf("Returning3 filename '%s'\n", pathname ); + /* Separate directory path-name and 'potential' file-name, into appropriate parts. */ + k = strlen( pathname ) - 1; /* Find last slash, if any. */ + while ((k >= 0) && (pathname[k] != FB_DIRSEP_CHR)) k--; + if (k < 1) /* If no slash(es) after leading position. */ + { fb_dirname[0] = '\0'; strcpy( fb_filename, pathname ); } /* Place all in filename. */ + else + { strcpy( fb_dirname, pathname ); fb_dirname[k] = '\0'; strcpy( fb_filename, &(pathname[k+1]) ); } + // printf("fb_dirname='%s', fb_filename='%s', pathname='%s'\n", fb_dirname, fb_filename, fb_filename ); + strcpy_safe( fb_fnptr, fb_filename, fb_maxlen ); + strcpy_safe( fb_dnptr, fb_dirname, fb_maxlen ); + strcpy_safe( fb_wcptr, fb_wildcard, fb_maxlen ); + FB_DEBUG printf("Returning filename '%s'\n", pathname ); + // printf("Returning filename '%s'\n", pathname ); + + fb_callback( pathname ); + free(pathname); + } +} + + + +void fb_select( GtkWidget *wdg, void *data ) +{ char *fname; + GtkTreeIter iter; + GtkTreeModel *model; + + if (wdg == 0) + { + fname = (char *)data; + modify_formbox( fb_filename_formbox, fname ); + } + else + { + if (gtk_tree_selection_get_selected( GTK_TREE_SELECTION(wdg), &model, &iter )) + { + fb_selection_count++; + gtk_tree_model_get( model, &iter, FB_COLUMNS - 1, &fname, -1 ); + FB_DEBUG printf("selected file item '%s'\n", fname ); + if (fname[0] == '\0') return; + modify_formbox( fb_filename_formbox, fname ); + } + } +} + + +void fb_select_and_go( GtkWidget *widget, gpointer fname ) +{ + char *name=(char *)fname; + modify_formbox( fb_filename_formbox, name ); + strcpy( fb_Selected[1], fb_Selected[0] ); + strcpy( fb_Selected[0], name ); + fb_dirname[0] = '\0'; + fb_select( 0, fname ); + fb_accept( 0, "x" ); /* The "x" give non-null argument allowing immediate fb-redraw. */ +} + + +void fb_truncate_fname( char *truncname, char *origfname, int n ) /* Limit file names to no longer than n characters. */ +{ + if (strlen(origfname) > n) + { + strcpy_safe( truncname, origfname, n - 2 ); /* Truncate and add ".." indication that is was truncated. */ + strcat(truncname, ".." ); + } + else strcpy( truncname, origfname ); +} + + + +struct fb_directory_item + { + char *filename; + time_t file_date; + unsigned long long sz; + struct fb_directory_item *nxt; + }; + +void fb_format_minutes( int value, char *buf ) +{ + if (value < 10) + { char buf2[30]; + sprintf(buf2,"%d", value); + strcpy(buf,"0"); strcat(buf,buf2); + } else sprintf(buf,"%2d", value); +} + +int fb_current_day=0; + + +struct fb_directory_item *fb_new_dirlist_item( char *fname, unsigned long long sz, time_t filedate ) +{ + struct fb_directory_item *newitem; + + newitem = (struct fb_directory_item *)malloc( sizeof(struct fb_directory_item) ); + newitem->filename = strdup_padded( fname ); + newitem->sz = sz; + newitem->file_date = filedate; + return newitem; +} + + +int fb_wildcard_match( char *fname, char *wildcards[] ) +{ + int j=0; + while ((wildcards[j] != 0) && (fb_strcasestr(fname, wildcards[j]) == 0)) j++; + if (wildcards[j] != 0) return 1; else return 0; +} + + + +void spread2rightjustify( char *wrd ) +{ + int j=0, k=0, stop=0; + char twrd[100]; + strcpy( twrd, wrd ); + while (!stop) + { + if (twrd[j] == ' ') { wrd[k++] = ' '; wrd[k++] = ' '; } + else + { + wrd[k++] = twrd[j]; + if (twrd[j] == '\0') stop = 1; + } + j++; + } +} + + + +GtkWidget *fbrowser_frame; +int fbwinwidth, fbwinheight; +char *fb_prior_directory=0; +GtkEntry *fb_crdir_formbox; + +/* Prototype. */ +void renderBrowseFiles0( char *prompt, int maxlength, char *directory, char *wildcards, + char *filename, void (*callback)(char *fname) ); + + +void pastuerize( char *word, char replace ) +{ + int j=0; + while (word[j] != '\0') + { + if ((word[j] < '.') || (word[j] > 'z') || (word[j] == '/')) + word[j] = replace; + else + if ((word[j] > '9') && (word[j] < 'A')) + word[j] = replace; + else + if ((word[j] > 'Z') && (word[j] < 'a')) + word[j] = replace; + j++; + } +} + +void fb_add_new_dir( GtkWidget *wdg, void *data ) +{ + int errs; + char *newname, *newdirname, *fullname; +printf("CurDir = '%s'\n", fbdata.directory ); + newname = get_formbox( fb_crdir_formbox ); + if (newname[0] != '\0') + { + newdirname = strdup_padded( newname ); + pastuerize( newdirname, '_' ); + fullname = (char *)malloc( strlen( fbdata.directory ) + strlen( newdirname ) + 128 ); + strcpy( fullname, fbdata.directory ); + if (strlen(fullname) > 0) + strcat( fullname, "/" ); + strcat( fullname, newdirname ); + printf("Creating new directory: '%s'.\n", fullname ); + #ifndef __MINGW32__ + errs = mkdir( fullname, 0755 ); /* Posix */ + #else + errs = mkdir( fullname ); /* MsWin */ + #endif + if (errs) + { + printf("Error: Could not create the named directory '%s'.\n", fullname ); + } + free( fullname ); + renderBrowseFiles0( fbdata.prompt, fbdata.maxlength, fbdata.directory, fbdata.wildcards, fbdata.filename, fbdata.callback ); + } + close_any_window( wdg, &fbcrdirwin ); +} + + +void fb_create_new_dir( GtkWidget *wdg, void *data ) +{ + int winwd=450, winht=89; + GtkWidget *panel; + #ifdef __MINGW32__ + char *title="Create New Folder"; + #else + char *title="Create New Directory"; + #endif + + panel = make_window( winwd, winht, title, &fbcrdirwin ); + make_label( panel, 2, 1, title ); + fb_crdir_formbox = make_formbox( panel, 5, 20, 50, "", fbdata.maxlength, fb_add_new_dir, 0 ); + make_button( panel, 10, winht - 35, " Create ", fb_add_new_dir, 0 ); + make_button( panel, winwd - 80, winht - 35, " Cancel ", close_any_window, &fbcrdirwin ); + show_wind( fbcrdirwin ); +} + + +int fb_sort_state=0; + +void fb_set_sort_method( int by_date_not_alpha ) +{ /* Call with 0 to sort by file-names alphabetically, or 1 to sort by date. */ + fb_sort_state = by_date_not_alpha; +} + +void fb_re_sort_alpha( GtkWidget *wdg, void *data ) +{ + if (fb_sort_state == 0) /* If no change, then just return. */ + return; + fb_sort_state = 0; + renderBrowseFiles0( fb_prompt, fb_maxlen, fb_dirname, fb_wildcard, fb_filename, fb_callback ); +} + +void fb_re_sort_bydate( GtkWidget *wdg, void *data ) +{ + if (fb_sort_state == 1) /* If no change, then just return. */ + return; + fb_sort_state = 1; + renderBrowseFiles0( fb_prompt, fb_maxlen, fb_dirname, fb_wildcard, fb_filename, fb_callback ); +} + + + +void renderBrowseFiles0( char *prompt, int maxlength, char *directory, char *wildcards, char *filename, void (*callback)(char *fname) ) +{ + int frmbx_wdth_pix, j=0; + GtkWidget *pulldown, *btn, *radio_sort_by_alpha, *radio_sort_by_date; + GtkTreeStore *mylist; + int ypos=20, erno; + float posx1; + char *line, *word, *pathname, *wildcard_array[200], *twrd1, *dir_row[4]; + #if (SHOWFILESIZE == 1) + const char *headings[4]={ " ", " Size ", " Date", " File Name " }; + #else + const char *headings[4]={ " ", " Date ", " File Name " }; + #endif + + line = (char *)malloc(MXLEN); + word = (char *)malloc(MXLEN); + twrd1 = (char *)malloc(MXLEN); + pathname = (char *)malloc(MXLEN); + fb_reduce_pathname( directory ); + if (directory[0] == '\0') strcpy( directory, "." ); + + sprintf(line,"Directory: %s", directory ); + make_label( fbrowser_frame, 5, 2, line ); + + strcpy_safe( fb_dirname, directory, MXLEN ); + + /* Filter any '*' from wildcards, and parse into an array. */ + strcpy_safe( line, wildcards, 500 ); + fb_next_word( line, word, " \t*" ); + while ((word[0] != '\0') && (j < 18)) + { + wildcard_array[j++] = strdup( word ); + fb_next_word( line, word, " \t*" ); + } + wildcard_array[j] = 0; /* Terminate wild-card list. */ + + if (fb_current_day == 0) + { /*Get current date.*/ + const struct tm *tm; + #ifdef __MINGW32__ + time_t T; + T = time(0); + tm = localtime( &T ); + #else + struct timeval tp; + gettimeofday(&tp,0); + tm = localtime( &(tp.tv_sec) ); + #endif + /* Compute days since 1900, assuming all months have 31 days. */ + fb_current_day = tm->tm_year * (12 * 31) + tm->tm_mon * 31 + tm->tm_mday; + } + + fb_selection_count = 0; + mylist = make_multicolumn_selection_list( fbrowser_frame, 5, 24, fbwinwidth - 10, fbwinheight - 154, + FB_COLUMNS, headings, fb_select, fb_accept, 0 ); + for (j=0; j < FB_COLUMNS; j++) dir_row[j] = (char *)calloc( 1, 200 ); + + { /*listdirectory*/ + DIR *dirpt; + struct stat buf; + struct dirent *dir_entry; + struct tm *time_struct; + char month_name[13][4]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","BAD"}; + int month_value, day, n_entries=0, column; + struct fb_directory_item *dir_sublist_hd, *dir_filelist_hd, *newitem, *flstptr, *olditem, *previtem; + char minfrmt[30], yeartime[50]; + + // printf("Listing dir: %s\n", directory ); + dir_sublist_hd = 0; + dir_filelist_hd = 0; + dirpt = opendir( directory ); + if (dirpt == 0) {printf("Error: Could not open directory '%s'.\n", directory ); /* exit(1); */ } + else + { /*ok*/ + dir_entry = readdir(dirpt); + if (dir_entry == 0) + { + strcpy_safe( directory, fb_prior_directory, MXLEN ); + dirpt = opendir( directory ); + dir_entry = readdir(dirpt); + } + else + { + if (fb_prior_directory) free(fb_prior_directory); + fb_prior_directory = strdup_padded(directory); + } + while (dir_entry != 0) + { /*direntry*/ + if ((fb_showdotfiles) || ((dir_entry->d_name[0] != '.') || (strcmp(dir_entry->d_name,"..") == 0))) + if (strcmp(dir_entry->d_name,".") != 0) + { /*fileorsubdir*/ + strcpy_safe(pathname, directory, MXLEN-100); strcat(pathname,"/"); + strcat( pathname, dir_entry->d_name ); + erno = stat( pathname, &buf ); + if (erno) + printf("Bad file name %s\n", pathname ); + else + if (S_ISDIR(buf.st_mode)) /* If subdirectory, then */ + { /*dir*/ /* Enqueue onto subdirectory list. */ + if (not_banned_dir( dir_entry->d_name )) + { /*ok*/ + newitem = fb_new_dirlist_item( dir_entry->d_name, buf.st_size, buf.st_mtime ); + previtem = 0; /* Insert in sorted order. */ + flstptr = dir_sublist_hd; + if (fb_sort_state == 0) + { /* Insert in alphabetic-sorted order. */ + while ((flstptr != 0) && (strcmp(flstptr->filename, dir_entry->d_name) < 0 )) + { previtem = flstptr; flstptr = flstptr->nxt; } + } + else + { /* Insert in date-sorted rder. */ + while ((flstptr != 0) && (flstptr->file_date > buf.st_mtime)) + { previtem = flstptr; flstptr = flstptr->nxt; } + } + if (previtem == 0) { dir_sublist_hd = newitem; } + else { previtem->nxt = newitem; } + newitem->nxt = flstptr; + } /*ok*/ + } /*dir*/ + else + if (not_banned(dir_entry->d_name) && ((wildcard_array[0] == 0) || (fb_wildcard_match( dir_entry->d_name, wildcard_array )))) + { /* Otherwise, Enqueue on regular files list. */ + newitem = fb_new_dirlist_item( dir_entry->d_name, buf.st_size, buf.st_mtime ); + previtem = 0; /* Insert in sorted order. */ + flstptr = dir_filelist_hd; + if (fb_sort_state == 0) + { /* Insert in alphabetic-sorted order. */ + while ((flstptr != 0) && (strcmp(flstptr->filename, dir_entry->d_name) < 0 )) + { previtem = flstptr; flstptr = flstptr->nxt; } + } + else + { /* Insert in date-sorted order. */ + while ((flstptr != 0) && ( flstptr->file_date > buf.st_mtime )) + { previtem = flstptr; flstptr = flstptr->nxt; } + } + if (previtem == 0) { dir_filelist_hd = newitem; } + else { previtem->nxt = newitem; } + newitem->nxt = flstptr; + } + + } /*fileorsubdir*/ + dir_entry = readdir(dirpt); + } /*direntry*/ + closedir( dirpt ); + } /*ok*/ + + /* First add an empty item at top of list, because it is always pre-selected. */ + for (j=0; j < FB_COLUMNS; j++) dir_row[j][0] = '\0'; + add_multicolumn_selection_item( mylist, FB_COLUMNS, dir_row ); + + /* First list the directories at this level. */ + flstptr = dir_sublist_hd; + while (flstptr != 0) + { + // fb_truncate_fname( word, flstptr->filename, 46 ); /* Limit file names to no longer than 45 characters. */ + /* If file is older than six months, list year, else list time of day. */ + time_struct = localtime( &(flstptr->file_date) ); + day = time_struct->tm_year * (12 * 31) + time_struct->tm_mon * 31 + time_struct->tm_mday; + if (fb_current_day - day > 6 * 31) + sprintf(yeartime,"%d", time_struct->tm_year + 1900 ); + else + { + fb_format_minutes( time_struct->tm_min, minfrmt ); + sprintf(yeartime,"%2d:%s", time_struct->tm_hour, minfrmt ); + } + month_value = time_struct->tm_mon; + if ((month_value < 0) || (month_value > 11)) { printf("ERROR: BAD MONTH %d for file %s\n", month_value, pathname ); month_value = 12; } + column = 0; + strcpy( dir_row[column++],"d"); + #if (SHOWFILESIZE == 1) + // sprintf( dir_row[1], "%7d", (int)((double)(flstptr->sz) / 1000.0 + 0.5) ); + sprintf( dir_row[column], "%7ld", flstptr->sz ); + spread2rightjustify( dir_row[column++] ); + #endif + strcpy( dir_row[column], month_name[month_value] ); + sprintf(twrd1," %2d ", time_struct->tm_mday ); + strcat( dir_row[column], twrd1 ); + sprintf(twrd1,"%5s", yeartime ); + strcat( dir_row[column++], twrd1 ); + free( dir_row[column] ); + dir_row[column] = strdup( flstptr->filename ); + // sprintf(line, "d %8ld %s %2d %5s %s", flstptr->sz, month_name[month_value], time_struct->tm_mday, yeartime, flstptr->filename ); + add_multicolumn_selection_item( mylist, FB_COLUMNS, dir_row ); + n_entries++; + olditem = flstptr; + flstptr = flstptr->nxt; /* Free file entries as we list them. */ + free( olditem ); + } + + /* Second list the regular files at this level. */ + flstptr = dir_filelist_hd; + while (flstptr != 0) + { + // fb_truncate_fname( word, flstptr->filename, 46.0 ); /* Limit file names to no longer than 45 characters. */ + /* If file is older than six months, list year, else list time of day. */ + time_struct = localtime( &(flstptr->file_date) ); + day = time_struct->tm_year * (12 * 31) + time_struct->tm_mon * 31 + time_struct->tm_mday; + if (fb_current_day - day > 6 * 31) + sprintf(yeartime,"%d", time_struct->tm_year + 1900 ); + else + { + fb_format_minutes( time_struct->tm_min, minfrmt ); + sprintf(yeartime,"%2d:%s", time_struct->tm_hour, minfrmt ); + } + month_value = time_struct->tm_mon; + if ((month_value < 0) || (month_value > 11)) { printf("ERROR: BAD MONTH %d for file %s\n", month_value, pathname ); month_value = 12; } + if ((!fb_dirsonly) || (fb_allowfiles)) + { + column = 0; + strcpy( dir_row[column++]," "); + #if (SHOWFILESIZE == 1) + // sprintf( dir_row[column], "%7d", (int)((double)(flstptr->sz) / 1000.0 + 0.5) ); + sprintf( dir_row[column], "%7ld", flstptr->sz ); + spread2rightjustify( dir_row[column++] ); + #endif + strcpy( dir_row[column], month_name[month_value] ); + sprintf(twrd1," %2d ", time_struct->tm_mday ); + strcat( dir_row[column], twrd1 ); + sprintf(twrd1,"%5s", yeartime ); + strcat( dir_row[column++], twrd1 ); + free( dir_row[column] ); + dir_row[column] = strdup( flstptr->filename ); + add_multicolumn_selection_item( mylist, FB_COLUMNS, dir_row ); + n_entries++; + } + olditem = flstptr; + flstptr = flstptr->nxt; /* Free file entries as we list them. */ + free( olditem ); + } + } /*listdirectory*/ + + /* Cleanup any temporary wildcards. */ + j = 0; + while (wildcard_array[j] != 0) { free(wildcard_array[j]); j++; } + + ypos = fbwinheight - 105; + make_label( fbrowser_frame, 296, ypos - 11, "Sort by:" ); + if (fb_sort_state) + { + radio_sort_by_date = make_radio_button( fbrowser_frame, 0, 427, ypos-13, "Dates", fb_re_sort_bydate, "Dates" ); + radio_sort_by_alpha = make_radio_button( fbrowser_frame, radio_sort_by_date, 353, ypos-13, "Names", fb_re_sort_alpha, "Alpha" ); + } + else + { + radio_sort_by_alpha = make_radio_button( fbrowser_frame, 0, 353, ypos-13, "Names", fb_re_sort_alpha, "Alpha" ); + radio_sort_by_date = make_radio_button( fbrowser_frame, radio_sort_by_alpha, 427, ypos-13, "Dates", fb_re_sort_bydate, "Dates" ); + } + + make_label( fbrowser_frame, 2, ypos, prompt ); + #ifdef __MINGW32__ + make_button( fbrowser_frame, fbwinwidth - 110, ypos - 15, "New Folder", fb_create_new_dir, 0 ); + #else + make_button( fbrowser_frame, fbwinwidth - 85, ypos - 15, "New Dir", fb_create_new_dir, 0 ); + #endif + ypos = ypos + 22; + if (fb_altdirs) /* If alternate-directories list is populated, then place selector button. */ + { struct fb_word_list_item *altdir=fb_altdirs; + pulldown = make_menu_button( fbrowser_frame, fbwinwidth - 30, ypos, "v" ); + add_tool_tip( most_recent_menu, "Jump to alternate or recent directories." ); + while (altdir != 0) + { + add_menu_item( pulldown, altdir->word, fb_select_and_go, altdir->word ); + altdir = altdir->nxt; + } + frmbx_wdth_pix = fbwinwidth - 30 - 25; + } + else + frmbx_wdth_pix = fbwinwidth - 30; + fb_filename_formbox = make_formbox_bypix( fbrowser_frame, 25, ypos, frmbx_wdth_pix, filename, maxlength, fb_accept, 0 ); + + make_button( fbrowser_frame, 10, fbwinheight - 41, " OK ", fb_accept, 0 ); + + posx1 = 0.30; + make_label( fbrowser_frame, posx1 * fbwinwidth - 70, fbwinheight - 35 + 2, "File Types:" ); + frmbx_wdth_pix = 90; + fb_wildcard_formbox = make_formbox_bypix( fbrowser_frame, posx1 * fbwinwidth, fbwinheight - 41, frmbx_wdth_pix, wildcards, 500, fb_wildcard_accept, 0 ); + btn = make_button( fbrowser_frame, posx1 * fbwinwidth + 107, fbwinheight - 41, "Filter", fb_wildcard_accept, 0 ); + add_tool_tip( btn, "Refresh file listing showing only files matching the current filter strings." ); + btn = make_button( fbrowser_frame, posx1 * fbwinwidth + 178, fbwinheight - 41, "Clr", fb_wildcard_clear, 0 ); + add_tool_tip( btn, "Clear filter wildcards to Show All File Types." ); + btn = make_button( fbrowser_frame, posx1 * fbwinwidth + 238, fbwinheight - 41, "Res", fb_wildcard_restore, 0 ); + add_tool_tip( btn, "Restore the normal file filter types." ); + + make_button( fbrowser_frame, fbwinwidth - 79, fbwinheight - 41, "Cancel ", cancel_fbwindow, 0 ); + for (j=0; j < FB_COLUMNS; j++) free(dir_row[j]); + free(pathname); + free(twrd1); + free(word); + free(line); + show_wind( fbwindow ); +} + + + +void fb_extract_path_fname( char *fullname, char *path, char *fname ) +{ + int j, k; + j = strlen( fullname ) - 1; + while ((j >= 0) && (fullname[j] != '/') && (fullname[j] != '\\')) + j--; + if (j < 0) + { /*No slashes in fullname. Assume it is a filename only.*/ + path[0] = '\0'; + strcpy( fname, fullname ); + } + else + { + k = 0; + while (k <= j) + { path[k] = fullname[k]; k++; } + path[k] = '\0'; + k = 0; j++; + while (fullname[j] != '\0') + fname[k++] = fullname[j++]; + fname[k] = '\0'; + } +} + + + +GtkWidget *fbwinframe; + +static gboolean fb_expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer data ) +{ + int new_width, new_height; + gtk_window_get_size( GTK_WINDOW( fbwindow ), &new_width, &new_height ); + if ((abs( new_width - fbwinwidth ) > 15) || (abs( new_height - fbwinheight ) > 15)) + { + fbwinwidth = new_width; + fbwinheight = new_height; + gtk_widget_destroy( fbrowser_frame ); + fbrowser_frame = gtk_fixed_new(); + gtk_container_add( GTK_CONTAINER( fbwinframe ), fbrowser_frame ); + renderBrowseFiles0( fbdata.prompt, fbdata.maxlength, fbdata.directory, fbdata.wildcards, fbdata.filename, fbdata.callback ); + } + return 0; +} + + +void BrowseFiles0( char *prompt, int maxlength, char *directory, char *wildcards, char *filename, void (*callback)(char *fname) ) +{ + fbwinheight = 525; + if (SHOWFILESIZE) + fbwinwidth = 750; + else + fbwinwidth = 700; + fbdata.prompt = strdup( prompt ); + fbdata.maxlength = maxlength; + fbdata.directory = strdup_padded( directory ); + fbdata.wildcards = strdup( wildcards ); + fbdata.filename = strdup( filename ); + fbdata.callback = callback; + fbwinframe = make_window( fbwinwidth+10, fbwinheight, "File Browser", &fbwindow ); + gtk_window_set_resizable( GTK_WINDOW( fbwindow ), 1 ); + g_signal_connect( fbwindow, "draw", G_CALLBACK(fb_expose_event), NULL); + fbrowser_frame = gtk_fixed_new(); + gtk_container_add( GTK_CONTAINER( fbwinframe ), fbrowser_frame ); + renderBrowseFiles0( prompt, maxlength, directory, wildcards, filename, callback ); +} + + +void Browse_Files( char *prompt, int maxlength, char *directory, char *wildcards, char *filename, void (*callback)(char *fname) ) +{ + fb_callback = callback; + fb_prompt = strdup( prompt ); + fb_maxlen = maxlength; + fb_dnptr = directory; + strcpy_safe( fb_wildcard_default, wildcards, 500 ); + strcpy_safe( fb_wildcard, wildcards, 500 ); + fb_wcptr = wildcards; + fb_fnptr = filename; + fb_dirsonly = 0; + BrowseFiles0( fb_prompt, maxlength, directory, wildcards, filename, callback ); +} + + +void Browse_Dirs( char *prompt, int maxlength, char *directory, char *wildcards, char *dirname, void (*callback)(char *fdname) ) +{ + fb_callback = callback; + fb_prompt = strdup( prompt ); + fb_maxlen = maxlength; + fb_dnptr = directory; + strcpy_safe( fb_wildcard_default, wildcards, 500 ); + strcpy_safe( fb_wildcard, wildcards, 500 ); + fb_wcptr = wildcards; + fb_fnptr = dirname; + fb_dirsonly = 1; + BrowseFiles0( fb_prompt, maxlength, directory, wildcards, dirname, callback ); +} + +void fb_allow_files( int state ) /* Sets whether Browse_Dirs can return path */ +{ /* to a regular file, or only directories. */ + fb_allowfiles = state; /* Zero=false (no-files, dirs-only), 1=true (allow files or directories). */ +} + +void fb_show_dotfiles( int state ) /* Sets whether file-browser shows files beginning with dot. */ +{ fb_showdotfiles = state; } /* 0=no. 1=yes. */ + +/* ------------------------ End File Browser --------------------------*/ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/gtk_utils.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/gtk_utils.c new file mode 100755 index 0000000..e7b4245 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/gtk_utils.c @@ -0,0 +1,1344 @@ +/********************************************************************************/ +/* Gtk_Utils.c - Re-usable convenience functions for making Gtk-based */ +/* applications. Useful calls for common GUI widgets, makes creating new */ +/* Gtk programs simple, quick, easier, and more robust and maintainable. */ +/* */ +/* To compile Gtk programs, add: */ +/* `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` */ +/* ... to your compile command. */ +/* */ +/* Version 1.2 - 1-27-2014 */ +/********************************************************************************/ +#include "gtk_utils.h" +GtkWidget *outer_window=0; + + +/********************************************************************************/ +/* strcpy_safe - Copy src string to dst string, upto maxlen characters. */ +/* Safer than strncpy, because it does not fill destination string, */ +/* but only copies up to the length needed. Src string should be */ +/* null-terminated, and must-be if its allocated length is shorter than maxlen. */ +/* Up to maxlen-1 characters are copied to dst string. The dst string is always */ +/* null-terminated. The dst string should be pre-allocated to at least maxlen */ +/* bytes. However, this function will work safely for dst arrays that are less */ +/* than maxlen, as long as the null-terminated src string is known to be */ +/* shorter than the allocated length of dst, just like regular strcpy. */ +/********************************************************************************/ +void strcpy_safe( char *dst, const char *src, int maxlen ) +{ + int j=0, oneless; + oneless = maxlen - 1; + while ((j < oneless) && (src[j] != '\0')) { dst[j] = src[j]; j++; } + dst[j] = '\0'; +} + + + + +/* ------------- GTK Text / Label Routines ----------------- */ + +GtkWidget *make_label( GtkWidget *panel, int xpos, int ypos, const char *text ) +{ + GtkWidget *bpanel, *label; + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + label = gtk_label_new( text ); + gtk_container_add( GTK_CONTAINER( bpanel ), label ); + return label; +} + +void modify_label( GtkWidget *label, const char *newtext ) +{ + gtk_label_set_text( (GtkLabel *)label, newtext ); +} + +void set_widget_color( GtkWidget *label, const char *color_value ) /* Specify colors as: "#rrggbb" in hex 00-ff. */ +{ + GdkColor color; + gdk_color_parse( color_value, &color ); + gtk_widget_modify_fg( label, GTK_STATE_NORMAL, &color ); +} + +void set_background_color( GtkWidget *label, const char *color_value ) /* Specify colors as: "#rrggbb" in hex 00-ff. */ +{ + GdkColor color; + gdk_color_parse( color_value, &color ); + gtk_widget_modify_bg( label, GTK_STATE_NORMAL, &color ); +} + +GtkWidget *make_sized_label( GtkWidget *panel, int xpos, int ypos, const char *text, float fontsize ) +{ + GtkWidget *bpanel, *label; + char *tmptxt; + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + label = gtk_label_new( "" ); + tmptxt = (char *)malloc( strlen(text) + 100 ); + sprintf( tmptxt, "" ); strcat( tmptxt, text ); strcat( tmptxt, "" ); + gtk_label_set_markup( (GtkLabel *)label, tmptxt ); + free( tmptxt ); + gtk_container_add( GTK_CONTAINER( bpanel ), label ); + return label; +} + + + +/* ------------- End GTK Text / Label Routines ----------------- */ + + + + +/* ------------- GTK Button Routines ----------------- */ + +GtkWidget *make_button( GtkWidget *panel, int xpos, int ypos, const char *label, void callback(GtkWidget *, void *), void *data ) +{ + GtkWidget *bpanel, *button; + + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + button = gtk_button_new_with_label( label ); + if (callback != 0) + gtk_signal_connect( GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC( callback ), data ); + gtk_container_add( GTK_CONTAINER( bpanel ), button ); + return button; +} + + +void cxpm_next_word( char *line, char *word, char *delim ) +{ + int i=0, j=0, m=0, nodelim=1; + while ((line[i]!='\0') && (nodelim)) /* Consume any preceding white-space. */ + { + j = 0; + while ((delim[j]!='\0') && (line[i]!=delim[j])) j = j + 1; + if (line[i]==delim[j]) { i = i + 1; } else nodelim = 0; + } + while ((line[i]!='\0') && (!nodelim)) /* Copy the word until the next delimiter. */ + { + word[m++] = line[i++]; + if (line[i]!='\0') + { + j = 0; + while ((delim[j]!='\0') && (line[i]!=delim[j])) j = j + 1; + if (line[i]==delim[j]) nodelim = 1; + } + } + j = 0; /* Shorten line. */ + while (line[i]!='\0') { line[j++] = line[i++]; } + /* Terminate the char-strings. */ + line[j] = '\0'; + word[m] = '\0'; +} + + +unsigned char cxhexpair( char *x ) +{ + unsigned char val; + if (x[0] <= '9') val = x[0] - 48; + else + if (x[0] <= 'F') val = x[0] - 55; + else val = x[0] - 87; + if (x[1] <= '9') val = (val << 4) + x[1] - 48; + else + if (x[1] <= 'F') val = (val << 4) + x[1] - 55; + else val = (val << 4) + x[1] - 87; + return val; +} + +unsigned char *decode_xpm( const char **xpm_icon, int *wd, int *ht ) +{ + int j, k, mm=0, ncolors, cppx, tabsz=256, pp; + char line[100], word[100]; + unsigned char *rtab, *gtab, *btab, *img; + strcpy( line, xpm_icon[0] ); + cxpm_next_word( line, word, " \t" ); + if (sscanf( word, "%d", wd ) != 1) { printf("Error reading wd '%s'\n", word ); exit(1); } + cxpm_next_word( line, word, " \t" ); + if (sscanf( word, "%d", ht ) != 1) { printf("Error reading ht '%s'\n", word ); exit(1); } + cxpm_next_word( line, word, " \t" ); + if (sscanf( word, "%d", &ncolors ) != 1) { printf("Error reading ncolors '%s'\n", word ); exit(1); } + cxpm_next_word( line, word, " \t" ); + if (sscanf( word, "%d", &cppx ) != 1) { printf("Error reading cppx '%s'\n", word ); exit(1); } + if (cppx > 1) { tabsz = 256 * tabsz; if (cppx > 2) { printf("Error cppx of '%d' not supported.\n", cppx ); exit(1); }} + rtab = (unsigned char *)malloc( tabsz ); + gtab = (unsigned char *)malloc( tabsz ); + btab = (unsigned char *)malloc( tabsz ); + for (j=1; j <= ncolors; j++) + { + strcpy( line, xpm_icon[j] ); + k = line[0]; + if (cppx > 1) { k = (k << 8) + line[1]; pp = 2; } + else pp = 1; + cxpm_next_word( &(line[pp]), word, " \t" ); /* Should have "c". */ + cxpm_next_word( &(line[pp]), word, " \t" ); + if (word[0] == '#') + { + rtab[k] = cxhexpair( &(word[1]) ); + gtab[k] = cxhexpair( &(word[3]) ); + btab[k] = cxhexpair( &(word[5]) ); + } + else + { + rtab[k] = 250; gtab[k] = 0; btab[k] = 0; + } + } + img = (unsigned char *)malloc( 3 * *wd * *ht ); + for (j=0; j < *ht; j++) + { + for (k=0; k < *wd * cppx; k = k + cppx) + { + pp = xpm_icon[ncolors+1+j][k]; + if (cppx > 1) pp = (pp << 8) + xpm_icon[ncolors+1+j][k+1]; + img[mm++] = rtab[pp]; + img[mm++] = gtab[pp]; + img[mm++] = btab[pp]; + } + } + free( rtab ); free( gtab ); free( btab ); + return img; +} + + +GtkWidget *make_button_wicon( GtkWidget *panel, int xpos, int ypos, const char **icon, void callback(GtkWidget *, void *), void *data ) +{ /* Be sure to somewhere set: g_object_set( gtk_settings_get_default(), "gtk-button-images", TRUE, NULL); */ + GtkWidget *bpanel, *button, *image; /* To use, "#include" an xpm image file of icon. */ + GdkPixbuf *pixbuf; /* Make sure variable-name at top of data declaration matches "icon" name */ + /* called in this function. (You call it with that variable name.) */ + int wd, ht; + unsigned char *imgdata; + + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + button = gtk_button_new(); + if (callback != 0) + gtk_signal_connect( GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC( callback ), data ); + gtk_container_add( GTK_CONTAINER( bpanel ), button ); + imgdata = decode_xpm( icon, &wd, &ht ); + pixbuf = gdk_pixbuf_new_from_data( imgdata, GDK_COLORSPACE_RGB, 0, 8, wd, ht, 3 * wd, 0, 0 ); + image = gtk_image_new_from_pixbuf( pixbuf ); + gtk_button_set_image( (GtkButton *)button, image ); + return button; +} + +#if (0) + GtkWidget *make_button_wicon_old( GtkWidget *panel, int xpos, int ypos, const char **icon, void callback(GtkWidget *, void *), void *data ) + { /* Be sure to somewhere set: g_object_set( gtk_settings_get_default(), "gtk-button-images", TRUE, NULL); */ + GtkWidget *bpanel, *button, *image; /* To use, "#include" an xpm image file of icon. */ + GdkPixbuf *pixbuf; /* Make sure variable-name at top of data declaration matches "icon" name */ + /* called in this function. (You call it with that variable name.) */ + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + button = gtk_button_new(); + if (callback != 0) + gtk_signal_connect( GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC( callback ), data ); + gtk_container_add( GTK_CONTAINER( bpanel ), button ); + pixbuf = gdk_pixbuf_new_from_xpm_data( (const char **)icon ); + image = gtk_image_new_from_pixbuf( pixbuf ); + gtk_button_set_image( (GtkButton *)button, image ); + return button; + } +#endif + +GtkWidget *make_button_wsizedcolor_text( GtkWidget *panel, int xpos, int ypos, const char *text, float fontsize, + const char *color_value, void callback(GtkWidget *, void *), void *data ) +{ + GtkWidget *bpanel, *button, *label; + GdkColor color; + char *tmptxt; + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + button = gtk_button_new(); + label = gtk_label_new( "" ); + tmptxt = (char *)malloc( strlen(text) + 100 ); + sprintf( tmptxt, "" ); strcat( tmptxt, text ); strcat( tmptxt, "" ); + gtk_label_set_markup( (GtkLabel *)label, tmptxt ); + if (strcmp( color_value, "#000000" ) != 0) + { + gdk_color_parse( color_value, &color ); + gtk_widget_modify_fg( label, GTK_STATE_NORMAL, &color ); + } + free( tmptxt ); + gtk_container_add( GTK_CONTAINER( button ), label ); + if (callback != 0) + gtk_signal_connect( GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC( callback ), data ); + gtk_container_add( GTK_CONTAINER( bpanel ), button ); + return button; +} + + + +/* ------------- End GTK Button Routines ----------------- */ + + + + +/* ------------- GTK Radio Button Routines ----------------- */ + +GtkWidget *make_radio_button( GtkWidget *panel, GtkWidget *group, int xpos, int ypos, const char *label, void callback(GtkWidget *, void *), const void *data ) +{ + GtkWidget *bpanel, *button; + + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + button = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( group ), label ); + if (callback != 0) + gtk_signal_connect( GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC( callback ), (gpointer)data ); + gtk_container_add( GTK_CONTAINER( bpanel ), button ); + return button; +} + +void set_radio_button( GtkWidget *radio_button ) +{ + gtk_toggle_button_set_active( (GtkToggleButton *)radio_button, 1 ); +} +/* ------------- End GTK Radio Button Routines ----------------- */ + + + + +/* ------------- GTK Toggle Button Routines ----------------- */ + +GtkWidget *make_toggle_button( GtkWidget *panel, int xpos, int ypos, const char *label, int state, void callback(GtkWidget *, void *), void *data ) +{ + GtkWidget *bpanel, *button; + + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + button = gtk_check_button_new_with_label( label ); + if (callback != 0) + gtk_signal_connect( GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC( callback ), data ); + gtk_container_add( GTK_CONTAINER( bpanel ), button ); + gtk_toggle_button_set_active( (GtkToggleButton *)button, state ); + return button; +} + +void set_toggle_button( GtkWidget *toggle_button, int state ) +{ + gtk_toggle_button_set_active( (GtkToggleButton *)toggle_button, state ); +} +/* ------------- End GTK Toggle Button Routines ----------------- */ + + + + +/* ------------- GTK Form-Box (Text-Entry Box) Routines ----------------- */ + float charsperpix=0.109; + GtkWidget *current_formbox; + +GtkEntry *make_formbox( GtkWidget *panel, int xpos, int ypos, int nchars_wide, const char *text, int maxlen, + void callback(GtkWidget *, void *), void *data ) +{ + GtkWidget *formbox, *bpanel; + formbox = gtk_entry_new(); + gtk_entry_set_max_length( GTK_ENTRY(formbox), maxlen ); + gtk_entry_set_text( GTK_ENTRY(formbox), text ); + bpanel = gtk_fixed_new(); + current_formbox = bpanel; + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + gtk_entry_set_width_chars( GTK_ENTRY(formbox), nchars_wide ); + if (callback != 0) + gtk_signal_connect( GTK_OBJECT(formbox), "activate", GTK_SIGNAL_FUNC( callback ), data ); + gtk_container_add( GTK_CONTAINER( bpanel ), formbox ); + return GTK_ENTRY(formbox); +} + + +GtkEntry *make_formbox_bypix( GtkWidget *panel, int xpos, int ypos, int npix_wide, const char *text, int maxlen, + void callback(GtkWidget *, void *), void *data ) +{ + int nchars; + GtkEntry *nfrmbx; + GtkRequisition actual; + nchars = charsperpix * npix_wide; + nfrmbx = make_formbox( panel, xpos, ypos, nchars, text, maxlen, callback, data ); + gtk_widget_size_request( (GtkWidget *)nfrmbx, &actual ); /* Find the box's actual size. */ + if ((actual.width > npix_wide + 1) || (npix_wide - actual.width > 1.0 / charsperpix)) + { + gtk_widget_destroy( current_formbox ); + charsperpix = charsperpix * (float)npix_wide / (float)(actual.width); + nchars = charsperpix * npix_wide; + nfrmbx = make_formbox( panel, xpos, ypos, nchars, text, maxlen, callback, data ); + } + return nfrmbx; +} + + +void modify_formbox( GtkEntry *formbox, const char *text ) +{ + gtk_entry_set_text( formbox, text ); +} + + +char *get_formbox( GtkEntry *formbox ) +{ + return (char *)gtk_entry_get_text( formbox ); /* Returns string poiner, which must NOT be freed. */ +} + + +void get_formbox_text( GtkEntry *formbox, char *rtrnstrng, int maxlen ) +{ + char *tmpstrptr; + tmpstrptr = (char *)gtk_entry_get_text( formbox ); + strcpy_safe( rtrnstrng, tmpstrptr, maxlen ); +} + + + /*--- Example Usage: + GtkEntry *formbox1; + + SetFormBox_Routine() + { + int nchars; + nchars = 0.109 * frmbx_wdth_pix; // Good rule of thumb. + formbox1 = make_formbox( panel, xpos, ypos, nchars, "0", 1024, action_routine, 0 ); + } + + Retreival_routine() + { + char *word; + word = get_formbox( formbox1 ); + printf("Text = '%s'\n", word ); + } + ---*/ + +/* ------------- GTK Form-Box (Text-Entry Box) Routines ----------------- */ + + +/* ------------- GTK Text-Edit Box Routines ----------------- */ + +GtkTextView *make_text_edit_box( GtkWidget *panel, int xpos, int ypos, int width, int height, const char *text ) /* Multi-line text entry/edit widget. */ +{ + GtkWidget *bpanel, *scroll_window, *frame; + GtkTextView *textview; + GtkTextBuffer *buffer; + + textview = (GtkTextView *)gtk_text_view_new(); + buffer = gtk_text_view_get_buffer( textview ); + gtk_text_buffer_set_text( buffer, text, -1 ); + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + gtk_widget_set_size_request( bpanel, width, height ); + + scroll_window = gtk_scrolled_window_new( NULL, NULL ); + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scroll_window ), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS ); + gtk_widget_set_size_request( scroll_window, width, height ); + + frame = gtk_frame_new(""); + gtk_frame_set_shadow_type( (GtkFrame *)frame, GTK_SHADOW_OUT ); + gtk_container_add( GTK_CONTAINER( scroll_window ), (GtkWidget *)textview ); + gtk_container_add( GTK_CONTAINER( frame ), scroll_window ); + gtk_container_add( GTK_CONTAINER( bpanel ), frame ); + return textview; +} + + +void modify_text_edit_box( GtkTextView *textview, const char *text ) +{ + GtkTextBuffer *buf; + buf = gtk_text_view_get_buffer( textview ); + gtk_text_buffer_set_text( buf, text, -1 ); +} + + +void get_text_edit_box( GtkTextView *textview, char *rtrnstrng, int maxlen ) +{ + GtkTextBuffer *buf; + GtkTextIter start, end; + char *tmpstrptr; + + buf = gtk_text_view_get_buffer( textview ); + gtk_text_buffer_get_bounds( buf, &start, &end ); + tmpstrptr = gtk_text_buffer_get_text( buf, &start, &end, 0 ); + strcpy_safe( rtrnstrng, tmpstrptr, maxlen ); +} + + + /*--- Example Usage: + GtkTextView *txtedt; + + MakeTextEditWindow_Routine() + { + txtedt = make_text_edit_box( panel, 2, 2, 200, 100, "Initial text\n is here." ); + } + + Retreival_routine() + { + char word[1000]; + get_text_edit_box( txtedt, word, 1000 ); + printf("Text = '%s'\n", word ); + } + ---*/ + +/* ------------- GTK Text-Edit-Box Routines ----------------- */ + + + +/* ------------- GTK Slider Routines ----------------- */ + +GtkWidget *make_slider( GtkWidget *panel, int xpos, int ypos, int size, char orien, double min, double initval, double max, \ + void callback(GtkWidget *, void *), void *data ) +{ /* Read double value with: x = gtk_range_get_value( GTK_RANGE( slider ) ); */ + GtkWidget *bpanel, *slider; + + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + if (orien == 'h') + { + slider = gtk_hscale_new_with_range( min, max, 0.05 * (max - min) ); + gtk_widget_set_size_request( slider, size, 40 ); + } + else + { + slider = gtk_vscale_new_with_range( min, max, 0.1 * (max - min) ); + gtk_widget_set_size_request( slider, 40, size ); + } + if (callback != 0) + gtk_signal_connect( GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC( callback ), data ); + gtk_container_add( GTK_CONTAINER( bpanel ), slider ); + gtk_range_set_value( GTK_RANGE(slider), initval ); + return slider; +} + + /*--- Example Usage: + void slide_adj( GtkWidget *widget, gpointer data ) + { + double x; + x = gtk_range_get_value( GTK_RANGE(widget) ); + printf("Slider Adjusted '%g'\n", x ); + } + + ... + make_slider( panel, xpos, ypos, size, 'h', minv, initval, maxval, slide_adj, 0 ); + ---*/ + +void adjust_slider( GtkWidget *slider, double newvalue ) +{ + gtk_range_set_value( GTK_RANGE(slider), newvalue ); +} + +/* ------------- End GTK Slider Routines ----------------- */ + + + + +/* ------------- GTK FormBoxWithSuggestor ------------------- */ + +GtkSpinButton *make_FormBoxWithSuggestor( GtkWidget *panel, int xpos, int ypos, float min, + float initval, float max, float step, int ndigits ) +{ + GtkWidget *bpanel; + GtkAdjustment *spinner_adj; + GtkSpinButton *spinbox; + spinner_adj = (GtkAdjustment *)gtk_adjustment_new( initval, min, max, step, 3, 0 ); + spinbox = (GtkSpinButton *)gtk_spin_button_new( spinner_adj, step, ndigits ); + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + gtk_container_add( GTK_CONTAINER( bpanel ), (GtkWidget *)spinbox ); + return spinbox; +} + + +GtkSpinButton *make_FormBoxWithSuggestor_bypix( GtkWidget *panel, int xpos, int ypos, int w1, float min, + float initval, float max, float step, int ndigits ) +{ + GtkWidget *bpanel; + GtkAdjustment *spinner_adj; + GtkSpinButton *spinbox; + spinner_adj = (GtkAdjustment *)gtk_adjustment_new( initval, min, max, step, 3, 0 ); + spinbox = (GtkSpinButton *)gtk_spin_button_new( spinner_adj, step, ndigits ); + gtk_widget_set_size_request( (GtkWidget *)spinbox, w1, 25); + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + gtk_container_add( GTK_CONTAINER( bpanel ), (GtkWidget *)spinbox ); + return spinbox; +} + + +float get_FormBoxWithSuggestor_Value( GtkSpinButton *spinbox ) +{ return gtk_spin_button_get_value( spinbox ); } + + +void set_FormBoxWithSuggestor_value( GtkSpinButton *spinbox, float value ) +{ gtk_spin_button_set_value( spinbox, value ); } + + +/*--- + make_combobox - Creates a kind of text-box that the user cannot type into, but has + a selector on the right, from which the user can pick any alphanumeric setting. +---*/ +GtkWidget *make_combobox( GtkWidget *panel, int xpos, int ypos, int width ) +{ + GtkWidget *bpanel, *combobox; + combobox = (GtkWidget *)gtk_combo_box_text_new(); + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + gtk_widget_set_size_request( combobox, width, 25 ); + gtk_container_add( GTK_CONTAINER( bpanel ), combobox ); + return combobox; +} + +void add_combo_suggestion( GtkWidget *combobox, char *itemtext ) +{ + gtk_combo_box_text_append_text( (GtkComboBoxText *)combobox, itemtext ); +} + +void select_combo_suggestion( GtkWidget *combobox, int item ) +{ + gtk_combo_box_set_active( (GtkComboBox *)combobox, item ); +} + + /* Example to read value from: frmbx1 = make_combobox( panel, x, y, 30 ); + word = gtk_combo_box_text_get_active_text( (GtkComboBoxText *)frmbx1 ); + */ + + +/*--- + make_formbox_wcombo - Like "make_combobox" above, but users can also type their + own values into the text box, as well as select them. +---*/ +GtkWidget *make_formbox_wcombo( GtkWidget *panel, int xpos, int ypos, int width ) +{ + GtkWidget *bpanel, *combobox; + combobox = gtk_combo_box_entry_new_text(); + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + gtk_widget_set_size_request( combobox, width, 25 ); + gtk_container_add( GTK_CONTAINER( bpanel ), combobox ); + return combobox; +} + +void add_form_suggestion( GtkWidget *combobox, char *text ) +{ + gtk_combo_box_append_text( GTK_COMBO_BOX( combobox ), text ); +} + + /* Example to read value from: frmbx2 = make_formbox_wcombo( panel, x, y, 30 ); + word = strdup( gtk_entry_get_text( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( frmbx2 ) ) ) ) ); + */ + + +/* ------------- End GTK FormBoxWithSuggestor ------------------- */ + + + + + +/* ------------- GTK Menu Routines ----------------- */ +GtkWidget *most_recent_menu=0; + +GtkWidget *make_menu( GtkWidget *tool_bar, const char *label ) /* For use on automatically placed menu-bars. */ +{ + GtkWidget *new_menu, *sub_menu; + new_menu = gtk_menu_item_new_with_label( label ); + gtk_menu_bar_append( GTK_MENU_BAR( tool_bar ), new_menu ); + sub_menu = gtk_menu_new(); + gtk_menu_item_set_submenu( GTK_MENU_ITEM( new_menu ), sub_menu ); + return sub_menu; +} + + +GtkWidget *make_menu_button( GtkWidget *panel, int xpos, int ypos, const char *label ) /* For use anywhere on a window. */ +{ + GtkWidget *new_menu, *sub_menu, *bpanel; + bpanel = gtk_menu_bar_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + new_menu = gtk_menu_item_new_with_label( label ); + most_recent_menu = new_menu; + gtk_container_add( GTK_CONTAINER( bpanel ), new_menu ); + sub_menu = gtk_menu_new(); + gtk_menu_item_set_submenu( GTK_MENU_ITEM( new_menu ), sub_menu ); + return sub_menu; +} + + +GtkWidget *add_menu_item( GtkWidget *menu, const char *label, void callback(GtkWidget *, void *), void *data ) +{ + GtkWidget *menuitem; + menuitem = gtk_menu_item_new_with_label( label ); + if (callback != 0) + gtk_signal_connect( GTK_OBJECT(menuitem), "activate", G_CALLBACK( callback ), data ); + gtk_menu_append( GTK_MENU(menu), menuitem ); + return menuitem; +} + + +GtkWidget *add_submenu( GtkWidget *menu, const char *label ) +{ + GtkWidget *menuitem, *submenu; + menuitem = gtk_menu_item_new_with_label( label ); + gtk_menu_append( GTK_MENU(menu), menuitem ); + submenu = gtk_menu_new(); + gtk_menu_item_set_submenu( GTK_MENU_ITEM( menuitem ), submenu ); + return submenu; +} + + +void modify_menu_label( GtkWidget *menu_label, const char *newtext ) /* A 'menu_label' is what is returned by add_menu_item(). */ +{ + gtk_menu_item_set_label( (GtkMenuItem *)menu_label, newtext ); +} + +/* ----------- End GTK Menu Routines ---------------- */ + + + + +/* ------------- GTK Selection List Routines ----------------- */ +GtkWidget *most_recent_selector_box=0, *LastBpanel; + +GtkTreeStore *make_selection_list( GtkWidget *panel, int xpos, int ypos, int width, int height, const char *column_titles, + void callback(GtkWidget *, void *), void dclick_callback(GtkWidget *, void *), void *data ) +{ + GtkWidget *bpanel, *scroll_window, *tree; + GtkTreeStore *list; + GtkCellRenderer *renderer; + GtkTreeViewColumn *column; + GtkTreeSelection *select; + + list = gtk_tree_store_new( 1, G_TYPE_STRING ); + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + gtk_widget_set_size_request( bpanel, width, height ); + LastBpanel = bpanel; + + scroll_window = gtk_scrolled_window_new( NULL, NULL ); + most_recent_selector_box = scroll_window; + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scroll_window ), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS ); + gtk_widget_set_size_request( scroll_window, width, height ); + gtk_container_add( GTK_CONTAINER( bpanel ), scroll_window ); + + tree = gtk_tree_view_new_with_model( GTK_TREE_MODEL( list ) ); + renderer = gtk_cell_renderer_text_new(); + column = gtk_tree_view_column_new_with_attributes( column_titles, renderer, "text", 0, NULL ); + gtk_tree_view_append_column( GTK_TREE_VIEW(tree), column ); + if (dclick_callback != 0) + g_signal_connect( G_OBJECT( tree ), "row-activated", G_CALLBACK( dclick_callback ), data ); + + gtk_container_add( GTK_CONTAINER( scroll_window ), tree ); + select = gtk_tree_view_get_selection( GTK_TREE_VIEW(tree) ); + gtk_tree_selection_set_mode( select, GTK_SELECTION_SINGLE ); + if (callback != 0) + g_signal_connect( G_OBJECT(select), "changed", G_CALLBACK( callback ), data ); + + /* Cluge: Create blank entry at top of list, since first entry is always preselected and cannot be selected by user. */ + // gtk_tree_store_append( list, &iter, 0 ); + // gtk_tree_store_set( list, &iter, 0, "", -1 ); + + return list; +} + +void append_selection_list( GtkTreeStore *list, GtkTreeIter *iter, const char *item ) +{ /* To use, just declare a "GtkTreeIter iter;", and pass its address in. */ + gtk_tree_store_append( list, iter, 0 ); + gtk_tree_store_set( list, iter, 0, item, -1 ); +} + +void append_selection_child( GtkTreeStore *list, GtkTreeIter *iter, GtkTreeIter *child, char *item ) +{ /* Must declare "GtkTreeIter iter, child;", and pass their addresses in. */ + gtk_tree_store_append( list, child, iter ); + gtk_tree_store_set( list, child, 0, item, -1 ); +} + + +char *get_selection_from_list( GtkWidget *selection ) +{ + GtkTreeIter iter; + GtkTreeModel *model; + char *selected_item; + + if (gtk_tree_selection_get_selected( (GtkTreeSelection *)selection, &model, &iter)) + { + gtk_tree_model_get(model, &iter, 0, &selected_item, -1); + return selected_item; + } + else return 0; +} + + +/* Example Usage: + { + GtkTreeStore *mylist; + GtkTreeIter iter; + + mylist = make_selection_list( panel, 10, 20, 80, 100, myfunction, 0 ); + for (j=0; j<10; j++) + append_selection_list( mylist, &iter, text[j] ); + } + + void myfunction( GtkWidget *wdg, void *data ) + { + char *text; + text = get_selection_from_list( wdg ); + printf("Selected: '%s'\n", text ); + } +*/ + +GtkTreeStore *make_multicolumn_selection_list( GtkWidget *panel, int xpos, int ypos, int width, int height, + int ncols, const char *column_titles[], + void callback(GtkWidget *, void *), void dclick_callback(GtkWidget *, void *), void *data ) +{ + GtkWidget *bpanel, *scroll_window, *tree; + GtkTreeStore *list; + GtkCellRenderer *renderer; + GtkTreeViewColumn *column; + GtkTreeSelection *select; + int j; + switch (ncols) + { /* This will support up to 10 columns. Extend if needed. */ + case 1: list = gtk_tree_store_new( ncols, G_TYPE_STRING ); break; + case 2: list = gtk_tree_store_new( ncols, G_TYPE_STRING, G_TYPE_STRING ); break; + case 3: list = gtk_tree_store_new( ncols, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); break; + case 4: list = gtk_tree_store_new( ncols, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); break; + case 5: list = gtk_tree_store_new( ncols, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); break; + case 6: list = gtk_tree_store_new( ncols, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); break; + case 7: list = gtk_tree_store_new( ncols, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); break; + case 8: list = gtk_tree_store_new( ncols, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); break; + case 9: list = gtk_tree_store_new( ncols, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); break; + case 10: list = gtk_tree_store_new( ncols, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); break; + default: printf("Number of columns %d not supported.\n", ncols ); exit(1); + } + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + gtk_widget_set_size_request( bpanel, width, height ); + // LastBpanel = bpanel; + scroll_window = gtk_scrolled_window_new( NULL, NULL ); + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scroll_window ), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS ); + gtk_widget_set_size_request( scroll_window, width, height ); + gtk_scrolled_window_set_shadow_type( (GtkScrolledWindow *)scroll_window, GTK_SHADOW_IN ); + gtk_container_add( GTK_CONTAINER( bpanel ), scroll_window ); + tree = gtk_tree_view_new_with_model( GTK_TREE_MODEL( list ) ); + for (j=0; j < ncols; j++) + { + renderer = gtk_cell_renderer_text_new(); + column = gtk_tree_view_column_new_with_attributes( column_titles[j], renderer, "text", j, NULL ); + gtk_tree_view_append_column( GTK_TREE_VIEW(tree), column ); + } + if (dclick_callback != 0) + g_signal_connect( G_OBJECT(tree), "row-activated", G_CALLBACK( dclick_callback ), data ); + gtk_container_add( GTK_CONTAINER( scroll_window ), tree ); + select = gtk_tree_view_get_selection( GTK_TREE_VIEW(tree) ); + gtk_tree_selection_set_mode( select, GTK_SELECTION_SINGLE ); + if (callback != 0) + g_signal_connect( G_OBJECT(select), "changed", G_CALLBACK( callback ), data ); + return list; +} + +void add_multicolumn_selection_item( GtkTreeStore *selst, int ncols, char *items[] ) +{ + GtkTreeIter iter; + gtk_tree_store_append( selst, &iter, 0 ); + switch (ncols) + { /* This will support up to 10 columns. Extend if needed. */ + case 1: gtk_tree_store_set( selst, &iter, 0, items[0], -1 ); break; + case 2: gtk_tree_store_set( selst, &iter, 0, items[0], 1, items[1], -1 ); break; + case 3: gtk_tree_store_set( selst, &iter, 0, items[0], 1, items[1], 2, items[2], -1 ); break; + case 4: gtk_tree_store_set( selst, &iter, 0, items[0], 1, items[1], 2, items[2], 3, items[3], -1 ); break; + case 5: gtk_tree_store_set( selst, &iter, 0, items[0], 1, items[1], 2, items[2], 3, items[3], 4, items[4], -1 ); break; + case 6: gtk_tree_store_set( selst, &iter, 0, items[0], 1, items[1], 2, items[2], 3, items[3], 4, items[4], 5, items[5], -1 ); break; + case 7: gtk_tree_store_set( selst, &iter, 0, items[0], 1, items[1], 2, items[2], 3, items[3], 4, items[4], 5, items[5], 6, items[6], -1 ); break; + case 8: gtk_tree_store_set( selst, &iter, 0, items[0], 1, items[1], 2, items[2], 3, items[3], 4, items[4], 5, items[5], 6, items[6], 7, items[7], -1 ); break; + case 9: gtk_tree_store_set( selst, &iter, 0, items[0], 1, items[1], 2, items[2], 3, items[3], 4, items[4], 5, items[5], 6, items[6], 7, items[7], 8, items[8], -1 ); break; + case 10: gtk_tree_store_set( selst, &iter, 0, items[0], 1, items[1], 2, items[2], 3, items[3], 4, items[4], 5, items[5], 6, items[6], 7, items[7], 8, items[8], 9, items[9], -1 ); break; + default: printf("Number of columns %d not supported.\n", ncols ); exit(1); + } +} + + /* Example Usage: + char *MY_Selected_item=0, *MY_Selected_list=0; + int MY_column_to_get=2; // --- Set this to get the column you need. + + void selected_item_by_column( GtkWidget *wdg, void *data ) + { + GtkTreeIter iter; + GtkTreeModel *model; + if (!done_init) return; + if (gtk_tree_selection_get_selected( GTK_TREE_SELECTION(wdg), &model, &iter )) + { + if (MY_Selected_item != 0) free( MY_Selected_item ); + gtk_tree_model_get( model, &iter, MY_column_to_get, &MY_Selected_item, -1 ); + MY_Selected_list = data; + printf("Column%d = %s, for %s\n", MY_, MY_Selected_item, MY_Selected_list ); + } + } + + void dclicked_item( GtkWidget *wdg, void *data ) + { printf("Dclicked '%s', for %s.\n", MY_Selected_item, MY_Selected_list ); } + + ... + GtkTreeStore *selst; + const char *headings[]={ "T1", "D2", "P3" }; + char *items[]; + selst = make_multicolumn_selection_list( winpanel, 200, 30, 180, 150, 3, headings, + selected_item, dclicked_item, "chartA" ); + items[0] = "Fries"; items[1] = "Shake"; items[2] = "Cola"; + add_multicolumn_selection_item( selst, 3, iems ); + items[0] = "Coffee"; items[1] = "Donut"; items[2] = "Beer"; + add_multicolumn_selection_item( selst, 3, iems ); + ... + */ + +/* ------------- End GTK Selection List Routines ----------------- */ + + +/* ------------- Sub-Panel Frames ----------------- */ + +GtkWidget *make_tabbed_panel_frame( GtkWidget *panel, int xpos, int ypos ) +{ + GtkWidget *bpanel, *tabbed_panel; + tabbed_panel = gtk_notebook_new(); + gtk_notebook_set_tab_pos( GTK_NOTEBOOK(tabbed_panel), GTK_POS_TOP ); + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + gtk_container_add( GTK_CONTAINER( bpanel ), tabbed_panel ); + return tabbed_panel; +} + + +GtkWidget *add_tabbed_panel( GtkWidget *tabbed_panel, int width, int height, char *tab_name ) +{ /* Adds a tabbed-panel to a tabbed_panel_frame. */ + GtkWidget *bpanel, *label; + bpanel = gtk_fixed_new(); + gtk_widget_set_size_request( bpanel, width, height ); + label = gtk_label_new( tab_name ); /* Tab-name. */ + gtk_notebook_append_page( GTK_NOTEBOOK(tabbed_panel), bpanel, label ); + return bpanel; +} + + +GtkWidget *make_framed_panel( GtkWidget *panel, int xpos, int ypos, int width, int height, char *frame_name ) +{ /* Creates an outlined rectangular area for adding widgets inside it. */ + GtkWidget *bpanel, *frame; + frame = gtk_frame_new( frame_name ); + // gtk_container_set_border_width( GTK_CONTAINER(frame), 10 ); + gtk_widget_set_size_request( frame, width, height ); + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED(panel), bpanel, xpos, ypos ); + gtk_container_add( GTK_CONTAINER(bpanel), frame ); + return bpanel; +} + + +/* ------------- Sub-Window or (Detachable) Pop-up Window Making Routines ----------------- */ + +GtkWindowPosition window_position_policy=GTK_WIN_POS_CENTER_ON_PARENT, + top_window_position_policy=GTK_WIN_POS_CENTER; + +void close_any_window( GtkWidget *widget, gpointer data ) +{ + GtkWidget *(*win0) = (GtkWidget **)data; + if (data == 0) { printf("Close_Any_Window: Zero data\n"); return; } + if (*win0 != 0) gtk_widget_destroy( *win0 ); + *win0 = 0; +} + + +int killed_any_window( GtkWidget *widget, GdkEvent *event, gpointer data ) +{ + GtkWidget *(*win0) = (GtkWidget **)data; + *win0 = 0; + return 0; /* Returning "0" causes window to be destroyed. */ +} + + +void place_window_center() { window_position_policy = GTK_WIN_POS_CENTER_ON_PARENT; } +void place_window_atmouse() { window_position_policy = GTK_WIN_POS_MOUSE; } + + +GtkWidget *make_window( int width, int height, const char *title, GtkWidget **winptr ) +{ /* You must call "show_wind(winptr)" after creating all widgets under this window!! */ + GtkWidget *winframe; + if (*winptr != 0) gtk_widget_destroy( *winptr ); + *winptr = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_widget_set_size_request( *winptr, width, height ); + gtk_window_set_transient_for( GTK_WINDOW( *winptr ), GTK_WINDOW( outer_window ) ); + gtk_window_set_position( GTK_WINDOW( *winptr ), window_position_policy ); /* Other option(s): GTK_WIN_POS_CENTER, GTK_WIN_POS_MOUSE, GTK_WIN_POS_CENTER_ON_PARENT. */ + gtk_window_set_title( GTK_WINDOW( *winptr ), title ); + g_signal_connect( GTK_OBJECT( *winptr ), "delete-event", G_CALLBACK( killed_any_window ), (gpointer)winptr ); + winframe = gtk_fixed_new(); + gtk_container_add( GTK_CONTAINER( *winptr ), winframe ); + gtk_window_set_resizable( GTK_WINDOW( *winptr ), 0 ); + return winframe; +} + + + /* New window and Register user's own killed callback. It must return 0. */ +GtkWidget *make_window_wkill( int width, int height, const char *title, GtkWidget *(*winptr), int callback(GtkWidget *, void *) ) +{ /* You must call "show_wind(winptr)" after creating all widgets under this window!! */ + GtkWidget *winframe; + if (*winptr != 0) gtk_widget_destroy( *winptr ); + *winptr = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_widget_set_size_request( *winptr, width, height ); + gtk_window_set_transient_for( GTK_WINDOW( *winptr ), GTK_WINDOW( outer_window ) ); + gtk_window_set_position( GTK_WINDOW( *winptr ), window_position_policy ); /* Other option(s): GTK_WIN_POS_CENTER, GTK_WIN_POS_MOUSE, GTK_WIN_POS_CENTER_ON_PARENT. */ + gtk_window_set_title( GTK_WINDOW( *winptr ), title ); + gtk_signal_connect( GTK_OBJECT( *winptr ), "delete_event", GTK_SIGNAL_FUNC( callback ), winptr ); + winframe = gtk_fixed_new(); + gtk_container_add( GTK_CONTAINER( *winptr ), winframe ); + gtk_window_set_resizable( GTK_WINDOW( *winptr ), 0 ); + return winframe; +} + + /* Like above, but set horz/vert-scroll to 1 or 0, to enable or disable respective scroll. */ +GtkWidget *make_scrolled_window_wkill( int width, int height, const char *title, GtkWidget *(*winptr), + int horzscroll, int vertscroll, int callback(GtkWidget *, void *) ) +{ /* You must call "show_wind(winptr)" after creating all widgets under this window!! */ + GtkWidget *winframe, *swin; + if (*winptr != 0) gtk_widget_destroy( *winptr ); + *winptr = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_widget_set_size_request( *winptr, width, height ); + gtk_window_set_transient_for( GTK_WINDOW( *winptr ), GTK_WINDOW( outer_window ) ); + gtk_window_set_position( GTK_WINDOW( *winptr ), window_position_policy ); /* Other option(s): GTK_WIN_POS_CENTER, GTK_WIN_POS_MOUSE, GTK_WIN_POS_CENTER_ON_PARENT. */ + gtk_window_set_title( GTK_WINDOW( *winptr ), title ); + if (callback != 0) + gtk_signal_connect( GTK_OBJECT( *winptr ), "delete_event", GTK_SIGNAL_FUNC( callback ), winptr ); + else + gtk_signal_connect( GTK_OBJECT( *winptr ), "delete_event", GTK_SIGNAL_FUNC( killed_any_window ), winptr ); + gtk_window_set_resizable( GTK_WINDOW( *winptr ), 0 ); + winframe = gtk_fixed_new(); + swin = gtk_scrolled_window_new( 0, 0 ); + if (horzscroll) horzscroll = GTK_POLICY_ALWAYS; else horzscroll = GTK_POLICY_NEVER; + if (vertscroll) vertscroll = GTK_POLICY_ALWAYS; else vertscroll = GTK_POLICY_NEVER; + gtk_scrolled_window_set_policy( (GtkScrolledWindow *)swin, (GtkPolicyType)horzscroll, (GtkPolicyType)vertscroll ); + gtk_scrolled_window_add_with_viewport( (GtkScrolledWindow *)swin, winframe ); + gtk_container_add( GTK_CONTAINER( *winptr ), swin ); + return winframe; +} + + + /* Initial call to set up outermost window. */ +GtkWidget *init_top_outer_window( int *argc, char ***argv, int winwidth, int winhght, const char *title, + int horzscroll, int vertscroll ) +{ /* Set horz/vert-scroll to 1 or 0, enable or discable respective scroll. */ + GtkWidget *outer_frame, *swin; + gtk_init( argc, argv ); + outer_window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_widget_set_size_request( outer_window, winwidth, winhght ); + gtk_window_set_title( GTK_WINDOW( outer_window ), title ); + gtk_window_set_position( GTK_WINDOW( outer_window ), top_window_position_policy ); + outer_frame = gtk_fixed_new(); + if (horzscroll || vertscroll) + { + if (horzscroll) horzscroll = GTK_POLICY_ALWAYS; else horzscroll = GTK_POLICY_NEVER; + if (vertscroll) vertscroll = GTK_POLICY_ALWAYS; else vertscroll = GTK_POLICY_NEVER; + swin = gtk_scrolled_window_new( 0, 0 ); + gtk_scrolled_window_set_policy( (GtkScrolledWindow *)swin, (GtkPolicyType)horzscroll, (GtkPolicyType)vertscroll ); + gtk_scrolled_window_add_with_viewport( (GtkScrolledWindow *)swin, outer_frame ); + gtk_container_add( GTK_CONTAINER( outer_window ), swin ); + } + else + gtk_container_add( GTK_CONTAINER( outer_window ), outer_frame ); + return outer_frame; +} + + +void show_wind( GtkWidget *wind ) +{ + gtk_widget_show_all( wind ); +} + + + /**** ---- Example window making function. ---- + GtkWidget *win1=0; + + void respond_to_some_event( GtkWidget *widget, gpointer data ) + { + GtkWidget *panel; + + panel = make_window( 400, 150, "Test Win", &win1 ); + + ---- Place all window items here .... ---- + make_button( panel, 20, 20, " OK ", close_any_window, &win1 ); + + gtk_widget_show_all( win1 ); + } + + ****/ + +/* ------------- Sub-Window or (Detachable) Pop-up Window Making Routines ----------------- */ + + + + +/* ------------- GTK Separator Routines ----------------- */ + +GtkWidget *make_vseparator( GtkWidget *panel, int xpos, int y1, int y2 ) +{ + GtkWidget *sep; + sep = gtk_vseparator_new(); + gtk_fixed_put( GTK_FIXED( panel ), sep, xpos, y1 ); + gtk_widget_set_size_request( sep, 5, y2 - y1 ); + return sep; +} + + +GtkWidget *make_hseparator( GtkWidget *panel, int x1, int x2, int ypos ) +{ + GtkWidget *sep; + sep = gtk_hseparator_new(); + gtk_fixed_put( GTK_FIXED( panel ), sep, x1, ypos ); + gtk_widget_set_size_request( sep, x2 - x1, 5 ); + return sep; +} + + +GtkWidget *make_rectangular_separator( GtkWidget *panel, int x1, int y1, int x2, int y2 ) +{ + GtkWidget *sep; + sep = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), sep, 0, 0 ); + make_hseparator( sep, x1, x2, y1 ); + make_vseparator( sep, x1, y1, y2 ); + make_vseparator( sep, x2, y1, y2 ); + make_hseparator( sep, x1, x2, y2 ); + return sep; +} + +/* ------------- End GTK Separator Routines ----------------- */ + + +/*------------------------------------------------------------------------------ + attach_image_from_file - Reads image from jpg/gif file, and places on panel + at specified position and size. Returns 0 on error, else returns widget. + ------------------------------------------------------------------------------*/ +GtkWidget *attach_image_from_file( GtkWidget *panel, char *imgfname, int xpos, int ypos, int width, int height ) +{ + GtkWidget *pic, *wdg; + GdkPixbuf *pixbuf; + pixbuf = gdk_pixbuf_new_from_file_at_scale( imgfname, width, height, 0, 0 ); + if (pixbuf == 0) { printf("Error reading image-file '%s'\n", imgfname ); return 0; } + pic = gtk_image_new_from_pixbuf( pixbuf ); + wdg = gtk_fixed_new(); /* Position a widget. */ + gtk_fixed_put( GTK_FIXED( panel ), wdg, xpos, ypos ); + gtk_container_add( GTK_CONTAINER( wdg ), pic ); /* Attach image. */ + return wdg; +} + + +/*------------------------------------------------------------------------------*/ +/* place_image - This routine displays an image on the named panel, at the */ +/* specified (x,y) position. Image_pixels = image_width x image_height */ +/* Allocate and initialize image as: */ +/* imagedata = (unsigned char *)malloc( 4 * image_pixels ); */ +/* imagedata[ 4 * (image_width * row + col) ] = Blue; */ +/* imagedata[ 4 * (image_width * row + col) + 1 ] = Green; */ +/* imagedata[ 4 * (image_width * row + col) + 2 ] = Red; */ +/* Where values are 0=dark to 255=bright. */ +/* You can de-allocate or re-use image array after calling this function. */ +/*------------------------------------------------------------------------------*/ +void place_image( GtkWidget *window, int image_width, int image_height, int pos_x, int pos_y, unsigned char *imagedata ) +{ + int stride; + cairo_surface_t *image; + cairo_t *cr; + + cr = gdk_cairo_create( window->window ); + stride = cairo_format_stride_for_width( CAIRO_FORMAT_RGB24, image_width ); + /* stride should now equal (4 * image_width). */ + image = cairo_image_surface_create_for_data( imagedata, CAIRO_FORMAT_RGB24, image_width, image_height, stride ); + cairo_set_source_surface( cr, image, pos_x, pos_y ); + cairo_paint(cr); + cairo_destroy(cr); +} + + +/* --- Convert Data to Image (cdti) Routines --- */ +/* --- These routines retreive image-data from pre-initialized arrays stored within a program, for display. --- */ +/* (The pre-stored array text can be created from the "data2code.c" utility.) */ +unsigned char cdti_get_next_byte( char *data, int *indx ) +{ + unsigned char ch, ch0, ch1; + ch0 = data[ *indx ]; *indx = *indx + 1; + if (ch0 > 60) ch0 = ch0 - 87; else ch0 = ch0 - 48; + ch1 = data[ *indx ]; *indx = *indx + 1; + if (ch1 > 60) ch1 = ch1 - 87; else ch1 = ch1 - 48; + ch = (ch0 << 4) | ch1; + return ch; +} + +int cdti_read_binary_number( char *data, int *indx ) +{ + int k=0; + unsigned char ch; + do + { + ch = cdti_get_next_byte( data, indx ); + if (ch == '#') while (cdti_get_next_byte( data, indx ) != '\n'); + } + while (ch == '#'); + while ((ch >= '0') && (ch <= '9')) + { + k = (ch - '0') + 10 * k; + ch = cdti_get_next_byte( data, indx ); + } + return k; +} + +unsigned char *cdti_convert_data_to_image( char *data, int dimension, int *imgwd, int *imght ) +{ /* Assumes PPM (P6, raw) file. */ + unsigned char r, g, b, *imagedata; + int indx=0, ht=0, wd=0, mm=0; + + /* P6#sdsawidth height255binary-data */ + /* 1 2 3 4 */ + + if ((cdti_get_next_byte( data, &indx ) != 'P') || (cdti_get_next_byte( data, &indx ) != '6')) + { printf("Error: Image data does not have expected header.\n"); return 0; } + while (cdti_get_next_byte( data, &indx ) != '\n'); + wd = cdti_read_binary_number( data, &indx ); + ht = cdti_read_binary_number( data, &indx ); + // printf("Image %d x %d\n", wd, ht ); + cdti_read_binary_number( data, &indx ); + imagedata = (unsigned char *)malloc( 4 * wd * ht ); + while (indx < dimension) + { + r = cdti_get_next_byte( data, &indx ); + g = cdti_get_next_byte( data, &indx ); + b = cdti_get_next_byte( data, &indx ); + imagedata[ mm++ ] = b; + imagedata[ mm++ ] = g; + imagedata[ mm++ ] = r; + mm++; + } + *imgwd = wd; + *imght = ht; + return imagedata; +} +/* --- End of cdti routines --- */ + + +/* ------------- Tool Tips / Hover Notes ----------------- */ + +GtkTooltips *add_tool_tip( GtkWidget *wdg, const char *text ) /* Adds tool-tip to button, etc. */ +{ + GtkTooltips *tt; + tt = gtk_tooltips_new(); + gtk_tooltips_set_tip( tt, wdg, text, 0 ); + return tt; +} + +/* ------------- File Browser ----------------- */ + +void canceled_file_browser( GtkWidget *wdg, void *fb ) { gtk_widget_destroy( (GtkWidget *)fb ); } + +char *file_browser_filter=0; + +GtkWidget *file_browser_popup( const char *dir, const char *text, void callback(GtkWidget *, void *) ) +{ + GtkWidget *fb; + fb = gtk_file_selection_new( text ); + if (file_browser_filter != 0) + gtk_file_selection_complete( (GtkFileSelection *)fb, file_browser_filter ); + gtk_file_selection_set_filename( GTK_FILE_SELECTION(fb), dir ); + gtk_signal_connect( GTK_OBJECT( GTK_FILE_SELECTION( fb )->ok_button ), "clicked", (GtkSignalFunc)callback, fb ); + gtk_signal_connect( GTK_OBJECT( GTK_FILE_SELECTION( fb )->cancel_button ), "clicked", (GtkSignalFunc)canceled_file_browser, fb ); + show_wind( fb ); + return fb; +} + + + /* Example usage: + void receive_filename( GtkWidget *wdg, void *fs ) + { + char *yourfilename; + yourfilename = strdup( gtk_file_selection_get_filename( (GtkFileSelection *)fs ) ); + gtk_widget_destroy( fs ); + printf("Absolute path = '%s'\n", yourfilename ); + free( yourfilename ); + } + + file_browser_popup( ".", "Select File", receive_filename ); + */ + + +/* ------------- Progress Bar ----------------- */ + +void adjust_progress_bar( GtkWidget *wdg, double fraction ) +{ + gtk_progress_bar_set_fraction( (GtkProgressBar *)wdg, fraction ); +} + + +GtkWidget *make_progress_bar( GtkWidget *panel, int xpos, int ypos, int width, char *text ) +{ + GtkWidget *bpanel, *bar; + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + bar = gtk_progress_bar_new(); + gtk_progress_bar_set_text( (GtkProgressBar *)bar, text ); + if (width < 1) width = 150; /* Assume default width if not specified. */ + gtk_widget_set_size_request( bar, width, 20 ); + gtk_container_add( GTK_CONTAINER( bpanel ), bar ); + return bar; +} + + + +/* ------------- General Stuff ----------------- */ +int udchck_flag=0; + +void UpdateCheck() /* Process any pending window events. */ +{ + if (udchck_flag) return; + udchck_flag = 1; + while (gtk_events_pending()) + { + gtk_main_iteration_do( 0 ); + } + udchck_flag = 0; +} + + +GTimer *mytimer=0; + +double Report_Time() /* Reports time in seconds, accurate to millisecs, for checking time differences. */ +{ + if (mytimer==0) + { + mytimer = g_timer_new(); + g_timer_start( mytimer ); + return 0.0; + } + else + return g_timer_elapsed( mytimer, 0 ); // (double)GetTickCount() * 1.0e-3; +} + + +void Sleep_seconds( float dt_seconds ) +{ + g_usleep( (int)(dt_seconds * 1e6) ); +} + + +/* ------------- End General Stuff ----------------- */ + + +/* --------------- Back-compatibility Stuff ------------ */ + +GtkEntry *new_formbox( GtkWidget *panel, int xpos, int ypos, int nchars_wide, const char *text, int maxlen, + void callback(GtkWidget *, void *), void *data ) + { return make_formbox( panel, xpos, ypos, nchars_wide, text, maxlen, callback, data ); } + +GtkEntry *new_formbox_bypix( GtkWidget *panel, int xpos, int ypos, int npix_wide, const char *text, int maxlen, + void callback(GtkWidget *, void *), void *data ) + { return make_formbox_bypix( panel, xpos, ypos, npix_wide, text, maxlen, callback, data ); } + +GtkTextView *new_text_edit_box( GtkWidget *panel, int xpos, int ypos, int width, int height, const char *text ) + { return make_text_edit_box( panel, xpos, ypos, width, height, text ); } + +GtkTreeStore *new_selection_list( GtkWidget *panel, int xpos, int ypos, int width, int height, const char *column_titles, + void callback(GtkWidget *, void *), void dclick_callback(GtkWidget *, void *), void *data ) + { return make_selection_list( panel, xpos, ypos, width, height, column_titles, callback, dclick_callback, data ); } + +GtkWidget *new_window( int width, int height, const char *title, GtkWidget *(*winptr) ) + { return make_window( width, height, title, winptr ); } + +GtkWidget *new_window_wkill( int width, int height, const char *title, GtkWidget *(*winptr), int callback(GtkWidget *, void *) ) + { return make_window_wkill( width, height, title, winptr, callback ); } + +GtkWidget *new_scrolled_window_wkill( int width, int height, const char *title, GtkWidget *(*winptr), + int horzscroll, int vertscroll, int callback(GtkWidget *, void *) ) + { return make_scrolled_window_wkill( width, height, title, winptr, horzscroll, vertscroll, callback ); } + +/* --------------- End Back-compatibility Stuff ------------ */ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/gtk_utils.h b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/gtk_utils.h new file mode 100755 index 0000000..11e4c9b --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/gtk_utils.h @@ -0,0 +1,355 @@ +#include +#include + +#define GtkUtils_Version 1.0 + + +/* ------------- Text-Label Routines ----------------- */ +GtkWidget *make_label( GtkWidget *panel, int xpos, int ypos, const char *text ); + +void modify_label( GtkWidget *label, const char *newtext ); +void set_widget_color( GtkWidget *label, const char *color_value ); /* Specify colors as: "#rrggbb" in hex 00-ff. */ +void set_background_color( GtkWidget *label, const char *color_value ); +GtkWidget *make_sized_label( GtkWidget *panel, int xpos, int ypos, const char *text, float fontsize ); /* Default = 10.0. */ + + +/* ------------- Button Routines ----------------- */ +GtkWidget *make_button( GtkWidget *panel, int xpos, int ypos, const char *label, void callback(GtkWidget *, void *), void *data ); + +GtkWidget *make_button_wicon( GtkWidget *panel, int xpos, int ypos, const char **icon, void callback(GtkWidget *, void *), void *data ); + /* Be sure to somewhere set: g_object_set( gtk_settings_get_default(), "gtk-button-images", TRUE, NULL); */ + /* To use, "#include" an xpm image file of icon. Make variable-name at top of XPM file match "icon" name */ + /* called in this function. (You call it with that variable name.) */ + + +/* ------------- Radio Button Routines ----------------- */ +GtkWidget *make_radio_button( GtkWidget *panel, GtkWidget *group, int xpos, int ypos, const char *label, + void callback(GtkWidget *, void *), const void *data ); + +void set_radio_button( GtkWidget *radio_button ); + + +/* ------------- Toggle Button Routines ----------------- */ +GtkWidget *make_toggle_button( GtkWidget *panel, int xpos, int ypos, const char *label, int state, void callback(GtkWidget *, void *), void *data ); + +void set_toggle_button( GtkWidget *tog_button, int state ); + + +/* ------------- Form-Box (Text-Entry Box) Routines ----------------- */ +GtkEntry *make_formbox( GtkWidget *panel, int xpos, int ypos, int nchars_wide, const char *text, int maxlen, + void callback(GtkWidget *, void *), void *data ); + +GtkEntry *make_formbox_bypix( GtkWidget *panel, int xpos, int ypos, int npix_wide, const char *text, int maxlen, + void callback(GtkWidget *, void *), void *data ); + +void modify_formbox( GtkEntry *formbox, const char *text ); + +char *get_formbox( GtkEntry *formbox ); /* Returns string poiner, which must NOT be freed. */ + +void get_formbox_text( GtkEntry *formbox, char *rtrnstrng, int maxlen ); + + /*--- Example Usage: + GtkEntry *formbox1; + + SetFormBox_Routine() + { + int nchars; + nchars = 0.109 * frmbx_wdth_pix; // Good rule of thumb. + formbox1 = make_formbox( panel, ypos, xpos, nchars, "0", 1024, action_routine, 0 ); + } + + Retreival_routine() + { + char *word; + word = get_formbox( formbox1 ); + printf("Text = '%s'\n", word ); + } + ---*/ + +/* ------------- GTK Text-Edit Box Routines ----------------- */ /* Multi-line text-edit widget. */ +GtkTextView *make_text_edit_box( GtkWidget *panel, int xpos, int ypos, int width, int height, const char *text ); + +void modify_text_edit_box( GtkTextView *textview, const char *text ); + +void get_text_edit_box( GtkTextView *textview, char *rtrnstrng, int maxlen ); + + /*--- Example Usage: + GtkTextView *txtedt; + + MakeTextEditWindow_Routine() + { + txtedt = make_text_edit_box( panel, 2, 2, 200, 100, "Initial text\n is here." ); + } + + Retreival_routine() + { + char word[1000]; + get_text_edit_box( txtedt, word, 1000 ); + printf("Text = '%s'\n", word ); + } + ---*/ + + + +/* ------------- Menu Routines ----------------- */ + +GtkWidget *make_menu( GtkWidget *tool_bar, const char *label ); /* For use on automatically spaced menu-bars. */ + +GtkWidget *make_menu_button( GtkWidget *panel, int xpos, int ypos, const char *label ); /* For use anywhere on a window. */ + +GtkWidget *add_menu_item( GtkWidget *menu, const char *label, void callback(GtkWidget *, void *), void *data ); + +GtkWidget *add_submenu( GtkWidget *menu, const char *label ); + +void modify_menu_label( GtkWidget *menu_label, const char *newtext ); /* A 'menu_label' is what is returned by add_menu_item(). */ + + + +/* ------------- GTK Selection List Routines ----------------- */ + +GtkTreeStore *make_selection_list( GtkWidget *panel, int xpos, int ypos, int width, int height, const char *column_titles, + void callback(GtkWidget *, void *), void dclick_callback(GtkWidget *, void *), void *data ); + +void append_selection_list( GtkTreeStore *list, GtkTreeIter *iter, const char *item ); + +char *get_selection_from_list( GtkWidget *selection ); + + + /* Example Usage: + { + GtkTreeStore *mylist; + GtkTreeIter iter; + mylist = make_selection_list( panel, 10, 20, 80, 100, myfunction, 0, 0 ); + for (j=0; j<10; j++) + append_selection_list( mylist, &iter, text[j] ); + } + + void myfunction( GtkWidget *wdg, void *data ) + { + char *text; + text = get_selection_from_list( wdg ); + printf("Selected: '%s'\n", text ); + } + */ + +GtkTreeStore *make_multicolumn_selection_list( GtkWidget *panel, int xpos, int ypos, int width, int height, + int ncols, const char *column_titles[], + void callback(GtkWidget *, void *), void dclick_callback(GtkWidget *, void *), void *data ); +void add_multicolumn_selection_item( GtkTreeStore *selst, int ncols, char *items[] ); + + /* Example Usage: + char *MY_Selected_item=0, *MY_Selected_list=0; + int MY_column_to_get=2; // --- Set this to get the column you need. + + void selected_item_by_column( GtkWidget *wdg, void *data ) + { + GtkTreeIter iter; + GtkTreeModel *model; + if (!done_init) return; + if (gtk_tree_selection_get_selected( GTK_TREE_SELECTION(wdg), &model, &iter )) + { + if (MY_Selected_item != 0) free( MY_Selected_item ); + gtk_tree_model_get( model, &iter, MY_column_to_get, &MY_Selected_item, -1 ); + MY_Selected_list = data; + printf("Column %d = %s, for %s\n", MY_column_to_get, MY_Selected_item, MY_Selected_list ); + } + } + + void dclicked_item( GtkWidget *wdg, void *data ) + { + printf("Dclicked '%s', for %s.\n", MY_Selected_item, MY_Selected_list ); + } + + ... + GtkTreeStore *selst; + const char *headings[]={ "T1", "D2", "P3" }; + char *items[]; + selst = make_multicolumn_selection_list( winpanel, 200, 30, 180, 150, 3, headings, + selected_item, dclicked_item, "chartA" ); + items[0] = "Fries"; items[1] = "Shake"; items[2] = "Cola"; + add_multicolumn_selection_item( selst, 3, iems ); + items[0] = "Coffee"; items[1] = "Donut"; items[2] = "Beer"; + add_multicolumn_selection_item( selst, 3, iems ); + ... + */ + + +/* ------------- GTK FormBoxWithSuggestor ------------------- */ + +GtkSpinButton *make_FormBoxWithSuggestor( GtkWidget *panel, int xpos, int ypos, float min, float initval, + float max, float step, int ndigits ); + +float get_FormBoxWithSuggestor_Value( GtkSpinButton *spinbox ); + +void set_FormBoxWithSuggestor_value( GtkSpinButton *spinbox, float value ); + + /* + make_combobox - Creates a kind of text-box that the user cannot type into, + but has a selector on the right, from which the user can pick any alphanumeric setting. + */ +GtkWidget *make_combobox( GtkWidget *panel, int xpos, int ypos, int width ); +void add_combo_suggestion( GtkWidget *combobox, char *itemtext ); +void select_combo_suggestion( GtkWidget *combobox, int item ); + + /* Example to read value from: frmbx1 = make_combobox( panel, x, y, 30 ); + word = gtk_combo_box_text_get_active_text( (GtkComboBoxText *)frmbx1 ); + */ + + /* + make_formbox_wcombo - Like "make_combobox" above, but users can also type their + own values into the text box, as well as select them. + */ +GtkWidget *make_formbox_wcombo( GtkWidget *panel, int xpos, int ypos, int width ); +void add_form_suggestion( GtkWidget *combobox, char *text ); + + /* Example to read value from: frmbx2 = make_formbox_wcombo( panel, x, y, 30 ); + word = strdup( gtk_entry_get_text( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( frmbx2 ) ) ) ) ); + */ + + +/* ------------- Separator Routines ----------------- */ + +GtkWidget *make_vseparator( GtkWidget *panel, int xpos, int y1, int y2 ); +GtkWidget *make_hseparator( GtkWidget *panel, int x1, int x2, int ypos ); +GtkWidget *make_rectangular_separator( GtkWidget *panel, int x1, int y1, int x2, int y2 ); + + + +/* ------------- GTK Slider Routines ----------------- */ + +GtkWidget *make_slider( GtkWidget *panel, int xpos, int ypos, int size, char orien, double min, double initval, double max, + void callback(GtkWidget *, void *), void *data ); + + /*--- Example Usage: + void slide_adj( GtkWidget *widget, gpointer data ) + { + double x; + x = gtk_range_get_value( GTK_RANGE(widget) ); + printf("Slider Adjusted '%g'\n", x ); + } + + ... + make_slider( panel, xpos, ypos, size, 'h', minv, initval, maxval, slide_adj, 0 ); + ---*/ + + +/* ------------- Sub-Panel Frames ----------------- */ + +GtkWidget *make_tabbed_panel_frame( GtkWidget *panel, int xpos, int ypos ); +GtkWidget *add_tabbed_panel( GtkWidget *tabbed_panel, int width, int height, char *tab_name ); + +GtkWidget *make_framed_panel( GtkWidget *panel, int xpos, int ypos, int width, int height, char *frame_name ); + + +/* ------------- Sub-Window or (Detachable) Pop-up Window Making Routines ----------------- */ + +GtkWidget *make_window( int width, int height, const char *title, GtkWidget *(*winptr) ); + + /* Create new window and register user's own killed callback. It must return 0. */ +GtkWidget *make_window_wkill( int width, int height, const char *title, GtkWidget *(*winptr), int callback(GtkWidget *, void *) ); + + /* Like above, but set horz/vert-scroll to 1 or 0, to enable or disable respective scroll. */ +GtkWidget *make_scrolled_window_wkill( int width, int height, const char *title, GtkWidget *(*winptr), + int horzscroll, int vertscroll, int callback(GtkWidget *, void *) ); + + /* Initial call to set up outermost window. */ +GtkWidget *init_top_outer_window( int *argc, char ***argv, int winwidth, int winhght, const char *title, + int horzscroll, int vertscroll ); + +void close_any_window( GtkWidget *widget, gpointer data ); + +int killed_any_window( GtkWidget *widget, GdkEvent *event, gpointer data ); + +void place_window_center(); +void place_window_atmouse(); +void show_wind( GtkWidget *wind ); + + + /**** ---- Example window making function. ---- + GtkWidget *win1=0; + + void respond_to_some_event( GtkWidget *widget, gpointer data ) + { + GtkWidget *panel; + + panel = make_window( 400, 150, "Test Win", &win1 ); + + ---- Place all window items here .... ---- + make_button( panel, 20, 20, " OK ", close_any_window, &win1 ); + + show_wind( win1 ); + } + + ****/ + + + + +/* ------------- GTK Image Routines ----------------- */ + +/*------------------------------------------------------------------------------ + attach_image_from_file - Reads image from jpg/gif file, and places on panel + at specified position and size. Returns 0 on error, else returns widget. + ------------------------------------------------------------------------------*/ +GtkWidget *attach_image_from_file( GtkWidget *panel, char *imagefilename, int xpos, int ypos, int width, int height ); + + +/*------------------------------------------------------------------------------*/ +/* place_image - This routine displays an image on the named panel, at the */ +/* specified (x,y) position. Image pixels: image_width x image_height */ +/* Allocate and initialize image as: */ +/* imagedata = (unsigned char *)malloc( 4 * image_pixels ); */ +/* imagedata[ 4 * (image_width * row + col) ] = Blue; */ +/* imagedata[ 4 * (image_width * row + col) + 1 ] = Green; */ +/* imagedata[ 4 * (image_width * row + col) + 2 ] = Red; */ +/* Where values are 0=dark to 255=bright. */ +/* You can de-allocate or re-use image array after calling this function. */ +/*------------------------------------------------------------------------------*/ +void place_image( GtkWidget *window, int image_width, int image_height, int pos_x, int pos_y, unsigned char *imagedata ); + +/* Convert Data to Image (cdti) - Retreives image-data from pre-initialized arrays stored within program. */ +/* (The pre-stored array text can be created from the "data2code.c" utility.) */ +unsigned char *cdti_convert_data_to_image( char *data, int dimension, int *imgwd, int *imght ); + + + +/* ------------- Tool Tips / Hover Notes ----------------- */ +GtkTooltips *add_tool_tip( GtkWidget *wdg, const char *text ); /* Adds tool-tip to button, etc. */ + + +/* ------------- File Browser ----------------- */ +GtkWidget *file_browser_popup( const char *dir, const char *text, void callback(GtkWidget *, void *) ); + + /* Example usage: + void receive_filename( GtkWidget *wdg, void *fs ) + { + char *yourfilename=0; + yourfilename = strdup( gtk_file_selection_get_filename( (GtkFileSelection *)fs ) ); + gtk_widget_destroy( fs ); -- Closes file-browser window. -- + printf("Absolute path = '%s'\n", yourfilename ); + free( yourfilename ); + } + + file_browser_popup( ".", "Select File", receive_filename ); + */ + + +/* ------------- Progress Bar ----------------- */ + +void adjust_progress_bar( GtkWidget *wdg, double fraction ); + +GtkWidget *make_progress_bar( GtkWidget *panel, int xpos, int ypos, int width, char *text ); + + + +/* ------------- General Stuff ----------------- */ + +void UpdateCheck(); /* Process any pending window events. */ + +void strcpy_safe( char *dst, const char *src, int maxlen ); + +double Report_Time(); /* Reports time in seconds, accurate to millisecs, for checking time differences. */ + +void Sleep_seconds( float dt_seconds ); + +/* gtk_widget_destroy( wdg ); */ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/gtk_utils3.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/gtk_utils3.c new file mode 100755 index 0000000..1171bcb --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/gtk_utils3.c @@ -0,0 +1,1515 @@ +/********************************************************************************/ +/* Gtk_Utils.c - Re-usable convenience functions for making Gtk-based */ +/* applications. Useful calls for common GUI widgets, makes creating new */ +/* Gtk programs simple, quick, easier, and more robust and maintainable. */ +/* */ +/* To compile Gtk programs, add: */ +/* `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` */ +/* ... to your compile command. */ +/* */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA. */ +/* */ +/* Version 3.0 - 2-12-2023 */ +/********************************************************************************/ +#include "gtk_utils3.h" +GtkWidget *outer_window=0; + + +/********************************************************************************/ +/* strcpy_safe - Copy src string to dst string, upto maxlen characters. */ +/* Safer than strncpy, because it does not fill destination string, */ +/* but only copies up to the length needed. Src string should be */ +/* null-terminated, and must-be if its allocated length is shorter than maxlen. */ +/* Up to maxlen-1 characters are copied to dst string. The dst string is always */ +/* null-terminated. The dst string should be pre-allocated to at least maxlen */ +/* bytes. However, this function will work safely for dst arrays that are less */ +/* than maxlen, as long as the null-terminated src string is known to be */ +/* shorter than the allocated length of dst, just like regular strcpy. */ +/********************************************************************************/ +void strcpy_safe( char *dst, const char *src, int maxlen ) +{ + int j=0, oneless; + oneless = maxlen - 1; + while ((j < oneless) && (src[j] != '\0')) { dst[j] = src[j]; j++; } + dst[j] = '\0'; +} + + + +/* ------------- GTK Text / Label Routines ----------------- */ + +GtkWidget *make_label( GtkWidget *panel, int xpos, int ypos, const char *text ) +{ + GtkWidget *bpanel, *label; + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + label = gtk_label_new( text ); + gtk_container_add( GTK_CONTAINER( bpanel ), label ); + return label; +} + + +void modify_label( GtkWidget *label, const char *newtext ) +{ + gtk_label_set_text( (GtkLabel *)label, newtext ); +} + + +void set_label_color( GtkWidget *label, const char *color_value ) /* Specify colors as: "#rrggbb" in hex 00-ff. */ +{ + char *tmptxt; + const char *text; + text = gtk_label_get_text( (GtkLabel *)label ); + tmptxt = (char *)malloc( strlen(text) + 100 ); + sprintf( tmptxt, "" ); strcat( tmptxt, text ); strcat( tmptxt, "" ); + gtk_label_set_markup( (GtkLabel *)label, tmptxt ); + free( tmptxt ); +} + +void set_label_fgbg_color( GtkWidget *label, const char *fgrnd, const char *bkgrnd ) /* Specify colors as: "#rrggbb" in hex 00-ff. */ +{ + char *tmptxt; + const char *text; + text = gtk_label_get_text( (GtkLabel *)label ); + tmptxt = (char *)malloc( strlen(text) + 100 ); + sprintf( tmptxt, "" ); strcat( tmptxt, text ); strcat( tmptxt, "" ); + gtk_label_set_markup( (GtkLabel *)label, tmptxt ); + free( tmptxt ); +} + +GtkWidget *make_sized_label( GtkWidget *panel, int xpos, int ypos, const char *text, float fontsize ) +{ + GtkWidget *bpanel, *label; + char *tmptxt; + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + label = gtk_label_new( "" ); + tmptxt = (char *)malloc( strlen(text) + 100 ); + sprintf( tmptxt, "" ); strcat( tmptxt, text ); strcat( tmptxt, "" ); + gtk_label_set_markup( (GtkLabel *)label, tmptxt ); + free( tmptxt ); + gtk_container_add( GTK_CONTAINER( bpanel ), label ); + return label; +} + +void set_label_size_color( GtkWidget *label, float fontsize, const char *color_value ) /* Specify colors as: "#rrggbb" in hex 00-ff. */ +{ + char *tmptxt; + const char *text; + text = gtk_label_get_text( (GtkLabel *)label ); + tmptxt = (char *)malloc( strlen(text) + 128 ); + sprintf( tmptxt, "" ); strcat( tmptxt, text ); strcat( tmptxt, "" ); + gtk_label_set_markup( (GtkLabel *)label, tmptxt ); + free( tmptxt ); +} + + + + +/* ------------- End GTK Text / Label Routines ----------------- */ + + + + +/* ------------- GTK Button Routines ----------------- */ + +GtkWidget *make_button( GtkWidget *panel, int xpos, int ypos, const char *label, void callback(GtkWidget *, void *), void *data ) +{ + GtkWidget *bpanel, *button; + + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + button = gtk_button_new_with_label( label ); + if (callback != 0) + g_signal_connect( button, "clicked", G_CALLBACK( callback ), data ); + gtk_container_add( GTK_CONTAINER( bpanel ), button ); + return button; +} + + + +void cxpm_next_word( char *line, char *word, char *delim ) +{ + int i=0, j=0, m=0, nodelim=1; + while ((line[i]!='\0') && (nodelim)) /* Consume any preceding white-space. */ + { + j = 0; + while ((delim[j]!='\0') && (line[i]!=delim[j])) j = j + 1; + if (line[i]==delim[j]) { i = i + 1; } else nodelim = 0; + } + while ((line[i]!='\0') && (!nodelim)) /* Copy the word until the next delimiter. */ + { + word[m++] = line[i++]; + if (line[i]!='\0') + { + j = 0; + while ((delim[j]!='\0') && (line[i]!=delim[j])) j = j + 1; + if (line[i]==delim[j]) nodelim = 1; + } + } + j = 0; /* Shorten line. */ + while (line[i]!='\0') { line[j++] = line[i++]; } + /* Terminate the char-strings. */ + line[j] = '\0'; + word[m] = '\0'; +} + + +unsigned char cxhexpair( char *x ) +{ + unsigned char val; + if (x[0] <= '9') val = x[0] - 48; + else + if (x[0] <= 'F') val = x[0] - 55; + else val = x[0] - 87; + if (x[1] <= '9') val = (val << 4) + x[1] - 48; + else + if (x[1] <= 'F') val = (val << 4) + x[1] - 55; + else val = (val << 4) + x[1] - 87; + return val; +} + +unsigned char *decode_xpm( const char **xpm_icon, int *wd, int *ht ) +{ + int j, k, mm=0, ncolors, cppx, tabsz=256, pp; + char line[100], word[100]; + unsigned char *rtab, *gtab, *btab, *img; + strcpy( line, xpm_icon[0] ); + cxpm_next_word( line, word, " \t" ); + if (sscanf( word, "%d", wd ) != 1) { printf("Error reading wd '%s'\n", word ); exit(1); } + cxpm_next_word( line, word, " \t" ); + if (sscanf( word, "%d", ht ) != 1) { printf("Error reading ht '%s'\n", word ); exit(1); } + cxpm_next_word( line, word, " \t" ); + if (sscanf( word, "%d", &ncolors ) != 1) { printf("Error reading ncolors '%s'\n", word ); exit(1); } + cxpm_next_word( line, word, " \t" ); + if (sscanf( word, "%d", &cppx ) != 1) { printf("Error reading cppx '%s'\n", word ); exit(1); } + if (cppx > 1) { tabsz = 256 * tabsz; if (cppx > 2) { printf("Error cppx of '%d' not supported.\n", cppx ); exit(1); }} + rtab = (unsigned char *)malloc( tabsz ); + gtab = (unsigned char *)malloc( tabsz ); + btab = (unsigned char *)malloc( tabsz ); + for (j=1; j <= ncolors; j++) + { + strcpy( line, xpm_icon[j] ); + k = line[0]; + if (cppx > 1) { k = (k << 8) + line[1]; pp = 2; } + else pp = 1; + cxpm_next_word( &(line[pp]), word, " \t" ); /* Should have "c". */ + cxpm_next_word( &(line[pp]), word, " \t" ); + if (word[0] == '#') + { + rtab[k] = cxhexpair( &(word[1]) ); + gtab[k] = cxhexpair( &(word[3]) ); + btab[k] = cxhexpair( &(word[5]) ); + } + else + { + rtab[k] = 250; gtab[k] = 0; btab[k] = 0; + } + } + img = (unsigned char *)malloc( 3 * *wd * *ht ); + for (j=0; j < *ht; j++) + { + for (k=0; k < *wd * cppx; k = k + cppx) + { + pp = xpm_icon[ncolors+1+j][k]; + if (cppx > 1) pp = (pp << 8) + xpm_icon[ncolors+1+j][k+1]; + img[mm++] = rtab[pp]; + img[mm++] = gtab[pp]; + img[mm++] = btab[pp]; + } + } + free( rtab ); free( gtab ); free( btab ); + return img; +} + + +GtkWidget *make_button_wicon( GtkWidget *panel, int xpos, int ypos, const char **icon, void callback(GtkWidget *, void *), void *data ) +{ /* Be sure to somewhere set: g_object_set( gtk_settings_get_default(), "gtk-button-images", TRUE, NULL); */ + GtkWidget *bpanel, *button, *image; /* To use, "#include" an xpm image file of icon. */ + GdkPixbuf *pixbuf; /* Make sure variable-name at top of data declaration matches "icon" name */ + /* called in this function. (You call it with that variable name.) */ + int wd, ht; + unsigned char *imgdata; + + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + button = gtk_button_new(); + if (callback != 0) + g_signal_connect( button, "clicked", G_CALLBACK( callback ), data ); + gtk_container_add( GTK_CONTAINER( bpanel ), button ); + imgdata = decode_xpm( icon, &wd, &ht ); + pixbuf = gdk_pixbuf_new_from_data( imgdata, GDK_COLORSPACE_RGB, 0, 8, wd, ht, 3 * wd, 0, 0 ); + image = gtk_image_new_from_pixbuf( pixbuf ); + gtk_button_set_image( (GtkButton *)button, image ); + return button; +} + + +GtkWidget *make_button_wsizedcolor_text( GtkWidget *panel, int xpos, int ypos, const char *text, float fontsize, + const char *color_value, void callback(GtkWidget *, void *), void *data ) +{ + GtkWidget *bpanel, *button, *label; + char *tmptxt; + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + button = gtk_button_new(); + label = gtk_label_new( "" ); + tmptxt = (char *)malloc( strlen(text) + 150 ); + sprintf( tmptxt, "" ); strcat( tmptxt, text ); strcat( tmptxt, "" ); + gtk_label_set_markup( (GtkLabel *)label, tmptxt ); + free( tmptxt ); + gtk_container_add( GTK_CONTAINER( button ), label ); + if (callback != 0) + g_signal_connect( button, "clicked", G_CALLBACK( callback ), data ); + gtk_container_add( GTK_CONTAINER( bpanel ), button ); + return button; +} + + + +/* ------------- End GTK Button Routines ----------------- */ + + + + +/* ------------- GTK Radio Button Routines ----------------- */ + +GtkWidget *make_radio_button( GtkWidget *panel, GtkWidget *group, int xpos, int ypos, const char *label, void callback(GtkWidget *, void *), const void *data ) +{ + GtkWidget *bpanel, *button; + + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + button = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( group ), label ); + if (callback != 0) + g_signal_connect( button, "clicked", G_CALLBACK( callback ), (gpointer)data ); + gtk_container_add( GTK_CONTAINER( bpanel ), button ); + return button; +} + +void set_radio_button( GtkWidget *radio_button ) +{ + gtk_toggle_button_set_active( (GtkToggleButton *)radio_button, 1 ); +} +/* ------------- End GTK Radio Button Routines ----------------- */ + + + +/* ------------- GTK Toggle Button Routines ----------------- */ + +GtkWidget *make_toggle_button( GtkWidget *panel, int xpos, int ypos, const char *label, int state, void callback(GtkWidget *, void *), void *data ) +{ + GtkWidget *bpanel, *button; + + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + button = gtk_check_button_new_with_label( label ); + if (callback != 0) + g_signal_connect( button, "clicked", G_CALLBACK( callback ), data ); + gtk_container_add( GTK_CONTAINER( bpanel ), button ); + gtk_toggle_button_set_active( (GtkToggleButton *)button, state ); + return button; +} + +void set_toggle_button( GtkWidget *toggle_button, int state ) +{ + gtk_toggle_button_set_active( (GtkToggleButton *)toggle_button, state ); +} +/* ------------- End GTK Toggle Button Routines ----------------- */ + + + + + +/* ------------- GTK Form-Box (Text-Entry Box) Routines ----------------- */ + float charsperpix=0.109; + GtkWidget *current_formbox; + +GtkEntry *make_formbox( GtkWidget *panel, int xpos, int ypos, int nchars_wide, const char *text, int maxlen, + void callback(GtkWidget *, void *), void *data ) +{ + GtkWidget *formbox, *bpanel; + formbox = gtk_entry_new(); + gtk_entry_set_max_length( GTK_ENTRY(formbox), maxlen ); + gtk_entry_set_text( GTK_ENTRY(formbox), text ); + bpanel = gtk_fixed_new(); + current_formbox = bpanel; + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + gtk_entry_set_width_chars( GTK_ENTRY(formbox), nchars_wide ); + if (callback != 0) + g_signal_connect( formbox, "activate", G_CALLBACK( callback ), data ); + gtk_container_add( GTK_CONTAINER( bpanel ), formbox ); + return GTK_ENTRY(formbox); +} + + +GtkEntry *make_formbox_bypix( GtkWidget *panel, int xpos, int ypos, int npix_wide, const char *text, int maxlen, + void callback(GtkWidget *, void *), void *data ) +{ + int nchars; + gint actual_width; + GtkEntry *nfrmbx; + GtkRequisition actual1, actual2; + nchars = charsperpix * npix_wide; + nfrmbx = make_formbox( panel, xpos, ypos, nchars, text, maxlen, callback, data ); + + // gtk_widget_show_all( panel ); + gtk_widget_show_all( current_formbox ); + + gtk_widget_get_preferred_size( (GtkWidget *)nfrmbx, &actual1, &actual2 ); /* Find the box's actual size. */ + actual_width = actual2.width; + + if (actual_width < 2) + { + printf("Error: Actual width = %d\n", actual_width ); + return 0; + } + if (actual1.width != actual2.width) + printf("Note that actual1.width != actual2.width. (%d != %d)\n", actual1.width, actual2.width ); + + if ((actual_width > npix_wide + 1) || (npix_wide - actual_width > 1.0 / charsperpix)) + { + gtk_widget_destroy( current_formbox ); /* This function used "make_formbox()" which set current_formbox. */ + charsperpix = charsperpix * (float)npix_wide / (float)(actual_width); + nchars = charsperpix * npix_wide; + nfrmbx = make_formbox( panel, xpos, ypos, nchars, text, maxlen, callback, data ); + } + return nfrmbx; +} + + +void modify_formbox( GtkEntry *formbox, const char *text ) +{ + gtk_entry_set_text( formbox, text ); +} + + +char *get_formbox( GtkEntry *formbox ) +{ + return (char *)gtk_entry_get_text( formbox ); /* Returns string poiner, which must NOT be freed. */ +} + + +void get_formbox_text( GtkEntry *formbox, char *rtrnstrng, int maxlen ) +{ + char *tmpstrptr; + tmpstrptr = (char *)gtk_entry_get_text( formbox ); + strcpy_safe( rtrnstrng, tmpstrptr, maxlen ); +} + + + + /*--- Example Usage: + GtkEntry *formbox1; + + SetFormBox_Routine() + { + int nchars; + nchars = 0.109 * frmbx_wdth_pix; // Good rule of thumb. + formbox1 = make_formbox( panel, xpos, ypos, nchars, "0", 1024, action_routine, 0 ); + } + + Retreival_routine() + { + char *word; + word = get_formbox( formbox1 ); + printf("Text = '%s'\n", word ); + } + ---*/ + +/* ------------- GTK Form-Box (Text-Entry Box) Routines ----------------- */ + + +/* ------------- GTK Text-Edit Box Routines ----------------- */ + +GtkTextView *make_text_edit_box( GtkWidget *panel, int xpos, int ypos, int width, int height, const char *text ) /* Multi-line text entry/edit widget. */ +{ + GtkWidget *bpanel, *scroll_window, *frame; + GtkTextView *textview; + GtkTextBuffer *buffer; + + textview = (GtkTextView *)gtk_text_view_new(); + buffer = gtk_text_view_get_buffer( textview ); + gtk_text_buffer_set_text( buffer, text, -1 ); + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + gtk_widget_set_size_request( bpanel, width, height ); + + scroll_window = gtk_scrolled_window_new( NULL, NULL ); + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scroll_window ), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS ); + gtk_widget_set_size_request( scroll_window, width, height ); + + frame = gtk_frame_new(""); + gtk_frame_set_shadow_type( (GtkFrame *)frame, GTK_SHADOW_OUT ); + gtk_container_add( GTK_CONTAINER( scroll_window ), (GtkWidget *)textview ); + gtk_container_add( GTK_CONTAINER( frame ), scroll_window ); + gtk_container_add( GTK_CONTAINER( bpanel ), frame ); + return textview; +} + + +void modify_text_edit_box( GtkTextView *textview, const char *text ) +{ + GtkTextBuffer *buf; + buf = gtk_text_view_get_buffer( textview ); + gtk_text_buffer_set_text( buf, text, -1 ); +} + + +void get_text_edit_box( GtkTextView *textview, char *rtrnstrng, int maxlen ) +{ + GtkTextBuffer *buf; + GtkTextIter start, end; + char *tmpstrptr; + + buf = gtk_text_view_get_buffer( textview ); + gtk_text_buffer_get_bounds( buf, &start, &end ); + tmpstrptr = gtk_text_buffer_get_text( buf, &start, &end, 0 ); + strcpy_safe( rtrnstrng, tmpstrptr, maxlen ); +} + + + /*--- Example Usage: + GtkTextView *txtedt; + + MakeTextEditWindow_Routine() + { + txtedt = make_text_edit_box( panel, 2, 2, 200, 100, "Initial text\n is here." ); + } + + Retreival_routine() + { + char word[1000]; + get_text_edit_box( txtedt, word, 1000 ); + printf("Text = '%s'\n", word ); + } + ---*/ + +/* ------------- GTK Text-Edit-Box Routines ----------------- */ + + + +/* ------------- GTK Slider Routines ----------------- */ + +GtkWidget *make_slider( GtkWidget *panel, int xpos, int ypos, int size, char orien, double min, double initval, double max, \ + void callback(GtkWidget *, void *), void *data ) +{ /* Read double value with: x = gtk_range_get_value( GTK_RANGE( slider ) ); */ + GtkWidget *bpanel, *slider; + + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + if (orien == 'h') + { + slider = gtk_scale_new_with_range( GTK_ORIENTATION_HORIZONTAL, min, max, 0.05 * (max - min) ); + gtk_widget_set_size_request( slider, size, 40 ); + } + else + { + slider = gtk_scale_new_with_range( GTK_ORIENTATION_VERTICAL, min, max, 0.1 * (max - min) ); + gtk_widget_set_size_request( slider, 40, size ); + } + if (callback != 0) + g_signal_connect( slider, "value-changed", G_CALLBACK( callback ), data ); + gtk_container_add( GTK_CONTAINER( bpanel ), slider ); + gtk_range_set_value( GTK_RANGE(slider), initval ); + return slider; +} + + /*--- Example Usage: + void slide_adj( GtkWidget *widget, gpointer data ) + { + double x; + x = gtk_range_get_value( GTK_RANGE(widget) ); + printf("Slider Adjusted '%g'\n", x ); + } + + ... + make_slider( panel, xpos, ypos, size, 'h', minv, initval, maxval, slide_adj, 0 ); + ---*/ + +void adjust_slider( GtkWidget *slider, double newvalue ) +{ + gtk_range_set_value( GTK_RANGE(slider), newvalue ); +} + +/* ------------- End GTK Slider Routines ----------------- */ + + + +/* ------------- GTK FormBoxWithSuggestor ------------------- */ + +GtkSpinButton *make_FormBoxWithSuggestor( GtkWidget *panel, int xpos, int ypos, float min, + float initval, float max, float step, int ndigits ) +{ + GtkWidget *bpanel; + GtkAdjustment *spinner_adj; + GtkSpinButton *spinbox; + spinner_adj = (GtkAdjustment *)gtk_adjustment_new( initval, min, max, step, 3, 0 ); + spinbox = (GtkSpinButton *)gtk_spin_button_new( spinner_adj, step, ndigits ); + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + gtk_container_add( GTK_CONTAINER( bpanel ), (GtkWidget *)spinbox ); + return spinbox; +} + + + +GtkSpinButton *make_FormBoxWithSuggestor_bypix( GtkWidget *panel, int xpos, int ypos, int w1, float min, + float initval, float max, float step, int ndigits ) +{ + GtkWidget *bpanel; + GtkAdjustment *spinner_adj; + GtkSpinButton *spinbox; + spinner_adj = (GtkAdjustment *)gtk_adjustment_new( initval, min, max, step, 3, 0 ); + spinbox = (GtkSpinButton *)gtk_spin_button_new( spinner_adj, step, ndigits ); + gtk_widget_set_size_request( (GtkWidget *)spinbox, w1, 25); + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + gtk_container_add( GTK_CONTAINER( bpanel ), (GtkWidget *)spinbox ); + return spinbox; +} + + +float get_FormBoxWithSuggestor_Value( GtkSpinButton *spinbox ) +{ return gtk_spin_button_get_value( spinbox ); } + + +void set_FormBoxWithSuggestor_value( GtkSpinButton *spinbox, float value ) +{ gtk_spin_button_set_value( spinbox, value ); } + + + +/*--- + make_combobox - Creates a kind of text-box that the user cannot type into, but has + a selector on the right, from which the user can pick any alphanumeric setting. +---*/ +GtkWidget *make_combobox( GtkWidget *panel, int xpos, int ypos, int width ) +{ + GtkWidget *bpanel, *combobox; + combobox = (GtkWidget *)gtk_combo_box_text_new(); + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + gtk_widget_set_size_request( combobox, width, 25 ); + gtk_container_add( GTK_CONTAINER( bpanel ), combobox ); + return combobox; +} + +void add_combo_suggestion( GtkWidget *combobox, char *itemtext ) +{ + gtk_combo_box_text_append( (GtkComboBoxText *)combobox, 0, itemtext ); +} + +void select_combo_suggestion( GtkWidget *combobox, int item ) +{ + gtk_combo_box_set_active( (GtkComboBox *)combobox, item ); +} + + /* Example to read value from: frmbx1 = make_combobox( panel, x, y, 30 ); + word = gtk_combo_box_text_get_active_text( (GtkComboBoxText *)frmbx1 ); + */ + + + +/*--- + make_formbox_wcombo - Like "make_combobox" above, but users can also type their + own values into the text box, as well as select them. +---*/ +GtkWidget *make_formbox_wcombo( GtkWidget *panel, int xpos, int ypos, int width ) +{ + GtkWidget *bpanel, *combobox; + combobox = gtk_combo_box_text_new_with_entry(); + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + gtk_widget_set_size_request( combobox, width, 25 ); + gtk_container_add( GTK_CONTAINER( bpanel ), combobox ); + return combobox; +} + +void add_form_suggestion( GtkWidget *combobox, char *text ) +{ + gtk_combo_box_text_append_text( (GtkComboBoxText *)combobox, text ); +} + + /* Example to read value from: frmbx2 = make_formbox_wcombo( panel, x, y, 30 ); + word = strdup( gtk_entry_get_text( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( frmbx2 ) ) ) ) ); + */ + + +/* ------------- End GTK FormBoxWithSuggestor ------------------- */ + + + + +/* ------------- GTK Menu Routines ----------------- */ +GtkWidget *most_recent_menu=0; + +GtkWidget *make_menu( GtkWidget *tool_bar, const char *label ) /* For use on automatically placed menu-bars. */ +{ + GtkWidget *new_menu, *sub_menu; + new_menu = gtk_menu_item_new_with_label( label ); + gtk_menu_shell_append( (GtkMenuShell *)tool_bar, new_menu ); + sub_menu = gtk_menu_new(); + gtk_menu_item_set_submenu( GTK_MENU_ITEM( new_menu ), sub_menu ); + return sub_menu; +} + + +GtkWidget *make_menu_button( GtkWidget *panel, int xpos, int ypos, const char *label ) /* For use anywhere on a window. */ +{ + GtkWidget *new_menu, *sub_menu, *bpanel; + bpanel = gtk_menu_bar_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + new_menu = gtk_menu_item_new_with_label( label ); + most_recent_menu = new_menu; + gtk_container_add( GTK_CONTAINER( bpanel ), new_menu ); + sub_menu = gtk_menu_new(); + gtk_menu_item_set_submenu( GTK_MENU_ITEM( new_menu ), sub_menu ); + return sub_menu; +} + + +GtkWidget *add_menu_item( GtkWidget *menu, const char *label, void callback(GtkWidget *, void *), void *data ) +{ + GtkWidget *menuitem; + menuitem = gtk_menu_item_new_with_label( label ); + if (callback != 0) + g_signal_connect( menuitem, "activate", G_CALLBACK( callback ), data ); + gtk_menu_shell_append( (GtkMenuShell *)menu, menuitem ); + return menuitem; +} + + +GtkWidget *add_submenu( GtkWidget *menu, const char *label ) +{ + GtkWidget *menuitem, *submenu; + menuitem = gtk_menu_item_new_with_label( label ); + gtk_menu_shell_append( (GtkMenuShell *)menu, menuitem ); + submenu = gtk_menu_new(); + gtk_menu_item_set_submenu( GTK_MENU_ITEM( menuitem ), submenu ); + return submenu; +} + + +void modify_menu_label( GtkWidget *menu_label, const char *newtext ) /* A 'menu_label' is what is returned by add_menu_item(). */ +{ + gtk_menu_item_set_label( (GtkMenuItem *)menu_label, newtext ); +} + +/* ----------- End GTK Menu Routines ---------------- */ + + + + +/* ------------- GTK Selection List Routines ----------------- */ +GtkWidget *most_recent_selector_box=0, *LastBpanel; + +GtkTreeStore *make_selection_list( GtkWidget *panel, int xpos, int ypos, int width, int height, const char *column_titles, + void callback(GtkWidget *, void *), void dclick_callback(GtkWidget *, void *), void *data ) +{ + GtkWidget *bpanel, *scroll_window, *tree; + GtkTreeStore *list; + GtkCellRenderer *renderer; + GtkTreeViewColumn *column; + GtkTreeSelection *select; + + list = gtk_tree_store_new( 1, G_TYPE_STRING ); + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + gtk_widget_set_size_request( bpanel, width, height ); + LastBpanel = bpanel; + + scroll_window = gtk_scrolled_window_new( NULL, NULL ); + most_recent_selector_box = scroll_window; + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scroll_window ), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS ); + gtk_widget_set_size_request( scroll_window, width, height ); + gtk_container_add( GTK_CONTAINER( bpanel ), scroll_window ); + + tree = gtk_tree_view_new_with_model( GTK_TREE_MODEL( list ) ); + renderer = gtk_cell_renderer_text_new(); + column = gtk_tree_view_column_new_with_attributes( column_titles, renderer, "text", 0, NULL ); + gtk_tree_view_append_column( GTK_TREE_VIEW(tree), column ); + if (dclick_callback != 0) + g_signal_connect( G_OBJECT( tree ), "row-activated", G_CALLBACK( dclick_callback ), data ); + + gtk_container_add( GTK_CONTAINER( scroll_window ), tree ); + select = gtk_tree_view_get_selection( GTK_TREE_VIEW(tree) ); + gtk_tree_selection_set_mode( select, GTK_SELECTION_SINGLE ); + if (callback != 0) + g_signal_connect( G_OBJECT(select), "changed", G_CALLBACK( callback ), data ); + + /* Cluge: Create blank entry at top of list, since first entry is always preselected and cannot be selected by user. */ + // gtk_tree_store_append( list, &iter, 0 ); + // gtk_tree_store_set( list, &iter, 0, "", -1 ); + + return list; +} + +void append_selection_list( GtkTreeStore *list, GtkTreeIter *iter, const char *item ) +{ /* To use, just declare a "GtkTreeIter iter;", and pass its address in. */ + gtk_tree_store_append( list, iter, 0 ); + gtk_tree_store_set( list, iter, 0, item, -1 ); +} + +void append_selection_child( GtkTreeStore *list, GtkTreeIter *iter, GtkTreeIter *child, char *item ) +{ /* Must declare "GtkTreeIter iter, child;", and pass their addresses in. */ + gtk_tree_store_append( list, child, iter ); + gtk_tree_store_set( list, child, 0, item, -1 ); +} + + +char *get_selection_from_list( GtkWidget *selection ) +{ + GtkTreeIter iter; + GtkTreeModel *model; + char *selected_item; + + if (gtk_tree_selection_get_selected( (GtkTreeSelection *)selection, &model, &iter)) + { + gtk_tree_model_get(model, &iter, 0, &selected_item, -1); + return selected_item; + } + else return 0; +} + + +/* Example Usage: + { + GtkTreeStore *mylist; + GtkTreeIter iter; + + mylist = make_selection_list( panel, 10, 20, 80, 100, myfunction, 0 ); + for (j=0; j<10; j++) + append_selection_list( mylist, &iter, text[j] ); + } + + void myfunction( GtkWidget *wdg, void *data ) + { + char *text; + text = get_selection_from_list( wdg ); + printf("Selected: '%s'\n", text ); + } +*/ + + + +GtkTreeStore *make_multicolumn_selection_list( GtkWidget *panel, int xpos, int ypos, int width, int height, + int ncols, const char *column_titles[], + void callback(GtkWidget *, void *), void dclick_callback(GtkWidget *, void *), void *data ) +{ + GtkWidget *bpanel, *scroll_window, *tree; + GtkTreeStore *list; + GtkCellRenderer *renderer; + GtkTreeViewColumn *column; + GtkTreeSelection *select; + int j; + switch (ncols) + { /* This will support up to 10 columns. Extend if needed. */ + case 1: list = gtk_tree_store_new( ncols, G_TYPE_STRING ); break; + case 2: list = gtk_tree_store_new( ncols, G_TYPE_STRING, G_TYPE_STRING ); break; + case 3: list = gtk_tree_store_new( ncols, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); break; + case 4: list = gtk_tree_store_new( ncols, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); break; + case 5: list = gtk_tree_store_new( ncols, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); break; + case 6: list = gtk_tree_store_new( ncols, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); break; + case 7: list = gtk_tree_store_new( ncols, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); break; + case 8: list = gtk_tree_store_new( ncols, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); break; + case 9: list = gtk_tree_store_new( ncols, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); break; + case 10: list = gtk_tree_store_new( ncols, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); break; + default: printf("Number of columns %d not supported.\n", ncols ); exit(1); + } + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + gtk_widget_set_size_request( bpanel, width, height ); + // LastBpanel = bpanel; + scroll_window = gtk_scrolled_window_new( NULL, NULL ); + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scroll_window ), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS ); + gtk_widget_set_size_request( scroll_window, width, height ); + gtk_scrolled_window_set_shadow_type( (GtkScrolledWindow *)scroll_window, GTK_SHADOW_IN ); + gtk_container_add( GTK_CONTAINER( bpanel ), scroll_window ); + tree = gtk_tree_view_new_with_model( GTK_TREE_MODEL( list ) ); + for (j=0; j < ncols; j++) + { + renderer = gtk_cell_renderer_text_new(); + column = gtk_tree_view_column_new_with_attributes( column_titles[j], renderer, "text", j, NULL ); + gtk_tree_view_append_column( GTK_TREE_VIEW(tree), column ); + } + if (dclick_callback != 0) + g_signal_connect( G_OBJECT(tree), "row-activated", G_CALLBACK( dclick_callback ), data ); + gtk_container_add( GTK_CONTAINER( scroll_window ), tree ); + select = gtk_tree_view_get_selection( GTK_TREE_VIEW(tree) ); + gtk_tree_selection_set_mode( select, GTK_SELECTION_SINGLE ); + if (callback != 0) + g_signal_connect( G_OBJECT(select), "changed", G_CALLBACK( callback ), data ); + return list; +} + +void add_multicolumn_selection_item( GtkTreeStore *selst, int ncols, char *items[] ) +{ + GtkTreeIter iter; + gtk_tree_store_append( selst, &iter, 0 ); + switch (ncols) + { /* This will support up to 10 columns. Extend if needed. */ + case 1: gtk_tree_store_set( selst, &iter, 0, items[0], -1 ); break; + case 2: gtk_tree_store_set( selst, &iter, 0, items[0], 1, items[1], -1 ); break; + case 3: gtk_tree_store_set( selst, &iter, 0, items[0], 1, items[1], 2, items[2], -1 ); break; + case 4: gtk_tree_store_set( selst, &iter, 0, items[0], 1, items[1], 2, items[2], 3, items[3], -1 ); break; + case 5: gtk_tree_store_set( selst, &iter, 0, items[0], 1, items[1], 2, items[2], 3, items[3], 4, items[4], -1 ); break; + case 6: gtk_tree_store_set( selst, &iter, 0, items[0], 1, items[1], 2, items[2], 3, items[3], 4, items[4], 5, items[5], -1 ); break; + case 7: gtk_tree_store_set( selst, &iter, 0, items[0], 1, items[1], 2, items[2], 3, items[3], 4, items[4], 5, items[5], 6, items[6], -1 ); break; + case 8: gtk_tree_store_set( selst, &iter, 0, items[0], 1, items[1], 2, items[2], 3, items[3], 4, items[4], 5, items[5], 6, items[6], 7, items[7], -1 ); break; + case 9: gtk_tree_store_set( selst, &iter, 0, items[0], 1, items[1], 2, items[2], 3, items[3], 4, items[4], 5, items[5], 6, items[6], 7, items[7], 8, items[8], -1 ); break; + case 10: gtk_tree_store_set( selst, &iter, 0, items[0], 1, items[1], 2, items[2], 3, items[3], 4, items[4], 5, items[5], 6, items[6], 7, items[7], 8, items[8], 9, items[9], -1 ); break; + default: printf("Number of columns %d not supported.\n", ncols ); exit(1); + } +} + + /* Example Usage: + char *MY_Selected_item=0, *MY_Selected_list=0; + int MY_column_to_get=2; // --- Set this to get the column you need. + + void selected_item_by_column( GtkWidget *wdg, void *data ) + { + GtkTreeIter iter; + GtkTreeModel *model; + if (!done_init) return; + if (gtk_tree_selection_get_selected( GTK_TREE_SELECTION(wdg), &model, &iter )) + { + if (MY_Selected_item != 0) free( MY_Selected_item ); + gtk_tree_model_get( model, &iter, MY_column_to_get, &MY_Selected_item, -1 ); + MY_Selected_list = data; + printf("Column%d = %s, for %s\n", MY_, MY_Selected_item, MY_Selected_list ); + } + } + + void dclicked_item( GtkWidget *wdg, void *data ) + { printf("Dclicked '%s', for %s.\n", MY_Selected_item, MY_Selected_list ); } + + ... + GtkTreeStore *selst; + const char *headings[]={ "T1", "D2", "P3" }; + char *items[]; + selst = make_multicolumn_selection_list( winpanel, 200, 30, 180, 150, 3, headings, + selected_item, dclicked_item, "chartA" ); + items[0] = "Fries"; items[1] = "Shake"; items[2] = "Cola"; + add_multicolumn_selection_item( selst, 3, iems ); + items[0] = "Coffee"; items[1] = "Donut"; items[2] = "Beer"; + add_multicolumn_selection_item( selst, 3, iems ); + ... + */ + +/* ------------- End GTK Selection List Routines ----------------- */ + + + +/* ------------- Sub-Panel Frames ----------------- */ + +GtkWidget *make_tabbed_panel_frame( GtkWidget *panel, int xpos, int ypos ) +{ + GtkWidget *bpanel, *tabbed_panel; + tabbed_panel = gtk_notebook_new(); + gtk_notebook_set_tab_pos( GTK_NOTEBOOK(tabbed_panel), GTK_POS_TOP ); + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + gtk_container_add( GTK_CONTAINER( bpanel ), tabbed_panel ); + return tabbed_panel; +} + + +GtkWidget *add_tabbed_panel( GtkWidget *tabbed_panel, int width, int height, char *tab_name ) +{ /* Adds a tabbed-panel to a tabbed_panel_frame. */ + GtkWidget *bpanel, *label; + bpanel = gtk_fixed_new(); + gtk_widget_set_size_request( bpanel, width, height ); + label = gtk_label_new( tab_name ); /* Tab-name. */ + gtk_notebook_append_page( GTK_NOTEBOOK(tabbed_panel), bpanel, label ); + return bpanel; +} + + +GtkWidget *make_framed_panel( GtkWidget *panel, int xpos, int ypos, int width, int height, char *frame_name ) +{ /* Creates an outlined rectangular area for adding widgets inside it. */ + GtkWidget *bpanel, *frame; + frame = gtk_frame_new( frame_name ); + // gtk_container_set_border_width( GTK_CONTAINER(frame), 10 ); + gtk_widget_set_size_request( frame, width, height ); + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED(panel), bpanel, xpos, ypos ); + gtk_container_add( GTK_CONTAINER(bpanel), frame ); + return bpanel; +} + + +/* ------------- Sub-Window or (Detachable) Pop-up Window Making Routines ----------------- */ + + + +GtkWindowPosition window_position_policy=GTK_WIN_POS_CENTER_ON_PARENT, + top_window_position_policy=GTK_WIN_POS_CENTER; + +void close_any_window( GtkWidget *widget, gpointer data ) +{ + GtkWidget *(*win0) = (GtkWidget **)data; + if (data == 0) { printf("Close_Any_Window: Zero data\n"); return; } + if (*win0 != 0) gtk_widget_destroy( *win0 ); + *win0 = 0; +} + + +int killed_any_window( GtkWidget *widget, GdkEvent *event, gpointer data ) +{ + GtkWidget *(*win0) = (GtkWidget **)data; + *win0 = 0; + return 0; /* Returning "0" causes window to be destroyed. */ +} + + + +void place_window_center() { window_position_policy = GTK_WIN_POS_CENTER_ON_PARENT; } +void place_window_atmouse() { window_position_policy = GTK_WIN_POS_MOUSE; } + + +GtkWidget *make_window( int width, int height, const char *title, GtkWidget **winptr ) +{ /* You must call "show_wind(winptr)" after creating all widgets under this window!! */ + GtkWidget *winframe; + if (*winptr != 0) gtk_widget_destroy( *winptr ); + *winptr = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_widget_set_size_request( *winptr, width, height ); + gtk_window_set_transient_for( GTK_WINDOW( *winptr ), GTK_WINDOW( outer_window ) ); + gtk_window_set_position( GTK_WINDOW( *winptr ), window_position_policy ); /* Other option(s): GTK_WIN_POS_CENTER, GTK_WIN_POS_MOUSE, GTK_WIN_POS_CENTER_ON_PARENT. */ + gtk_window_set_title( GTK_WINDOW( *winptr ), title ); + g_signal_connect( G_OBJECT( *winptr ), "delete-event", G_CALLBACK( killed_any_window ), (gpointer)winptr ); + winframe = gtk_fixed_new(); + gtk_container_add( GTK_CONTAINER( *winptr ), winframe ); + gtk_window_set_resizable( GTK_WINDOW( *winptr ), 0 ); + return winframe; +} + + + /* New window and Register user's own killed callback. It must return 0. */ +GtkWidget *make_window_wkill( int width, int height, const char *title, GtkWidget *(*winptr), int callback(GtkWidget *, void *) ) +{ /* You must call "show_wind(winptr)" after creating all widgets under this window!! */ + GtkWidget *winframe; + if (*winptr != 0) gtk_widget_destroy( *winptr ); + *winptr = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_widget_set_size_request( *winptr, width, height ); + gtk_window_set_transient_for( GTK_WINDOW( *winptr ), GTK_WINDOW( outer_window ) ); + gtk_window_set_position( GTK_WINDOW( *winptr ), window_position_policy ); /* Other option(s): GTK_WIN_POS_CENTER, GTK_WIN_POS_MOUSE, GTK_WIN_POS_CENTER_ON_PARENT. */ + gtk_window_set_title( GTK_WINDOW( *winptr ), title ); + if (callback != 0) + g_signal_connect( *winptr, "delete_event", G_CALLBACK( callback ), winptr ); + else + g_signal_connect( *winptr, "delete_event", G_CALLBACK( killed_any_window ), winptr ); + winframe = gtk_fixed_new(); + gtk_container_add( GTK_CONTAINER( *winptr ), winframe ); + gtk_window_set_resizable( GTK_WINDOW( *winptr ), 0 ); + return winframe; +} + + + /* Like above, but set horz/vert-scroll to 1 or 0, to enable or disable respective scroll. */ +GtkWidget *make_scrolled_window_wkill( int width, int height, const char *title, GtkWidget *(*winptr), + int horzscroll, int vertscroll, int callback(GtkWidget *, void *) ) +{ /* You must call "show_wind(winptr)" after creating all widgets under this window!! */ + GtkWidget *winframe, *swin; + + if (*winptr != 0) gtk_widget_destroy( *winptr ); + *winptr = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_widget_set_size_request( *winptr, width, height ); + gtk_window_set_transient_for( GTK_WINDOW( *winptr ), GTK_WINDOW( outer_window ) ); + gtk_window_set_position( GTK_WINDOW( *winptr ), window_position_policy ); /* Other option(s): GTK_WIN_POS_CENTER, GTK_WIN_POS_MOUSE, GTK_WIN_POS_CENTER_ON_PARENT. */ + gtk_window_set_title( GTK_WINDOW( *winptr ), title ); + if (callback != 0) + g_signal_connect( *winptr, "delete_event", G_CALLBACK( callback ), winptr ); + else + g_signal_connect( *winptr, "delete_event", G_CALLBACK( killed_any_window ), winptr ); + gtk_window_set_resizable( GTK_WINDOW( *winptr ), 0 ); + winframe = gtk_fixed_new(); + swin = gtk_scrolled_window_new( 0, 0 ); + if (horzscroll) horzscroll = GTK_POLICY_ALWAYS; else horzscroll = GTK_POLICY_NEVER; + if (vertscroll) vertscroll = GTK_POLICY_ALWAYS; else vertscroll = GTK_POLICY_NEVER; + gtk_scrolled_window_set_policy( (GtkScrolledWindow *)(swin), (GtkPolicyType)horzscroll, (GtkPolicyType)vertscroll ); + gtk_container_add( GTK_CONTAINER( winframe ), swin ); + gtk_container_add( GTK_CONTAINER( *winptr ), winframe ); + +#if (0) + swin = gtk_scrolled_window_new( 0, 0 ); + if (horzscroll) horzscroll = GTK_POLICY_ALWAYS; else horzscroll = GTK_POLICY_NEVER; + if (vertscroll) vertscroll = GTK_POLICY_ALWAYS; else vertscroll = GTK_POLICY_NEVER; + gtk_scrolled_window_set_policy( (GtkScrolledWindow *)swin, (GtkPolicyType)horzscroll, (GtkPolicyType)vertscroll ); + gtk_scrolled_window_add_with_viewport( (GtkScrolledWindow *)swin, winframe ); + gtk_container_add( GTK_CONTAINER( *winptr ), swin ); +#endif + + return winframe; +} + + + + /* Initial call to set up outermost window. */ +GtkWidget *init_top_outer_window( int *argc, char ***argv, int winwidth, int winhght, const char *title, + int horzscroll, int vertscroll ) +{ /* Set horz/vert-scroll to 1 or 0, enable or discable respective scroll. */ + GtkWidget *outer_frame, *swin; + gtk_init( argc, argv ); + outer_window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_widget_set_size_request( outer_window, winwidth, winhght ); + gtk_window_set_title( GTK_WINDOW( outer_window ), title ); + gtk_window_set_position( GTK_WINDOW( outer_window ), top_window_position_policy ); + outer_frame = gtk_fixed_new(); + if (horzscroll || vertscroll) + { + if (horzscroll) horzscroll = GTK_POLICY_ALWAYS; else horzscroll = GTK_POLICY_NEVER; + if (vertscroll) vertscroll = GTK_POLICY_ALWAYS; else vertscroll = GTK_POLICY_NEVER; + swin = gtk_scrolled_window_new( 0, 0 ); + gtk_scrolled_window_set_policy( (GtkScrolledWindow *)swin, (GtkPolicyType)horzscroll, (GtkPolicyType)vertscroll ); + // printf("Adding scrolled viewport in gtk_utils3.c\n"); + // gtk_scrolled_window_add_with_viewport( (GtkScrolledWindow *)swin, outer_frame ); + gtk_container_add( GTK_CONTAINER( swin ), outer_frame ); + gtk_container_add( GTK_CONTAINER( outer_window ), swin ); + } + else + gtk_container_add( GTK_CONTAINER( outer_window ), outer_frame ); + return outer_frame; +} + + +void show_wind( GtkWidget *wind ) +{ + gtk_widget_show_all( wind ); +} + + + /**** ---- Example window making function. ---- + GtkWidget *win1=0; + + void respond_to_some_event( GtkWidget *widget, gpointer data ) + { + GtkWidget *panel; + + panel = make_window( 400, 150, "Test Win", &win1 ); + + ---- Place all window items here .... ---- + make_button( panel, 20, 20, " OK ", close_any_window, &win1 ); + + gtk_widget_show_all( win1 ); + } + + ****/ + +/* ------------- Sub-Window or (Detachable) Pop-up Window Making Routines ----------------- */ + + + +/* ------------- GTK Separator Routines ----------------- */ + +GtkWidget *make_vseparator( GtkWidget *panel, int xpos, int y1, int y2 ) +{ + GtkWidget *sep; + sep = gtk_separator_new( GTK_ORIENTATION_VERTICAL ); + gtk_fixed_put( GTK_FIXED( panel ), sep, xpos, y1 ); + gtk_widget_set_size_request( sep, 5, y2 - y1 ); + return sep; +} + + +GtkWidget *make_hseparator( GtkWidget *panel, int x1, int x2, int ypos ) +{ + GtkWidget *sep; + sep = gtk_separator_new( GTK_ORIENTATION_HORIZONTAL ); + gtk_fixed_put( GTK_FIXED( panel ), sep, x1, ypos ); + gtk_widget_set_size_request( sep, x2 - x1, 5 ); + return sep; +} + + +GtkWidget *make_rectangular_separator( GtkWidget *panel, int x1, int y1, int x2, int y2 ) +{ + GtkWidget *sep; + sep = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), sep, 0, 0 ); + make_hseparator( sep, x1, x2, y1 ); + make_vseparator( sep, x1, y1, y2 ); + make_vseparator( sep, x2, y1, y2 ); + make_hseparator( sep, x1, x2, y2 ); + return sep; +} + +/* ------------- End GTK Separator Routines ----------------- */ + + + +/*------------------------------------------------------------------------------ + attach_image_from_file - Reads image from jpg/gif file, and places on panel + at specified position and size. Returns 0 on error, else returns widget. + ------------------------------------------------------------------------------*/ +GtkWidget *attach_image_from_file( GtkWidget *panel, char *imgfname, int xpos, int ypos, int width, int height ) +{ + GtkWidget *pic, *wdg; + GdkPixbuf *pixbuf; + pixbuf = gdk_pixbuf_new_from_file_at_scale( imgfname, width, height, 0, 0 ); + if (pixbuf == 0) { printf("Error reading image-file '%s'\n", imgfname ); return 0; } + pic = gtk_image_new_from_pixbuf( pixbuf ); + wdg = gtk_fixed_new(); /* Position a widget. */ + gtk_fixed_put( GTK_FIXED( panel ), wdg, xpos, ypos ); + gtk_container_add( GTK_CONTAINER( wdg ), pic ); /* Attach image. */ + return wdg; +} + + +GtkWidget *attach_image_from_pixbuf( GtkWidget *panel, unsigned char *imgdata, int xpos, int ypos, int width, int height, int has_alpha ) +{ + GtkWidget *pic, *wdg; + GdkPixbuf *pixbuf; + int bits_per_sample=8, rowstride; + rowstride = (3 + has_alpha) * width; + pixbuf = gdk_pixbuf_new_from_data( imgdata, + GDK_COLORSPACE_RGB, has_alpha, bits_per_sample, + width, height, rowstride, 0, 0 ); + if (pixbuf == 0) { printf("Error creating pixbuf.\n"); return 0; } + pic = gtk_image_new_from_pixbuf( pixbuf ); + wdg = gtk_fixed_new(); /* Position a widget. */ + gtk_fixed_put( GTK_FIXED( panel ), wdg, xpos, ypos ); + gtk_container_add( GTK_CONTAINER( wdg ), pic ); /* Attach image. */ + return wdg; +} + + +/*------------------------------------------------------------------------------*/ +/* place_image - This routine displays an image on the named panel, at the */ +/* specified (x,y) position. Image_pixels = image_width x image_height */ +/* Allocate and initialize image as: */ +/* imagedata = (unsigned char *)malloc( 4 * image_pixels ); */ +/* imagedata[ 4 * (image_width * row + col) ] = Blue; */ +/* imagedata[ 4 * (image_width * row + col) + 1 ] = Green; */ +/* imagedata[ 4 * (image_width * row + col) + 2 ] = Red; */ +/* Where values are 0=dark to 255=bright. */ +/* You can de-allocate or re-use image array after calling this function. */ +/*------------------------------------------------------------------------------*/ +void place_image( cairo_t *cr, int image_width, int image_height, int pos_x, int pos_y, unsigned char *imagedata ) +{ + int stride; + cairo_surface_t *image; + + stride = cairo_format_stride_for_width( CAIRO_FORMAT_RGB24, image_width ); + /* stride should now equal (4 * image_width). */ + image = cairo_image_surface_create_for_data( imagedata, CAIRO_FORMAT_RGB24, image_width, image_height, stride ); + cairo_set_source_surface( cr, image, pos_x, pos_y ); + cairo_paint( cr ); +} + + + + +/* --- Convert Data to Image (cdti) Routines --- */ +/* --- These routines retreive image-data from pre-initialized arrays stored within a program, for display. --- */ +/* (The pre-stored array text can be created from the "data2code.c" utility.) */ +unsigned char cdti_get_next_byte( char *data, int *indx ) +{ + unsigned char ch, ch0, ch1; + ch0 = data[ *indx ]; *indx = *indx + 1; + if (ch0 > 60) ch0 = ch0 - 87; else ch0 = ch0 - 48; + ch1 = data[ *indx ]; *indx = *indx + 1; + if (ch1 > 60) ch1 = ch1 - 87; else ch1 = ch1 - 48; + ch = (ch0 << 4) | ch1; + return ch; +} + +int cdti_read_binary_number( char *data, int *indx ) +{ + int k=0; + unsigned char ch; + do + { + ch = cdti_get_next_byte( data, indx ); + if (ch == '#') while (cdti_get_next_byte( data, indx ) != '\n'); + } + while (ch == '#'); + while ((ch >= '0') && (ch <= '9')) + { + k = (ch - '0') + 10 * k; + ch = cdti_get_next_byte( data, indx ); + } + return k; +} + +unsigned char *cdti_convert_data_to_image( char *data, int dimension, int *imgwd, int *imght ) +{ /* Assumes PPM (P6, raw) file. */ + unsigned char r, g, b, *imagedata; + int indx=0, ht=0, wd=0, mm=0; + + /* P6#sdsawidth height255binary-data */ + /* 1 2 3 4 */ + + if ((cdti_get_next_byte( data, &indx ) != 'P') || (cdti_get_next_byte( data, &indx ) != '6')) + { printf("Error: Image data does not have expected header.\n"); return 0; } + while (cdti_get_next_byte( data, &indx ) != '\n'); + wd = cdti_read_binary_number( data, &indx ); + ht = cdti_read_binary_number( data, &indx ); + // printf("Image %d x %d\n", wd, ht ); + cdti_read_binary_number( data, &indx ); + imagedata = (unsigned char *)malloc( 4 * wd * ht ); + while (indx < dimension) + { + r = cdti_get_next_byte( data, &indx ); + g = cdti_get_next_byte( data, &indx ); + b = cdti_get_next_byte( data, &indx ); + imagedata[ mm++ ] = r; + imagedata[ mm++ ] = g; + imagedata[ mm++ ] = b; + imagedata[ mm++ ] = 255; + } + *imgwd = wd; + *imght = ht; + return imagedata; +} +/* --- End of cdti routines --- */ + + + +/* ------------- Tool Tips / Hover Notes ----------------- */ + +void add_tool_tip( GtkWidget *wdg, const char *text ) /* Adds tool-tip to button, etc. */ +{ + gtk_widget_set_tooltip_text( wdg, text ); +} + + + + +/* ------------- File Browser ----------------- */ + +void canceled_file_browser( GtkWidget *wdg, void *fb ) { gtk_widget_destroy( (GtkWidget *)fb ); } + +char *file_browser_filter=0; + + + +GtkWidget *file_browser_popup( const char *dir, const char *prompt, void callback(GtkWidget *, void *) ) +{ /* "Classic" simple-basic version for backward-compatibility. */ + GtkWindow *parent_window = GTK_WINDOW(outer_window); // assuming that the caller is GtkWindow + GtkFileChooserNative *nativefb; + GtkFileFilter *filter; + gint res; + + nativefb = gtk_file_chooser_native_new( + prompt, // Window header title, indicating function ('Save', 'Open', ...). + parent_window, + GTK_FILE_CHOOSER_ACTION_SAVE, // Allows user to do anything. Existing file or not. + " OK ", // Text to go on the Ok/Save/Open button. + "Cancel" // Text to go on the Cancel bitton. + ); + + gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( nativefb ), dir ); + + if ((file_browser_filter != 0) && (file_browser_filter[0] != '\0')) + { // Set file filters + filter = gtk_file_filter_new(); // filter 1 + gtk_file_filter_set_name( filter, file_browser_filter ); + gtk_file_filter_add_pattern( filter, file_browser_filter ); + gtk_file_chooser_add_filter( GTK_FILE_CHOOSER( nativefb ), filter); + + filter = gtk_file_filter_new(); // filter 2 + gtk_file_filter_set_name( filter, "All Files" ); + gtk_file_filter_add_pattern( filter, "*" ); + gtk_file_chooser_add_filter( GTK_FILE_CHOOSER( nativefb ), filter ); + } + + res = gtk_native_dialog_run(GTK_NATIVE_DIALOG( nativefb )); + if (res == GTK_RESPONSE_ACCEPT) + { + char *filename; + GtkFileChooser *chooser = GTK_FILE_CHOOSER( nativefb ); + filename = gtk_file_chooser_get_filename(chooser); + callback( 0, filename ); // Return the selected file name. + // g_free(filename); + } + g_object_unref( nativefb ); + return 0; // (GtkWidget *)nativefb; +} + + + +void make_file_browser_popup( /* New+improved gtk-native file-browser. */ + const char *dir, // Directory to open to. Example: "." + const char *prompt, // Window header title, indicating function ('Save', 'Open', ...). + const char *OK_button_label, // Text to go on the Ok/Save/Open button. + const char *default_fname, // Initial file-name, if any. + const char *wildcard, // Optional file-name filter. (Ex. "*.txt" or "*.exe") + void callback(GtkWidget *, void *) + ) +{ + GtkWindow *parent_window = GTK_WINDOW(outer_window); + GtkFileChooserNative *nativefb; + GtkFileFilter *filter; + gint res; + + nativefb = gtk_file_chooser_native_new( + prompt, // Window header title, indicating function ('Save', 'Open', ...). + parent_window, + GTK_FILE_CHOOSER_ACTION_SAVE, // Allows user to do anything. Existing file or not. + OK_button_label, // Text to go on the Ok/Save/Open button. + "Cancel" // Text to go on the Cancel bitton. + ); + + if ((dir != 0) && (strlen(dir) > 0)) + gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( nativefb ), dir ); + + if ((default_fname != 0) && (strlen(default_fname) > 0)) + gtk_file_chooser_set_current_name( GTK_FILE_CHOOSER( nativefb ), default_fname ); + + if ((wildcard != NULL) && (strlen(wildcard) > 0)) + { // Set file filters + filter = gtk_file_filter_new(); // filter 1 + gtk_file_filter_set_name( filter, wildcard ); + gtk_file_filter_add_pattern( filter, wildcard ); + gtk_file_chooser_add_filter( GTK_FILE_CHOOSER( nativefb ), filter); + + filter = gtk_file_filter_new(); // filter 2 + gtk_file_filter_set_name( filter, "All Files" ); + gtk_file_filter_add_pattern( filter, "*" ); + gtk_file_chooser_add_filter( GTK_FILE_CHOOSER( nativefb ), filter ); + } + + res = gtk_native_dialog_run(GTK_NATIVE_DIALOG( nativefb )); + if (res == GTK_RESPONSE_ACCEPT) + { + char *filename; + GtkFileChooser *chooser = GTK_FILE_CHOOSER( nativefb ); + filename = gtk_file_chooser_get_filename(chooser); + callback( 0, filename ); // Return the selected file name. + // g_free(filename); + } + g_object_unref( nativefb ); +} + + + + + /* Example usage: + void receive_filename( GtkWidget *wdg, void *fs ) + { + char *yourfilename=(char *)fs; + printf("Absolute path = '%s'\n", yourfilename ); + g_free( yourfilename ); + } + + file_browser_popup( ".", "Select File", receive_filename ); + */ + + + + + +/* ------------- Progress Bar ----------------- */ + +void adjust_progress_bar( GtkWidget *wdg, double fraction ) +{ + gtk_progress_bar_set_fraction( (GtkProgressBar *)wdg, fraction ); +} + + +GtkWidget *make_progress_bar( GtkWidget *panel, int xpos, int ypos, int width, char *text ) +{ + GtkWidget *bpanel, *bar; + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + bar = gtk_progress_bar_new(); + gtk_progress_bar_set_text( (GtkProgressBar *)bar, text ); + if (width < 1) width = 150; /* Assume default width if not specified. */ + gtk_widget_set_size_request( bar, width, 20 ); + gtk_container_add( GTK_CONTAINER( bpanel ), bar ); + return bar; +} + + + +/* ------------- General Stuff ----------------- */ +int udchck_flag=0; + +void UpdateCheck() /* Process any pending window events. */ +{ + if (udchck_flag) return; + udchck_flag = 1; + while (gtk_events_pending()) + { + gtk_main_iteration_do( 0 ); + } + udchck_flag = 0; +} + + +GTimer *mytimer=0; + +double Report_Time() /* Reports time in seconds, accurate to millisecs, for checking time differences. */ +{ + if (mytimer==0) + { + mytimer = g_timer_new(); + g_timer_start( mytimer ); + return 0.0; + } + else + return g_timer_elapsed( mytimer, 0 ); // (double)GetTickCount() * 1.0e-3; +} + + +void Sleep_seconds( float dt_seconds ) +{ + g_usleep( (int)(dt_seconds * 1e6) ); +} + + +/* ------------- End General Stuff ----------------- */ + + +#if (0) + +/* --------------- Back-compatibility Stuff ------------ */ + +GtkEntry *new_formbox( GtkWidget *panel, int xpos, int ypos, int nchars_wide, const char *text, int maxlen, + void callback(GtkWidget *, void *), void *data ) + { return make_formbox( panel, xpos, ypos, nchars_wide, text, maxlen, callback, data ); } + +GtkEntry *new_formbox_bypix( GtkWidget *panel, int xpos, int ypos, int npix_wide, const char *text, int maxlen, + void callback(GtkWidget *, void *), void *data ) + { return make_formbox_bypix( panel, xpos, ypos, npix_wide, text, maxlen, callback, data ); } + +GtkTextView *new_text_edit_box( GtkWidget *panel, int xpos, int ypos, int width, int height, const char *text ) + { return make_text_edit_box( panel, xpos, ypos, width, height, text ); } + +GtkTreeStore *new_selection_list( GtkWidget *panel, int xpos, int ypos, int width, int height, const char *column_titles, + void callback(GtkWidget *, void *), void dclick_callback(GtkWidget *, void *), void *data ) + { return make_selection_list( panel, xpos, ypos, width, height, column_titles, callback, dclick_callback, data ); } + +GtkWidget *new_window( int width, int height, const char *title, GtkWidget *(*winptr) ) + { return make_window( width, height, title, winptr ); } + +GtkWidget *new_window_wkill( int width, int height, const char *title, GtkWidget *(*winptr), int callback(GtkWidget *, void *) ) + { return make_window_wkill( width, height, title, winptr, callback ); } + +GtkWidget *new_scrolled_window_wkill( int width, int height, const char *title, GtkWidget *(*winptr), + int horzscroll, int vertscroll, int callback(GtkWidget *, void *) ) + { return make_scrolled_window_wkill( width, height, title, winptr, horzscroll, vertscroll, callback ); } + +/* --------------- End Back-compatibility Stuff ------------ */ + +#endif diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/gtk_utils3.h b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/gtk_utils3.h new file mode 100755 index 0000000..59a7f61 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/gtk_utils3.h @@ -0,0 +1,357 @@ +#include +#include + +#define GtkUtils_Version 3.0 + + +/* ------------- Text-Label Routines ----------------- */ +GtkWidget *make_label( GtkWidget *panel, int xpos, int ypos, const char *text ); + +void modify_label( GtkWidget *label, const char *newtext ); +void set_label_color( GtkWidget *label, const char *color_value ); /* Specify colors as: "#rrggbb" in hex 00-ff. */ +void set_label_fgbg_color( GtkWidget *label, const char *fgrnd, const char *bkgrnd ); +GtkWidget *make_sized_label( GtkWidget *panel, int xpos, int ypos, const char *text, float fontsize ); /* Default = 10.0. */ + + +/* ------------- Button Routines ----------------- */ +GtkWidget *make_button( GtkWidget *panel, int xpos, int ypos, const char *label, void callback(GtkWidget *, void *), void *data ); + +GtkWidget *make_button_wicon( GtkWidget *panel, int xpos, int ypos, const char **icon, void callback(GtkWidget *, void *), void *data ); + /* Be sure to somewhere set: g_object_set( gtk_settings_get_default(), "gtk-button-images", TRUE, NULL); */ + /* To use, "#include" an xpm image file of icon. Make variable-name at top of XPM file match "icon" name */ + /* called in this function. (You call it with that variable name.) */ + + +/* ------------- Radio Button Routines ----------------- */ +GtkWidget *make_radio_button( GtkWidget *panel, GtkWidget *group, int xpos, int ypos, const char *label, + void callback(GtkWidget *, void *), const void *data ); + +void set_radio_button( GtkWidget *radio_button ); + + +/* ------------- Toggle Button Routines ----------------- */ +GtkWidget *make_toggle_button( GtkWidget *panel, int xpos, int ypos, const char *label, int state, void callback(GtkWidget *, void *), void *data ); + +void set_toggle_button( GtkWidget *tog_button, int state ); + + +/* ------------- Form-Box (Text-Entry Box) Routines ----------------- */ +GtkEntry *make_formbox( GtkWidget *panel, int xpos, int ypos, int nchars_wide, const char *text, int maxlen, + void callback(GtkWidget *, void *), void *data ); + +GtkEntry *make_formbox_bypix( GtkWidget *panel, int xpos, int ypos, int npix_wide, const char *text, int maxlen, + void callback(GtkWidget *, void *), void *data ); + +void modify_formbox( GtkEntry *formbox, const char *text ); + +char *get_formbox( GtkEntry *formbox ); /* Returns string poiner, which must NOT be freed. */ + +void get_formbox_text( GtkEntry *formbox, char *rtrnstrng, int maxlen ); + + /*--- Example Usage: + GtkEntry *formbox1; + + SetFormBox_Routine() + { + int nchars; + nchars = 0.109 * frmbx_wdth_pix; // Good rule of thumb. + formbox1 = make_formbox( panel, ypos, xpos, nchars, "0", 1024, action_routine, 0 ); + } + + Retreival_routine() + { + char *word; + word = get_formbox( formbox1 ); + printf("Text = '%s'\n", word ); + } + ---*/ + +/* ------------- GTK Text-Edit Box Routines ----------------- */ /* Multi-line text-edit widget. */ +GtkTextView *make_text_edit_box( GtkWidget *panel, int xpos, int ypos, int width, int height, const char *text ); + +void modify_text_edit_box( GtkTextView *textview, const char *text ); + +void get_text_edit_box( GtkTextView *textview, char *rtrnstrng, int maxlen ); + + /*--- Example Usage: + GtkTextView *txtedt; + + MakeTextEditWindow_Routine() + { + txtedt = make_text_edit_box( panel, 2, 2, 200, 100, "Initial text\n is here." ); + } + + Retreival_routine() + { + char word[1000]; + get_text_edit_box( txtedt, word, 1000 ); + printf("Text = '%s'\n", word ); + } + ---*/ + + + +/* ------------- Menu Routines ----------------- */ + +GtkWidget *make_menu( GtkWidget *tool_bar, const char *label ); /* For use on automatically spaced menu-bars. */ + +GtkWidget *make_menu_button( GtkWidget *panel, int xpos, int ypos, const char *label ); /* For use anywhere on a window. */ + +GtkWidget *add_menu_item( GtkWidget *menu, const char *label, void callback(GtkWidget *, void *), void *data ); + +GtkWidget *add_submenu( GtkWidget *menu, const char *label ); + +void modify_menu_label( GtkWidget *menu_label, const char *newtext ); /* A 'menu_label' is what is returned by add_menu_item(). */ + + + +/* ------------- GTK Selection List Routines ----------------- */ + +GtkTreeStore *make_selection_list( GtkWidget *panel, int xpos, int ypos, int width, int height, const char *column_titles, + void callback(GtkWidget *, void *), void dclick_callback(GtkWidget *, void *), void *data ); + +void append_selection_list( GtkTreeStore *list, GtkTreeIter *iter, const char *item ); + +char *get_selection_from_list( GtkWidget *selection ); + + + /* Example Usage: + { + GtkTreeStore *mylist; + GtkTreeIter iter; + mylist = make_selection_list( panel, 10, 20, 80, 100, myfunction, 0, 0 ); + for (j=0; j<10; j++) + append_selection_list( mylist, &iter, text[j] ); + } + + void myfunction( GtkWidget *wdg, void *data ) + { + char *text; + text = get_selection_from_list( wdg ); + printf("Selected: '%s'\n", text ); + } + */ + +GtkTreeStore *make_multicolumn_selection_list( GtkWidget *panel, int xpos, int ypos, int width, int height, + int ncols, const char *column_titles[], + void callback(GtkWidget *, void *), void dclick_callback(GtkWidget *, void *), void *data ); +void add_multicolumn_selection_item( GtkTreeStore *selst, int ncols, char *items[] ); + + /* Example Usage: + char *MY_Selected_item=0, *MY_Selected_list=0; + int MY_column_to_get=2; // --- Set this to get the column you need. + + void selected_item_by_column( GtkWidget *wdg, void *data ) + { + GtkTreeIter iter; + GtkTreeModel *model; + if (!done_init) return; + if (gtk_tree_selection_get_selected( GTK_TREE_SELECTION(wdg), &model, &iter )) + { + if (MY_Selected_item != 0) free( MY_Selected_item ); + gtk_tree_model_get( model, &iter, MY_column_to_get, &MY_Selected_item, -1 ); + MY_Selected_list = data; + printf("Column %d = %s, for %s\n", MY_column_to_get, MY_Selected_item, MY_Selected_list ); + } + } + + void dclicked_item( GtkWidget *wdg, void *data ) + { + printf("Dclicked '%s', for %s.\n", MY_Selected_item, MY_Selected_list ); + } + + ... + GtkTreeStore *selst; + const char *headings[]={ "T1", "D2", "P3" }; + char *items[]; + selst = make_multicolumn_selection_list( winpanel, 200, 30, 180, 150, 3, headings, + selected_item, dclicked_item, "chartA" ); + items[0] = "Fries"; items[1] = "Shake"; items[2] = "Cola"; + add_multicolumn_selection_item( selst, 3, iems ); + items[0] = "Coffee"; items[1] = "Donut"; items[2] = "Beer"; + add_multicolumn_selection_item( selst, 3, iems ); + ... + */ + + +/* ------------- GTK FormBoxWithSuggestor ------------------- */ + +GtkSpinButton *make_FormBoxWithSuggestor( GtkWidget *panel, int xpos, int ypos, float min, float initval, + float max, float step, int ndigits ); + +float get_FormBoxWithSuggestor_Value( GtkSpinButton *spinbox ); + +void set_FormBoxWithSuggestor_value( GtkSpinButton *spinbox, float value ); + + /* + make_combobox - Creates a kind of text-box that the user cannot type into, + but has a selector on the right, from which the user can pick any alphanumeric setting. + */ +GtkWidget *make_combobox( GtkWidget *panel, int xpos, int ypos, int width ); +void add_combo_suggestion( GtkWidget *combobox, char *itemtext ); +void select_combo_suggestion( GtkWidget *combobox, int item ); + + /* Example to read value from: frmbx1 = make_combobox( panel, x, y, 30 ); + word = gtk_combo_box_text_get_active_text( (GtkComboBoxText *)frmbx1 ); + */ + + /* + make_formbox_wcombo - Like "make_combobox" above, but users can also type their + own values into the text box, as well as select them. + */ +GtkWidget *make_formbox_wcombo( GtkWidget *panel, int xpos, int ypos, int width ); +void add_form_suggestion( GtkWidget *combobox, char *text ); + + /* Example to read value from: frmbx2 = make_formbox_wcombo( panel, x, y, 30 ); + word = strdup( gtk_entry_get_text( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( frmbx2 ) ) ) ) ); + */ + + +/* ------------- Separator Routines ----------------- */ + +GtkWidget *make_vseparator( GtkWidget *panel, int xpos, int y1, int y2 ); +GtkWidget *make_hseparator( GtkWidget *panel, int x1, int x2, int ypos ); +GtkWidget *make_rectangular_separator( GtkWidget *panel, int x1, int y1, int x2, int y2 ); + + + +/* ------------- GTK Slider Routines ----------------- */ + +GtkWidget *make_slider( GtkWidget *panel, int xpos, int ypos, int size, char orien, double min, double initval, double max, + void callback(GtkWidget *, void *), void *data ); + + /*--- Example Usage: + void slide_adj( GtkWidget *widget, gpointer data ) + { + double x; + x = gtk_range_get_value( GTK_RANGE(widget) ); + printf("Slider Adjusted '%g'\n", x ); + } + + ... + make_slider( panel, xpos, ypos, size, 'h', minv, initval, maxval, slide_adj, 0 ); + ---*/ + + +/* ------------- Sub-Panel Frames ----------------- */ + +GtkWidget *make_tabbed_panel_frame( GtkWidget *panel, int xpos, int ypos ); +GtkWidget *add_tabbed_panel( GtkWidget *tabbed_panel, int width, int height, char *tab_name ); + +GtkWidget *make_framed_panel( GtkWidget *panel, int xpos, int ypos, int width, int height, char *frame_name ); + + +/* ------------- Sub-Window or (Detachable) Pop-up Window Making Routines ----------------- */ + +GtkWidget *make_window( int width, int height, const char *title, GtkWidget *(*winptr) ); + + /* Create new window and register user's own killed callback. It must return 0. */ +GtkWidget *make_window_wkill( int width, int height, const char *title, GtkWidget *(*winptr), int callback(GtkWidget *, void *) ); + + /* Like above, but set horz/vert-scroll to 1 or 0, to enable or disable respective scroll. */ +GtkWidget *make_scrolled_window_wkill( int width, int height, const char *title, GtkWidget *(*winptr), + int horzscroll, int vertscroll, int callback(GtkWidget *, void *) ); + + /* Initial call to set up outermost window. */ +GtkWidget *init_top_outer_window( int *argc, char ***argv, int winwidth, int winhght, const char *title, + int horzscroll, int vertscroll ); + +void close_any_window( GtkWidget *widget, gpointer data ); + +int killed_any_window( GtkWidget *widget, GdkEvent *event, gpointer data ); + +void place_window_center(); +void place_window_atmouse(); +void show_wind( GtkWidget *wind ); + + + /**** ---- Example window making function. ---- + GtkWidget *win1=0; + + void respond_to_some_event( GtkWidget *widget, gpointer data ) + { + GtkWidget *panel; + + panel = make_window( 400, 150, "Test Win", &win1 ); + + ---- Place all window items here .... ---- + make_button( panel, 20, 20, " OK ", close_any_window, &win1 ); + + show_wind( win1 ); + } + + ****/ + + + + +/* ------------- GTK Image Routines ----------------- */ + +/*------------------------------------------------------------------------------ + attach_image_from_file - Reads image from jpg/gif file, and places on panel + at specified position and size. Returns 0 on error, else returns widget. + ------------------------------------------------------------------------------*/ +GtkWidget *attach_image_from_file( GtkWidget *panel, char *imagefilename, int xpos, int ypos, int width, int height ); + + +/*------------------------------------------------------------------------------*/ +/* place_image - This routine displays an image on the named panel, at the */ +/* specified (x,y) position. Image pixels: image_width x image_height */ +/* Allocate and initialize image as: */ +/* imagedata = (unsigned char *)malloc( 4 * image_pixels ); */ +/* imagedata[ 4 * (image_width * row + col) ] = Blue; */ +/* imagedata[ 4 * (image_width * row + col) + 1 ] = Green; */ +/* imagedata[ 4 * (image_width * row + col) + 2 ] = Red; */ +/* Where values are 0=dark to 255=bright. */ +/* You can de-allocate or re-use image array after calling this function. */ +/*------------------------------------------------------------------------------*/ +void place_image( cairo_t *cr, int image_width, int image_height, int pos_x, int pos_y, unsigned char *imagedata ); + +/* Convert Data to Image (cdti) - Retreives image-data from pre-initialized arrays stored within program. */ +/* (The pre-stored array text can be created from the "data2code.c" utility.) */ +unsigned char *cdti_convert_data_to_image( char *data, int dimension, int *imgwd, int *imght ); + + + +/* ------------- Tool Tips / Hover Notes ----------------- */ +void add_tool_tip( GtkWidget *wdg, const char *text ); /* Adds tool-tip to button, etc. */ + + +/* ------------- File Browser ----------------- */ +GtkWidget *file_browser_popup( const char *dir, const char *text, void callback(GtkWidget *, void *) ); + + /* Example usage: + void receive_filename( GtkWidget *wdg, void *fs ) + { + char *yourfilename=0; + yourfilename = strdup( gtk_file_selection_get_filename( (GtkFileSelection *)fs ) ); + gtk_widget_destroy( fs ); -- Closes file-browser window. -- + printf("Absolute path = '%s'\n", yourfilename ); + free( yourfilename ); + } + + file_browser_popup( ".", "Select File", receive_filename ); + */ + + +/* ------------- Progress Bar ----------------- */ + +void adjust_progress_bar( GtkWidget *wdg, double fraction ); + +GtkWidget *make_progress_bar( GtkWidget *panel, int xpos, int ypos, int width, char *text ); + + + +/* ------------- General Stuff ----------------- */ + +void UpdateCheck(); /* Process any pending window events. */ + +void strcpy_safe( char *dst, const char *src, int maxlen ); + +double Report_Time(); /* Reports time in seconds, accurate to millisecs, for checking time differences. */ + +void Sleep_seconds( float dt_seconds ); + +/* gtk_widget_destroy( wdg ); */ + + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/logo_image.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/logo_image.c new file mode 100755 index 0000000..b4cec6a --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/logo_image.c @@ -0,0 +1,2470 @@ +char data_0[] = { + "50360a232043524541544f523a2058562056657273696f6e20332e31306120205265763a" + "2031322f32392f39342028504e4720706174636820312e32290a23200a23200a23204352" + "4541544f523a2058562056657273696f6e20332e31306120205265763a2031322f32392f" + "39342028504e4720706174636820312e322920205175616c697479203d2037352c20536d" + "6f6f7468696e67203d20300a3332312039320a3235350a493c34493c34483b33493a3349" + "3b32493b324a393149382e4a392f4b3a32503b38523d38523d3854403955413854403551" + "3e304e3b2c4d3a2c4f3d3152403656443a57453b57453b59473d58463c58463c58463c55" + "433957453b58463c59473d59473d5a483e5a483e5a483e5a483e5a483e5a44395c463b5e" + "483d5f493e5f493e5f493e5f493e5f493e5e483d5c463b5e483d604a3f604a3f5c463b5b" + "453a5a44395d473c5e4b3d5d4d3d5a4d3a594c39584b38584b3856493655483554473452" + "45324e412e504330524532564936584b385a4d3a5b4e3b5a4d3a574a375548355e4d3d5c" + "4b3b5a49395948385f4e3e5b4a3a554434524131503f2d5c47345946355d4c3a4e3e2e4e" + "41315f52424f43354a3e3253493f4e433d453a364237333a2f2b3a2f2b34292532272331" + "2622362b27372c263a30273c322940362d42382f42382f443a31443a31473d344c3e354f" + "372d4e362c4d352b4d352b483026472f25452d23442c22452a1f44271945281a472a1c49" + "2c1e4b2e204a2d1f45281a41241640231542221543231643231643231643231647271a43" + "23164222154323163e21133e21133e21133f22143f22143e21133d20123e21133f221440" + "23153b1e0e391c0e391d0f3b1f113b21143a1f143c21164931253c21163d1f143d1f1438" + "1b0d3013053d20103a1d0d361907361907331606381c10371b10361a0f35190e35190e34" + "180d34180d34180d33170c35140b35140b34130a33120932110833120935140b38170e39" + "180f37190e34190833180732170631160532170632170632170632170632170631160531" + "160532170633180533180533180533180333180333190234170534170534170534170534" + "170534170534170534170534170535190435190435190435190437180438190537160337" + "16033a17043b18053d18063d18063d18063d18063b18043b18043b18043919043b180443" + "170a4218084019083f1a07401d07401d073f1f063f21054023053f1d04401e05411f0440" + "1e02401d003f1c00431e04441e0746200d49200c49200a461d0746200b4e2b15401d0941" + "220e3c200b371b06361b0a311d14533e39816d6c8c797b79696a7163626b5e5862554c5c" + "5248574e49534a434d443b4c44394d453860584b7b7464564f3d463f2d473d31564c424c" + "423851473d4a40344f46374940314c43324e45344f46374e45364c43344e453651483952" + "493a52493a52493a52493a52493a51473b52483c52483c53493d53493d53493d53493d53" + "493d53493d52483e52483e52483e52483e52483e53493f51473d51473d52483e594f4656" + "4c43574d445e544b6f655c695f5648393246393146373047383147393045372e47362e48" + "372d4a392f4c39324934314c37324e3934513d36544037533f34513e304f3c2e4e3b2d50" + "3e3452403656443a57453b57453b53413754423854423854423853413755433955433956" + "443a56443a58463c57453b57453b56443a56443a5b453a5c463b5c463b5c463b5d473c5c" + "463b5a44395a44395943385e483d5e483d5d473c5b453a5842375741365741365943385a" + "463b5b4a3a5a4a3a5949395848385849365647345647345646365646365a4a3a59493958" + "49365647345546335849365949395a4a3a58483858483853423255443457463659463857" + "44365b483a5f4c3e5f4e3e5f4c3d5a4534523f30513e2f503e30615144847669a89c90a6" + "9990998f86958a869085839085838a7f7b8a7f7b8075716d625e635856554a484b403a43" + "38323b302a2c211b2419132d221c2e231d291e18281d172c1d163d261e3e271f40292141" + "2a22422b23432c24452e26462f274830264d31254a2e22412519391d113f23173f23173f" + "231742261a45291d482a1f46281d44261b42241941231845271c44261b43251a44261b45" + "291d43271b4125193d21153b1f134024183e22163b1f133a1e123a1e123f23153d21153c" + "22153d23163921153b2317361e12331b0f31190d31150935170d391b1037190e381b0d35" + "1a09341908381d0a381d0c33170b35190e381c11391e133b201533180d34190e35190e36" + "1a0f33150b34130a32140a32140a32140a300f063110073211083211082f11062f140330" + "150430150431160531160531160531160531160531160530150430150431160531160535" + "1a07351a07351a05351a05351a0534170534170534170534170534170536190736190736" + "1907361907351806351904351904351904371804391a063918053817043c19063c19063d" + "18063d18063d18063d18063b18043b18043b18043919043b180442180a4218084019083f" + "1a073c19033c19033b1b023b1d013b1e003e1c033f1d043f1d023f1d013f1c00421f0342" + "1d03421c05421c09441b07451c06431d063e1a043b180243230e42230f381c073216012f" + "14034a362d6f5a558b78748775757464656c5e5b6659535e5148594f45534a435047404b" + "42394a42374a42354b43365d56466d665467604e493f3342382e554b41564c42493f3349" + "4031504738534a394e45344e45364e45364f463750473850473850473850473850473850" + "473850473851473b52483c52483c53493d53493d53493d53493d53493d53493d52483e52" + "483e52483e52483e52483e53493f51473d52483e52483e564c43584e455b51485f554c6a" + "605772685f47362e45372e46352d46352d47362e45342a48362c4c3a304d3b314f3c354d" + "38334f3a35503c35523e37544037544037533f34523e33523e3352403654433b56453d57" + "463e57463e52413953423a54433b55443c56443a56443a56443a57453b57453b59473d59" + "473d58463c57453b57453b57433a57433a58443b58443b5d49405c483f5b473e5b473e5b" + "473e604c43614d44614d445f4b425d49405c483f5b473e5c483f5e4a3f5b483a5a483a59" + "47395947395948385342325443335442345543355947395947395a49395b4a3a5c4b3b57" + "46365745375745375543355643355643355744365946385c463b5640355a44395a443955" + "4234523c2f533d305842355743384331274e3b3475645c9f9188a4958ea0938da19392a1" + "9393a49696a09291a19392a59796a19392a092929e90909385848b7d7a8476737567646c" + "5e5b483a374739363e302d392b283a2b2635221b321f182d1a132c191228150e29160f2c" + "19122d1a13301c152e180d321c113c261b463025463025442e233e281d3c261b3e281d3f" + "271d3d251b3b23193a221839211731190f351d13361e1438201631190f311b10311b1033" + "1d12331d122e180d2c160b291308281207281207261005261005250f04240e032610052d" + "170c3b251a3e281d361e14361b10391c143d21163e2217391d11361c0d33190a351b0a33" + "190a32180b32170c31160b2e160a2d150930180c30180c32170c31160b371b1037190f36" + "1a0f35190e35190e37190f37190f37190f35170d33170b31170831170831170831170833" + "190a33190a33190a33190a33190a33190a33190a33190a33190832180732190532190532" + "190332190335180635180835180835180835180835180835180835180835180835180635" + "1806351806351806371806391a083918073817063b17073c18083c18083c18083c19063c" + "19063b18053919043919043919043b18044019084019083f1a073f1a073a17013a170139" + "1900391a00391a003d1b023e1c033e1c013e1c003d1c00411e02401c02401c043f1a0741" + "1b06401a05401a053f1a0737170246251241220e3b1e0c462b18462c1b6e5a5185726c87" + "74707a68666c5c5c6456535f524c564c42544a3e4f463d4d443b4941364a42374f473a47" + "3f324b44346861516962525e544841372d4f453b4b41374f45394f45394c43344d44354e" + "45344c43344d44354f46374f46374e453650473850473850473850473850473850463a51" + "473b51473b52483c52483c52483c52483c52483c52483c52483e52483e52483e52483e52" + "483e53493f52483e52483e53493f544a415a50475f554c60564d655b5272685f47342d45" + "342c45342c46352d48352e49372d4c3a304f3d33513f3552403654413b523f39523e3751" + "3d36523e37513e37513e37523f385240364f3e3651403853423a53423a52413952413954" + "433b55443c56453d56433c55423b55433955433955433958463c58453e58453e59463f59" + "473d54423856443a57453b58443d54403955413a56423b56443a57453b4d3b31503c3554" + "403956423b56423b554339534137524036523e3558443958443958443958443958443958" + "4439584439584439584439523e335440355541365844395a463b5b473c5b473c59453a57" + "43385642375c453d5a433b574038563f37614a426049415b443c574038513a325f4b4258" + "413b4e3a335e4b457c6965998783a59691a59693b1a1a1aa9c9cac9da0b0a1a4aea0a0ad" + "9f9fa59797a89a9aaa9b9eaa9b9eaa9c9caa9c9caa9c9ca99b9ba89a9ab8aaaab7a9a9ae" + "a0a0aa9c9caa9c9bb1a49eac9f99a69993a497919a8d879a8d879a8d879a8d879a8b8692" + "817a8b7a7378676068575066554e62514a56453e4f3e374d3c3555423c56433d5946405b" + "48425c49436b5852725f5975625c77645e7c6b647e6d6681706985746d8877708a797289" + "78718978718b7a738c7b7494837c95847d94817b927f7996837c3e2a233a261f2d19122e" + "170f381f18371e17371f153d251b3a2216371f13341d0f351e10331c0e361e12331d1231" + "1b10301a0d2f190c2e180b2d170a2d170c2c160b33180f32170e31160b30150a2f140931" + "160d32170e32170e30150c2f1409341a0b33190a32180932180b33190c33190c33190a33" + "190a33190a341a0b341a0d33190a33190a32180732180732190532190532190534190835" + "180a35180a35180835180835180835180835180a35180a35180835180635180635180637" + "18063718063716053716053a16063a16063918073a19083a19063d1a0739180539180539" + "19043919043919043e19073e19073e19063e19063c19033c19033c1a013b1c003d1b003d" + "1a043e1c033e1c013e1c003d1c003c18003e1a023f1b05401b08421d0a3f1b053d180544" + "210d4425113c1d093c1f0d492e1b6e5342715a4a867468837069725f596a58546556535e" + "514b5a4d4552483c51473b4c44394b43384941364a42374c44374f473a4f473a4c453550" + "483b655b515e544a4e443a42382e4b41354f45394a41324a41324e45344c43344b42334b" + "42334c43344e453650473850473850473850473850473850463a50463a51473b51473b51" + "473b51473b51473b51473b51473b51473d51473d51473d51473d51473d52483e52483e53" + "493f544a40554b425c524960564d61574e655b526d635a48342b46342a46342a48362c4a" + "362d4c382f4f3b32513d34513d344f3d33524139503f37503d364e3b35503d374f3e374f" + "3e37503f38503f384d3c354e3d364f3e374e3d364e3d364e3d36503f3851403952413a54" + "413b523f39503d36503d36513e37523f3853403a55423c57443e58453e57463e57463e56" + "453d56433d58453f58453f59464058473f58473f58473f5a47415b48425a47415d4a445b" + "4a425a494157463e56433c58443d5b443e5b443e5b443e5b443e553e38553e38543d3753" + "3c365c453f5b443e5a433d57403a563f3957403a57403a58413b59423c59423c533e3953" + "3e39533e39533e3948332e48332e4b36314e3934533e394e3b374a35344c38376452528f" + "7d7da79797aa9c9ca09292a39497a59699a8999ea8999ea8999ca6979aa99a9dafa0a3b2" + "a3a8afa0a5ad9ea3ad9ea3ae9fa4afa0a5afa0a5ac9da2ac9da2a8999ea7989da69a9ca0" + "9896a19997a39b99a49c9aafa7a5afa7a5aea6a4aea6a4aea6a4b4a9a7b4a9a7b4a9a7b5" + "aaa8afa4a2ada2a0a79c9aa59a98a69b99a29795a59a98aa9f9daca19fafa4a2aba09eaf" + "a4a2b0a5a3afa4a2aaa09ea99f9da99f9da99f9da89e9caea4a2ada3a1ada3a1afa5a3af" + "a5a3ab9f9faca19fac9e9daa9c9bb0a19c5948415d4c4537241e2c1912361f19321b152f" + "1812382119331c14311b10301a0f341e11311d1229150a2c180f2f1b12311d1234201533" + "1f14342015342017352118321b13331a13341c12351d13351d132f160f30171031181131" + "181131190f2f180a30190b30190b31190d30180c30180c30190b30190b30190b2f180a2f" + "170b2f180a2f180a321b0b321b0b321b09321b09321b0934180a34180c34180c34180a34" + "180a361a0c361a0c361a0e361a0e34190834190834190835180835180838180937170838" + "170839180939180938180939190a3a1b093b1a093819073819053819053819043919043d" + "1a073d1a063d1a063d1a043e1b053e1b053f1b033d1b023e1a023e1b053f1d043f1d023f" + "1d013e1c003b19003c19033d1a063e1b083f1c093d1a063b1a073e1f0b3d200e32150347" + "2c1b664c3b896f6089746385756876655d6251495e4f485f504b594c4455483f50463a4f" + "46374c42364c42364c42364c4236463c304e443851473d443a2e473d334d4339675d5459" + "4f4553493f463c32453b2f4c43344d44354d44354e45364c43344940314c43345047384e" + "45364e45364e45364e45364e45364f45394f453950463a50463a51473b51473b51473b51" + "473b51473b51473d51473d51473d51473d51473d52483e52483e544a40554b41594f465d" + "524c5f544e625751695e587166604a332b47332a47332a49352c4a362d49352c4d39304f" + "3b324f3b324c3a304f3e36503f3751403852413a55443d55433f55434155434156444253" + "413d53423b53423b52413a4f40394c3d364d3e37503f3851403954423e523f3b503d394f" + "3c38503d39503d39513e3a53403c55423e55433f56474253443f4e3f3a4d3e3952433e51" + "423d50413c4f403b4e3f3a54454053443f4f403b4a3b3647383347383348393447383348" + "363244312d45302d46312e47322f47322f442f2c432e2b432e2b432e2b3b26233c27243c" + "27243d28253e29263e2926402b28442f2c4a35324a37334b3937513f3d5846445c484762" + "4e4d634f4e6b5756715f5d7b69698777789080819a8c8c918285a19295b3a7a9aea2a6aa" + "9fa3b1a6acb6a9b0b8abb2b4a7aeb5aaaeb3a8aca69b9fb3a8acbbaeb5bbaeb5b8abb2b7" + "aab3b5aab2b4a9b1b4a9b1b6abb3b8abb4b7aab3b9acb5b9b0b5afadaeb0aeafb2b0b1b3" + "b1b2a9a7a8a9a7a8aba9aaaba9aaacaaababa5a7aca6a8ada7a9ada7a9b2acaeb1abadb0" + "aaacb0aaacb0aaaca8a4a5a8a4a5aaa6a7aaa6a7aba7a8aca8a9aaa6a7a9a5a6a5a1a2ad" + "a9aaacaaabacaaabadabacaeacada8a6a7a6a4a5a3a1a2a2a0a1a2a0a3aaa5a9aca6a8ae" + "a5a8ada4a5aca0a0a69895b3a5a26859543f2d2945322e3d2a26311e1a311e182c191229" + "160f210e071d0b011705001e0d031e0d031e0d031e0d031d0c021f0e04200f0521100622" + "110727130a28140b29150c2b170e2c180f29150c2b170e2c180f2c180f2c180f2c16092f" + "190c331d10341e13331d12331d12331d10331d10331d102f190c301a0f311b0e311b0e2d" + "17092d17092d18072d18072d180732180b33170c33170c33170b33170b32160a32160a32" + "160b32160b34180a34180a34180a34180a35180a381b0d39190c38180b3b190d3a1a0d35" + "180a371a0a381b0b3b1b0c381907381905381905381904381904391a06391a053a1a053c" + "19033d1a043d1a043d19013d19013c18003e1b053f1d043f1d023f1d023e1c003d1d043b" + "1b063c19063817063716053918053a1b093013012c1100432817674d3e856e5e8b756784" + "71627365586c5e535f51485b4c45594c4455483f52453c4e44384f46374c43344c43344d" + "44354d43374e44384c4236483e344b41384c4239443a314a403751473d61574d594f4551" + "473b443b2c403728473e2f4e45364d44354b42334d44355047384b42334b42334b42334b" + "42334b42334e44384f45394f453950463a50463a50463a50463a50463a50463a50463c50" + "463c50463c50463c50463c52483e52483e544a40564c425c514b5e534d60554f6459536d" + "625c776c664a32284832274933284b352a4c352d4831294d362e4f3b344f3b344d3a334b" + "3d344c3e354d3e374f403b52433e52434052424252424251414151423f52433e51423d4f" + "403b4d403a4b3e384b3e384d3e394d3e39513f3d4c3a384a38364836344a38364a38364a" + "38364a38364a38364a38364739364537344335324234313c2e2b3c2e2b3e302d3f312e3f" + "312e392b283a2c293c2e2b3b2d2a392b283b2d2a40322f4436334537344e3e3e4f3f3f50" + "40405040405141415f4f4f6252526353536555556e5e5e7262627565657b6b6b7e6e6e8a" + "7a7a8a7a7a8e7e7e948484958585998d8d9f9393a69a9aaa9c9cb0a2a2afa1a1b1a3a3b2" + "a6a6b7abadb5acb1aea5aaaba2a7aaa0a8ada3abb8b1b8aaa3aaafaab0b9b4bab3acb3b3" + "acb3ada6adb0abafafaaaea29da1a8a3a7aca5aca19aa1a9a2aaaaa3aba9a4abaaa5acab" + "a6adb2adb4b5aeb6b4adb5b5aeb6b4b1b8a9adb0a7abaea4a8aba3a7aaa5a9aca5a9aca5" + "a9aca5a9aca7a8acaaa9afabaab0aeadb3b0afb5aaa9afaaa9afaaa9afa7a6aca4a3a9aa" + "abb0a9aaafa7a8ada6a7aca5a6aba8a9aea5a6aba4a5aaa4a5aa9da0a59fa2a7a1a4a9a6" + "a9aea8abb0a7aaafa5a8ada2a5aaa1a4a9a1a4a9a0a0a8a1a0a6a4a2a7a7a2a6b0a7aac0" + "b6b5c1b7b6b5a7a6b6a8a59f8f8f9a8a8a8d7e7b85767384757080716c74655e6b5c5563" + "544d4c3e35483a313f31283b2d243729202b1d1426180f23150c1e100726150d23120a21" + "10081c0b031a09011e0d051f0e061f0e061d0c041c0b0127130828140929150a2a160d2c" + "180f2c180f2c180d2c180d2c180d2b170c2c180f2e1a0f301c1129160829160829160729" + "16072916072f170b31160d31160d31160b31160b30150a30150a30150c30150c33180d33" + "190c33190c33190c34180c35190d35170c34160b37170c36180d34180c361a0c371b0d39" + "1c0e361907361907361a05361a05381904371b05371b05391b033a1a033d1a043d1a043d" + "19033d17023d17023d1a043c1c033c1d013c1d013b1c003c1e043a1b063a190837170838" + "1809391c0a3518082e13023720105e47377d67598c796a7e6b5d766456685c5064584c5b" + "4f43574a4153493f4f453b4d43374d43374e45364c43324c43324c43344b413553493f4c" + "42384339304b403a4a3f394b41383b312840362d4f453c61574d60564a4c423643392d45" + "3c2d483e32493f334c42364b41354a40344c42364c42364c42364c42364c42364d43374e" + "44384e44384f45394f45394f45394f45394f45394f453950463c50463c50463c50463c50" + "463c52483e53493f554b41564c425b504a60554f635852675c5670655f796e6848302648" + "30264931274b33294b342c4730284d362e523e37533f38513e3745382f45383045362f45" + "3631473835463837453737453639443636463835473a3446393343363043363046393346" + "39334538324538324434343f2f303c2c2c3b2b2b3c2c2c3c2c2c3b2b2c39292a37272835" + "2727322827352b2a382e2d392f2e3f35344339384b41404e44435248475b51506056556c" + "6261756b6a7f75748177768b8180938988968c8b9a90919a90919b91929c92939d9394a0" + "9697a59b9ca79d9eaca2a3aea4a5afa5a6b0a6a7b2a8a9b3a9aab4aaabb3a9aab2a8a9b4" + "aaabb5abacaca6a8aca6a8aba5a7aba5a7aca6a8aca6a8aba5a7aaa4a6a8a3a7aaa9afaa" + "a9afb1b0b6a5a4aaa6a5adb6b5bbb0afb5afb0b5a7a8adafaeb4aeadb3a8a7adadaeb2ad" + "aeb2a2a3a7adaeb2b3b2b8abaab0adacb4aeacb7adadb5aeaeb6aeaeb6acacb4aeacb7ab" + "a9b4aba9b4ababb3a6aeb1a8b0b3aab2b5adb2b8acb1b7aaafb5a6abb1a2aaada2a7ada7" + "aab1a6a9b2a4a7b0a3a6afa1a4ada3a6ada8abb2a8abb2a5a8afa2a6af9fa6ae9ca3ab9b" + "a2a89aa1a7949ba1959ca2979ea69da4ac989fa7979ea6969da3959ca2959ca2939aa292" + "99a1939aa2949ba3959ca4979ba6979aa39d9da5a09fa5b6b1b7b7b1b3a19899b0a6a5a7" + "9b9ba49898a8999ca99b9ba49696a69897a297939d928e9d928c9a8f899b8e86978a8290" + "837b8b8177877d737d736971675d6b5e565e51494f423a48393241342b33261d2c1f162c" + "1d162c1d162a1b1427181126180f1e0d051b0a021706001603001c09021c09021b0a021b" + "0a021b0a02200f07220f0825120b28160c2e1c122d1d102d1d0e2d1d0e2e1c0e2d170c2e" + "150e2e150e2e160c2e160c341c12341c12341b14341b1431190f301a0f301a0d31190d31" + "190d2f140b2f120a2f120a30130b30140933180d351b0e361c0d381c0e351a0936190736" + "1907361a05361a04361c05371b05391b033a1a033f1c063e1b053e1a043e18033e18033b" + "18023a1a013b1b023a1b00381a003a1c04381c07381b0b381b0d3d21133d211330160736" + "1c0f5741336f594b7c695b7e6c606f5f52695b4e655b4f5a504453473b51473d50463c4d" + "43374b41354b41354d43374b42314c43344c43344a4034473d33483e35463b3544393547" + "3c38493e384a403742382f362c234a4036584e446b6155655b4f4a41323f352942382c4b" + "4135483e3241372b50463a50463a50463a50463a50463a4d43374e44384e44384f45394f" + "45394f45394f45394f45394f453950463c50463c50463c50463c50463c52483e53493f55" + "4b41564c425a4f49615650675c566a5f5970655f7c716b4e332a4c312842271e3a211a3d" + "241f38211b321e172c171226130d2f1e172d231a352a243b2e284537345244435448485e" + "5254685c60706466887d7b867b778075719085818b807c908581908581908581968b879c" + "8e8e9d8e91a19393a69898a19393a99b9bab9c9fb0a1a4b2a3a6ada1a3a79e9fada4a5ac" + "a3a4a9a0a1afa6a7a79e9fafa6a7b0a7a8aea5a6ada4a5afa6a7b1a8a9b1a8a9aca3a4ae" + "a5a6b4abacb0a7a8a8a2a2a8a4a5aaa8a9aaa8a9aba9aaadabaca9a7a8a8a6a7a8a6a7ab" + "a9aaa5a3a4a8a6a7aaa8a9aba9aaacaaabaaa8a9acaaabadabacaaa8a9a8a6a7a9a9aba8" + "a8aaa9a9abaaaaacababadb1b1b3b0b0b2acacaea6a7aba5acb4a5acb4a4abb19fa4aaa4" + "a8b1a5aab0a8adb3a5acb2a3aab0a0a5abacb1b7a9aeb4a9b1b4a9b1b4a1a9aca0a8aba1" + "a6ac93989e999da69ca0ab9aa1a9979ea6939aa2989fa79a9ea99b9faa9fa3ae9ea5ad96" + "9fa498a1a699a2a799a0a8939aa2969da5949ba3919a9f939aa29498a19498a39397a293" + "97a29397a29397a09599a2969aa38f969e8f98a18f98a18f98a18f989f9099a0939ca38f" + "989f8e97a09099a2959ea7929ba49099a09099a0919aa1959ea7939ca59099a28e97a08d" + "969f8f95a39296a29597a39699a29e9da3a9a4a8aca6a8ada4a5aea4a5a89e9fa69a9ea1" + "9597a094969e9292a09694a197959a918c9c938e9c918b978c86978c86968d84948b8296" + "8d848e857c8e837d8c817b93888294878191877e90867d90867d95888296898396898395" + "888294877f8f8079897a73877871887770806f687e6d667a6b6472635c6b5c5560514a5c" + "4b4453423b4f3e363c2b2336281d2c1e1127190c251508241007240d071e07011a030013" + "0000210a021f08001e0701220b05230f06230f06241005271106230d023017102c110a2f" + "140d33181131190f392117351d11372012290f02341a0b351a07351a07351a0535190332" + "18003319003519013618003d1d063c1c053d1a043d18053e18053b18023b1b0434160034" + "16003c1e043b1f093d220f3e22143f2317280e012710023b24165f493c816f61806e6072" + "625565574c5f51465f5347585045544c4153493d4e46394b43364f473a51493c524a3f52" + "483c53473953473b4a3e324b3e3550433b50433d4c3e3b493b3a4b3d3c483d3744393349" + "3f364b4138483e3540362c3d3329453b2f60564a62584c5b5145493f33453b2f4b413544" + "3a2e473d31453b2f463c30473d314d43374d43374e44384c42364e443850463a51473b50" + "463a4d43374f453b50463c52483e544a40544a4050463c52483e564c42584e4461565066" + "5b576e635f726763776c68837874472c234a2f26472c25452c274f3631775f5b7a656278" + "6463746260766764877e798c837e9186849c918fa69a9aa89e9faea4a5aea3a7aea2a6a7" + "9c9ab1a6a2b4a9a5aca19db6aba7baafabbaafabbaafabbaafabb8aeafb2a7abb0a6a7b1" + "a7a8b1a7a8a59b9ca59a9ea69b9fa69b9fa49b9eaba6aaa8a3a7a7a2a6a7a2a69e999d9d" + "989c9e999d9e999d9e999da09b9fa19ca0a49fa3a8a3a7aca7abada8acb1acb0b1acb0ad" + "abaeafb0b2aeb2b5abafb2adb1b4afb3b4adb1b2a5a9aaa3a7aaa2a6a9a9adb0aaaeb1ab" + "afb0adb1b2afb3b4b1b5b6b1b5b8aeb2b5aaaeb1a9adb0aaafb2a8adb0a8adb0a8adb1a2" + "a7aba3a8aca0a5a99ea3a69aa2a599a6ae98a5ad9ca7ad9da8ae97a0a798a1a898a1a897" + "a0a7969fa69ca5aa99a2a78c959a90999e9aa3a889929790999e9ba4a997a0a5919aa191" + "9aa3929ba4949da6959ea79099a2919aa3939ca5929ba4929ba29aa3aa98a1a897a0a797" + "9ea69ba2aa9da4ac989fa7959ea5959ca499a0a899a0aa99a0aa9aa1ab99a0aa99a0a89c" + "a3ab9ea5ad99a0a89099a2939ca5939ca5919aa18e979e828b9287909789929b8b949d89" + "929b888f99868f96858e95858e957f8690848b958c939d9299a3939ca58f95a38c929e8f" + "939e91949d9c9ba3a7a5aaaca7ababa5a7aca3a6ada2a6aba0a4a99ea2afa4a8b3a9aab0" + "a6a5a89e9da59b99a197959d948f9b928d9e95909e958e9c938ca59c95a49b949f96919a" + "918c938884958a86958a849186808d827c867b77877c78897e7a887d79887d7791847e91" + "847e94878193858294868394868394878191847e8d807a9588829284818b7e78897c768c" + "7f778b7e75877a7183776b80736a68574f63504a5d4a445d4a445f4c4648352f43302a3f" + "2c263a27212e1d1528170f24130b200d061c09021f0b04250e082009031e07011f08021b" + "0700271308372114372114321b0b33180732170433180335190333190033190034180035" + "17003313003414003916003e1906401b083c19033e1e073c1e04391b013519013e230e3c" + "2211381e113a1f14331b11382215533f346c5a4e7e6d63746359695b505f5249554b4156" + "4c43524b41534d41524a3f4d45384c44374f473a50483d51483f50463d473a313e312833" + "261e41342e4436334739364d3f3e4a3c3b493b3a453a364439334a40374a403743393044" + "3a303e342a3f3529483e3262584c62584c5e54484e443841372b42382c41372b453b2f57" + "4d415e5448493f33493f33493f334c42364d43374e44384f45394f45394f453952483e52" + "483e4f453b4d43394d433951473d53493f594f455c5248695e586d625e756a66786d697d" + "726e847975472c254b3029462a263f262249312d9a8582b19d9cb19f9fae9e9eac9e9daf" + "a7a4aca4a1aca2a1aea4a3a99fa0aaa1a4aea5a8b1a8abb3a9aaa49a99a89e9cbdb3b1ab" + "a19fbcb2b0bcb2b0b9afadb9afadbab0aeb7aeb1b1a8adaea5a8aaa1a4aaa1a4aba2a5aa" + "a1a6a89fa4a89fa4a7a1a59e9ca19f9da2a19fa4a2a0a5a3a1a6a9a7aca5a3a8a5a3a8a8" + "a6aba2a0a5a19fa4a2a0a5a4a2a7a6a4a9a6a4a9a5a3a8a5a3a8a5a4a9979c9f98a0a399" + "a1a49ea6a9a1a9ab9aa2a498a0a298a0a39ea6a9979fa2939b9e90989a8e96988e96988c" + "94968c94978d95988f979a90989b899395869092838d8f838c918a9398879095858e9384" + "8e90838e927c8a937b8a918491998e9ba1919ca28e999f8590947c878b7984887881866c" + "757a50595e4f585d545d624750555f686d7b84898b94998d969d889198868f96858e9588" + "9198929ba2959ea597a0a7939ca3919aa1888f95838a9080878d82878d7f848a82878d7e" + "83897b82887d8288767b81777b84787c85797d867a7e877a7f857d82887f848a7b80867f" + "868e7a8189767d85757c82757c82848b91858c92828991777e867980887d818a7c83897e" + "858b7e858b898d968589927d818a74788170777f7579857377827678847a7a8489889098" + "969b9f9da2a8a3a7ada7ab99909590878c7c7378736a6d72696c6c63646960617a72707a" + "726f736b68766e6b7e76738079737f78727f78728f88828f8784948c89998f8d9e9492a0" + "97929c938e958c87928886948a88968c8a958b89958c878e837f8e837f8d827e8a7f7d91" + "8684938886958a86968b87968b878d827e8c817f8a7f7b887d79928781948a81958b8290" + "867c8f857c9c8f899687828f807b8f807b91827d93847f92837e91827d8e7f7a998c8695" + "888094877f94857e968780988780a5928c9b888293807a95827c5340392a180e24100533" + "2012311a0a311706301703321702341a03351a00351a00351a00341600381a02381a0239" + "19043b18043b18053b1b043b1b043d1f073d1f07371b033e250f341d0d30180c361d164f" + "3b3257453976645a7d6c62776a61675a5160564c595047554c435750484e4a41504c4151" + "4a404d473b4e483c4f473c4d443b473e374338323d2e293e2f2a3f302d3627243828283e" + "2e2e4d3d3e4c3c3d4a3a3b453a36483d374c413b4a3f3941372e453b32463c32463c3246" + "3c32362c223a30264a40365f554b6b61575b51475c52484f453b3e342a3a3026493f334b" + "41354a40344f45394b41354b41354c42364e443851473b4a40364c423852483e564c4258" + "4e44544a40554b415c52485f554b6f645e7368647b706c7f74708378748c817d482c2849" + "2d2941282439211f3c2422857170b6a3a5b2a2a5afa0a3ada1a3afa6a7aba2a3aaa1a2a4" + "9b9ea69da0a69da0a69da0aaa1a4aba2a3b2a8a7aba19fb1a7a5ada3a1b2a8a6aca2a0af" + "a5a3b0a6a4aba19fa7a1a3a7a2a8a8a3a7a9a4a8a7a2a6a8a3a7a5a0a6a19ca2a19ca2a5" + "a0a69f9fa7a6a6aea7a7afa7a6ae9e9da59d9ca49b9aa29f9fa7a0a0a8a1a1a9a2a1a99f" + "9ea69a99a193929a9191998d8d958a8a92868990868e918a94968a94968892948993958a" + "9496869092838d8f7e888a858f91818b8d808a8c828c8e858f91838d8f818b8d818b8d84" + "8e90869092879095838c917f888d7e878c818a8f80898e818a8f818a8f7e898f7c8a937f" + "8c948a979f96a1a7909ba18d989c848e907f898b81898c798086777e845e656b575e6450" + "575d50575d656c727e858b8e959b8e959b868d9380878d777e84737a80868d93888f958a" + "9197888f95898e9486898e7f82877d80857d808783868d898c938c8f968d90959194999e" + "a1a69fa2a7a1a4a9a3a6aba6a9aea5a8ada7aaafa8abb0a3a6ab9c9fa48f929786898e8a" + "8d9294979c979a9f8f9297878a8f76797e6f727777787d787b807d80857e818681828782" + "83888081867d7e83797c8371737f71747d7979837d7d878c8b919694999b999ea6a1a7af" + "aaaeb0a7acaaa1a69a91968f86899a919491888b82797a807778776f6d6d6562726a677e" + "76738179768078756b63607169666e66636a625f796f6d7e74728076747f75737b716f8c" + "82808d83818d83818c82808b817f938987958b89958b89918786877d7c897f7e8a807e8b" + "817f8c82809288869288879288869086848c837e8e857e8d847d89807789807991868293" + "8884938884928783908581928783938884968b87998e8a948b86988f889990899c918ba0" + "958f968983a1928d9a8b8694858095868174655e2f1e161d0b01301e12301a0c311a0834" + "1a09351a05351b04381d023a1c02361b003517003a1c043a1c043819043617023516023b" + "1b06331300381a023a1e063b210a3a240f2f190b38221748312b6e5b547362588072697a" + "6c636a60575e544b574e45504941544d4558534d4f4c45504c434f4b424e473d504a3e4e" + "453c4a413a4037323a2f2d3c2c2c4434344a3a3b31212231212237272844343549393a4a" + "3a3d483a39483d374a3f39473c3642382f41372e473d33483e34463c324b4137473d333e" + "342a3e342a443a305d5349695f55675d53584e4453493f4e44384f4539483e32443a2e4e" + "44384c42364b41354e443851473b564c42554b4152483e50463c50463c51473d52483e5a" + "50465f554b716660766b677f7470837874887d799388844128243f2622422827422d2c3d" + "2827675355ac9c9faa9ba0a3979ba79ca2a9a3a7b1abafb4aeb2b0aaaeaea8aaaea8aaaf" + "a9aba6a0a2958f8fa9a19fbab2b0928a889d9593958d8ba49c9a9f97959c94929d95938b" + "868a86838a8b898e9e9ca1a8a6ab9e9ca199969d8f8c9389868d8f8e9486899283868f84" + "879087879195959f86869085858f8c8f98868992888b948c8c968a8a9481818b8b8b958a" + "8d96898c9583868f7e818a7d848a82898f7b82886e757b6b727870777d767d83777e8473" + "7a805f666c61686e646b7170777d7980867f868c7980866f767c6b72786b72787d848c79" + "8088757c84757c84737a82757c847c838b7c838b767d856f7982727b847a838a7c838b86" + "8b91868b8f898d9094989ba1a2a6a5a6abb0b1b6a8a9aea6a7aca2a3a8a5a6aba4a5aaa9" + "aaafa6a7aca6a7aca2a3a89e9fa494959a8c8d927a7b807a7b807c7d827e7f847f80857c" + "7b8077767b76757a78777d8382888a898f8e8d93908f949594998e8e908f8f9191919392" + "92949494969393959393959292948c8c8e88888a8181838080828585878f8f919393958e" + "8e908b8b8d8686888482858b868a8b898c8e8c8f8e8c8f8f8a8e9590949c979b9e999d9c" + "9a9f9a9aa29b9aa2a1a0a8a4a3ababa8afa8a6aba4a2a7a4a2a7ada8aeb1aab1afa9ada4" + "9ea29690927e787a7d7779817b7b8c8686928a888f87859389889a908f9b9190978d8c9a" + "908f9b91909c92919d9392948a89948a89948a89938988938988847a79847a7983797880" + "76757f7574776f6d80787689817f887f808f86878e85868d85838c84828c84828a82808b" + "82838a8280877f7d8d85828c857f8a837d8a837b8d86807d76707f7774837b78857d7a87" + "7f7c8d858289817e8b83808f87848f8a84948f89938e888e87818e8580958c87968b8799" + "8e8a9a8f8b9a8f8b877a744e3f382a190f2b190d2d1a0b351e0c38210f39200c361c053c" + "1e023d1e023b1d03381a022f1300301400331701371b06381c073b1c073517003a1c043a" + "1e06371d06311b06341e10513b306f5b547c6b647a6c6374675f6a60576158515c534c4d" + "463e3c3731443f394c494451504c4d4a454c49404e4a3f4a463b4c453d4b443c473d3b44" + "383a3c2b3135242a3120262d1c222e1d233020233525283d2d30433336463837453a3644" + "393344393344393341372e3f352c3d3329392f252f251b33291f3e342a443a3043392f36" + "2c22392f2541372d53493f5a5046655b4f675d515e544852483c4b4135453b2f42382c3e" + "34283e34284c42384d43394e443a50463c50463c554b415b5147685e546e645a7469657a" + "6f6d847977897e7c8f84829489874027233d2420422a284630323b272859464aa5969bad" + "a0a7a69ba3aaa0a8a59ea5ada6adb2abb2ada7ab9690949a9496a7a1a39a94947c767662" + "5a589f9795615957726a6869615f837b795a5250524a48756d6b6b6a6f5a5b606061668a" + "8b90a1a2a79e9fa498999e898a8f7c7d8283838b848692797b878587938f919d91939f7b" + "7d8977798581838f7274806f717d7274807476826f717d656773666874686a7666687461" + "6570787c8580858b7e838974797f71767c6c7177777c827a7f85797e8473787e74797f76" + "7b817d828883888e868b9181868c797e84777c82777c8280838c7d80897b7e877b7e877e" + "818a80838c8b8e978b8e9782858e7d818c7d818c7e828b797c8375767b76757a7e7c818d" + "8b8e9a95998f8a90969198918c939590979a959c979299959097928d94928d9495909698" + "9399999498979296938e929893979792989691979a959b9b969ca19fa49e9ca19f9da2a2" + "9da3a39ea4a8a3a9a8a3a9a5a3a8a8a6a9a8a7a5aaa6a7aca8a9ada9aaaba7a8a8a7a5a8" + "a7a5a7a6a4a39f9e9894959e9a9ba6a2a3a9a5a4aba7a6a4a09fa19d9ca29e9fa6a2a3b0" + "a7aab0a7aab0a7a8afa6a7ada4a5b0a7aab2a9acb2a9acada4a7a9a3a5adabb0adabb0ae" + "acb1afadb2a9a7aca4a2a79f9da29d9ba0a8a3a9b6afb6b4aeb2aba5a99c96989e989a9c" + "9698969090918b8b9088868b8180887e7d887e7d867c7b7f7574756b6a7d7372867c7b96" + "8c8ba197969f95949d93929b91909b9190968c8b968c8b958b8a9288879187868d848593" + "8a8b9a91929a91929188898f86878d84858b82838b82839087888f86878e85868d858381" + "79777f77747d7572827b75827b75847f7b7c797477746f7875707d7a757a777277746f7b" + "78737f7c777d7a75838079817e777b76707c777185807a827b7589827c928984928984a8" + "9a976d605a2b1d1426150b2d1a0c35200f38210f3a210d371d063d1e023d1e023c1c0339" + "1b03371b05371b05391d07391e093a1f0a3a1b063e20083e220a3b1f073017012d160442" + "2f216551488976707d6e677a6d656c6259665d54625b53645d554b46402e2b2433302b3b" + "3a364e4d4b4a49454b48414e4a414642374b443c4d46404f45464f434735242e2a192320" + "0f1927162029182029181e28171d2f1f2237272a443635443935433832443933493e3843" + "39303f352c3e342a3d332943392f42382e3c3228372d23362c22453b31443a3042382e48" + "3e344b41375e54486d63576e64586d635761574b5b5145564c404d4337493f3341372d42" + "382e473d334b41374c42384b4137584e44685e546e645a7d726e8277758a7f7d8f848293" + "8886958a884129273f2725432b2b422c2e3723254b3b3e93848bb0a3acaca0aaa89ea7a9" + "a4aba9a4abaca7aea7a2a8908b8f938e92a29e9fa4a09f928d8a504748857c7d655c5d6a" + "6162635a5b655c5d4c434442393a5d545565666b4f5259595c638e9198a1a4ab9fa2a99a" + "9da48b8e957c7f8684878e777b876f737f7c808c878b97828692767a86707480787c8869" + "6d796e727e6f737f717581727682777b87777b87777b87767a86767a8582858e8a8d948b" + "8e958a8d948a8d948b8e9586899082858c7a7d8484878e83868d83868d81848b81848b7d" + "80877d80877e818882858c85858d817f8a807e89807e89807e897c7a857a788382808b83" + "818c7b798482808b817f8a82808b807d86847f86857e858a818692898c998e94a79ca4aa" + "9fa7a1969ea499a1aa9fa7a69ba3aa9fa7aba0a8b2a7afaea3a9b0a5abb2a7abb6abafb7" + "acb0bbb0b4baafb5b9aeb4b6abb1b6abb1aba6aaaba6aaaaa5a9aba5a9ada7abafa9adab" + "a5a9a7a2a6a7a2a6aca8a5ada7a7ada7a7aea8a8ada7a7aba7a4ada9a6afaba8aba6a3b2" + "a9aab4abacb7aeafb9b1afb9b1afb9b1afb2aaa8b1a8a9b2a9aab2a6a8b0a4a6afa3a3ad" + "a1a1ada1a1a09496a79b9dafa3a5afa3a5aea4a5a09a9ea09b9f9f9a9e9e999d98939797" + "959a97959a9a989da5a0a6aaa1a6aca3a8b1a8adb5acafa9a0a1a49b9c9f9697aaa2a0a8" + "a09ea69c9da197989f95969d9394988e8f968c8d948a8b948a8b998f90978d8e998f909a" + "90919a9091998f90998f909a90919a9091998f90998f90938d8f928c8e938d8f918b8d8c" + "86888a84868983858983858b85878983858781838680808882828c878488838086817d88" + "837f817c787c7b777d7c787d7c787c7b777a79757978747978747d7c787a797573726d79" + "78737877727b7873888580817e79827d79847f7b8e86839189869b908c7b6e68392b2246" + "352b2e1b0d311c0b321b09361d09381e073d1b003d1b003b1b02391b033f230d3f230d3b" + "200b381f09371e0a3a1b063d1f073a1e06391d05381f09452e1c65524475615886736d79" + "6a65786b656f645e6a615a605953655e584a454127241f2524202d2e2943434346474248" + "47424b483f49453c4a433d49413e43393a3e31382d1b292c1a2827152125131f25141e26" + "151d27161c29181e2c1c1f3426253a2f2b3c312d3c312d4136303e332d3e342b3f352b41" + "372d453b3240362d362c23372d243f352c382e25433930463c3341372e40362c41372b52" + "483c5a504463594d766c60756b5f746a5e70665a6d635760564c5d5349554b414f453b4d" + "4339544a4060564c6b61576f655b877c78897e7c8e83819085839388868e83813f272340" + "2824462e2a45302d402c2d4030317f7075ada0a9aca0aaa197a2a79faaa59ea6a9a4aaac" + "a7ab918c908d888c8f8b8c9e98989f9795817577867b7f8680807574726968666d6b7099" + "98aa8c8ea7676d91545b87464e7f545e8f8794c08c9ab58c99a28d969b858a8d797c8585" + "858f89879282828e7e808d7f81908385948587947f818d8888927c7c867e7d8b7b7b8777" + "7a817b808480858b7e828b787a867978867c7a858382888382877c7b817b7a827c7a858a" + "88938e8d9593929a9e9da39a999f9d9ca29f9ea4a1a0a6a1a0a6a1a0a6a1a0a6a3a2a8a5" + "a4aaa6a5adadaab5adaab3aeabb2b1acb3afaab0a7a2a8aca7aeaea8b2a8a3aa9b999c9c" + "979da29ba2aaa0a8aba0a6ac9fa6b0a4a8b7abadbdb1b5b2a5acbdb0b7b7aab1baadb6bb" + "aeb7bcafb8b6a9b2b3a6afb2a5aeb3a6afb1a4adb0a3aab2a6aab7a8adb9aaafbaabb0b7" + "a8afafa0a7aa9da4ada7abaca6aaaaa4a8a9a3a7a59ea5a99fa7a49aa39f98a09e989c9b" + "998d9c97919e96939c96969d96a69b96aa9e9ab1a39eb4a09bb29b96aa8c899a827f9084" + "81948b889b8e899d8784958382927d818d828096827e99817d968780908d84878b838192" + "8889968d90938b88928a879791939b969a9c979d9a959b99979c9e9ca19e9da29e9e9ea3" + "a1a4b0a9b1aca5ada7a0a8aba1a9a49b9e958c8d817977877f7d7a72707e75767a71747b" + "71727c72737a70717a6e707b6f71776b6d7d6e73817577897f808e848592888990858991" + "868a94898d978c90988d91988d91948e92938d8d99918f99918f958c8d948b8e958c8f99" + "90939e9397968a8c938987928a87948e8e8d8988868489817d96787998696b84525a7f6d" + "759c878ea0888f9982858a75757372726a736f6c615e5746463e47464244433f4a47425d" + "5a5189867d918e878c8784928c8c989390948d859f988e5a52476b6155291d0f28180829" + "1605301907391e093818003b19003a1a01381a02341500331701341904341e09351f0a3c" + "1b083119002c1300301a0d3c2f3860555983767d766e7b746a606f625972655d70665d67" + "5d5b534a4b585252423d37211c181f181f2722293a393e454547484848464541504d4648" + "433d3f3a362c23241f141c2b19292c1a2a28162429172323121c26171e2b1c1f27191926" + "18181a0f09281e152c211b2c211b31241e35282236272035261f34251e3627243a2b2847" + "38354537343e302d453a36453a344439334c433a50473e4f453c51473e554b42594f4555" + "4b415d504861544c675851675a526b65556f69597a736d847c6f867e7192887e99907f9b" + "93889a94888c817b8f817e90827f8e837f8f8480807571442c22422a20402a1f422e2340" + "2d263e2c28655556a899a0a3969fa597a4ab9daaaba1a9a8a2a4a7a6a29897959997988e" + "878e9a9091a49495b298a1ad9ca4a0a0a09da6a19ca7a3949bab222f631127703459c32f" + "3db72d39bf4a5ce43451c912307868829391a3a3919692767482878090867b818d868e7a" + "788671708277768877768476737a7671757f797d8378888079817b7c777b8177868c8886" + "8a8b807e897e7685887e898f898b948e8e928b928e86938d85949f97a6a69ea9aba3aeb5" + "aeb5b2acb0aea8acada7abada7abafa9adafa9adada7abaaa4a8aaa4a8a9a4aaaea8b6ab" + "a6adaca8a9aea9a6aca7a1a5a09ca19b9dada7abada7a9a7a599a7a39aaba29db2a4a4ba" + "aaadb1a0a6b8a8abaca0a0ada3a4aca3a4a6a0a2a7a1a3a7a1a5a39ca3a49da4a39ca4a5" + "9ea5a49da4a59aaaa599a7a498a4a3989ea397999e92949f9095a5959faa9aa5a89ba5a5" + "a1a2a29da1a19aa1a298a0a399a4ab9fadada0b1aba0b0a7a1a5a5a98eacaa9da89f96b1" + "a8adada5d86e67aa7270bb6966ad6b67b45b5d984d578c525d93545f975b649d52589260" + "6ca05a6a9b547199526aaa596aba616ebc7076a6a7acb0b0b2adacacaeaeafb4adb3a5b6" + "baabb3b3b5b1aeb5b0adb8b0acbab5b3bea8a9aea9adaeaeb5ad9ca19ba39faea69fafaa" + "a3b5b6adbeb9afb7b2a9aca49a98a39997a298999a9496989296988f92978c90978b8f97" + "868c8b787e89767c86717a817275786c6c786c6e7c70747e7178786b7285787f7b6e7584" + "777e7f747c827883867e7c857c73827a6f887d798d7e818f808394858a98888b987f8295" + "847a8b8279908c899393958384992b297d313ca64456ac4157ce364ac70d1f5d39496d74" + "7a908787877a7464847a795f5549554e444b42434c4346524d4a5c5a4b8887758c8a7e8d" + "8787878087857f7f8d8f7a8f927f8488777579682c2d1d2922122519092812043e231238" + "19043818033b1b0639190241230b301400270c003a231136210e3714012116001000001c" + "0e1b2a35773948734647733b47813038237065517365585d54455a5051534b5a534b5643" + "3c362d222025132b21112c2925333634423d3b4847464c41423c333528292b201f1e1a23" + "1a1f230e1d2611202c1a2823131e24151c2115192419172a1f192920192d26163128192e" + "221625180f2f1e17321f1b3f27253e2624371d1c381f253f25303d263045303744343743" + "3437493e3c4c433e4b443c4c453f473d3e493f3e4f4543574c485f514e63515167535570" + "595f6f5d5d696d54696f536061636a695772705b82756d8b826389857a8687778b817785" + "766f90817a95888093867e857870442d1f432c1e422c1e422f20433022301f174e3f3c91" + "828793848ba4949fa898a3a79ba59f989fa2a19da7a6a29a9997958e95a096979d8e8996" + "80828b7e8871768a6876932b395c2431684156af4869d42a5ee6293ce01c2ddb3149f421" + "46dd2b51c0405a970718437d82989997ac807c8db0a4a89389918b87958482909694a297" + "949f938d91968d909d9296a296a4a0969f9c9b979ca2989ca09f9da1a4a09da8a69ba9ac" + "a1a7aaa29fb0a8a5b0a7aaaea4adafa5b0ada2b0aea4adaea4acada4a9afa6a9aea5a8ad" + "a4a7aaa1a4a79ea1a49b9ea79ea1aaa1a4a89fa2a89fa4ada7b3a7a2a8a29d9aa19c9899" + "958c9a938d9d9495a49ba0a49ea099968d96928992888698888b9a878d9c898f97888d99" + "8d8f988f90a19b9baba7a6b2aeafb1adaeada8acaaa5abaaa5abaca7adafaab0b2aab7b3" + "a8b6b3a9b2b2a9acb2aaa8b2a8a7b1a5a7b0a3aab0a3adaea3abb1adaab2acacafa9adaf" + "a6aba99ea6b0a4b0b4a8b6b4a8b6b0aaaeb4b7a2b9b5acb4aa9eb0a7a8867fc2413e9939" + "3ba84043ae2b2ca03642a43247a0435cb83c55b14054b32e41a04961bb5070c3416fbc13" + "399e2a43b73046b33d4c8d848e977f88857e8186818590828c838a9489898c9184848e83" + "82908584968385949195a08a8f956e79737a83809f9eaca6a4b2aba7b6a8a2b0b1aab2ad" + "a7ababa3a1aca2a0a79d9ba8a09ea8a09ea9a19faaa09fab9f9fa49598a19096a69399a8" + "949da8999ca39797a296989e929695888f9e91989e919a95889195888f938690988d9e91" + "888b918881938a819085818f80838c7d8287787b8774788c71767c6a60726d6962637549" + "4c6f393c73252aa23b4bdf2944c71b41d42748eb3e5bc13b55a2222d6b5d637976766a7f" + "797d89827080786d81777882777b847c7a8c89787b7a668280738b85878e878f8f898b8b" + "8a758f927d929783939884575848191202180a0038201434160b381907391a083a190637" + "17023e1f0a2e12002b1200311c092c19083611081e1d003b3132302a50344cb8243f9052" + "5aab5269c922332d5c5449645751524a3d52494c51485b4d455439322a291e1829153027" + "1434211d2c25223527263832323e26282720231a1d201520201e28232a2c1b2e28172a26" + "152722142120131c1f14181c12101b120920170e2d231932251c30231b2b1c1535231f45" + "302f3a22203319183017132b121532191d341e21422e30473738483a3a4c40404c42404b" + "443e4c453f534947584f4a5b524d5f544e6254516454546956587059616f5c5e66685266" + "6a5173727873705d706855816d6e8a7b5e857c77817d71867a6e99887ea19086988a7f85" + "776c7a6c61412a1c422b1d422c1e412e1f4330223b2a2248393687787b8f8087b1a1aba4" + "989ca497a99e93a4a49da49d99968b8784827d81837e7a847f6c655e4c71717d39457f3d" + "49af404bbe2f38b73d52d23e61e12d66e72337e41d32db3552ee234cd82c4fdf2939ca25" + "2db2494b9e7075929fa3afaaa3aaa9a2aaaba6ada09da4a7a4aba9a4aa9d979ba69da2aa" + "9fa7a59aaaa29aa79f9ca3a0a0a89f9fab9e9daba09caaa29ba29f9795a8a39daba79ea7" + "a29ea39d9da39d9fa6a0a4a49ea0a29c9e9c96969c9394a09798a198999d9495988f9099" + "90919c93949b92939087888d84878e878e8d87898b85858a8582948f8c9990939e949c9b" + "919a9e96a19b969d979299968c959c8f999f8f9aa999a49c9199a59ba3a59fa3a4a0a1b0" + "acabb2aeafb2aeafb4b0b1afaaaeada8acada8acb1acb0afaaaeafa9abafa9a9b0aba7b1" + "aca6b0aba5aea9a5afa7a5aea5a6aca4a2afaaa6b2aaa7afa7a5ada3a2b1a7a6b2a8a9af" + "a6a7aba2a3a59c9fa7a0a8afa2acb1a694aba5975b5b99373a992e37b63641c13441cd2e" + "45c92a4cca3960df274ecf2144c62442c62d50ce365fdb386fe42c50da2a42ca3448c149" + "579e6975857d878971767c717485676d796a717b6a737c686e7a6f758574798d868b9f8d" + "94a7757c8e39434f3f49527d848a8e9396a6aaa9b2b4b3a7a5a8a8a6abafa9adaea6a3a3" + "9c92a29a8fa39b90a49c91a49b92a59c95a89e9ca19798a0979a9c93989f93959f9395a1" + "9597a79b9da69a9ea69a9ea0939aa3969da19599a296a09a90a9948c99968d90988f909e" + "93979c91959a8f93978d8e98898c8b7581a095936d6f7e8085c73c419f2c339d2d37bd2c" + "40df1a34d33164e31948e03b62ed2a4dcf1e34ae374989616f725a636c6e75637670647e" + "76747f76777e7673827e72686556716d62817b7b8f888f948b8e978e7f999282948d7d9c" + "9384807466372416230b003a191039170d371a0a3a1d0d3718043617033c1d092e120032" + "19052b16052613042f100e262813554f69393477233ec12743b14b56cc4055d416244950" + "4c5a594f5a4c483f4f4a47524a57473f4a2d261c20180b2216222015261e1c271c192a1a" + "172a2322321c1d221b1b191a1a181f1e23252130241b362218331a10281c11221b111c1e" + "131b1b0f0f1a0f0b24191338272f3c2a363e2d353d2c3247373a412f2f33221b2a191130" + "20133a2d1a3d321c3d321e463a2c4e4138453a344b403e4f4343544a4b584d4959513c61" + "59466158475f5848655d52675e556a5f596d625e716362776966786c6085757f85736781" + "6b608a6a7991746c8d767e8a787687766c8a786c7c6a5e7262556b5b4e7060533f281a41" + "2a1c422b1d412b1d422f213c2a203f2d2b726265796a6fa899a0a49a9ba79aaea597b0a9" + "9eaeb0a7aaa7a29f96928f8a8984979b8d8a92855564835163c53746dd2531d53844e82b" + "43d92247d4235ce12f45f02f48e34465f22c59d82549e51727df292fe52429a9101c583a" + "44689897a7a5a2ad948f959793949b96939c93948d8487968d92968c948f8a918d888f89" + "8691898795918e9f908e9c918e95908d888381758d8882908b878d88848a84848b858597" + "91939a9496999395958f919e9596a39a9ba69d9ea79e9fa49b9ca2999aa79e9fafa6a7ae" + "a5a6ada4a5b2acacb5afafb5afafb4aeb0ada7abafa5aeafa5b0a59aa8a9a1b0aca8b7ac" + "a5b5ada2b0b1a5afab9ea7b2a7ada9a0a5a5a0a4a8a6a9a6a2a3a5a1a0989495989495a3" + "9f9ea29e9d9b97969894939b97969c98979c98979b9a989f9e9aa3a29ea1a09ca1a09ca6" + "a2a1a7a3a2a6a29faaa29faea6a3aaa29fa79d9ba69d98a39a959d969099928c91888b9c" + "8ca9a592a8a89b88a6a390383d7f373faa2335c5384edf3a51ed354fea3354ed365ef429" + "51e72043db2f4ce6294be22149de2e62f3294ce83349db3d51d44654ac575f8d4c537049" + "4b607a7d90858b9b858d9a7e8b917d879086909c8d96a58d96a79199ac929aad979fb29b" + "a7b7919ca0939d9e959f969ca39ca4a5aaa7a5b0aea8b4a7a1a59c958f998e889a8d8796" + "8b85948b84928b858984818c8b87939290989898938a8b817577796d6f75696b786c6e7d" + "71757a6e72928688938789988d938f8796958e96948e90948b8e938a8f948b90938d8f94" + "8e8e978e8f90828f908b928891ba3c47b1424ddb323ed22536ca3049ee2c47f82a5ae028" + "55f0355ef6294ee5344de53a4eaf5b6a8b787e9e6b6e67706c61776f6c766e6b79716e74" + "7067827e737d797077726f746e72766d708a7c799f908b9e8d85aa99919a867d61463f30" + "130d34121035140f371d0e3a1e103215033518063a1d0b2d1200351e0c28150629180843" + "282d5256475b59885050aa2641d62f4cd43843d91e34c80b196236326538315b3b383f53" + "4e4a534d51433a3f241d131b170c251d2a231c2c201f241f1d2b201d30221f3227253221" + "20251d1c2116141f1310211817291d1a2d19152616101c1f151e20151d1d0e111e0e0f26" + "16162e1928331c2e37212d39252e423233392c26393021342b1a38301b403d1e423f1e42" + "3f20433d25473e2f493f354d423e514547594a4f5c4e4d5c513b625a47615946615a4a6a" + "64566b68596d6a5b6f6c5b776d63866d7186726b81686c8f7564997b70a0798b95737287" + "6973826869736052614e3f4f3c2d4e3b2c564334564334412a1c422b1d432c1c432d1f43" + "30223b291f3b292562525366555b9c9094a19899a497a8ac9ab4ab99b39d909a9e95968a" + "8a7e7b807a6f7c8561768b3f5a9f314bd34c61ff475bff2338e32845de1d42d81f56e738" + "52ed415fe53c63dc2052c33860f3162ce42330f01a26c83748be5e6ec68b91b18b8ca09a" + "989d7e7976968d84948983897f808f868b8b848b8c8d858b8c878a888d8e889499939f99" + "949b9c9b969ca08991937d999691a09a9ea29ca0a6a0a4a8a2a6aaa3aaaea7afaea6b1ac" + "a4b1afa6a9b2a8a9b4aaabb7adaeb8aeafb4aaabb5abacb5abacb3a9aab2aaa8aca7a1aa" + "a5a2a59fa1a29ca0aaa3aba69eaba39ba8978f9c9e96a59e97a79e96a59b919a968d8e98" + "8f8a968f8997948f8685808f8f8d999896989493888483878382928e8b96928f8f8b888b" + "87848d89869997989a989b9a9a9ca1a0a5a6a5aba9a8aea8a7ada9aaaea7a8aca8a6a9b3" + "a9aab6acadb3a9a8afa7a5a69e9ba69f99aba49caba49ca89da3b29cc3b9a2bfac9f8ea8" + "a697323b8a3745c00f28cb3759f81a37dd2c41e83248ec2f4bec3351f1374fef3042e436" + "49ed2a43e5284eed3755f35a73ff485ce30000730003620a0b5b0d0e3a7073828b909483" + "8d8e8595947c8c8b7c8c8c7f8f8f91a0a582909986929e95a1b18893a58596a089989d90" + "9f9aa1abaaa5a8b7a7a8bcaca8c1a69fafa298a1a696a3a593a19f929c9c909a9790978e" + "8c8d92948f979c969ca39b9d97978a80817f7576796f707b7170796f707a7071968c8b98" + "8e8d9d948f948e82979387969289948f898f8a878d87898b87888985848783808f8a9071" + "74872031771d33bd3a4dff2a3ff21b33d53c58ff2745ff1a36e2354ffc304ee03352de3d" + "53e73741bd100f5d3d33788c7d9089817e85807a827d7789847e8179768e868388817980" + "7b777f797b7f797d8e828e9f8f999c898dab9597b09697785b5f2f121632131b26090d36" + "1e12391e13301406361b0a361b0a2b1100331e0d2e1d0d342214543f446e7766383c7b5b" + "61cf3858f82344dd3643f1243bdf010e740b046b0a015c221d3b524d47514a4441373523" + "1c141d191a27233e27233c1a1a1a1e1c292421341f1b322b273825232e211f2a1513200d" + "0d191721191c231c181a151716121e18181f15161b0c0f1e0b111e0b1128111b2c151d2f" + "191c331f1e3729203d3423403c233d391e3b3a1b3e3f1f40412148482c4a452f4d453852" + "483e56484554454857464e59494c61544c685b55665b556a615a6b65596e6d5970705870" + "74537b775e886b6d8a6f64876b60987d5fa4866ea37e8582615c6547495e433c4f382649" + "341f4f3a25503b2648331e49341f473022452e20432c1c463120463022402e2242312a5c" + "4c4d5a4a4d998d919a94949e919ba996aaa991b19d8c9c9b9094939685757e834a5b8923" + "3f88385ac82042d70c2ad62540f12843ec2a49e2173cd22b5eef1f38d24663ef2c51d510" + "40bc3a65f23f5bff2035e61e33da2843d21b34aa00093fa2a6c9a19ea9aba2a3ab9f93a7" + "998ea39797a1989d9c979b9c9f8e9b9d929e9a9ba59ba4a99ea6a89fa2a7a599a1a58a99" + "9d84a8a39faca3a6aaa1a2aaa2a0aca4a2ada4a5ada4a9aba1a9a79da6a3989ca3999aa3" + "999aa29899a29899a3999aa096979a9091998f9098908e9f9b929e99959c969a9b949c9b" + "939e99919e968e99908a94938b9692899a928a97948b90938c869d968c989286a09d948e" + "8d889797959a9899a29e9f9e9a999b97969d9996a3a09ba09d989d9a95a09d98aaa9a5a9" + "a8a6a8a8a8aeadb2b4b3b9b3b3bbb0b1b6abafb2a5a9aaa5a5a7b1a4abb2a7adafa6a9ad" + "a4a7a9a3a3a7a1a1afaaa7b1aca9aea4acbaa6c9beaac5b0a498a9a9a72f3998394bd519" + "39e62e55f81e41e7243de22b43e52644e02d4ee73a53ed293cd82e42df2b43e12f52ee16" + "33d7465ef2394fd900007e03027a04016a04043a6f7281797e8269717472858170837f6f" + "827c70837d788b8778878a7c8991858e9d818c9e889aa48c9ea28b9b98879393a4a8b4a7" + "a8baadaabfaca8b7b1a7b2b09fafb09eaeac9eabaa9eaaa69fa6a8a6a7a0a39c9fa59b9b" + "a396a09a9a9b9094988e8f968c8b9389889288879288879f9593a29896a59c93a09c8398" + "938097908698918b99949198929296929193928e92918ca1a5a6838baf445bbb2643dc28" + "44ff2742ff213ee22f4ff01d3af0273ced2b43ee2242d53253e03b56ed2836bd4242a40e" + "065c6a5a81867c8487827c837f768a867d817879837a7b857e788b847c918b8b938d9199" + "939f9389918d7d7e9b8987a6918c9179773e29281b0709281416301c11321c112e170935" + "1b0c3117062811002e1b0a3b2b1c413124614f4f69765c121a63454fca395bfa163ad83b" + "4bff233bdb000476020078000067201c3f514e3f4c4334493f362c251d1a18191b192f17" + "182c1515131715221d1a2d1a142e2823372c28362c2a3529273224242c222b1a1c221410" + "140613130917100a170d0b1e0e1127131c28131c30171b341a19331b1735211a31241437" + "2c18352f173531183c381d42402b43402d4c49384b45374f473c4d433a5547445b4b4c62" + "4f55635356625658685c606a5e627064686e6462726f6072715c7074537c785b886f6b8b" + "71629c816e9d8360987e5d795a55593d3144282441261b442b154028104a321a4b331b3d" + "250d432b134a3021452b1c402919463120432d1f3b291d3c2b244535353d2d2e84787c9e" + "989c9c918fa4939baa91af9f8ca0978c909ba2904d5c733749ad2743d21f47dd3a64ec1b" + "42cb456af71633cd3554ed2043d52d5adb1329cd4057ff1e3de51b43e01d45d8496af73d" + "5cea3354df2e55de2549c43f4fa4000035aeaac3c0b9c1b2a499ac9c8fb1a6a4a89fa2a4" + "9fa39b9e8d9c9a8e9d9495a2939a9f8f929f9190999288908f7d8d8e7e928b819289808c" + "84798a83738b8474928b7b928a7f918881908684978d8e999091999091978e8f938a8b90" + "8788938a8ba09798aea5a6b1a9a7a6a299a7a29faaa4a8aba6ada9a3adaba6ada9a4a8a9" + "a7a8a39fa0a89dada89ea9aea4a5b6afa7b3ada1b1aaa0afaca5aaa9a7adabaea4a2a5a8" + "a6a7aaa9a7a8a7a5a6a5a0a6a5a0a6a5a0a2a19ca5a4a0aaa89ba6a497a2a298a3a29ea6" + "a6a4a3a3a3a1a3a0a0a59f9ca2989c9d979f929c9f939d9b949c9a939b959097908b9296" + "919898939a938c94a9a1aeada0b1aba3a0a1a4b52632a02a3bcf2a4bf81944e12e56f324" + "49df254ede2554de1f4fd72a54da2446ce2b4ad62347d32d58e21f3ae93148e4263bc800" + "028300007002016911114382859487889c767b8e7483867d8d8c80938d80938d73847e7a" + "888979868c757d8a767f8e7185847e918f90a09d95a19d9ca2a0a1a5a4ababadafaab0b7" + "aeb3b0a4a6b0a2a2aa9e9ea89e9da39e9a9c99929b9b8fa2a296a9ac9ba59d9b988d918f" + "85867f7574736967847a78867c7a877d7b998f8d9c938aa39b86999184978d8c988e8f96" + "8d90978f8d96918d97948f96968c757d7f313c742b45c01339cc1135e31a3aed2b49e92c" + "4ade2d49eb2442d4284be3305bf52351ec224eeb1437b94f62c000004e140f49746f838b" + "8883868478888479867b8190858d8b817f837c727d7875797876818a8583857a8b857598" + "917e90866d9e937d6159440f090027211528160c2c180f311b0e2f180a2f18082c150531" + "1e0f4f3f305141346f615864704a26327e3442bf3357eb183dd43b4ffc1e38c300016c08" + "047c0a056b2e2c41534f324f442e5244373a30262522191f20221c202123252019172418" + "13272017322e27393532393b393e3e3d423c3c3e2e2e26222218141108140d05160b071b" + "0d0c251516311e24352228341b17361e14301a0d301d0f2816082b1b0e2b1d1230231a39" + "2c2435292b34282c3c30323f31314a3c3b4d3f3c5849466252526959596b5d5d6459616c" + "5e6b70626f7261717767727c70707a716a766f5d7d77618e7c708e7b6a957f68826b4974" + "603d46341e382811352116392316442c143b2106391f043b2106391f04341a00492f2041" + "27183d2314442d1d3e281a422f21402d263c2a282d1d1d7a6b70a6a0a49e938fa59294af" + "97ada392a29c9398a3acab24336a3e52d72747f22c57fe3a64ee3158d72043c51e3ac943" + "5fef2643cd264ac43344e93b4eff142edd3657fe0e31cd2c4cdf2c4cdd1e45d12554e03a" + "64ec1f33a6010b602e2b56a8a0b79f928c97897ca59a96968d8e938e92918f838e89838a" + "7e828b787e8a76788c7a788a7f7b8680808e8a8b8f8681948a80968c809b92819e96839f" + "9685a2988ca59b91aa9f99a8a09eb1a8a9b3adadb1ababaaa4a4a7a1a1aaa1a2ada4a5b0" + "a7a8afaaa7b1aca6aca8a7aba6acaba6ada9a6adafadb0acada7b1b2aaa09f9aa89caaa4" + "98a2a3989cada5a2aba49eafa7a49f999ba8a3aa9e9ba4a5a2a99b9b9d98989899999799" + "9a9494958f9495908e8f8a8e8e8c9694888f8d818b887f8786828888888888888b8b8b93" + "95909699929697929489919089918d8a938d8a938d8c948a88939894a29d99a79a979ea3" + "a5a0a1a0a6a8a6ab969bb93e4bbb2336c33555f52048dd2e53ec224bdb2452dc3064eb1a" + "4fd32655d72247cb4062e7294ed21e4bcc243eeb374ce5273bc200007605067a00006317" + "1a4784889483839b7577906f7b877a878f7b8b8b7888877484817a88897e898f7f85937b" + "8390889a9a909fa293a0a8919a9f9499939b9e95a6a69eaaa6a7b2a9aeb2a9a2aea69ba6" + "9d96a29b959e9694a098969c9492a19997a69e9ba99ea2958a8e8b818282787780767476" + "6d687d746f7d7371a19796a79e999f928a9f93959b8d9a988a999b90989a908f9a918c97" + "908a94918a5c6779444fa13a55e42953e3244cea1c3fe33550e52d47cf2038cc3251ce29" + "4fd62e5cf8093ddf2a60ff1745cc4461c74051ad00004a676384908f8d8d8b7f8783778d" + "828a827682837977837d71817c797e7d7b869288878e7e8786718a866d8e896b9490737a" + "795d22260f12130321100828150e331f142b1406321b0b311c0b3724155e4e3f5c4c3f64" + "5649555d344854a62839bb294cda1f45d43d55f5374dc50005670000630200582f2f3b4f" + "4b2e56483b4e3c3c4436353b372b3f4134404338393b3823212e1a15292b233b352d3c3e" + "3a3b41403c43443f403e3f392c3631242d25191d1a0c0c2212122717172d1b1b2b181a31" + "1e20452c28462d263e261c3e281d321b132e1914321d1c372123341f26301a262e18253c" + "2730483539604e4e5c4a4862534e64555063544f615652685f6072676f786b7576637683" + "6c7e89737f8673797f6d6b83756c9184749483737a6051574227513e20382a0d31250b35" + "2214382119381c064123074123073f24064227093c210345291b40241641271848311f40" + "2b1a402d1e3f2d2333211d3f2d2b6b5d5dada7a9a59797a69697b3a0a6a89da39f9aa168" + "71923a4aa9364fe72c52f3143ee03b5ef8334fdf344fdc4b63e73047c7364bca1d30b033" + "3ed63f4fea3449e02946df1f39e4263af91f33f42448f81446dd3664f8192fc12430a00b" + "0b4b312a53ac9fa6aea199a29994a9a19fa09c9da49b9c9a8f95a997a3ae99a2b19b9dad" + "999aa99aa1a89ab1aa9db7a497a1aa9c9ba89a97ab9e98a89b93b2a59fa99b98ad9f9caf" + "a1a0a49b9ca09a9c979394999596918d8e9f9b9ca49ea0918b8d9791939591928b87888c" + "8a8d8f8d92908d9491919386888384887a878b7a8d8f829c909e8c808c857b83877e8391" + "8a91928b93a29aa9a79eb39e96ab95939e9d9ea2a6a8a7a7a9a6a7a9a4aaaca7a5a7a4a5" + "a7a6aeafb1b1afb0bab5b9b0abb1adaab3b6b3beb9b6c1b9b6c1aaa9b1b0afb5a7a6abbc" + "b6b6afadaeaaabada5a9acadb2b6adb0b79f9fab9896a3909495899b85929c9b9094a085" + "8eaf3746a54257ce2d4bcf2747ce2b48e44668ff1f47da1846d71f4edc2e54e33551e02b" + "45d03f5be31335ba2b41e44558e24053cc040e7d0000660304613d4069a3a7b09a9baf82" + "849d7c809b787e947e8a9684919a818e947c868f777f8a8e91a283869785939e6e798d6a" + "70908488a18b8c8e9899919e9c90a69fa7aaa2b19d998ea5a291b2aea5a49c9aa498a2af" + "a1b2b4a1b7b39fb8b59eb8b6a8b5ada4a7a59c9daca4a2a39c96a19a94928a879e9694a5" + "9c9da1969abcaabab3a0bcb6a2c5a895b5b5a4b4b5aaa8a59a94a69c93b0aaac00083f31" + "3baa2a44e11d46d21c42d12848d93c55d63346bf3343ca4d64d83150cd2752ee0938de19" + "4ef23361f22a47bf4759c506096a0d093c8d8b90939185827f709387918c7e8d93888690" + "8a7c847e7e817f82848b848d908584827387826f89836da39e8a9695815a5d4c07080027" + "18112817102713083721132e180a2c16082f1c0d4e3e2f5545385e5141494a284f58b728" + "37c43655e1385ce42841d23c50b300065e00005707064c34343e51493e5d4b59513a5654" + "41554f48404e4d383d402d3c3e3d3a3845373344231a2d140a1219160f1b1b0f3133252b" + "27262c10362b10332208212f19263823282c181a210f0b35231f34221e31181c23080d34" + "1a1d472a2c5033354a2d3243252f4828355433465838455d3e4660434758403e64504965" + "524b61534a64574f72655d6c64596c6b59766f67796b6a7f6a737d61709c7d8f8a6b7ba6" + "8796a2898d7563555e473f462520381a103d231432250536280e3d25193b1c1a41210c41" + "22054021043f22023e21013e2101432719402416402617452e1c412a1a3e281a3d2b1f33" + "221b3927235446439f9594ad9da7ad9ca4a798939b9595abaaba434b943445c92946e232" + "5cf02d54ed1730d24e5efb4252e62e41c200007300038100008200008e00008500008019" + "30b0384ae84b58ff3a48ff2848fd1245dc2453eb2b42ea3d4bd000004a11104aa299aea5" + "9b9ab4aca9b3aeaaaaa4a4b2a8a9a79ca2b1a1abbba8ac9c8b84aa9992a39497a697b4a6" + "96baa69aa8a5999d968a8e998d919d92968f84888d838484787a9b8f91908c8d8c8a8d86" + "84858684858a8889918f909694978a888b939194918f92928f9694939999989e9a999e9c" + "9d9f8a918a878f808f98859fa597a69fa6b6afb6afaab0b0aeb3b7b4bdaaa4aea39dabb9" + "b0c3b0a9bbb3b3bfb0b5b9b0b6b6afb5b3aeb4b0afb5b1a7adada5aaada1a6acacaab7ab" + "a9b7a19fad94929f94929f918f9c94929f9492a09492a09c9aa58d8f8a858b8787928e82" + "8d89707c7a899394989da18c8f96939c9778947b81959377808f75819b3243894458b148" + "63ca2b41bb3747e5374fe73756ee355af13055ec3853ec4453ec2f3aca4552de3649cc44" + "56e03748bc24359d00026705086f050660565a80a0a5a9a0a3ac9698a78586a27d829874" + "7d8c717d89808f967a848d7d868f8084908a8e9a7c8898757c986f729b6c6f8e85868a85" + "867e99998d9e98a4a79fb4bcbbb6b2b2a69f9b9a9b95998f8293917f979e87a3a58caab0" + "96b3a193a0a2999e968d8e9d95929089838e87819a928fa2999a8c83889a8f95a898a3a4" + "92acae9bbba693afa0909bac9f99a69991b2a4a19c93a8434cab4750d9213add385eed2a" + "4bd64e6af100006a06128000007500006c3548be4260f6264ae9416aff2c4ff13448db49" + "53d608057a0000428583908c8c848e88789688959385968f84828f8878857f8187828882" + "817d8f8c878f8880887f768e847a918b7f837f737674682a271e1e0f0a1f0e072f1b1233" + "1d10362012311b0d2e1b0c4634264b392b53433649422f4c52c23744de3650e13052d841" + "59e14757ae00025308075705034234343e4642394536494d38574c3b4e4a413c4b483544" + "42333a3b3f3a37423b34442c212f2319181c180c1c1a0b151807302c2b25062824032223" + "061c290f182c1316230e0b220e07321f18301d172f141b280a143c1f243d20244d2f2f49" + "2b2d3f20253b1a23452331513134593a3860433d6a524676635462514165574a6c5f5674" + "6a616e665b6c6b576f675a766961846c6c8e6f7594707a9e7a84a07f88886b6d513c2946" + "2921441d1638120f3a1a0f3c2c0a37260c4423104318114321084021023f20013f20013e" + "1f003e1f00412517402416402615432c1a422b193c27163c2a1c36251d36251e3c2e2589" + "7e78b5a3b9ab9aada29a8f9c9e9d686d8b3e47be1829ce2645dd436bee486cf43949e732" + "38d8242bc400078d00038507068e01008e09028e02077c00046d000a6900006a434de333" + "3fe11c3ad82d5ee91545d7324bff2e40d200076c0c0f5c3a365b8f89938f89897f7b7892" + "8d8790887d867d78847a7b8c837c9b957f9b957d8f897b9286947e718b847c878e878e98" + "909b928a99908a989e98a4a19ca2aba5a7a49f9cafafb1aeadb2adadafa3a3a5a9a9abad" + "adafb0afb4a4a3a8a8a7aca4a3a9a9a7b4a7a7b1a3a6aba3a7aa929898a3aea8a1ada39b" + "a79d97a1969a9b958e908b7f83828b8f907c808386878b99989d9290938f8d92878b9483" + "8a92828a8d848c8e87908d81898b8a91979097a1959ba99092a79496ab989bac999ba79c" + "9fa89699a094949e9594a49b9aac878996929d998a99948a9d9781948e94a89f8d9c9588" + "938d9298949ba79d88a99893acb08a98a397a6ad7c90b3849acc7a91d70a16820306a300" + "039c4252ed293ddc172bcc2834d63230cf00008b07008a00007600036900045900015400" + "005301046300004c7578a1a5aaad9499928e938d81818d747b8389969c8a999e8d9fa186" + "96968795958b95968f979a949dae8d93ab8f94b48c91a78b8f908d90899a9b93a19faaa1" + "9eb3a6a6aea8a9aea4a2adb8b4c2b5acbdb0a2b3ab99a7ab97a3a8939c988d959f969b93" + "8a8b99918e8c857f9c9491857c7d9d9499918792a39a9da19a87a39997a398a09f9299a8" + "9d97ada397998f859b8c91867aac4f57e63543e11d39db3f60fb0821b23a4dd000056700" + "0063100d8e190e900000702c35be2634c8172dd02d3bf34d4dff4c48e30b00840400587b" + "799190908e9c9784998c969c8b9d988a87999280918a91938992978986928483998b8b91" + "8285938585998d8d8e8381887d7941363023140f1f0e0737231a2d170a392212331e0d2a" + "17063c2b1b3f2e1e4c3b34493a3f3b3fc4333feb1e35d3203fcd4c65e639459700005002" + "005400003b2d313a2b2e1d3e3a39453b4342393a463f3549413e4c48473c3d413c394240" + "384532272f221711140e001b180924261b181411150000130000230c042911052d16082b" + "1508331d123e26223d252333151d3011174022202e110b3b2114351b0c42281b452e204b" + "33293c251748311f4c36214c3a223d2d1447371e554837695d517366606d645f75726b7a" + "6f69796b628f776da0827777574a8e6e615e4234371d0c3b21083918074d1e0a48190f46" + "1f10371f00341b004d2200521c00441f023f20033e1f023e1f023d1e013f200342261842" + "2618432817442a19442d1b402b1a402d1e3d2b213928203120167a6b64b4a4bea294ada5" + "a4a0959caf010a435560f8475aff2241d7375de43d5adc242db600008106079500008c00" + "008806008810008607006907085802094f07124a0005485c62c44953c4344ed62d5aeb23" + "4eeb3550ff4a5ff84956c60000540002359a98ae98969b88848597948d9d978999948e93" + "90979b9d9ca3a894989e84a0a28c9c9696a29caaa6a6a8999da0a2a4b19c9db19798ad96" + "97a99da0a99a9ea1999e97a4a8a9a4a7aca9acb1a0a3a89fa2a796999e999ca18f929791" + "94998c8f968c8e9d8a8c98878c92868b8f8993947782847d8a90828f957c898f7b878385" + "91918f9ca2818e97939da68b969c889092979c969597928e959d8d97a08f9a9e909b9d93" + "9f9f929da1949ea8939cab8f97ac8b95b08d98ae939faf949fa3939d9c909b97a5adaf96" + "9aa59699ac9297aa93a3b292a6b18ba4a9829ea18ca6a3899e97909f989ca79f89968c82" + "a39c8ca4b08a99a09aa9a28ea1af8da1bc8597c700075f0000840000824c5ef0243bd61c" + "30cf222ed03531ce06008707007d04026d00004b00084c020c51030b5302074b0509467f" + "84a48b90968d928b9499929596988c96988e9da4879aa18b9faa899da685989f96a5ac89" + "949a8390998a949e9ba5af86919388918e919a958b91919498a38c8f9ea4a8b1a7aab1a0" + "a0aca8a6b4a39fadaea7afa89fa0a9a19eaba299a39a9da2999e9f9697a0989598908d9d" + "95928e85889a9099928798918b8f989b7ca5a5999995929994908c8676a39e8b9e968b96" + "88973c31762331dc2b3ee32240dc2e4cea384ada00007505096406056305007210016a12" + "0c643e3fbd2d34c21f2dcb1e29dd5858ff4241db1008910e05725c5a7f96959a9d988599" + "89949c8a9aa0938b99927f938b968c808e95827ea393969d919b8a808b8a828f918a928d" + "838b84787a70625f2e1f1a22110a3622192f190b351e0e30190928130237241339261744" + "322e4a374b2f34c42332e71429d21636c9405cd70e196800004f0c0a5e00003b27313a2c" + "3a23424b3a33392b373a253e3d293e383849444a393a3e3c39404039412d21231d130a23" + "1b10130f0618181a1f1e231e1003160900190a001604001e0900220b002d120733151334" + "16164623274a282754362e43271b462f1d3e2c182d1d0d322417372a223b2e2641342b35" + "291b483d29443822382c164e41316a5c53786966776969776e738476758b7872967f71b0" + "95806e563e7a644c3e2c1637281346311e4424174f22034112083c160b442c1445291b4f" + "2300531d00451e003e1f033e1f033d1e013d1e0140210444271946291b462b1a442b1745" + "2f1a432e1b402d1e402e223d2b213120186c5a58a99aada299ae999aac030d48414eae1c" + "2ad5182fe13f61f82141e14d64e600005f02026404017200008e0d049b0a00841d09683e" + "35627777939092ab9096a6757984191e3c0001374d62d53656ff1c3ef5203ce53e56ea59" + "6ce2000264010a4b6c7093a9a7b4a9a7ac94918c98988e9c9ba09b9fba9ba7bf97aaa89f" + "b1a3a5b1999ea093b3b5b29faaa2a3b3b298a6b396a2bc939eba838fa78d9ba48c9c9b7d" + "8f817a8284767b817b80867e83897b8086777c827f848a7d8288868b918286917d80937d" + "838f7f888d80898e768389808d9d707e996d7a9a7889a77b92a26a80958ba0bd849bba78" + "8ca78496ac909fa68a978e95a09897a2a897a3af97a4ac95a2a8909ea1919ea78f9aac89" + "94aa818aa9798caa7b92a47c949e7b948e79907e7085726c7e707984867c8692808aa37e" + "8fc3849bc77794b47696af7c9ca9819a9f92a2a18594918b9a957692967b8e9f7c87897f" + "8c7a8190957687976d7d9e070f4d040874000d7e345cd8143dc9224add112ec72635c400" + "057a000168000e5b060f5000064400033d00093200071d0001128990a2adb3c39a9eaa95" + "989f9195948691977b8e9f859bb37c95b4859dbf8ba2c28a9dbb97a7be8f9f9e91a3978a" + "a1848ba2858fa09690a0a08a98a388979e939f9d9ea8a0a2a7a3aaaeaf9fa3a6a9aeb19a" + "a09e97a19699a4949ba791a7a3a2a09a9ea6a0a09d98949a9591847f7c9a9498817988a5" + "9bb3aba8b388967f97a09b8a8f92999e9aa1a493a1a290a19e95a096ae1911661a30e542" + "60ff264adc2741dc4b59e000006f09065d120c620200590f0e3a50557d4148bc2934c21a" + "2ec5243bd75364fc2135b200007b06007c29265592929c948f7b9787919684949c8f868d" + "86738f8796857a8b9485808f868b82818f7e83968a90a67f8497878a997c7a7f796f6e38" + "29242c1b142f1b1238221433190a2f1504271000341f0c331e0d352820473253333dd322" + "36ef2a3ff01e40d73d5ed2000049000053070a590000371b2e352d472e274124243c1c32" + "4517333e16302d263937382f30323b363a3d3739271c18271a111e14121c161a16122b00" + "001a15180d0d0f021211001a12001504001b06002406002a03042d06093c13114620174d" + "2d204b2f214332223f362d3533343233383235443d425842445b383a494b4b4d47423c56" + "4d46685b527d6a64846f6c8571737866768974799b8685957e708e79648c7d68978c7a3d" + "3b2f11120d2f242834201f4727013e19113c1e202d1c22442d3d482300532200451f003e" + "1e053e1e053d1e023d1e023e1f0345281a472a1c472c1b452c18442e19432e1b3e2b1a40" + "2e203e2c2035221c5c454b94878ea8a2ac797ca93e47b05864ec2839e91a35dc2e50e51e" + "3cd84356d600045c13106902006300007c0300770e066b7665999b91999b969c97949d99" + "979caaa79e8e8f8a676a7b3242a13c56ff2844fd2542de1833c0324bc12c43ab00004a17" + "204b85869a8e8c9787838481808e7a7d9c7e86c5677abc6d87ac7691a4768983929c937c" + "81847d8f9b5b738f0b204f3143814052921225600b214a2b435f58737e808d957d848c77" + "80877c858c7982897f888f8b929a858c948c939b8a909c868b9e838b96808b917f8a9088" + "96a172809b7e8aba7481b83b4d8b16336b001d593f5a9f00155b233c7c3e558b687b9b66" + "777f6e7e7e6e7c8773818e77858e73848b6f80876e7e8b75849b7c87a37982a9738cc277" + "96c4708eb272929f708e8c829a9a80949b76869f535f8719245c2d409e324b9d1b3a7b1d" + "3d767092b786a0b78ea0ac7c8b9297a4aa889ea98897aa929b9a9099848a949d8491a490" + "9eb88088ac8c95e00422844572e91745ce2855e62c4ee52e41cc00097700005c0005428c" + "94c3898dbd888cbb959cb6919d9b8e9a96a2aab78a8ea79093a4969aa69aa0ae838eaa56" + "68982f457e1e367c233d88374f991c307753639f98a9bba0b4b397b28fa9c3a69aafc08a" + "9cc295a4dd899bc1a3b6bd8d9691949993b0b5bb999faba5adc49aa8c29cadc794a8c083" + "98ad8e8e98a39d9fa8a2a29994909893908c86869d969e867d909288a3908ba994a3c091" + "9dc5868eb3a1a8c28e94929fa599989a959791ab4c4da02d4efb365ef3305ae22f4bda00" + "007000005f060058000042060443605f6f6264702d3188454bbb3c4ebe3147c1495ede1c" + "329f000b8700008005023b9493a195907a9e8f96968190988a7f948c79978b9f998eac7d" + "758d4c4e74121e5011245c4d639f04174f0c1c4f51567e827e954f40394d3c35321e1336" + "1f113319083017032a11003019072b14022b22113925483846da2640f52f48fa294fe248" + "6ed900004500025300004a0b155a2f456a1c3b5027465829474f415b423140232929272c" + "2c2e2a2c293b37363d38352d201a25181011060c1e15260d05341110490513360003230f" + "14281e18221c0c0c240c0a2b08062f03043305072f00003306002c09052c100d24151a1f" + "1c310c143b030f3f3b4b893e4f952f3e830c1950393f63706f81746e787f717187726d85" + "6965876b6a8d76809d858597807a8f796ca6958bafa9ababa9b45b627f1b274f25275029" + "233d352408311a243623411f184b3c2e6c3b1f074822004321003f1f083e1e073e1e053d" + "1d043b1b0245281a46291b462b1a442b17402a15412c173f2c1b402e203e2c2038232249" + "2e3f80766aa5a29d5b5fa93d43df3541ef253de51535c84e6ffa2648c600067f00007200" + "006005006801035a373c7463628a8a7e8a776a64796d777d708282748d8b7c819e9791a1" + "a0a647559c435dee1d39d8405de92f4dd12441b64762cd000556010d418688a1888694a1" + "9ba94f4e873b3d8a4d56cd283dbc3b58b63c5aa2637a997a86946067831327624a62ba41" + "55c64253d52a3ac1283aba6378e1566dca1c377e64738a848d967d8790818b947a848d79" + "838c868f9877808979828b79818c7a8194747e886c797f6a777f61718165749b1a28690e" + "1b694858b83d5bcd2340b64966e42946c63c55c92c45ac20367f5d709b7688a0798a9c7f" + "8f9c84959d85989f8699a08b9cac8696b08e9bbd737eab465fc44766d02e4daa29488b22" + "4072a4bbef8296d11926754c54b6454cbe4555e0495edb3350b83453ae37589b617ca99b" + "acca8d9bb58b97a796a4af959db0a1a3a0a0a496a0a6bc9ea7c892a0ba99a6ae94a1cd09" + "217b4062de1c40d21f40db253bde171eb5000070030363000341989eb4989bba989bbea2" + "a8c297a1a29ea8a79aa1b49b9fbca4a9afa4abb5787cac252e713848a7394eb93951cf2c" + "42c92f45cc2e41c44c5bd25a68b16d80aa9eb9b08ca8ac4657a53d49b73740c93d4cb336" + "48769299a396979b999db86c719b3d458d3744a45062d2485bd12b41bb565678a7a1a3a2" + "9c9c9c97939893909a9494968e99968ca44136563b336c515bd7464cc84045ad575eae3c" + "4564899394949c9e9292aa5a62ab3564f80c3ec13c6cec3251ce00086700004e06005811" + "0c4e272b4888798e7c6d701e163b201d4c1b244f00004700057800006500008101008d07" + "02429d9cae9c97819f90979c8894998b7ea69e897a6e848c83b22523774955b92d46bc32" + "52cd3b60e22343be2a44bb4654bd171a615748416c5b543c281d2a13033318073015022c" + "13002e1803261000241f0221122f354bd42e50fa1a38e41f48d44a76d500024400004b00" + "0058333d9c4a5dbc2940b24862db3752bb536b9b2b3c442224311e1e2a24262133302b34" + "2d27291c141809042113240c001f03003c635ec25163e12e3db44f55b34742821403251c" + "03192700052c00003100003d050837040b2800111c001320113c2d2d756370d65064d72a" + "42ca3f59e13f58d9495ecb2d3a891a1c4c6965887b6d7a8b71708b6a618e6e639c827195" + "7c687a614b766355ac9fa85f5e88484c894a57b74458c84555b5353d8517171719123e26" + "226e444aba4641bf2c1e2b361e064022063f200b3e1f0a3e20083d1f073b1d0545281a44" + "2719452a194429163f2612412a18432e1d433021412e203c24243b1f2b726c5297969b4a" + "53b8374aee2f46f61f3ce23251e0324dce3a55c0000061150e800f026b0c035e30316774" + "798c8081867c736a93898081747d7f6e817f6d877d71757d746f6e686c222a5b2139b743" + "5eed1e3bc32543c92642c0425ad6000b630007429d9ebd9798aca2a0b53d418b23288e4f" + "5cf62e46e63756ca3655af8097cb2a3668424997495ac44b61ea475bf2485df8192dcc11" + "27c8455eec4460de1330a51528636573906c788e7c8491727b847c858a8b95977c868881" + "8994848a9a8c8fa28c92a28c95a68d95a88795ba29387d3242a24457be3046be425cf11c" + "35d0425efd2a47e02946d23c57da253baa1c2d7f90a0d48b9bbf899aaa8899a18a999e8b" + "9b9b8f9cac808fac899ab65a69a2304bd0415ceb2641c22c4eb03450a34d65bb132c891c" + "28a02e37c4434ee62536db3545e02f46d0334aca5c74d42f489a8c98d4848cba929db39a" + "a3b4959cac959a949496918e92ab969bbb878fa29eaaa6919ec03f4eb33a52d84b68ff47" + "62ff1526cc00049300006e0d07730000357e858f7d80937c7e97999cada1aaa7a0a9a899" + "a0b0a3aac4909ab58490b835409a25319d303fc04152de5064fb2d41e01026c7455bff23" + "33d14651c42a40957b97af829ec3364bb84655e41a28d33b51db09175e7075958d8ea2a6" + "a6c87b7dad222b8a2938c54c63fe425cf71732d919235e9f9fb79390a19e99939b939190" + "878a5d5a635d5a892722645e5fbc2e3be92e37dc343bbd454db07d85b38d95aa9098ad91" + "95ba344088416ff80635b74670f62c4ac6000054050c5a0f0856050032807f8d95809383" + "706c7669706c656d61656e080b3e00005c0709600c0a780b0184181144a8a2aca2968696" + "858ba29398938e8ba09db0322e614e4b98202aa62e3fcd1e38d73754f84467ff2c4de818" + "37cd3c56e12835a5383353665e763c2d32200e022c17042a15002b1500311802290f001d" + "19000c0225374ed84164ff0f30d50c36be456eca00034500004400035b303ca02941c738" + "50ee4858ff3e58f35772c3223256171a3d0e0e261a1d1424211c2118191a0a0a13040014" + "09190100234f4ab12c35ae4759ff1a29cc5661df4c4ca211023b19022c27030d2c00002d" + "00003100032a00131e002d0b002f241e763640b34f62ef4459f41f37e23451f52a47e337" + "4ed83f52b95e68c14a4e9869628e8e7c7a987d6c9f846f8a7558684c345c442c56463997" + "8b9538377d2c34964058dc2138d3475bd82b399a060e3c2a368a4858c7394cd9393bcc28" + "214b30243239211d3c21163c210e3d210b3e1f0b3e1f0d422716432817462b1a452a1943" + "2817472d1e4a30214c32254a2f24482b2545291d4944279a9cc23d50d00531b44473fd21" + "46ef3143e12f38ad00005a000557100c5900003810073e605b7968656e64605f7f786e8e" + "8a87978b8f9f8e969989968a877e817879887b857878942233a53950de2f4ad9142ebf41" + "56ef2f3bdb0002611010508282a89d9fb697a2b401135b2b3da92037df4c69ff13339800" + "1d66576da64952b93337cc333ed42532e12e41e5516cf71835c12947e5193cce193dc50d" + "30c23b54cb35468e818fc0989db1989aa78f939499a1968e938c9899ab9391a7928da19d" + "98b6a09ec39193bc1119613c4bbe2943cc4868ef1838bf5b68ff293ae22239dd3757e617" + "37be4360e83346d33d48c4525cb37984c2909fb4828d937e8786889081868e9b7e8ea771" + "8795273a873957eb4959f4455ae74b74dd324aaa0010754b6ddb2430c21f30d8293feb2e" + "43ec373de94856fd262dd52f3bb34156d61a1e827777bd828ea4959bb58c969f7683798c" + "959a8b8ea186879984858a757d7f565e8f3138ba283acc2942e51d37e4283cd900006a08" + "068503007e00033a808d95808797848a98919392989b929ca09f8692907184933f519d34" + "47ae1f39c21d31c63d4ce72835d12636c94155ea1a31cc4462ff2037e94853e02d4fcd0e" + "2a6b5f78b82a45b63e56de1f38da1e42d82228807d83c18486ad8d8ea29498b3343f991d" + "35d3183dd31e46cc1637d0425faf959fe49396c99a948897888b84797f5f646a1c228022" + "2dab4254de102fd81f35d84756cb000559858eb98488b79194c98b8fce35408f415ee827" + "43d31532cb4c66ef00005900034c010232392e50a496ad927d8c74656071686368646163" + "636f110f3e0400421f1a5c10094c060153352f3ba79b8fad9591b6a3a9a4a0958691a509" + "1271252b99444fc3152ebe2a3de13e4dfe2835e61e30d2435ced223dcc4d6dfe2140cf53" + "64d03a459e37375d0600001f1303291e0a2b1b042d13003112001f15000000322c3dd314" + "30d91a3eda2042ca1b339700085203055005084f4d58b22e53ec4b6aff2b2edd1e41dd43" + "67b50b1a5107074312113b1c1e112923232a1d2e210d19180a001b181f08093f5562fc24" + "46c14658f82b3ddd2b3eb60008540b014618064016000b1d05001c0200160000220f2f00" + "00483d3aa3313dc72136cd3048e6192fd22234de354fec3e59f23049d75269d92334c02b" + "3abb00005781827d8172537f70516b62455b3b2c644e40514a429588801713681e2aa039" + "65ea253ee35461e3000060303ba53f62e2406cf35074ff4044bf07013f0d084b15062d28" + "171f3b2517543b253f200e33120b432817432817442918442918432719482c1e4b2f234c" + "30244a2e22482a203c211065634e535590445fec053cb1427df5173ee44956f000006c00" + "005600003e0000321e17414d43658d8495a49b9ea0989699928a84848494888899868a9a" + "8b928486798c868a94848f918a9a2c3aa3364cd62642d43752e92d40e4252fdf00006106" + "01444948708389a18192a41c327d4e64d11d38df3757f82343aa0000502238844952db24" + "2ae2222dd52b36f01c2ed64f6cf43a5ae12043df1941d70b34c22c52f34d6bff2a40a300" + "00457c81a19796a6878b8a90988d8c918a9190a09593a8908d9e8d8aa79898cc393a7d33" + "3ba84d5ff13d5dfd092fce3e62fe2533de3143ed213eda3e65f01239c2496efd334de84a" + "5bf31e2ca60b1a6f687794737b86767c7c7277637f838f7989a0718a912f449d445ef925" + "37d52d43d52c57ca001e8a304fc3345ad52131ce2337e64c66ff1d38dd2430de3a47f81c" + "22da3543c8455af54751cc00035865758f7a7f9f77848a788c806c79828486957e7e887e" + "7e7e858c925059922b30c02b3ad1132bd3142edd3b50e90000600200800300850e16478c" + "9ba28a949d8a91998a8c878a8d847a7f7b7c8b8e52688f0f26903c57da1f44dd2740e53d" + "4df8222fd53341d83b50e14761f61336dc3f5cff303edc3159ef223c991630840929a05b" + "7bff2245e1325ef500005700014f090a401416259da0b14c58aa3652f30f3ccd0e3ebc27" + "4bdf3c62c700005000003a5e5654a29396aba1a97c849b3645b81a2ecb3753f52148eb1c" + "36d13241b4142076070d410c0d450808462f32754b56a6384ddc394ee51f35d63b54e500" + "016a00015300012b655b7397889da3939d7c716d67615565635766656d1f1b401b134639" + "3164453d66252352514946afa292a98e939a8c999092913449782b3dc52f3ecf3e50e038" + "59f42138de4856ff222dd7313bdb3b4fe4465ef21236cc3c63fe213bce4055d2020d4f16" + "17291710082017082a1905341a013619001c1100100e571626c30c27ce274fe5324fdb03" + "12770000470b0a56000035020d5d1d49e82041da1c1ccc1436d53e64b5000a480c0c5402" + "00341c1d0f2924212a1d2f230d2225180700000e0209512f47f22c58dd2e3edc4255f127" + "3dad00004b0000420d003f160410342812372a24342f450305402e3aa61a2dae3554ec26" + "4be41033cb0e2fca3049eb4e6cff2d4bdf263fd9405ce11d33df172fcd4657db262d4993" + "8b8078715f53513c55342b553f32433f367f72625e5ab9586aea0d41c83650fd2b32c100" + "00772436be2753e7295ced446cf23842b10603540b056f0f05422417291b0b001f0a002d" + "1201311112432815432815422714422716432719492d1f4b2f234a2e22492d2146292134" + "1b1432312f0f135c3f5ae92a5dda2f66e43a5efc4957dc00005c090c5d0d0c4e00002e5b" + "5378736a85887d8b8b80848a8280867f798282828b7f7f907d81a3939d9ea095948b90a0" + "8e9ab5abb64652b4455ce02043d33355ea2841e33242f00003620303431e2247868ea392" + "a3b52b3c8c4a5dc6334ee53758f33452cc0000695e74e12a39d21d29dd2736d72f3de827" + "3de1304cdc1737c62548e42d55eb2b54e43a62ff466bfa253fb03d52af131d5071768972" + "7a7d707a7b737b7e7178827a818b69747a7e8a9a000848464fb42a38cd435bfd4667ff19" + "3deb1f43fb1d39e24f70ff113dc43768f12a59ed3a69ff2954ee3457fd2a43de283ba413" + "224d6870857a81897f8676777b8776859a6d838e2e439e5368ff1630cb3050e33a62e609" + "35b04067e8355adf4156ed2d3ade3b4cf12148e33a5cfc5363ff1b30e31c41c53d55f527" + "46c3183a930002266e7297858f9b7a8e8576838c7073846b6b776a6b6d757e871b26643a" + "40d2364adf243fe42640ed1931c7000b700301800600862329598c9a9b939f9d969ea19b" + "9ea79ea4a2abb4afadbcdb3347a0526bdf3a5ad31943cb3351ef3a4bfb3845f41926ca45" + "5bef405aeb0d31c72142df1e30d2406aff3c5bc700096b2f52d24e71ff3e65ff2654e500" + "00570002500505410e0f239396a7303f82213dcd244ee01d49cc3255ed5a7af100145d00" + "083e1f172ea3999a939097747db81c319e576fff2643e92045db3a55e400007700006002" + "024a00002e0a0b3b6e72a24c55a2293ed53d54ef2e48e52f49de4b61db000061030b4959" + "576da8a2aca0979c88837d6c695872715f6968665d57715c547d786f9a9b93b8a9abc49d" + "999ab1a7a5a998a29490a97c85a436509b3b53db384ae84258f9173ad62d48dd364bdc29" + "39cd2330ce3f52f64d66ff173cd52045db0c21b8485ee53f53ac0007321009111c0d0a2a" + "13053019072917031c17003634882c3fd92c4aea1941d7213dcd00036500004702014f01" + "0037030d552654e74963ff2f37e41b37d92f5bb40007460c0c5401013716160c2a221f2d" + "222a2f1c30231b0610113f646acc112dce325cee2536db4758ee2638a600035b0a01500f" + "034113060f50464454485e333e802d44a41c3cb72c53d60739be1b52d1154bc92456db29" + "56e7305ae40d33c43a58ff324ef71c36ef1735d53547e53b409b312950534c5e5b574e54" + "332c5e483a524f3e776b5d4946ad4858df0839c23d54ff383ce53946d32741c9375ce837" + "5ee74567e3000b7400006107007c0900401e152843372b50412e776052ab8e9043281542" + "2714402512412615422618482c1e492d21482c20472b1f442721402a2d1d1b315359af27" + "43d33060e63668ed4467f7515ed000005300004901013f100d3a958faba39aafafa5ada2" + "9899a39a9bada4a5a7a7a7a89c9cb3a0a6a595a293928dbeb3bbc5b1bcb1a6ac1f2a8411" + "29a5254ede3a62f72c4ae8384df800005500003a00062a7883978ea0b64552b04252c13e" + "59e61e40d73d5ae64965ec3048d04c63ff2f46ec2f43d83b4be63d54f03a55ec2a48de24" + "47df1840d33e66f9133cd42e57e52443c24c63d50000434d5770869099808a967e88947f" + "8a8c7f8f8f758d91647c98293e973e52cf283de42c49ed3c5dff0224cc3050ff1b3ad034" + "59de3c66df1943d32d59fa325efd1f4ce33b65ff2545e82e44bb00003b50597a8990a283" + "897f878b978a99ae7e94a23d4fb13a54e7113ad0335df13c5ef32d58e53f62f0142dbe22" + "3ecd2638ca2b40d11b49d33462f31e31d53351ff2555db122dd24772f51341a300124136" + "396268708371848277858e828898868895868b8e818f9a182a6c2732c2374fe53a57fb3a" + "56ff223bcc01117304027d060080383f6b9ca8a69ea9a199a3a2989eae969ea985929a11" + "215f3b4ed11c39bb1236b1204ccf4163fa293be32f40e83948e31d32bf1f39c2163ac240" + "60f31e34d8315cff2b4dc8000070365ae62d52e8335bf9315fe800004d0a0f6004034526" + "2640888b9c6e7eb1213dbb294fe04168f32445e23f5ce6000347000d410300258e8c918c" + "8d9f0000583f57c5122ecf2746ec294dd54e66ea01088a0000700f0961100f391112308a" + "8fad454e992d43e63a52f23b58f1203ed23954d9445ad200004e6368888d8f9c83838d79" + "79775e5f4f71735e6f6d6168606d625976716a899790af9a9da6a0a0a2938e949d95ac65" + "6b9b0615562040a72f4bda283fe51f37df2144de4c6af0263eba4154d43c4cdf1228cb2d" + "46eb0328c1365aee4f5ffa465cee3f5dcd000f551007261f0a192f120c27150b1e140b1f" + "1f075454b83f52ec3c5bf4173cd31f39ce00046100014e00004a0e093f0008461847cb38" + "4ef23543ee2a40e41e4bb00211520101490c0b4515110e2720182a201f2f1e2e322f1e00" + "0046353bb51635cd1f47e52f40e63447d400097200005907004a05003220192145425735" + "2e62293fa53d5edf2448da3963f72758e51148c61a51c6497df51546c64370ed1c46cc33" + "53fc3e5bff2b49ff2e51e90c25c75059da00004213103f655e65593a37624d3c605c4376" + "6c634242b03546d40837c3445bff4147f7394de4395be32642d21a33c33a51d100036b0f" + "137e0f03830f05445a53638d83799285749e8b7dac93964227144126133f241140251241" + "2615462a1c462a1c45291d44281c422622402e3e00002d5059be0a28bc3d6af90a37c443" + "61e5000d690d0c58000144000032433e668d859a8e869382797a867c7d867b7f80777c7d" + "7d7d8a7e7eac999f86758561605c6d60698068757a6c6c151e6d12299d3764f53b67fb14" + "37d33950f800005300043e0003275c697c7788a6444dc24553ce3a56de1032c92945e420" + "3ad94b63ff4562fb2543d51b31ba566aed253cca213ad4314ce32849d61037c33159ec0e" + "37cd1845d21336c44a66ed01126e000629626d7f757f986a768c6e817d6f867e6387933d" + "5c9c1937b12f4ddf2747ea082bc53d60f02346d44a67ef445ecd4f6ad33049bf132ac63d" + "54ff223ce74367f9345deb2044d6223bba0000500a14450f16327379776b717f75849967" + "7c8f203199234cd81657e52f67fa2538dd3753f52a3cda464ce84166ea1d3db606249e39" + "65e03766e81e33ca3757ff194ad3203fe72552e12e5ccc00003a050737383f5b94a6a884" + "929b888da09396a5909a9c8394a4354b962232c33f5af12141e21837dd425be900016200" + "007202007652577f747f7b748074707b75747c8f6b79966a7a9c3a4cae566cff1e3ed103" + "29b23a64ee4063f32b41d3485be82c3ebe2d43ba2640b71d3ebf3e5deb425afc2f5cff44" + "6af32b4cd1395ef51a42e03a66ff406dee050c5c00004a0000433738579197a594a7c534" + "4fb60e31bf375bed0b2bce132cc600044f00053c0a073e9295a88b91b53440b85574e91e" + "3ede0424c54d6de400007100007c05018a0d03660908286264708c909b6169b2354afb38" + "51f63a5cf10e31c1304cdb3c57dc0001650003377a85a39199b089909873776991947f96" + "947f8179767d758280798b9893a9888d869395948f8f9b8a8bb75565b31f37992146c84a" + "6dff1a35de112cd3284bd94e6ce4132e974f65d21e31b21d32c91f39d41f43d94264f93f" + "4dec4059f43259e22740a50a03391b06273011172315141a1a1a1d21105f5ed52237d01b" + "3bce3257ee3950eb00065f00004902014f090333050f425786f8283ae6364cf73240e91b" + "48bd0110530000490604431c171b231d0f1f160f1b10140e0f0a292c97333bcc2749de44" + "69ff4d5eff4b5ee10000600b046c0d014b03002a0d0d190e104317176d263fc03a58f421" + "3ced1d3af03755ff2849e21339b82f56cb2b51bc0b37a42f5cd1395cee1c3beb2a4efc17" + "41c93054e83a4cdc00005f03084c443c54614345594232524e2b59514f2b2ba32837ce30" + "5dec334bf53f4af13f5af3486ffa2130d32f36de3d48d800086c00006300006210083baa" + "a7b2b2aa9f9d9483958578806c6e4025124025123f24113f241140251442261842261842" + "261a42261a3f26213a2e4652569d5865d50d2fc4254ee82e56eb1c36af00004b00003e0b" + "0b490604368782a2776f7c767074776f6c7e74737c7175746a736c6c6c72666699858e89" + "768a7b777890808b9b818c877873394189374dba305ef13967fa1d41dd364ef600015706" + "0c460810344753697180a72d36c33343ce3a57e31a3dd53d59ff3048f31f37d91a3cc443" + "66de495edb4a5ece00007a1d32c34c63f11232ab4268e71e41cf3257ee214edf4a6fff3d" + "5bf1122794000e3f4049667982a37b87a17c918a819c954b71954164c81738d14468ff30" + "55ee0a2fbb4766e54561dc182f9900005a00005a0000733338c83e47e43e4be73e59e41d" + "42c74268f12c48d04e63cc0008460c153c989da3a5abbba5b4c797abc34353c22952e023" + "66f53770ff1325cf3451f74a5cfa4c4fe8183bb300006900086f476cd6466bde263ec61f" + "3adf2b55e50b2bd44063fd4669e900105800002e02072d88969f7e8b94848b9e8a90a080" + "8b8f6d8398425baf3b51e23f5ef4183cda0b2dcd3b55dd00036201006f05006e666c9070" + "7976737f75738079828fa06f7fb2182b70384dcc2944ed2f53f21c44da3158e44e6ef71a" + "32ae3c50c300036900005c00046a5a75ea1d38bb2841d9113cd93157ea2f4fe23255f715" + "3ce1204eec1039b500025000004f0502537376999ea6b3869aa52e49984060e93453e939" + "55fe2f46ea485db800084d0e104d7880a73c46834c5ee8193abd264be42246dc425fc701" + "12840000790c048e1004666d6a7f95979485898831387e293ef32c44ec3255e71338c532" + "55e52e4ddb2c45bc3d509d000d486b79a87b87a1777d7d8d9085777560746c5f7a717275" + "6e75807d889294878287838a90a0515a9d3e54c12848c3355df00e32d11833d82e4be740" + "5fde4763d1000b6b00005a0000632136b31028ac5273fe1737ca0615b82c48ea3c69ff29" + "49c400004a0d00312205191c1318161b1f1921165352da1830c81435c2385bf32d41de00" + "0e6100015100004609022c0a133a3f6dcb0f20d0334bf53642ec2b57da00074b0d0d5700" + "003a201a24241f0c20180d1c180f0b0e21272cac2b38d64263fc0b2cd92231d42434ae00" + "005c0c0068100645141035131b2e000251202799334fe14a67ff0c21d42134ea3c49f732" + "42d64357d03248b700005e0003653e61c7506fe32540d73f61ff1642bf355fe52540cf29" + "3ba900005519103b5e434c6750424d481e4e494f1a1fa11f2fcd456fff2139e11827cc24" + "44e41f49cf2a34d11b19bc4549d1000d69000668090164140d368e898f8880738176647b" + "6b5e533f403e230e3e230e3f240f3f24113e23123e23123e22143f23154024163e271f2c" + "2642515bb42336ae1e42d6345afd3c5dfa455acd00034514135500003616133ea09cb394" + "8e92aba3a0aca39ca99d9daa9fa3ada2b0b6b6b6aa9c9cb6a1aab3a0b6ada7abad9ba7b4" + "9aa5aa99915a62a1475cc52955ea406cff3d60fa2138de000050000037040a2e2a344d6d" + "7dae2e3bdf2135d42e4fe81d41e0354ffa384ef92c41d82646b500005e00006a07187400" + "086e00028300037f0009665777e41430b82d4ae4335af30c30cf4f70ff3f55cd00054815" + "1d44555a808692aa7a918b7b979a000a513b5ae82141f40d31dd466df93555d02a40b000" + "0973010a6700005d0e0c7a00006507016b090b725359c72033b32747d04064f05472ff50" + "65e5000049000032686d809095a98392a58194b22736ad344de51143da3765ff102dcf2d" + "5af32948d7303dc7000d7c00005a02076500116700005d4962d62b3adb4a63fb2a4df31a" + "28cf2c37c700004e05063f080c3c7d8a9a86939b9097aa8c93a5859499728ca54b68c638" + "52e33155eb244be62247e03d59d7000d6903026a09046b7b809e7c84867a858176827e76" + "8894475ba44458c84660f50c2fc92b51fa375cff2d4dd6445ddb00026700015b01115c00" + "034f00035500005e2439ac263ec21238c7193ed4112dcc2e4ef7496dff234fee2246be00" + "015004045a00004a8e92b8969eab9eb3ac0d265e4762e51934cd2844ee4b62ff2e3fb500" + "00570009461f2d6e5968c31f38c8193dd34169fc2b50d5374faf00006c01007f09008000" + "004578757e9f9f959a9c97171b5a2337e61831d62949da284fda375dee2f53e52b48d01b" + "35a41f379b4c61b06d7eb47e869b8e93976966575e56436a6257615a54605e5f7575698d" + "928c969fb04451b13853e0476bf72b54ec1436de5974ff3551d63a54c200006300046300" + "075e000c5a0000520008652845bd1d37c8243ade1635db103bdf1f40cd090b6f09004c11" + "0020120f180b13160814124d4ee6263fd7274bd33255ed1527c5000b5a01065700004200" + "001e16203b3b66b4273aee3951fb404cf6355af0000248100f5b00003e1b1426241f0b22" + "1c102527121a2052444fdc2739d91a3bde2445ea1122b6000d7f0e0a6b1202640000251d" + "1d353f4e6f1c2d972434bb445ef9425cf92f3ed73943d85255da00006700005e060c6c00" + "005b000564071b72000854192e99314eda456be61f4dc50e34b1516fe100006409003c43" + "2b3b675146514b1b4f4e5c4750db3c4ff41a3fd52944eb192fda0d2cd4244ac5333cbb00" + "0078000060000045000668000057231a39493f3d4c412f4b3c274a37285c44403c210c3d" + "220d4025103f24113d22113b200f3c20123d21133f23153b271e2728464b58c02f48c62f" + "54ea1232dd233fe14c5ccb00034200003a070439545073b0acbbada5a3a7a098a1988fa5" + "9a98aba0a6aba0b0a0a0a0a99b9bac97a0b5a1ba9a939a9d8b97ad919dbdaca2656ea93f" + "55bb5079ff1c44da2c4ae6162cd000004f00003a02062c1e25417080b4253de7112ed41d" + "43e42f54fa142cd42f45e65365eb00005a001362000670000450000656010a7300056700" + "0c4b425bb5273cb91a2ecd4264ff1135d44667ff2a41c100005600002e20224b818ca069" + "7e815f7a8f3954bb253ee03553ff1b3aec3455e0344ebc00005f03076b0503660001620c" + "087611087101004300003700074f5267da1636c52951e62141e2485ef000076200054301" + "0623747a9469788d768aaf2635b43e58f50128c53c63fe2645de4367f300007800077f00" + "0b6f09096100035200003e0407583b55b42331c82f43da1137d6262cd82d2ec70000530a" + "0a4a04063f7480966f7c8471788b69718473848b6784a23352bc3d5bed3d62f9143dd515" + "3ad0405dd3000b6400005e0b06648b91ab8a8f938c96988c9a9b8da4b45269c64459e631" + "4def244ad9143be02c4ff15a74ef000774000052000e5900003c101b5900003e000a5500" + "01582b42ac1436b1264ade3a53f61632de1c3dea436fff1833a805045408055c0402568d" + "90b9818b97798e7b4c63853248c02840d8051fca384ef92332bf5966d80008490000594d" + "60d6405ef02144e61037c23457cd000c660000650b037c040066392e68918d8e8f8d8083" + "847f6a6da23448df1028bc2140cf3559eb0f37cd2348df4567fc213ec81e3abf415bca4e" + "63b66470a08087a4767271635c4a706957635d4f5c59507a776e9094976b74932d3eb240" + "5cfe3659f3365df82744e61c37ba314bbc000b6a00096a00005000085300063a000d4000" + "0b481c3393233abe1936d81b3ce1204aee304fe51f289d111171090134100f1d060b0e00" + "030b585dff1f3ad1254acf4567fe2434cf00004a00004e0403490a0724040b1e567cba21" + "3aec4a60ff4556fe2a4aeb00004a01004d060047170f271f19091d17091e230f00004f1f" + "34c54058fa1131da1435ce1f32b500036c0000590300470f0c27262e39283e6f283fbf26" + "3fd02748e53a58ee2636bd2933ae00005a0000500c095a00004700035400004f00003e00" + "002900054a485dd43b58d62f5ada2854d1193fbe3851c70600491f0b26442c2a453d0c2c" + "31472432c63248f31b3fd51e3bdf2843e81f3ce21937a700005a00046505075100033800" + "005102004e20132549382e55432d443017513824452a21381d083a1f0a4025104126113f" + "24113b200d3d22114024164125173b271e161c3c4256c73d5ada072fc40826d4293ee500" + "026e0001440000430602349793ae96909ca09993a1988fa59b91a89d9baa9fa5ac9fb0a5" + "a5a5a79999a8939cab94aeaba4abb9a7b3c2a6b2ab9d92656ea94356bd2245e1183bd333" + "4be92634db00004e01003c00002a34375a44538c092fce355fff2f5cff163be21128c417" + "29b94752c500035600055000026700034000053c0305500106481324420012511f2d9a2f" + "3bdd4159ff2647e44160f6374ed200026c0e094b00002782899b7a8fa0172d5c2031b51f" + "34cf435aff1f36e6465deb000e6e00005308006a00006d00045600076200005010183f1e" + "2f4b0116413a5abf2953e52e5bfe365bff1f37d7000e73030f570a0f39858bab70809977" + "8cb93545cc3561ff2950ed3d5cf54f64f13433b301006c00006300004f0c1a6300003d01" + "0e3a1b1d5800014a2737c23e54e80b34ca343ce5393cd700005a00004408094c4a557173" + "8086787f92767e917c8f95718fb33556ca3f5ef4183dd6224ae02c52e1506bdc00075d00" + "00580d095d939aad94999d8e97a082909b849dbc2840ac1b32cd2d4cf43e65ee163ed135" + "59e500005a00035c00004902065000004100013800003119224d1c2956000e5a425cbd30" + "51de2a3de11127d21534dd2b56f34357ca0100500a065d0201518489b1929eaa9baf968b" + "a0b14d5fcd2234c62c47f03e56ff2a3ad85563e800054e162a9d253bc52646d73f60ff29" + "4fce3f60c7000b6100006c00005909004f8179919b96909592899492958587ad1d329f3c" + "52c9344ddb193ad70a2dcf1e42e1264ae63152ed1b39d74461ed374ec23e4a9c40488690" + "8ea3605b555d58456966536463516e66649191a922295d3e4ed51f39e62342e83251e94d" + "66f41c329f000b6a00075f00005000004412154c080f2c000620000829000e514d62cf1b" + "41e0355bfa2e51ed2c47de2233b50000690003450a0c1b141412000718363ee7324fe92d" + "51d93958ee3f4fe300035206085b0504460d0b23171d295a7aab2d4dfa192bd72940e432" + "4af500035401004f09004a120b2c141007211e0b151c155562ca142fc4415fff112fdd2f" + "4fd600006d00005a03005419084c1519223e50540005492f4bdb1534ca365efb254ad923" + "39b100067000025300004200003e0204410005410600351a083a0e021609062527308f2a" + "3ac32c4dea426cfe1d45da3e5be505005516062a1f08103c3103131b3f1227c03f5bff29" + "4be2375af61235c7465df900005e000047040e53030633060024060040040438402d2f4d" + "3322472d1443280b44260e3a190a381d08391e093e230e3e230e3d220f3c210e3f241342" + "261841251739271d00062a2b41b9375ada1c46da1933e22c3de300006300004704004a00" + "00289893a9a099a1a198939f958c91877e897d7d887c80867a887a7879958586a18a949e" + "889f8983877e6e798f7580998c834954923348b3334ff0213eda3f53f03742ea00005101" + "003d03003234335d3747822757e73365fc2152f51339dc283dcc414ed002066902085600" + "014e0000520d0e3e0c0c2e6f6d9e8486af9facb47584ad131e772c31d3475bff3956f03f" + "5def3a52d800006c06004b0000294f556b3d5174293e81303ad03645de3b4ded2e40e040" + "52ce0000470d09560000500c006d000d4005164c717ca98592a38298a36d89a10f34851c" + "4ad42d5cff1a40ed223ae43141b000095b000037575c846c7d97576ca13c4fda3764ff3e" + "5afc425af22c44c2050069100760000045251d66000040081a4c6d7c939aa6cc1c3b722d" + "45c33f5fee1c4bd73349ec3948e100005900004500004b404b6b8b999a9ba2b58b92a583" + "969c80a0c93c5adc1837cf0b2fcb3c61f73f65ee435ec700025705015609054f9ca4b196" + "9b9e8d97a397a6bd39528a1d37b0223dd62d4cf2153bc4426ae61738ab00015500044f0f" + "12550101410000303c3b67525278767b917b8698526391000d562e4fd41b2dcd2639de26" + "43e93861fb303cac0b035903005602024a8d95b9939fab8ea08877898d5766c54858e119" + "32d7475fff4051f74b5bec00055f3249cb233dd25578ff1431d34665da00005a00025601" + "0067160f5f0000297874719b978c98938d948e988d8fa41a2e6d5769bf2e42c70c25c821" + "40e81031d65074ff2347e62548ec102ece1029b95262d35964be5356836b6b7365635453" + "503d55523f6862663c3c6e545bab3648d81933e0152fdc435bef172b9e02136f00005007" + "055900003e01003006052740424f00000c1e25370000273d4fa12754ed365ef42f4ee41b" + "35ca182fbb00068300004904071a1815100615341824ce3957f32349d24565f83544d100" + "004e00005304033f0c0d21070c123a537b193ee52735e01f3bdc3e51ff12378f0c075b0a" + "00490a042a0b0706161500020b1c485bd3294ae32a4eed3756fe4a67dd00046000005806" + "00511002332d393711282e486ac32144de264ae01a42d70a2cb400077600076700034d07" + "063f02032f000025040b271d0a262e1229261012150b0a090e502b33b83a55ff0c33d831" + "5bfb2141d20000571307351f091e3d3109061443304de93c5cff3153ea3c61f8264cc93a" + "4dd800005e0a185500003001022017031c1e0d37171628321b0d401e053e1b003c19003e" + "19003f19043e240d40260f4228114126114025103f241142271644291842271638251e1a" + "2753223bba4269ec2a56eb324af53d4bea00006200004f04024d09052a9892a0a59ba39e" + "93919c8f8991847e877b7b887c808c808a8b87889d8a8ca38c96a690a59c9698a2959faf" + "98a2a299922d3c813147b73d55f73149e74254f2474ff800005600003d06013b3230622a" + "3d773e76ef1f58dd376aff1d42db4255d6333db0000050040152080357130b611410339e" + "9bac8d89a48c8aa0747d786d7a8d5f6aac4d50ed2130e12540d91c3bca3953dc00007e05" + "00521209404c51710318512a3e95535cf53f4bdf4555de5264e0000d610001310502370c" + "0143060043475f636e83847484837a878d576b766c85995d80b65178ef345bff274df620" + "3bea4253c700005500003f444a7a7b8eac384e8a3147d91631e02a31d92f3ad23456c200" + "005100003b000f450d003b150b487677a592a6ad90afc14768913b60d3376ff6275ce01d" + "4ae3315aea00005a00004c000053333d6197a3a3979caf9398ac8e9fa66b87b64360ec3d" + "5cf41739d81b3fd31d42c700086c000253070252000037949da4a2a8a6959eaf7583a648" + "5db62643c52948d63454f50625bb2b4eb200065d00004c00014400002c08073156527587" + "84a185839b72748171788078849c4252854665e22f3fdc3749e92743e22450e500006c0a" + "005700004f00003c95a0be96a4b1909f8ca8b7b2000b591c2aa5314be81d37e2182ed229" + "3dd0485fd31530bb2a47e03b5af01732c100006501126a0001500000500200354845586e" + "6e569a968a9b959596909e97989d8899a912204f5360d32e40e23048f34360ff2449e249" + "70ff0a31cc3857ff0922c52d40cb17269d00064e494f696768634a483c5653424b454f01" + "02544048b7394fe01029cc1a2fe03847d600005000055500055901004b130c402a253977" + "747d4c4a4f0d0b161b1d2a02071a081a4c305fed325be74663ef2039ca3a54e52e49ce00" + "0d6304061d17120f0213411728ce3354f1183dcc415ff12a39ba0001520000520a0a400e" + "101f0003060014332c54f22735e01b37d64a5bff214caa0000520e004f03002d16151d00" + "04000004374861df3962fc153cdf4563ff4f68cd00014f0000520c004e0e042600090800" + "1628355ec84d73ff0b33c62a49d51e36b40000620000570000470700360905200a081313" + "17082917092e160a30190b271b030005253940b53b4fff001dd73763ff2447d500005c0c" + "043f1903273f321200154e3054f01b42e83759ee3258e9486ecf04138800005808124d00" + "063208041b2d0e1e381e292c2714391b00421b00411800411800461a00481c0343291244" + "2a13442a1343281341261140251244291844291842271636251e58659c2d49d03e68ee25" + "52e93146ed4550e802026203005702024a2c2747978f9a9e93999b8d8d9a8c8b8b7d7c88" + "7a7a8a7e8292878d9894959a86889a80899f8a9ba29e9ba69ba3b5a1ac9e969423358146" + "5cd41e34d8243cda2133d32d35de00005a01004306014134356e2c407f3c75e81249c836" + "68fd3053e52635ac00066e03005005004b00004600003f7d7b93858489736f807b79877e" + "857d6e7d806673a04549de202ddb2340da1333c44360ec373ec300005405003f464c802f" + "49966780e72731ce2c37cd2f3ebb0e2187000d4a00072e01042f00002935345e7c908e6d" + "81767c8c7f7785867486905b72804f6f963353c24666ff365dff2442f0374ac200005b01" + "045320275e7c93b3263f82314ae21f39e81b22c8222cc14566cd00004808124300012c06" + "00278478aaa2a0c58da3a1769da2537493214cbc3174f9235ad8033dcf3065f100036300" + "005201025c242d5686918d6e718275778c7d8c93415d8f344ee33d57f22747e8395cee28" + "49cc00036100015206024c0000308c9497858f8778839552608f475ccf2844d32b4cd735" + "53ef1f38d200045800024b0e0d6a0909491111330909219998a8a4a3b39190a06b6d796b" + "70746e78817d86ad3a5ad34e5ff7293dd43958f03867f500005c07005502004f00002c8f" + "9eb594a2af9aa69aa3ada2303a784856c33c57ec1632db1a32d4263ed6425ce52442d429" + "48e0213fd33c54d000086701095c0a09550f0b5533304f7878786667488e8a7f948e9096" + "8e9b969591959f948f96a90000584f5ae7283dd8324de63d62f1264fdd1942d23757ff34" + "50fc4057f52d42d13f4fb10812434a4c585555535a53495b596e2a2e99252eb74862f536" + "50eb4252ff4a52d900003c00004300005301003e130b308b87887e797539343119131d0c" + "0a15181c1f00011e3763e8254dd14060e93551e32642d43b55dd00096504052318121600" + "00403a51ef2f51f12146dd3c58e818279c0106580300590c0d3d1c1b2928292b0007214a" + "73ff3344ec2943e03a4bfd1d48ae00004e14005700002f0d0d19090f010813634a6bee30" + "5cf90834d52f4edc253a930004490000510e00460a071c061e2a00072b2a56d13b66ff21" + "4ada485ee72c3ab401076700004c05004009022c150e201f1b1c1a1d0222170120110024" + "1204271f0a070f26434bba2b3ffe1d3fff1f4ae44065e90005650100430d002c40311a49" + "62a53865ff143fe34467f91d43d43758b5000063030059000636020c2719121a3f192440" + "221a3627064927044d20014a1c024a1c024d1f054e210441271041271040260f3f250e3e" + "230e4126114328154328174126153523235e6ab23c5be91c47d22955f2182ccd3b46d306" + "035c030059000142625e779c929a958a909c8d92a08f95a292959d8e919b8f919c929399" + "9395a99597b0969fad98a79e9d989c929aab9aa4a7a2a62e42994f68e7142ace1e36d415" + "29c81b26ce00005b00004a0101473f4583364d932c5cda2353d90e38cc405de700006600" + "005a0700480801470300405b598a8688957979777c7887716e816a70706c7d755e6e873d" + "45ca2736db213fdd0a2dc71d3cd23c49cc0a046600004d0d16631f3d9f2c4bc02736d713" + "21c02133af000966000c400006360002310c1a4174829c7a85a36e7b8c717f8285929a80" + "9399778e967c95bd556ce02037e51c43e03452fe4457cf00096b05075e0106467189af24" + "40892d4ae42d52f9243dd7293ecb2a3da600004900002c12153e252144858bab7f8aa087" + "979676979c3f5e7a133dad2a6cf6235bd60038cd356af800056800005300005e1c25507b" + "867e7c7b8b7475897380863750862b42de253ddb3551f33b59ed324fcf00005700004f08" + "03460b093a8f98977e887d7a869c7281ba2236bb3c59f52242d33552eb4658ea00004e0b" + "196400005c010141282a3f73787e8c908f9699a09498a38b91a180878f7d8789797fa113" + "35b0374be21d36c62e53e01f58db00005500004c03014c0005267f8f9f82929f8a949390" + "988b868ebd525fbf2f4ad71a37db2b48e4102ac51d37d64564fa2346d8405ceb4154bd00" + "004a02045100003c060433797a7f6d6f62686752837e7a8c868a948f95918e859795868f" + "8e93797ab04b54b31d32a7425cd73255d34169ec2b56d91537d63553ff2e49f2445efd4b" + "61db0211561b213b484755524a484d51743a45c11b2cc22040d33e58ed303ee54a4ecc00" + "033a00004602015112043f59516875706a807c713d3832120d1319171c1719160612283a" + "61da224ac6153cc73a5ef41832c53d53da0004610100280c08190003594b66fd3356f831" + "55f43a56e5000c7500025905005a05073012101d36363806162f274ddc344df22e42df30" + "44f12e59c906005e10005504073c0408110d151815208c4066ef2255ef0b39d5304dcb00" + "0856030d520706560b0039000110000a2a2b53913e6ef4305cf3385eed2f3ac800007400" + "00450409430000210203180b07160f0c130b08011113120d0e100f0d0e100f17010e3133" + "40b0354cfc3153ff123dc74068da00086600004a0b003b382a1f4c6cb91b51e90b3dda3b" + "5eee173ad20010800007790d08660b0c280000022a1e124420243f19103c1c074d210449" + "1a00471901481a034b1d054d200341271041271040260f3f250e3e230e4025104025123f" + "24133e23123522243642984a69ff0835c4406dff1c31ca3e48cb09085800005800003c8e" + "8ba0a39a9d988b92a08f99a5949e96858d9081848f83838e85808c83869f898ca78c93a2" + "8e999191879d979ba0939da5a4ac273e9c2642c92b42e62842df2940de2735dc00025e00" + "004d00044c5762a44057a7193dcf3d62f80d31c7415ce100005e090b6202003c00003344" + "45738e92ab979c9f9c9e998a879a908ea68f95a194a99a80979d4753cb3043df2f4ff21c" + "41e71438d44659d9000064090564020e724065d72d54d5142bd12c3fe3293ebe000e7800" + "004e00106100064f22377649618f4e5da05262a05768a0536895455f80415e7e5978b140" + "5ad3112acd1038cd4261ff4d60d800026606066601084e718ab23b58a63758f50e35d827" + "4bdd2947cd0000630305520c0a3c02002a7077918190a36a76827f82876a7d842c476228" + "49bd2458ea2f65e11847df3961f70000660000560101652a32608a948b8b89978482976d" + "787e061c551627cc142bc9334cf1405cee223ebc00005602035304003f29285288938f79" + "84747886a12f3e7f1325b52d47f21431d3445df55364e6000a630003590000611c1c5c7f" + "84989fa6ac8e97968c939b8e96a1909aa67e898d929c9d878dad1437b5354de31935bd37" + "63e83979f400085d0103500201470f1a2e71838d70808d6e757f9296887f85a927338541" + "5de42646e62846e22945e41e38e32142db1639c9405ce100046018145e00003e00003b0d" + "0e237e827474756578766a878183908a8e979390959186837670988e8d9796a88e96c400" + "004b3b55ac3e60ce4068e21e47c30e30c52847ef3352ff1938e11732bd3b4fa6020b340f" + "112a574d56212b5e4256d93049e31c41d73a56e61321bf06077d00003b060a540605510c" + "0129827b8b7a7772736f663e3b321615111b1b19131512111c322b4bba3559d10b3ac830" + "5bf7273fd34856db0a0b680301320403231e31973a59e73457fd2447ed2641ce00005900" + "005a06015d0103290b081312101308172e092db72f4ff01b29c74b63ff3861d705005e06" + "004d060b450810130a102a303ab62d56e42a62f72052e54563d5000044020a520702520a" + "002f01041300033a4972ca2f64f03864f8254ad91f2ac200007f051069010d5500053a00" + "033800023600002f07092f00003000043500082800003200074f2133b34d69ff2347f726" + "52d52e54bf00015c0000560f004b2c1c1c385cb02662f62d64fc3c61f03b5cf700006903" + "097700005e06021d3a32303522133e1b213d14024517004d1e00481900491a064c1d0b4d" + "2009481c0041270e41270e40260f40260f4025103e230e3c210e3b200d3b200d35222823" + "2c913e5cf81e4ce03764ff3549dc3d47c008064f000057040b419c99aaa89e9fa2959ea2" + "909ea593a1a18f9b9b8c8f9b8f8fa19891a59c9fab9598ad9299aa969fa1a396a8a3a7a8" + "9ca6adacba516acf405de9324bee2542de2c46e32e41e600055f00004c000b547182c73e" + "56b0132ada455fff334fee3a4ed1020a6c000152060338000022848c9f8994969aa59f89" + "8f8b9b9bb38787ab939ab477907d8ca9a45466d22238ca2648f0143ceb0a31d43f57d100" + "01680000630000712f5bd82552df2643f72642e12a43d33146d73547d9475ae4475fd928" + "43b63a59c3213fad425edb3954e12a4ac12f58b21744993662c5123bbb1841cd1a48cf3a" + "59ff4255cd000060030268000049647faa4261b34163ff1c3cdc315ce72348cc00006700" + "004c00003312113d72839564717a878c928b7f8b8985962d47623547c51f3ddd386be838" + "50f23442e300016a00015807066c40487690988da2a0aea8a5b897a0a50c215a3344ec30" + "44e33c53f9304add1e37b5000a5f0507540100394c4c72848f8996a38f8794b60b196035" + "4ad73850ff1b32f04257ee2937a0090c7300005c0a09660000359da2c082889e959db08e" + "99ad8f9aac8f9ea18c9d938f989d777d9f2a51d24b66fd2547cc1e51d0236ade00024e00" + "034d03024426323e6d80846f7f8c6c718476786b989eb86c78c04461e1183bd32c4cec19" + "36dc122dde4767ff0528ba5471e700004e05003d1004461d1a536b6f7083896f82837385" + "80868d888f928e8f9391859a938da68fa1907f858785767e8a803f5771000d3d4869c620" + "47be3c64e03155df4868ff3253ff0c30e0092bc24d66cb000c4000002255495d0a175b36" + "53d3193cce1139d6304be02d3dce00006000004400004a00003c716d7c68647378757c72" + "6e6f3232262225140f1305171b1c0a10322138a04164da1c52e61b4dee2236c93239bd06" + "005806033c070a373b50c33254da3153fb0f30dd122db800005002015e05005c0407281c" + "162209040a07162d2243c83961ff1e27c44262ff224ac600005b07005400003e00070310" + "12434956d91945da356fff366bf52743ae00064400004b02004b0b0027050a1d3859a800" + "2a9a336afb0e3bc83256e82f45e83045de334ed10e2aa70e2aa83951d73a4dce4154cd4e" + "5fc7263dbd2e48c13249992b36aa3d4ed22336da3d5ef7183de43c67ea2f55c200035900" + "005b0e0054201118234ba32e6fff2e6afe1439c62746df0000690000640000610c002d8a" + "758845262b3616234418005119005421024c1c064f20105022134d220f451c003c220b3c" + "220b3b210a3b210a3c210c3d220d3a1f0c381d0a3a1f0c33222825349b1d3edb3a67fe0c" + "3ad63851e12836b300004c000151181f4b9895a0a89e9dab9ea7a08fa19f8ea0a694a49b" + "8b959c8d90a398929f999ba59598a79297a28e9994918a918d8e9089907c84994b67d542" + "5df2384ef92d4be73247e24652e600065d000052050e4f8797d23652b3142ddf415dff3b" + "58f22e42c503086e00004e03003c0d12288894a091a19e83928b9ca7a3898ea49697b695" + "9bb18da2938ea8a9293aac3d55eb385eff1e49f7153ed8465acb00056b00046c1931b53d" + "6bf23d6afb3654ff2b4ae22341d5425cf71229cf546cff3751e41f39ca2e4dd90a32b631" + "59ef2b54fe1c48dd1e49c92f58d4375de41b3fd12c55e11849c92748eb3c4ecc00056f00" + "00600000514c67922543991435d83e5ffc3f68f6294bd1010b7c00035b00073d0002256b" + "7d89747b8176757a8575828d7f96233661454fd5132dca366ae44351fa2427cc00086900" + "00530907724d527880827d87818f898596919aa31f31713344ea2941d93e55fb3e53ee1b" + "2eb100004704074e01003b6b6a8c949a8e9ca8907380aa3b4c9a1832bd3d5cff3048ff25" + "3ad100005700006408056c000047494d7d848ba57580967d89a18c9bae91a1ae869a9985" + "98927e88926f7a983d62e62241d72d52d71645c92f67e200034b00024f07044937414d6d" + "8380798c938286a38d8c8a9da6af8b9bcc1b3bb63359ec3e5fff2a49f21632db3353f336" + "55e3000067080f5f0100380b003d000029999c95838a6995978a837d898c83948c848f85" + "8376958d8aa990ad9a868f979378868f70879796718495011a5300035e3e59c02140bd22" + "42e23c60ff0329d6183bd72943b400094f080b423b354f475bb14365ed193ed40c34d150" + "6cfc2e41c200005d1413630004440b0d3d7772786e6874807d86706e7333342c22241714" + "150d1c1b20121536283ba13b5bd41f56ee093bda3e53e23b40c00a005903003a00063a31" + "4ac13a5feb3356fc1030db1834bc00004a000154000056060821141217121013010c2026" + "46b73662ff3946e40e31cd1037ba0c056c100062000047000b1b0000493e53e20938cc35" + "6ef14174ea00005d00034500004804004308031a000915304bb43155e13562f91e43d247" + "5ffd1b35e23150f62447df1f42da1a3edc2849f0213de63450f22c46db3a57fd3f5df92f" + "4dbf2537c94355f32e44f01133c81f43e23c63ee4265d9000b59000052040051120f1a0d" + "34912b6cfe2861f61636c73754f00000600b0f7a090977301e4e9a819650313735172149" + "2100571f00532204481b06491b0b491b0c431805471d04391d08391d083a1e093a1e093a" + "1e093b1f0a3b1f0a3b1f0a3b1f0a2e1f244a66c71338d12e5cef0b3dc41e39ce4e5ef100" + "006b000039272b489c9698aba09ca398a09b8fa3a498aea092a9796b7c71616c72646461" + "5f60645e606a5d64735e717b6b767c77746d6f6a4356774765df233bdb222ee62f50e94d" + "53e901006f00005001006a413f6e8b93b83f61c2214de13763fa2a54de1e36ba00067600" + "00620200515f62718791aa8899a3869a988797968088937f838f6668636b76706572921c" + "27b4394ef71541ea2658f92c53d600006100005a0015682047c84772ff163bca2a3fda38" + "54e44167f03158e32e57e54e71ff1e38cd3b50e73e56ec2755de3568f51f59e90f42cf19" + "39ca4b60f7242fd63c49f82845e73566e70a31ce4454dd00006c02005807095e19325b31" + "4eaa0a2dd12c53f01735d14c65f5040d7602056c0000381f26368993959a999fa19ca296" + "8f969996ab1420683544d12f55e4427aeb182dd63c44e500004902085e03016f7f8095a8" + "9fa4aca1af9e98a4a1a8b84858a3283ad83d5fe52541e24a55ff424cdf00023900044300" + "003c76728d918a789ba1854353864257b2294dd5305df81638e23b55ea00006300005703" + "04570b0146898aa886939b8d9ba48c9eaa84999c7f9895869c9a91a1ae7a859b7e90a62a" + "4bcc1539cd0f30bd5270ff2033c000034708005806004a4c546b788f85748a888b8fb5a4" + "9fb6a5b1a3819aa12047bc2952e21c3dec4968ff3252e53b55f42641c4000f7000004f07" + "01470500396f65889494929fa98793968da7a1a59889aa9586a58e8a7f908b859c8aa498" + "8b948e87758e8b7a989890848681878b94080b34070946546ada1e3ae33256ff2950f52d" + "4ee91c31b000096300004b0309293752bd1e3fdc496bff2f52ea3c58e01c36a500004c06" + "085f0000231a1b2f8577847c7378716d6c71706e1d1b201b151f10091123181e0d092038" + "4fb74563e52b5cf61747d91b31ba636de90200520e0e440000324361d92b4feb3e60ff2f" + "4fef415be301155c00004200005301000f0810051017100c0e1b395dab335dff1933ce29" + "4be2153cc50e0c790c0066050060000d4c3445b72f53f2144ad03767d3436bca00004b05" + "00500601430e073a000005000a081f32b54e63ff1c36d14050ed272ce04059ff1f40e535" + "5af1274ce22d51e71336d22f50f52242ed0827d72f4ff21d3cd53653dd2d43d53149dd21" + "3ad4213fd31d3ed93c5df62946c800004701003e020b5000131c3657b83c75ff3b72ff3c" + "53ee3650ef00016a00007a0900686b5a7a83707487736c3e251e3f1c004d200341170042" + "1a01451b05461c06481b06471d053d210c3d210c3c200b3b1f0a3a1e093b1f0a3b1f0a3c" + "200b3d210c3122253857b14568ff214de42152d21636c94558f2060a8500043c33334da2" + "98a0aca0a0a0979c98909ba098a5a297a5887c868578818e7f848c8c8a8c8a8d948a93a1" + "8c9fa38f9aa19e99abb4b300033b3c5de01a33d62f39f3486bf92827af000051060b5c06" + "0167696284a6a9ca3f61cf406ffd3967fa436cf82e49ca0001790000710d0461767d8583" + "8da8808b9d7b8d8f7e8d9280869280838a7578677c877f7b8aab2b3cbe3e55fd0633d72e" + "60fd2d4fca000051030363000b59305dde4069f71232c32b3bd9415af41339ca1540cd2d" + "5ae7345aed2740db3d51f04c60ff4165fb3a67f82a63f0194cd9243ed93c4bee282edc38" + "44f8102fd53565ed0c30cc5162e400006a060256090865172e623b56bd1236d42c55ef0a" + "23c53d4ee200006303006b080941464f56999a9ca29ba3a59ea5a2a0a39d9eb22a348d32" + "42d52553dc235bcc273fe73f4ce80004450003540000628886919d9099948693837b8696" + "9cb23f4da62438d53e65e61a38d6454eff272cc4010d3f0208420b044a817c928f827187" + "8b70505e9b3850b42a54dc2757e7264eee344ce400006600035103034d0c01398385927d" + "87887a878f80909f8095988399978da2a795a5be8c98b27791a24564e13058ed2444d73f" + "54ef2f2fc300004002005107004f5e657f7d9587758c847f85a98d89a47d8b7e89a4ab0d" + "34ad4268f90c2ddc294af73053e1425bf52d45c900086400035e0100480500389a8ca599" + "9798969c80868883908b889182a39788a99d968ea09d949b919a9d95939a938b9b909692" + "88879992888e8b7897919b675d7f3447a5213be63c61ff1a42e02345dc3a4cd600036a00" + "005d00002b4a69de0d2ed32a4bf03251e9425ee32b46af00024e00005d0408234e4f5384" + "747e7b716f6d6a616d6d6527252a110b1718101d1c10141612294057c74a6af12e5cf718" + "45d62c43c53945bb0000520000380000373f5fd6193fe02245e12b4ae32038be00004302" + "08440703570f0c170f1c0a0a14091c1a25496da9335dff2c4de8385bed345de900007000" + "00601209765562c8324ad00d37d93469ed315dbe4363b60003480a02580400350d092e0a" + "11090005092f3ecd404fff1d2ed33840e32b29e4415bff0a30cf385df42449df2347d92e" + "53e9355bfa2045eb1439e93154f61c3fdb3556f1304de64866fa1a38cc4261f73356ee3c" + "60fc1330ba00004208024200024509253b3d5cc81d52ee2557f63d51f24058f800026501" + "007a0c005d685769796a63928072432d1f3b1b0248220b3e1a02401c04451c06461c0646" + "1c06491f094327124327124125103f230e3e220d3c200b3d210c3e220d3f230e34242430" + "46994662ff0d33d41f4dd43252e34055ec0000730403453d395ca298b0a79ba79b92939a" + "968d9e9a8ea29e92968f87988f8aa4989a9999919a929d9e91a3a795a3a0938a96989394" + "9caf5a73c7476bf51f3cde1f2bdf365cdb00006909035d00045507074f8984a48e90c01c" + "37c22b4ef01e42e11a3bd800078300057d0200760f0b578c9898838f9d797c8d73778272" + "78887878927a798b7a80727f95806a858c2a4ea4445ef1052fd12d5bf9435ee100004601" + "005900095f4369f03358e42b49df1c27e13d52ff1534dd1235db3961ff3558fa3b56fb27" + "3ee61424d1303ce81d32d91c43e0173fd53956f0384feb3145e43757f70a35d13765f82a" + "4be83646b700076200004e0c076b021562253eb2264fdd3d67fb1933d04052e200006000" + "00650203396a717999999b9f959ea2979fb5afb3a09eb32f379a1d2dc1345fea2458d238" + "50f2313fd303084c04075604015aa4a1a8a79b9fa2959f89828a969db73e4bb4162ccd35" + "5de31e3fdc525cff383ed20001390002411f19598c85978b7d707d826b050f56566ada2e" + "5ce5416bfd2955f62639d500016200045504024b160e33807f858083888083967f83a680" + "8ca28191a18293a78190af8b9cae7c97aa2345c01d46de3d5cf5364deb474ad700023f00" + "004a08025869768971877a6c817a7b83985559628593a0576c9b3753da385cf0163ad92c" + "4ff3476aff425ef04056e700036200046005054d3d396cb4a6b5a39d9f95968686858383" + "7b7986798b8d80928c87818c8d7f898b758e8d79908a8e9183a494889ea1979f8c8a7597" + "93909790a21127701c37de365bff163fd71e41d33d4de000016b0002640003433e5ed716" + "3ad92c4ff1486aff435fe43e59c2000b5900005a0f102e7272747e757076726667655666" + "675926271f0e0d0b1513141612131112312f47c31232b91f4ce71945dc364ecc04107e00" + "0054000041050b494164dc0b31d03e61fb1938d0233bbf00044c00064200004928263120" + "2b1a1e2619322f3841619a3962ff2d4ee91e42d63962f00000731009730c0d774554d316" + "30b80933c72553e44c71d90000520a135804005105003006021d151d0e0f21394454db3d" + "4df83243f14450f24143f83956f81f48e0355df3244ce21b40d6335bf0355ef41e47dd28" + "54e93660ff143de3385fff466cff3159f6355dfa0a35cf3e6dff3765ff183cc800005804" + "005400004e00093f334ecf305cff3862ff192ed72a3edd00035801006b0d004f61505870" + "6051928171523c2e3617023f1c093e1b05401d07421c07441b07431a06451c0845291444" + "281343271242261142261140240f3f230e3f230e3f230e36242037458c3248eb213feb10" + "3dcc4265f53a53e400007500004627204aa499b99f92a399918fa19c899c9a81a29e859c" + "96889e978fa59ca19e9993a096a19e91a3a192999a9383abb2b86f7ba3445cca2d52e833" + "54f72131dc3157c60000520b075e020556090e369e9bb85b5d9a1c32d6142bdb0924cb0e" + "26ce00006c04067f0000720606448c9c9986959c9999a5918e998e8ca19390ad9492a88a" + "8f898097877290984e78c43b57de345af92b53f34359e005024900004c040f693e5deb42" + "63f0334ee3202fee374bff223dec0c2bd43e5fff1e3ee12e49ee152ed31e30dc2529e01a" + "27d81b3ae02547e6425afa475bfa374bea3d59f82549e7153cd93d56f1000263070e5c04" + "00510703643949ab3d55d33f6aed355ff1334ee54659e400036b0000611212469599a2ab" + "a9aeb4a8b2b3a6b0b9b0b3a5a4b63036a6202fc83661ee1b4ccf3d56f02734c000044d00" + "004c000046a7a2a69d91919b90968782888d96b54c57d32d44ea1a43cf3758f33e4bf138" + "40cf00004000004238336b908a9694837c8387760e196b4457d03a65f01441d22248f11a" + "2cca00026002045705014b3126447d787587827f9088979c97b59b9eb199a0b0909db087" + "96b5899eaf85a0bd193eb3123ad73757f84159f95057dc00024100004501025577849771" + "83756e807477818a616f7043557b00085a475bee3052e93a5ff53559f53659fd2140cf2c" + "44dc000269000056090c537e7aacb0a0a3aba1a2a29d999a9496988f928f858e8d868e83" + "818283847c858c6d868a71888389897da39285a1877d888b8974817e77847e8a3a53892f" + "4ded2b51f42951e73053e32534cd000675000267050f663355d33a5efc3559f8385aef24" + "40c73e56c200085900005c2b28477a787b77726c74716a615f53615f521c1d0b1418090d" + "1005161a19010930243bc50e30b80c38d51e49e63b51c9000064000058000050030a521d" + "40b82d53f23457f12d4ce23b52d404166000033f0000423b3a42343d2c414439322f3600" + "15481036d93152ed1135c92c55e500006e00006800036d4556ea243fca1339c8365bf220" + "41aa000053000043020048130c350c091c0c150205143f4457d7465af93d52ff4554f73d" + "48f21f41d6466fff294ee42b50e7294ce6254ae3365ef1234edb3c6af1325dfa1a43e92e" + "57fd3660ff1943e32a55f20936cf2658eb3467f83f64e804005f0000520002540000454e" + "6af2072dd81136df1d35d51729bb00034c02005d0c003f5c4a4665553e8675616f594b33" + "18033412063b1a073c1c073f1a073f1b053e18033d17043e220d3f230e40240f41251041" + "25104226114125103f230e3e220d3521183237714a57fd3e57ff1b46e02148d43652e100" + "018600004d08002ea294b59d919f9d9391a49d8a9c987fa09b859d968c9d98959f97a4a0" + "9896a79ca4a2959fa29696a09e91919bb61d2b6c304bd05077ff0d32d93c53f1446ccc00" + "084f00004e01025400020b9e9eb831337e323ffd2e3cf42234dc3f51fd000e7400007400" + "006f090c3f889b99889a9c878b8e817f827e7e8a85839b87859b85888f6e7e8b647ca04f" + "71d51a35b84869ff1536d91b2bb600003900004d050b69354de15473ff1736c52e44f03f" + "57ff3750f2344eed253fda1934cb314ae21a33cb283edf293cee2e45f32043e93150f629" + "39e4454ffc2a2bdb3336e73d49f72d44ec4f63f600004c04094b0902520000555f6ee33b" + "52dc436fec1640d03a54e53145c8030870060067161445979aa3a09ba1aa9ca9a696a1aa" + "a1a4acadbf3d43bf4452f0224bd90731c33a53e41c2baa00025002004c050239a19d9e94" + "8985938b899492937d87aa3742d23951fc133cd24164fe1827c200028b080f5d01034d54" + "5180918c929c8a8a8e8f874b5ab71e32b71f42d41043d22944f5243adb00056301015700" + "00494d3e5d84776f9080709f8e86958588928d8990918b89949a8392a9869fb557749e2e" + "56c8214beb1d3ce2425afa2630ac00024600003e050b57919eb18f9b8d8c978783928d7d" + "9599061d604355c54c5afb203fd73963ed1139cc0d2fd92646d7314be62b3eb40e19752d" + "317ab5b3e2aa9b94afa1a1aa9ea8aaa1a6aea6b199949a9491989291a19599a291998c8f" + "9686908f8b948ba0958a9b99909594917e9b9893928c9a7a96bd3e5df61137d81941d63a" + "5ae91a28c6030d800000690005722142c73960fd1137d60e32c62a46ce334bb900004f04" + "00605851707e797f737176756f795d575b5d5854181a04131c000b17000d1c17000f4022" + "37d21232c12e5af73259fc344bbf000a6b02025c00026100004c2246c0385ffc1738d122" + "40d45c74f00009560309470100453b3a3f323625414135353336000733193cd62748e11d" + "43d6345cef0007850000680003703a50f32d49d92449d62c4be300006a000b6700055705" + "00401f19332a2730232b14000a462c40bb435bf12138f62036d71a2cce1c3ec63f65ec17" + "39ce2544dd405efe1939d93c60f42d54e03c67ea2044da3051ee1c3edd072bc9264de620" + "48de2953e32a58df3666e61637aa06005301005200014100004a1334b51233d01a3bd415" + "32ba2c3cb50003420200500e002e5a483a5d4c2e806e588a77663a200f2c0e0435180636" + "1a053918053b18043a1502391402371b06381c073a1e093c200b3d210c41251040240f3d" + "210c3c200b36201312113d555dfe2136f12f5bfa032eb83b5fe71f28b100005709013487" + "7d969e939ba39896a3998d9e9488a0968da09798a298a19f96a99b9096a5999b9f9594a3" + "9b989a9da41a275e495ab44765f72d57ff1a40eb3048dc173f970112570000530000490e" + "1810a1a5be2d3284212df52c38ec3749eb2738de00056200006909077423275791a3a592" + "a3aa9095998b8f908b93969799a8989aa9aeafc19da6cf4450983e54dd213bc32a48e60d" + "2ad02330ba00003e00004c0000583b4fe63654e62344cf2847df2b46db2d46d63a51df1e" + "31bc3447d1485ce32e44cb2033c02e42d9344ce22442d6334fe11e2bc54248e42622c12d" + "28ca494ce93d4de03846c9000556000042070050080c4c5766db283fcb325ce41941d63c" + "57e21529a60407700e066b3e3b68a9a9b3aba4abb3a3b0ab99a79c9195a7a8bc3e44ce49" + "58f91f45d6264dea344cd400077b03075e080053100b34aaa4a6a99e989e9993b1b2ad73" + "7fa51c29c73852fd2b56f23358ef2c3ece00007503086302045169678c8b878896858d92" + "92924c59c11f32bf0426bb2d5def3953ff3f52f602086601015b0000455b49618c7968a2" + "896ab79b83a5897da090809c95839599988d99af839bc11d3b791a45b62d59f61031d838" + "52ed00007101065700044200003e70788f6f736573786473827b7492aa3756b03047c737" + "41ee1e3bd4335bde0630ba0226d23052e93653ed4155dc0003610e145e8888bab4a69dad" + "9f9ca79aababa1a9938ea575768873758a797ca57b81a382879a858b8b8f9281928d8a95" + "8c91a3999a979185918c889a929d86a5c23959ec0a30d1052dc24262f12433cc000a7d00" + "00700000741d3fc73158f5062ccb0528c03651dc3f56c600004e02005b736a877b757973" + "72787871815d52605c5157211e0b0b150012210e001220162a732b40e73a59f11540dc2f" + "53f2152a9d010d6f00015b04096f0000594369e6375ef91839d20c28ba3d53cb00025302" + "064604024334343431322234322644403f1b33593b5bec2e4de52951e63058ee2738ba03" + "14862142b32a45ec203fd55270ff2f48d9000d7900005c14157100012f2b2735403c3d38" + "402b141d601a30a83c56e90a25e41330cc1932cc5070eb2949c01e39be1d37c0495ff022" + "3bcb3f5be23250d22f53cb223abe4255df243bc5132db8314cd73856dc2544c34768dc32" + "54c20010750b03500407560202380009652446cc1f39d42c4ae03b5cdd00006800034102" + "004a0f00255c47325c49287b695393826e442f1c260b0430160733180536170537160538" + "1502391603371b06381c07391d083a1e093a1e093c200b3c200b3c200b3c200b38210f09" + "031f4950e90a1dd93362ff0c3ec33b66e92837c40000660e093f544c599c918ba79998a2" + "9197a4939ba290a0a293a8a395ac9e94ada294a3a69b95a19b8da5a4a0888db75766c369" + "7ef1092bc01842f03157ff213cc100035b00045506046f04015061695ca0a7c14b53a81e" + "2af01c2dd32e43dc0318af0003570000610b0b6f33346a96a3ab96a3b4949dac909ea194" + "a4a19da7a8a0a5aba6a6c08e8bd81515872024db435cec2745e52641e63240c30c0a5e01" + "00550000483546de1332ca335ae3224bc70b2faa000f8b000c8500007500007100027700" + "097d030d7e00046e00016a00076e000f78000069000775000067000068060e7900117000" + "006b0303670000570a02572e38515266c73c57dc183fe22a50ef3752d50011860306710a" + "0265525077a2a2aca29ba3a795a39f8d9b9e92969a9cb33d44da2e3fe4294fe2395aff3e" + "55d500006303066700004f0a0525a6a0a4b0a7a09f9c93a6aba45a69902c39df3c5bff30" + "5cf92b50e64458dd00007300005d0200547e7e988c8b8691818e868b8f4e51c22937ce1f" + "49dd0f33c93b60ff4f57ff000664070865000049543f48795e40967446b58d6aa87f6ba1" + "86719c8b778d8c8a8188a5637bb91d3b93123fb23564fc1a3edd3550e500006900016203" + "0848040d447878947a766a7e7d697d8c910e32703a63cd4669e71b28d93b56eb355cdb24" + "4cd2183de31436d64a69ff495ef900005b000351444681b0a59faa9f99ac9fb0a7a0a761" + "5e8b424975454f80505aa2484f935f5d9e6f718a8b90708b88698b807a8276768f83838d" + "858382797e6b8aa73859e6254bee1b42dd4462f43748d600057500007500007a3859e432" + "58f92248eb1b3eda1a36c54b65d600055900005871677f76716d7675717d75845e4f645e" + "4e5b231c120b1009101b1f0011442c40b02c40ef1d3ade1039d33155eb00087e00006701" + "0358040d720000682a51d4446bff1b3ad22b47d700017600055b00004500003b33333142" + "3f303c352b423e3b1c2f4d1d39c04968ff355ff31740d82a40c700047e214bc3183ad901" + "22bf243cda4558db0915810f1681000057020621393534413c382c3021131d5a2439b639" + "52ea1532ee2142db3050e33551bc000464000369000061000e7b00006800097500046c00" + "066a00006a00016d00006d00057600006f00037300077000096a00005b00004c02004500" + "02530b083d202fa43c5df63f54fd2d43e72647d200006f0002460200481200205f49325f" + "482877624d9787705e4c38240d072c16092f18063318073518083716053817063c200b3c" + "200b3c200b3b1f0a3b1f0a371b06391d083b1f0a3d210c3c230f231b2a4e54e02c41f42e" + "62ff1b54d52e5fdf283fcd00047e000036232029938a81a59797a18d99ab94a6a38da4a1" + "8fa7a091a89a8ea4a093a59b948a959384979ca2646cb7404fce4158e22246dc0833da21" + "49e93d59d400066700005c00007308024c959a9373819c4b5aaf313efc3248eb233dd22c" + "49d33854a800005800005c2c2b648c93998e99af8f97ac8a98a38a9e9c8e9d98909a9b84" + "84a64c48a72422a72e30f4314ce13451f52d46e9000780000065110d6c00003c1e2ec118" + "3bd51944cf1f50c71a41b800057900017301057100006100005c07066400004f060d5300" + "0040000950000852000d5a00004f00075800035401045100024600004f00005a09026201" + "004748565f1a2d93253fc80026d3244aed2340b800006900006e000058686787a7a7afa9" + "a2aaaa9aa7a593a1a89da5979db74953f22036da274ce20a28d6546ae400066a00006407" + "005f110c2aa7a0a8ada5a2b0b2a59da59a3c4d783341e8193add113fdd3257ed243ab400" + "047601026c0401589093a49899919587988185903b41b3414fe63a64f81d41d7375cff47" + "52fc00005f0d0f73040052452b38512f136c4116905e3db27f6aaf8d74ac947c9e978f8d" + "92b01d358f2643b82a58d03062f5274ce53655e1000672000067030750000030847b9693" + "8882898278657491335bbb174abf0733ae2b3cea314cdb183cb62d53d23f63ff1a3de337" + "59ee3e53fc00096a00055704094d9c979baaa198b6abb9a9a4a84748892d3b8637489a48" + "59c33a44a54d47a7676898969b7d918f69988a879b8c9192858c958d8b948c8a415f8527" + "4bd52a50f3284eef1e3cd24b5ddb00026e00007500057a2e4ed71437db2b4df54062ff1f" + "3dcf455fd6000c6103005b6a61767a766d77776d817686614f675f4c5f1c121013171a03" + "0e22071965374bce3348fb203ce8244ce23d5fe700007800006606095a000b6b00007718" + "3ec51f47dd3150e83752e100007000005703034d09063d3637323d372b41382f3d3c371b" + "2b421d37b23554ea2f5bef153cd72a45d000007c2757d50e33ca2b4bee1628c800007300" + "006700006502015f0a101e332f233c37313839332d38663348c7354fec2545fa2449df31" + "55e72a40af000b6a00096200015600015200004700004c00004e000b5d0d095d00004900" + "004f0000540307600001590e126900004c0f0c5d04004a0f0449010a4f0704312d3abc20" + "41e42939e71e30da3e5eed00007300005003004d14001e644a33614829755e4ca090777d" + "6d562a171029150a2e190833190a35190b3818093817083a1e093a1e093b1f0a3d210c3f" + "230e3c200b3c200b3b1f0a3a1e09371f07241a1b5056ce485eff3165ff3875f4053cba38" + "58e75465e700024716172b9e969497888dad97a3a58d9b9c8494a2909ea999a4a399a2a1" + "96a69c9b978f918c8e99b7414eb7182bc7475fff1c3fd7224be32f55e44661d2000f7a00" + "04820000760000378d8e934f5f832a3c8e4051ff304def4768ff3e63e74e6dc800055400" + "0455211b578d928ca1a6bc9b9cba979fb68a9ba294a4a197a7a79ca4c82b31912b34b520" + "31df3459e81a37dd3d55f50002700305800000590d18452f3fca0e34d33e6dff2d5ee72f" + "55da0000760a168e08076f0c015d09004913064c0f094502133e00012c00104100073f00" + "0b480009470e0d4f16094e13064b0105450002460705461510520300378594a92638b818" + "2fca1338df395cfe1d38a900086b00006a04005a8e8ea88b8b938b858f9b8d9ca695a5a1" + "97a2525b7c4453f81730d52f54eb0f28dc4257cc000060010278130574171230a7a1afa7" + "a1a3a3a99b9eaa9e1126534559fa1639d51341dd4065fb495ed300047000006e09065d8c" + "929e93968d92869a8d8f9c1f2d985466f81d3cd42050e21d36ea4257fe0000610c117901" + "005b3c1d3d4a24196e3c21884f3b8e5647b590758e73559f9983898fa9465cd63e58e944" + "74f23e71ff4b71ff1839ba00006a0000860000540805327365767d6f6e645a6336458a36" + "61e30030ab1347bd132fd1445be50000723a5dd51538d23053f71e42d8445bff283fa705" + "156d000047a8a9bda6a39a9d989ea4a4a45359ad1c30a11b31ab1f34c33d4bc55f58cc3c" + "397e8a8c817d786491818b7f6e7e8e818a817a7477726c05225a466cf34066ff294bf317" + "31cc4052be0009700000770000623a58dc0d2ed53052fc2a4df13655eb1c38b300035b12" + "0e6d6863776a675e78756e7f72835c48635640551b11100e131916203900004e3a4dd736" + "49fd3851ff385cee405fd400007b04047c0206500000554f61e70b32be3961f74d6aff4a" + "65f2000371030b6e0403510907393839333d342b42373141423c303d4d3f55c52341d531" + "5df11e42e02241d03e5fea3b6df22b51e41f3be42837d200057400006f06037801004e25" + "29323d3822423b353c3a3d3d495f5164e5253ce22d52f9406afa2d56e62b37bf00007504" + "036103005107023c04003206063a00003704074a0c01460c00430e04490a094d05084d00" + "024700004405004b1a0d5f0700400901340410400000192734b63556fb1c2cd91224cc1d" + "3dcc00007e040468040057260e325d412c5f4125765c4b897a5d9b8d7225140c2a180c2e" + "1d0d2912042f15063316083313043a1e093a1e093b1f0a3d210c3e220d3d210c3c200b3b" + "1f0a3b1f0a391f0830231b2b34914b62ec3467ff0f4fcd1c58d4163ccb2037c103136a00" + "0733827f92a195a19f8c929f888ea18d8ead9d9d9f9393948e8e8884937a7c8b888fa218" + "2863374bc81329d4455fff294ae54268ed4d71ec00006700006e060795000074372a60a1" + "9eaf384c7e20388e3d53f60d2dd81133db3c64ea496bcf00004a0109542a266392968791" + "92a48e8ba0a3a4b9919ea796a8ac99abb56f7fb0384bb23850ce2f54ea3d68f32540e737" + "4ce70009700000860d0d710005233a4ac4325af83164fe2f60fa3b5ff12c41c100006e00" + "005f6a5ea8a392c6a390bda496b78e8fababaecd8b8ebb8b94cd8594d77583ca7077c781" + "7dd2938bde9392de7678b19395be8181a79699ba818eb83a48e6354cf41e45e24062ff37" + "52b900056101006f0b055f9fa2b59da0a79a97a0a296a4aa9cad908a98526188273ce30d" + "2dd03358ef1c32e74a5bcf08167700007a0a00712625449f9bac9e9ba29ea99b93a3990b" + "2256162dc91d42d90936d14267fe5266d608157b060472000052868f968c94898e87998b" + "8d9a1424863b4fd61130c62656e81630dd4760ff2934a800006e06066a2d0d3e4d28224a" + "1c005a27087340237e5c378f775376706060658f2539ce122ad23464ea4276ff1940c914" + "34af000c7600008b070364372e5bb6a7acbbadbab4adcf2a36a42c58ed2863e31f55cf2a" + "4ee23d51d4000371000c7e1033c52448e6062ac63f59ff2238af0003620514696d719695" + "9690a3a29ea0a4a3515cb82d46d41a34cf1d38df4859e7312bb137369361627678727490" + "849296899a827b83918e9592909d2a47973c62e93359fa597bff1b32ce00046300006100" + "007b020b5a4662dd2847ed3d5dff0629cf2748e31433b203177600005936344c70716b72" + "6e6270646e544258584759160f1600001308143a3043a13b50dd2236e32137ef5778ff50" + "6dd300007f00007b0000430007544c5fec1941d4365ef44461fa4b64f200006c04087306" + "04580b093835383140352f4c413d3d403747515a374bae1331c5335ff3294bea304fe544" + "69f83162ed4266f8334ef71c29b600026d02007507007006073f32373b403c213d35323c" + "39402331323042be233ade1940db0e39c6466eff242ccc03008a0b036606004b42375f40" + "364e3e38523631513a376439325c241d49060541070a5900005b0207650a0a6408014e10" + "0442180b4007032405162a0004103040ba3458f71c32d52e42df1633bb03048303007506" + "006322082d5637255939226b4f417e6d4fa295755241372312082d1c0c2b15072d160833" + "1608391a08391d083a1e093b1f0a3c200b3d210c3d210c3d210c3c200b3c200b3a20091d" + "10003a43843d55c33767f92e69e92660dd254fdf2543d52f47b100004a4c4e819d99b29d" + "91919d8f86a69986a198878c887c93948f8c8fa2949bc73c4681263b98435fe42c48f429" + "43fa1e3adb1334a54262c700036f05068501008f0d0a7d716289948fa61f34772d47a644" + "5df8082ae30f33eb2f5ced3f64d7000e61000654000037abb59d919297aca2a1a49da4b6" + "bcc87c8d9f8b9ebc031a603a5bce4975f20d4ec64274f93f58fa5061f500016800008700" + "025f1521312c39a22851e72e60fd3b67ff274ae63a51d500006e000056635c908c80969b" + "8e989d888fac88a49d799da48bc48c88d55466c8405bc4274ac22d4bcd3c4eca3c41a581" + "82bb9799b29fa2b19098a5626cb14b55ff495eff3a63f14260fe4660bf00025600006d07" + "01579096a490979d91949d96909c9e96a5a3a0b3172c5b243fe62d53f2325af04257ff2e" + "3db0010f720301890d0479515473a4a3b3a3a5b2a0ada495a8a6344d8d3550e52a4fe620" + "4de41334cf00006c0007690705720001538c979b8f9a929493a389909a3840954050c91b" + "44d4355af1123cde2c3fe4374ccc000176000068270b462c10045333005d3a005634007c" + "67325b4c256f6c73050b551b2ed30f28dc2f5eec3364ef4268ed4565dc000d7701019301" + "00635a4c7db8aaa7a79ebb7e7bbe2d3bcf0028c5396ff32154d4284ed3000683000d7200" + "00651d3cca365ced1639dd2945ef3e56dc0000650002613a4178969799ababa19fa3a241" + "50ad3450ef3251ff112de64256f52a29c200006a00003901001c94909f98959e96979c7b" + "7ea1777ab12f4abb072eb73960fd3455fa2f44db000054070767140e8c0008415870dc3d" + "5af63656f90d30d43557f62143c82b44ab00007025294e575d5d73735b706b67554b5658" + "505d1514220e183c000037384aba5165fa3245e90217cc2241c00000570a048a0b008207" + "0946001053465bea254de3274fe53c59f34760ee00077106077b07025c090832282b2433" + "28263c30302f352b3a42444251ac1836c82e5bec203ede2145db3d66f62650e02f4ee42d" + "45e7313fba00006d09017a0500630f13303e4148433f22413738443e482937265567d541" + "58f3244cdf214cd92e56ec4950ff00008c00005d1b135e392f48453b3a3f3a373b363a3a" + "3748414b4c29383d0008432634af525bfe2f38dd353cc0464a930c0e2322222e0c0e1d01" + "150c000a083d52bf395ef4415def3651de2e4ac700007803008109006d21072a4f2b1b55" + "311b6b4b40715e3e978a68786a5f2012072816082d170930190b331608381907391d0839" + "1d083b1f0a3b1f0a3b1f0a3d210c3d210c3c200b3c200b3c200a372413000022455aab2c" + "56de3267e92358d83761f3385bf52543bf5066d3000150a7aad7908d9699918faaa29593" + "90899292949298a67d87ab0000472637931d37ae2347d11132d9536eff3c53f12039a000" + "116d000b780c0285110c8d00005597889d766e860e2479415ccf3e57f21534f12b4eff36" + "61fb3057d6425abc000057040b53839587a5aeb5aaa5a1b0abb2868ea594a8cb495f911b" + "34982f55de3465ee3780f10033b52237ce000081050d7801068600004e5158620812690f" + "36c13b6aff092fdc4c6eff3a55da556ce00211623a3e6da6a2b1b7b1b5ab9c99c7a1b8b1" + "8cadad91cc2a257f3c55c94164e23462f32d55f5243cd04f56c18888c89998c28f93aca9" + "b4b8293483454fff384dfe365ced2642e328409a00024e00006e030052949da4939ea293" + "9aa296949fa09cab9fa1b808235a3255f73661fd3159ef475bff03108300016a09089400" + "0063626787898f9b8b90a389999682979c4e68b54766f5153cd5305cf1112fcb00006500" + "046300006600004b818f9285918d8a8e9a80898e5660a52a3da31b44d22f54eb315ef751" + "69ff2f48d600047c00087212003c3121113c2b004634003d2b003b320b47413321235659" + "5ed41e33de2f47ff3765f92758e5375ee14462da0000630605910a05697164909f97958c" + "8ec10f15755466ff0428c71c47d24973fb385cd60000700614750003692d4acc375de429" + "4bf3304ff52741d40002760011770d155d9999a5a2a0949697991020754162ff0d30e23b" + "59ff4357ff333ae23037c50c0f6c0c0d467a7b977f85958894a4515c9e4048ab3e5be518" + "41cf335bf01639d35466f6030b5e000057140a84060b331a328a2742d1223fd83054f328" + "4eef294eda3350c500007700063c626b7a82866d7e7f774949533e404f080e3200044844" + "53ae4b5eeb3e51f6293cd61f34dd3856c800106302007b07007908093f000543233ac831" + "5af21a41da3d57f43249d700097206068005005f05042c181b142014141b101421291e16" + "1b175665b63652e23d6afb2f4bec183bd52f57ec2c50e4445ff41b30c700006700006f0a" + "0373030053171e28393c43433f26463b3f443d453d4c2f394da4435be13259e54a73ff18" + "3fd83241f2272dc90b0d7100003e363243444035403e31404038393a3e1e323905203522" + "3c872c45d3384dff3649ff4857e83641910e152f02071a15182b000e00000d11495fce3a" + "5df94468fa2143cb465bda00007c0402870b026f270f294e2916502a1568463c65523180" + "73518f8178302217210f012e180a351e0e331606361703381c07381c073b1f0a3a1e093a" + "1e093c200b3c200b3c200b3c200b3c200b361c0b23262f09194c3f5edb123cc43965ec33" + "5bee3357f60025b13758db1a329e17256e9ea2c89494aea5a2b57f809e8e92b85862971f" + "2d762536a2243ab43556e14972fe4165ff2b4bee475ced00005f00005d00007105007200" + "0055323278ad9da07d75820f2690405de7223ada1b35ec1e3df03e65ff1f47cd2842bb51" + "66dd0000557993a07f93ae8d969f80889f8fa2cc0b256037519e162fb03151fa1740e614" + "55d51344c50000800a0e94000075070b772120628e8c9745488b1e45be1a45d02845eb11" + "30c91637ba3f5ed30000530b1f54939cb97d849685888d8281899794a94542775762bb1d" + "40b62e56da345ffb3651ff242fc9090b6f9794e39a93f2b0acf69daab22635784859f136" + "4eec3053f90c24ce000a5f00074d020071020050899798869598828d9380848f8c8e9b89" + "90ac2241821a45e12456ed2f58ee2d3fe7000070020a7900008f0002667a83a08691978a" + "92a97c9091738a9a4961c13150de092fce3562f31f3bda06148100005a0b096a080c557e" + "90928494938b969c9ca4a67d92bf203b8c2d51dd3d6cff133bce3154ee425bf62c4ac600" + "036b0e0b402a2c172a2c002d2d0031310b393c43171b41484dc32b31dd2136dd2b46f72f" + "5cf72a58ec1337bf3753d000006b00007e0e0b64958eb09fa1ad000f5c11249a2641ea25" + "43e14662f41e39c800006e161a88000266000c703550c33b60e42346ec3b5dfd3e57f92c" + "45c3000d77000052a6a0baa89f969a989d1a2c6c4061ee0427cd3a57ff1e33e61324d62d" + "3dda00006c00085d8d99cb8b9bbf4b618a3a50b62032c24465ff1d45da345ee61337c134" + "47ca0e126b0000550b006e2a2e491f33781933ae102cb42b50e73e65ff163ed13c5de052" + "62f610206e1a284b828b786d78703f4c5c19274400064b2c3daf1122ae3749ff1d2eee06" + "18a8293ed500006300065705007708006e0f1040021a56122cb53d66fe153cd74059fb18" + "2dbe00056e05028305006208082e12150e1a0e12140b101420160c0f0647539b2945d435" + "62f14058f81e42de1941d7152fca283ecf5163eb00016d0000730703610202401d22262a" + "2b2f36311e372c32373131313e2000154f4964cb3e62ee3a5ff51c40dc3e5ffa1631b400" + "0055000e493a435440453e3a40363d433f2c353a0a1e63536dca1939a83258df3e64f522" + "47d63a56d300005a1b226a0b0b51111242000a0a0010304e63e33250ff204be81137ca41" + "50dd0208900102810701652d16264c280e4c240b5d382f604c297164449c8d884f41381d" + "0c002c16083821113518083d1c09371b06381c073a1e093a1e09381c073a1e093a1e093b" + "1f0a3b1f0a3e1f0d5030213533261a23402137ae2e4fda3357e32f53e72d50f41841d73c" + "69f61e44bf3f57bb262f7a0a0d522e2d6f2124715056ac404cae2131a20e22a92f4ad90b" + "33c8305ef12d57e71a3dcd1c2daf040b750000611013880f006f110f509598c5ad9b919e" + "96941d35af3653f5172dd1344bf3142fd41a3fe51640c8233fd13c52e6495fcf001f4f81" + "a0d98ca2d1546caa00115c2b4ba03b58bc2b3ed84559ff3b57ff2656e60f37ba00007900" + "007c1b109200004d666295aca1b19290c24f72da1a43c33e54f73853ec0f33bb4b71f048" + "6dd50000524e62a190a1d98a99c441597b293b6b32428f2b43ad2f57da2957e12d55f23f" + "51fb2627bf05046a0400600d037e00005564737a43539e3f51e33851e93b5dff1a32dd00" + "004c00115300006d00004b8c9c9b8a9c9c8b9aa18c959e9aa0ae8896b3355aa10f41d82d" + "63f72953e7394bed00007601087d00008d060c647a89a07989887e8aa281959c778fa93f" + "56c64261ef173ce33d67f7142dcf000066000762090865242b6f85989c8da1a295a4a787" + "928e7e97b52644842347cf1f51e4153cc81840d61732d93a5bdc2240ae070c60131d382d" + "3736262d3312183800054339489d4756e51524d9334ae81c39df153fdf1f4be83252e144" + "5dde020e7a0305720a0a54a9a7bd98a3c14561c52546c93758fb4057f54552ec4c58ea00" + "067706036e05026d00076c1b3596365be00124c60e32d12f4af34964e900006c00025b95" + "8ab2ac9f999a929d5d6e9a3052cd294de1223de40c1fd31d3be9435dfc2c40c53241b611" + "227a0f2570415fa84a69e80825c73356f80025bd3762e22148c100047d0705661103650b" + "00646665776374a8334bb52d49c40f34c33e68ff0834cb1b40cf2436de0000600113556e" + "7399737fa5091d4f152a692e46aa455ce8243cdc3f56ff1629e54b5de52d43ca00005701" + "0c5e15067d0e0069181743324c89213cc13760f6143bd8445dff1b2fc2010c7501008305" + "0065101036181b141c0f182117200a170d1b1f11111c5e1733c21441d0283edf385cf822" + "49e44559fa2537bf3c4dc300077800017505054f0306331a1d22191a151e180c1c11192d" + "261e1e280d00183737559e3a5be82b4ee80d2fce3461f8234ed04768c9284392000e4137" + "41652b33582e37621a24591d30a83650db2849d4032db52757d71440bb2343b400086f0c" + "0c6e02005d040444030e100015444960e42d4aff2a5bf61a44d64752e000048a00007a02" + "005a2d181d482404471e02573126614a286b5c3f95838372645b221101291403371d0c3b" + "1c0a3d1d08361a05381c073a1e09391d08371b06381c07391d083a1e093a1e093e1d0e2b" + "07001611002226313b48ba485eef1b36c52240d62c4cf52f5cf7265ee92254d73a59d646" + "52cc4549c44a47c82527b0383dcc3644d93442e0415af44362fa1a47e01c4de74773fa11" + "38b100047000006c18178e0000791100658384a0979cb0a99781a8a3902941c9334fff27" + "39e34658e8344ed90728cd244ed43d5cff233cf01d38c33057b23862c8365fcb1d47c01d" + "4bc3234dbb4063db3a46f02529fc3036ff3d51f02d4bcd00006f010072000078080a479b" + "93b8ab9aad958db44160ba486de22b39da445cfa375af22e56e90a35bf3b60e2213bb43f" + "55cc1e36a44f77d92646b31a36b32f50dd3361f4174adb1b45d73c4ee00a07920100720b" + "02770a007f100c6a6f81833a48a91b2dcd213ad5284be53950f800004900104e00006f0b" + "0a56778a847a8e8d7d90967b88908a94a07f8eaf476ebd2c63f4376fff1541d54959f700" + "027e00007701029226327e8a9dae889d948e9cb67d93a07890b22c44c04868f7294af939" + "62f0263ee0000068151a7500004e3941807e9396879ca1899d9b839087849bad5e7cae30" + "58dc1846da2756da0b30c60b2ada4a6ff34867e6282dc95c62da5359cb4a4fcd242cb552" + "64e23e54ce3d5adc2e4adc3952e32e4de6113bdd1d46ec3957ed2e45cf00006c02076520" + "255d92999f102459345cd52250d9325beb3241e23a3ad82c2dbd0000740000601a118404" + "07700823741a3bc8274ce3284ef10c28d2516cf7455bd300005a4f3f70a8949396889783" + "93ac3355b73053d3425bf33243f12d58f52e54e71632c12d41d85668f8243bbf3559cb2b" + "57de113dda355dfa1f47e42d5ad12a53bd00006d00005e0c00600b005b837f8d5c6e922c" + "449e4763d01a40c90a35d92f5cf7153cd71e32e94258d05464d33d38ca4f54d43f53c43e" + "58c9304ed02c4cdd3759f03b5cf73250e4485bdb4258cf0014660000500b006b0800580e" + "0d35425b9b2541bf315af01d44e1445dff3549dc040f7800008303006716163c1d20191d" + "101a241a2508180e1f2113000240314cdb1c47d4182ccb4064ff3c60fe3a45ec5d6de700" + "006300007500037102083a060b28111320121406140d07140911221c0c181f0d00171e00" + "17441e3dcc3858f81030d02a62ff053cd41a44ce3354d74f5fd8444dc43237b5373bc02b" + "32c03b49ea394cf04360fc143dcb1542c12a54cc00006a00076c000055130b6e00004306" + "110b000f3e425cd7233eed356cfa2455d5353ebd00017b0002740203532a1711421f0045" + "1d00532b215d46246a5a40826f738e7f782f1e0e2510003117063f200e3a170336190737" + "1b063a1e09391d08371a08371a08381b09391c0a3a1e093c1c0d3c180a3c320f1a171204" + "095b3642ba3b4dcb1e36ca3855ff2a53fd4473ff2e5bea4161f03349db3344d83d4ae622" + "2fd31a28d11a2bd94c5dff1935d41637d0355ff31640d41137b43e5ecd0000660e088200" + "006f0000601c07549698a49ba0a6b09f8f9a968b2b40cd3551ff2f47f22c41d24f6bf223" + "46e03b63e73553ff1932ee1e3dd33b62db3c63ec496cff264eee3867fb1e4dcf1f4acd2d" + "45e72f36f61f22df1e27c00002850505750900761c0b8b0c103d9a96adafa2b6a6a2bd00" + "0c4f344fb62530d83046e95276ff3058f50a38d4113cd61f41d8304ee22f4edc1a4bd633" + "5ded1e42d83b60f92854e90936c51d42c74a59da00007203007c03007108026e00034d58" + "6b792e3eaf172acf1c36d30d33c4435af500015a000654050275272a6d83969084989680" + "93996f7d86798792667a9d3358b13566ff386bff072fc42c41d200088100027d00008731" + "3b798596a8859a938a9baf829cad849dc6253cbc2b48e24460ff4767fa3f4fed040b7f00" + "0055030456555b9584979e8d9fa9889a9c8896897488917992ba3255cd2246da2c56de3b" + "5cf71b3aec1238c12d4edb1b2be23748ed505eff4653ff1f2ee32037d2465fed2f4ecb23" + "42c12340c84d6dff2950f6335cff314fe32840c404107600004b383d779fa4c25268be2e" + "5ee62c63f1224fdc3d4bea2923bb050087080c7a0d0165060062000057354b872745c13d" + "5fe7294cf21432e01531c13c54d2030866190b46baa6afb2a1b1a5afb9304c954b6cd333" + "50dc2843ec214fe33660f01b3fd1405bff3048f01c35d71c3fcf254de33961ff4262ff39" + "57f34566da00056d000b740a026f0c00570f004f706b7260687f000e572437954869ee20" + "49f12651f6355cff102ae32840c83347ce2126e44b59ff3a53e44c68f70629b71b3ed04e" + "71ff1f43cf203dbf0000720003730002610606660400520d004a131337495ba73347cc43" + "61fd3452f24256f7485aea00026b0000770000541716361c1d171e121e1c142113211414" + "19050a164a425ad83459e81124c91c3de0294aed111ec24353cc000063070a8b01036a07" + "0c2a09101a0c0c1612150419140e1d1417120c00171a0f0b211e00142f253db93a53ee37" + "4df03561ff1445ea3c64ff375bf72944dd3244e21e2bd22531dd2833e75565ff1e30d81c" + "36d5395cec1f43be3859cc000065080d6b1d137400005008053c040e100000403b58d608" + "2bd10f45d92857db000a7a020d810104750b0a502817073f1c00471e02462015573f1d6f" + "5e447b666b9f8b843c291a220d002b110042230f3a15023717083819073b1c0a3a1b0938" + "18093818093b1b0c3e1e0f3d1e0c381b0b371c0b3323093124141d182f5f60a14a51a931" + "42ce213af91832fb273aec2a3edf3958f12951e4143ed02e58ec193ddb2141e22139e433" + "4bf32643dd1432c63c59e33e59da1f34a9000778000270010075090170050035766e8399" + "9ba89394989a8f959693a83343cc304af52a51f71d3ce4375af23c63ec284ed5405fff34" + "50fa3454e71335bd1c34d62e35e62a36ea3a5cfc2053e0073dc31545cb2645d1293fc930" + "3bb90000880200790e0a7b00004f4750718189967f86907980926171954657a5212be437" + "4cf53a5efa0831cb1745e32652f1254de33258e9355ce80538d12856f12e57ef3559eb3d" + "5fe72341c53e56d20000700000780600820b026b1519564c5983647ba4374ec22e47e923" + "43e31841cf455edd06128a00007300006b28305f72837d74848184939a909ea98d9fab82" + "9fc13554be3557ff0f33e11336ce314bc4000a7a00007005037e5c6090888fab82919679" + "8d987690ab526c9d354dc7172dd91d2ff12634d23238ca01067c0000670000486d76a18e" + "9aaa9da9b99ca5b4a0ae9f8b9da191a1c206187c4f61f34d62fb384ff73e5aff1c3ed52e" + "52e60c36d62a52ef3256f41a3bde1a36d72f49da3b52dc4055d43d52cf183ac04b6eff38" + "5dff2c53f9385ae000077c000358000048524d9f4b45a52c3ebc2356e7124be21c4be345" + "54ef0000770e067f0203601304611c0e599a92cba1abce31479d3f59d03757ff3857ff1c" + "39d2435ee300025f00003da394a7a4949f9d989c000637455fac3b63e72c57fe0b33c83a" + "62f52e56e92c53ee3a5cfc2e4eee354ef02234de2a3ae8212cd32e39cf040e8900007107" + "057013096c10034b5d5085837d7d79717e5c598e3a3d8c3144c72544f43357ff2d54ff34" + "52ff2844d3314ddc1436de2c50ee3c60f41a3fce1336c41c3bca4662f13853e23449c900" + "006300027501008404006b0c07412a2649292d4a353a9e3031c72930d82d39dd424de731" + "3ecb000c7800045c05073a08091d131007170f1a18121e1a230e162309000f314559b23a" + "52e63e51ff2240ee2847ed2137cb00018100007b05038804005b0e101d1619101a1d1216" + "171219170818150e1b1811181913161f1c030f1f4852a72e36c52128d02633e42238e334" + "54f42247e01743d73c65fb1d40dc1d3adc2d42ed3f58f3233cd4122bc33148d6374cc300" + "006600055c0503570a015c100353180f2a00001b0013720e34bd0e3cda2651ff274be900" + "006000027b0a057b030039291500401c02340d0047221a4a340f5541266b53519f827c72" + "5849210a00210a002e0f00411c093717083818093b1b0c3a1a0b3818093818093b1b0c3d" + "1d0e3c1c0d381b0b351c0838220b39240f2d1e17151030383874323cb70619cd2839ff23" + "27e22d35e23551f22e5df1255ced2760ef1847dd1a43dd2a47e93e5afc1e39d21e38cb42" + "59db3849bd00097300097206097203016c0d06653b294f94948c92919f939395a098a7a2" + "a0c8515ee82039dc325fff2d52f9456aff224ac64c6ef41834d51935d71c3ace1532cc23" + "33e82523e02c2de7324ff32f62f32963e94c83fa153baa1933a200006504018600007300" + "00610b114f8591ab77868d7281866775805865784350852f3ed92a3fd83c5df62448e425" + "4fef335fff2e55f01d42d9335bf02e5efe3664ff274fe53256e2233bbf384dca00006a00" + "05710103740300780000543540605f6f86647bad4660d11e3bd51738d33d64f02f46b600" + "007c000080040873525b828795958290907886936f7f8f6b7e8f6b88b04861d5435dff26" + "41f42543d73753c003127900006e04006e6c6e958c91af88969f7f969c90abc84762972b" + "42b4162ad72532f2262bcf2d2ebe0000790000650000476670937c859488909d8f97a491" + "9f9094a4a48998ad7d89d12534ab2431bd2739db253de53956fc2e4ff21a4ce32a58f32b" + "58f31d46e0395af3425beb394edb303ec10000733254d23051dc2142e53254f32143c100" + "006900004c00004843399a382cb62130c93264f72660f02151e13e4fdb100b8b00006a0a" + "0a6e0c005653457a9e94b69496ab5163a53148b02441e3213fed2e48e53650db00117100" + "0246948baaab9daca99ea45b60885264a61439bd2853f84367fd365bf22a53e92b57ee13" + "3ad51537d6334aee1e29d3282eda3436d91b1baf00007d02007b010064000049372f626c" + "63827067687b6d6d615877413e753542b2334fee2d4dfa2446fd1736df3751ec3857ef1f" + "4ee63360f9365df62447df3452e84c66f7344ddd1c31be00007b00046902047b01007e05" + "005b1e1e38363a432429462a2a9a3932ce3834e02f31d3474fe200068f0000680009500c" + "10331214231a150f1e18221b1821161b04101e040c1e36000b4d2637c31f33e0324cf939" + "55f63752d300007100007a00006a07004a0e0e10111400171a071b1b1d1617051515091b" + "17161918131517120d1216171c53383ab53130ca312edf2028d33e5af92950e91a4dde1c" + "53e41f4be2173bd7364ff22e48e30d28bf3147d93f50d4030f7f00006200025502004a05" + "00480b003c0f030d020c2f3745ae244bd41e50e53355ff3650fb0008670a05830c017709" + "0036301b003c1704360e0643201a472f0b554023664d489d7c77866a5e220d001e09002a" + "0d003e19063717083818093b1b0c3a1a0b3818093818093b1b0c3d1d0e3c1c0d3a1a0b37" + "1a083b210a3e240d3825173225370f0831272a873643cf2b37e13537ea2f36e73550f735" + "62fb3165f91e57e62859e61943d34969fc344cec2f44df364cde3749c900016e00005700" + "00550000500a075e08014e8071909f9e9a9e9ea8a1a1a3948d957b79aa4b58e51029cc3d" + "6aff395ff0385ee300097e0b29af2139d7152dcd3c53ee1328d32430f43134f12833e331" + "4fef3867f3396bee1744b93e5ac8000c7b18168300006e0a0a6e00005141487c6a778a70" + "7f826676766170757e8c997d8ca9061b6a2d44b61533c73656f6163cdd183edd3354f710" + "2fd53b5aff325af73960fb3456eb1f3cc61227a6081b9400006600016a00005e0d057215" + "125974809a7182947991bd2a43a82843d22846da4265f3475ec800037b0004830000635d" + "668f69767c69767f64708a63718e627293546da3243bad273fe1334bf32e49d42e47ae00" + "0c6c0000620302608e92b799a0bc93a1ac879ba2839cba213b6c2e45ad2236d3222ee237" + "3be43a3ad6010489000174050d567782a08391948b979794a09e79897e7888878899a181" + "94b5192d74283b97162aaf253ae12c41fe223cf33460f71b44de2148e52d51ef102eca2c" + "42d6293bcd2430ba00007f506ede4361db3b5ae9203fce1d39b600006b05116700004a10" + "036c4735d5373fe83463ed2a66e23b71de00097900007200007a00007609004fa89cc4a2" + "9ab2a4a7ba45548f2a3f9c203acf142dd22f44df2e43d0415abf000c5836315aaca2bb9e" + "93a49492c35a60aa1d31b64a67ff4d6eff2648e7345bf81038d51239d40a2dc71b34ce22" + "31ca303bd52428bf1512a900008808018b0a036d100a4a84809b968fa18c828a756b627f" + "7a817b7d961929744a64db1936c01835d7162ed92135e21e37da315fe9072fc41839dc3b" + "58fe2239e1273cd72236c90005880007830305800707810100620c0a3b262a293d443c34" + "39562c2c9e2e27c22f2dce2b2ec75962ed00007700076f00064d161a3d2425392e2a272b" + "262d27252a1d220e14220b11213800053e2333ad1d30cc1127ca324ade3552b800046b09" + "147e01006008033914130f14150311130515151715170915150d1a161716151016190e1e" + "231f0b0f34292c8d3131ad3b3ade2730d7435ffe365bf43d6fff0f43d51e4adf274ce343" + "5dfa3b4ffc384df83348d73c4dc100005e00016601005d0500470704330d06280c020a00" + "08233d4aa83759d41a44ce203aef263be200005e00007a0c006e1105373d26073913003a" + "0f06431e16422a04543c206044408f706b998175362515311e0d321704340f0038180939" + "190a3a1a0b39190a39190a39190a3b1b0c3c1c0d3c1c0d3b1b0c3918073c1c053f1f083e" + "23102a171b2a1b3016104e474bac272cae3737d5252ed53e58f73b67fe2f5ff1053ac614" + "42cc2a54de4464ed394be94554ef404fe00000700000650a1162070b5507064814125163" + "5c92988aa1918f9096959d969495a5a1a25f5e9a4f5bed2239dd2b57ec1b40c41236b000" + "007300048d1e32c91f33c83c4ee03846f1242ef22d38ec1b2cd13d5cf23e66ec315ad828" + "49ba00006300056d00005b06056300004c0c11538790b78694a182929289999883939371" + "808764757f2e4660172f79233cba1c38c71937d30523c13d56fb1e36e03c52fe1335ca13" + "33c61f3ac7233cbd000075000e7f00026800005c01055e00004a3f4076758295687a885c" + "74982d459b364fcd3953dc3b5ae63a4ebe00017d00018301066e7c88b28c99a18a96a278" + "849c6c7a946c7b983d53851d33961f35bf344ddd2841c0182e940000610000600a076292" + "98b88f99b28d9ea87f939c7e98b31c34623b52af3144ce2735d43135d43233cb00008100" + "006c00034b818fac919fa2919f9f95a19f8a98988da09e7789897b8f965a71911c336522" + "389d273bd21221de162ae12f53e7082bc31132cd2b49e5243dd82435cd1e2cc000008700" + "04823048a82740a7243eb52c48c52a41b50004710000530000453527894430c53439d12e" + "5bd02960c73366bf00056200006712158a000181332d6db0a6bf968f9fa0a2b12f3b6f4d" + "5eae273cbc1e32c71f2ac01726b33d57c500004f00002b9590b0a9a0b19e9abd7f7eb746" + "4db73749d31a38ce1938d01b3ed6274ce31236cc0b2dc2314ada495ae6313eca00019000" + "009305009108008a03005e2c2654817d8b7c777e777078817a6a71716764686b48567d24" + "3b894159bb1e36bc273bdc1222d01a2fd63157e01235c71832cf2e46e61d2fd11726bd1c" + "2bbc020f920002810302840603780706481a1c2828301b383f2f4b506e5957c24c48d137" + "38c83639c4555edd00006c00005b000446171b3e292c3f3834333b363a3a383940443538" + "4333243144000e3b273598293abe0d1fb12a3ec5000368000a7500026d0000510e09321f" + "1e1a20211117170b17171517190e1615111a151915140f16180a1317090b1121090a4d07" + "08622d2eba3944da3c58ea2c4fdf2b59ea002fc1254de21e40d74059f3404fff3d4afb45" + "56e400037300086a0003610402550a053f110e2b1510241610120002152b36853954bb1b" + "3eb61328cf1d2dcb0000650702830c0062170a354b33113a12003d1104401a0f4127024f" + "351a5a3b367e635c9d897e5245354d3d2d2c1201310d00391a08391a08391a08391a0839" + "1a08391a083b1c0a3c1d0b3c1d0b3d1c0b3b16043d19033e1a023f1c06351a0f28101034" + "243e00002b3432853838b43f47d64e65f33258e71c47d42a58e21940c93155dd425ee52f" + "3dd400008a000080040b7d01075d00003c070a410000257e7a9d8f8aa89b919c9c99a08d" + "8d8f8e8d8b87868135337c4e59f1263de1133dcf2143c11a3ab1000a85000083323fcb36" + "44c72c3ab73a44e3262ee81f30d52139cd4d6af44363de2c4bbf00006903096b04036116" + "07640a0a50080f453f4775636f8957656e6676757484837e8e8d7686866e817f7d93915c" + "74962942944962c92d47d01f33d24657fd2d3ee43040de142bb5263ec6293ebe000a8000" + "00650003670000540c136404084f14164f858aaa6e7c8981939d4e637e3d54972a41a937" + "4dc5526af0303eb9070d9900028f00006d6873a06b7a7f707d836e7c8571808573848c3d" + "5271263b7c2c42a73e54c3445aca2c3aa505097500006e00005a8a96b08894aa91a1ae89" + "9da693abc33d557b344a95283daa2634b7252db62d31b7080d83040b730610558491b48f" + "9cac8c9aa58e9aa89eacb99badaf92a5a190a89b8ca6a588a2b10012523444be323de425" + "33da2c47d4253fd02640d5334be33548e2202ec30000890000850d138f1d2e7c32459440" + "58b0455dbf2d40a903117a0000570b054f584a99422f983c40ab466bc43e6cc1204e9c00" + "0f6109136a00055c000054a0a0c49b95a1b3acb4a09eac787fa95967a62a3ca23640c339" + "3cc9272fb82841b8000360040a3e323352a09b9f99949aa7a3b27e7cae373d931029a81c" + "37ba223fc75473ff3554e32e4ad92940ca2031b500008000008b0000830d058f09007f0c" + "0759817d9e8d8b8e918d8c807a7e827f6e6568557a80726673793f5175051850394bad29" + "39c2303ce02734da2741d61d38c73046cf3549ce3b49cc00007e09119600007a05049002" + "007d0200630c0f2e1e2611363d1e363d2b373c5c41439a3b3ca83335ac2f34aa3a42b101" + "0c75000b610004411116362124372f2d3036353137363146493e484f472632402835554a" + "579d3441a93846c32734b40000790003890000740a045c262044302c2b2e2b2223231728" + "2820181913191718201b21231f1c2829171316011116120e113200002e00005c3e4ac038" + "51cf4b6deb0e38c03e68f82b4de42744de485cf92a35dd2a33da0000930c128a00035f00" + "035204043a0c082913102315111f15100d1219234147855466b8475fc12a36c82830bf00" + "02650000781003551d0e2f553b163e15004015023d1509422601482d1256352e6f58528d" + "7f746d6455675b4b200a00381406391a08391a08391a08391a08391a083a1b093a1b093b" + "1c0a3c1d0b3d1c0b3e17063e18033f16003d18003918053a1d0f250d0d2e1e2b0a022b00" + "004929309b4054c73151cc2447c74469ee4e6ff43753d800008200019000008411159300" + "006400004407083800002256546a868291948e9890878a8983918988868b8a8685877c2a" + "2a80414eec1e35d9254bde0f29b11f38b6000588030da00008841b2690131d7c242baf45" + "4eeb374ad73a53d4253fb8000a7800006100026002035602004d1709580204346974948b" + "96b28592a378878e6878775d6d6c5161606575746d7d7a576862596d78283f6b000a4d28" + "3cac3241ce3f4ae0323ed22f3bc52b3bb52535ae010e8000005e00076400005400054f03" + "084c20255c545a7e7d85986e7c85778890566b7e112756102576172b8c000a8300007a00" + "008d00008f0b0d7a7682ac7c8b8e7b898a6f7f7f66776d6376702c3f500c20450e23640b" + "216d00005900006200006a04006f0805608897ac8898a88ea0ac8b9faa697f96364d6d1a" + "2e6914267a00006c00007f04089000007700006e00055067749e67768d6473866d798f70" + "7c926a7b8390a2a26d83766680757c96958298bf00085f3e49c51a27a93548c83b4fd23d" + "50da4152de00049300008600008400008000006c00003a00003900054000135c00055d00" + "00570000530000372c1f55220d4e28256a000d5700024f00005300005000065200004003" + "1249a5a9b58a8687afa9ad9892a09497b828305f27358000006000007400007300007800" + "006004094902042d8c8a8f948d85a59d9a9f96a77e7baa000461253c9c465ecc2d47c04a" + "63e4445ce01b2eaf02108b00007406048b0c058901006c00005e413d7a9b97b08684859f" + "9a97807b7879776b898c7b6f7362757d70717c826a768c000a486c78de222aaf232ebb3f" + "52dc4f62e33040b901108300057500037700006a03037f00007104006602004b10131c1a" + "210022280e2629201d203f060a470a0f5300005c00005700005600035a00024a0003360e" + "13301d20313030323f3f353b3b2f3c3d35393d3c1d262f18243409153f00004a00006300" + "00690c129a080697100a920e0659504a64443e4037322f27241b2b2c1e1819141a181b27" + "222934302d3233213537212b2e1d26263015162b1a205e0002504861be17349c294bc63c" + "5de8405aed5368ff1d2ac600029b0000921016a20000720003540204410405210c0a1810" + "0d18110c131c1815060a0b02053200043f00004500006c00006c00005304007112054a24" + "152c573b14411800461c043a130241230145250c4f2c2659463f70665a817b6d7f786838" + "261839170b3a1b09391a08381907391a08391a083a1b093a1b093b1c0a3b1c0a3e1d0c3f" + "1a0a421c0941180440180048240c331000442715392214322328100c2d161d5405135e00" + "005f00006500057f00007800028400058901028100006f00006b0c0a5e0f0e471410314c" + "485f938d97908a8c8d8884a39e9890899b9f9e999e9d98a9ad9f5557bb3c4aeb3047eb34" + "58ee3245df3f52dd00008b00009501046b656bb72a346900005400007100006a00077400" + "0f75000764000258080e5a07044910094c0500383237547682925e6a7856626e5b68705a" + "686b5c6a6d6573746f7d7d7381849099aa87959e8ba0b17489a8000f5400006700006f00" + "007000006b000972081176040d6a000457000043151c600001390d1345696e94878fa271" + "7e8684929b7687917b8f9a7488a38296cb7283cb00036900057905088d07078d00046771" + "7ea16e7e7d70807f778882798c79788a7a83949b7e919f7085a446588600095201076504" + "02670400640000487b8c9c7e909e778993778b96778c9f6e829b6578a36b7bb6030e6a00" + "008600009e010290070b89030d667e8bbf7e8ea87d8da48291a68392a996a6b692a3ad8f" + "a3a483999784999c889db26374a0000b4700065100006500006d00007600007800007300" + "007b10169210128b0f11760c12421d244e28365900103e00054c00004b0000490e08364f" + "425c664e685b4c7500024700004c060d7508056c06024f100f49727c97959a96a7a29faf" + "a6a9ada2b29b97ae979bb8a4acdb3a39850b00650800740810970f148900004e0d0e4797" + "94a7a096959e9391a4949ea096ae485985000d41000d5500005a000069000176000a8200" + "00770000750000750e067609055226225f706e938784997e7b828f898b827e72817f8066" + "66646a6b6572756464675c646965535a7400003700085d00005700005f00006400056f00" + "006203077201036a2323870504620c09600806450b0a34141611161a030c0d0713141922" + "243d0f1632162137151b5700004600004200074800043a00052c0f14281a1c2828282842" + "44363f42313839342f3336282d31343e40151e2f1921520b0d6015177b00007705008c0d" + "038600003a5b55634943473b353729262125261619191719171a26232a3a36352f2d1e4c" + "4b3642442e2928232c2a2d22273a0a1737000842000c55000061000d8900008b00008b00" + "059d00007e070b88090985060771000144060733090c1314151018131717121612110f10" + "110c04011e1215360b0f3e03035b05066203075000005917093e2d1c2c4e320a431b004e" + "240b3711003e1d0044210b49241c37261e443e326c6a5b6f6c5d48382b35140b3a1b0939" + "1a08381907391a08391a083b1c0a3a1b093a1b093b1c0a3d1e0c3e1d0c43200d411c0941" + "1b063d17003d19014121083a1f04362410342c2904051700072e031054000b5d000b7300" + "077b02077d09098106036e0f0969120c64100b4d2e2854847f958f89978c8384948d8592" + "8c7e837f73847a927370696e6e665860553b3fad1e2dd23a51f51c3bd4303fe23543d700" + "008e01009409075a9a9ccc8b94a502083a000553000c6100005400075900085100044800" + "003c0a083a00002c5956819aa4b08693998e9ba1839098909da6818e9676838b6a777d65" + "737668727b6367824c5564495a644e606e47577b040f4f00004d00065900005300005100" + "004b000044030848070c4300002c151a426c7093757b936370786c797f69778274828d6d" + "80876a7c866b7c9a58689900004f00085f00046c080b76070e5e95a3bd7d8d8d79888b77" + "86896e8074697a70737f8d5f70776375813a4c6200063800004800004b03014c08093f7b" + "8d9981939f77899381939f8596a68c9eb2899ab89aa9d0040f4f030a7201078102087608" + "1073000c527b8baf8596a88596a68090a08796ab8e9db08999a98597a38c9ea88597a182" + "94a08d9eae5b6c7e021033000253040e65000a6900005d000b74010a7300056d00006001" + "0358585a80535774323e4e000b2500063900043e04033c0200192b1f1f5f433f3319240b" + "002a0d034000004707004b1a0b420900229e9fa3a0a294a69e9ba09599a493a5a299aaa7" + "a5b39698af716d9f17065410015c0000630909630203430e0f3f8a8896a19996ada29eb6" + "a3a79b8e978e999f7a8696000c34040d5001086200046300006400006309086e0c047306" + "00544744718888a4908f9d8a8896908a94837d7f918e7f75747c77767e74727373716476" + "73627371646b6c703f455f000b38000236000047000453040a6000025b00005a04025500" + "00430f0f4f0000340d0d25131522191a1218180e2a272e211f2c202133151d1f18231b0d" + "133300002b020a3900033100062a060d270e121e0e11160f0e0a1518051a1d0a1f1f1f1e" + "1e26292d2c232a22262f2a1519340806450606501516730d0775000056262149403c393d" + "37393b343b352f312a281c1a1b16181617221f263632334442365554425958433e3a2e3c" + "382f23261b131d1e06143100002c02126000006003098100007b02018307087409086e0a" + "0a6a0000450506360c0d2b11131220201625221924211c1614151b1b131e1a291b192706" + "04190a07400e0c4b14164906024c180c3433222a462a03441c00542b0d3610003a190043" + "200c441d1617090019170a3c3d2d3e3c2d32211735170f371804371804381905391a0639" + "1a06391a063a1b073b1c083c1d093d1e0a391e0b3d1e0c3e1d0c411d0d3e1b083f1c083f" + "1c063c1e043921053025092721131b19240709320001390c0b59000050100b67110a690b" + "0454110a4e110847645c8b8f88a778707f7167706f65646c635c676151636250685e7668" + "64596b68615f6865282ea62233d9273ee2314dec202dd4323ed000008f07008d1c185592" + "93a89ba195787a8f0a0f3908114c0005460509460102380a0a3c07063031345564698697" + "9fb67984886773735c676b545e6759636f67707f68718069737d68727b68707b7e7e9684" + "88a3888fa98792a68c9aa55b6879111a41060d41020749060a47050a4400003504083519" + "1f43373d5d646a82666b7e646c776876796f7e857a87977e8b9b7f91958598968899a35b" + "69831a255b1e2b571c266116205e2b37676b7b8867797d66738376829a7b879376829070" + "799a7d8a9a6b7a8147555e2a3650293158292d52282d4b2a31438a9ca6889aa48698a288" + "9aa68393a28193a18697a96574891b2b441d2e482336541f304e2334503a4d5b90a4a591" + "a5a38fa3a290a3a990a0af8d9caf8b9aad8998af8897ac8e9db08798a28597998d9e988f" + "9da631386e000543030d52000853010c5b010a590005531b216b6263a37877966a6b7f40" + "4a4c08151e081130070c320407281312172e230d492a0e3714002b1311220d162c162d37" + "1f3747303a523e3dbaaf9da8a592aba19fb1a2a9b39eafaea1aab8afb2a9a9ab928aa23b" + "295d32205436335031314d2a2d402c303b747671938f839c9489ab9b9cafa1a19ea190a3" + "a69d7d818d181a4104044204034706044f0905520c05520b0253605b938e8d9f8b8c9089" + "8a858e8c918b868d8c868a908c8185838e7977827573787a726f827a6f7a726775726b6c" + "7071323c4517223400022c00063802043f080a47090947030037070536110f360f10250c" + "0f060d10051718121e191f3834433735433334382a311f252f141017210c122a040a2402" + "0820060c22050b170d1114111310121208191d06171a0514141615131e181a17171b0c1c" + "200f1616200a043205043000052202033309072f21211f2f2f132d28242a232a2c242f34" + "312c21201b1514121c1a1f3432353f3c374240344a47383d362c3831292d2b122326150d" + "111a070d25040b410a0e580a0a600100590a036009055c0d0a5b060740171a3d06071c10" + "0e2312111923231b292911302f1d2b292c26231c261f26201816100a0a0b051f05022100" + "001b00002d0e041d2315154a2e0959330e532c0d3e1a003b1c0044210e3f1910190c031d" + "1f1134362831322435271c33140f3718043718043718043819053819053c1d093c1d093c" + "1d093d1e0a3b1f0a381f0b391e0b3b1e0e3d1d103514053615063a19063f1f083f240732" + "200031260a281f1a1f172c1e1738281e522f24603d316f423472594f84847ba88e86afa4" + "9bba8b8295786e77766b717a6e6e7a6f6b78706377786685798f8a83798b887f8d97a03a" + "44c02e3fe53b52f62f48ea2531d31f2bb10000860600803c36649d9ca1999b83a1a2a685" + "889b797ba140416f2825503d3b6051507272748d727b8c6f7b8b8c9da7899797828e8e80" + "8b8d869099929baa8f98a99099aa919aa9909aa69199a49294a1888aa3797e9b747a9073" + "7e827482825a66764e5873383f6b1c2149191e442f33566065827e849a838a9c80889381" + "88908a939884929587959e8a97a88895a585949774857b78888563717a555f824e5b6b55" + "607c56638663738c7f91937889907682987f8aaa818ca07d889e8f97be8a95a78d9b9c88" + "9697949ea88a92a58d97a1919a9f909c98889ba28799a38798a28798a29cacb996a7b190" + "9ea992a0ab8a999e80958e869d9782979883989992a7a28ba1948ba194899e97899d9e84" + "959f8494a38595a58897ac8a99ae8a97aa8593a07f8e917e8d887e8c8d898faf7179a03c" + "47752832651d28604b568c636da27981b28083b0838199797b88626b68404c4c1b243319" + "2134171d292a2e20423c1a48270851290f5d3d28593a285d3f3478574eb09083b39686c0" + "a791b6ad9cab9d9caa979db095a4b8a5a99f928c918d829e959a9f8caaab97b0a49b94a4" + "9e9ea0a0a2a3a5a4a1a49da9a69da8a39daea2a6a8999ea09c839e9b889a969587829665" + "5f85564f79322a59443c6b5c5483948cbb9994b28e8c9187868187887a908d868b87868b" + "85858f8989827f8677747b736e74766c6d7d72707d726e756e6675766e5960584851503d" + "415a2529461b1c3b1819381918380d0d2912102818162b14151a0d11000f12001a191720" + "1a262f29352d2a332e2d282f331c30351731333024273021242d1f232c1c1f281216191a" + "1c171f201824251723250f2023101b1b1d1a18231718121a1b091b1d05181713110a290d" + "0922050c050b0e170f1015181a021f200025201a26212726202c2824231c1b1611100c16" + "14172523262d2c2a34302d3e393337302a352c272e281026240f12110f0c0a1508072711" + "0f3e1410430a0639130b3e332e68312e651f203c26293016171c15141c110e17221f1a2e" + "2e143739243231372f2a26281f2023190f1d1307140e12110c13090c11090921140e1c28" + "1d194c32115b3914573414371800361b004625144722191d10072426183337282d2e2038" + "2b222f120c361703361703371804381905381905391a0638190538190538190535190434" + "1e09361c0b361c0d37190e3a1a0f3a1a0f3a1a0d39190a371b0631190037230b2e1c122f" + "1e2634243147384f94849ea191ab96879e988ea79d95ac9b93a8a097a8a399a4a0959ba4" + "999fa69a9ca69a9aa59e96a9aa9aaca0b4a39c929f9c938d97b23e4bcd2f42e6445cfe2e" + "46e81f2fc00008770003710800735a5277a29e9d94927d99979ca1a0a89e9ab1968fae9a" + "94ae9793aa9d9bb0797f8d84919984959c92a7aa8d9b9c818c9079848a717b85727b8c71" + "798c727a8d747d8e747d8e757e878288848286917f859b7f859d757c8e8a949e929ca693" + "9da98b93a67a8299737b92757d907881907078836b747d6a73786a74756873756d7c8172" + "828f79869978859575848775867c8998918593948a95a78f9da08e9aaa8d99af8696a578" + "8d888295998190a38590ae8891a08591a18e97b6909ca896a2a09ba7a398a2a4868f9687" + "92948a969483928b7a8b927b8c947c8a937b89926f7d886f7d866d7a8274818784919780" + "91998496a48394a68394a68798a28c9f9d8b9e98899c98889a9e86979e87989f8899a18d" + "9ba6909eab929faf929eae8e99ab8894a48891a2878e9e9ca4b98b96b28996b67f8caf7f" + "8cae848faf8992af868ca68182967a7e8a717b7a64706e5b6668545f63363f3c262e1623" + "1e003c1f0d431b0f4d2615502918643e2b7d5645a47c72a07a71b48f87b2a197af9b9aba" + "a1a5c8aab4a89392bdaca4aca595a69d98a694a0ab97a2a5948da293989c94a19d97a396" + "939a94929798939aada2b3ac9eafb6ad9eb1a99eada3a1a59ba4a098a7a097a8a49caba7" + "9faca8a0aba29da4948f968e898f8f8b8a8e8c7f908e798c897a8b86808e8693837f7c79" + "766f746f6b73686c786b7281747b776e6f7975726b6c646264634d4b603d3d4943444841" + "434225272416171918171c1b19241514190e12001112001b191a201b223531303a352f48" + "4536504d3c514e3f4e4e463c3b373635333232322523241f1e1a1d1d1521211529271a2a" + "2b19292a1a2c2a2d2f2c3528272231301e29290f252219191222140e1c1f21162b2b292b" + "2c2624260e1a1a001e1b161d1b1e1c19221e1d1b1e1b14100f0a1414121b1b1d11111314" + "12151713141910111c1213282015251c13191011120b12100a181d192a272331211e272c" + "272d312e43322e472826312e2e2c1c1d181817150f0e0c1a1a122b2c1a39392d3c3b413a" + "35322f27252b2115261b091a110815110810110908090e0e0b12251c15432c0d52341251" + "3311402508351d033c1f0f4220160a0000121305282b1a2425153c30242f120c36170336" + "1703361703371804381905381905371804361703351602331702351c06341a09341a0934" + "180a3d1f143c1e13391b1037170c331606351a0536200b31190d331e1b3823222a16189f" + "8c90ad9d9ea090909b9199968f97979098979098aba1a99b90969f9498948a8b8f838590" + "89838183767d70817269606c69606e76a43b49cc283fdd3e56f82c42e62c3ec400005900" + "025d0b006b59506f8883808781718b868d9897959b959f988fa09891a18c8a978c8e9a6f" + "787f768588889a9c8ca1a2869399858f98838d9686909c8a93a28992a38a93a48d96a78d" + "96a78e96a1939d958d9695828a957c8395787e96727a8f646e7a5c696f54626364707c6b" + "77837d8a9378858d6c777d6a75797c87897d8989747f817987907c8c9b8693a48896a38a" + "999e8c9d9792a19c889696818e967783837881907c879b8596a081968f879b9c8898a88b" + "95ae909b9f8f9d9e8390a08e9c9f87938f86918d8c9697838c91808d93808f927d8d8d79" + "888f7b89927c899279868f79868f7d8a92808d937a888b7c898f88969f8996a78c98b08c" + "98b08898a88b9da18c9ea08c9ba08a9aa78e9fa68c9ea28a9ca08b9a9f8b99a28a98a38d" + "98aa8e98b38c95b68b95ae919a9f8e98a28c99aa8a99ac8b9aaf8d9aad8e9bac8995a17f" + "879282889678808b6f7a7e6876765a696659656145514339432a2b2b1139261839190e39" + "15053f1a07572e187a513b936959895f51b3887fbca69bb8a09cb79b9abf9ca0bea29e9c" + "887f9f9687a69c93aa9a9da79496b6a19cb3a0a6ada1afaea3b3b6b0baaea9ada6a1a5a6" + "9ca79d919da69b97a79d9ba49a98958b8a988e8d9b9190a49a98a69d98a39c9496908494" + "8c8a998f979690948d897e8f8d748c89768b877e8e859688847b7e7a6e7a736b756a6e76" + "6a747f757e7a70787a74766c696462615d4d4a5148464748494443433b26271f16170f16" + "171118181612130e1014001212061917181c171b2a261d342e204f4836574e4553494745" + "3e36353128302b252d2824231e1b1f1a161612091c180d2a261a302e213030243e3c3d4c" + "4a4f4946413836292f2e192d291e1e171f160f171f1e1c32312d33322d2a2b1d3536282c" + "2b2926242721202529282623201b16130e1819141f1f1d1c1c1e1c1b201510161913151f" + "16192319182117162016171a111419101317120f231f141d1a0b23200d1a17121c1a1b21" + "1f2027262214140c16160c0e0e0214140a1f1e192b2b29343237352f2f2d25222e241a28" + "1f0e1a13031711031210030304000507061a160d331f0643280a442a09341f022d19013d" + "211347291e25190d141507282b1a2728183c302436171236170236170237180338190438" + "19043d1e093c1d083b1c073a1b063a1b06381d08371c09371c09351a07361b0a361b0a38" + "1b0d391c0e3a1c113a2011371d10371c11371f15371f15311a128d7a739a8981a6988f9e" + "9493a0979aa59c9f9d9497a69da0a0979aa49b9e8e858683797a837e7b858881887c8691" + "8680928e83646cab3245c82940db3a50f32638e2485ce100025600024f0a006382779794" + "8b8e88817b938d9ba5a59daba7a89e99a0908f95868990858c9286919779868c7d8c9196" + "a8ac96a0ac8e96a3868e9b78808b7078856c747f6e7683717888727989727a8776808182" + "8d8584918a838e92838aa68d93b7949fb3919fa88a9b956f81856d7c8168777c6d7c8189" + "969c86939986949783919488959b8997a48595a484959f85969e89989f8a999e89989b81" + "8f92919fa2848e977d849e767f9c6d7d8c6c817c6276776474816571816a786b6b7c6a74" + "8781758481737f7d7680817a8388838d97818e9f7f8ea38493a88b98a08c99a18e98a18b" + "959e949ea7929ca58d97a08e999f909b9f8998958694958b97a58d99a98c99a98c9aa58e" + "9ca98e99ab8e99b78f9daa8d9ca18c9ba08b9a9d8b9a9f8c9ba28c99aa8b96b48b94bb8c" + "95b4838c9189939c8f9daa8999a88292a294a2af98a6af949fa38e989a8d97a17e8a9671" + "7f8c6c7b8267777469796f596758444f3f282c1b23210c32230c3c230d40240f46230d50" + "2e138a674b825f417a5334a08677cdb1a6c7a69db08b83c1a49cc3aca4b2a59da39997a7" + "9999a292929f8c88a39096a699a3a89da59d9593a4a192a29f8ea49e8ea59c95a79da5a7" + "9ea3a59c9da69e9ba19a92a0998f9f988ea49d93a7a096a7a193a09694978c94948a9295" + "8e88918c788d8a798d88828e86958d847b857d707e776d756f6f726d747a757c7772797a" + "737a756f71716c684a4839524f484442473b353f25222d14121514130f15180710130012" + "140912130e1715161713101f190b261f0f3d312544343741303a372c2a382d27382d2938" + "2d293a2f2d201513170e091d1610322b2334312837342d48444358545556534e2f2b222b" + "28192f2a24201a1c18101b1d152c312b3536313735323955525b4a4a4c40403e33353036" + "3732272121171310191a142629222b2d2c2f30322e2d32343031322e2d262024231a1f25" + "1c1f1e15161b13101b170b21200c1716011616001e1d09201e11201c1d201b21110e0918" + "19091216001113061211191c1a251a18191f1b1c1f1a17241c19261d161a130919120816" + "120708080002070114140a291a053a22063a250633220627160230190b391f122d211309" + "07002324122d2c1a45372c391a15371803371803381904391a05391a053c1d083c1d083b" + "1c073b1c073b1c073d1e0a3d1e093a1e083a1e06391d07391d07391c0a381b0b381b0d33" + "1c0e311a0c361f0f361c0d311a0c2c160973615778675fa1928da399979b93919a929097" + "8e8fa198999b9295a1989b8b82837a71727874716b6d6a6c6167756a66767267565dad1f" + "33b6243ed3344aeb2130e1485ee800075b0001480a0060a89dbfa99fa79b92939c96a49b" + "9c8c928f8a98969796979b828a8d7c858a667379626f7764717a88929c8b92a48c93a58c" + "93a3879099838c938a939a8c959e9098a3929aa7929aa78e9ba48f9e9b88958e818d8d75" + "7e8f6e77946a778a62707d57696964797a6175766074756f81858899a08e9da487949c82" + "8f9883919c8393a280909d7f91957f919583919a8593a07f8d9a6b77836472755e677066" + "6c86676e8a6575846e837e7e91977f8f9f808b9d8492858394817c918882929288929b8b" + "939e89919c96a2ae8f9eb38a9ab48e9eb8929ca5929ca5929ca5909aa3838e94808b917f" + "8992848e98818c928995918894948d97a39099aa8f9bab929eaa939fad929db1939cbb91" + "9eaf919faa919fa893a2a995a4ab95a3ac929faf8e9ab28a95b38995af9aa5ab94a1aa85" + "95a28595a48b9baa8c9aa3859499828e8c94a09e78878c6a7b855f6e835a6a7a5d706e63" + "746a6677675e696347524e202c1e212411271a0a311e0f34190640240e6447296f503175" + "5232816653b89889c8a592cea796b7978cb097929f91919b9094a39799a29493ac9d98ae" + "9fa4b3a6b0b5a8b2bab0aec3bcacbbb4a2aca593a59c959d97a19b969d948e8e918c8693" + "8f84979388a29e95a09b989c9696a19893a397999a8f95988d939b9391928b838f8b828e" + "89858f888f8e837d877d748178717571706f6f7178777c737176736d717970737b737045" + "4231544f494a454b413b4727233115131814131115180511140112121012121216151316" + "110b21190e23190f2b1c17331e27351d2d362325382926342424322222362627291a1d1d" + "11111d1210281f1a332e2b35312e3e3a39433f3c44413c37322e342f29322d29231e1b1b" + "141b22192e332d2f383433423f4a524f625353554d50493b3e3331312f27212519131315" + "160e252b1f252a243237334446454a49453f3e3a32303328232725211e1a171215110822" + "20132c2d1d242716292c1b2b28172724151f19191e191d1b18131e1f11171a0711120a0e" + "0e181919231312101712161c18171f191d191315170f0c170f0c18100d0c0c020009000f" + "10082115052f1e022f1e003123082617042b180a30190b3225150b08001211001d1a093c" + "2e23381914381904381904391a053a1b063a1b06381904381904391a05391a05391a053c" + "19053d1a043b1b023a1d003e21033d20023a1c023718043116032b1601331e09341f0a2f" + "18062c1706331c146854555d4d50a4949f948a8b9f9795a39b99a39a9b938a8b9f9697a7" + "a1a1999393817c797e7a7775767874696d7769666f6b60353a98233aba233dd0293fe025" + "33eb3146dd00025e00044c0a0060988cb09c909aa1989ba29ca6989b80a8a89e9a9c9b87" + "908f848f9182909384919a808a968289999194a7979cb29299ab8c93a37982896a747669" + "73746b7577707980727a85727b8a6c78907683947f8c9282909194a39e8494918795a086" + "95a88d9db4758d8d758a8d758a8d6e81875d6f796c7d876f7d8a75829267748460708065" + "767e6a7d7b6a7d7b6a7b83748098929eb88c99ac8f9ea5879190848c997e879870818b6e" + "82805a6c7a5a688560698a646f7363726f677c81758497757c98747a948a91a1909da389" + "9ba78497a88597af8a929d89929b8891988891988f9aa0909ba1939da7939da98d97a385" + "8e958b939e8e94aa8e94ac8d96a7939ea4929da3909aa38d99a78e9bac8b98ab8895a884" + "91a28390a07686957a8a977b8c9477889077858e6b75816975836373836b7a8d71819184" + "929d85949b7f8b89818d8990a4a58597a37b8aa775859e7084857386806d7e745a656b42" + "4f5f40575d29393924201f312624311d14321c0e2d16043b220e6849378f74618d6d5695" + "7157cda58bc9a79bc9adaab4a4afb3a7b3aca1a7aaa09fa097909f949aa496a7a395a6a1" + "919bad9ea1aea0a0b5a6abb0a5ada1a2a7a4a5a9a4a5a0a3a399a4a1989f9c979590969a" + "93a39f9ab0a99caeb0a0aaa69a9a9e9493968b8f938992908991908a8e908b8590818489" + "7d8183787c7574726f716e6f747072736e726e6b796f6e7b71705a51524f494b4741433d" + "383c2c2a2d18181816161417181312140f10111311131218171318130f1c12111e121426" + "13192a121f2c121f2713152310121f0a0f1d080d17040a2c191f25161b1e0f12180c0e24" + "1e202622232723202320192b2724363030322c2e2b2525231e1a201b1819110e21200425" + "25093230313b384942444140463a333a2a2b2b2d2d262e201a1e15160e242b1b2a322537" + "3e364a4f495758504f4f473a3d36282b2424261b17170b10100613140c2426252024252d" + "3238322c3032292a2e29232b271c27241d24231e1515150b0c0e14151724262326252023" + "2124252324241e2817111f1811181a1116180d13100d08000a000b0e071b110527190025" + "1700231a00291e0c3e2c20432d20716454514c391a1704140f0037271a35170f391a0539" + "1a053a1b063b1c073b1c073a1b063a1b063c1d083c1d083d1e0936130037140036160036" + "1900351800361900371900391a05391d08301a033f2b1338240c2e19042e19064029214f" + "3b3d3322289d8d9a9e92969b9192978d8ea09599968d90999093a59f9f9c97947e797577" + "746f7676747f7775867d807f7f7f202984475fd92b47d71e38d72a3def2d40cd00066300" + "0a52040053a399bba098a59e959a9b95999a9a8098988e9597968c959489949687929680" + "8a946d7484666c7c808196898ea28e95a79098a58b949b828d8f848f918691938b969c8e" + "98a18c98a48e9ab28a96ac8a98a38c9a9d87998d798b7f78878e6f7e916b7b955d727558" + "6d7061767b5e71786677817484916f7c8c8592a37784957a87978192998698988395957d" + "8e9679859d79859f6d798f6e7c85717d7b667177616e776172796476786d7d8d6f7a967b" + "81a3828a97818c928b99a28a92a97f83a08185a0777d8b7a85898291988393a08696a68a" + "8e97888c95868b91888d918b9298899096828993868c989399a590949f9aa0ae9ca1b599" + "9eb2959daa8b969a879294838e90808b91808d9e7682986d7c915f6e835766795a6a7a67" + "788274868a7486867284868894a2929faf92a2b28b9cac90a0af91a2ac8d9ca37c8a8b75" + "8582798e916e808c62728c5868814e616752666460736f66727e6473884a64713a4e5735" + "3a403b3b3d261b192c1e153e2c203822153e2016846553936f578a654aa47b5fc4a092bf" + "a09b9f8a93a2929ca8999eaea09fa69c93aa9b9eb4a4b1b5a3b3bba9b5b7a6b0b4a3adb6" + "a4b2a599a7999a9e939496898a8596968c9c9994999592928d94938ea29792a9a496ad9c" + "8f999a908f9d9391a0979a948999918996918a91908c819084888c7f88867c8478767772" + "746f5f645e74756f7f7c778078768177785e575e474145514d4c4d4946302f2b1a1a1818" + "18161717191112140f10121012111a19151b16122317192b1a203d26303e202c3818232f" + "1419280d122f141931161b270e14220d122a1a1d231417190f10120c1016121315110e10" + "0d061e1a17161211181216181212201b17241f191610021818001b1c002625202d2b3632" + "342f32352a303426313133342d35282425181911242a1c2a3225333b30383d364c4d454b" + "4b413d4037282b2024261916180b1212081516102324281d2027292d38423c46473d454c" + "47413d3b2e2c2922262523100f150504091a1c172f322b393a34302f342d2b3025213020" + "1b2f231d292119241a1019140f0c050c040e0f091d140b261a042216003d331a382c1c3c" + "2b213523178373648074642f261522190856443832150d341802341802351903361a0436" + "1a04391d07391d07391d07391d073b1c07391904371702361800361800381a02381a0239" + "1b03391a05381c073419063b220e3a210d321c07311a08341e113a27213c2827816e70a3" + "9298a5969d9889909d9099968b939c93989e989a98939083807b7d7a717e7c6d84847c6d" + "717a5a62750b1d672a46b43151e02346e22a46e700006700086400004200023b918fa792" + "909d9692939b9693a4a0949b9794979799919296898c91878c928b929a898f9b868c9890" + "96a4939ba8909aa68e98a28c969f8a979f86939b87949c87969d7b899274828b707c8a63" + "6f7d5d6a735f6c746b797c69777a68757e606e7b74819172818871808788969f8a98a185" + "939c84929d8995a184909c7c8a957a889377858e75848b6a79805c6a73616f7c5e6b7b61" + "6f7c707e8785979b7f90977f909884959d89969e8e98a48891a282879b7e828e7d808980" + "80887d7b88706e7b6a68756a6a726f727779818480878d8990989290959492979a989da0" + "9ea3a6a4a9a6a4a99d9aa197949ba2a1a79e9fa49da0a79b9fa8999da6939aa2939ca17e" + "878c737c817b868c8393a278879a78899b7f90a0798a9a7e909e889aa694a6b08a9da48b" + "9ca4818f9a74858f72838d6b7d8762747e6a7d84687b825e71776275796f82887586907a" + "8a9975859474858d75878b77898d74828b6b7b88596d7447585f3641453840432c2c2c2f" + "2822301f152f190e37190e5c3828784f3d764b38976a55b68d7bb28c7fb99b93bca39fbc" + "a7a4bca7a2bba49cac9794ad999baf9a9fa392989d8e959c8c96a1919ca79aa49f9a9e9d" + "999a9e9898a59d9aa69e9ca39b999c93969a939a9d969ea49aa3a1989d9d94959d94959b" + "95978f888f878087857f83847f7c877e817f797d7b7579736f706d6c6a676664706f6d75" + "7170726c6c726c6c605a5c3c38394945444844433534321c1c1a1717151b1b1b13151410" + "151113151216151115100c2618172d1b1b3b1e233f1a21411921451e234a26283d191b2a" + "0809341614311917271815211614221a182a262521201e201f1d17161213120e1b1a1620" + "1c191d1a1519160f18150e18150c1210011314061a19141b191a1e1f1920211924251d26" + "25212a26251b1a1617161113140c2c2d2532332d393a343e3d383a3a3234352f292a222c" + "2c241e1e1612120a0d0c071b1b192424222e2e2e3a38393733323a37322e2e262d2c2728" + "2723211f200a090717181340413c4648474142473b39443a3748302d42282433211b2712" + "0d130f0b0a090803090601130a011c0e011c0f00281b0b281c102d20173b2d2478645968" + "55472714062714063a24172f1409351903351903361a04371b05371b05381c06381c0638" + "1c06381c06381c063c1d083a1b063a1b063a1b06381904391a05391a053a1b063b1c0837" + "1a08391e0b3b200d351c08311b06331d0f342015301d16675450a49195a998a29c8b959c" + "8c97968993998e949c93989a95928e8b848b877c8f897983837b73798569758d3c4f892e" + "48a73354d5274ad83d59e8000055040b6300044501063081849789899594929397928e99" + "918ea29c9c9d9b9e98979c9293989192978b8e95777b866c737d656d787f8792919ba598" + "a2ac8d97a176838c727f8875838c81929a82939b82909997a4ad929fa8929fa894a1aa8f" + "9ca583909978858e6e7b847f8c956c7982626f786370796a778064717a606d7669767f75" + "828b6d7a837f8d9683919a8b99a288969f8a98a185939c7a889175838c77858e65787f64" + "777e677a8170818976838c717984727884787c887e808d81818d8c878d9b969ca6a4a9aa" + "a7aea8a7ada7a8ada4a7aca4a8aba5a6aaa5a3a6a2a0a39b999c97959895939697959893" + "91948e8c8f989699999a9e9fa0a4a4a8aba5aaaea4acaf8f989d8b949b858e9579848a6a" + "7a89718292728393697a8a617381586a785b6d796a7c8871838d778892798a9282939b89" + "9aa28da0a78c9fa6879aa1869aa1889ca38a9da472838b72838b71828a6e7f87596a725b" + "6c746071796071795d6e755f70775f6e7359676a5b666a464b4e322e2b2d1e172f1b1232" + "160a4923164e2416512717764b38845946875e4caa8676bd9f95b49b94b29992ad928bb4" + "9b96ac9794baa6a7baaaadb4a5acaea1aaa497a19f929b999095978e91988e8f9c9090a1" + "9796a39998a49a999c9492969090938d8f9c9698a19b9d9d9799958f919f999b97919394" + "8e90918b8d8b8788868283827e7f7a76777672736d696a706c6d736f70726e6f726e6f67" + "61614a46454a46454746443635331c1c1a1616141a1a181214110e130d12140f18171319" + "1410291a173723223d1f2162393d70464a693f433c1214562e2e56302f3b1c1732191421" + "120d1c110d201b18302f2d2d2c2a363533302f2d32312d28272227262127271f25251d24" + "241c21201b22211c25241f24231e21201b1e1d181c1b1618171217161121201b15140f13" + "120d100f0a13120d14130e100f0a1d1c1722211c22211c1b1a1521201b1817120f0e0909" + "080314130e1b1a151f1e19302f2b2d2c2834332f31302c34332f35343023221e0504000e" + "0d0932332e3f43444141493d3d493c394c373449322e3f2a2634161419100c0b0e090511" + "0906190e081b0d04180a0041312442342922150c30231b463227775f53351d11321a0e19" + "01002f170b381904391a05391a053a1b063a1b06391a05391a05391a05391a05391a053d" + "1e093b1c073b1c073b1c07391a053a1b063a1b063b1c073c1d09391c0a351808381d0a34" + "1b072e18033b25173420152d1a134d3a36978488a7969e9e8d95988892988b95988d9399" + "909599949195928b9591886e645a57524e484b5444495d5a6794334693334cb34964d73f" + "55cc000258060b5c0000371014399e9fb19d9da79694959c9793ada5a2a49e9ea19fa29d" + "9ca198999e97989d85888f82868f838a94898f9b858d9887919b8a949e909aa4919ea78b" + "98a18997a08997a084929b82909979868f717e8767747d63707968757e5f6c755d6a735b" + "68716f7c857b889176838c76838c8b98a1818e977a8790808d96929fa887949d7a889177" + "858e717f886b7982717f8872808968767f5f6d765a687160737a65787f6d80877e8f9787" + "949d89919c8e94a09a9eaaa4a8b4a8aab6aba8afa29fa696959b9291998f8f978f8f978c" + "8f968a8f93888d9185898c888c8f8f9396979b9e9fa3a6a1a5a89ca0a391959893979aa1" + "a4a9a3a6aba1a6aa9fa4aa9aa1a79099a0858f98848e97707d857585948797a78696a675" + "85947686958595a282929f899aa48e9fa993a4ae8fa2a985989f697c8368798172838b61" + "727a60737a6f82896d7e866f7d866e7c856f7d8674828b75838c77858e7b89927a889177" + "868d707f867180856e7c7f707b7f5860624645432d201a2e1d1631190f48281b4b271954" + "2f1f724c39825c49795241916d5dbea095bfa79dbaa19ab9a29cb19c99ac9a9aae9e9fa3" + "949ba1949da0949ea094a0a0949ea1969a9f94989d93949e9493a49a99a69c9ba9a19fa1" + "9899999393958f919e989aa19b9d9e989a969092999395938d8f8f898b89838585818281" + "7d7e7e7a7b767273706c6d716d6e6a66676e6a6b716d6e706c6d696363555150433f3e41" + "403e3736341c1c1a1616141919171214110d120c12140f17161218130f1e100d311d1c30" + "12145e35396f4549663c40451b1d4f27274a2423381914341b161e0f0a190e0a221d1a31" + "302e2f2e2c3938363b3a384c4b473736312f2e292f2f272c2c2429292117161126252030" + "2f2a302f2a32312c2e2d282b2a2526252023221d2827221a191416151012110c201f1a1f" + "1e19100f0a1615101c1b161c1b161817121f1e191c1b1614130e0c0b0613120d17161118" + "1712201f1b1f1e1a2625212625212a29252f2e2a201f1b09080406050120211c2f333434" + "343c33333f3431443431443430412e2a381b191e130f0e0d08040d05021308021c0e051e" + "0d03453327504033291b1033251c523c2f9780726b5446715a4c321b0d2b140638190438" + "1904391a05391a05391a053718033718033718033718033718033a1b06391a0538190439" + "1a053a1b063a1b063b1c073c1d083c1d09391c0a3013033518063318052e1501412c1b33" + "2012301c13392620806d719f8e969e8d959686909c8f989b909699909395908d95928b97" + "928c988a87958b8a99969d9998a88389ab929fd67687d53a4ca200005500004303064b08" + "0a3d2124439d9caa9f9ea6a29e9f9e99969f9a97a19b9b9e9c9f9d9ba099989e97989d96" + "99a081858e777e885f65716f7782838d978e98a2939da788959e808d967d8b947b89927b" + "89927b89928390998f9ca598a5ae98a5ae929fa885929b7c899277848d808d9678858e76" + "838c65727b66737c6f7c8566737c65727b6c7982616e776d7b8475838c78868f76848d86" + "949d8c9aa38b99a286949d83919a74858d6b7e85677a815d6e7656636c6f7983737b867e" + "828e868a968a8c98908f9794939b9b9ba39f9fa9a2a5aea6a9b2a8acb5a7aeb4a7aeb4ab" + "b6b8a8b2b49fa9ab98a2a4929c9e929d9f8d989a85909287919383888c8a8f9592999f96" + "9da397a0a799a3ac7e8b93808d9689969f6c7c8b7383936e7e8d6676857585926f7f8c6f" + "7f8c71828c697a846a7b857b8e958699a082959c8899a198a9b18899a18b99a299a7b095" + "a3ac88969f89969f8c99a294a1aa87949d86949d85939c808e977b8a917a898e7281866b" + "797c707e81666e716161632f25232a1c19331f18280d02381b0d3e1e0f43221166433068" + "4532745342876a5ca58a7fb39b91b09d99ac9a98b7a7a7b8a9acb6a9b0aca0aaa69aa4a2" + "98a3a59ba6aa9fa3a59a9e998f909187869e94939d95939e96949f96979d97979c969898" + "92949892949c9698a29c9e9b9597989294958f918f898b8d898a8b87888884857f7b7c78" + "74757975766a66676e6a6b757172736f706b65655f5b5a3e3a393c3b393837351c1c1a15" + "15131818161212100f140e12140f14130f130e0a1f110e2f1d1b37191b4f282b562c3059" + "2f33613739502828411b1a43241f361d1822130e1c110d241f1c3332302f2e2c32312f38" + "37355857533f3e39302f2a2e2e2628282023231b0e0d081d1c172a292432312c3b3a3540" + "3f3a42413c41403b3e3d3836353024231e1a191414130e35342f373631302f2a2d2c272d" + "2c272a292425241f24231e24231e1a19140f0e0915140f1918131a19141c1b171b1a161c" + "1b171a19151a19151918141a19151716120706021616141b1f2021212920202c23203127" + "24372a26352723311c1a1f181415120a070b01000d000024130b2c1a102e1a0f3a281c2e" + "1d132f1e16392316533c2e4f382a644d3f230c0028110338190438190437180337180337" + "18033617023617023617023617023617023819043617023617023617023a1b063a1b063b" + "1c073c1d083c1d093d1e0c331304361907351a073017033c27162c190b301c132c17126b" + "585a9a878da08f9597888f9e919a9c9197988f92938e8b948f89978f8c9d8f8f9a8e909e" + "989c9b98a19d9eb09b9fc28088b9000239070d4b03023e08074006052f25253f83818c7f" + "7c837470717973738a84849c96989c98999b999c99989e97989d90939a8f939c8e959f7f" + "869078808b868e998e96a1929ca68e98a28d9aa38a97a084929b84929b86949d84919a81" + "8e9779868f717e876b7881626f785f6c755b68715a67706e7b8475828b75828b7e8b948c" + "99a288959e88959e88959e84919a87959e8997a07c8a93717f8873818a7b89927c8a937a" + "88917a88917081896f828971848b77889077848d7b858f828a958b919d959ba79b9fabab" + "abb5a1a4ad9c9fa89b9da99ca0ab9b9faa959ca6929ba28e999f82949683929583929584" + "9396839295829496839597899b9d94a2a5919a9f8b929a7c858c737c8367717a75828b66" + "747d6b798484929d7383926e7e8d6a7a896b7b887989968696a38798a28d9ea88899a18b" + "9ca48ca0a78fa3aa8a9da48a9ba38b99a287959e88959e8c99a28a97a087949d89939d88" + "929c87919b919ba58f9ca58f9ca58c99a288959d818e947684877380867d8a907b828870" + "7175403a3a352b2a3628252f1c153822153720123317095033215c3d2b7d5e4c674a3a8f" + "7365b59d91bdaba9beacaaa59595a29396ada0a7a79ba5a397a19e949f9d939e9c90929e" + "9294a29899a79d9e9d94959e9596a19b9ba9a3a3ada7a79b9597938d8f928c8e999395a6" + "a0a29c96989c96989a94969791938f8b8c8e8a8b8c8889837f807a7677827e7f716d6e73" + "6f707a76777a7677706a6a68646344403f403f3d3b3a381d1d1b16161418181613131113" + "1510141611161511140f0b1e100d23110f371a1c3b14173b1216451b1f461c1e4a222246" + "201f3e1f1a341b16261712211612221d1a333230302f2d35343237363451504c3f3e3931" + "302b3030282a2a2226261e1a1914181712201f1a2e2d2839383345443f4b4a454b4a4543" + "423d39383325241f17161113120d2726212f2e293736313d3c373f3e393d3c3734332e27" + "26212827221918130b0a0511100b1716111d1c1729282429282423221e1f1e1a1c1b1715" + "14101b1a16201f1b0e0d09171715171b1c1c1c241919231c192a1e1b2c201c2b1e1b2618" + "161b1b1517190f0d13080612030027130c2e1a111b0500210b001d09001c080037201234" + "1a0b452b1c543a2b3117082d130438190437180337180336170236170236170236170236" + "1702361702361702381904371803361702371803391a053a1b063a1b063b1c073c1d0940" + "210f3a1a0b3c1d0b3a1d0b371c0938210f2c1608331d122b17105b4748948187a491979a" + "89919b8e97988d93978c90958c8d95908c978f8c8f80857c70727e75787c767878757c71" + "708072728c00001d000022090633000027080524514e619a97a099949a938f909c9696af" + "a9a99a94969b97989b999c9b9a9f9b9aa094949c8e929b8c909b777e886a707c656d7867" + "6f7a79838d8d97a18b98a187949d7a889178868f79879084919a89969f8f9ca58d9aa37e" + "8b947c899286939c8a97a088959e74818a707d865f6c755e6b745a677059666f626f7867" + "747d69767f67757e73818a7e8c957c8a9383919a8d9ba48a98a18a98a18c9aa37b8c946f" + "8289687b825c6d7553616a606a7469717c757d88838995888e9a888c97868a95868d9787" + "8e98989fa9949ba58d969f8b949d86939b7f9296798c926c7f8563767c65787e64777b65" + "787c6d808477898d75828a7e889187919a88959d8a97a084929d8896a18896a18e9ca992" + "a0ad8f9cac8c9ca98f9fac8e9fa98b99a484929d86949d8a98a18d9ea684989f8a9ea592" + "a5ac92a3ab919fa896a3ac98a2ac959da8949ca7939da7969ea9979faa949ca7848c9784" + "8e9888929c8a949e8b959e8e999f869497828f958a959b7d868d72757c62606356515547" + "3e3f30231d27160e210f052f190c3b2112361b0a4e33205a3d2b7659478e746593807cb9" + "a6a2c9b7b5c3b1b1af9fa2b5a6adb7aab3b4a8b2aea3abb4a8a8afa3a39e949590868785" + "7c7d868080918b8b9993939b9595a6a0a29e989a969092958f91958f91969092958f9195" + "8f91948e908a86878b87888a86877f7b7c7571727f7b7c716d6e716d6e77737477737471" + "6b6b6864634d49484746443e3d3b1f1f1d17171519191713131113151015171219181419" + "14101f110e1c0a082e111326020426000230060a2800002d0505300a092c0d082f161127" + "18132217131d181522211f22211f302f2d2b2a2833322e3635302f2e2932322a3131292e" + "2e261c1b1614130e1918132d2c273b3a354746414c4b464847423c3b363837322625201b" + "1a1516151023221d2c2b2635342f42413c4a49444c4b4641403b2b2a252d2c271a19140a" + "09040e0d0815140f22211c31302c33322e2b2a262a292527262228272323221e1e1d1911" + "100c1919172327282e2e36262630262432211e2f221e2c1f1c2718161b1a14161a0e0e1c" + "0e0d1b0905200901220a001b00001d05001700001f0900301609381e0f4026173b211235" + "1b0c2c12033a1a053a1a0539190438180338180338180338180338180338180338180338" + "1904361702361702361702381904391a05391a053a1b063b1c083f1e0f3f1e0f3d1e0c3a" + "1d0b391e0b3a200f301a0c351f14331c14463233887579a28f939b8a90988b92988d9398" + "8d91978e8f948f8b938e8b908589887e7f978f8d9b9391908b887e797d89838d87818d86" + "8195817a9b797291716c827b78837b767c8a8486aba5a5a59f9f918b8d9993939b97989c" + "9a9d9c9ba09d9ca196979c90959b90949d888c97707682828a958d95a0979faa939da78c" + "96a08b98a187949d8c99a28f9ca58b98a1839099818e977b88916b7881626f7865727b68" + "757e616e7764717a626f7864717a6d7a837e8b947b889184919a8b98a185929b83919a82" + "9099818f9879879074828b6d7b846e7c8576848d83919a74858d6e7f876c7d856d7e866d" + "7b8476838c7e8892808a94868e998a929d9298a48d95a089919c88909b69717c666e7966" + "707a68727c6b78816a7f846c808773878e7b8f96788c93778c91778c91798e937b8e9487" + "959e8c99a28f9ca58e9ca58d9ba68898a58c9ca98898a580909f8795a28b97a58c9aa78d" + "9ba68b99a49aa6b2919ea7909da58e9ba390a1a88da4aa8ea2a98fa2a98fa0a88a97a08e" + "98a29098a38e94a08c929e8b939e8f95a19399a59298a4979da9969ea9969ea9969ea996" + "9fa8889397828d917c878d7e88916d767f666a7575767b7170765a585b3a35313027201f" + "150c3123183b28193722113a210d5d402e74584381665586726ba28b85c7b0aab9a19db2" + "9d9aaf9b9cab989aa091969a8b90948685988a899f9596a69da0a2999c9f999b9e9a9ba4" + "9e9ea6a0a0a49ea09f999b969092918b8d8d87899e989a9a94969993959a9496928e8f95" + "91929490918985867d797a797576726e6f6f6b6c726e6f747071736d6d6763625a565552" + "514f41403e21211f1818161a1a1815151312140f14161118171318130f271c182a1b1837" + "1d1e351314360f12390f133b11132d05052b05042f100b2c130e2819142318141a151214" + "131112110f1e1d1b1b1a181c1b1723221d25241f28282029292129292116151012110c14" + "130e29282333322d3c3b36403f3a3d3c3735342f3837322a292422211c16151028272231" + "302b39383343423d4b4a454f4e4945443f2b2a2531302b1e1d180e0d080d0c0714130e24" + "231e302f2b33322e2c2b272f2e2a2c2b272f2e2a2827231c1b170e0d091717152c303143" + "434b383842312f3c26243229253327242f1c1a1f1a1416190d0d20121123100c21080123" + "080021050025090022070030150a3117083e2413381e0d301605301605290f003b1b063b" + "1b063a1a0539190439190438180338180338180338180338180336170234150034150034" + "1500381904381904391a05391a053a1b073b1a0b3f1e0f3c1b0a3a1b09381b09381d0a33" + "1c0c321a0e331d12341f1e7b686a9c898d9b8a90998a919b8e959b9094988f90918c8890" + "8b8897919389848188837f837e787f7a748e8684797071837a7d8379827e768b7b728587" + "7f8c9c959c8d87898b8585857f7f8b85859993959791919995969d989c9d9ba09d9ca196" + "979c8f929990939c9296a1858b97818994818994858d9889939d919ba58a97a078858e6f" + "7c856f7c8565727b64717a6e7b846e7b846e7b8467747d74818a7f8c957f8c9585929b84" + "919a8b98a18a97a086939c7e8b947e8b94818e976d7a83707e8769778068767f616f785a" + "687158666f62707974828b909ea7899aa283949c81929a84959d87959e87949d88959e7b" + "858f727c86737d8769737d67717b646e78636d776f79836c76806f7983747e887b889187" + "9aa18699a085989f8699a082959c83969d889ba28c9fa68a9ba38899a18d9ba48e9ca78d" + "9ba68b99a48595a280909d80909f8494a3838f9d8995a38a96a28e9aa696a3ac8c99a28f" + "9ca494a1a98b98a08a99a082999f84989f85969e8997a0959fa9949ca7969ca89b9fab97" + "9ba79aa0ac999fab969ca89399a58e94a08c929e858b977d838f787f8970797e67727664" + "6e776b757e626a755359656f737c74777e63666b44444242413c221f181c130a32221531" + "1f113d2614321702553621775b4674594e876b60a98d82ad9186b1948ca78b87a28985a9" + "9493b7a3a2b6a7a4b6a7a4b1a5a5aca3a6a29c9e9a96978884858b8585938d8d8c86888a" + "84868c8688908a8c9791939c9698969092948e90958f918c8889908c8d8f8b8c84808177" + "73747b77787975767470717672737874757b75756b67666965645f5e5c42413f22222019" + "19171a1a1815151312140f13151014130f110c08160b072718153b212245252645212342" + "191d43191b4018183d17162c0d082e15102a1b16251a161c171419181612110f14131117" + "16141f1e1a13120d1918131a1a121919111a1a121a191416151014130e1f1e191d1c1724" + "231e2827222d2c272c2b263736312c2b2624231e0f0e0919181325241f3635303e3d3843" + "423d4746413f3e39272621302f2a1e1d180f0e090a09040f0e091f1e19302f2b33322e2c" + "2b27302f2b2d2c282524202827231e1d190c0b071212102c30334d4e5340404833313c26" + "24312d2a352d2a33211f241c161a2012122616172b1613321710361911280a0026080029" + "0d0232140a4226183a200f301605351b0a2e14032d13023e1e093e1e093e1e093b1b0639" + "1904361601371702381803371702361601371803351601351601351601381904391a053a" + "1b06391a053819053615063a1608391807381905351904351a07361c0d361c0f30180c2b" + "1613624e4f988587a0909396878c9d90979b9094958c8d99918e95908c8c8d887d7e7872" + "726a77746d89867f8c87849b92939a9192887f8478707b7369746c626a71686b7b727385" + "7c7d857c7d888284948e909791919d97979e9a9b9c9a9d9c9ba098999e9699a093969f8d" + "919a767c887076826f7581757d88808893909aa49aa4ae8b98a189969f919ea78c99a286" + "939c919ea78e9ba489969f717e8769767f626f785f6c755d6a735f6c756d7a83717e8772" + "7f886f7c85717e87808d9685929b7e8c9584929b8f9da685939c86949d829099707e876c" + "7a8365737c5a6b735b6c7461727a71828a7b89926c7a836977807380897d8a937e8b9492" + "9eaa939fab8b97a386929e7d89957b87936b77836975816b77836c7884717d897c889489" + "95a1929eaa8b97a384909c818d998795a081929a8596a084959f84959f8898a58999a689" + "99a88d9dac8292a28e9aa8939da9929ca6929ca6929ca5929ca597a1aa9ba6ac9aa5ab96" + "a5ac92a6ad8b9ea583949c818f98818b957a808c757b87757784777b87767a86767a8675" + "7985707480666a76797d898b8f9b8e929e959ca68e979e959ea59ea7b0a0a8b3a3a9b79a" + "a0ac8d949e878b9471767c666c6a5254513b3c37211e1523190d2c1e112e19084126113b" + "1c073c1d085e3e2f8a66569f7a689e7967be9987c9a79bc6a69bac8f87a88f8a98858198" + "86849b8f8f9d9497aca7aba5a3a69b999aa29e9da7a1a1aba5a7a8a2a4a59fa1a29c9e9b" + "9597969092948e90958f919a9496938f90949091918d8e827e7f747071625e5f6e6a6b6d" + "696a5c5859605c5d726c6c625e5d64605f5e5d5b47464427272514141218181614141216" + "171216171219181417120e1d140f2618153d25254e2e2f4a2829481f234b21234b23234e" + "2827452621341b1622130e1409051f1a172d2c2a28272532312f262523201f1b29282328" + "272222221a20201821211923221d1b1a151c1b161c1b1613120d1a19141f1e191f1e1914" + "130e12110c1a19140c0b060e0d0811100b21201b1d1c171716111c1b1621201b24231e23" + "221d22211c23221d12110c14130e1716111d1c172b2a2636353128272331302c1d1c1823" + "221e2c2b272625211c1b170e0e0c2226294b4c514c4c5444434b3a384338353e35323b2a" + "282d251f232315151e0e0f2813102b100931140c35150a3414073113083313082f140330" + "15023116033015022f14013217043c1c073d1d083d1d083b1b063919043818033919043a" + "1a05391904381803371803351601351601351601381904391a053a1b06391a0539180538" + "14063a160a3b1707391805371804371a08381d0c381c0e33180d29140f4d393a847071a2" + "8f939c8b919c8f969b8f93958b8c99918e948f8b87898481847d76777176777166656067" + "6362706a6c716b6d6a61666b62676f66697d74778d8485978f8d9e96949990919b95979f" + "999b9f9999a09a9a9b95979694979795989e9da39d9da5999ca59498a1969aa58c929e87" + "8d99868c9888909b939da79ba5af828f986f7c85738089707d866c7982738089707d8667" + "747d606d766e7b846e7b84707d867d8a937e8b9488959e88959e919ea78b98a1828f9880" + "8d9679868f7f8d968290997a8891717f8868767f59677056646d64727b6d7b846c7d856d" + "7e8672838b82939b8c9aa38f9da68d9ba488969f84919a82909962707b64727d616d795d" + "69755e6a76616d795b67735f6b7769737f808895828a97838b9888909d868e9b828a9782" + "8a97828a978a94a086979f899aa48798a28798a28a9aa78393a08292a18696a57d8a9b8e" + "97a68a949e88929c858f987e889189939c89949a848f957b868c768389687b82697a826a" + "78816a77806d75806d737f6f737f7577847b7d8a8f939f9397a39a9eaa9da1ad9498a4a1" + "a5b1a5a9b5a5a9b5a9b0ba9ea7ae9ca5ac98a0ab979da9949aa88d93a189909a838a9474" + "7b81666f6e5b615f484d492e2f292a23192a20162714053a1f0a3a1a033e1e075a372379" + "503c8f624b92654ea47760ad8472b58e7dbb978bb89a90bca7a2bba8a4baacacb4abb0a3" + "a1a6a09ea39795989692919690909f999ba09a9ca49ea0a49ea0a09a9c969092948e9094" + "8e90989294959192959192928e8f8682837b77787470717975767b77786b67686e6a6b7d" + "7777716d6c726e6d6f6e6c4c4b4929292714141217171514141215161115161118171315" + "120d180f0a231512422a2a5b3d3d59393a663d41653b3d5d35355c36354c2d283a211c25" + "1611160b071e19162d2c2a2625232f2e2c2e2d2b34332f3b3a353b3a3535352d31312931" + "312921201b1615101a191427262129282326252026252025241f1f1e191e1d182827221b" + "1a1512110c0b0a051c1b161c1b1615140f1a191421201b23221d1f1e191d1c171c1b160e" + "0d08100f0a12110c1716112c2b2739383433322e46454139383435343032312d2625211d" + "1c180e0e0c1a1e2136373b36373c33323a2e2d352e2b342c2930252328231d212517171f" + "0f1027120f290e072f130835150835130733130633130631140231160331160331160330" + "15023217043b18043c19053d1a063c19053c19053d1a063e1b073e1b073e1b073b1b0637" + "1803351601351601351601381904391a053a1b06391a053918053913083b150a3b170739" + "1805371804381c073a1f0e3a1e10341a0d2d15113521206c58599e8b8f9d8c929b8f939a" + "8e92948a8b988e8d938e8b868b848a8f8883858081837e8f8f8d8f8d90928d93938e9497" + "9097958f8f979191979191968e8c9f9697a19899968d8e9a9192948b8e978e8f958c8d8b" + "858786848787858898979c999a9f95989f93969d7f838e777b87717581676d79646c7772" + "7a8588929c919ba5919ba598a2ac8e9ba48c99a28c99a289969f87949d808d9686939c7f" + "8c9574818a5c69725d6a7367747d68757e5d6a735c69726370796f7c856d7a8372808982" + "9099808e9788969f83919a83919a76848d86949d84929b61727a596a7257687057687056" + "676f61727a6a7b8374858d798790798a9286979f8997a088969f88959e8d9aa3929ca68a" + "949e8c96a0949ca79295a49194a38c8f9e8b8e9d8a8d9c888b9a8d909f8f92a1939ba88e" + "9ca58da0a78b9ca68a9ba58c9da79dabb89caab7a0adbd96a2b2939da98a929d87909987" + "9099798289737c837d868d8b9499929ba0929da18e9fa794a2ab9aa7b09ca9b2a4acb7a6" + "aab6a5a9b5a7abb7a9abb89ca2ae9ea4b0a0a6b29fa5b19ea4b0a2a8b4969ca8949aa694" + "9ba58e979e868f967c828e777d897578876164736a6e79656c765c656a6a747568716e59" + "625d40423d3531283229202715073318053515003d1a044c260f5a2e156f402478462b95" + "63489a6a53ad7f68cda492cba99dbfa8a2bca9a5baacacada7abb0adb4adacb1aaa8aba4" + "a09f9f9999969092999395a19b9da49ea0a29c9e979193928c8e928c8e958f9197939496" + "92939490918b8788858182726e6f6f6b6c736f70666263676364746e6e6b67666b67666b" + "6a685453512c2c2a14141216161414141214151014151017161213100b19100b2116123d" + "282754383752323362393d673d3f643c3c643e3d5435303f2621281914180d091d18152a" + "292721201e29282634333147464245443f47464140403838383036362e23221d12110c17" + "16112f2e293c3b36302f2a2c2b262d2c27302f2a2a292435342f2c2b2615140f1a19142c" + "2b26302f2a2a29242d2c272b2a252c2b2624231e201f1a1f1e190e0d080e0d08100f0a14" + "130e26252134332f36353151504c4847434645413635312a292524231f13131114181b1e" + "1f231e1f242120262a292f2c29302d2a312a282d2a24282315151d0d0e2813102b100932" + "160b3515083514053413043413043215033317023418033317023216013317023916023a" + "17033c19053c19053c19053e1b073f1c083f1c083f1c083c1c0737180335160135160135" + "1601381904391a053a1b06391a053918053913083b150a3b17093918053817043c1d093c" + "1f0d3b1f11361c0f321a162c18175e4a499683859b8a909c8d92988c9093898a978d8c92" + "8d8a878c8590958e8c8e898b8d8a8c8c8c8e8c918d888f8e89909792989b96939c97949a" + "9592948c8a978e8f948b8c857c7d8b82837d7475857c7d82797a7a74767c777b7d7b7e90" + "8f9493949990939a8e9198969aa59397a38f939f868c98828894969ea9a3adb7939da77b" + "858f7d879176838c76838c707d866d7a8368757e66737c717e876b7881626f7869767f6b" + "78817b8891808d967e8b947e8b9485929b8d9aa387949d77858e87959e76848d82909975" + "838c63717a5a68716f7d867280896e7f876c7d856e7f87798a927d8e9683949c8e9fa78f" + "a0a88e9fa791a2aa85969e87959e88969f89969f8b98a18c96a07f89937e8892838b9697" + "99a89698a79193a29193a2989aa99698a79c9ead9b9dac9aa0ae92a0a990a3aa8d9ea88b" + "9ca68c9da78a98a58997a48e9aaa838f9f98a0ad8b949d8b949d929ba4818a91868f968e" + "979c98a1a69ca6a89ba6aa919fa895a2ab98a5ae9ba5afa0a6b29fa3af9ca0ac969aa692" + "96a2969ca8959ba78f95a1878d998b919d8a909c767c88747a866a737c6f787f68717861" + "67736066726365746b6d7c7c808b777e88727b806f797a707b77646f6b494e483b383141" + "38312f1d0f341906311100381400441c034719005c2b0d683314875233865338986851bf" + "9481bf998cbaa39dbba6a1bbadadafa9adaca9b0aaa9afaaaaaca7a3a2a29c9c958f9198" + "92949f999ba19b9d9f999b979193918b8d908a8c928c8e9894959692939490918f8b8c8c" + "88897a76776f6b6c7773746b67686b6768787272706c6b6d69686f6e6c5b5a582e2e2c14" + "141214141214141212130e12130e151410120f0a18110b201511362120462a294022224b" + "2226562c2e5c34345f393850312c412823291a15180d091d18152524221c1b1923222034" + "33314e4d4944433e48474240403834342c32322a28272211100b15140f2e2d283d3c372f" + "2e292c2b2633322d3d3c372e2d2838373231302b15140f1615102a292431302b2b2a252e" + "2d2833322d33322d2b2a2527262125241f12110c11100b11100b14130e201f1b2f2e2a32" + "312d4e4d494645414b4a46363531302f2b2c2b271a1a1813171a12131714151a1a191f19" + "181e1d1a211e1b221d1b201e181c1c10101a0a0b28151130150e381c1135150835140534" + "1304341304351604341803351904341803331702331702" + }; +int data_0_size = 177526; + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/make_gtk3 b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/make_gtk3 new file mode 100755 index 0000000..9120de9 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/make_gtk3 @@ -0,0 +1,41 @@ +# +# Make file for the newer Gtk-3 version of OTS GUI. +# To compile: make -f make_gtk3 +# +# Produces: bin/ots_gui3 +# + +#==================== +#====== Macros ====== +#==================== + +#====== OpenTaxSolver GUI programs; in ../../bin/ ====== +OTS_GUI := \ + ots_gui3 \ + notify_popup3 + +# List of OTS GUI programs in ../../bin/ +EXE_OTS_GUI := $(patsubst %,../../bin/%, $(OTS_GUI)) + +#=================== +#====== Rules ====== +#=================== + +all: $(EXE_OTS_GUI) + +# Pattern rule for GUI programs in ../../bin/ +# includes dependency on any (all) gtk modules +$(EXE_OTS_GUI): ../../bin/%: %.c gtk_utils3.c gtk_utils3.h gtk_file_browser3.c + gcc -O -Wall -fmax-errors=1 -Wno-unused-result `pkg-config --cflags gtk+-3.0` $< `pkg-config --libs gtk+-3.0` -o $@ + +clean: + rm -f $(EXE_OTS_GUI) + + + +# Notes: +# On some versions of Linux, it may be necessary to execute the following command +# before compiling this make-file, so that pkg-config finds the gtk3+ libs. +# export PKG_CONFIG_PATH=/usr/lib/pkgconfig +# Also, be sure to install "gtk3-devel". + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/makefile b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/makefile new file mode 100755 index 0000000..1ffdf8c --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/makefile @@ -0,0 +1,34 @@ +#==================== +#====== Macros ====== +#==================== + +#====== OpenTaxSolver GUI programs; in ../../bin/ ====== +OTS_GUI := \ + ots_gui2 \ + notify_popup + +# List of OTS GUI programs in ../../bin/ +EXE_OTS_GUI := $(patsubst %,../../bin/%, $(OTS_GUI)) + +#=================== +#====== Rules ====== +#=================== + +all: $(EXE_OTS_GUI) + +# Pattern rule for GUI programs in ../../bin/ +# includes dependency on any (all) gtk modules +$(EXE_OTS_GUI): ../../bin/%: %.c gtk_utils.c gtk_utils.h gtk_file_browser.c + gcc -O -Wall `pkg-config --cflags gtk+-2.0` $< `pkg-config --libs gtk+-2.0` -o $@ + +clean: + rm -f $(EXE_OTS_GUI) + + + +# Notes: +# On some versions of Linux, it may be necessary to execute the following command +# before compiling this make-file, so that pkg-config finds the gtk2+ libs. +# export PKG_CONFIG_PATH=/usr/lib/pkgconfig +# Also, be sure to install "gtk2-devel". + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/makefile_mswin b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/makefile_mswin new file mode 100755 index 0000000..d36517b --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/makefile_mswin @@ -0,0 +1,29 @@ +#==================== +#====== Macros ====== +#==================== + +# For MSYS1.0, define "CFLAGS = -std=c99" +# in your build env + +#====== OpenTaxSolver GUI programs; in ../../bin/ ====== +OTS_GUI := \ + ots_gui2 \ + notify_popup + +# List of OTS GUI programs in ../../bin/ +EXE_OTS_GUI := $(patsubst %,../../bin/%.exe, $(OTS_GUI)) + +#=================== +#====== Rules ====== +#=================== + +all: $(EXE_OTS_GUI) + +# Pattern rule for GUI programs in ../../bin/ +# includes dependency on any (all) gtk modules +$(EXE_OTS_GUI): ../../bin/%.exe: %.c gtk_utils.c gtk_utils.h gtk_file_browser.c + gcc -$(CFLAGS) -O -Wall `pkg-config --cflags gtk+-2.0` $< `pkg-config --libs gtk+-2.0` -o $@ + +clean: + rm -f $(EXE_OTS_GUI) + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/notify_popup.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/notify_popup.c new file mode 100755 index 0000000..aba1b5e --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/notify_popup.c @@ -0,0 +1,177 @@ +/************************************************************************************************ + Notify_Popup - Stand alone pop-up notifier utility. + Accepts a message on command-line, and pops up a small window with the message. + Useful for alerting users of warnings or errors, especially for non-graphical programs or + scripts. + + Amazing there is not already a universal command like this. It should be the same command + natively available within *all* operating systems and platforms. But could not be found. + (Other than "xmessage" in Linux, but is often not installed. Or "osascript" in MacOS, but indirect.) + So here it is. + + Multi-word messages should be quoted. + Example: + notify_popup "Warning: Bad file detected." + + You can enter multiple explicit lines with separate arguments, like: + Example: + notify_popup "Please re-run the program." "Because of bad data." " -bye" + + Options: + -delay n - Delays popping-up for n-seconds. + -expire nn - Automatically close after nn seconds. + + Planned future features: + - Command-line options to specify: + - Message text color, size, & boldness. + -textcolor r g b, (RGB values in 0.0 - 1.0 range) + -textsize fs (Default Font size = 10) + -textbold + -textnormal + - Ability to specify line-breaks in message with a symbol. (In addition to the method above.) + \n + - Window name (ex. Note, Warning, Error, etc.) + -title "Warning" + - Optional button(s), with command(s) to execute when pressed. + -button "label" command + - Ability to specify a file to provide the text. + -file notice.txt + - Scrollable panel when text exceeds window size. + + Compile: + gcc -O notify_popup.c `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` -o notify_popup + + Public Domain. + ***********************************************************************************************/ +#include +#include +#include +#include "gtk_utils.c" + +char *my_version="1.0"; + + +void OK_Button( GtkWidget *win, void *data ) +{ + exit(0); +} + + +int main( int argc, char *argv[] ) +{ + GtkWidget *winpanel; + int winwidth, winhght, ypos=10, minht=80, minwd=250, nsecs=0; + int j, k=1, col=0, maxcols=0, nlines=0, num_in=0, cnt=0, expire=0; + char *text_in[999], *mesg[999], line[4096]; + double endtime=0.0; + + /* Accept command-line arguments. */ + k = 1; + while (k < argc) + { + if (strcmp( argv[k], "-delay" ) == 0) + { + k++; + if (k == argc) + { printf("Missing value after option '%s'\n", argv[k-1] ); exit(1); } + if (sscanf(argv[k], "%d", &nsecs ) != 1) + { printf("Bad integer after option '%s'\n", argv[k-1] ); exit(1); } + } + else + if (strcmp( argv[k], "-expire" ) == 0) + { + k++; + if (k == argc) + { printf("Missing value after option '%s'\n", argv[k-1] ); exit(1); } + if (sscanf(argv[k], "%d", &expire ) != 1) + { printf("Bad integer after option '%s'\n", argv[k-1] ); exit(1); } + endtime = Report_Time() + (double)expire; + } + else + if (strcmp( argv[k], "-help" ) == 0) + { + printf("Notify Popup version %s:\n Options:\n", my_version ); + printf(" -delay n - Delays popping up for n-seconds.\n"); + printf(" -expire nn - Automatically close after nn seconds.\n\n"); + exit(0); + } + else + text_in[num_in++] = strdup( argv[k] ); /* Accept text to display. */ + k++; + } + if (num_in == 0) + { + printf("Error: No text to display on command-line.\n"); + exit(1); + } + + /* Scan through the text, breaking it into lines. */ + for (cnt = 0; cnt < num_in; cnt++) + { /*cnt*/ + col = 0; + j = 0; + while (text_in[cnt][j] != '\0') /* Determine max line width and number of rows. */ + { /*loop*/ + if ((text_in[cnt][j] == '\n') || ((text_in[cnt][j] == ' ') && (col >= 90)) || (col > 180)) + { + if ((text_in[cnt][j] != '\n') && (text_in[cnt][j] != ' ')) + line[col++] = text_in[cnt][j++]; + line[col] = '\0'; + mesg[nlines++] = strdup( line ); + if (nlines > 900) { printf("Error: Too many lines.\n"); exit(1); } + if (col > maxcols) + maxcols = col; + col = 0; + } + else + line[col++] = text_in[cnt][j]; + j++; + if (j >= 1024) { printf("Error: line too long.\n"); exit(1); } + } /*loop*/ + if (col > 0) + { + line[col] = '\0'; + mesg[nlines++] = strdup( line ); + if (col > maxcols) + maxcols = col; + } + } /*cnt*/ + + /* Determine the needed window size. */ + winwidth = 30 + maxcols * 7; + winhght = 65 + 18 * nlines; + if (winwidth < minwd) + winwidth = minwd; + if (winhght < minht) + winhght = minht; + + if (nsecs > 0) + Sleep_seconds( (float)nsecs ); + + /* Initialize and generate top-outer window. */ + winpanel = init_top_outer_window( &argc, &argv, winwidth, winhght, "Notice", 0, 0 ); + + for (j=0; j < nlines; j++) + { + make_label( winpanel, 20, ypos, mesg[j] ); + ypos = ypos + 18; + } + make_button( winpanel, winwidth/2 - 30, winhght - 38, " OK ", OK_Button, 0 ); + + /* When the window is given the 'forced delete_event' signal by the window manager, exit the program. */ + gtk_signal_connect( GTK_OBJECT(outer_window), "delete_event", GTK_SIGNAL_FUNC(exit), NULL ); + + gtk_widget_show_all( outer_window ); + while (1) // gtk_main(); + { + UpdateCheck(); /* Check for, and serve, any pending GTK window/interaction events. */ + Sleep_seconds( 0.1 ); /* No need to spin faster than ~10 Hz update rate. */ + if (expire > 0) + { + if (Report_Time() > endtime + (double)nsecs) + exit(0); + } + } + return 0; +} + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/notify_popup3.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/notify_popup3.c new file mode 100755 index 0000000..87f724f --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/notify_popup3.c @@ -0,0 +1,177 @@ +/************************************************************************************************ + Notify_Popup - Stand alone pop-up notifier utility. + Accepts a message on command-line, and pops up a small window with the message. + Useful for alerting users of warnings or errors, especially for non-graphical programs or + scripts. + + Amazing there is not already a universal command like this. It should be the same command + natively available within *all* operating systems and platforms. But could not be found. + (Other than "xmessage" in Linux, but is often not installed. Or "osascript" in MacOS, but indirect.) + So here it is. + + Multi-word messages should be quoted. + Example: + notify_popup "Warning: Bad file detected." + + You can enter multiple explicit lines with separate arguments, like: + Example: + notify_popup "Please re-run the program." "Because of bad data." " -bye" + + Options: + -delay n - Delays popping-up for n-seconds. + -expire nn - Automatically close after nn seconds. + + Planned future features: + - Command-line options to specify: + - Message text color, size, & boldness. + -textcolor r g b, (RGB values in 0.0 - 1.0 range) + -textsize fs (Default Font size = 10) + -textbold + -textnormal + - Ability to specify line-breaks in message with a symbol. (In addition to the method above.) + \n + - Window name (ex. Note, Warning, Error, etc.) + -title "Warning" + - Optional button(s), with command(s) to execute when pressed. + -button "label" command + - Ability to specify a file to provide the text. + -file notice.txt + - Scrollable panel when text exceeds window size. + + Compile: + gcc -O notify_popup3.c `pkg-config --cflags gtk+-3.0` `pkg-config --libs gtk+-3.0` -o notify_popup + + Public Domain. + ***********************************************************************************************/ +#include +#include +#include +#include "gtk_utils3.c" + +char *my_version="1.0"; + + +void OK_Button( GtkWidget *win, void *data ) +{ + exit(0); +} + + +int main( int argc, char *argv[] ) +{ + GtkWidget *winpanel; + int winwidth, winhght, ypos=10, minht=80, minwd=250, nsecs=0; + int j, k=1, col=0, maxcols=0, nlines=0, num_in=0, cnt=0, expire=0; + char *text_in[999], *mesg[999], line[4096]; + double endtime=0.0; + + /* Accept command-line arguments. */ + k = 1; + while (k < argc) + { + if (strcmp( argv[k], "-delay" ) == 0) + { + k++; + if (k == argc) + { printf("Missing value after option '%s'\n", argv[k-1] ); exit(1); } + if (sscanf(argv[k], "%d", &nsecs ) != 1) + { printf("Bad integer after option '%s'\n", argv[k-1] ); exit(1); } + } + else + if (strcmp( argv[k], "-expire" ) == 0) + { + k++; + if (k == argc) + { printf("Missing value after option '%s'\n", argv[k-1] ); exit(1); } + if (sscanf(argv[k], "%d", &expire ) != 1) + { printf("Bad integer after option '%s'\n", argv[k-1] ); exit(1); } + endtime = Report_Time() + (double)expire; + } + else + if (strcmp( argv[k], "-help" ) == 0) + { + printf("Notify Popup version %s:\n Options:\n", my_version ); + printf(" -delay n - Delays popping up for n-seconds.\n"); + printf(" -expire nn - Automatically close after nn seconds.\n\n"); + exit(0); + } + else + text_in[num_in++] = strdup( argv[k] ); /* Accept text to display. */ + k++; + } + if (num_in == 0) + { + printf("Error: No text to display on command-line.\n"); + exit(1); + } + + /* Scan through the text, breaking it into lines. */ + for (cnt = 0; cnt < num_in; cnt++) + { /*cnt*/ + col = 0; + j = 0; + while (text_in[cnt][j] != '\0') /* Determine max line width and number of rows. */ + { /*loop*/ + if ((text_in[cnt][j] == '\n') || ((text_in[cnt][j] == ' ') && (col >= 90)) || (col > 180)) + { + if ((text_in[cnt][j] != '\n') && (text_in[cnt][j] != ' ')) + line[col++] = text_in[cnt][j++]; + line[col] = '\0'; + mesg[nlines++] = strdup( line ); + if (nlines > 900) { printf("Error: Too many lines.\n"); exit(1); } + if (col > maxcols) + maxcols = col; + col = 0; + } + else + line[col++] = text_in[cnt][j]; + j++; + if (j >= 1024) { printf("Error: line too long.\n"); exit(1); } + } /*loop*/ + if (col > 0) + { + line[col] = '\0'; + mesg[nlines++] = strdup( line ); + if (col > maxcols) + maxcols = col; + } + } /*cnt*/ + + /* Determine the needed window size. */ + winwidth = 30 + maxcols * 7; + winhght = 65 + 18 * nlines; + if (winwidth < minwd) + winwidth = minwd; + if (winhght < minht) + winhght = minht; + + if (nsecs > 0) + Sleep_seconds( (float)nsecs ); + + /* Initialize and generate top-outer window. */ + winpanel = init_top_outer_window( &argc, &argv, winwidth, winhght, "Notice", 0, 0 ); + + for (j=0; j < nlines; j++) + { + make_label( winpanel, 20, ypos, mesg[j] ); + ypos = ypos + 18; + } + make_button( winpanel, winwidth/2 - 30, winhght - 38, " OK ", OK_Button, 0 ); + + /* When the window is given the 'forced delete_event' signal by the window manager, exit the program. */ + g_signal_connect( outer_window, "delete_event", G_CALLBACK(exit), NULL ); + + gtk_widget_show_all( outer_window ); + while (1) // gtk_main(); + { + UpdateCheck(); /* Check for, and serve, any pending GTK window/interaction events. */ + Sleep_seconds( 0.1 ); /* No need to spin faster than ~10 Hz update rate. */ + if (expire > 0) + { + if (Report_Time() > endtime + (double)nsecs) + exit(0); + } + } + return 0; +} + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/ots_gui2.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/ots_gui2.c new file mode 100755 index 0000000..146b414 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/ots_gui2.c @@ -0,0 +1,4457 @@ +/********************************************************/ +/* OTS_GUI.c - OpenTaxSolver Graphical User Interface. */ +/* Based on GimpToolKit (Gtk) widgets. */ +/* */ +/* This version is based on Gtk-2 widgets. */ +/* */ +/* The OTS_GUI is designed to read-in standard OTS data */ +/* files, and present the tax information on your */ +/* screen. It allows entering the values, saving */ +/* return data, editing previously saved return sheets, */ +/* and running the OTS tax-solver to compute your */ +/* taxes. */ +/* */ +/* The OTS tax-solver is a text program which can be */ +/* used by itself. This GUI front-end simplifies using */ +/* OTS. It walks you through the steps and invokes the */ +/* regular OTS solver when you are ready. */ +/* */ +/* OTS data files, for example "tax_xx.txt", contain */ +/* the line numbers (or names) of the entries for a */ +/* given tax form, as well as any previously entered */ +/* values for each line. Additional comments may */ +/* follow on any line. */ +/* A few example lines follow: */ +/* */ +/* L15 ; { Rental income } */ +/* L17 234.00 ; { Savings interest } */ +/* L18 { Dividends } */ +/* 23.00 { Bank1 } */ +/* 14.50 ; { Work loan } */ +/* */ +/* OTS_GUI reads these lines and places a label for */ +/* each line number/name, a text-box for filling in the */ +/* value(s), and additional labels for the comments. */ +/* At the bottom are placed buttons to save and */ +/* calculate-taxes. */ +/* */ +/* To compile this graphical program, you will need the */ +/* Gtk library. */ +/* */ +/* Compile: */ +/* cc -O `pkg-config --cflags gtk+-2.0` ots_gui2.c \ + `pkg-config --libs gtk+-2.0` -o ots_gui2 */ +/* */ +/********************************************************/ + +float version=2.76; +char package_date[]="April 28, 2025"; +char ots_release_package[]="22.07"; + +/************************************************************/ +/* Design Notes - */ +/* Unlike the individual tax programs, which can know */ +/* what to expect on each line, this GUI does not know */ +/* about the format of any particular tax form file. */ +/* Therefore, it applies some simple rules to parse */ +/* the fields: */ +/* 1. The next non-comment / non-white-space character */ +/* after a ";" is interpreted as a line-label. */ +/* (eg. L51) */ +/* However, some lines expecting single values were */ +/* not terminated with ";", so other rules are needed. */ +/* 2. Any line with a non-comment / non-white-space char */ +/* in column 1 (first char on line), is assumed to be */ +/* a line-label. So all field values should be */ +/* indented to use the GUI with them. */ +/* Internal Architecture: + Main + -pick_file + -receive_filename + -open_taxfile + -Get_New_Tax_Form_Page + -Get_Tax_Form_Page + -Read_Tax_File + -Setup_Tax_Form_Page - Creates the window for the form-page. + -DisplayTaxInfo - Renders the interactive form-page. + -check_comments +*/ +/************************************************************/ + +#include +#include +#include +#include +#include +// #include "backcompat.c" +#include "gtk_utils.c" /* Include the graphics library. */ +#include "gtk_file_browser.c" + + GtkWidget *mpanel, *mpanel2, *warnwin=0, *popupwin=0, *resultswindow=0, *scrolledpane, *title_label; + int operating_mode=1, need_to_resize=0, debug=0; + double last_resize_time; + +int verbose=0; +int winwidth=450, winht=480; +FILE *infile; +int ots_column=0, ots_line=0; /* Input file position. */ +#define MaxFname 4096 +char wildcards_bin[MaxFname]="", filename_exe[MaxFname]="", *ots_path; +char workdir[MaxFname+512]=""; +char temp_dir[MaxFname+512]=""; +char directory_dat[MaxFname+512]=".", wildcards_dat[MaxFname]="*.txt", filename_incl[MaxFname]=""; +char directory_incl[MaxFname]="tax_form_files", wildcards_incl[MaxFname]="*_out.txt"; +char wildcards_spreadsheet[MaxFname]="*.csv *.tsv"; +char directory_fb[MaxFname]="", wildcards_fb[MaxFname]="", filename_fb[MaxFname]=""; +char *title_line="Tax File", *current_working_filename=0, *invocation_path, *include_file_name=0; +char wildcards_out[MaxFname]="*_out.txt"; +char run_options[MaxFname]=""; +int fronty1, fronty2, computed=0, ok_slcttxprog=1; +char *yourfilename=0; +char toolpath[MaxFname]="", *start_cmd; +int pending_compute=0, supported_pdf_form=1; +int filingstatus_mfj=1; +int round_to_whole_nums=0, round_pdf_to_whole_dollars=0; + +void pick_file( GtkWidget *wdg, void *data ); /* Prototype */ +void consume_leading_trailing_whitespace( char *line ); +void get_line_entry( char *word, int maxn, int *linenum, FILE *infile ); +void Run_TaxSolver( GtkWidget *wdg, void *x ); +void helpabout2( GtkWidget *wdg, void *data ); +void read_instructions( int init ); +void dump_taxinfo(); +int warn_release=0; + +int selected_other=0; +void save_taxfile( GtkWidget *wdg, void *data ); +void printout( GtkWidget *wdg, void *data ); +void taxsolve(); +char *taxsolvecmd=0, taxsolvestrng[MaxFname]=""; + +#define VKIND_FLOAT 0 +#define VKIND_INT 1 +#define VKIND_TEXT 2 +#define VKIND_COMMENT 3 +#define VKIND_COLON 4 + +#define VALUE_LABEL 0 +#define COMMENT 1 +#define SEMICOLON 2 +#define NOTHING 10 +#define ENABLED 1 +#define DISABLED 0 + +#define LITERAL_INFO 1 +#define ID_INFO 2 + +#define CAPGAIN_READY "" // "Ready" + +char program_names[30][100] = + { + "taxsolve_US_1040_2024", /* 0 */ + "taxsolve_US_1040_Sched_C_2024", /* 1 */ + "taxsolve_US_8829", /* 2 */ + "taxsolve_CA_540_2024", /* 3 */ + "taxsolve_NC_D400_2024", /* 4 */ + "taxsolve_NJ_1040_2024", /* 5 */ + "taxsolve_OH_IT1040_2024", /* 6 */ + "taxsolve_PA_40_2024", /* 7 */ + "taxsolve_VA_760_2024", /* 8 */ + "taxsolve_NY_IT201_2024", /* 9 */ + "taxsolve_MA_1_2024", /* 10 */ + "taxsolve_GA_500", /* 11 */ + "taxsolve_AZ_140_2024", /* 12 */ + "taxsolve_MI_1040_2024", /* 13 */ + "taxsolve_OR_40_2024", /* 14 */ + "Other", /* xx */ + }; + +enum form_names { form_US_1040, form_US_1040_Sched_C, form_US_8829, form_CA_540, + form_NC_D400, form_NJ_1040, form_OH_IT1040, form_PA_40, + form_VA_760, form_NY_IT201, form_MA_1, form_GA_500, form_AZ_140, + form_MI_1040, form_OR_40, form_other, + form_1040e, form_4562, form_8582 + }; +int selected_form=form_other, other_form_selected=0; + + +char *setform( int formnum ) +{ + char twrd[500]; + sprintf( twrd, "%d", formnum ); + return strdup( twrd ); +} + + +#ifndef PLATFORM_KIND + #define Posix_Platform 0 + #define Mingw_Platform 1 + #define MsVisC_Platform 2 + #ifdef __CYGWIN32__ + #ifndef __CYGWIN__ + #define __CYGWIN__ __CYGWIN32__ + #endif + #endif + #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MSYS__) + #define PLATFORM_KIND Mingw_Platform /* MinGW or like platform */ + #elif defined(__WIN32) || defined(WIN32) + #define PLATFORM_KIND MsVisC_Platform /* microsoft visual C */ + #else + #define PLATFORM_KIND Posix_Platform /* Posix/Linux/Unix */ + #endif +#endif + + +#if (PLATFORM_KIND != Posix_Platform) + char slashchr='\\'; + char slashstr[]="\\"; +#else + char slashchr='/'; + char slashstr[]="/"; +#endif + + +void dismiss_general_warning( GtkWidget *wdg, void *data ) +{ + switch (warn_release) + { + case 1: pick_file( 0, 0 ); + warn_release = 0; + close_any_window( 0, data ); + break; + case 2: save_taxfile(0,"1"); /* Re-open file-browser. */ + warn_release = 0; + close_any_window( 0, data ); + if (pending_compute == 1) pending_compute++; + break; + default: close_any_window( 0, data ); + } +} + + +int dismiss_general_warning_ret0( GtkWidget *wdg, void *data ) +{ + dismiss_general_warning( wdg, data ); + warnwin = 0; + return 0; +} + + +char wmsg[4096], *pending_message=0; + +void GeneralWarning( char *mesg ) /* Used for one-line warning messages. */ +{ + int xpos=20, ypos=20, winwdth, winhght=100; + GtkWidget *winframe; + printf("%s\n", mesg); + winwdth = 90 + strlen( mesg ) * 8; + winframe = make_window( winwdth, winhght, "Warning Message", &warnwin ); + make_label( winframe, xpos, ypos, mesg ); + make_button( winframe, winwdth/2 - 30, winhght - 40, " Ok ", dismiss_general_warning, &warnwin ); + gtk_window_set_keep_above( (GtkWindow *)warnwin, 1 ); + show_wind( warnwin ); +} + + +void GeneralPopup( char *title, char *mesg, int to_text_win ) /* Used for multi-line informational messages. */ +{ + int xpos=20, ypos=10, winwdth, winhght, orig_winhght, j=0, k=0, maxcols=0, nlines=0; + GtkWidget *winframe; + if (to_text_win) + printf("%s\n", mesg); + while (mesg[k] != '\0') /* Determine max line width and number of rows. */ + { + if (j > maxcols) maxcols = j; + if ((mesg[k] == '\n') || (mesg[k] == '\0')) + { + j = 0; + nlines++; + } + else + j++; + k++; + } + winwdth = 50 + maxcols * 8; + winhght = 70 + 18 * nlines + 5; + orig_winhght = winhght; + if (winhght < 500) + { + if (winwdth <= 600) + winframe = make_window( winwdth, winhght, title, &warnwin ); + else + { + winwdth = 600; + winframe = make_scrolled_window_wkill( winwdth, winhght, title, &warnwin, 1, 0, dismiss_general_warning_ret0 ); + } + } + else + { + winhght = 500; + if (winwdth <= 600) + winframe = make_scrolled_window_wkill( winwdth, winhght, title, &warnwin, 0, 1, dismiss_general_warning_ret0 ); + else + { + winwdth = 600; + winframe = make_scrolled_window_wkill( winwdth, winhght, title, &warnwin, 1, 1, dismiss_general_warning_ret0 ); + } + } + make_label( winframe, xpos, ypos, mesg ); + make_button( winframe, winwdth/2 - 30, orig_winhght - 38, " Ok ", dismiss_general_warning, &warnwin ); + gtk_window_set_keep_above( (GtkWindow *)warnwin, 1 ); + show_wind( warnwin ); +} + + + +struct value_list + { + int kind; /* 0=float, 1=integer, 2=text, 3=comment. */ + float value; + char *comment, *text; + int column, linenum, formtype; + struct taxline_record *parent; + GtkEntry *box; + GtkWidget *comment_label; + struct value_list *nxt; + } *rptwd_txline=0; + +struct taxline_record + { + char *linename; + int linenum, vpos; + struct value_list *values_hd, *values_tl; /* Head and tail list pointers for a tax-line-entry. */ + struct instruct_rec *instructions; + struct taxline_record *nxt; + } *taxlines_hd=0, *taxlines_tl=0; /* Head and tail list pointers for tax-form. */ + + + struct taxline_record * +new_taxline( char *linename, int linenum ) +{ + struct taxline_record *tmppt; + + tmppt = (struct taxline_record *)calloc( 1, sizeof(struct taxline_record) ); + tmppt->linename = strdup(linename); + tmppt->linenum = linenum; + if (taxlines_hd==0) taxlines_hd = tmppt; + else taxlines_tl->nxt = tmppt; + taxlines_tl = tmppt; + return tmppt; +} + + + struct value_list * +new_list_item_value( int kind, struct taxline_record *txline, void *x, int column, int linenum ) +{ + struct value_list *tmppt; + + tmppt = (struct value_list *)calloc( 1, sizeof(struct value_list) ); + tmppt->kind = kind; + tmppt->text = 0; + tmppt->comment = 0; + tmppt->column = column; + tmppt->linenum = linenum; + tmppt->box = 0; + switch (kind) + { + case VKIND_FLOAT: tmppt->value = *(float *)x; break; + case VKIND_INT: tmppt->value = *(int *)x; break; + case VKIND_TEXT: tmppt->text = strdup( (char *)x ); break; + case VKIND_COMMENT: tmppt->comment = strdup( (char *)x ); break; + } + tmppt->parent = txline; + tmppt->nxt = 0; + if (txline==0) {printf("ERROR1: called add_value %d before any line.\n",kind); return tmppt;} + if (txline->values_hd==0) txline->values_hd = tmppt; else txline->values_tl->nxt = tmppt; + txline->values_tl = tmppt; + return tmppt; +} + + +void pasteurize_entry( char *text ) /* Filter disallowed characters from user input. */ +{ + int j=0; + while (text[j] != '\0') + { + if (text[j] == ';') text[j] = ' '; + j++; + } +} + + +struct line_record + { + char *line; + struct line_record *next; + } *markup_commands_hd=0, *markup_commands_tl=0; + +void add_markup_command( char *markup ) +{ + struct line_record *new; + new = (struct line_record *)calloc( 1, sizeof( struct line_record ) ); + new->line = strdup( markup ); + if (markup_commands_hd == 0) + markup_commands_hd = new; + else + markup_commands_tl->next = new; + markup_commands_tl = new; +} + +void dump_any_markup_commands( FILE *outfile ) +{ + struct line_record *old; + while (markup_commands_hd) + { + if (verbose) printf("MARKup: %s\n", markup_commands_hd->line ); + fprintf(outfile,"%s\n", markup_commands_hd->line ); + old = markup_commands_hd; + markup_commands_hd = markup_commands_hd->next; + free( old->line ); + free( old ); + } +} + + +int intercept_any_pragmas( char *word ) /* Intercept any special command pragmas. */ +{ + if (strncmp( word, "Round_to_Whole_Dollars", 21 ) == 0) /* Intercept any mode-setting commands. */ + { + printf("Setting Round_to_Whole_Dollars mode.\n"); + round_to_whole_nums = 1; + return 1; + } + else + return 0; +} + + + +/*--------------------------------------------------------------*/ +/* Get_Next_Entry - Reads next item from input file. */ +/* Returns 0=VALUE_LABEL if reads data value or line-label. */ +/* Returns 1=COMMENT if reads comment. */ +/* Returns 2=SEMICOLON if reads ';' entry-end character. */ +/* */ +/* Passes back the column and line number where the current */ +/* entry begins on the line in the input file. */ +/*--------------------------------------------------------------*/ +int get_next_entry( char *word, int maxn, int *column, int *linenum, FILE *infile ) +{ + int k=0; + + /* Get up to the next non-white-space character. */ + ots_line = *linenum; + do + { + word[k] = getc(infile); + if (word[k] == '\n') { ots_column = 0; ots_line++; } else ots_column++; + } + while ((!feof(infile)) && ((word[k]==' ') || (word[k]=='\t') || (word[k]=='\n') || (word[k]=='\r'))); + *column = ots_column; + *linenum = ots_line; + + if (feof(infile)) {word[0] = '\0'; return NOTHING;} + if (word[k]=='{') + { /*get_comment*/ + do + { + word[k++] = getc(infile); + if (word[k-1] == '\n') { ots_column = 0; ots_line++; } else ots_column++; + } + while ((!feof(infile)) && (word[k-1]!='}') && (k=maxn) {printf("Error: Character buffer overflow detected.\n"); exit(1);} + return COMMENT; + } /*get_comment*/ + else + if (word[k]=='"') + { /*get_quoted_value*/ + k++; + do + { + word[k++] = getc(infile); + if (word[k-1] == '\n') { ots_column = 0; ots_line++; } else ots_column++; + } + while ((!feof(infile)) && (word[k-1]!='"') && (k=maxn) {printf("Error: Character buffer overflow detected.\n"); exit(1);} + word[k] = '\0'; + return VALUE_LABEL; + } /*get_quoted_value*/ + else + { /*get_value_or_linelabel*/ + k++; + while ((!feof(infile)) && (word[k-1]!=' ') && (word[k-1]!='\t') && + (word[k-1]!='\n') && (word[k-1]!='\r') && (word[k-1]!=';') && (k=maxn) {printf("Error: Character buffer overflow detected.\n"); exit(1);} + word[k] = '\0'; + if (strncasecmp( word, "MarkupPDF", 9 ) == 0) + { /* Store any custom markup commands. */ + if (word[k-1] != '\n') + { /* Get the remainder of the line. */ + do word[k++] = getc(infile); while ((!feof(infile)) && (word[k-1] != '\n')); + } + word[k-1] = '\0'; + ots_column = 0; + ots_line++; + add_markup_command( word ); + return NOTHING; + } + if (intercept_any_pragmas( word )) + { + return NOTHING; + } + if (word[k-1]==';') + { + if (k==1) { word[1] = '\0'; return SEMICOLON; } + else { ungetc(word[k-1], infile); word[k-1] = '\0'; return VALUE_LABEL; } + } + else { ungetc(word[k-1], infile); word[k-1] = '\0'; return VALUE_LABEL; } + } /*get_value_or_linelabel*/ +} + + +/*--------------------------------------------------------------*/ +/* Get_Line_Entry - Reads remainder of line from input file. */ +/*--------------------------------------------------------------*/ +void get_line_entry( char *word, int maxn, int *linenum, FILE *infile ) +{ + int k=0; + word[k] = getc(infile); + while ((!feof(infile)) && (word[k] != '\n') && (word[k] != '{')) + { + if (word[k] == '{') + { + do word[k] = getc(infile); while ((!feof(infile)) && (word[k] != '}')); + if (word[k] == '}') word[k] = getc(infile); + } + else + { + k++; + if (k > maxn) + { + word[k-1] = '\0'; + while ((!feof(infile)) && (getc(infile) != '\n')); + consume_leading_trailing_whitespace( word ); + return; + } + // printf(" get_line_entry = '%c'\n", word[k-1] ); + word[k] = getc(infile); + } + } + if (word[k] == '{') + ungetc( word[k], infile ); + else + *linenum = *linenum + 1; + word[k] = '\0'; + // printf(" k = %d, word[%d] = %d\n", k, k, word[k] ); + // printf(" word = '%s'\n", word ); + consume_leading_trailing_whitespace( word ); +} + + +void DisplayTaxInfo(); /* This is a prototype statement only. */ +void warn_about_save_needed_switch(); +void quote_MS_file_name( char *fname ); +int save_needed=0; +int compute_needed=0; + + + +int Update_box_info() /* Capture entries from form-boxes. */ +{ + struct taxline_record *txline; + struct value_list *tmppt; + char text[1024]; + + txline = taxlines_hd; + while (txline!=0) + { + tmppt = txline->values_hd; + while (tmppt!=0) + { + if (tmppt->box != 0) + { + get_formbox_text( tmppt->box, text, 1024 ); + pasteurize_entry( text ); + tmppt->kind = VKIND_TEXT; + if (strcmp( tmppt->text, text ) != 0) { save_needed++; compute_needed = 1; } + tmppt->text = strdup( text ); + } + tmppt = tmppt->nxt; + } + txline = txline->nxt; + } + return save_needed; +} + + +void refresh() +{ + gtk_widget_destroy( mpanel2 ); /* Clear out panel. */ + /* Set up new panel with scrollbars for tax form data. */ + mpanel2 = gtk_fixed_new(); + scrolledpane = gtk_scrolled_window_new( 0, 0 ); + gtk_scrolled_window_set_policy( (GtkScrolledWindow *)scrolledpane, GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS ); + gtk_scrolled_window_add_with_viewport( (GtkScrolledWindow *)scrolledpane, mpanel2 ); + // gtk_container_add( GTK_CONTAINER( mpanel ), scrolledpane ); + gtk_fixed_put( GTK_FIXED( mpanel ), scrolledpane, 0, 35 ); + gtk_widget_set_size_request( scrolledpane, winwidth, winht - 80 ); + DisplayTaxInfo(); + gtk_widget_show_all( outer_window ); +} + + + +void re_display_form() +{ + double vpos; + GtkAdjustment *adj; + + Update_box_info(); /* Grab any new entries. */ + + /* Prestore the scrolling position. */ + adj = gtk_scrolled_window_get_vadjustment( (GtkScrolledWindow *)scrolledpane ); + vpos = gtk_adjustment_get_value( adj ); + + refresh(); + + /* Restore the scrolling position. */ + adj = gtk_scrolled_window_get_vadjustment( (GtkScrolledWindow *)scrolledpane ); + adj->value = vpos; +} + + + +/*--------------------------------------------------------------*/ +/* Add_New_Boxes - Callback for "+" button on form-boxes. */ +/* Adds new form-box(s) to the line item. */ +/*--------------------------------------------------------------*/ +void add_new_boxes( void *data, int num ) +{ + struct taxline_record *txline; + struct value_list *item, *lineitem, *newitem1, *newitemlast, *oldtail; + double vpos; + GtkAdjustment *adj; + + Update_box_info(); + + item = (struct value_list *)data; + oldtail = item->parent->values_tl; + + if (num==2) + { + newitem1 = new_list_item_value( VKIND_TEXT, item->parent, "", 0, item->linenum + 1 ); + new_list_item_value( VKIND_TEXT, item->parent, "", 0, item->linenum + 1 ); + new_list_item_value( VKIND_TEXT, item->parent, "", 0, item->linenum + 2 ); + newitemlast = new_list_item_value( VKIND_TEXT, item->parent, "", 0, item->linenum + 2 ); + } + else + if (num==3) /* CapGain only */ + { + newitem1 = new_list_item_value( VKIND_TEXT, item->parent, CAPGAIN_READY, 0, item->linenum + 1 ); + new_list_item_value( VKIND_TEXT, item->parent, "", 0, item->linenum + 1 ); + new_list_item_value( VKIND_TEXT, item->parent, "", 0, item->linenum + 2 ); + new_list_item_value( VKIND_TEXT, item->parent, "", 0, item->linenum + 2 ); + new_list_item_value( VKIND_TEXT, item->parent, "~", 0, item->linenum + 3 ); + newitemlast = new_list_item_value( VKIND_TEXT, item->parent, "~", 0, item->linenum + 3 ); + } + else + { + newitem1 = new_list_item_value( VKIND_TEXT, item->parent, "", 0, item->linenum + 1 ); + newitemlast = newitem1; + } + + lineitem = item; /* Skip the items on the original line. */ + while ((lineitem->nxt!=newitem1) && (lineitem->nxt->linenum == item->linenum)) lineitem = lineitem->nxt; + + /* Insert in list and remove from tail, if not on end of list. */ + if (lineitem->nxt != newitem1) + { + newitemlast->nxt = lineitem->nxt; + lineitem->nxt = newitem1; + oldtail->nxt = 0; + item->parent->values_tl = oldtail; + } + + /* Increment the effective file-line-number of all subsequent line entries. */ + lineitem = newitemlast->nxt; + while (lineitem!=0) /* Now do remaining lines of this item. */ + { + lineitem->linenum = lineitem->linenum + num; + lineitem = lineitem->nxt; + } + txline = item->parent->nxt; /* Next do remaining line items. */ + while (txline!=0) + { + txline->linenum = txline->linenum + num; + lineitem = txline->values_hd; + while (lineitem!=0) + { + lineitem->linenum = lineitem->linenum + num; + lineitem = lineitem->nxt; + } + txline = txline->nxt; + } + + /* Prestore the scrolling position. */ + adj = gtk_scrolled_window_get_vadjustment( (GtkScrolledWindow *)scrolledpane ); + // printf("Adj = (%x), %g, (%g, %g), (%g, %g), %g\n", adj, adj->value, adj->lower, adj->upper, adj->step_increment, adj->page_increment, adj->page_size ); + vpos = gtk_adjustment_get_value( adj ); + // vpos = adj->value; + + refresh(); + + /* Restore the scrolling position. */ + adj = gtk_scrolled_window_get_vadjustment( (GtkScrolledWindow *)scrolledpane ); + // gtk_adjustment_set_value( adj, vpos ); /* Isn't working because at this time upper and lower are 0 and 1. */ + adj->value = vpos; + // gtk_scrolled_window_set_vadjustment( (GtkScrolledWindow *)scrolledpane, adj ); /* Not needed. */ +} + + +/*-------------------------------------------------------------------------*/ +/* Add_new_capgain_boxes - Callback for "+" button on cap-gain form-boxes. */ +/* Adds a new form-boxes to the line item. */ +/*-------------------------------------------------------------------------*/ +void add_new_capgain_boxes( GtkWidget *wdg, void *data ) +{ + add_new_boxes( data, 3 ); /* 3 lines of two boxes per line */ +} + +void add_new_box_item( GtkWidget *wdg, void *data ) +{ + add_new_boxes( data, 1 ); +} + + + + + + +void filter_reserved_characters( char *word, char *reserved, char *replacement_char ) +{ + int j=0, k; + while (word[j] != '\0') + { + k = 0; + while ((reserved[k] != '\0') && (word[j] != reserved[k])) + k++; + if (reserved[k] != '\0') + { /* Replace reserved character. */ + if (k < strlen(replacement_char)) + word[j] = replacement_char[k]; + else + word[j] = replacement_char[0]; + } + j++; + } +} + + + + + +GtkEntry *commentbox; + +void cancelpopup( GtkWidget *wdg, void *data ) +{ gtk_widget_destroy( popupwin ); popupwin = 0; } + + +void acceptcomment( GtkWidget *wdg, void *data ) +{ + char *comment; + struct value_list *tmppt; + + tmppt = (struct value_list *)data; + comment = get_formbox( commentbox ); + filter_reserved_characters( comment, "{}", "()" ); + // printf("Prior comment was '%s', new comment is '%s'\n", tmppt->comment, comment ); + if (tmppt->comment != 0) + { + if (strcmp( tmppt->comment, comment ) != 0) { save_needed++; compute_needed = 1; } + free( tmppt->comment ); + } else { save_needed++; compute_needed = 1; } + tmppt->comment = strdup( comment ); + modify_label( tmppt->comment_label, comment ); + cancelpopup(0,0); + // refresh(); +} + + +void edit_line_comment( GtkWidget *wdg, void *data ) /* Edit_comment. */ +{ + struct value_list *tmppt; + int winwidth=510, winht=110; + GtkWidget *panel; + + tmppt = (struct value_list *)data; + if (popupwin) gtk_widget_destroy( popupwin ); + panel = make_window( winwidth, winht, "Edit Comment", &popupwin ); + make_label( panel, 2, 2, "Edit Line Comment:" ); + commentbox = make_formbox_bypix( panel, 10, 25, winwidth - 40, tmppt->comment, 500, acceptcomment, tmppt ); + make_button( panel, 20, winht - 30, " Ok ", acceptcomment, tmppt ); + make_button( panel, winwidth - 60, winht - 30, "Cancel", cancelpopup, 0 ); + gtk_widget_show_all( popupwin ); +} + + +void accept_capgain_reset( GtkWidget *wdg, void *data ) +{ + struct value_list *tmppt; + int valflg = 0, comcnt = 0; + char tmpstr[256]; + + tmppt = (struct value_list *)data; + while (comcnt < 3) + { + switch (tmppt->kind) + { + case VKIND_TEXT: + if (valflg == 0) /* Set 1st box 'Buy Cost' to "Ready" */ + { + strcpy( tmpstr, CAPGAIN_READY ); + valflg = 1; + } + else + if (comcnt <2) + strcpy (tmpstr, ""); + else + strcpy (tmpstr, "~" ); + modify_formbox( tmppt->box, tmpstr ); + break; + case VKIND_COMMENT: + if (tmppt->comment != 0) free( tmppt->comment ); + tmppt->comment = strdup(""); + comcnt++; + break; + default: + break; + } + tmppt = tmppt->nxt; + } + cancelpopup(0,0); + re_display_form(); +} + + +void verify_capgain_reset(GtkWidget *wdg, void *data) /* Code follows edit_line_comment as a framework */ +{ + struct value_list *tmppt; + int winwidth=220, winht=60; + GtkWidget *panel; + + tmppt = (struct value_list *)data; + if (popupwin) gtk_widget_destroy( popupwin ); + panel = make_window( winwidth, winht, "Clear Gain/Loss values ?", &popupwin ); + make_label( panel, 5, 1, "Clear gain/loss values ?" ); + make_button( panel, 20, winht - 35, " Ok ", accept_capgain_reset, tmppt ); + make_button( panel, winwidth - 60, winht - 35, "Cancel", cancelpopup, 0 ); + gtk_widget_show_all( popupwin ); +} + + +void switch_form( GtkWidget *wdg, void *data ) +{ char *cmd; + Update_box_info(); + if (save_needed) + { + warn_about_save_needed_switch(); + return; + } + cmd = (char *)malloc( strlen(start_cmd) + 250 ); + #if (PLATFORM_KIND==Posix_Platform) + strcpy( cmd, start_cmd ); + if (verbose) strcat( cmd, " -v "); + strcat( cmd, " &" ); + #else /* For MS-win platforms. */ + char *tmpfname; + strcpy( cmd, "start " ); + tmpfname = (char *)malloc( strlen( start_cmd ) + 256 ); + strcpy( tmpfname, start_cmd ); + if ((strstr( tmpfname, "\"" ) == 0) && (strstr( tmpfname, " " ) != 0)) /* If has spaces but no quotes, */ + quote_MS_file_name( tmpfname ); /* Then quote the spaces. */ + strcat( cmd, tmpfname ); + free( tmpfname ); + #endif + if (strlen(workdir) > 0) + { + strcat( cmd, " -workdir "); + strcat( cmd, workdir ); + } + printf("Issuing: '%s'\n", cmd ); + system( cmd ); + exit(0); + } + + +void switch_anyway( GtkWidget *wdg, void *data ) +{ + save_needed = 0; + switch_form( 0, 0 ); +} + +void warn_about_save_needed_switch() +{ + int xpos=20, ypos=20, winwdth, winhght=100; + GtkWidget *winframe, *label; + winwdth = 300; + winframe = make_window( winwdth, winhght, "Warning Message", &warnwin ); + label = make_sized_label( winframe, xpos, ypos, "Change(s) not saved !!", 12 ); + set_widget_color( label, "#ff0000" ); + make_button( winframe, 10, winhght - 40, "Switch anyway, without saving", switch_anyway, &warnwin ); + make_button( winframe, winwdth - 60, winhght - 40, "Cancel", dismiss_general_warning, &warnwin ); + gtk_window_set_keep_above( (GtkWindow *)warnwin, 1 ); + show_wind( warnwin ); +} + + +void quit_wcheck( GtkWidget *wdg, void *x ); /* Prototypes */ +void print_outfile_directly( GtkWidget *wdg, void *data ); +void create_pdf_file_directly( GtkWidget *wdg, void *data ); +void set_pdfviewer( GtkWidget *wdg, void *data ); + + +/* ----------------- Tax Instructions Helper -------------------- */ + +struct instruct_rec + { + char *instr_label, *instr_text; + int buflen; + struct instruct_rec *nxt; + } *instruct_lst=0; + +char *instructions_filename=0; + + +struct instruct_rec *new_instruction( char *line_label, char *buf, int *buflen ) +{ + struct instruct_rec *new; + //if (instruct_lst != 0) + //printf(" Instr: [%s] '%s'\n", instruct_lst->instr_label, buf ); + if (instruct_lst != 0) + instruct_lst->instr_text = strdup( buf ); /* Store prior instruction text. */ + buf[0] = '\0'; /* Clear buffer for new text. */ + *buflen = 0; + new = (struct instruct_rec *)calloc( 1, sizeof( struct instruct_rec ) ); + new->instr_label = strdup( line_label ); + new->nxt = instruct_lst; + instruct_lst = new; + return new; +} + + +void strcat_safe( char *dst, const char *src, int maxlen, int *buflen ) +{ + int j, k=0, oneless; +//printf("Adding: '%s' + '%s' = ", dst, src ); + oneless = maxlen - 1; + j = *buflen; + while ((j < oneless) && (src[k] != '\0')) { dst[j++] = src[k++]; } + dst[j] = '\0'; + *buflen = j; +//printf("'%s'\n", dst ); +} + + +int found_char( char ch, char *srch ) +{ + int j=0; + while ((ch != srch[j]) && (srch[j] != '\0')) + j++; + if (srch[j] != '\0') + return 1; + else + return 0; +} + + +void advance_word( char *tstr, char delim, char *srch ) +{ + int j=0, k=0; + while ((tstr[j] != '\0') && (tstr[j] != delim)) + j++; + if (tstr[j] != '\0') + j++; + while ((tstr[j] != '\0') && (found_char( tstr[j], srch ))) + j++; + do + tstr[k++] = tstr[j++]; + while (tstr[k-1] != '\0'); +} + + +void dispose_instuctions() +{ + struct instruct_rec *old; + while (instruct_lst != 0) + { + old = instruct_lst; + instruct_lst = instruct_lst->nxt; + free( old->instr_label ); + free( old->instr_text ); + free( old ); + } +} + + +void attach_instruction2line( struct instruct_rec *newinstr ) +{ + struct taxline_record *txline; + + txline = taxlines_hd; + while (txline!=0) + { + if (strcmp( txline->linename, newinstr->instr_label ) == 0) + { + txline->instructions = newinstr; + return; + } + txline = txline->nxt; + } +} + + +void read_instructions( int init ) +{ char *tmpinstrfname, *tline, *tstr, *twrd, *buf; + int maxstr1=16384, maxstr2=32768, buflen=0; + struct instruct_rec *newinstr; + FILE *instrfile; + /** + Instruction files must have the following form for any tax-lines with instructions: + [line-lable] instruction text + Example: + [L17] Report here your interest income. + More instruction text ... + [L20] This should come from your 1099-G box 2a. + Etc., etc.. + The instructions can span multiple lines, as shown, until the next bracket line. + The label bracket, "[", must be the first character on the line. + Do not have tabs or line-feeds in text. Only printable ascii characters!!! + **/ + if (init == 1) + { + dispose_instuctions(); + switch (selected_form) + { + case form_US_1040: + instructions_filename = strdup( "f1040_instructions.dat" ); break; + case form_US_1040_Sched_C: + instructions_filename = strdup( "f1040sc_instructions.dat" ); break; + case form_PA_40: + instructions_filename = strdup( "PA_instructions.dat" ); break; + case form_CA_540: + instructions_filename = strdup( "CA_540_instructions.dat" ); break; + case form_OH_IT1040: + instructions_filename = strdup( "OH_PIT_IT1040_instructions.dat" ); break; + case form_VA_760: + instructions_filename = strdup( "VA_760_instructions.dat" ); break; + case form_NJ_1040: + instructions_filename = strdup( "NJ_1040_instructions.dat" ); break; + case form_NY_IT201: + instructions_filename = strdup( "NY_it201_instructions.dat" ); break; + case form_MA_1: + instructions_filename = strdup( "MA_1_instructions.dat" ); break; + case form_NC_D400: + instructions_filename = strdup( "NC_instructions.dat" ); break; + case form_MI_1040: + instructions_filename = strdup( "MI_1040_instructions.dat" ); break; + case form_OR_40: + instructions_filename = strdup( "OR_40_instructions.dat" ); break; + default: + if (strstr( taxsolvestrng, "taxsolve_HSA_f8889" ) != 0) + instructions_filename = strdup( "f8889_instructions.dat" ); + else + if (strstr( taxsolvestrng, "taxsolve_US_1040_Sched_SE" ) != 0) + instructions_filename = strdup( "f1040sse_instructions.dat" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8829" ) != 0) + instructions_filename = strdup( "f8829_instructions.dat" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8995" ) != 0) + instructions_filename = strdup( "f8995_instructions.dat" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8959" ) != 0) + instructions_filename = strdup( "f8959_instructions.dat" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8960" ) != 0) + instructions_filename = strdup( "f8961_instructions.dat" ); + else + if (strstr( taxsolvestrng, "taxsolve_f2210" ) != 0) + instructions_filename = strdup( "f2210_instructions.dat" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8812" ) != 0) + instructions_filename = strdup( "f8812_instructions.dat" ); + else + if (strstr( taxsolvestrng, "taxsolve_CA_5805" ) != 0) + instructions_filename = strdup( "CA_5805_instructions.dat" ); + else + return; + } + if (verbose) printf("Instruction file = '%s'\n", instructions_filename ); + } + tmpinstrfname = (char *)malloc(8192); + tstr = (char *)malloc( 1024 ); + twrd = (char *)malloc( 1024 ); + tline = (char *)malloc( maxstr1 + 10 ); + buf = (char *)calloc( 1, maxstr2 + 10 ); + strcpy( tmpinstrfname, ots_path ); + strcat( tmpinstrfname, "src" ); strcat( tmpinstrfname, slashstr ); + strcat( tmpinstrfname, "formdata" ); strcat( tmpinstrfname, slashstr ); + strcat( tmpinstrfname, instructions_filename ); + if (verbose) printf("Opening: '%s'\n", tmpinstrfname ); + + instrfile = fopen( tmpinstrfname, "rb" ); + if (instrfile == 0) + { + if (verbose) printf("Could not open instructions file: '%s'\n", tmpinstrfname ); + return; + } + + fgets( tline, maxstr1, instrfile ); + // printf("%s", tline ); + while (!feof(instrfile)) + { + // printf("%s", tline ); + if (tline[0] == '[') + { + strcpy_safe( tstr, tline, 256 ); + fb_next_word( tstr, twrd, "[] \t\n\r" ); + // printf("Label: '%s'\n", twrd ); + newinstr = new_instruction( twrd, buf, &buflen ); + attach_instruction2line( newinstr ); + advance_word( tline, ']', " \t" ); + } + strcat_safe( buf, tline, maxstr2, &buflen ); + fgets( tline, maxstr1, instrfile ); + } + new_instruction( "_END_", buf, &buflen ); + fclose( instrfile ); + free( tmpinstrfname ); + free( tstr ); + free( twrd ); +} + + + +int mouse_clicked( GtkWidget *widget, GdkEventButton *event, gpointer data ) +{ + int xpos, vpos, mindist=9999999; + GtkAdjustment *adj; + struct taxline_record *txline, *closest_line=0; + + if (warnwin) + { /* Remove any previously open text window. */ + gtk_widget_destroy( warnwin ); + warnwin = 0; + } + xpos = (int)(event->x); + if (((xpos > 100) && (xpos < 245)) || (xpos > 710)) + return 1; /* Too close to buttons or text-forms of a tax-line, so return from here. */ + + /* Find the closest tax-line to where clicked. */ + // printf("Mouse button %d Pressed at: %d, %d, %g\n", (int)(event->button), (int)(event->x), (int)(event->y), (double)(event->time) ); + adj = gtk_scrolled_window_get_vadjustment( (GtkScrolledWindow *)scrolledpane ); + vpos = (int)(event->y + gtk_adjustment_get_value( adj )); + txline = taxlines_hd; + while (txline!=0) + { + if (abs( vpos - txline->vpos ) < mindist) + { + mindist = abs( vpos - txline->vpos ); + closest_line = txline; + } + txline = txline->nxt; + } + if ((closest_line != 0) && (vpos - closest_line->vpos > -30)) + { /* Pop up instruction-text window, if clicked near enough, and/or below, a tax-line with instructions. */ + // printf("Picked '%s', dist = %d\n", closest_line->linename, mindist ); + if (closest_line->instructions) + GeneralPopup( closest_line->instructions->instr_label, closest_line->instructions->instr_text, 0 ); + } + return 1; /* Stops other handlers from being invoked. */ +} + + +int mouse_unclicked( GtkWidget *widget, GdkEventButton *event, gpointer data ) +{ + printf("Mouse button %d Released at: %d, %d\n", (int)(event->button), (int)(event->x), (int)(event->y) ); + return 1; /* Stops other handlers from being invoked. */ +} + + +/* ----------------- End Tax Instructions Helper -------------------- */ + + +int whitespace_invariant_strstr( char *haystack, char *needle ) /* Return 1 if match, otherwise 0 if mismatch. */ +{ + int ret; + char *hay, *ne, *wrd1, *wrd2; + hay = strdup( haystack ); + wrd1 = (char *)malloc( strlen( haystack ) + 1 ); + ne = strdup( needle ); + wrd2 = (char *)malloc( strlen( needle ) + 1 ); + do + { + fb_next_word( hay, wrd1, " \t\n\r" ); + fb_next_word( ne, wrd2, " \t\n\r" ); + // printf("Comparing '%s' to '%s'\n", wrd1, wrd2 ); + } + while ((wrd2[0] != '\0') && (strcmp(wrd1,wrd2) == 0)); + if (wrd2[0] != '\0') + ret = 0; /* Mismatch. */ + else + ret = 1; /* Matched. */ + free( hay ); + free( ne ); + free( wrd1 ); + free( wrd2 ); + return ret; +} + +int check_form_version( char *title_as_read_in, char *expected_title ) +{ /* Check that Form input file matched intended Program. Return 1 if good. Or 0 if not-match. */ + char msg[4096]; + printf(" Comparing '%s' to '%s'\n", title_as_read_in, expected_title ); + if (whitespace_invariant_strstr( title_as_read_in, expected_title ) == 0) + { + // GeneralWarning( "Warning: Looks like wrong Form-file for selected tax-progam. ??" ); + strcpy(msg,"\nWarning: Looks like wrong Form-file for selected tax-progam. ??.\n"); + strcat(msg," Expecting: '"); + strcat(msg, expected_title ); + strcat(msg,"'\n But found: '"); + strcat(msg, title_as_read_in ); + strcat(msg,"'\n\nMaybe go back and switch your tax-selection or input file.\n\n" ); + GeneralPopup( "Warning:", msg, 1); + return 0; + } + else + return 1; +} + +void check_form_type( char *title_line ) +{ + printf("CHECKING: '%s'\n", title_line ); + switch (selected_form) + { + case form_US_1040: check_form_version( title_line, "Title: US Federal 1040 Tax Form" ); + break; + case form_US_1040_Sched_C: check_form_version( title_line, "Title: 1040 Schedule C" ); + break; + case form_PA_40: check_form_version( title_line, "Title: PA State Tax Form PA-40" ); + break; + case form_CA_540: check_form_version( title_line, "Title: CA State Tax Form 540" ); + break; + case form_OH_IT1040: check_form_version( title_line, "Title: Ohio IT1040 State" ); + break; + case form_VA_760: check_form_version( title_line, "Title: VA-760 State 2024" ); + break; + case form_NJ_1040: check_form_version( title_line, "Title: NJ-1040 State 2024" ); + break; + case form_NY_IT201: check_form_version( title_line, "Title: NY State 2024" ); + break; + case form_MA_1: check_form_version( title_line, "Title: Massachusetts Form 1 Tax Form" ); + break; + case form_NC_D400: check_form_version( title_line, "Title: NC State Tax Form 400 for 2024" ); + break; + case form_MI_1040: check_form_version( title_line, "Title: MI-1040" ); + break; + case form_OR_40: check_form_version( title_line, "Title: Oregon Form OR-40" ); + break; + default: + if (strstr( taxsolvestrng, "taxsolve_HSA_f8889" ) != 0) + check_form_version( title_line, "Title: 8889 HSA Form" ); + else + if (strstr( taxsolvestrng, "taxsolve_US_1040_Sched_SE" ) != 0) + check_form_version( title_line, "Title: 1040 Schedule SE" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8829" ) != 0) + check_form_version( title_line, "Title: 2024 Form 8829" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8995" ) != 0) + check_form_version( title_line, "Title: 2024 Form 8995" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8959" ) != 0) + check_form_version( title_line, "Title: 2024 Form 8959" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8960" ) != 0) + check_form_version( title_line, "Title: 2024 Form 8960" ); + else + if (strstr( taxsolvestrng, "taxsolve_f2210" ) != 0) + check_form_version( title_line, "Title: Form 2210 for Tax Year 2024" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8812" ) != 0) + check_form_version( title_line, "Title: Form 8812 - 2024" ); + else + if (strstr( taxsolvestrng, "taxsolve_CA_5805" ) != 0) + check_form_version( title_line, "Title: Form 5805" ); + } +} + + +/* Check if entry looks like a date. */ +/* If so, return 1, else return 0. */ +int datecheck( char *word ) +{ + int j, k=0; + + j = strlen(word) - 1; + while (j>0) + { + if ((word[j]=='-') || (word[j]=='/')) k++; + else if (word[j]>'9') return 0; + j--; + } + if (k==2) return 1; else return 0; +} + + +int interpret_boolean( char *word ) +{ + if ((toupper( word[0] ) == 'Y') || (toupper( word[0] ) == 'T') || (word[0] == '1')) + return 1; + return 0; +} + + +char *taxform_name; + + +/***********************/ +/* Read Tax Data File. */ +/***********************/ +void Read_Tax_File( char *fname ) +{ + int j, k, kind, state=0, column=0, + linenum=0, /* Line number in input file. */ + linecnt=0, /* Line number of gui display. */ + lastline=0, newentry=0, entrycnt=0; + int lastlinenum=-1; + char word[15000], *tmpstr, tmpstr2[900], tmpstr3[900]; + struct taxline_record *txline=0; + struct value_list *tmppt, *newitem, *oldtail; + + /* Read the Tax Data Form File. */ + current_working_filename = strdup(fname); + taxlines_hd = 0; + /* Accept the form's Title line. (Must be first line!) */ + fgets(word, 200, infile); + title_line = strdup( word ); + check_form_type( title_line ); + j = strlen(word); + if (j>0) word[j-1] = '\0'; + // printf("Title: '%s'\n", word); + if (strstr(word,"Title:")==word) tmpstr = &(word[6]); else tmpstr = &(word[0]); + k = strlen(tmpstr); /* Pad to center if title is too short. */ + if (k < 20) + { for (j=0; j<(20-k)/2; j++) tmpstr2[k]=' '; tmpstr2[(20-k)/2] = '\0'; + strcpy(tmpstr3,tmpstr2); strcat(tmpstr3,tmpstr); strcpy(tmpstr,tmpstr3); strcat(tmpstr,tmpstr2); + } + taxform_name = strdup( tmpstr ); + + kind = get_next_entry( word, 10000, &column, &linenum, infile ); + if (linenum > lastline) { lastline = linenum; if (newentry) linecnt++; newentry = 0; } + while (!feof(infile)) + { /*Loop1*/ + if (column == 1) state = 0; + if (verbose) printf("Kind=%d: state=%d: col=%d: lnum=%d: '%s'\n", kind, state, column, linenum, word); + switch (kind) + { + case VALUE_LABEL: + if (state==0) + { /*statezero*/ + if (verbose) printf(" LineLabel: '%s'\n", word); + state = 1; + entrycnt = 0; + txline = new_taxline( word, linecnt ); + if ((strcasecmp(txline->linename, "Your1stName:") == 0) || (strcasecmp(txline->linename, "YourName:") == 0) || + (strcasecmp(txline->linename, "YourLastName:") == 0) || (strcasecmp(txline->linename, "YourSocSec#:") == 0) || + (strcasecmp(txline->linename, "Spouse1stName:") == 0) || (strcasecmp(txline->linename, "SpouseLastName:") == 0) || + (strcasecmp(txline->linename, "YourInitial:") == 0) || (strcasecmp(txline->linename, "SpouseInitial:") == 0) || + (strcasecmp(txline->linename, "SpouseSocSec#:") == 0) || (strcasecmp(txline->linename, "Number&Street:") == 0) || + (strcmp(txline->linename, "YourBirthDate:") == 0) || (strcmp(txline->linename, "SpouseBirthDate:") == 0) || + (strcmp(txline->linename, "Apt#:") == 0) || (strcmp(txline->linename, "TownStateZip:") == 0) || + (strcmp(txline->linename, "Town:") == 0) || (strcmp(txline->linename, "State:") == 0) || + (strcmp(txline->linename, "Zipcode:") == 0) || (strstr( txline->linename, ":" ) != 0) || + (strcmp(txline->linename, "PrincipalBus:") == 0) || (strcmp(txline->linename, "BusinessName:") == 0)) + { + if (ots_column > 0) + { get_line_entry( word, 10000, &linenum, infile ); } + else + word[0] = '\0'; + tmppt = new_list_item_value( VKIND_TEXT, txline, word, column, linecnt ); + tmppt->formtype = ID_INFO; /* Special ID-only info lines. */ + state = 0; + } + } /*statezero*/ + else + { /*stateNotzero*/ + if (verbose) printf(" Value: %s\n", word); + if (strcasecmp(txline->linename, "Status") == 0) + { + new_list_item_value( VKIND_TEXT, txline, word, column, linecnt ); + state = 0; + } + else + { /*Accept normal value. */ + tmppt = new_list_item_value( VKIND_TEXT, txline, word, column, linecnt ); + if (strstr( txline->linename, ":" ) != 0) + tmppt->formtype = LITERAL_INFO; + if (strcmp( txline->linename, "Round_PDF_to_Whole_Dollars" ) == 0) + { + round_pdf_to_whole_dollars = interpret_boolean( word ); + rptwd_txline = tmppt; + } + entrycnt++; + } + } /*stateNotzero*/ + newentry++; + break; + case COMMENT: if (verbose) printf(" Comment: %s\n", word); + if ((txline==0) || ((strncasecmp(txline->linename, "CapGains",7) != 0) && (lastlinenum > 0) && (linenum > lastlinenum))) + txline = new_taxline("", linecnt); + new_list_item_value( VKIND_COMMENT, txline, word, column, linecnt ); + newentry++; + break; + case SEMICOLON: if (verbose) printf(" End: %s\n", word); + /* When line is labeled "CapGains", and there are no entries, */ + /* then produce extra boxes for date bought or sold. */ + /* So far, this is only known to be needed on US-Fed form. */ + if ((txline != 0) && ((strncasecmp(txline->linename, "Cap-Gains",8) == 0) || + (strncasecmp(txline->linename, "CapGains",7) == 0)) && (entrycnt < 2)) + { + new_list_item_value( VKIND_TEXT, txline, CAPGAIN_READY, column, linecnt ); + new_list_item_value( VKIND_TEXT, txline, "", column, linecnt++ ); + new_list_item_value( VKIND_TEXT, txline, "", column, linecnt ); + new_list_item_value( VKIND_TEXT, txline, "", column, linecnt++ ); + new_list_item_value( VKIND_TEXT, txline, "", column, linecnt ); + new_list_item_value( VKIND_TEXT, txline, "", column, linecnt++ ); + } + state = 0; + new_list_item_value( VKIND_COLON, txline, word, column, linecnt ); + lastlinenum = linenum; + break; + } + column = column + strlen(word); + lastlinenum = linenum; + kind = get_next_entry( word, 10000, &column, &linenum, infile ); + if (linenum > lastline) + { + if ((txline!=0) && (strncasecmp(txline->linename, "CapGains",7) == 0)) + { + if ((entrycnt % 6) == 0) + linecnt++; + } + lastline = linenum; + linecnt++; + newentry = 0; + } + } /*Loop1*/ + fclose(infile); + + /* Check for missing entries. */ + txline = taxlines_hd; + while (txline!=0) + { + tmppt = txline->values_hd; state = 0; + while (tmppt!=0) + { + if ((tmppt->kind==VKIND_FLOAT) || (tmppt->kind==VKIND_TEXT) || (tmppt->kind==VKIND_INT)) state = 1; + tmppt = tmppt->nxt; + } + if ((state==0) && (strlen(txline->linename)>0)) /* Place empty formbox on any line having no entries. */ + { + oldtail = txline->values_tl; + newitem = new_list_item_value( VKIND_TEXT, txline, "", 0, txline->linenum ); + if (newitem!=txline->values_hd) + { + newitem->nxt = txline->values_hd; + txline->values_hd = newitem; + txline->values_tl = oldtail; + oldtail->nxt = 0; + } + } + txline = txline->nxt; + } + //dump_taxinfo(); +} + + + +GtkWidget *options_window=0, *allforms_button; +int allforms_toggle=0; +double winopentime; + + +void set_pdf_option( GtkWidget *wdg, void *data ) +{ + if (Report_Time() - winopentime < 0.2) return; + allforms_toggle = !allforms_toggle; + printf("Allforms = %d\n", allforms_toggle ); +} + +void set_r2wn_option( GtkWidget *wdg, void *data ) +{ + // printf("dT = %g\n", Report_Time() - winopentime ); + if (Report_Time() - winopentime < 0.2) return; + round_to_whole_nums = !round_to_whole_nums; + printf("Round_to_Whole_Nums = %d\n", round_to_whole_nums ); + save_needed++; compute_needed = 1; +} + +void set_round_pdf_option( GtkWidget *wdg, void *data ) +{ + // printf("dT = %g\n", Report_Time() - winopentime ); + if (Report_Time() - winopentime < 0.2) return; + round_pdf_to_whole_dollars = !round_pdf_to_whole_dollars; + if (rptwd_txline) + { + rptwd_txline->value = round_pdf_to_whole_dollars; + if (round_pdf_to_whole_dollars) + rptwd_txline->text = strdup( "Yes" ); + else + rptwd_txline->text = strdup( "No" ); + modify_formbox( rptwd_txline->box, rptwd_txline->text ); + } + printf("Round_PDF_to_Whole_Dollars = %d\n", round_pdf_to_whole_dollars ); +} + +void options_pdf_diaglog( GtkWidget *wdg, void *data ) +{ + GtkWidget *panel; + int wd=400, ht=210, xpos=10, ypos=30; + panel = make_window( wd, ht, "Options Menu", &options_window ); + make_sized_label( panel, 5, 1, "Options Menu:", 12 ); + winopentime = Report_Time(); + allforms_button = make_toggle_button( panel, xpos, ypos, "Force production of All PDF Form Pages", allforms_toggle, set_pdf_option, "allforms" ); + ypos = ypos + 30; + make_toggle_button( panel, xpos, ypos, "Round Calculations to Whole Numbers", round_to_whole_nums, set_r2wn_option, 0 ); + ypos = ypos + 30; + make_toggle_button( panel, xpos, ypos, "Force PDF form-fill-out to Round to Whole Numbers", round_pdf_to_whole_dollars, set_round_pdf_option, 0 ); + ypos = ypos + 40; + make_button( panel, xpos, ypos, "Set PDF-Viewer", set_pdfviewer, 0 ); + make_button( panel, wd/2 - 30, ht - 35, " Close ", close_any_window, &options_window ); + show_wind( options_window ); +} + + + +void Setup_Tax_Form_Page( int init ) /* This is called whenever the form window needs to be redisplayed for any reason. */ +{ + GtkWidget *button; + GtkRequisition actual; + int x1=1, xpos; + char *twrd; + float fontsz; + double T1; + + printf("Setting up Form Page ...\n"); + gtk_widget_destroy( mpanel ); /* Clear out panel. */ + mpanel = gtk_fixed_new(); + gtk_container_add( GTK_CONTAINER( outer_window ), mpanel ); + + /* Set up new panel with scrollbars for tax form data. */ + mpanel2 = gtk_fixed_new(); + scrolledpane = gtk_scrolled_window_new( 0, 0 ); + gtk_scrolled_window_set_policy( (GtkScrolledWindow *)scrolledpane, GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS ); + gtk_scrolled_window_add_with_viewport( (GtkScrolledWindow *)scrolledpane, mpanel2 ); + // gtk_container_add( GTK_CONTAINER( mpanel ), scrolledpane ); + gtk_fixed_put( GTK_FIXED( mpanel ), scrolledpane, 0, 35 ); + gtk_widget_set_size_request( scrolledpane, winwidth, winht - 80 ); + operating_mode = 2; + + xpos = (int)(0.037 * (float)winwidth + 0.5); + // printf("\nwinwidth = %d, Save = %g, ", winwidth, (float)xpos / (float)winwidth ); + button = make_button( mpanel, xpos, winht - 35, " Save ", save_taxfile, "0" ); /* The "Save" button. */ + add_tool_tip( button, "Save your changes." ); + + xpos = (int)(0.17 * (float)winwidth + 0.5); + button = make_button( mpanel, xpos, winht - 35, "Compute Tax", Run_TaxSolver, 0 ); + add_tool_tip( button, "Run TaxSolver." ); + + xpos = (int)(0.36 * (float)winwidth + 0.5); + button = make_button( mpanel, xpos, winht - 35, " Print ", printout, 0 ); + add_tool_tip( button, "Print results." ); + + xpos = (int)(0.54 * (float)winwidth + 0.5); + button = make_button( mpanel, xpos, winht - 35, "Options", options_pdf_diaglog, 0 ); + add_tool_tip( button, "Review and set options." ); + + xpos = (int)(0.65 * (float)winwidth + 0.5); + button = make_button( mpanel, xpos, winht - 35, "Help", helpabout2, 0 ); + add_tool_tip( button, "Get information about this program,\n Help, and Updates." ); + + xpos = (int)(0.745 * (float)winwidth + 0.5); + button = make_button( mpanel, xpos, winht - 35, "Switch Form", switch_form, 0 ); + add_tool_tip( button, "Switch to-, or Open-, another form." ); + + xpos = (int)(0.93 * (float)winwidth + 0.5) - 20; + // printf("Exit = %1.2g\n", (float)xpos / (float)winwidth ); + button = make_button( mpanel, xpos, winht - 35, " Exit ", quit_wcheck, 0 ); + add_tool_tip( button, "Leave this program." ); + + twrd = (char *)malloc( strlen( taxform_name ) + 100 ); + strcpy( twrd, "" ); + strcat( twrd, taxform_name ); + strcat( twrd, "" ); + fontsz = 12.0; + title_label = make_sized_label( mpanel, x1, 10, twrd, fontsz ); /* Temporarily make label to get its size. */ + gtk_widget_size_request( (GtkWidget *)title_label, &actual ); + if (actual.width > winwidth) + fontsz = fontsz * (float)winwidth / (float)actual.width; + else + x1 = (winwidth - (actual.width + 20)) / 2; + if (x1 < 0) x1 = 0; + gtk_widget_destroy( title_label ); + title_label = make_sized_label( mpanel, x1, 10, twrd, fontsz ); /* Remake label in centered position. */ + set_widget_color( title_label, "#0000ff" ); + free( twrd ); + + if (init) + { + T1 = Report_Time(); + read_instructions( init ); + if (verbose) printf("\nRead_Instructions took %g Seconds.\n\n", Report_Time() - T1 ); + } + + g_signal_connect( outer_window, "button-press-event", G_CALLBACK( mouse_clicked ), NULL ); + // gtk_widget_add_events( outer_window, GDK_BUTTON_RELEASE_MASK ); + // g_signal_connect( outer_window, "button-release-event", G_CALLBACK( mouse_unclicked ), NULL ); + + DisplayTaxInfo(); + gtk_widget_show_all( outer_window ); +} + + +void Get_Tax_Form_Page( char *fname ) /* This is only called once, to bring up the initial form. */ +{ + Read_Tax_File( fname ); + Setup_Tax_Form_Page(1); +} + + +void Get_New_Tax_Form_Page( char *fname ) /* Transition from initial opening window to tax-form window. */ +{ + winwidth = 780; + winht = 700; + gtk_window_set_resizable( GTK_WINDOW( outer_window ), 1 ); + gtk_window_resize( (GtkWindow *)outer_window, winwidth, winht ); + Get_Tax_Form_Page( fname ); +} + + + +void check_comments() /* Make sure every line has a comment field. */ +{ + struct taxline_record *txline; + struct value_list *tmppt, *npt, *tail; + int ncomments; + + txline = taxlines_hd; + while (txline!=0) + { + ncomments = 0; + tmppt = txline->values_hd; + while (tmppt!=0) + { + if (tmppt->kind==VKIND_COMMENT) ncomments++; + if ((tmppt->nxt==0) || (tmppt->linenum != tmppt->nxt->linenum)) + { + if (ncomments==0) + { + if (debug) printf(" Adding empty missing comment to line %d\n", tmppt->linenum ); + new_list_item_value( VKIND_COMMENT, txline, "", 50, tmppt->linenum); + if (tmppt->nxt != txline->values_tl) + { + npt = txline->values_tl; + tail = tmppt->nxt; + while (tail->nxt != npt) tail = tail->nxt; + tail->nxt = 0; + txline->values_tl = tail; + npt->nxt = tmppt->nxt; + tmppt->nxt = npt; + } + } + ncomments = 0; + } + tmppt = tmppt->nxt; + } + txline = txline->nxt; + } +} + + +int startswith( char *line, char *phrase ) +{ /* Return true if first non-whitespace characters of line begin with pharse. */ + int j=0, k=0; + while ((line[j] != '\0') && (isspace(line[j]))) + j++; + while ((line[j] != '\0') && (line[j] == phrase[k]) && (phrase[k] != '\0')) + { j++; k++; } + if (phrase[k] == '\0') + return 1; + else + return 0; +} + + +struct choice_rec + { + char *word; + GtkEntry *box; + }; + + +void status_choice_S( GtkWidget *wdg, void *x ) +{ struct value_list *tmppt=(struct value_list *)x; + modify_formbox( tmppt->box, "Single" ); + if (filingstatus_mfj != 0) + re_display_form(); +} + +void status_choice_MJ( GtkWidget *wdg, void *x ) +{ struct value_list *tmppt=(struct value_list *)x; + modify_formbox( tmppt->box, "Married/Joint" ); + if (filingstatus_mfj != 1) + re_display_form(); +} + +void status_choice_MS( GtkWidget *wdg, void *x ) +{ struct value_list *tmppt=(struct value_list *)x; + modify_formbox( tmppt->box, "Married/Sep" ); + if (filingstatus_mfj != 0) + re_display_form(); +} + +void status_choice_HH( GtkWidget *wdg, void *x ) +{ struct value_list *tmppt=(struct value_list *)x; + modify_formbox( tmppt->box, "Head_of_Household" ); + if (filingstatus_mfj != 0) + re_display_form(); +} + +void status_choice_W( GtkWidget *wdg, void *x ) +{ struct value_list *tmppt=(struct value_list *)x; + modify_formbox( tmppt->box, "Widow(er)" ); + if (filingstatus_mfj != 0) + re_display_form(); +} + +void spinner_choice( GtkWidget *wdg, void *x ) +{ struct choice_rec *tmppt=(struct choice_rec *)x; + modify_formbox( tmppt->box, tmppt->word ); +} + + + + + +GtkEntry *active_entry; + +void set_included_file( char *fname ) +{ + // printf("OTS_RET_open_include_file: f='%s', dir='%s', wc='%s', fname='%s'\n", fname, directory_dat, wildcards_fb, filename_fb ); + if (include_file_name != 0) free( include_file_name ); + include_file_name = strdup( fname ); + if (strstr( include_file_name, " ")) + { /* If filename contains white-space, then add quotes around it. */ + char tmpfname[MaxFname]="\""; + strcat( tmpfname, include_file_name ); + strcat( tmpfname, "\"" ); + free( include_file_name ); + include_file_name = strdup( tmpfname ); + } + modify_formbox( active_entry, include_file_name ); +} + + +void open_include_file( GtkWidget *wdg, gpointer data ) +{ char *filename; + struct value_list *eb=(struct value_list *)data; + active_entry = eb->box; + filename = get_formbox( active_entry ); + if (filename[0] == '?') filename[0] = '\0'; /* Erase place-holder. */ + fb_clear_banned_files(); + strcpy( wildcards_incl, "_out.txt" ); + fb_extract_path_fname( filename, directory_incl, filename_incl ); + // printf("OTS_open_include_file: dir='%s', wc='%s', fname='%s'\n", directory_incl, wildcards_fb, filename_fb ); + Browse_Files( "File to Include:", 2048, directory_incl, wildcards_incl, filename_incl, set_included_file ); +} + + +void open_f8949_spreadsheet( GtkWidget *wdg, gpointer data ) +{ char *filename; + struct value_list *eb=(struct value_list *)data; + active_entry = eb->box; + filename = get_formbox( active_entry ); + if (filename[0] == '?') filename[0] = '\0'; /* Erase place-holder. */ + fb_clear_banned_files(); + strcpy( wildcards_incl, "_out.txt" ); + fb_extract_path_fname( filename, directory_incl, filename_incl ); + // printf("OTS_open_include_file: dir='%s', wc='%s', fname='%s'\n", directory_incl, wildcards_fb, filename_fb ); + Browse_Files( "Spreadsheet:", 2048, directory_incl, wildcards_spreadsheet, filename_incl, set_included_file ); +} + + +void escape_special_symbols( char *phrase, int maxlen ) +{ /* Replace any ampersand (&), quotes ("), or brackets (<,>), with XML escapes. */ + int j=0, k, m, n; + n = strlen(phrase); + do + { + if (phrase[j]=='&') + { + k = n + 4; m = n; n = n + 4; + if (n > maxlen) {printf("xml_Parse: MaxStrLen %d exceeded.\n",maxlen); return;} + do phrase[k--] = phrase[m--]; while (m > j); + j++; phrase[j++] = 'a'; phrase[j++] = 'm'; phrase[j++] = 'p'; phrase[j++] = ';'; + } else + if (phrase[j]=='"') + { + k = n + 5; m = n; n = n + 5; + if (n > maxlen) {printf("xml_Parse: MaxStrLen %d exceeded.\n",maxlen); return;} + do phrase[k--] = phrase[m--]; while (m > j); + phrase[j++] = '&'; phrase[j++] = 'q'; phrase[j++] = 'u'; phrase[j++] = 'o'; phrase[j++] = 't'; phrase[j++] = ';'; + } else + if (phrase[j]=='<') + { + k = n + 3; m = n; n = n + 3; + if (n > maxlen) {printf("xml_Parse: MaxStrLen %d exceeded.\n",maxlen); return;} + do phrase[k--] = phrase[m--]; while (m > j); + phrase[j++] = '&'; phrase[j++] = 'l'; phrase[j++] = 't'; phrase[j++] = ';'; + } else + if (phrase[j]=='>') + { + k = n + 3; m = n; n = n + 3; + if (n > maxlen) {printf("xml_Parse: MaxStrLen %d exceeded.\n",maxlen); return;} + do phrase[k--] = phrase[m--]; while (m > j); + phrase[j++] = '&'; phrase[j++] = 'g'; phrase[j++] = 't'; phrase[j++] = ';'; + } else j++; + } + while (phrase[j] != '\0'); +} + + +GtkWidget *make_bold_label( GtkWidget *panel, int xpos, int ypos, char *text ) +{ + GtkWidget *bpanel, *label; + char *tmptxt1, *tmptxt2; + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + label = gtk_label_new( text ); + tmptxt1 = (char *)malloc( strlen(text) + 1000 ); + tmptxt2 = (char *)malloc( strlen(text) + 1000 ); + strcpy( tmptxt1, text ); + escape_special_symbols( tmptxt1, 1000 ); + sprintf( tmptxt2, "%s", tmptxt1 ); + gtk_label_set_markup( (GtkLabel *)label, tmptxt2 ); + gtk_container_add( GTK_CONTAINER( bpanel ), label ); + free( tmptxt1 ); + free( tmptxt2 ); + return label; +} + + +char check_for_illegal_symbols( char *phrase, char *illegal_characters ) +{ /* Check for any problematic chararcters in file-names or file-paths. */ + /* Return 0 if OK. Otherwise returns the illegal character encountered. */ + int j=0, k; + while (phrase[j] != '\0') + { + k = 0; + while ((illegal_characters[k] != '\0') && (phrase[j] != illegal_characters[k])) + k++; + if (illegal_characters[k] != '\0') + return illegal_characters[k]; + j++; + } + return 0; +} + + +void Check_for_illegal_characters_in_the_file_path( char *pathname ) +{ /* Check for any illegal characters in the file-path. */ + char ch, msg[4096]; + #ifdef __MINGW32__ + ch = check_for_illegal_symbols( pathname, "'|()!@#~<>#$%^&*={}[]`;,?\"\t" ); + #else + ch = check_for_illegal_symbols( pathname, "'|()!@#~<>#$%^&*={}[]`;:,?\"\t" ); + #endif + if (ch != 0) + { + sprintf(msg,"Problematic character: %c found in file-path.\nWill prevent proper operation of OTS.\nRemove illegal character. Or re-install OTS under a legal directory path\ncontaining only characters: A-Z, a-z, 0-9, _ (underscore), or . (dot).", ch ); + GeneralPopup( "Illegal Character", msg, 1 ); + } +} + + +char *mystrcasestr( char *haystack, char *needle ) +{ + int j=0; + char *hs, *ndl, *pt; + hs = strdup( haystack ); + while (hs[j] != '\0') { hs[j] = toupper( hs[j] ); j++; } + ndl = strdup( needle ); + j = 0; + while (ndl[j] != '\0') { ndl[j] = toupper( ndl[j] ); j++; } + pt = strstr( hs, ndl ); + if (pt != 0) + { + j = 0; + while (pt != &(hs[j])) j++; + pt = &(haystack[j]); + } + free( ndl ); + free( hs ); + return pt; +} + + +/*************************************************************************/ +/* Display the Tax Info - This routine constructs, lays-out and populates */ +/* the panels. Called after initial read-in and on updates. */ +/*************************************************************************/ +void DisplayTaxInfo() +{ + struct taxline_record *txline; + struct value_list *entry, *previous_entry=0; + GtkWidget *label, *button, *cbutton, *menu; + GtkRequisition req; + GtkEntry *lastbox=0; + char messg[4096]; + int linenum, iscapgains, noplus=0; + int capgtoggle=0, firstbox_on_line_x=0; + int y1, y1a, yoffset=4, y2, y3, dy; + int entry_box_height=1, extra_dy, sectionheader=1; + + int label_x0=2, label_width, label_x1, box_x0, box_width, box_x1=100, comment_x0; + int norm_label_x1=100, min_box_x0 = 110, min_comment_x0 = 100; + int horzpad=10; + + check_comments(); + y1 = 5; y1a = y1 + yoffset; dy = 50; + if (debug) dump_taxinfo(); + + /* Now place the form-data onto the pages. */ + if (debug) printf("\n--------- Now rendering interactive form-page ------------\n"); + txline = taxlines_hd; + while (txline != 0) + { + if ((filingstatus_mfj == 1) || (strstr( txline->linename, "Spouse" ) == 0)) + { /*DisplayLine*/ + /* Place the line label. */ + // printf("\nAdding LineLabel %d (%3d, %d): '%s'\n", txline->linenum, 2, y1a, txline->linename ); + label = make_label( mpanel2, 2, y1a, txline->linename ); + txline->vpos = y1a; + gtk_widget_size_request( label, &req ); /* First find the label's size. */ + gtk_widget_destroy( label ); /* Remove it, then re-place it at best position. */ + label_width = req.width; + label_x0 = norm_label_x1 - label_width - 4; + if (label_x0 < 0) label_x0 = 0; + if (debug) printf("%d: LineLabel '%s' at (%d, %d)\n",txline->linenum, txline->linename, label_x0, y1a ); + label = make_label( mpanel2, label_x0, y1a, txline->linename ); + if (txline->instructions) + set_widget_color( label, "#0000a0" ); + label_x1 = label_x0 + label_width; + box_x0 = label_x1 + horzpad; + if (box_x0 < min_box_x0) box_x0 = min_box_x0; + comment_x0 = label_x1 + horzpad + 10; + button = 0; + lastbox = 0; + + if ((strncmp(txline->linename,"Cap-Gains",9) == 0) || (strncmp(txline->linename,"CapGains",8) == 0)) + iscapgains = 1; + else + iscapgains = 0; + + linenum = txline->linenum; + entry = txline->values_hd; + button = 0; capgtoggle = 0; extra_dy = 0; + while (entry != 0) + { /*entry*/ + if (linenum != entry->linenum) + { + y1 = y1 + dy + extra_dy; + y1a = y1 + yoffset; + linenum = entry->linenum; + extra_dy = 0; + comment_x0 = min_comment_x0; + if (debug) printf("\tLineNum now = %d\n", linenum ); + button = 0; + } + if (strstr( txline->linename, ":" ) != 0) noplus = 1; + switch (entry->kind) + { + case VKIND_FLOAT: /* This kind is presently not used at all. (or anymore?) */ + sprintf(messg, "%12.2f", entry->value ); + entry->box = make_formbox( mpanel2, box_x0, y1, 12, messg, 500, 0, 0 ); + lastbox = entry->box; + gtk_widget_size_request( (GtkWidget *)(entry->box), &req ); + box_width = req.width; + entry_box_height = req.height; + box_x1 = box_x0 + box_width; + comment_x0 = box_x1 + horzpad; + if (debug) printf("\tFloat-FormBox(%d-%d, %d) = '%s'\n", box_x0, box_x1, y1, messg ); + y2 = y1 + entry_box_height - 1; + button = make_button_wsizedcolor_text( mpanel2, box_x1 - 15, y2, "+", 6.0, "#000000", add_new_box_item, entry ); /* Add another box - button */ + add_tool_tip( button, "Add another entry box\nfor this line." ); + break; + + case VKIND_INT: + if (debug) printf("\tUnhandled VKIND_INT happened (%d) ??\n", (int)(entry->value)); + break; + + case VKIND_TEXT: + if (debug) printf("\tText-FormBox: '%s' formtype = %d\n", entry->text, entry->formtype ); + + if (entry->formtype == 0) + { /*normal*/ + entry->box = make_formbox( mpanel2, box_x0, y1, 12, entry->text, 500, 0, 0 ); + if (debug) printf("\t\tPlaced type0 at (%d, %d) 12-wide\n", box_x0, y1 ); + } + else + { + if (entry->formtype == ID_INFO) + { + entry->box = make_formbox( mpanel2, box_x0, y1, 24, entry->text, 500, 0, 0 ); + if (debug) printf("\t\tPlaced type2 at (%d, %d) 24-wide\n", box_x0 + 20, y1 ); + } + else + { /*Literal_Info*/ + entry->box = make_formbox( mpanel2, box_x0, y1, 10, entry->text, 500, 0, 0 ); + if (debug) printf("\t\tPlaced type1 at (%d, %d) 10-wide\n", box_x0 + 20, y1 ); + } + noplus = 1; + } + lastbox = entry->box; + gtk_widget_size_request( (GtkWidget *)(entry->box), &req ); + box_width = req.width; + entry_box_height = req.height; + box_x1 = box_x0 + box_width; + comment_x0 = box_x1 + horzpad; + + previous_entry = entry; + if (strcmp(txline->linename,"Status") == 0) + { + menu = make_menu_button( mpanel2, box_x1 + 3, y1a-2, "*" ); + add_tool_tip( most_recent_menu, "Click to select filing status\nfrom available choices." ); + add_menu_item( menu, "Single", status_choice_S, entry ); + add_menu_item( menu, "Married/Joint", status_choice_MJ, entry ); + add_menu_item( menu, "Married/Sep", status_choice_MS, entry ); + add_menu_item( menu, "Head_of_Household", status_choice_HH, entry ); + add_menu_item( menu, "Widow(er)", status_choice_W, entry ); + comment_x0 = comment_x0 + 20; + if (strlen( entry->text ) > 2) + { + if (mystrcasestr( entry->text, "Married/Joint" ) != 0) + filingstatus_mfj = 1; + else + filingstatus_mfj = 0; + } + } + else + if (iscapgains) + { + switch (capgtoggle) + { + case 0: + make_label( mpanel2, box_x0 + 15, y1 - 16, "Buy Cost" ); + firstbox_on_line_x = box_x0; + box_x0 = comment_x0; + capgtoggle++; + + y2 = y1 + 15; + button = make_button_wsizedcolor_text( mpanel2, 60, y2 - 15, "Clear", 8.0, "#000000", verify_capgain_reset, entry ); + add_tool_tip( button, "Clear all data for this CapGain\nSet Buy Cost box to Ready" ); + + break; + case 1: + make_label( mpanel2, box_x0 + 15, y1 - 16, "Date Bought" ); + box_x0 = firstbox_on_line_x; + capgtoggle++; + break; + + case 2: + make_label( mpanel2, box_x0 + 15, y1 - 16, "Sold For" ); + box_x0 = comment_x0; + capgtoggle++; + break; + case 3: + make_label( mpanel2, box_x0 + 15, y1 - 16, "Date Sold" ); + box_x0 = firstbox_on_line_x; + capgtoggle++; + break; + + + case 4: + make_label( mpanel2, box_x0 + 15, y1 - 16, "Adj Code" ); + box_x0 = comment_x0; + capgtoggle++; + break; + + case 5: + make_label( mpanel2, box_x0 + 15, y1 - 16, "Adj Amnt" ); + capgtoggle = 0; + y2 = y1 + entry_box_height - 1; + button = make_button_wsizedcolor_text( mpanel2, box_x1 - 15, y2, "+", 6.0, "#000000", add_new_capgain_boxes, entry ); /* Add more boxes - button */ + add_tool_tip( button, "Add another set of entry\nboxes for another\ncap-gains entry." ); + extra_dy = 23; + box_x0 = firstbox_on_line_x; + break; + default: capgtoggle = 0; + } + } + else + if (!noplus) + { + y2 = y1 + entry_box_height - 1; + button = make_button_wsizedcolor_text( mpanel2, box_x1 - 15, y2, "+", 6.0, "#000000", add_new_box_item, entry ); /* Add another box - button */ + add_tool_tip( button, "Add another entry box\nfor this line." ); + } + break; + + case VKIND_COMMENT: + if (debug) printf("\tComment {%s} at (%d, %d)\n", entry->comment, comment_x0, y1a ); + + if (startswith( entry->comment, "--" )) + { /*Section_header*/ + sectionheader = 1; + y1 = y1 + 10; + y1a = y1a + 10; + if (startswith( entry->comment, "---" )) + { + comment_x0 = 20; + sectionheader = 2; + } + } + if ((lastbox != 0) && (strstr( entry->comment, "(answer: " ) != 0)) + { char tmpline[1024], tmpword[512]; /* Add choices-spinner. */ + struct choice_rec *choice_item; + int j=0; + if (button != 0) { gtk_widget_destroy( button ); button = 0; } + strcpy( tmpline, strstr( entry->comment, "(answer: " ) ); + while ((tmpline[j] != '\0') && (tmpline[j] != ')')) j++; + if (tmpline[j] == ')') tmpline[j] = '\0'; + fb_next_word( tmpline, tmpword, " \t," ); + fb_next_word( tmpline, tmpword, " \t," ); + menu = make_menu_button( mpanel2, box_x1 + 3, y1a-2, "*" ); + add_tool_tip( most_recent_menu, "Click to select available choices." ); + while (tmpword[0] != '\0') + { + if (strcmp( tmpword, "...") != 0) + { + choice_item = (struct choice_rec *)malloc( sizeof(struct choice_rec) ); + choice_item->box = lastbox; + choice_item->word = strdup( tmpword ); + add_menu_item( menu, tmpword, spinner_choice, choice_item ); + } + fb_next_word( tmpline, tmpword, " \t," ); + } + comment_x0 = comment_x0 + 20; + } + + // printf(" Comment %d (%3d, %3d): '%s'\n", txline->linenum, comment_x0, y1a, entry->comment ); + if (sectionheader < 2) + label = make_label( mpanel2, comment_x0, y1a, entry->comment ); + else + label = make_bold_label( mpanel2, comment_x0, y1a, entry->comment ); + entry->comment_label = label; + + /* Add edit_line_comment button */ + if ((!sectionheader) && (entry_box_height != 0)) + { GtkRequisition sz; + gtk_widget_size_request( entry->comment_label, &sz ); + y3 = y1 + entry_box_height - 1; + if (comment_x0 + sz.width < winwidth - 65) + y2 = y1 + 0.25 * entry_box_height - 1; + else + y2 = y1 + entry_box_height - 1; + + cbutton = make_button_wsizedcolor_text( mpanel2, winwidth - 40, y2 - 4, "*", 7.0, "#000000", edit_line_comment, entry ); + add_tool_tip( cbutton, "Edit the comment for\nthis line." ); + if ((strstr( entry->comment, "File-name") != 0) && (previous_entry != 0)) + { + if (button != 0) { gtk_widget_destroy( button ); button = 0; } + if (strstr( entry->comment, "spread-sheet") == 0) + { + cbutton = make_button_wsizedcolor_text( mpanel2, comment_x0 + 40, y3 - 4, "Browse", 7.0, "#0000ff", open_include_file, previous_entry ); + add_tool_tip( cbutton, "Browse for tax return\noutput file to reference." ); + } + else + { + cbutton = make_button_wsizedcolor_text( mpanel2, comment_x0 + 40, y3 - 4, "Browse", 7.0, "#0000ff", open_f8949_spreadsheet, previous_entry ); + add_tool_tip( cbutton, "Browse for optional f8949 SpreadSheet\nCSV file for cap-gains+losses." ); + } + } + } + + if (strstr( entry->comment, "\n" )) /* Add extra line spacing for multi-line comments. */ + { int j=0; + while ( entry->comment[j] != 0) { if (entry->comment[j] == '\n') y1 = y1 + 0.2 * dy; j++; } + } + sectionheader = 0; + break; + } + noplus = 0; + entry = entry->nxt; + } /*entry*/ + + y1 = y1 + dy; + y1a = y1 + yoffset; + } /*DisplayLine*/ + else + txline->values_hd->box = 0; + + txline = txline->nxt; + } + if (debug) printf("\n--------- Done rendering interactive form-page ------------\n"); +} + + + + +void dump_taxinfo() +{ + struct taxline_record *txline; + struct value_list *tmppt; + + printf("\n======================================\n"); + printf("Line#, Kind, formtype: Value\n--------------------\n"); + txline = taxlines_hd; + while (txline != 0) + { + printf("\n%d: %s\n", txline->linenum, txline->linename ); + tmppt = txline->values_hd; + while (tmppt != 0) + { + switch (tmppt->kind) + { + case VKIND_FLOAT: printf("\t%d,F,%d: %6.2f\n", tmppt->linenum, tmppt->formtype, tmppt->value ); break; + case VKIND_INT: printf("\t%d,I,%d: %d\n", tmppt->linenum, tmppt->formtype, (int)(tmppt->value) ); break; + case VKIND_TEXT: printf("\t%d,T,%d: %s\n", tmppt->linenum, tmppt->formtype, tmppt->text ); break; + case VKIND_COMMENT: printf("\t%d,C: {%s}\n", tmppt->linenum, tmppt->comment ); break; + case VKIND_COLON: printf("\t%d,s:\n", tmppt->linenum ); break; + default: printf("\t%d,U: \n", tmppt->linenum ); break; + } + tmppt = tmppt->nxt; + } + txline = txline->nxt; + } + printf("\n"); +} + + + +char *my_strcasestr( char *line, char *srchstr ) +{ /* Define portable version of "non-std" C-extension function that is not (yet?) available on all platforms. */ + int j=0, k; + while (line[j] != '\0') + { + k = 0; + while ((line[j+k] != '\0') && (srchstr[k] != '\0') && (toupper( line[j+k] ) == toupper( srchstr[k]))) + k++; + if (srchstr[k] == '\0') { return &(line[j]); } + j++; + } + return 0; +} + + +void check_valid_date( char *str ) +{ /* Ensure that a date string has valid delimiters ("-" or "/"); NO spaces. */ + /* Must have 3 terms, separated by non-space delimiter. */ + int j=0, k=0; + char *outstr, delim='-'; + outstr = strdup( str ); + + while (str[j] == ' ') /* Get past any initial white-space(s). */ + j++; + do /* Copy 1st term until next delimiter. */ + outstr[k++] = str[j++]; + while ((str[j-1] != '\0') && (str[j-1] != '-') && (str[j-1] != '/') && (str[j-1] != ' ') && (str[j-1] != '.') && (str[j-1] != ',')); + if ((str[j-1] != '\0') && (str[j-1] != '-') && (str[j-1] != '/')) + outstr[k-1] = delim; + if (str[j-1] == '\0') + j = j - 1; + else + delim = outstr[k-1]; + + while ((str[j] == ' ') || (str[j] == '-') || (str[j] == '/')) /* Get past any intervening white-space(s) or deliminters. */ + j++; + do /* Copy 2nd term until next delimiter. */ + outstr[k++] = str[j++]; + while ((str[j-1] != '\0') && (str[j-1] != '-') && (str[j-1] != '/') && (str[j-1] != ' ') && (str[j-1] != '.') && (str[j-1] != ',')); + if ((str[j-1] != '\0') && (str[j-1] != delim)) + outstr[k-1] = delim; + if (str[j-1] == '\0') + j = j - 1; + + while ((str[j] == ' ') || (str[j] == '-') || (str[j] == '/')) /* Get past any intervening white-space(s) or deliminters. */ + j++; + do /* Copy 3rd term until end. */ + outstr[k++] = str[j++]; + while ((str[j-1] != '\0') && (str[j-1] != ' ')); + + strcpy( str, outstr ); /* Save temporary result string back to original string. */ + free( outstr ); +} + + +int lookaheadvals( struct value_list *linept ) +{ /* Look ahead and count the number of any remaining values in the list of items for the given line pointer. */ + int nn=0; + while (linept != 0) + { + if ((linept->kind==VKIND_FLOAT) || (linept->kind==VKIND_TEXT) || (linept->kind==VKIND_INT)) + nn++; + linept = linept->nxt; + } + return nn; +} + + +void capgain_ready_warning(char ready_val[5][1024], char ready_comment[2][1024]) /* Used in Save_TaxFile, VKIND_TEXT, iscapgains true */ +{ + char msg[4096]; + sprintf(msg, "CapGain * Ready * Entries are NOT Written to the Save File\n"); + sprintf(msg + strlen(msg), "However, there are non-empty boxes present.\n\n"); + sprintf(msg + strlen(msg), "If you wish to preserve non-empty boxes, fill in the Buy Cost box.\n\n"); + sprintf(msg + strlen(msg), "%-12s%-12s%-12s\n\n", ready_val[0], ready_val[1], ready_comment[0]); + sprintf(msg + strlen(msg), "%-12s%-12s%-12s\n\n", ready_val[2], ready_val[3], ready_comment[1]); + sprintf(msg + strlen(msg), "%-12s%-12s%-12s\n", ready_val[4], ready_val[5], ready_comment[2]); + GeneralPopup( "Caution Advisory:", msg, 1); +} + + +void Save_Tax_File( char *fname ) +{ + struct taxline_record *txline; + struct value_list *tmppt; + int lastline=-1, semicolon, j, newline; + char *suffix, *tmpstr; + FILE *outfile; + + // printf("OTS_save_taxfile RET: f='%s' dir='%s', wc='%s', fname='%s'\n", fname, directory_dat, wildcards_fb, filename_fb ); + if (current_working_filename != 0) free( current_working_filename ); + current_working_filename = strdup( fname ); + + /* Update the data structure(s) by getting the form fields. */ + Update_box_info(); + + /* Prevent weird characters in the save-name. */ + if (1) /* 1 = Protect users from creating bad filenames. 0 = Let them do whatever. */ + { + j = strlen( current_working_filename ) - 1; /* Find leaf-name, to skip over path name. */ + while ((j >= 0) && (current_working_filename[j] != '/') && (current_working_filename[j] != '\\')) + j--; + j++; /* Will be at last slash or first character in file name. */ + while (current_working_filename[j] != '\0') + { + #ifdef __MINGW32__ + if ((current_working_filename[j] == ':') && (j == 1)) + ; /* Allow ':' as second character - only. */ + else + #endif + if ((current_working_filename[j] < '+') || (current_working_filename[j] > 'z') || + (current_working_filename[j] == ',')) + { + if (current_working_filename[j] != ' ') + current_working_filename[j] = '_'; + } + else + if ((current_working_filename[j] > '9') && (current_working_filename[j] < 'A')) + current_working_filename[j] = '_'; + else + if ((current_working_filename[j] > ']') && (current_working_filename[j] < 'a')) + current_working_filename[j] = '_'; + j++; + } + } + + suffix = my_strcasestr( current_working_filename, ".txt" ); + if ((suffix == 0) || (strcasecmp( suffix, ".txt" ) != 0)) + { + tmpstr = (char *)malloc( strlen( current_working_filename ) + 10 ); + strcpy( tmpstr, current_working_filename ); + strcat( tmpstr, ".txt" ); + current_working_filename = tmpstr; + } + + suffix = my_strcasestr( current_working_filename, "_out.txt" ); + if ((suffix != 0) && (strcasecmp( suffix, "_out.txt" ) == 0)) + { + warn_release = 2; + GeneralWarning( "Your are saving an 'input-file', but the file name you picked looks like an output file." ); + return; + } + + if ((my_strcasestr( current_working_filename, "_template.txt" ) != 0)) + { + warn_release = 2; + GeneralWarning( "Your are saving over the 'template' file. Please choose a new unique name." ); + return; + } + + outfile = fopen(current_working_filename, "w"); + if (outfile==0) + { + sprintf(wmsg,"ERROR: Output file '%s' could not be opened for writing.", current_working_filename ); + warn_release = 2; + GeneralWarning( wmsg ); + return; + } + if (yourfilename != 0) free( yourfilename ); + yourfilename = strdup( current_working_filename ); + fprintf(outfile,"%s", title_line); + + if (round_to_whole_nums) + fprintf(outfile,"\nRound_to_Whole_Dollars\n"); + + txline = taxlines_hd; + while (txline!=0) + { /*txline*/ + int numvals=0, numcoms=0, iscapgains, capgain_ready_flg=0, ReadyErrFlg=0, tilde_flg=0; + char ready_val[6][1024], ready_comment[3][1024]={{0}}; /* Used by capgain_ready_warning */ + int valcnt=0, comcnt=0; /* Counters for an individual gain */ + // printf("\nNewTaxLine: '%s' (linenum = %d)\n", txline->linename, txline->linenum ); + fprintf(outfile,"\n%s", txline->linename ); /* Write line-label, if any. */ + if (strncasecmp(txline->linename, "CapGains",7) == 0) + iscapgains = 1; + else + iscapgains = 0; + semicolon = 0; + newline = 0; + lastline = txline->linenum; + tmppt = txline->values_hd; + while (tmppt!=0) /* Now write the line-value(s), comment(s), and ";", if any. */ + { /*line_item*/ + if (valcnt == 6) /* Counters and flags to enable Capgain Reset */ + { + valcnt = 0; + comcnt = 0; + capgain_ready_flg = 0; + ReadyErrFlg = 0; + tilde_flg = 0; + } + + switch (tmppt->kind) + { + case VKIND_FLOAT: + if (newline) fprintf(outfile,"\n"); + fprintf(outfile," %6.2f ", tmppt->value ); + numvals++; + // printf(" FloatValue: '%6.2f' (linenum = %d)\n", tmppt->value, tmppt->linenum ); + break; + case VKIND_INT: + if (newline) fprintf(outfile,"\n"); + fprintf(outfile," %d ", (int)(tmppt->value) ); + numvals++; + // printf(" IntValue: '%d' (linenum = %d)\n", (int)(tmppt->value), tmppt->linenum ); + break; + case VKIND_TEXT: + if (iscapgains) + { + /* Handle capgain_ready_flg */ + if ( valcnt == 0 && (strcmp(tmppt->text, CAPGAIN_READY) == 0 ) ) capgain_ready_flg = 1; + if (capgain_ready_flg == 0) + { + tilde_flg=0; + if ( (strlen(tmppt->text) == 0 ) ) /* Check for empty capgains box */ + { + //GeneralWarning ("Detected Empty CapGains Box, Inserting '~' into save file."); + tilde_flg=1; + } + if (lastline != tmppt->linenum) + { int j; for (j=0; j < tmppt->linenum - lastline; j++) fprintf(outfile,"\n"); lastline++; } + if (tilde_flg==1) + fprintf(outfile," ~ "); + else + { + if ((valcnt == 1) || (valcnt == 3)) + { /*CheckCapGain_DateFormat*/ + char *orig; + orig = strdup( tmppt->text ); + check_valid_date( tmppt->text ); + if (strcmp( orig, tmppt->text ) != 0) + modify_formbox( tmppt->box, tmppt->text ); + free( orig ); + } /*CheckCapGain_DateFormat*/ + fprintf(outfile," %s ", tmppt->text ); + } + if (valcnt==5 && ReadyErrFlg==1) capgain_ready_warning(ready_val, ready_comment); /* Display Warning Message */ + } // capgain_ready_flg == 0 + else + { /* capgain_ready_flg = 1, "Ready" is in Buy Cost box, Do Error trapping. Do NOT save to input.txt file. */ + strcpy(ready_val[valcnt], tmppt->text) ; /* Collect the capgain data values in array ready_val */ + /* A "Ready" gain/loss should only contain empty or "~" values */ + if ( (valcnt > 0) && (strlen(tmppt->text) != 0) && (strcmp(tmppt->text, "~") != 0 ) ) ReadyErrFlg = 1; + if (valcnt==5 && ReadyErrFlg==1) capgain_ready_warning(ready_val, ready_comment); /* Display Warning Message */ + } + } /* iscapgains */ + else + { /*RegularValue*/ + if (newline) fprintf(outfile,"\n"); + fprintf(outfile," %s ", tmppt->text ); + } /*RegularValue*/ + valcnt++; + numvals++; + // printf(" TextValue: '%s' (linenum = %d)\n", tmppt->text, tmppt->linenum ); + break; + case VKIND_COMMENT: + if (tmppt->linenum != lastline) fprintf(outfile,"\n\t"); + if ( (strlen(tmppt->comment)>0)) + { + if (capgain_ready_flg == 0) fprintf(outfile," {%s}", tmppt->comment ); + else + { + strcpy(ready_comment[comcnt], tmppt->comment); /* CapGain Ready gain/loss */ + comcnt++; + } + } + // printf(" Comment: '%s' (linenum = %d)\n", tmppt->comment, tmppt->linenum ); + numcoms++; + break; + case VKIND_COLON: + if ((numvals < 2) && (numcoms == 0) && (lookaheadvals(tmppt->nxt) == 0)) + fprintf(outfile,"\t;"); + else + semicolon = 1; + // printf(" SemiColon: numvals = %d (linenum = %d)\n", numvals, tmppt->linenum ); + break; + } + newline = 1; + lastline = tmppt->linenum; + tmppt = tmppt->nxt; + } /*line_item*/ + + if (semicolon) + { + fprintf(outfile,"\n"); + fprintf(outfile," ;"); + } + txline = txline->nxt; + } /*txline*/ + + + fprintf(outfile,"\n"); + dump_any_markup_commands( outfile ); + fclose(outfile); + save_needed = 0; + printf("\nWrote form-data to file %s\n.", yourfilename ); + if (pending_compute == 2) + taxsolve(); +} + + + +void open_taxfile( char *filename ) +{ + if (yourfilename == 0) + yourfilename = strdup( filename ); + infile = fopen(filename,"r"); + if (infile==0) + { + printf("ERROR: Input file '%s' could not be opened.\n", filename); + GeneralWarning("Error: Tax file could not be opened."); + return; + } + else + { + Get_New_Tax_Form_Page( filename ); + } +} + + + +void save_taxfile( GtkWidget *wdg, void *data ) +{ + char *cpt, *param; + char *directory_save; // Pointer to directory to use; either current, or overriden by working_dir + if (verbose) printf("File-Save Dialog at: '%s'\n", directory_dat ); + param = (char *)data; + if (param[0] == '0') pending_compute = 0; + fb_clear_banned_files(); + fb_ban_files( "_out.txt" ); + fb_ban_files( "_template.txt" ); + fb_ban_files( "README" ); + strcpy( wildcards_fb, ".txt" ); + fb_extract_path_fname( yourfilename, directory_dat, filename_fb ); + cpt = strstr( filename_fb, "_template.txt" ); + if (cpt != 0) + strcpy( cpt, "_xxxx.txt" ); + + if (strlen(workdir) > 0) + directory_save = workdir; + else + directory_save = directory_dat; + printf("OTS_save_taxfile: dir='%s', wc='%s', fname='%s'\n", directory_save, wildcards_fb, filename_fb ); + Browse_Files( "File to Save As:", 2048, directory_save, wildcards_fb, filename_fb, Save_Tax_File ); +} + + +void predict_output_filename(char *indatafile, char *outfname) +{ + int j; + /* Base name of output file on input file. */ + strcpy( outfname, indatafile ); + j = strlen(outfname) - 1; + while ((j >= 0) && (outfname[j] != '.')) j--; + if (j < 0) strcat( outfname, "_out.txt" ); else strcpy( &(outfname[j]), "_out.txt" ); +} + + + +void set_tax_solver( char *fname ) +{ + if (verbose) printf("OTS_set_tax_solver RET: file='%s', dir='%s', wc='%s', fname='%s'\n", fname, toolpath, wildcards_fb, filename_fb ); + taxsolvecmd = strdup( fname ); + strcpy( taxsolvestrng, taxsolvecmd ); + + selected_form = form_other; + other_form_selected = 1; + if (strstr( taxsolvestrng, "taxsolve_HSA_f8889" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "HSA_Form_8889" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_f8606" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "Form_8606" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_US_1040_Sched_SE" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "US_1040_Sched_SE" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_f8829" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "Form_8829" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_f8995" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "Form_8995" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_f8959" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "Form_8959" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_f8960" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "Form_8960" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_f2210" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "Form_2210" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_f8812" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "Form_8812" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_CA_5805" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "Form_CA_5805" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_MI_1040" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "MI_1040" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_OR_40" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "OR_40" ); + } +} + + +void canceltxslvr( GtkWidget *wdg, void *data ) +{ + gtk_widget_destroy( resultswindow ); + resultswindow = 0; +} + + + +int missingfile=0; + + +void filter_tabs( char *line ) +{ /* Replace tabs and with spaces for clean printouts. */ + char *ptr; + + ptr = strchr( line, '\r' ); + if (ptr != 0) + ptr[0] ='\0'; + + ptr = strchr( line, '\n' ); + if (ptr != 0) + ptr[0] ='\0'; + + ptr = strchr( line, '\t' ); + while (ptr != 0) + { + ptr[0] = ' '; + ptr = strchr( line, '\t' ); + } +} + + +void set_invocation_path( char *toolpath ) +{ + char tmpstr[MaxFname]; + int k; + strcpy(tmpstr, invocation_path); + k = strlen(tmpstr)-1; + while ((k > 0) && (tmpstr[k] != slashchr)) k--; + if (k > 0) k--; + while ((k > 0) && (tmpstr[k] != slashchr)) k--; + if (tmpstr[k] == slashchr) + tmpstr[k+1] = '\0'; + else +#if (PLATFORM_KIND==Posix_Platform) + {sprintf(tmpstr,".%c", slashchr);} + if (strstr( invocation_path, "bin" ) != 0) + sprintf( toolpath, "%sbin%c", tmpstr, slashchr); + else + strcpy( toolpath, "./" ); + #else + tmpstr[k] = '\0'; + sprintf( toolpath, "%sbin%c", tmpstr, slashchr); + #endif +} + + +void quote_file_name( char *fname ) /* Place quotes around a file name. With special care on Microsoft systems. */ +{ /* Enables proper operation when files or pathnames have spaces in them. */ + char *tmpstr; + if ((fname[0] == '\0') || (strstr( fname, "\"" ) != 0)) return; + tmpstr = (char *)malloc( strlen(fname) + 10 ); + #if (PLATFORM_KIND == Posix_Platform) + strcpy( tmpstr, "\"" ); + strcat( tmpstr, fname ); + #else + if (fname[1] == ':') + { /* Leading quote must be inserted after drive letter for Microsoft OS's. */ + int j; + tmpstr[0] = fname[0]; + tmpstr[1] = fname[1]; + tmpstr[2] = '"'; + j = 2; + do { tmpstr[j+1] = fname[j]; j++; } while (tmpstr[j] != '\0'); + } + else + { + strcpy( tmpstr, "\"" ); + strcat( tmpstr, fname ); + } + #endif + strcpy( fname, tmpstr ); + strcat( fname, "\"" ); + free(tmpstr); +} + + +void quote_MS_file_name( char *fname ) /* Place quotes around a file name. With special care on Microsoft systems. */ +{ /* Enables proper operation of Edge Viewer when files or pathnames have spaces in them. */ + #if (PLATFORM_KIND != Posix_Platform) + char *tmpstr; + int j=0, k=0; + if ((fname[0] == '\0') || (strstr( fname, "\"" ) != 0)) + return; + tmpstr = (char *)malloc( strlen(fname) + 512 ); + if (fname[1] == ':') + { /* Leading quote must be inserted after drive letter for Microsoft OS's. */ + int j; + tmpstr[0] = fname[0]; + tmpstr[1] = fname[1]; + tmpstr[2] = '"'; + j = 2; + do { tmpstr[j+1] = fname[j]; j++; } while (tmpstr[j] != '\0'); + strcpy( fname, tmpstr ); + strcat( fname, "\"" ); + } + else + { + while (fname[j] != '\0') + { + if (fname[j] == ' ') + { + tmpstr[k++] = '"'; + tmpstr[k++] = fname[j]; + tmpstr[k++] = '"'; + } + else + tmpstr[k++] = fname[j]; + j++; + } + tmpstr[k] = '\0'; + strcpy( fname, tmpstr ); + } + free(tmpstr); + #endif +} + + +void taxsolve() /* "Compute" the taxes. Run_TaxSolver. */ +{ + char cmd[MaxFname+512], outfname[MaxFname]; + GtkWidget *panel, *label; + GtkTreeStore *mylist; + GtkTreeIter iter; + FILE *viewfile; + char vline[9000], *errmsg=0; + int wd, ht, valid_results=1, linesread=0; + + if (current_working_filename == 0) + { + GeneralWarning( "No tax file selected." ); + return; + } + if (strlen(taxsolvestrng) > 0) + taxsolvecmd = taxsolvestrng; + if (taxsolvecmd == 0) + taxsolvecmd = getenv("taxsolvecmd"); + if (taxsolvecmd == 0) + { + set_invocation_path( toolpath ); + fb_clear_banned_files(); + fb_ban_files( ".txt" ); + fb_ban_files( ".pdf" ); + strcpy( wildcards_fb, "" ); + strcpy( filename_fb, "" ); + // printf("OTS_taxsolve: dir='%s', wc='%s', fname='%s'\n", toolpath, wildcards_fb, filename_fb ); + Browse_Files( "Select Tax Program to Use:", 2048, toolpath, wildcards_fb, filename_fb, set_tax_solver ); + place_window_atmouse(); /* Temporarily change the new window position policy. */ + GeneralWarning( "No tax solver selected. Re-try after selecting." ); + place_window_center(); /* Restore the normal window position policy. */ + return; + } + + if ((allforms_toggle) && ((selected_form == form_US_1040) || (selected_form == form_NY_IT201))) + strcpy( run_options, "-allforms" ); + else + strcpy( run_options, "" ); + + // if (round_to_whole_nums) + // strcat( run_options, " -round_to_whole_dollars" ); + + #if (PLATFORM_KIND == Posix_Platform) + sprintf(cmd,"'%s' %s '%s' &", taxsolvecmd, run_options, current_working_filename ); + #else + if ((strlen(taxsolvecmd) > 2 ) && (taxsolvecmd[1] == ':') && (taxsolvecmd[2] != '"')) + { /*Insert quotes around file name for Microsoft, in case pathname has spaces in it.*/ + int j; + char *tstr; + j = strlen( taxsolvecmd ) + 10; + tstr = (char *)malloc(j); + for (j = 0; j < 2; j++) tstr[j] = taxsolvecmd[j]; + j = 2; /* Leading quote must be inserted after drive letter for Microsoft OS's. */ + tstr[2] = '"'; j++; + do { tstr[j] = taxsolvecmd[j-1]; j++; } while (tstr[j-1] != '\0'); + strcat( tstr, "\"" ); + taxsolvecmd = tstr; + } + sprintf(cmd,"%s %s \"%s\"", taxsolvecmd, run_options, current_working_filename ); + #endif + + printf("Invoking '%s'\n", cmd ); + system(cmd); /* Run the TaxSolver. */ + Sleep_seconds( 0.1 ); + + /* Make a popup window telling where the results are, and showing them. */ + predict_output_filename( current_working_filename, outfname ); + wd = 620; ht = 550; + panel = make_window( wd, ht, "Results", &resultswindow ); + make_sized_label( panel, 1, 1, "Results written to file:", 12 ); + label = make_sized_label( panel, 30, 25, outfname, 8 ); + set_widget_color( label, "#0000ff" ); + // make_button( panel, wd/2 - 15, ht - 35, " OK ", canceltxslvr, 0 ); + make_button( panel, 40, ht - 35, "Print Result File", print_outfile_directly, 0 ); + make_button( panel, wd - 85, ht - 35, " Close ", canceltxslvr, 0 ); + show_wind( resultswindow ); + UpdateCheck(); + Sleep_seconds( 0.25 ); + UpdateCheck(); + Sleep_seconds( 0.25 ); + mylist = make_selection_list( panel, 5, 50, wd - 10, ht - 50 - 50, "Results Preview:", 0, 0, 0 ); + viewfile = fopen( outfname, "rb" ); + if (viewfile == 0) + { + sprintf(vline,"Cannot open: %s", outfname); + printf("%s\n", vline ); + append_selection_list( mylist, &iter, vline ); + valid_results = 0; + } + else + { + int valid=1; + fgets( vline, 256, viewfile ); + while ((!feof(viewfile)) && valid) + { + filter_tabs( vline ); + append_selection_list( mylist, &iter, vline ); + linesread++; + + if (my_strcasestr( vline, "Error" ) != 0) + { + if ((errmsg == 0) && ((strncasecmp( vline, "Error", 5 ) == 0) || (strncasecmp( vline, "DATA Error", 10 ) == 0))) + { /* Any line starting with "Error" is considered to indicate an error-problem. */ + valid_results = 0; + errmsg = strdup( vline ); + } + } + + fgets( vline, 256, viewfile ); + if (strstr( vline, "Identity-Information:" ) != 0) + valid = 0; + } + fclose(viewfile); + } + if ((valid_results) && (linesread > 10) && (supported_pdf_form)) + make_button( panel, wd/2 - 80, ht - 35, "Fill-out PDF Forms", create_pdf_file_directly, 0 ); + show_wind( resultswindow ); + computed = 1; + compute_needed = 0; + if (errmsg) + GeneralPopup( "Error", errmsg, 1 ); +} + + + +void Run_TaxSolver( GtkWidget *wdg, void *x ) +{ + Update_box_info(); + if (save_needed) + { + warn_release = 2; + pending_compute = 1; + GeneralWarning( "Change(s) not saved. You must save before computing." ); + return; + } + taxsolve(); /* Compute Taxes. */ +} + + + + + +GtkWidget *printpopup=0, *print_label, *print_button; +GtkEntry *printerformbox; +char printer_command[MaxFname+256], wrkingfname[MaxFname]; +char fillout_pdf_command[8192], fillout_pdf_tool[2048]="", modify_pdf_tool[2048]=""; +int printdialogsetup; +int print_mode=0; +#if (PLATFORM_KIND==Posix_Platform) + char base_printer_command[]="lpr "; +#else + char base_printer_command[]="print "; +#endif +void acceptprinter_command( GtkWidget *wdg, void *data ); + + + +void set_pdf_tool_path() +{ + set_invocation_path( fillout_pdf_tool ); + strcat( fillout_pdf_tool, "fillout_PDF_forms" ); + quote_file_name( fillout_pdf_tool ); + + set_invocation_path( modify_pdf_tool ); + strcat( modify_pdf_tool, "universal_pdf_file_modifier" ); + quote_file_name( modify_pdf_tool ); +} + + +void cancelprintpopup( GtkWidget *wdg, void *data ) +{ gtk_widget_destroy( printpopup ); printpopup = 0; } + + +void togprntcmd_in( GtkWidget *wdg, void *data ) +{ + if (!printdialogsetup) return; + sprintf(printer_command,"%s \"%s\"", base_printer_command, current_working_filename ); + modify_formbox( printerformbox, printer_command ); + if (print_mode == 2) + { + modify_label( print_label, "Print Command" ); + gtk_button_set_label( GTK_BUTTON( print_button ), " Print It " ); + } + print_mode = 0; +} + + +void togprntcmd_out( GtkWidget *wdg, void *data ) +{ + if (!printdialogsetup) return; + predict_output_filename( current_working_filename, wrkingfname ); + sprintf(printer_command,"%s \"%s\"", base_printer_command, wrkingfname ); + modify_formbox( printerformbox, printer_command ); + if (print_mode == 2) + { + modify_label( print_label, "Print Command" ); + gtk_button_set_label( GTK_BUTTON( print_button ), " Print It " ); + } + print_mode = 1; +} + + +GtkWidget *status_win=0, *status_panel, *status_label; +struct + { int wd, ht, y_val, nfiles; + char *fnames[10]; + } statusw; +char *pdfviewer=0; + + +void dismiss_status_win( GtkWidget *wdg, void *data ) +{ + if (status_win != 0) + { gtk_widget_destroy( status_win ); status_win = 0; } +} + +int killed_status_win( GtkWidget *wdg, void *data ) +{ + status_win = 0; + return 0; /* Returning "0" causes window to be destroyed. */ +} + +void add_status_line( char *msg ) +{ + if (status_win == 0) return; + make_label( status_panel, 10, statusw.y_val, msg ); + statusw.y_val = statusw.y_val + 20; + UpdateCheck(); + show_wind( status_win ); + UpdateCheck(); +} + +void update_status_label( char *msg ) +{ + if (status_win == 0) return; + modify_label( status_label, msg ); + UpdateCheck(); +} + +void create_status_popup_window( int width, int height ) +{ + status_panel = make_scrolled_window_wkill( width, height, "Filling-out PDF Form(s) ...", &status_win, 1, 0, killed_status_win ); + status_label = make_label( status_panel, 1, 1, "Filling-out PDF Form(s):" ); + gtk_window_set_keep_above( (GtkWindow *)status_win, 1 ); + statusw.y_val = 28; + statusw.wd = width; statusw.ht = height; + show_wind( status_win ); +} + + +void get_cwd( char *pwd ) +{ + int j=0; + FILE *fp; + fp = popen( "echo %cd%", "rb" ); + if (fp != 0) + { + do pwd[j++] = getc( fp ); + while ((!feof(fp)) && (pwd[j-1] != '\n') && (pwd[j-1] != '\r')); + if (j > 0) j--; + pwd[j] = '\0'; + pclose(fp); + } + else + pwd[0] = '\0'; +} + + +void call_pdfviewer( char *pdfname ) +{ + char cmd[4096], tmppdfname[4096]; + strcpy( tmppdfname, pdfname ); + #if (PLATFORM_KIND==Posix_Platform) + quote_file_name( tmppdfname ); + #ifdef __APPLE__ + strcpy( cmd, "open -a "); + strcat( cmd, pdfviewer ); + #else + if (strcmp( pdfviewer, "default-pdf-viewer" ) == 0) + strcpy( cmd, "xdg-open" ); + else + strcpy( cmd, pdfviewer ); + #endif + strcat( cmd, " "); strcat( cmd, tmppdfname ); strcat( cmd, " &" ); + #else + strcpy( cmd, "start "); + if (strcmp( pdfviewer, "default-pdf-viewer" ) != 0) + { char pwd[4096]; + strcat( cmd, pdfviewer ); + strcat( cmd, " "); + if ((strstr( pdfviewer, "chrome") != 0) || (strstr( pdfviewer, "firefox") != 0)) + { /* Prepend 'file:///' + Path, to relative file name. */ + strcat( cmd, "\"file://" ); + get_cwd( pwd ); + strcat( cmd, pwd ); + strcat( cmd, "\\" ); + strcat( cmd, tmppdfname ); + strcat( cmd, "\"" ); + } + else + if ((strstr( pdfviewer, "iexplore" ) != 0) || (strstr( pdfviewer, "edge") != 0)) + { /* As above, but without quotes. */ + strcat( cmd, "file://" ); + get_cwd( pwd ); + strcat( cmd, pwd ); + strcat( cmd, "\\" ); + strcat( cmd, tmppdfname ); + } + else + strcat( cmd, tmppdfname ); + } + else + { /* Default PDF-Viewer. */ + strcat( cmd, " "); + quote_MS_file_name( tmppdfname ); + strcat( cmd, tmppdfname ); + } + #endif + printf("Issuing: %s\n", cmd ); + system( cmd ); +} + + +void consume_leading_trailing_whitespace( char *line ) +{ int j, k; + while (isspace( line[0] )) + { + j = 0; + do { line[j] = line[j+1]; j++; } + while (line[j-1] != '\0'); + } + k = strlen( line ) - 1; + while ((k >= 0) && (isspace( line[k] ))) + { + line[k] = '\0'; + k--; + } +} + + +char *check4tool( char *toolname ) +{ + char line[4096]="which "; + FILE *cmdresp; + strcat( line, toolname ); + cmdresp = popen( line, "r" ); + line[0] = '\0'; + if (cmdresp != 0) + { + fscanf( cmdresp, "%s", line ); + pclose( cmdresp ); + } + if (line[0] != '\0') + return strdup( line ); + else + return 0; +} + + + +void get_pdf_viewer() +{ + FILE *configfile; + char fname[4096], line[4096]; + + // printf("get_pdf_viewer:\n"); + pdfviewer = getenv( "PDF_VIEWER" ); /* First check if user has set PDF_Viewer environment variable. */ + if (pdfviewer != 0) return; + + if (verbose) printf(" Checking config file\n"); + set_invocation_path( toolpath ); /* Next check if user has set preferences in config-file. */ + strcpy( fname, toolpath ); + strcat( fname, "gui_settings.conf" ); + configfile = fopen( fname, "r" ); + if (configfile == 0) + printf("Did not find any 'gui_settings.conf' to read for optional settings.\n"); + else + { + /* Expect config file to have options like: PDF_VIEWER: acroread */ + fgets( line, 2048, configfile ); + while (!feof(configfile)) + { + consume_leading_trailing_whitespace( line ); + if ((line[0] != '#') && (line[0] != '\0')) + { + if (strncmp( line, "PDF_VIEWER:", 11 ) == 0) + { + pdfviewer = strdup( &(line[12]) ); + consume_leading_trailing_whitespace( pdfviewer ); + if (verbose) printf("Setting pdfviewer = '%s'\n", pdfviewer ); + } + else + printf("Unknown config-file option '%s'\n", line ); + } + fgets( line, 2048, configfile ); + } + fclose( configfile ); + } + if (pdfviewer == 0) /* If the above fails, then set viewer to a default. */ + { + printf(" (Did not see preferred PDF_VIEWER in gui_settings.conf - Using default viewer.)\n"); + #if (PLATFORM_KIND==Posix_Platform) + /* --- The following are methods for opening PDF document(s) on Apple or Linux. --- */ + // pdfviewer = strdup( "xpdf" ); + // pdfviewer = strdup( "acroread" ); + // pdfviewer = strdup( "atril" ); + #ifdef __APPLE__ + { // struct stat buf; + // if (stat( "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", &buf ) == 0) + // pdfviewer = strdup( "\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\"" ); + // else + pdfviewer = strdup( "Preview" ); + // pdfviewer = strdup( "Safari" ); + } + #else + pdfviewer = check4tool( "atril" ); + #endif + if (pdfviewer == 0) + pdfviewer = check4tool( "google-chrome" ); + if (pdfviewer == 0) + pdfviewer = check4tool( "firefox" ); + if (pdfviewer == 0) + pdfviewer = check4tool( "evince" ); + if (pdfviewer == 0) + pdfviewer = check4tool( "xpdf" ); + if (pdfviewer == 0) + pdfviewer = check4tool( "libreoffice" ); + if (pdfviewer == 0) + pdfviewer = check4tool( "ooffice" ); + if (pdfviewer == 0) + pdfviewer = check4tool( "acroread" ); + if (pdfviewer == 0) + pdfviewer = strdup( "xdg-open" ); + #else + /* --- The following is(are) method(s) for opening PDF document(s) on Microsoft. --- */ + pdfviewer = strdup( "default-pdf-viewer" ); /* Calls default pdf viewer properly. */ + #endif + if (pdfviewer == 0) + { + printf("Could not find a PDF viewer on your system.\n"); + // pdfviewer = strdup( "google-chrome" ); + } + else + printf("Using PDF viewer: '%s'\n", pdfviewer ); + } +} + + + + +GtkWidget *spdfpopup=0; +GtkEntry *spdffrmbx; + + +void cancelspdfpopup( GtkWidget *wdg, void *data ) +{ gtk_widget_destroy( spdfpopup ); spdfpopup = 0; } + + +void accept_pdfviewer( GtkWidget *wdg, void *data ) +{ char *selection; + selection = get_formbox( spdffrmbx ); + if (pdfviewer != 0) free( pdfviewer ); + #ifdef __APPLE__ + if (strcmp(selection, "google-chrome" ) == 0) + pdfviewer = strdup( "\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\"" ); + else + if (strcmp(selection, "firefox" ) == 0) + pdfviewer = strdup( "\"/Applications/Firefox.app/Contents/MacOS/firefox\"" ); + else + #endif + pdfviewer = strdup( selection ); + printf("Accepted PDF-Viewer as '%s'\n", pdfviewer ); + cancelspdfpopup( 0, 0 ); +} + + +void saveconfig( GtkWidget *wdg, void *data ) +{ + FILE *configfile, *infile; + char fname[4096], bckfile[4096], line[4096]; + + accept_pdfviewer( 0, 0 ); + if (pdfviewer == 0) return; + printf("Saving config file ...\n"); + set_invocation_path( toolpath ); + strcpy( fname, toolpath ); + strcat( fname, "gui_settings.conf" ); + + /* First make a backup config-file. */ + infile = fopen( fname, "r" ); + if (infile == 0) + printf("Did not find any 'gui_settings.conf' to read for optional settings.\n"); + else + { + strcpy( bckfile, toolpath ); + strcat( bckfile, "gui_settings.bak" ); + configfile = fopen( bckfile, "w" ); + if (configfile == 0) + printf("Could not open 'gui_settings.bak' for writing.\n"); + else + { + fgets( line, 2048, infile ); + while (!feof(infile)) + { + fprintf(configfile,"%s", line ); + fgets( line, 2048, infile ); + } + fclose( configfile ); + } + fclose( infile ); + } + + configfile = fopen( fname, "w" ); + if (configfile == 0) + printf("Could not open 'gui_settings.conf' for writing.\n"); + else + { + fprintf( configfile, "PDF_VIEWER: %s\n", pdfviewer ); + fclose( configfile ); + } +} + + + +void catch_pdfviewer_selection( GtkWidget *wdg, void *data ) +{ + char *text; + text = get_selection_from_list( wdg ); + if (strlen( text ) > 0) + modify_formbox( spdffrmbx, text ); +} + + +void set_pdfviewer( GtkWidget *wdg, void *data ) +{ + int wd=400, ht=300; + GtkWidget *panel; + + window_position_policy = GTK_WIN_POS_NONE; + panel = make_window( wd, ht, "Select Your PDF-Viewer", &spdfpopup ); + place_window_center(); + make_sized_label( panel, 15, 15, "Pick and Set PDF Viewer to Use:", 12 ); + { GtkTreeStore *spdfvlist; GtkTreeIter iter; + spdfvlist = make_selection_list( panel, 40, 40, 333, 119, "Some popular viewers ...", catch_pdfviewer_selection, 0, 0 ); + append_selection_list( spdfvlist, &iter, "" ); + #if (PLATFORM_KIND==Posix_Platform) + /* --- For Apple's and Linux --- */ + #ifdef __APPLE__ + append_selection_list( spdfvlist, &iter, "Google Chrome" ); + append_selection_list( spdfvlist, &iter, "Preview" ); + append_selection_list( spdfvlist, &iter, "Safari" ); + #else + append_selection_list( spdfvlist, &iter, "default-pdf-viewer" ); + append_selection_list( spdfvlist, &iter, "google-chrome" ); + #endif + append_selection_list( spdfvlist, &iter, "firefox" ); + append_selection_list( spdfvlist, &iter, "atril" ); + append_selection_list( spdfvlist, &iter, "xpdf" ); + append_selection_list( spdfvlist, &iter, "evince" ); + append_selection_list( spdfvlist, &iter, "libreoffice" ); + append_selection_list( spdfvlist, &iter, "ooffice" ); + #ifdef __APPLE__ + #endif + append_selection_list( spdfvlist, &iter, "acroread" ); + #else + /* --- For Microsoft --- */ + append_selection_list( spdfvlist, &iter, "default-pdf-viewer" ); + append_selection_list( spdfvlist, &iter, "chrome" ); + append_selection_list( spdfvlist, &iter, "firefox" ); + // append_selection_list( spdfvlist, &iter, "microsoft-edge:" ); /* Edge can't open local files. :-( */ + append_selection_list( spdfvlist, &iter, "iexplore" ); + append_selection_list( spdfvlist, &iter, "evince" ); + append_selection_list( spdfvlist, &iter, "xpdf" ); + append_selection_list( spdfvlist, &iter, "libreoffice" ); + append_selection_list( spdfvlist, &iter, "acroread" ); + #endif + } + make_label( panel, 20, 185, "PDF Viewer Executable:" ); + if (pdfviewer == 0) + get_pdf_viewer(); + if (pdfviewer == 0) + spdffrmbx = make_formbox( panel, 35, 200, 42, "", 500, accept_pdfviewer, 0 ); + else + spdffrmbx = make_formbox( panel, 35, 200, 42, pdfviewer, 500, accept_pdfviewer, 0 ); + + make_button( panel, 30, 260, " OK ", accept_pdfviewer, 0 ); + make_button( panel, 180, 260, "Save", saveconfig, 0 ); + make_button( panel, 320, 260, "Cancel", cancelspdfpopup, 0 ); + // gtk_window_activate_focus( GTK_WINDOW( spdfpopup ) ); + // gtk_window_set_transient_for( GTK_WINDOW( spdfpopup ), GTK_WINDOW( status_win ) ); + // gtk_window_set_transient_for( GTK_WINDOW( spdfpopup ), GTK_WINDOW( outer_window ) ); + // gtk_window_set_keep_above( GTK_WINDOW( spdfpopup ), 1 ); + show_wind( spdfpopup ); +} + + +void callup_pdfviewer( GtkWidget *wdg, void *data ) +{ + int k=0; + dismiss_status_win( 0, 0 ); + UpdateCheck(); + printf("\n"); + if (pdfviewer == 0) + { + get_pdf_viewer(); + } + if (pdfviewer == 0) + { + GeneralWarning( "Could not find a PDF viewer on your system.\n"); + return; + } + while (k < statusw.nfiles) + call_pdfviewer( statusw.fnames[k++] ); +} + + +void add_view_pdf_button() +{ + make_button( status_panel, 30, statusw.ht - 50, "(Set PDF Viewer)", set_pdfviewer, 0 ); + make_button( status_panel, statusw.wd/2 - 90, statusw.ht - 50, " Open in PDF Viewer ", callup_pdfviewer, 0 ); + make_button( status_panel, statusw.wd - 90, statusw.ht - 50, "Close", dismiss_status_win, &status_win ); + show_wind( status_win ); +} + + + +void togprntcmd_pdf( GtkWidget *wdg, void *data ) +{ + if (!printdialogsetup) return; + predict_output_filename( current_working_filename, wrkingfname ); + modify_formbox( printerformbox, wrkingfname ); + if (print_mode != 2) + { + modify_label( print_label, "File:" ); + gtk_button_set_label( GTK_BUTTON( print_button ), " OK " ); + } + print_mode = 2; +} + + +int schedule_PDF_conversion=0, pdf_conversion_step; + +void acceptprinter_command( GtkWidget *wdg, void *data ) +{ + if ((print_mode > 0) && (compute_needed)) + { + cancelprintpopup( 0, 0 ); + GeneralWarning( "Change(s) not Re-Computed. You should Compute-Tax before printing results." ); + return; + } + if (print_mode < 2) + { + get_formbox_text( printerformbox, printer_command, MaxFname ); + printf("Issuing: %s\n", printer_command); + system( printer_command ); + cancelprintpopup( 0, 0 ); + } + else + { /*Fill-out_PDF*/ + cancelprintpopup( 0, 0 ); + pdf_conversion_step = 1; + schedule_PDF_conversion = 1; + create_status_popup_window( 800, 125 ); + } +} + + +void setpdfoutputname( char *origname, char *suffix, char *newname ) +{ + int j; + strcpy( newname, origname ); + j = strlen( newname ) - 1; + while ((j >= 0) && (newname[j] != '.')) j--; + if (j >= 0) + newname[j] = '\0'; + strcat( newname, suffix ); +} + + +void prepare_universal_pdf_cmd( char *options, char *metadata, char *wrkingfname, char *markedpdf, char *outputname ) +{ char *tmpmetadata, *tmpwrkingfname, *tmpmarkedpdf, *tmpout; + + if (metadata==0) + { printf("Error in prepare_universal_pdf_cmd: metadata is null.\n"); return; } + if (wrkingfname==0) + { printf("Error in prepare_universal_pdf_cmd: wrkingfname is null.\n"); return; } + if (markedpdf==0) + { printf("Error in prepare_universal_pdf_cmd: markedpdf is null.\n"); return; } + if (outputname==0) + { printf("Error in prepare_universal_pdf_cmd: outputname is null.\n"); return; } + + tmpmetadata = (char *)malloc(4096); + tmpwrkingfname = (char *)malloc(4096); + tmpmarkedpdf = (char *)malloc(4096); + tmpout = (char *)malloc(4096); + + strcpy( fillout_pdf_command, modify_pdf_tool ); + strcat( fillout_pdf_command, " " ); + strcat( fillout_pdf_command, options ); + strcat( fillout_pdf_command, " " ); + strcpy( tmpmetadata, ots_path ); + strcat( tmpmetadata, "src" ); strcat( tmpmetadata, slashstr ); + strcat( tmpmetadata, "formdata" ); strcat( tmpmetadata, slashstr ); + strcat( tmpmetadata, metadata ); + quote_file_name( tmpmetadata ); + strcpy( tmpwrkingfname, wrkingfname ); + quote_file_name( tmpwrkingfname ); + strcpy( tmpmarkedpdf, ots_path ); + strcat( tmpmarkedpdf, "src" ); strcat( tmpmarkedpdf, slashstr ); + strcat( tmpmarkedpdf, "formdata" ); strcat( tmpmarkedpdf, slashstr ); + strcat( tmpmarkedpdf, markedpdf ); + quote_file_name( tmpmarkedpdf ); + strcat( fillout_pdf_command, tmpmetadata ); + strcat( fillout_pdf_command, " " ); + strcat( fillout_pdf_command, tmpwrkingfname ); + strcat( fillout_pdf_command, " " ); + strcat( fillout_pdf_command, tmpmarkedpdf ); + if (strlen(outputname) > 0) + { + strcat( fillout_pdf_command, " -o " ); + strcpy( tmpout, outputname ); + quote_file_name( tmpout ); + strcat( fillout_pdf_command, tmpout ); + } + free( tmpmetadata ); + free( tmpwrkingfname ); + free( tmpmarkedpdf ); + free( tmpout ); +} + + +#ifndef MY_TMPNAM_DEFINED +#define MY_TMPNAM_DEFINED 1 +char *my_tmp_dir=0, *my_tmp_suffix=".bat"; + +int my_tmpnam( char *fname ) /* Get a temporary file name for writing. Return 1 on success, 0 on failure. */ +{ + int k=0; + struct stat buf; + + if (my_tmp_dir == 0) + { + #ifdef __MINGW32__ + char *sptr; int j; + sptr = getenv( "TEMP" ); + if ((sptr == 0) || (sptr[0] == '\0')) + my_tmp_dir = strdup(""); + else + { + my_tmp_dir = (char *)malloc( strlen( sptr ) + 2 ); + strcpy( my_tmp_dir, sptr ); + j = strlen( my_tmp_dir ); + if ((my_tmp_dir[j-1] != '/') && (my_tmp_dir[j-1] != '\\')) + strcat( my_tmp_dir, "\\" ); + } + #else + my_tmp_dir = strdup( "/tmp/" ); + #endif + } + do + { char cnt[20]; + strcpy( fname, my_tmp_dir ); + strcat( fname, "tmpfile" ); + sprintf(cnt,"%d", k++ ); + strcat( fname, cnt ); + if (my_tmp_suffix == 0) + strcat( fname, ".dat" ); + else + strcat( fname, my_tmp_suffix ); + } + while ((stat( fname, &buf ) == 0) && (k < 10000)); + if (k == 10000) return 0; + else return 1; +} +#endif + + + +void execute_cmd( char *cmd ) +{ + #if (PLATFORM_KIND==Posix_Platform) + system( fillout_pdf_command ); + #else + char tmpfname[1024]; + FILE *T; /* Due to limitation of microsoft, we must use a temp-cmd file on MSwin. */ + my_tmpnam( tmpfname ); + T = fopen(tmpfname,"w"); + fprintf(T,"%s\n", fillout_pdf_command ); + fclose(T); + system( tmpfname ); + remove( tmpfname ); + // system( "erase tmpcmd.bat" ); /* remove does not work for some reason. */ + #endif +} + + + +typedef struct FORM_PDF_CONVERT_T +{ + int sel_form; + char *other_form_name; + char *form_meta_data_name; + char *form_pdf_name; +} FORM_PDF_CONVERT, *P_FORM_PDF_CONVERT; + +FORM_PDF_CONVERT form_pdfs[] = + { /* Top-tier forms: */ + { form_US_1040, "", "f1040_meta.dat", "f1040_pdf.dat" }, + { form_US_1040_Sched_C, "", "f1040sc_meta.dat", "f1040sc_pdf.dat" }, + { form_PA_40, "", "PA_40_meta.dat", "PA_40_pdf.dat" }, + { form_CA_540, "", "CA_540_meta.dat", "CA_540_pdf.dat" }, + { form_OH_IT1040, "", "OH_PIT_IT1040_meta.dat", "OH_PIT_IT1040_pdf.dat" }, + { form_VA_760, "", "VA_760_meta.dat", "VA_760_pdf.dat" }, + { form_NJ_1040, "", "NJ_1040_meta.dat", "NJ_1040_pdf.dat" }, + { form_NY_IT201, "", "NY_it201_meta.dat", "NY_it201_pdf.dat" }, + { form_MA_1, "", "MA_1_meta.dat", "MA_1_pdf.dat" }, + { form_NC_D400, "", "NC_meta.dat", "NC_pdf.dat" }, + { form_1040e, "", "f1040e_meta.dat", "f1040e_pdf.dat" }, + { form_4562, "", "f4562_meta.dat", "f4562_pdf.dat" }, + { form_8582, "", "f8582_meta.dat", "f8582_pdf.dat" }, + { form_AZ_140, "", "AZ_140_meta.dat", "AZ_140_pdf.dat" }, + { form_MI_1040, "", "MI_1040_meta.dat", "MI_1040_pdf.dat" }, + { form_OR_40, "taxsolve_OR_40", "OR_40_meta.dat", "OR_40_pdf.dat" }, + /* Other added forms: */ + { form_other, "taxsolve_HSA_f8889", "f8889_meta.dat", "f8889_pdf.dat" }, + { form_other, "taxsolve_f8606", "f8606_meta.dat", "f8606_pdf.dat" }, + { form_other, "taxsolve_US_1040_Sched_SE", "f1040sse_meta.dat", "f1040sse_pdf.dat" }, + { form_other, "taxsolve_f8829", "f8829_meta.dat", "f8829_pdf.dat" }, + { form_other, "taxsolve_f8995", "f8995_meta.dat", "f8995_pdf.dat" }, + { form_other, "taxsolve_f8959", "f8959_meta.dat", "f8959_pdf.dat" }, + { form_other, "taxsolve_f8960", "f8960_meta.dat", "f8960_pdf.dat" }, + { form_other, "taxsolve_f2210", "f2210_meta.dat", "f2210_pdf.dat" }, + { form_other, "taxsolve_f8812", "f8812_meta.dat", "f8812_pdf.dat" }, + { form_other, "taxsolve_CA_5805", "CA_5805_meta.dat", "CA_5805_pdf.dat" } + }; + + +void do_pdf_conversion() +{ + char outputname[4096], updf_options[1024]=""; + int f; + schedule_PDF_conversion = 0; + predict_output_filename( current_working_filename, wrkingfname ); + + // Found form_pdfs struct; NULL if no matching entry found + P_FORM_PDF_CONVERT ppdf = NULL; + + if (strlen(fillout_pdf_tool) < 1) set_pdf_tool_path(); + // Search through table for matching form type + for (f = 0; f < sizeof(form_pdfs)/sizeof(FORM_PDF_CONVERT); ++f) + { + // Pointer to the current FORM_PDF_CONVERT struct for search + P_FORM_PDF_CONVERT psp = &form_pdfs[f]; + + // Check for matching main form type (not 'form_other') + if ((psp->sel_form != form_other) && (psp->sel_form == selected_form)) + { + ppdf = psp; + break; + } + // Check for 'form_other', and matching name + if ((psp->sel_form == form_other) && (strstr( taxsolvestrng, psp->other_form_name ) != 0)) + { + ppdf = psp; + printf("%s: Found form_pdf: %d, %s\n", taxsolvestrng, ppdf->sel_form, ppdf->other_form_name ); + break; + } + } + + if (ppdf == NULL) + { + printf("Form type not supported.\n"); + make_button( status_panel, 30, statusw.ht - 50, " Ok ", dismiss_status_win, &status_win ); + return; + } + printf("Found form_pdf: %d, %s\n", ppdf->sel_form, ppdf->other_form_name); + // Found a matching entry, since ppdf is not NULL + statusw.nfiles = 0; + setpdfoutputname( wrkingfname, ".pdf", outputname ); + + if (rptwd_txline) + { + round_pdf_to_whole_dollars = interpret_boolean( rptwd_txline->text ); + // printf("INTERPRETTED '%s' as %d\n", rptwd_txline->text, round_pdf_to_whole_dollars ); + } + if (round_pdf_to_whole_dollars) + strcpy( updf_options, "-round_to_whole_numbers" ); + + prepare_universal_pdf_cmd( updf_options, ppdf->form_meta_data_name, wrkingfname, ppdf->form_pdf_name, outputname ); + printf("Issuing: %s\n", fillout_pdf_command ); + add_status_line( outputname ); + execute_cmd( fillout_pdf_command ); + update_status_label( "Completed Filling-out PDF Form:" ); + statusw.fnames[ statusw.nfiles ] = strdup( outputname ); statusw.nfiles = statusw.nfiles + 1; + add_view_pdf_button(); +} + + + +void print_outfile_directly( GtkWidget *wdg, void *data ) +{ + // predict_output_filename( current_working_filename, wrkingfname ); + // sprintf(printer_command,"%s \"%s\"", base_printer_command, wrkingfname ); + // printf("Issuing: %s\n", printer_command); + // system( printer_command ); + printout( wdg, data ); +} + +void create_pdf_file_directly( GtkWidget *wdg, void *data ) +{ + predict_output_filename( current_working_filename, wrkingfname ); + pdf_conversion_step = 1; + schedule_PDF_conversion = 1; + create_status_popup_window( 800, 125 ); +} + + +void printout( GtkWidget *wdg, void *data ) +{ + GtkWidget *rad, *panel; + int x1=70, x2, y1=30, dy=20, wd=750, ht=190, printht; + + Update_box_info(); + if (save_needed) + { + if (!computed) + GeneralWarning( "Change(s) not saved. You should Save input file before printing it." ); + else + GeneralWarning( "Change(s) not saved. You should Save + Re-Compute before printing." ); + return; + } + dismiss_status_win( 0, 0 ); + print_mode = 0; + panel = make_window( wd, ht, "Print Return Data", &printpopup ); + make_sized_label( panel, 1, 1, "Print Return Data:", 12 ); + rad = make_radio_button( panel, 0, x1, y1, "Print Input Data", togprntcmd_in, 0 ); + + if (supported_pdf_form) + { + make_radio_button( panel, rad, x1 + 170, y1, "Automatically Fill-out PDF Tax-Form", togprntcmd_pdf, 0 ); + x2 = x1 + 460; + } + else x2 = x1 + 160; + + y1 = y1 + dy; + rad = make_radio_button( panel, rad, x1, y1, "Print Output Data", togprntcmd_out, 0 ); + make_rectangular_separator( panel, x1 - 10, y1 - dy - 10, x2, y1 + dy ); + y1 = y1 + dy + 15; + print_label = make_label( panel, 10, y1 + 4, "Print Command:" ); + y1 = y1 + dy; + printdialogsetup = 0; + strcpy( printer_command, base_printer_command ); + strcat( printer_command, " " ); + if (computed) + { + set_radio_button( rad ); + predict_output_filename( current_working_filename, wrkingfname ); + strcat( printer_command, wrkingfname ); + print_mode = 1; + } + else + strcat( printer_command, current_working_filename ); + x1 = 20; + printerformbox = make_formbox_bypix( panel, x1, y1, wd - x1 - 10, printer_command, MaxFname, acceptprinter_command, 0 ); + printht = ht - 35; + print_button = make_button( panel, 50, printht, " Print It ", acceptprinter_command, 0 ); + make_button( panel, wd - 95, printht, "Cancel", cancelprintpopup, 0 ); + show_wind( printpopup ); + printdialogsetup = 1; +} + + + + +void slcttxprog( GtkWidget *wdg, void *data ) +{ /* Come here when user selects one of the opening-screen radio-buttons. */ + char *sel=(char *)data; + char strg[MaxFname], tmpstr[MaxFname]; + int k, prev; + + if (!ok_slcttxprog) return; + prev = selected_form; + if (sscanf(sel,"%d", &selected_form) != 1) printf("Internal error '%s'\n", sel ); + if (verbose) printf("\n Selected form = %d. (prev=%d)\n", selected_form, prev ); + if (selected_form == prev) return; + strcpy( strg, program_names[selected_form] ); + if (verbose) printf(" Form Name = '%s'\n", strg ); + if (strcmp(strg,"Other")==0) + { + selected_other = 1; + supported_pdf_form = 0; + other_form_selected = 0; + if (verbose) printf("invocation_path = '%s'\n", invocation_path ); + set_invocation_path( toolpath ); + fb_clear_banned_files(); + fb_ban_files( ".txt" ); + fb_ban_files( ".pdf" ); + fb_ban_files( ".dll" ); + fb_ban_files( ".dylib" ); + fb_ban_files( "convert_results2xfdf" ); + fb_ban_files( "notify_popup" ); + fb_ban_files( "ots_gui" ); + fb_ban_files( "universal_pdf_file_modifier" ); + + fb_ban_files( "taxsolve_CA_540" ); + fb_ban_files( "taxsolve_MA_1" ); + fb_ban_files( "taxsolve_NC_D400" ); + fb_ban_files( "taxsolve_NJ_1040" ); + fb_ban_files( "taxsolve_NY_IT201" ); + fb_ban_files( "taxsolve_OH_IT1040" ); + fb_ban_files( "taxsolve_PA_40_" ); + fb_ban_files( "taxsolve_US_1040_2024"); + fb_ban_files( "taxsolve_US_1040_Sched_C_" ); + fb_ban_files( "taxsolve_VA_760_" ); + fb_ban_files( "taxsolve_AZ_140_" ); + fb_ban_files( "taxsolve_MI_1040_" ); + + strcpy( wildcards_fb, "" ); + strcpy( filename_fb, "" ); + // printf("OTS_taxsolve: dir='%s', wc='%s', fname='%s'\n", toolpath, wildcards_fb, filename_fb ); + Browse_Files( "Select Tax Program to Use:", 2048, toolpath, wildcards_fb, filename_fb, set_tax_solver ); + + strcpy(tmpstr, invocation_path); + k = strlen(tmpstr)-1; + while ((k > 0) && (tmpstr[k] != slashchr)) k--; + if (k > 0) k--; + while ((k > 0) && (tmpstr[k] != slashchr)) k--; + if (tmpstr[k] == slashchr) tmpstr[k+1] = '\0'; + else {sprintf(tmpstr,".%c", slashchr);} + sprintf(directory_dat, "%stax_form_files%c", tmpstr, slashchr); + + return; + } + else + { + selected_other = 0; + supported_pdf_form = 1; + + sprintf(tmpstr,"%s%s", invocation_path, strg); + printf("Setting Tax Program to be: '%s'\n", tmpstr); + taxsolvecmd = strdup(tmpstr); + strcpy(taxsolvestrng, tmpstr); + + strcpy(tmpstr, invocation_path); + k = strlen(tmpstr)-1; + while ((k > 0) && (tmpstr[k] != slashchr)) k--; + if (k > 0) k--; + while ((k > 0) && (tmpstr[k] != slashchr)) k--; + if (tmpstr[k] == slashchr) tmpstr[k+1] = '\0'; + else {sprintf(tmpstr,".%c", slashchr);} + sprintf(directory_dat, "%stax_form_files%c", tmpstr, slashchr); + + sel = strstr( strg, "_2024" ); + if (sel != 0) + sel[0] = '\0'; + strcpy( tmpstr, strg ); + if (strlen(tmpstr) < 10) {printf("Internal error, name too short '%s'\n", tmpstr); return;} + strcpy( strg, &(tmpstr[9]) ); /* Remove the prefix "taxsolve_". */ + strcat( directory_dat, strg ); + printf("Setting Tax Data Directory to be: '%s'\n", directory_dat); + } +} + + + +#include "logo_image.c" /* <--- The image-data is included here, produced by "data2code". */ + + +void quit( GtkWidget *wdg, void *x ) +{ + printf("OTS Exiting.\n"); + exit(0); +} + + +void warn_about_save_needed() +{ + int xpos=20, ypos=20, winwdth, winhght=100; + GtkWidget *winframe, *label; + winwdth = 300; + winframe = make_window( winwdth, winhght, "Warning Message", &warnwin ); + label = make_sized_label( winframe, xpos, ypos, "Change(s) not saved !!", 12 ); + set_widget_color( label, "#ff0000" ); + make_button( winframe, 10, winhght - 40, "Exit anyway, without saving", quit, &warnwin ); + make_button( winframe, winwdth - 60, winhght - 40, "Cancel", dismiss_general_warning, &warnwin ); + gtk_window_set_keep_above( (GtkWindow *)warnwin, 1 ); + show_wind( warnwin ); +} + + +void quit_wcheck( GtkWidget *wdg, void *x ) +{ + Update_box_info(); + if (save_needed) + { + warn_about_save_needed(); + return; + } + quit( 0, 0 ); +} + + + +static gboolean on_expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer data ) +{ + unsigned char *logodata; + int imgwd, imght, x1, y1, x2, y2, new_width, new_height; + + if (operating_mode == 1) + { /*mode1*/ + logodata = cdti_convert_data_to_image( data_0, data_0_size, &imgwd, &imght ); + x1 = (winwidth - imgwd) / 2; + y1 = 10; + x2 = x1 + imgwd; + y2 = y1 + imght; + place_image( mpanel, imgwd, imght, x1, y1, logodata ); + free( logodata ); + // make_rectangular_separator( mpanel, x1 - 2, y1 - 2, x2 - 2, y2 + 2 ); + { /* Place a border around the logo image. */ + cairo_t *canvas=0; + canvas = gdk_cairo_create( mpanel->window ); + cairo_set_line_width( canvas, 2.0 ); + cairo_set_source_rgb( canvas, 0.1, 0.1, 0.2 ); + x1 = x1 - 2; y1 = y1 - 2; + x2 = x2 + 2; y2 = y2 + 2; + cairo_move_to( canvas, x1, y1 ); + cairo_line_to( canvas, x2, y1 ); + cairo_line_to( canvas, x2, y2 ); + cairo_line_to( canvas, x1, y2 ); + cairo_line_to( canvas, x1, y1 ); + cairo_stroke( canvas ); + x1 = 20; x2 = winwidth - 20; + y1 = fronty1 - 5; y2 = fronty2; + cairo_set_line_width( canvas, 1.0 ); + cairo_set_source_rgb( canvas, 0.1, 0.1, 0.5 ); + cairo_move_to( canvas, x1, y1 ); + cairo_line_to( canvas, x2, y1 ); + cairo_line_to( canvas, x2, y2 ); + cairo_line_to( canvas, x1, y2 ); + cairo_line_to( canvas, x1, y1 ); + cairo_stroke( canvas ); + cairo_destroy(canvas); + } + } /*mode1*/ + else + { /*mode2*/ + gtk_window_get_size( GTK_WINDOW( outer_window ), &new_width, &new_height ); + if ((new_width != winwidth) || (new_height != winht)) + { + winwidth = new_width; + winht = new_height; + need_to_resize = 1; + last_resize_time = Report_Time(); + } + } /*mode2*/ + return FALSE; +} + + + +int myfilterfunc( char *word ) +{ + if (my_strcasestr( word, ".txt") != 0) + { + if (my_strcasestr( word, "_out.txt" ) != 0) return 0; + if (my_strcasestr( word, "README_" ) != 0) return 0; + return 1; + } + else return 0; +} + + +//gboolean filterfunc( const GtkFileFilterInfo *finfo, gpointer data ) +//{ + // printf("Got '%s'\n", finfo->filename ); +// return myfilterfunc( finfo->filename ); +//} + + +void receive_filename( char *fname ) +{ + // printf("OTS_pick_file RET: f='%s', dir='%s', wc='%s', fname='%s'\n", fname, directory_dat, wildcards_fb, filename_fb ); + if (yourfilename != 0) free( yourfilename ); + yourfilename = strdup( fname ); + printf("You picked '%s'\n", yourfilename ); + if (myfilterfunc( yourfilename ) == 0) + { + warn_release = 1; + GeneralWarning("File name does not look like a tax input file."); + } + else + { + open_taxfile( yourfilename ); + } +} + + +void pick_file( GtkWidget *wdg, void *data ) +{ int j; + GtkFileFilter *rule; + + printf("Selected_Form = %d\n", selected_form ); + if ((selected_form == form_other) && (other_form_selected == 0)) + { + GeneralWarning("You must first select which Form to work on."); + return; + } + + rule = gtk_file_filter_new(); + gtk_file_filter_add_pattern( rule, "*.txt" ); + // gtk_file_filter_add_custom( rule, 15, filterfunc, 0, 0 ); + + // If workdir option is set, save the current directory_dat + // path to temp_dir, and then set it to the workdir path + if (strlen(workdir) > 0) + { + strcpy(temp_dir, directory_dat); + strcpy( directory_dat, workdir ); + } + + j = strlen( directory_dat ); + if ((j > 0) && (directory_dat[j-1] != slashchr)) + strcat( directory_dat, slashstr ); + if (verbose) printf("BrowsePath = '%s'\n", directory_dat ); + fb_clear_banned_files(); + fb_ban_files( "_out.txt" ); + fb_ban_files( "_template.txt" ); + fb_ban_files( "README" ); + strcpy( wildcards_fb, ".txt" ); + strcpy( filename_fb, "" ); + // printf("OTS_pick_file: dir='%s', wc='%s', fname='%s'\n", directory_dat, wildcards_fb, filename_fb ); + Browse_Files( "Select File", 2048, directory_dat, wildcards_fb, filename_fb, receive_filename ); + + // If modified, restore directory_dat path from temp_dir, so that templates + // are found properly during the call to pick_template. + if (strlen(workdir) > 0) + strcpy( directory_dat, temp_dir ); +} + + +void pick_template( GtkWidget *wdg, void *data ) +{ int j; + GtkFileFilter *rule; + DIR *dirpt; + struct dirent *dir_entry; + int match=0; + char *templatefile="", *fileanswer; + + printf("Selected_Form = %d\n", selected_form ); + if ((selected_form == form_other) && (other_form_selected == 0)) + { + GeneralWarning("You must first select which Form to work on."); + return; + } + rule = gtk_file_filter_new(); + gtk_file_filter_add_pattern( rule, "*.txt" ); + // gtk_file_filter_add_custom( rule, 15, filterfunc, 0, 0 ); + + j = strlen( directory_dat ); + if ((j > 0) && (directory_dat[j-1] != slashchr)) + strcat( directory_dat, slashstr ); + if (verbose) printf("BrowsePath = '%s'\n", directory_dat ); + fb_clear_banned_files(); + fb_ban_files( "_out.txt" ); + fb_ban_files( "README" ); + strcpy( wildcards_fb, "_template.txt" ); + strcpy( filename_fb, "" ); + // printf("OTS_pick_template: dir='%s', wc='%s', fname='%s'\n", directory_dat, wildcards_fb, filename_fb ); + + /* Expect only a single file in the named directory to match. */ + /* If so, then call "receive_filename" on that file. Otherwise drop through to the File-Browser. */ + dirpt = opendir( directory_dat ); + if (dirpt != 0) + { + dir_entry = readdir(dirpt); + while (dir_entry != 0) + { + if (strstr( dir_entry->d_name, "_template.txt" ) != 0) + { + match++; + templatefile = strdup( dir_entry->d_name ); + } + dir_entry = readdir(dirpt); + } + closedir( dirpt ); + if (match == 1) + { + printf(" Dir = '%s', File = '%s'\n", directory_dat, templatefile ); + fileanswer = (char *)malloc( strlen( directory_dat ) + strlen( templatefile ) + 100 ); + strcpy( fileanswer, directory_dat ); + strcat( fileanswer, "/" ); + strcat( fileanswer, templatefile ); + fb_reduce_pathname( fileanswer ); + printf("Directly opening: '%s'\n", fileanswer ); + receive_filename( fileanswer ); + return; + } + } + + Browse_Files( "Select File", 2048, directory_dat, wildcards_fb, filename_fb, receive_filename ); +} + + +void set_ots_path() +{ /* Expect invocation path to end with "bin" or "msbin", and remove that part. */ + int j; + ots_path = strdup( invocation_path ); + j = strlen( ots_path ) - 1; + while ((j >= 0) && (strstr( &(ots_path[j]), "bin" ) != &(ots_path[j]))) j--; + if (j < 0) { ots_path = strdup( "./" ); ots_path[1] = slashchr; } + else + if ((j > 1) && (ots_path[j-1] == 's')) ots_path[j-2] = '\0'; + else ots_path[j] = '\0'; +} + + +void helpabout1( GtkWidget *wdg, void *data ) +{ + char msg[4096]; + sprintf( msg, "OpenTaxSolver (OTS) GUI - Version %1.2f, %s\n", version, package_date ); + strcat( msg, " For the 2024 Tax Year. OTS release "); + strcat( msg, ots_release_package ); strcat( msg, "\n\n" ); + strcat( msg, "Use this GUI to open tax-forms and calculate taxes.\n"); + strcat( msg, " 1. First select a tax-form to do from the available programs listed.\n" ); + strcat( msg, " 2. Then to start a new blank return click 'Start New Return'.\n"); + strcat( msg, " Or to open a file you previously saved, or a working example,\n"); + strcat( msg, " click 'Open Saved Form' button, select your file or example,\n" ); + strcat( msg, " and click 'Ok'\n"); + strcat( msg, " 3. Fill out the form that pops up.\n"); + strcat( msg, " (Click the label on any line to see tax-instructions, if provided.)\n" ); + strcat( msg, " 4. Save your filled-out form to a name of your choice.\n"); + strcat( msg, " 5. Click 'Compute Tax' to see your results.\n"); + strcat( msg, " 6. Click 'Print' to fill-out or print-out your forms.\n\n"); + strcat( msg, "For help, additional information, and updates:\n" ); + strcat( msg, " Surf to: https://opentaxsolver.sourceforge.net/\n" ); + GeneralPopup( "OTS Information", msg, 1 ); +} + + +void helpabout2( GtkWidget *wdg, void *data ) +{ + char msg[4096]; + sprintf( msg, "OpenTaxSolver (OTS) GUI - Version %1.2f, %s\n", version, package_date ); + strcat( msg, " For the 2024 Tax Year. OTS release "); + strcat( msg, ots_release_package ); strcat( msg, "\n\n" ); + strcat( msg, "Use this GUI to fill-out tax forms and calculate taxes.\n"); + strcat( msg, " 1. Fill-out the line entries that apply to you.\n"); + strcat( msg, " (Click the label on any line to see tax-instructions, if provided.)\n" ); + strcat( msg, " 2. Save your filled-out form by clicking 'Save' button.\n"); + strcat( msg, " (If you started a new form ('_template'), then save your\n"); + strcat( msg, " version with a unique name that is meaningful to you.)\n"); + strcat( msg, " 3. Click 'Compute Tax' to see results.\n"); + strcat( msg, " 4. Click 'Print' to print-out the results or to automatically\n"); + strcat( msg, " fill-out the final forms.\n\n"); + strcat( msg, "For help, additional information, and updates:\n" ); + strcat( msg, " Surf to: https://opentaxsolver.sourceforge.net/\n" ); + GeneralPopup( "OTS Information", msg, 1 ); +} + + + +/*----------------------------------------------------------------------------*/ +/* Main - */ +/*----------------------------------------------------------------------------*/ + +int main(int argc, char *argv[] ) +{ + int argn, k, grayed_out=0, setwinsz=0; + char vrsnmssg[256], ots_pkg_mssg[256], tmpstr[MaxFname], *formid; + float x, y, dy, y1, y2; + GtkWidget *txprogstog, *button, *tmpwdg; + + sprintf(ots_pkg_mssg, "OTS Release %s", ots_release_package ); printf("%s\n\n", ots_pkg_mssg ); + sprintf(vrsnmssg, "GUI v%1.2f", version ); printf("%s\n", vrsnmssg ); + start_cmd = strdup(argv[0]); + invocation_path = strdup(argv[0]); + k = strlen(invocation_path)-1; + while ((k>0) && (invocation_path[k]!=slashchr)) k--; + if (invocation_path[k]==slashchr) k++; + invocation_path[k] = '\0'; + // printf("Invocation path = '%s'\n", invocation_path); + // printf("Start cmd: '%s'; invocation path = '%s'; slashchr = '%c'\n", start_cmd, invocation_path, slashchr); + set_ots_path(); + + /* Decode any command-line arguments. */ + argn = 1; k=1; + while (argn < argc) + { + if ((strcmp(argv[argn],"-verbose")==0) || (strcmp(argv[argn],"-v")==0)) + { + verbose = 1; + printf(" GUI Setting Verbose Mode = On.\n"); + } + else + if (strcmp(argv[argn],"-help")==0) + { + printf("OTS GUI v%1.2f, %s:\n", version, package_date ); + printf(" Command-line Options:\n"); + printf(" -verbose - Show debugging messages.\n"); + printf(" -winsz wd ht - Set the window size to wd x ht.\n"); + printf(" -debug - Set debug mode.\n"); + printf(" -taxsolver xx - Set path and name of the tax-solver executable.\n"); + printf(" -workdir yy - Set path for opening and saving data files.\n"); + printf(" {file-name}.txt - Set path and name of the tax data input file.\n\n"); + exit(0); + } + else + if (strcmp(argv[argn],"-taxsolver")==0) + { int kx; + argn++; + if (argn == argc) { printf("Missing entry after '-taxsolver'.\n"); exit(1); } + taxsolvecmd = strdup( argv[argn] ); + strcpy( taxsolvestrng, taxsolvecmd ); + selected_other = 1; + if (verbose) printf("invocation_path = '%s'\n", invocation_path ); + + strcpy(tmpstr, invocation_path); + kx = strlen(tmpstr)-1; + while ((kx > 0) && (tmpstr[kx] != slashchr)) kx--; + if (kx > 0) kx--; + while ((kx > 0) && (tmpstr[kx] != slashchr)) kx--; + if (tmpstr[kx] == slashchr) tmpstr[kx+1] = '\0'; + else {sprintf(tmpstr,".%c", slashchr);} + sprintf(directory_dat, "%stax_form_files%c", tmpstr, slashchr); + selected_form = form_other; + other_form_selected = 1; + ok_slcttxprog = 0; + } + else + if (strcmp(argv[argn],"-workdir")==0) + { + argn++; + if (argn == argc) { printf("Missing entry after '-workdir'.\n"); exit(1); } + strcpy(workdir, argv[argn]); + printf(" Setting WorkDir to be '%s'.\n", workdir ); + } + else + if (strcmp(argv[argn],"-winsz")==0) + { + argn++; + if (argn == argc) { printf("Missing entry after '%s'.\n", argv[argn-1] ); exit(1); } + if (sscanf(argv[argn],"%d",&winwidth) != 1) + { printf("Bad integer window-width after '%s'.\n", argv[argn-1] ); exit(1); } + argn++; + if (argn == argc) { printf("Missing entry after '%s'.\n", argv[argn-2] ); exit(1); } + if (sscanf(argv[argn],"%d",&winht) != 1) + { printf("Bad integer window-height after '%s'.\n", argv[argn-2] ); exit(1); } + printf(" Setting window size = %d x %d\n", winwidth, winht ); + setwinsz = 1; + } + else + if (strcmp( argv[argn], "-debug" ) == 0) + { + debug = 1; + #if (PLATFORM_KIND==Posix_Platform) + system( "pwd" ); + #else + system( "dir" ); + #endif + } + else + if (k==1) + { + current_working_filename = strdup(argv[argn]); + infile = fopen(current_working_filename,"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", argv[argn]); exit(1);} + k = 2; + ok_slcttxprog = 0; + } + else + { + printf("Unknown command-line parameter '%s'\n", argv[argn]); + /* exit(1); */ + } + argn = argn + 1; + } + + mpanel = init_top_outer_window( &argc, &argv, winwidth, winht, "OpenTaxSolver-GUI", 0, 0 ); + if (!setwinsz) + { /* Check for super-hi-res monitor screen. */ + int swd, sht; + GdkScreen *scrn; + scrn = gtk_window_get_screen( (GtkWindow *)outer_window ); + swd = gdk_screen_get_width( scrn ); + if (swd > 2500) + { /*Hi-DPI Screen*/ + sht = gdk_screen_get_height( scrn ); + printf("Screen size = %d x %d\n", swd, sht); + if (swd > 3840) swd = 3840; /* Limit reported screen size to realistic values. */ + if (sht > 2160) sht = 2160; + winwidth = (int)((float)winwidth * (float)swd / 1920.0); + winht = (int)((float)winht * (float)sht / 1080.0); + printf("Detected HiDPI Screen. Setting window size = %d x %d\n", winwidth, winht ); + gtk_widget_set_size_request( outer_window, winwidth, winht ); + } + setwinsz = 1; + } + + gtk_window_set_resizable( GTK_WINDOW( outer_window ), 0 ); + // make_sized_label( mpanel, 180, 10, "Open-Tax-Solver", 20.0 ); + + /* When the window is given the "delete_event" signal by the window manager, exit the program. */ + gtk_signal_connect( GTK_OBJECT(outer_window), "delete_event", GTK_SIGNAL_FUNC(quit), NULL ); + // g_signal_connect( GTK_WINDOW(outer_window), "destroy", quit, NULL); + + gtk_widget_set_app_paintable( outer_window, TRUE ); + g_signal_connect( outer_window, "expose-event", G_CALLBACK(on_expose_event), NULL); + + make_rectangular_separator( mpanel, 59, 6, 387, 102 ); + + y = 105; + make_sized_label( mpanel, winwidth / 2 - 60, y, "2024 Tax Year", 11.0 ); + + /* Place warning about this being a 'development version' when being revised. */ + // tmpwdg = make_label( mpanel, winwidth / 2 - 120, y+15, "-- DEVELOPMENT VERSION ONLY --" ); + // set_widget_color( tmpwdg, "#ff0000" ); + + y = y + 33; + make_sized_label( mpanel, 10, 135, "Select Tax Program:", 12.0 ); + + x = 30; + y = y + 25; + y1 = y; + dy = ((winht - 120) - y) / 7; + formid = setform( form_US_1040 ); + txprogstog = make_radio_button( mpanel, 0, x, y, "US 1040 (w/Scheds A,B,D)", slcttxprog, formid ); + add_tool_tip( txprogstog, "Also does the 8949 forms." ); + // gtk_widget_set_sensitive( txprogstog, grayed_out ); /* Gray-out for this version - Not Ready. */ + y = y + dy; + formid = setform( form_US_1040_Sched_C ); + make_radio_button( mpanel, txprogstog, x, y, "US 1040 Sched C", slcttxprog, formid ); + y = y + dy; + formid = setform( form_CA_540 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "CA State 540", slcttxprog, formid ); + // gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + y = y + dy; + formid = setform( form_NC_D400 ); + make_radio_button( mpanel, txprogstog, x, y, "NC State DC400", slcttxprog, formid ); + y = y + dy; + formid = setform( form_NJ_1040 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "NJ State 1040", slcttxprog, formid ); + // gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + y = y + dy; + formid = setform( form_AZ_140 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "AZ State 140", slcttxprog, formid ); + // gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + y = y + dy; + formid = setform( form_MI_1040 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "MI State 1040", slcttxprog, formid ); + // gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + fronty2 = y + dy; + + y = y1; + x = winwidth/2 + 40; + formid = setform( form_OH_IT1040 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "OH State IT1040", slcttxprog, formid ); + // gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + y = y + dy; + formid = setform( form_PA_40 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "PA State 40", slcttxprog, formid ); + // gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + y = y + dy; + formid = setform( form_VA_760 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "VA State 760", slcttxprog, formid ); + // gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + y = y + dy; + formid = setform( form_NY_IT201 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "NY State IT201", slcttxprog, formid ); + // gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + y = y + dy; + formid = setform( form_MA_1 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "MA State 1", slcttxprog, formid ); + if (0) + gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + y = y + dy; + formid = setform( form_OR_40 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "OR State 40", slcttxprog, formid ); + // gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + y = y + dy; + formid = setform( form_other ); + txprogstog = make_radio_button( mpanel, txprogstog, x, y, "Other", slcttxprog, formid ); + y2 = y + dy; + if (selected_other) set_radio_button( txprogstog ); + + fronty1 = y1; + if (y2 > fronty2) + fronty2 = y2; + // make_rectangular_separator( mpanel, 20, y1-5, winwidth - 20, y2 ); + + slcttxprog( 0, "0" ); /* Set default tax program. */ + + if (infile == 0) + { + button = make_button_wsizedcolor_text( mpanel, 30, winht - 95, "Start New Return", 14.0, "#000000", pick_template, 0 ); + add_tool_tip( button, "Start a fresh new blank return of the selected type." ); + + button = make_button_wsizedcolor_text( mpanel, (int)(0.5222 * (float)winwidth), winht - 95, "Open Saved Form", 14.0, "#000000", pick_file, 0 ); + add_tool_tip( button, "Open a previously saved or existing, tax form or example." ); + make_sized_label( mpanel, winwidth / 2 - 25, winht - 30, vrsnmssg, 8 ); + make_sized_label( mpanel, winwidth / 2 - 45, winht - 14, ots_pkg_mssg, 7 ); + } + else + Get_New_Tax_Form_Page( current_working_filename ); + + button = make_button( mpanel, 20, winht - 35, "Help", helpabout1, 0 ); + add_tool_tip( button, "Get information about this program, Help, and Updates." ); + button = make_button( mpanel, winwidth - 60, winht - 35, " Quit ", quit, 0 ); + add_tool_tip( button, "Leave this program." ); + + Check_for_illegal_characters_in_the_file_path( argv[0] ); + + ok_slcttxprog = 1; + gtk_widget_show_all( outer_window ); + while (1) // gtk_main(); + { + UpdateCheck(); /* Check for, and serve, any pending GTK window/interaction events. */ + Sleep_seconds( 0.05 ); /* No need to spin faster than ~20 Hz update rate. */ + if ((need_to_resize) && (Report_Time() - last_resize_time > 0.35)) + { + if (verbose) printf(" Resizing to (%d, %d)\n", winwidth, winht ); + Update_box_info(); + Setup_Tax_Form_Page(0); + need_to_resize = 0; + } + if (schedule_PDF_conversion) do_pdf_conversion(); + } + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/ots_gui3.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/ots_gui3.c new file mode 100755 index 0000000..0248669 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Gui_gtk/ots_gui3.c @@ -0,0 +1,4501 @@ +/********************************************************/ +/* OTS_GUI.c - OpenTaxSolver Graphical User Interface. */ +/* Based on GimpToolKit (Gtk) widgets. */ +/* */ +/* This version is based on Gtk-3 widgets. */ +/* */ +/* The OTS_GUI is designed to read-in standard OTS data */ +/* files, and present the tax information on your */ +/* screen. It allows entering the values, saving */ +/* return data, editing previously saved return sheets, */ +/* and running the OTS tax-solver to compute your */ +/* taxes. */ +/* */ +/* The OTS tax-solver is a text program which can be */ +/* used by itself. This GUI front-end simplifies using */ +/* OTS. It walks you through the steps and invokes the */ +/* regular OTS solver when you are ready. */ +/* */ +/* OTS data files, for example "tax_xx.txt", contain */ +/* the line numbers (or names) of the entries for a */ +/* given tax form, as well as any previously entered */ +/* values for each line. Additional comments may */ +/* follow on any line. */ +/* A few example lines follow: */ +/* */ +/* L15 ; { Rental income } */ +/* L17 234.00 ; { Savings interest } */ +/* L18 { Dividends } */ +/* 23.00 { Bank1 } */ +/* 14.50 ; { Work loan } */ +/* */ +/* OTS_GUI reads these lines and places a label for */ +/* each line number/name, a text-box for filling in the */ +/* value(s), and additional labels for the comments. */ +/* At the bottom are placed buttons to save and */ +/* calculate-taxes. */ +/* */ +/* To compile this graphical program, you will need the */ +/* Gtk library. */ +/* */ +/* Compile: */ +/* cc -O `pkg-config --cflags gtk+-3.0` ots_gui3.c \ + `pkg-config --libs gtk+-3.0` -o ots_gui3 */ +/* */ +/********************************************************/ + +/**********************************************************************/ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of */ +/* the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA. */ +/**********************************************************************/ + +float version=3.16; +char package_date[]="April 28, 2025"; +char ots_release_package[]="22.07"; + +/************************************************************/ +/* Design Notes - */ +/* Unlike the individual tax programs, which can know */ +/* what to expect on each line, this GUI does not know */ +/* about the format of any particular tax form file. */ +/* Therefore, it applies some simple rules to parse */ +/* the fields: */ +/* 1. The next non-comment / non-white-space character */ +/* after a ";" is interpreted as a line-label. */ +/* (eg. L51) */ +/* However, some lines expecting single values were */ +/* not terminated with ";", so other rules are needed. */ +/* 2. Any line with a non-comment / non-white-space char */ +/* in column 1 (first char on line), is assumed to be */ +/* a line-label. So all field values should be */ +/* indented to use the GUI with them. */ +/* Internal Architecture: + Main + -pick_file + -receive_filename + -open_taxfile + -Get_New_Tax_Form_Page + -Get_Tax_Form_Page + -Read_Tax_File + -Setup_Tax_Form_Page - Creates the window for the form-page. + -DisplayTaxInfo - Renders the interactive form-page. + -check_comments +*/ +/************************************************************/ + +#include +#include +#include +#include +#include +// #include "backcompat.c" +#include "gtk_utils3.c" /* Include the graphics library. */ +#include "gtk_file_browser3.c" + + GtkWidget *mpanel, *mpanel2, *warnwin=0, *popupwin=0, *resultswindow=0, *scrolledpane, *title_label; + int operating_mode=1, need_to_resize=0, debug=0; + double last_resize_time; + +int verbose=0; +int winwidth=450, winht=480; +FILE *infile; +int ots_column=0, ots_line=0; /* Input file position. */ +#define MaxFname 4096 +char wildcards_bin[MaxFname]="", filename_exe[MaxFname]="", *ots_path; +char workdir[MaxFname+512]=""; +char temp_dir[MaxFname+512]=""; +char directory_dat[MaxFname+512]=".", wildcards_dat[MaxFname]="*.txt", filename_incl[MaxFname]=""; +char directory_incl[MaxFname]="tax_form_files", wildcards_incl[MaxFname]="*_out.txt"; +char wildcards_spreadsheet[MaxFname]="*.csv *.tsv"; +char directory_fb[MaxFname]="", wildcards_fb[MaxFname]="", filename_fb[MaxFname]=""; +char *title_line="Tax File", *current_working_filename=0, *invocation_path, *include_file_name=0; +char wildcards_out[MaxFname]="*_out.txt"; +char run_options[MaxFname]=""; +int fronty1, fronty2, computed=0, ok_slcttxprog=1; +char *yourfilename=0; +char toolpath[MaxFname]="", *start_cmd; +int pending_compute=0, supported_pdf_form=1; +int filingstatus_mfj=1; +int round_to_whole_nums=0, round_pdf_to_whole_dollars=0; + +void pick_file( GtkWidget *wdg, void *data ); /* Prototype */ +void consume_leading_trailing_whitespace( char *line ); +void get_line_entry( char *word, int maxn, int *linenum, FILE *infile ); +void Run_TaxSolver( GtkWidget *wdg, void *x ); +void helpabout2( GtkWidget *wdg, void *data ); +void read_instructions( int init ); +void dump_taxinfo(); +int warn_release=0; + +int selected_other=0; +void save_taxfile( GtkWidget *wdg, void *data ); +void printout( GtkWidget *wdg, void *data ); +void taxsolve(); +char *taxsolvecmd=0, taxsolvestrng[MaxFname]=""; + +#define VKIND_FLOAT 0 +#define VKIND_INT 1 +#define VKIND_TEXT 2 +#define VKIND_COMMENT 3 +#define VKIND_COLON 4 + +#define VALUE_LABEL 0 +#define COMMENT 1 +#define SEMICOLON 2 +#define NOTHING 10 +#define ENABLED 1 +#define DISABLED 0 + +#define LITERAL_INFO 1 +#define ID_INFO 2 + +#define CAPGAIN_READY "" // "Ready" + +char program_names[30][100] = + { + "taxsolve_US_1040_2024", /* 0 */ + "taxsolve_US_1040_Sched_C_2024", /* 1 */ + "taxsolve_US_8829", /* 2 */ + "taxsolve_CA_540_2024", /* 3 */ + "taxsolve_NC_D400_2024", /* 4 */ + "taxsolve_NJ_1040_2024", /* 5 */ + "taxsolve_OH_IT1040_2024", /* 6 */ + "taxsolve_PA_40_2024", /* 7 */ + "taxsolve_VA_760_2024", /* 8 */ + "taxsolve_NY_IT201_2024", /* 9 */ + "taxsolve_MA_1_2024", /* 10 */ + "taxsolve_GA_500", /* 11 */ + "taxsolve_AZ_140_2024", /* 12 */ + "taxsolve_MI_1040_2024", /* 13 */ + "taxsolve_OR_40_2024", /* 14 */ + "Other", /* xx */ + }; + +enum form_names { form_US_1040, form_US_1040_Sched_C, form_US_8829, form_CA_540, + form_NC_D400, form_NJ_1040, form_OH_IT1040, form_PA_40, + form_VA_760, form_NY_IT201, form_MA_1, form_GA_500, form_AZ_140, + form_MI_1040, form_OR_40, form_other, + form_1040e, form_4562, form_8582 + }; +int selected_form=form_other, other_form_selected=0; + + +char *setform( int formnum ) +{ + char twrd[500]; + sprintf( twrd, "%d", formnum ); + return strdup( twrd ); +} + + +#ifndef PLATFORM_KIND + #define Posix_Platform 0 + #define Mingw_Platform 1 + #define MsVisC_Platform 2 + #ifdef __CYGWIN32__ + #ifndef __CYGWIN__ + #define __CYGWIN__ __CYGWIN32__ + #endif + #endif + #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MSYS__) + #define PLATFORM_KIND Mingw_Platform /* MinGW or like platform */ + #elif defined(__WIN32) || defined(WIN32) + #define PLATFORM_KIND MsVisC_Platform /* microsoft visual C */ + #else + #define PLATFORM_KIND Posix_Platform /* Posix/Linux/Unix */ + #endif +#endif + + +#if (PLATFORM_KIND != Posix_Platform) + char slashchr='\\'; + char slashstr[]="\\"; +#else + char slashchr='/'; + char slashstr[]="/"; +#endif + + +void dismiss_general_warning( GtkWidget *wdg, void *data ) +{ + switch (warn_release) + { + case 1: pick_file( 0, 0 ); + warn_release = 0; + close_any_window( 0, data ); + break; + case 2: save_taxfile(0,"1"); /* Re-open file-browser. */ + warn_release = 0; + close_any_window( 0, data ); + if (pending_compute == 1) pending_compute++; + break; + default: close_any_window( 0, data ); + } +} + + +int dismiss_general_warning_ret0( GtkWidget *wdg, void *data ) +{ + dismiss_general_warning( wdg, data ); + warnwin = 0; + return 0; +} + + +char wmsg[4096], *pending_message=0; + +void GeneralWarning( char *mesg ) /* Used for one-line warning messages. */ +{ + int xpos=20, ypos=20, winwdth, winhght=100; + GtkWidget *winframe; + printf("%s\n", mesg); + winwdth = 90 + strlen( mesg ) * 8; + winframe = make_window( winwdth, winhght, "Warning Message", &warnwin ); + make_label( winframe, xpos, ypos, mesg ); + make_button( winframe, winwdth/2 - 30, winhght - 40, " Ok ", dismiss_general_warning, &warnwin ); + gtk_window_set_keep_above( (GtkWindow *)warnwin, 1 ); + show_wind( warnwin ); +} + + +void GeneralPopup( char *title, char *mesg, int to_text_win ) /* Used for multi-line informational messages. */ +{ + int xpos=20, ypos=10, winwdth, winhght, orig_winhght, j=0, k=0, maxcols=0, nlines=0; + GtkWidget *winframe; + if (to_text_win) + printf("%s\n", mesg); + while (mesg[k] != '\0') /* Determine max line width and number of rows. */ + { + if (j > maxcols) maxcols = j; + if ((mesg[k] == '\n') || (mesg[k] == '\0')) + { + j = 0; + nlines++; + } + else + j++; + k++; + } + winwdth = 50 + maxcols * 8; + winhght = 70 + 18 * nlines + 5; + orig_winhght = winhght; + if (winhght < 500) + { + if (winwdth <= 600) + winframe = make_window( winwdth, winhght, title, &warnwin ); + else + { + winwdth = 600; + winframe = make_scrolled_window_wkill( winwdth, winhght, title, &warnwin, 1, 0, dismiss_general_warning_ret0 ); + } + } + else + { + winhght = 500; + if (winwdth <= 600) + winframe = make_scrolled_window_wkill( winwdth, winhght, title, &warnwin, 0, 1, dismiss_general_warning_ret0 ); + else + { + winwdth = 600; + winframe = make_scrolled_window_wkill( winwdth, winhght, title, &warnwin, 1, 1, dismiss_general_warning_ret0 ); + } + } + make_label( winframe, xpos, ypos, mesg ); + make_button( winframe, winwdth/2 - 30, orig_winhght - 38, " Ok ", dismiss_general_warning, &warnwin ); + gtk_window_set_keep_above( (GtkWindow *)warnwin, 1 ); + show_wind( warnwin ); +} + + + +struct value_list + { + int kind; /* 0=float, 1=integer, 2=text, 3=comment. */ + float value; + char *comment, *text; + int column, linenum, formtype; + struct taxline_record *parent; + GtkEntry *box; + GtkWidget *comment_label; + struct value_list *nxt; + } *rptwd_txline=0; + +struct taxline_record + { + char *linename; + int linenum, vpos; + struct value_list *values_hd, *values_tl; /* Head and tail list pointers for a tax-line-entry. */ + struct instruct_rec *instructions; + struct taxline_record *nxt; + } *taxlines_hd=0, *taxlines_tl=0; /* Head and tail list pointers for tax-form. */ + + + struct taxline_record * +new_taxline( char *linename, int linenum ) +{ + struct taxline_record *tmppt; + + tmppt = (struct taxline_record *)calloc( 1, sizeof(struct taxline_record) ); + tmppt->linename = strdup(linename); + tmppt->linenum = linenum; + if (taxlines_hd==0) taxlines_hd = tmppt; + else taxlines_tl->nxt = tmppt; + taxlines_tl = tmppt; + return tmppt; +} + + + struct value_list * +new_list_item_value( int kind, struct taxline_record *txline, void *x, int column, int linenum ) +{ + struct value_list *tmppt; + + tmppt = (struct value_list *)calloc( 1, sizeof(struct value_list) ); + tmppt->kind = kind; + tmppt->text = 0; + tmppt->comment = 0; + tmppt->column = column; + tmppt->linenum = linenum; + tmppt->box = 0; + switch (kind) + { + case VKIND_FLOAT: tmppt->value = *(float *)x; break; + case VKIND_INT: tmppt->value = *(int *)x; break; + case VKIND_TEXT: tmppt->text = strdup( (char *)x ); break; + case VKIND_COMMENT: tmppt->comment = strdup( (char *)x ); break; + } + tmppt->parent = txline; + tmppt->nxt = 0; + if (txline==0) {printf("ERROR1: called add_value %d before any line.\n",kind); return tmppt;} + if (txline->values_hd==0) txline->values_hd = tmppt; else txline->values_tl->nxt = tmppt; + txline->values_tl = tmppt; + return tmppt; +} + + +void pasteurize_entry( char *text ) /* Filter disallowed characters from user input. */ +{ + int j=0; + while (text[j] != '\0') + { + if (text[j] == ';') text[j] = ' '; + j++; + } +} + + +struct line_record + { + char *line; + struct line_record *next; + } *markup_commands_hd=0, *markup_commands_tl=0; + +void add_markup_command( char *markup ) +{ + struct line_record *new; + new = (struct line_record *)calloc( 1, sizeof( struct line_record ) ); + new->line = strdup( markup ); + if (markup_commands_hd == 0) + markup_commands_hd = new; + else + markup_commands_tl->next = new; + markup_commands_tl = new; +} + +void dump_any_markup_commands( FILE *outfile ) +{ + struct line_record *old; + while (markup_commands_hd) + { + if (verbose) printf("MARKup: %s\n", markup_commands_hd->line ); + fprintf(outfile,"%s\n", markup_commands_hd->line ); + old = markup_commands_hd; + markup_commands_hd = markup_commands_hd->next; + free( old->line ); + free( old ); + } +} + + +int intercept_any_pragmas( char *word ) /* Intercept any special command pragmas. */ +{ + if (strncmp( word, "Round_to_Whole_Dollars", 21 ) == 0) /* Intercept any mode-setting commands. */ + { + printf("Setting Round_to_Whole_Dollars mode.\n"); + round_to_whole_nums = 1; + return 1; + } + else + return 0; +} + + + +/*--------------------------------------------------------------*/ +/* Get_Next_Entry - Reads next item from input file. */ +/* Returns 0=VALUE_LABEL if reads data value or line-label. */ +/* Returns 1=COMMENT if reads comment. */ +/* Returns 2=SEMICOLON if reads ';' entry-end character. */ +/* */ +/* Passes back the column and line number where the current */ +/* entry begins on the line in the input file. */ +/*--------------------------------------------------------------*/ +int get_next_entry( char *word, int maxn, int *column, int *linenum, FILE *infile ) +{ + int k=0; + + /* Get up to the next non-white-space character. */ + ots_line = *linenum; + do + { + word[k] = getc(infile); + if (word[k] == '\n') { ots_column = 0; ots_line++; } else ots_column++; + } + while ((!feof(infile)) && ((word[k]==' ') || (word[k]=='\t') || (word[k]=='\n') || (word[k]=='\r'))); + *column = ots_column; + *linenum = ots_line; + + if (feof(infile)) {word[0] = '\0'; return NOTHING;} + if (word[k]=='{') + { /*get_comment*/ + do + { + word[k++] = getc(infile); + if (word[k-1] == '\n') { ots_column = 0; ots_line++; } else ots_column++; + } + while ((!feof(infile)) && (word[k-1]!='}') && (k=maxn) {printf("Error: Character buffer overflow detected.\n"); exit(1);} + return COMMENT; + } /*get_comment*/ + else + if (word[k]=='"') + { /*get_quoted_value*/ + k++; + do + { + word[k++] = getc(infile); + if (word[k-1] == '\n') { ots_column = 0; ots_line++; } else ots_column++; + } + while ((!feof(infile)) && (word[k-1]!='"') && (k=maxn) {printf("Error: Character buffer overflow detected.\n"); exit(1);} + word[k] = '\0'; + return VALUE_LABEL; + } /*get_quoted_value*/ + else + { /*get_value_or_linelabel*/ + k++; + while ((!feof(infile)) && (word[k-1]!=' ') && (word[k-1]!='\t') && + (word[k-1]!='\n') && (word[k-1]!='\r') && (word[k-1]!=';') && (k=maxn) {printf("Error: Character buffer overflow detected.\n"); exit(1);} + word[k] = '\0'; + if (strncasecmp( word, "MarkupPDF", 9 ) == 0) + { /* Store any custom markup commands. */ + if (word[k-1] != '\n') + { /* Get the remainder of the line. */ + do word[k++] = getc(infile); while ((!feof(infile)) && (word[k-1] != '\n')); + } + word[k-1] = '\0'; + ots_column = 0; + ots_line++; + add_markup_command( word ); + return NOTHING; + } + if (intercept_any_pragmas( word )) + { + return NOTHING; + } + if (word[k-1]==';') + { + if (k==1) { word[1] = '\0'; return SEMICOLON; } + else { ungetc(word[k-1], infile); word[k-1] = '\0'; return VALUE_LABEL; } + } + else { ungetc(word[k-1], infile); word[k-1] = '\0'; return VALUE_LABEL; } + } /*get_value_or_linelabel*/ +} + + +/*--------------------------------------------------------------*/ +/* Get_Line_Entry - Reads remainder of line from input file. */ +/*--------------------------------------------------------------*/ +void get_line_entry( char *word, int maxn, int *linenum, FILE *infile ) +{ + int k=0; + word[k] = getc(infile); + while ((!feof(infile)) && (word[k] != '\n') && (word[k] != '{')) + { + if (word[k] == '{') + { + do word[k] = getc(infile); while ((!feof(infile)) && (word[k] != '}')); + if (word[k] == '}') word[k] = getc(infile); + } + else + { + k++; + if (k > maxn) + { + word[k-1] = '\0'; + while ((!feof(infile)) && (getc(infile) != '\n')); + consume_leading_trailing_whitespace( word ); + return; + } + // printf(" get_line_entry = '%c'\n", word[k-1] ); + word[k] = getc(infile); + } + } + if (word[k] == '{') + ungetc( word[k], infile ); + else + *linenum = *linenum + 1; + word[k] = '\0'; + // printf(" k = %d, word[%d] = %d\n", k, k, word[k] ); + // printf(" word = '%s'\n", word ); + consume_leading_trailing_whitespace( word ); +} + + +void DisplayTaxInfo(); /* This is a prototype statement only. */ +void warn_about_save_needed_switch(); +void quote_MS_file_name( char *fname ); +int save_needed=0; +int compute_needed=0; + + + +int Update_box_info() /* Capture entries from form-boxes. */ +{ + struct taxline_record *txline; + struct value_list *tmppt; + char text[1024]; + + txline = taxlines_hd; + while (txline!=0) + { + tmppt = txline->values_hd; + while (tmppt!=0) + { + if (tmppt->box != 0) + { + get_formbox_text( tmppt->box, text, 1024 ); + pasteurize_entry( text ); + tmppt->kind = VKIND_TEXT; + if (strcmp( tmppt->text, text ) != 0) { save_needed++; compute_needed = 1; } + tmppt->text = strdup( text ); + } + tmppt = tmppt->nxt; + } + txline = txline->nxt; + } + return save_needed; +} + + +void refresh( gdouble vpos ) +{ + GtkAdjustment *adj; +printf("Refreshing ...\n"); + gtk_widget_destroy( mpanel2 ); /* Clear out panel. */ + /* Set up new panel with scrollbars for tax form data. */ + mpanel2 = gtk_fixed_new(); + scrolledpane = gtk_scrolled_window_new( 0, 0 ); + gtk_scrolled_window_set_policy( (GtkScrolledWindow *)scrolledpane, GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS ); + // gtk_scrolled_window_add_with_viewport( (GtkScrolledWindow *)scrolledpane, mpanel2 ); + gtk_container_add( GTK_CONTAINER( scrolledpane ), mpanel2 ); + gtk_fixed_put( GTK_FIXED( mpanel ), scrolledpane, 0, 35 ); + gtk_widget_set_size_request( scrolledpane, winwidth, winht - 80 ); + + /* Restore the scrolling position. */ + adj = gtk_scrolled_window_get_vadjustment( (GtkScrolledWindow *)scrolledpane ); + gtk_adjustment_set_value( adj, vpos ); + gtk_scrolled_window_set_vadjustment( (GtkScrolledWindow *)scrolledpane, adj ); + + DisplayTaxInfo(); + + /* Restore the scrolling position. */ + adj = gtk_scrolled_window_get_vadjustment( (GtkScrolledWindow *)scrolledpane ); + gtk_adjustment_set_value( adj, vpos ); + gtk_scrolled_window_set_vadjustment( (GtkScrolledWindow *)scrolledpane, adj ); + + gtk_widget_show_all( outer_window ); +} + + + +void re_display_form() +{ + gdouble vpos; + GtkAdjustment *adj; + + Update_box_info(); /* Grab any new entries. */ + + /* Prestore the scrolling position. */ + adj = gtk_scrolled_window_get_vadjustment( (GtkScrolledWindow *)scrolledpane ); + vpos = gtk_adjustment_get_value( adj ); + + refresh( vpos ); + +#if (0) + /* Restore the scrolling position. */ + adj = gtk_scrolled_window_get_vadjustment( (GtkScrolledWindow *)scrolledpane ); + // adj->value = vpos; + gtk_adjustment_set_value( adj, vpos ); + gtk_scrolled_window_set_vadjustment( (GtkScrolledWindow *)scrolledpane, adj ); + gtk_widget_show_all( outer_window ); +#endif +} + + + +/*--------------------------------------------------------------*/ +/* Add_New_Boxes - Callback for "+" button on form-boxes. */ +/* Adds new form-box(s) to the line item. */ +/*--------------------------------------------------------------*/ +void add_new_boxes( void *data, int num ) +{ + struct taxline_record *txline; + struct value_list *item, *lineitem, *newitem1, *newitemlast, *oldtail; + double vpos; + GtkAdjustment *adj; + + Update_box_info(); + + item = (struct value_list *)data; + oldtail = item->parent->values_tl; + + if (num==2) + { + newitem1 = new_list_item_value( VKIND_TEXT, item->parent, "", 0, item->linenum + 1 ); + new_list_item_value( VKIND_TEXT, item->parent, "", 0, item->linenum + 1 ); + new_list_item_value( VKIND_TEXT, item->parent, "", 0, item->linenum + 2 ); + newitemlast = new_list_item_value( VKIND_TEXT, item->parent, "", 0, item->linenum + 2 ); + } + else + if (num==3) /* CapGain only */ + { + newitem1 = new_list_item_value( VKIND_TEXT, item->parent, CAPGAIN_READY, 0, item->linenum + 1 ); + new_list_item_value( VKIND_TEXT, item->parent, "", 0, item->linenum + 1 ); + new_list_item_value( VKIND_TEXT, item->parent, "", 0, item->linenum + 2 ); + new_list_item_value( VKIND_TEXT, item->parent, "", 0, item->linenum + 2 ); + new_list_item_value( VKIND_TEXT, item->parent, "~", 0, item->linenum + 3 ); + newitemlast = new_list_item_value( VKIND_TEXT, item->parent, "~", 0, item->linenum + 3 ); + } + else + { + newitem1 = new_list_item_value( VKIND_TEXT, item->parent, "", 0, item->linenum + 1 ); + newitemlast = newitem1; + } + + lineitem = item; /* Skip the items on the original line. */ + while ((lineitem->nxt!=newitem1) && (lineitem->nxt->linenum == item->linenum)) lineitem = lineitem->nxt; + + /* Insert in list and remove from tail, if not on end of list. */ + if (lineitem->nxt != newitem1) + { + newitemlast->nxt = lineitem->nxt; + lineitem->nxt = newitem1; + oldtail->nxt = 0; + item->parent->values_tl = oldtail; + } + + /* Increment the effective file-line-number of all subsequent line entries. */ + lineitem = newitemlast->nxt; + while (lineitem!=0) /* Now do remaining lines of this item. */ + { + lineitem->linenum = lineitem->linenum + num; + lineitem = lineitem->nxt; + } + txline = item->parent->nxt; /* Next do remaining line items. */ + while (txline!=0) + { + txline->linenum = txline->linenum + num; + lineitem = txline->values_hd; + while (lineitem!=0) + { + lineitem->linenum = lineitem->linenum + num; + lineitem = lineitem->nxt; + } + txline = txline->nxt; + } + + /* Prestore the scrolling position. */ + adj = gtk_scrolled_window_get_vadjustment( (GtkScrolledWindow *)scrolledpane ); + // printf("Adj = (%x), %g, (%g, %g), (%g, %g), %g\n", adj, adj->value, adj->lower, adj->upper, adj->step_increment, adj->page_increment, adj->page_size ); + // vpos = adj->value; + vpos = gtk_adjustment_get_value( adj ); + printf("\nVpos = %g\n", vpos ); + + refresh( vpos ); + +#if (0) + /* Restore the scrolling position. */ + adj = gtk_scrolled_window_get_vadjustment( (GtkScrolledWindow *)scrolledpane ); + gtk_adjustment_set_value( adj, vpos ); + // adj->value = vpos; + gtk_scrolled_window_set_vadjustment( (GtkScrolledWindow *)scrolledpane, adj ); +#endif + +gtk_widget_show_all( outer_window ); +} + + +/*-------------------------------------------------------------------------*/ +/* Add_new_capgain_boxes - Callback for "+" button on cap-gain form-boxes. */ +/* Adds a new form-boxes to the line item. */ +/*-------------------------------------------------------------------------*/ +void add_new_capgain_boxes( GtkWidget *wdg, void *data ) +{ + add_new_boxes( data, 3 ); /* 3 lines of two boxes per line */ +} + +void add_new_box_item( GtkWidget *wdg, void *data ) +{ + add_new_boxes( data, 1 ); +} + + + + + + +void filter_reserved_characters( char *word, char *reserved, char *replacement_char ) +{ + int j=0, k; + while (word[j] != '\0') + { + k = 0; + while ((reserved[k] != '\0') && (word[j] != reserved[k])) + k++; + if (reserved[k] != '\0') + { /* Replace reserved character. */ + if (k < strlen(replacement_char)) + word[j] = replacement_char[k]; + else + word[j] = replacement_char[0]; + } + j++; + } +} + + + + + +GtkEntry *commentbox; + +void cancelpopup( GtkWidget *wdg, void *data ) +{ gtk_widget_destroy( popupwin ); popupwin = 0; } + + +void acceptcomment( GtkWidget *wdg, void *data ) +{ + char *comment; + struct value_list *tmppt; + + tmppt = (struct value_list *)data; + comment = get_formbox( commentbox ); + filter_reserved_characters( comment, "{}", "()" ); + // printf("Prior comment was '%s', new comment is '%s'\n", tmppt->comment, comment ); + if (tmppt->comment != 0) + { + if (strcmp( tmppt->comment, comment ) != 0) { save_needed++; compute_needed = 1; } + free( tmppt->comment ); + } else { save_needed++; compute_needed = 1; } + tmppt->comment = strdup( comment ); + modify_label( tmppt->comment_label, comment ); + cancelpopup(0,0); + // refresh(); +} + + +void edit_line_comment( GtkWidget *wdg, void *data ) /* Edit_comment. */ +{ + struct value_list *tmppt; + int winwidth=510, winht=110; + GtkWidget *panel; + + tmppt = (struct value_list *)data; + if (popupwin) gtk_widget_destroy( popupwin ); + panel = make_window( winwidth, winht, "Edit Comment", &popupwin ); + make_label( panel, 2, 2, "Edit Line Comment:" ); + commentbox = make_formbox_bypix( panel, 10, 25, winwidth - 40, tmppt->comment, 500, acceptcomment, tmppt ); + make_button( panel, 20, winht - 40, " Ok ", acceptcomment, tmppt ); + make_button( panel, winwidth - 60, winht - 40, "Cancel", cancelpopup, 0 ); + gtk_widget_show_all( popupwin ); +} + + +void accept_capgain_reset( GtkWidget *wdg, void *data ) +{ + struct value_list *tmppt; + int valflg = 0, comcnt = 0; + char tmpstr[256]; + + tmppt = (struct value_list *)data; + while (comcnt < 3) + { + switch (tmppt->kind) + { + case VKIND_TEXT: + if (valflg == 0) /* Set 1st box 'Buy Cost' to "Ready" */ + { + strcpy( tmpstr, CAPGAIN_READY ); + valflg = 1; + } + else + if (comcnt <2) + strcpy (tmpstr, ""); + else + strcpy (tmpstr, "~" ); + modify_formbox( tmppt->box, tmpstr ); + break; + case VKIND_COMMENT: + if (tmppt->comment != 0) free( tmppt->comment ); + tmppt->comment = strdup(""); + comcnt++; + break; + default: + break; + } + tmppt = tmppt->nxt; + } + cancelpopup(0,0); + re_display_form(); +} + + +void verify_capgain_reset(GtkWidget *wdg, void *data) /* Code follows edit_line_comment as a framework */ +{ + struct value_list *tmppt; + int winwidth=220, winht=60; + GtkWidget *panel; + + tmppt = (struct value_list *)data; + if (popupwin) gtk_widget_destroy( popupwin ); + panel = make_window( winwidth, winht, "Clear Gain/Loss values ?", &popupwin ); + make_label( panel, 5, 1, "Clear gain/loss values ?" ); + make_button( panel, 20, winht - 40, " Ok ", accept_capgain_reset, tmppt ); + make_button( panel, winwidth - 60, winht - 40, "Cancel", cancelpopup, 0 ); + gtk_widget_show_all( popupwin ); +} + + +void switch_form( GtkWidget *wdg, void *data ) +{ char *cmd; + Update_box_info(); + if (save_needed) + { + warn_about_save_needed_switch(); + return; + } + cmd = (char *)malloc( strlen(start_cmd) + 250 ); + #if (PLATFORM_KIND==Posix_Platform) + strcpy( cmd, start_cmd ); + if (verbose) strcat( cmd, " -v "); + strcat( cmd, " &" ); + #else /* For MS-win platforms. */ + char *tmpfname; + strcpy( cmd, "start " ); + tmpfname = (char *)malloc( strlen( start_cmd ) + 256 ); + strcpy( tmpfname, start_cmd ); + if ((strstr( tmpfname, "\"" ) == 0) && (strstr( tmpfname, " " ) != 0)) /* If has spaces but no quotes, */ + quote_MS_file_name( tmpfname ); /* Then quote the spaces. */ + strcat( cmd, tmpfname ); + free( tmpfname ); + #endif + if (strlen(workdir) > 0) + { + strcat( cmd, " -workdir "); + strcat( cmd, workdir ); + } + printf("Issuing: '%s'\n", cmd ); + system( cmd ); + exit(0); + } + + +void switch_anyway( GtkWidget *wdg, void *data ) +{ + save_needed = 0; + switch_form( 0, 0 ); +} + +void warn_about_save_needed_switch() +{ + int xpos=20, ypos=20, winwdth, winhght=100; + GtkWidget *winframe, *label; + winwdth = 300; + winframe = make_window( winwdth, winhght, "Warning Message", &warnwin ); + label = make_sized_label( winframe, xpos, ypos, "Change(s) not saved !!", 12 ); + set_label_color( label, "#ff0000" ); + make_button( winframe, 10, winhght - 40, "Switch anyway, without saving", switch_anyway, &warnwin ); + make_button( winframe, winwdth - 60, winhght - 40, "Cancel", dismiss_general_warning, &warnwin ); + gtk_window_set_keep_above( (GtkWindow *)warnwin, 1 ); + show_wind( warnwin ); +} + + +void quit_wcheck( GtkWidget *wdg, void *x ); /* Prototypes */ +void print_outfile_directly( GtkWidget *wdg, void *data ); +void create_pdf_file_directly( GtkWidget *wdg, void *data ); +void set_pdfviewer( GtkWidget *wdg, void *data ); + + +/* ----------------- Tax Instructions Helper -------------------- */ + +struct instruct_rec + { + char *instr_label, *instr_text; + int buflen; + struct instruct_rec *nxt; + } *instruct_lst=0; + +char *instructions_filename=0; + + +struct instruct_rec *new_instruction( char *line_label, char *buf, int *buflen ) +{ + struct instruct_rec *new; + //if (instruct_lst != 0) + //printf(" Instr: [%s] '%s'\n", instruct_lst->instr_label, buf ); + if (instruct_lst != 0) + instruct_lst->instr_text = strdup( buf ); /* Store prior instruction text. */ + buf[0] = '\0'; /* Clear buffer for new text. */ + *buflen = 0; + new = (struct instruct_rec *)calloc( 1, sizeof( struct instruct_rec ) ); + new->instr_label = strdup( line_label ); + new->nxt = instruct_lst; + instruct_lst = new; + return new; +} + + +void strcat_safe( char *dst, const char *src, int maxlen, int *buflen ) +{ + int j, k=0, oneless; +//printf("Adding: '%s' + '%s' = ", dst, src ); + oneless = maxlen - 1; + j = *buflen; + while ((j < oneless) && (src[k] != '\0')) { dst[j++] = src[k++]; } + dst[j] = '\0'; + *buflen = j; +//printf("'%s'\n", dst ); +} + + +int found_char( char ch, char *srch ) +{ + int j=0; + while ((ch != srch[j]) && (srch[j] != '\0')) + j++; + if (srch[j] != '\0') + return 1; + else + return 0; +} + + +void advance_word( char *tstr, char delim, char *srch ) +{ + int j=0, k=0; + while ((tstr[j] != '\0') && (tstr[j] != delim)) + j++; + if (tstr[j] != '\0') + j++; + while ((tstr[j] != '\0') && (found_char( tstr[j], srch ))) + j++; + do + tstr[k++] = tstr[j++]; + while (tstr[k-1] != '\0'); +} + + +void dispose_instuctions() +{ + struct instruct_rec *old; + while (instruct_lst != 0) + { + old = instruct_lst; + instruct_lst = instruct_lst->nxt; + free( old->instr_label ); + free( old->instr_text ); + free( old ); + } +} + + +void attach_instruction2line( struct instruct_rec *newinstr ) +{ + struct taxline_record *txline; + + txline = taxlines_hd; + while (txline!=0) + { + if (strcmp( txline->linename, newinstr->instr_label ) == 0) + { + txline->instructions = newinstr; + return; + } + txline = txline->nxt; + } +} + + +void read_instructions( int init ) +{ char *tmpinstrfname, *tline, *tstr, *twrd, *buf; + int maxstr1=16384, maxstr2=32768, buflen=0; + struct instruct_rec *newinstr; + FILE *instrfile; + /** + Instruction files must have the following form for any tax-lines with instructions: + [line-lable] instruction text + Example: + [L17] Report here your interest income. + More instruction text ... + [L20] This should come from your 1099-G box 2a. + Etc., etc.. + The instructions can span multiple lines, as shown, until the next bracket line. + The label bracket, "[", must be the first character on the line. + Do not have tabs or line-feeds in text. Only printable ascii characters!!! + **/ + if (init == 1) + { + dispose_instuctions(); + switch (selected_form) + { + case form_US_1040: + instructions_filename = strdup( "f1040_instructions.dat" ); break; + case form_US_1040_Sched_C: + instructions_filename = strdup( "f1040sc_instructions.dat" ); break; + case form_PA_40: + instructions_filename = strdup( "PA_instructions.dat" ); break; + case form_CA_540: + instructions_filename = strdup( "CA_540_instructions.dat" ); break; + case form_OH_IT1040: + instructions_filename = strdup( "OH_PIT_IT1040_instructions.dat" ); break; + case form_VA_760: + instructions_filename = strdup( "VA_760_instructions.dat" ); break; + case form_NJ_1040: + instructions_filename = strdup( "NJ_1040_instructions.dat" ); break; + case form_NY_IT201: + instructions_filename = strdup( "NY_it201_instructions.dat" ); break; + case form_MA_1: + instructions_filename = strdup( "MA_1_instructions.dat" ); break; + case form_NC_D400: + instructions_filename = strdup( "NC_instructions.dat" ); break; + case form_MI_1040: + instructions_filename = strdup( "MI_1040_instructions.dat" ); break; + case form_OR_40: + instructions_filename = strdup( "OR_40_instructions.dat" ); break; + default: + if (strstr( taxsolvestrng, "taxsolve_HSA_f8889" ) != 0) + instructions_filename = strdup( "f8889_instructions.dat" ); + else + if (strstr( taxsolvestrng, "taxsolve_US_1040_Sched_SE" ) != 0) + instructions_filename = strdup( "f1040sse_instructions.dat" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8829" ) != 0) + instructions_filename = strdup( "f8829_instructions.dat" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8995" ) != 0) + instructions_filename = strdup( "f8995_instructions.dat" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8959" ) != 0) + instructions_filename = strdup( "f8959_instructions.dat" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8960" ) != 0) + instructions_filename = strdup( "f8961_instructions.dat" ); + else + if (strstr( taxsolvestrng, "taxsolve_f2210" ) != 0) + instructions_filename = strdup( "f2210_instructions.dat" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8812" ) != 0) + instructions_filename = strdup( "f8812_instructions.dat" ); + else + if (strstr( taxsolvestrng, "taxsolve_CA_5805" ) != 0) + instructions_filename = strdup( "CA_5805_instructions.dat" ); + else + return; + } + if (verbose) printf("Instruction file = '%s'\n", instructions_filename ); + } + tmpinstrfname = (char *)malloc(8192); + tstr = (char *)malloc( 1024 ); + twrd = (char *)malloc( 1024 ); + tline = (char *)malloc( maxstr1 + 10 ); + buf = (char *)calloc( 1, maxstr2 + 10 ); + strcpy( tmpinstrfname, ots_path ); + strcat( tmpinstrfname, "src" ); strcat( tmpinstrfname, slashstr ); + strcat( tmpinstrfname, "formdata" ); strcat( tmpinstrfname, slashstr ); + strcat( tmpinstrfname, instructions_filename ); + if (verbose) printf("Opening: '%s'\n", tmpinstrfname ); + + instrfile = fopen( tmpinstrfname, "rb" ); + if (instrfile == 0) + { + if (verbose) printf("Could not open instructions file: '%s'\n", tmpinstrfname ); + return; + } + + fgets( tline, maxstr1, instrfile ); + // printf("%s", tline ); + while (!feof(instrfile)) + { + // printf("%s", tline ); + if (tline[0] == '[') + { + strcpy_safe( tstr, tline, 256 ); + fb_next_word( tstr, twrd, "[] \t\n\r" ); + // printf("Label: '%s'\n", twrd ); + newinstr = new_instruction( twrd, buf, &buflen ); + attach_instruction2line( newinstr ); + advance_word( tline, ']', " \t" ); + } + strcat_safe( buf, tline, maxstr2, &buflen ); + fgets( tline, maxstr1, instrfile ); + } + new_instruction( "_END_", buf, &buflen ); + fclose( instrfile ); + free( tmpinstrfname ); + free( tstr ); + free( twrd ); +} + + + +int mouse_clicked( GtkWidget *widget, GdkEventButton *event, gpointer data ) +{ + int xpos, vpos, mindist=9999999; + GtkAdjustment *adj; + struct taxline_record *txline, *closest_line=0; + + if (warnwin) + { /* Remove any previously open text window. */ + gtk_widget_destroy( warnwin ); + warnwin = 0; + } + xpos = (int)(event->x); + if (((xpos > 100) && (xpos < 245)) || (xpos > 710)) + return 1; /* Too close to buttons or text-forms of a tax-line, so return from here. */ + + /* Find the closest tax-line to where clicked. */ + // printf("Mouse button %d Pressed at: %d, %d, %g\n", (int)(event->button), (int)(event->x), (int)(event->y), (double)(event->time) ); + adj = gtk_scrolled_window_get_vadjustment( (GtkScrolledWindow *)scrolledpane ); + vpos = (int)(event->y + gtk_adjustment_get_value( adj )); + txline = taxlines_hd; + while (txline!=0) + { + if (abs( vpos - txline->vpos ) < mindist) + { + mindist = abs( vpos - txline->vpos ); + closest_line = txline; + } + txline = txline->nxt; + } + if ((closest_line != 0) && (vpos - closest_line->vpos > -30)) + { /* Pop up instruction-text window, if clicked near enough, and/or below, a tax-line with instructions. */ + // printf("Picked '%s', dist = %d\n", closest_line->linename, mindist ); + if (closest_line->instructions) + GeneralPopup( closest_line->instructions->instr_label, closest_line->instructions->instr_text, 0 ); + } + return 1; /* Stops other handlers from being invoked. */ +} + + +int mouse_unclicked( GtkWidget *widget, GdkEventButton *event, gpointer data ) +{ + printf("Mouse button %d Released at: %d, %d\n", (int)(event->button), (int)(event->x), (int)(event->y) ); + return 1; /* Stops other handlers from being invoked. */ +} + + +/* ----------------- End Tax Instructions Helper -------------------- */ + + +int whitespace_invariant_strstr( char *haystack, char *needle ) /* Return 1 if match, otherwise 0 if mismatch. */ +{ + int ret; + char *hay, *ne, *wrd1, *wrd2; + hay = strdup( haystack ); + wrd1 = (char *)malloc( strlen( haystack ) + 1 ); + ne = strdup( needle ); + wrd2 = (char *)malloc( strlen( needle ) + 1 ); + do + { + fb_next_word( hay, wrd1, " \t\n\r" ); + fb_next_word( ne, wrd2, " \t\n\r" ); + // printf("Comparing '%s' to '%s'\n", wrd1, wrd2 ); + } + while ((wrd2[0] != '\0') && (strcmp(wrd1,wrd2) == 0)); + if (wrd2[0] != '\0') + ret = 0; /* Mismatch. */ + else + ret = 1; /* Matched. */ + free( hay ); + free( ne ); + free( wrd1 ); + free( wrd2 ); + return ret; +} + +int check_form_version( char *title_as_read_in, char *expected_title ) +{ /* Check that Form input file matched intended Program. Return 1 if good. Or 0 if not-match. */ + char msg[4096]; + printf(" Comparing '%s' to '%s'\n", title_as_read_in, expected_title ); + if (whitespace_invariant_strstr( title_as_read_in, expected_title ) == 0) + { + // GeneralWarning( "Warning: Looks like wrong Form-file for selected tax-progam. ??" ); + strcpy(msg,"\nWarning: Looks like wrong Form-file for selected tax-progam. ??.\n"); + strcat(msg," Expecting: '"); + strcat(msg, expected_title ); + strcat(msg,"'\n But found: '"); + strcat(msg, title_as_read_in ); + strcat(msg,"'\n\nMaybe go back and switch your tax-selection or input file.\n\n" ); + GeneralPopup( "Warning:", msg, 1); + return 0; + } + else + return 1; +} + +void check_form_type( char *title_line ) +{ + printf("CHECKING: '%s'\n", title_line ); + switch (selected_form) + { + case form_US_1040: check_form_version( title_line, "Title: US Federal 1040 Tax Form" ); + break; + case form_US_1040_Sched_C: check_form_version( title_line, "Title: 1040 Schedule C" ); + break; + case form_PA_40: check_form_version( title_line, "Title: PA State Tax Form PA-40" ); + break; + case form_CA_540: check_form_version( title_line, "Title: CA State Tax Form 540" ); + break; + case form_OH_IT1040: check_form_version( title_line, "Title: Ohio IT1040 State" ); + break; + case form_VA_760: check_form_version( title_line, "Title: VA-760 State 2024" ); + break; + case form_NJ_1040: check_form_version( title_line, "Title: NJ-1040 State 2024" ); + break; + case form_NY_IT201: check_form_version( title_line, "Title: NY State 2024" ); + break; + case form_MA_1: check_form_version( title_line, "Title: Massachusetts Form 1 Tax Form" ); + break; + case form_NC_D400: check_form_version( title_line, "Title: NC State Tax Form 400 for 2024" ); + break; + case form_MI_1040: check_form_version( title_line, "Title: MI-1040" ); + break; + case form_OR_40: check_form_version( title_line, "Title: Oregon Form OR-40" ); + break; + default: + if (strstr( taxsolvestrng, "taxsolve_HSA_f8889" ) != 0) + check_form_version( title_line, "Title: 8889 HSA Form" ); + else + if (strstr( taxsolvestrng, "taxsolve_US_1040_Sched_SE" ) != 0) + check_form_version( title_line, "Title: 1040 Schedule SE" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8829" ) != 0) + check_form_version( title_line, "Title: 2024 Form 8829" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8995" ) != 0) + check_form_version( title_line, "Title: 2024 Form 8995" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8959" ) != 0) + check_form_version( title_line, "Title: 2024 Form 8959" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8960" ) != 0) + check_form_version( title_line, "Title: 2024 Form 8960" ); + else + if (strstr( taxsolvestrng, "taxsolve_f2210" ) != 0) + check_form_version( title_line, "Title: Form 2210 for Tax Year 2024" ); + else + if (strstr( taxsolvestrng, "taxsolve_f8812" ) != 0) + check_form_version( title_line, "Title: Form 8812 -" ); + else + if (strstr( taxsolvestrng, "taxsolve_CA_5805" ) != 0) + check_form_version( title_line, "Title: Form 5805" ); + } +} + + +/* Check if entry looks like a date. */ +/* If so, return 1, else return 0. */ +int datecheck( char *word ) +{ + int j, k=0; + + j = strlen(word) - 1; + while (j>0) + { + if ((word[j]=='-') || (word[j]=='/')) k++; + else if (word[j]>'9') return 0; + j--; + } + if (k==2) return 1; else return 0; +} + + +int interpret_boolean( char *word ) +{ + if ((toupper( word[0] ) == 'Y') || (toupper( word[0] ) == 'T') || (word[0] == '1')) + return 1; + return 0; +} + + +char *taxform_name; + + +/***********************/ +/* Read Tax Data File. */ +/***********************/ +void Read_Tax_File( char *fname ) +{ + int j, k, kind, state=0, column=0, + linenum=0, /* Line number in input file. */ + linecnt=0, /* Line number of gui display. */ + lastline=0, newentry=0, entrycnt=0; + int lastlinenum=-1; + char word[15000], *tmpstr, tmpstr2[900], tmpstr3[900]; + struct taxline_record *txline=0; + struct value_list *tmppt, *newitem, *oldtail; + + /* Read the Tax Data Form File. */ + current_working_filename = strdup(fname); + taxlines_hd = 0; + /* Accept the form's Title line. (Must be first line!) */ + fgets(word, 200, infile); + title_line = strdup( word ); + check_form_type( title_line ); + j = strlen(word); + if (j>0) word[j-1] = '\0'; + // printf("Title: '%s'\n", word); + if (strstr(word,"Title:")==word) tmpstr = &(word[6]); else tmpstr = &(word[0]); + k = strlen(tmpstr); /* Pad to center if title is too short. */ + if (k < 20) + { for (j=0; j<(20-k)/2; j++) tmpstr2[k]=' '; tmpstr2[(20-k)/2] = '\0'; + strcpy(tmpstr3,tmpstr2); strcat(tmpstr3,tmpstr); strcpy(tmpstr,tmpstr3); strcat(tmpstr,tmpstr2); + } + taxform_name = strdup( tmpstr ); + + kind = get_next_entry( word, 10000, &column, &linenum, infile ); + if (linenum > lastline) { lastline = linenum; if (newentry) linecnt++; newentry = 0; } + while (!feof(infile)) + { /*Loop1*/ + if (column == 1) state = 0; + if (verbose) printf("Kind=%d: state=%d: col=%d: lnum=%d: '%s'\n", kind, state, column, linenum, word); + switch (kind) + { + case VALUE_LABEL: + if (state==0) + { /*statezero*/ + if (verbose) printf(" LineLabel: '%s'\n", word); + state = 1; + entrycnt = 0; + txline = new_taxline( word, linecnt ); + if ((strcasecmp(txline->linename, "Your1stName:") == 0) || (strcasecmp(txline->linename, "YourName:") == 0) || + (strcasecmp(txline->linename, "YourLastName:") == 0) || (strcasecmp(txline->linename, "YourSocSec#:") == 0) || + (strcasecmp(txline->linename, "Spouse1stName:") == 0) || (strcasecmp(txline->linename, "SpouseLastName:") == 0) || + (strcasecmp(txline->linename, "YourInitial:") == 0) || (strcasecmp(txline->linename, "SpouseInitial:") == 0) || + (strcasecmp(txline->linename, "SpouseSocSec#:") == 0) || (strcasecmp(txline->linename, "Number&Street:") == 0) || + (strcmp(txline->linename, "YourBirthDate:") == 0) || (strcmp(txline->linename, "SpouseBirthDate:") == 0) || + (strcmp(txline->linename, "Apt#:") == 0) || (strcmp(txline->linename, "TownStateZip:") == 0) || + (strcmp(txline->linename, "Town:") == 0) || (strcmp(txline->linename, "State:") == 0) || + (strcmp(txline->linename, "Zipcode:") == 0) || (strstr( txline->linename, ":" ) != 0) || + (strcmp(txline->linename, "PrincipalBus:") == 0) || (strcmp(txline->linename, "BusinessName:") == 0)) + { + if (ots_column > 0) + { get_line_entry( word, 10000, &linenum, infile ); } + else + word[0] = '\0'; + tmppt = new_list_item_value( VKIND_TEXT, txline, word, column, linecnt ); + tmppt->formtype = ID_INFO; /* Special ID-only info lines. */ + state = 0; + } + } /*statezero*/ + else + { /*stateNotzero*/ + if (verbose) printf(" Value: %s\n", word); + if (strcasecmp(txline->linename, "Status") == 0) + { + new_list_item_value( VKIND_TEXT, txline, word, column, linecnt ); + state = 0; + } + else + { /*Accept normal value. */ + tmppt = new_list_item_value( VKIND_TEXT, txline, word, column, linecnt ); + if (strstr( txline->linename, ":" ) != 0) + tmppt->formtype = LITERAL_INFO; + if (strcmp( txline->linename, "Round_PDF_to_Whole_Dollars" ) == 0) + { + round_pdf_to_whole_dollars = interpret_boolean( word ); + rptwd_txline = tmppt; + } + entrycnt++; + } + } /*stateNotzero*/ + newentry++; + break; + case COMMENT: if (verbose) printf(" Comment: %s\n", word); + if ((txline==0) || ((strncasecmp(txline->linename, "CapGains",7) != 0) && (lastlinenum > 0) && (linenum > lastlinenum))) + txline = new_taxline("", linecnt); + new_list_item_value( VKIND_COMMENT, txline, word, column, linecnt ); + newentry++; + break; + case SEMICOLON: if (verbose) printf(" End: %s\n", word); + /* When line is labeled "CapGains", and there are no entries, */ + /* then produce extra boxes for date bought or sold. */ + /* So far, this is only known to be needed on US-Fed form. */ + if ((txline != 0) && ((strncasecmp(txline->linename, "Cap-Gains",8) == 0) || + (strncasecmp(txline->linename, "CapGains",7) == 0)) && (entrycnt < 2)) + { + new_list_item_value( VKIND_TEXT, txline, CAPGAIN_READY, column, linecnt ); + new_list_item_value( VKIND_TEXT, txline, "", column, linecnt++ ); + new_list_item_value( VKIND_TEXT, txline, "", column, linecnt ); + new_list_item_value( VKIND_TEXT, txline, "", column, linecnt++ ); + new_list_item_value( VKIND_TEXT, txline, "", column, linecnt ); + new_list_item_value( VKIND_TEXT, txline, "", column, linecnt++ ); + } + state = 0; + new_list_item_value( VKIND_COLON, txline, word, column, linecnt ); + lastlinenum = linenum; + break; + } + column = column + strlen(word); + lastlinenum = linenum; + kind = get_next_entry( word, 10000, &column, &linenum, infile ); + if (linenum > lastline) + { + if ((txline!=0) && (strncasecmp(txline->linename, "CapGains",7) == 0)) + { + if ((entrycnt % 6) == 0) + linecnt++; + } + lastline = linenum; + linecnt++; + newentry = 0; + } + } /*Loop1*/ + fclose(infile); + + /* Check for missing entries. */ + txline = taxlines_hd; + while (txline!=0) + { + tmppt = txline->values_hd; state = 0; + while (tmppt!=0) + { + if ((tmppt->kind==VKIND_FLOAT) || (tmppt->kind==VKIND_TEXT) || (tmppt->kind==VKIND_INT)) state = 1; + tmppt = tmppt->nxt; + } + if ((state==0) && (strlen(txline->linename)>0)) /* Place empty formbox on any line having no entries. */ + { + oldtail = txline->values_tl; + newitem = new_list_item_value( VKIND_TEXT, txline, "", 0, txline->linenum ); + if (newitem!=txline->values_hd) + { + newitem->nxt = txline->values_hd; + txline->values_hd = newitem; + txline->values_tl = oldtail; + oldtail->nxt = 0; + } + } + txline = txline->nxt; + } + //dump_taxinfo(); +} + + + +GtkWidget *options_window=0, *allforms_button; +int allforms_toggle=0; +double winopentime; + + +void set_pdf_option( GtkWidget *wdg, void *data ) +{ + if (Report_Time() - winopentime < 0.2) return; + allforms_toggle = !allforms_toggle; + printf("Allforms = %d\n", allforms_toggle ); +} + +void set_r2wn_option( GtkWidget *wdg, void *data ) +{ + // printf("dT = %g\n", Report_Time() - winopentime ); + if (Report_Time() - winopentime < 0.2) return; + round_to_whole_nums = !round_to_whole_nums; + printf("Round_to_Whole_Nums = %d\n", round_to_whole_nums ); + save_needed++; compute_needed = 1; +} + +void set_round_pdf_option( GtkWidget *wdg, void *data ) +{ + // printf("dT = %g\n", Report_Time() - winopentime ); + if (Report_Time() - winopentime < 0.2) return; + round_pdf_to_whole_dollars = !round_pdf_to_whole_dollars; + if (rptwd_txline) + { + rptwd_txline->value = round_pdf_to_whole_dollars; + if (round_pdf_to_whole_dollars) + rptwd_txline->text = strdup( "Yes" ); + else + rptwd_txline->text = strdup( "No" ); + modify_formbox( rptwd_txline->box, rptwd_txline->text ); + } + printf("Round_PDF_to_Whole_Dollars = %d\n", round_pdf_to_whole_dollars ); +} + +void options_pdf_diaglog( GtkWidget *wdg, void *data ) +{ + GtkWidget *panel; + int wd=400, ht=210, xpos=10, ypos=30; + panel = make_window( wd, ht, "Options Menu", &options_window ); + make_sized_label( panel, 5, 1, "Options Menu:", 12 ); + winopentime = Report_Time(); + allforms_button = make_toggle_button( panel, xpos, ypos, "Force production of All PDF Form Pages", allforms_toggle, set_pdf_option, "allforms" ); + ypos = ypos + 30; + make_toggle_button( panel, xpos, ypos, "Round Calculations to Whole Numbers", round_to_whole_nums, set_r2wn_option, 0 ); + ypos = ypos + 30; + make_toggle_button( panel, xpos, ypos, "Force PDF form-fill-out to Round to Whole Numbers", round_pdf_to_whole_dollars, set_round_pdf_option, 0 ); + ypos = ypos + 40; + make_button( panel, xpos, ypos, "Set PDF-Viewer", set_pdfviewer, 0 ); + make_button( panel, wd/2 - 30, ht - 35, " Close ", close_any_window, &options_window ); + show_wind( options_window ); +} + + + +void Setup_Tax_Form_Page( int init ) /* This is called whenever the form window needs to be redisplayed for any reason. */ +{ + GtkWidget *button; + GtkRequisition actual1, actual2; + int x1=1, xpos; + char *twrd; + float fontsz; + double T1; + + printf("Setting up Form Page ...\n"); + gtk_widget_destroy( mpanel ); /* Clear out panel. */ + mpanel = gtk_fixed_new(); + gtk_container_add( GTK_CONTAINER( outer_window ), mpanel ); + + /* Set up new panel with scrollbars for tax form data. */ + mpanel2 = gtk_fixed_new(); + scrolledpane = gtk_scrolled_window_new( 0, 0 ); + gtk_scrolled_window_set_policy( (GtkScrolledWindow *)scrolledpane, GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS ); + // gtk_scrolled_window_add_with_viewport( (GtkScrolledWindow *)scrolledpane, mpanel2 ); + gtk_container_add( GTK_CONTAINER( scrolledpane ), mpanel2 ); + + gtk_fixed_put( GTK_FIXED( mpanel ), scrolledpane, 0, 35 ); + gtk_widget_set_size_request( scrolledpane, winwidth, winht - 80 ); + operating_mode = 2; + + xpos = (int)(0.03 * (float)winwidth + 0.5); + // printf("\nwinwidth = %d, Save = %g, ", winwidth, (float)xpos / (float)winwidth ); + button = make_button( mpanel, xpos, winht - 35, " Save ", save_taxfile, "0" ); /* The "Save" button. */ + add_tool_tip( button, "Save your changes." ); + + xpos = (int)(0.165 * (float)winwidth + 0.5); + button = make_button( mpanel, xpos, winht - 35, "Compute Tax", Run_TaxSolver, 0 ); + add_tool_tip( button, "Run TaxSolver." ); + + xpos = (int)(0.355 * (float)winwidth + 0.5); + button = make_button( mpanel, xpos, winht - 35, " Print ", printout, 0 ); + add_tool_tip( button, "Print results." ); + + xpos = (int)(0.51 * (float)winwidth + 0.5); + button = make_button( mpanel, xpos, winht - 35, "Options", options_pdf_diaglog, 0 ); + add_tool_tip( button, "Review and set options." ); + + xpos = (int)(0.64 * (float)winwidth + 0.5); + button = make_button( mpanel, xpos, winht - 35, "Help", helpabout2, 0 ); + add_tool_tip( button, "Get information about this program,\n Help, and Updates." ); + + xpos = (int)(0.745 * (float)winwidth + 0.5); + button = make_button( mpanel, xpos, winht - 35, "Switch Form", switch_form, 0 ); + add_tool_tip( button, "Switch to-, or Open-, another form." ); + + xpos = (int)(0.93 * (float)winwidth + 0.5) - 20; + // printf("Exit = %1.2g\n", (float)xpos / (float)winwidth ); + button = make_button( mpanel, xpos, winht - 35, " Exit ", quit_wcheck, 0 ); + add_tool_tip( button, "Leave this program." ); + + twrd = (char *)malloc( strlen( taxform_name ) + 100 ); + strcpy( twrd, "" ); + strcat( twrd, taxform_name ); + strcat( twrd, "" ); + fontsz = 12.0; + title_label = make_sized_label( mpanel, x1, 10, twrd, fontsz ); /* Temporarily make label to get its size. */ + + //gtk_widget_size_request( (GtkWidget *)title_label, &actual ); + gtk_widget_show_all( title_label ); + gtk_widget_get_preferred_size( title_label, &actual1, &actual2 ); + + if (actual2.width > winwidth) + fontsz = fontsz * (float)winwidth / (float)actual2.width; + else + x1 = (winwidth - (actual2.width + 20)) / 2; + if (x1 < 0) x1 = 0; + gtk_widget_destroy( title_label ); + title_label = make_sized_label( mpanel, x1, 10, twrd, fontsz ); /* Remake label in centered position. */ + set_label_color( title_label, "#0000ff" ); + free( twrd ); + + if (init) + { + T1 = Report_Time(); + read_instructions( init ); + if (verbose) printf("\nRead_Instructions took %g Seconds.\n\n", Report_Time() - T1 ); + } + + g_signal_connect( outer_window, "button-press-event", G_CALLBACK( mouse_clicked ), NULL ); + // gtk_widget_add_events( outer_window, GDK_BUTTON_RELEASE_MASK ); + // g_signal_connect( outer_window, "button-release-event", G_CALLBACK( mouse_unclicked ), NULL ); + + DisplayTaxInfo(); + gtk_widget_show_all( outer_window ); +} + + +void Get_Tax_Form_Page( char *fname ) /* This is only called once, to bring up the initial form. */ +{ + Read_Tax_File( fname ); + Setup_Tax_Form_Page(1); +} + + +void Get_New_Tax_Form_Page( char *fname ) /* Transition from initial opening window to tax-form window. */ +{ + winwidth = 780; + winht = 700; + gtk_window_set_resizable( GTK_WINDOW( outer_window ), 1 ); + gtk_window_resize( (GtkWindow *)outer_window, winwidth, winht ); + Get_Tax_Form_Page( fname ); +} + + + +void check_comments() /* Make sure every line has a comment field. */ +{ + struct taxline_record *txline; + struct value_list *tmppt, *npt, *tail; + int ncomments; + + txline = taxlines_hd; + while (txline!=0) + { + ncomments = 0; + tmppt = txline->values_hd; + while (tmppt!=0) + { + if (tmppt->kind==VKIND_COMMENT) ncomments++; + if ((tmppt->nxt==0) || (tmppt->linenum != tmppt->nxt->linenum)) + { + if (ncomments==0) + { + if (debug) printf(" Adding empty missing comment to line %d\n", tmppt->linenum ); + new_list_item_value( VKIND_COMMENT, txline, "", 50, tmppt->linenum); + if (tmppt->nxt != txline->values_tl) + { + npt = txline->values_tl; + tail = tmppt->nxt; + while (tail->nxt != npt) tail = tail->nxt; + tail->nxt = 0; + txline->values_tl = tail; + npt->nxt = tmppt->nxt; + tmppt->nxt = npt; + } + } + ncomments = 0; + } + tmppt = tmppt->nxt; + } + txline = txline->nxt; + } +} + + +int startswith( char *line, char *phrase ) +{ /* Return true if first non-whitespace characters of line begin with pharse. */ + int j=0, k=0; + while ((line[j] != '\0') && (isspace(line[j]))) + j++; + while ((line[j] != '\0') && (line[j] == phrase[k]) && (phrase[k] != '\0')) + { j++; k++; } + if (phrase[k] == '\0') + return 1; + else + return 0; +} + + +struct choice_rec + { + char *word; + GtkEntry *box; + }; + + +void status_choice_S( GtkWidget *wdg, void *x ) +{ struct value_list *tmppt=(struct value_list *)x; + modify_formbox( tmppt->box, "Single" ); + if (filingstatus_mfj != 0) + re_display_form(); +} + +void status_choice_MJ( GtkWidget *wdg, void *x ) +{ struct value_list *tmppt=(struct value_list *)x; + modify_formbox( tmppt->box, "Married/Joint" ); + if (filingstatus_mfj != 1) + re_display_form(); +} + +void status_choice_MS( GtkWidget *wdg, void *x ) +{ struct value_list *tmppt=(struct value_list *)x; + modify_formbox( tmppt->box, "Married/Sep" ); + if (filingstatus_mfj != 0) + re_display_form(); +} + +void status_choice_HH( GtkWidget *wdg, void *x ) +{ struct value_list *tmppt=(struct value_list *)x; + modify_formbox( tmppt->box, "Head_of_Household" ); + if (filingstatus_mfj != 0) + re_display_form(); +} + +void status_choice_W( GtkWidget *wdg, void *x ) +{ struct value_list *tmppt=(struct value_list *)x; + modify_formbox( tmppt->box, "Widow(er)" ); + if (filingstatus_mfj != 0) + re_display_form(); +} + +void spinner_choice( GtkWidget *wdg, void *x ) +{ struct choice_rec *tmppt=(struct choice_rec *)x; + modify_formbox( tmppt->box, tmppt->word ); +} + + + + + +GtkEntry *active_entry; + +void set_included_file( char *fname ) +{ + // printf("OTS_RET_open_include_file: f='%s', dir='%s', wc='%s', fname='%s'\n", fname, directory_dat, wildcards_fb, filename_fb ); + if (include_file_name != 0) free( include_file_name ); + include_file_name = strdup( fname ); + if (strstr( include_file_name, " ")) + { /* If filename contains white-space, then add quotes around it. */ + char tmpfname[MaxFname]="\""; + strcat( tmpfname, include_file_name ); + strcat( tmpfname, "\"" ); + free( include_file_name ); + include_file_name = strdup( tmpfname ); + } + modify_formbox( active_entry, include_file_name ); +} + + +void open_include_file( GtkWidget *wdg, gpointer data ) +{ char *filename; + struct value_list *eb=(struct value_list *)data; + active_entry = eb->box; + filename = get_formbox( active_entry ); + if (filename[0] == '?') filename[0] = '\0'; /* Erase place-holder. */ + fb_clear_banned_files(); + strcpy( wildcards_incl, "_out.txt" ); + fb_extract_path_fname( filename, directory_incl, filename_incl ); + // printf("OTS_open_include_file: dir='%s', wc='%s', fname='%s'\n", directory_incl, wildcards_fb, filename_fb ); + Browse_Files( "File to Include:", 2048, directory_incl, wildcards_incl, filename_incl, set_included_file ); +} + + +void open_f8949_spreadsheet( GtkWidget *wdg, gpointer data ) +{ char *filename; + struct value_list *eb=(struct value_list *)data; + active_entry = eb->box; + filename = get_formbox( active_entry ); + if (filename[0] == '?') filename[0] = '\0'; /* Erase place-holder. */ + fb_clear_banned_files(); + strcpy( wildcards_incl, "_out.txt" ); + fb_extract_path_fname( filename, directory_incl, filename_incl ); + // printf("OTS_open_include_file: dir='%s', wc='%s', fname='%s'\n", directory_incl, wildcards_fb, filename_fb ); + Browse_Files( "Spreadsheet:", 2048, directory_incl, wildcards_spreadsheet, filename_incl, set_included_file ); +} + + +void escape_special_symbols( char *phrase, int maxlen ) +{ /* Replace any ampersand (&), quotes ("), or brackets (<,>), with XML escapes. */ + int j=0, k, m, n; + n = strlen(phrase); + do + { + if (phrase[j]=='&') + { + k = n + 4; m = n; n = n + 4; + if (n > maxlen) {printf("xml_Parse: MaxStrLen %d exceeded.\n",maxlen); return;} + do phrase[k--] = phrase[m--]; while (m > j); + j++; phrase[j++] = 'a'; phrase[j++] = 'm'; phrase[j++] = 'p'; phrase[j++] = ';'; + } else + if (phrase[j]=='"') + { + k = n + 5; m = n; n = n + 5; + if (n > maxlen) {printf("xml_Parse: MaxStrLen %d exceeded.\n",maxlen); return;} + do phrase[k--] = phrase[m--]; while (m > j); + phrase[j++] = '&'; phrase[j++] = 'q'; phrase[j++] = 'u'; phrase[j++] = 'o'; phrase[j++] = 't'; phrase[j++] = ';'; + } else + if (phrase[j]=='<') + { + k = n + 3; m = n; n = n + 3; + if (n > maxlen) {printf("xml_Parse: MaxStrLen %d exceeded.\n",maxlen); return;} + do phrase[k--] = phrase[m--]; while (m > j); + phrase[j++] = '&'; phrase[j++] = 'l'; phrase[j++] = 't'; phrase[j++] = ';'; + } else + if (phrase[j]=='>') + { + k = n + 3; m = n; n = n + 3; + if (n > maxlen) {printf("xml_Parse: MaxStrLen %d exceeded.\n",maxlen); return;} + do phrase[k--] = phrase[m--]; while (m > j); + phrase[j++] = '&'; phrase[j++] = 'g'; phrase[j++] = 't'; phrase[j++] = ';'; + } else j++; + } + while (phrase[j] != '\0'); +} + + +GtkWidget *make_bold_label( GtkWidget *panel, int xpos, int ypos, char *text ) +{ + GtkWidget *bpanel, *label; + char *tmptxt1, *tmptxt2; + bpanel = gtk_fixed_new(); + gtk_fixed_put( GTK_FIXED( panel ), bpanel, xpos, ypos ); + label = gtk_label_new( text ); + tmptxt1 = (char *)malloc( strlen(text) + 1000 ); + tmptxt2 = (char *)malloc( strlen(text) + 1000 ); + strcpy( tmptxt1, text ); + escape_special_symbols( tmptxt1, 1000 ); + sprintf( tmptxt2, "%s", tmptxt1 ); + gtk_label_set_markup( (GtkLabel *)label, tmptxt2 ); + gtk_container_add( GTK_CONTAINER( bpanel ), label ); + free( tmptxt1 ); + free( tmptxt2 ); + return label; +} + + +char check_for_illegal_symbols( char *phrase, char *illegal_characters ) +{ /* Check for any problematic chararcters in file-names or file-paths. */ + /* Return 0 if OK. Otherwise returns the illegal character encountered. */ + int j=0, k; + while (phrase[j] != '\0') + { + k = 0; + while ((illegal_characters[k] != '\0') && (phrase[j] != illegal_characters[k])) + k++; + if (illegal_characters[k] != '\0') + return illegal_characters[k]; + j++; + } + return 0; +} + + +void Check_for_illegal_characters_in_the_file_path( char *pathname ) +{ /* Check for any illegal characters in the file-path. */ + char ch, msg[4096]; + #ifdef __MINGW32__ + ch = check_for_illegal_symbols( pathname, "'|()!@#~<>#$%^&*={}[]`;,?\"\t" ); + #else + ch = check_for_illegal_symbols( pathname, "'|()!@#~<>#$%^&*={}[]`;:,?\"\t" ); + #endif + if (ch != 0) + { + sprintf(msg,"Problematic character: %c found in file-path.\nWill prevent proper operation of OTS.\nRemove illegal character. Or re-install OTS under a legal directory path\ncontaining only characters: A-Z, a-z, 0-9, _ (underscore), or . (dot).", ch ); + GeneralPopup( "Illegal Character", msg, 1 ); + } +} + + +char *mystrcasestr( char *haystack, char *needle ) +{ + int j=0; + char *hs, *ndl, *pt; + hs = strdup( haystack ); + while (hs[j] != '\0') { hs[j] = toupper( hs[j] ); j++; } + ndl = strdup( needle ); + j = 0; + while (ndl[j] != '\0') { ndl[j] = toupper( ndl[j] ); j++; } + pt = strstr( hs, ndl ); + if (pt != 0) + { + j = 0; + while (pt != &(hs[j])) j++; + pt = &(haystack[j]); + } + free( ndl ); + free( hs ); + return pt; +} + + +/*************************************************************************/ +/* Display the Tax Info - This routine constructs, lays-out and populates */ +/* the panels. Called after initial read-in and on updates. */ +/*************************************************************************/ +void DisplayTaxInfo() +{ + struct taxline_record *txline; + struct value_list *entry, *previous_entry=0; + GtkWidget *label, *button, *cbutton, *menu; + GtkRequisition req1, req2; + GtkEntry *lastbox=0; + char messg[4096]; + int linenum, iscapgains, noplus=0; + int capgtoggle=0, firstbox_on_line_x=0; + int y1, y1a, yoffset=4, y2, y3, dy; + int entry_box_height=1, extra_dy, sectionheader=1; + + int label_x0=2, label_width, label_x1, box_x0, box_width, box_x1=100, comment_x0; + int norm_label_x1=100, min_box_x0 = 110, min_comment_x0 = 100; + int horzpad=10; + + check_comments(); + y1 = 5; y1a = y1 + yoffset; dy = 75; + if (debug) dump_taxinfo(); + + /* Now place the form-data onto the pages. */ + if (debug) printf("\n--------- Now rendering interactive form-page ------------\n"); + txline = taxlines_hd; + while (txline != 0) + { + if ((filingstatus_mfj == 1) || (strstr( txline->linename, "Spouse" ) == 0)) + { /*DisplayLine*/ + /* Place the line label. */ + // printf("\nAdding LineLabel %d (%3d, %d): '%s'\n", txline->linenum, 2, y1a, txline->linename ); + label = make_label( mpanel2, 2, y1a, txline->linename ); + txline->vpos = y1a; + + // gtk_widget_size_request( label, &req ); /* First find the label's size. */ + gtk_widget_show_all( label ); + gtk_widget_get_preferred_size( label, &req1, &req2 ); /* First find the label's size. */ + + gtk_widget_destroy( label ); /* Remove it, then re-place it at best position. */ + label_width = req2.width; + label_x0 = norm_label_x1 - label_width - 4; + if (label_x0 < 0) label_x0 = 0; + if (debug) printf("%d: LineLabel '%s' at (%d, %d)\n",txline->linenum, txline->linename, label_x0, y1a ); + label = make_label( mpanel2, label_x0, y1a, txline->linename ); + if (txline->instructions) + set_label_color( label, "#0000a0" ); + label_x1 = label_x0 + label_width; + box_x0 = label_x1 + horzpad; + if (box_x0 < min_box_x0) box_x0 = min_box_x0; + comment_x0 = label_x1 + horzpad + 10; + button = 0; + lastbox = 0; + + if ((strncmp(txline->linename,"Cap-Gains",9) == 0) || (strncmp(txline->linename,"CapGains",8) == 0)) + iscapgains = 1; + else + iscapgains = 0; + + linenum = txline->linenum; + entry = txline->values_hd; + button = 0; capgtoggle = 0; extra_dy = 0; + while (entry != 0) + { /*entry*/ + if (linenum != entry->linenum) + { + y1 = y1 + dy + extra_dy; + y1a = y1 + yoffset; + linenum = entry->linenum; + extra_dy = 0; + comment_x0 = min_comment_x0; + if (debug) printf("\tLineNum now = %d\n", linenum ); + button = 0; + } + if (strstr( txline->linename, ":" ) != 0) noplus = 1; + switch (entry->kind) + { + case VKIND_FLOAT: /* This kind is presently not used at all. (or anymore?) */ + sprintf(messg, "%12.2f", entry->value ); + entry->box = make_formbox( mpanel2, box_x0, y1, 12, messg, 500, 0, 0 ); + lastbox = entry->box; + + // gtk_widget_size_request( (GtkWidget *)(entry->box), &req ); + gtk_widget_show_all( (GtkWidget *)(entry->box) ); + gtk_widget_get_preferred_size( (GtkWidget *)entry->box, &req1, &req2 ); + + box_width = req2.width; + entry_box_height = req2.height; + box_x1 = box_x0 + box_width; + comment_x0 = box_x1 + horzpad; + if (debug) printf("\tFloat-FormBox(%d-%d, %d) = '%s'\n", box_x0, box_x1, y1, messg ); + y2 = y1 + entry_box_height - 1; + button = make_button_wsizedcolor_text( mpanel2, box_x1 - 15, y2, "+", 8.0, "#000000", add_new_box_item, entry ); /* Add another box - button */// button = make_button( mpanel2, box_x1 - 15, y2, "+", add_new_box_item, entry ); /* Add another box - button */ + add_tool_tip( button, "Add another entry box\nfor this line." ); + break; + + case VKIND_INT: + if (debug) printf("\tUnhandled VKIND_INT happened (%d) ??\n", (int)(entry->value)); + break; + + case VKIND_TEXT: + if (debug) printf("\tText-FormBox: '%s' formtype = %d\n", entry->text, entry->formtype ); + + if (entry->formtype == 0) + { /*normal*/ + entry->box = make_formbox( mpanel2, box_x0, y1, 12, entry->text, 500, 0, 0 ); + if (debug) printf("\t\tPlaced type0 at (%d, %d) 12-wide\n", box_x0, y1 ); + } + else + { + if (entry->formtype == ID_INFO) + { + entry->box = make_formbox( mpanel2, box_x0, y1, 24, entry->text, 500, 0, 0 ); + if (debug) printf("\t\tPlaced type2 at (%d, %d) 24-wide\n", box_x0 + 20, y1 ); + } + else + { /*Literal_Info*/ + entry->box = make_formbox( mpanel2, box_x0, y1, 10, entry->text, 500, 0, 0 ); + if (debug) printf("\t\tPlaced type1 at (%d, %d) 10-wide\n", box_x0 + 20, y1 ); + } + noplus = 1; + } + lastbox = entry->box; + + // gtk_widget_size_request( (GtkWidget *)(entry->box), &req ); + gtk_widget_show_all( (GtkWidget *)(entry->box) ); + gtk_widget_get_preferred_size( (GtkWidget *)(entry->box), &req1, &req2 ); + + box_width = req2.width; + entry_box_height = req2.height; + box_x1 = box_x0 + box_width; + comment_x0 = box_x1 + horzpad; + + previous_entry = entry; + if (strcmp(txline->linename,"Status") == 0) + { + menu = make_menu_button( mpanel2, box_x1 + 3, y1a-2, "^" ); + add_tool_tip( most_recent_menu, "Click to select filing status\nfrom available choices." ); + add_menu_item( menu, "Single", status_choice_S, entry ); + add_menu_item( menu, "Married/Joint", status_choice_MJ, entry ); + add_menu_item( menu, "Married/Sep", status_choice_MS, entry ); + add_menu_item( menu, "Head_of_Household", status_choice_HH, entry ); + add_menu_item( menu, "Widow(er)", status_choice_W, entry ); + comment_x0 = comment_x0 + 20; + if (strlen( entry->text ) > 2) + { + if (mystrcasestr( entry->text, "Married/Joint" ) != 0) + filingstatus_mfj = 1; + else + filingstatus_mfj = 0; + } + } + else + if (iscapgains) + { + switch (capgtoggle) + { + case 0: + make_label( mpanel2, box_x0 + 15, y1 - 16, "Buy Cost" ); + firstbox_on_line_x = box_x0; + box_x0 = comment_x0; + capgtoggle++; + + y2 = y1 + 15; + button = make_button_wsizedcolor_text( mpanel2, 60, y2 - 15, "Clear", 8.0, "#000000", verify_capgain_reset, entry ); + add_tool_tip( button, "Clear all data for this CapGain\nSet Buy Cost box to Ready" ); + + break; + case 1: + make_label( mpanel2, box_x0 + 15, y1 - 16, "Date Bought" ); + box_x0 = firstbox_on_line_x; + capgtoggle++; + break; + + case 2: + make_label( mpanel2, box_x0 + 15, y1 - 16, "Sold For" ); + box_x0 = comment_x0; + capgtoggle++; + break; + case 3: + make_label( mpanel2, box_x0 + 15, y1 - 16, "Date Sold" ); + box_x0 = firstbox_on_line_x; + capgtoggle++; + break; + + + case 4: + make_label( mpanel2, box_x0 + 15, y1 - 16, "Adj Code" ); + box_x0 = comment_x0; + capgtoggle++; + break; + + case 5: + make_label( mpanel2, box_x0 + 15, y1 - 16, "Adj Amnt" ); + capgtoggle = 0; + y2 = y1 + entry_box_height - 1; + button = make_button_wsizedcolor_text( mpanel2, box_x1 - 15, y2, "+", 8.0, "#000000", add_new_capgain_boxes, entry ); /* Add more boxes - button */ + add_tool_tip( button, "Add another set of entry\nboxes for another\ncap-gains entry." ); + extra_dy = 23; + box_x0 = firstbox_on_line_x; + break; + default: capgtoggle = 0; + } + } + else + if (!noplus) + { + y2 = y1 + entry_box_height - 1; + button = make_button_wsizedcolor_text( mpanel2, box_x1 - 15, y2, "+", 8.0, "#000000", add_new_box_item, entry ); /* Add another box - button */ + add_tool_tip( button, "Add another entry box\nfor this line." ); + } + break; + + case VKIND_COMMENT: + if (debug) printf("\tComment {%s} at (%d, %d)\n", entry->comment, comment_x0, y1a ); + + if (startswith( entry->comment, "--" )) + { /*Section_header*/ + sectionheader = 1; + y1 = y1 + 10; + y1a = y1a + 10; + if (startswith( entry->comment, "---" )) + { + comment_x0 = 20; + sectionheader = 2; + } + } + if ((lastbox != 0) && (strstr( entry->comment, "(answer: " ) != 0)) + { char tmpline[1024], tmpword[512]; /* Add choices-spinner. */ + struct choice_rec *choice_item; + int j=0; + if (button != 0) { gtk_widget_destroy( button ); button = 0; } + strcpy( tmpline, strstr( entry->comment, "(answer: " ) ); + while ((tmpline[j] != '\0') && (tmpline[j] != ')')) j++; + if (tmpline[j] == ')') tmpline[j] = '\0'; + fb_next_word( tmpline, tmpword, " \t," ); + fb_next_word( tmpline, tmpword, " \t," ); + menu = make_menu_button( mpanel2, box_x1 + 3, y1a-2, "^" ); + add_tool_tip( most_recent_menu, "Click to select available choices." ); + while (tmpword[0] != '\0') + { + if (strcmp( tmpword, "...") != 0) + { + choice_item = (struct choice_rec *)malloc( sizeof(struct choice_rec) ); + choice_item->box = lastbox; + choice_item->word = strdup( tmpword ); + add_menu_item( menu, tmpword, spinner_choice, choice_item ); + } + fb_next_word( tmpline, tmpword, " \t," ); + } + comment_x0 = comment_x0 + 20; + } + + // printf(" Comment %d (%3d, %3d): '%s'\n", txline->linenum, comment_x0, y1a, entry->comment ); + if (sectionheader < 2) + label = make_label( mpanel2, comment_x0, y1a, entry->comment ); + else + label = make_bold_label( mpanel2, comment_x0, y1a, entry->comment ); + entry->comment_label = label; + + /* Add edit_line_comment button */ + if ((!sectionheader) && (entry_box_height != 0)) + { GtkRequisition req1, req2; + // gtk_widget_size_request( entry->comment_label, &sz ); + gtk_widget_show_all( (GtkWidget *)(entry->comment_label) ); + gtk_widget_get_preferred_size( (GtkWidget *)(entry->comment_label), &req1, &req2 ); + + y3 = y1 + entry_box_height - 1; + if (comment_x0 + req2.width < winwidth - 65) + y2 = y1 + 0.25 * entry_box_height - 1; + else + y2 = y1 + entry_box_height - 1; + + cbutton = make_button_wsizedcolor_text( mpanel2, winwidth - 40, y2 - 4, "#", 7.0, "#000000", edit_line_comment, entry ); + add_tool_tip( cbutton, "Edit the comment for\nthis line." ); + if ((strstr( entry->comment, "File-name") != 0) && (previous_entry != 0)) + { + if (button != 0) { gtk_widget_destroy( button ); button = 0; } + if (strstr( entry->comment, "spread-sheet") == 0) + { + cbutton = make_button_wsizedcolor_text( mpanel2, comment_x0 + 40, y3 - 4, "Browse", 7.0, "#0000ff", open_include_file, previous_entry ); + add_tool_tip( cbutton, "Browse for tax return\noutput file to reference." ); + } + else + { + cbutton = make_button_wsizedcolor_text( mpanel2, comment_x0 + 40, y3 - 4, "Browse", 7.0, "#0000ff", open_f8949_spreadsheet, previous_entry ); + add_tool_tip( cbutton, "Browse for optional f8949 SpreadSheet\nCSV file for cap-gains+losses." ); + } + } + } + + if (strstr( entry->comment, "\n" )) /* Add extra line spacing for multi-line comments. */ + { int j=0; + while ( entry->comment[j] != 0) { if (entry->comment[j] == '\n') y1 = y1 + 0.2 * dy; j++; } + } + sectionheader = 0; + break; + } + noplus = 0; + entry = entry->nxt; + } /*entry*/ + + y1 = y1 + dy; + y1a = y1 + yoffset; + } /*DisplayLine*/ + else + txline->values_hd->box = 0; + + txline = txline->nxt; + } + if (debug) printf("\n--------- Done rendering interactive form-page ------------\n"); +} + + + + +void dump_taxinfo() +{ + struct taxline_record *txline; + struct value_list *tmppt; + + printf("\n======================================\n"); + printf("Line#, Kind, formtype: Value\n--------------------\n"); + txline = taxlines_hd; + while (txline != 0) + { + printf("\n%d: %s\n", txline->linenum, txline->linename ); + tmppt = txline->values_hd; + while (tmppt != 0) + { + switch (tmppt->kind) + { + case VKIND_FLOAT: printf("\t%d,F,%d: %6.2f\n", tmppt->linenum, tmppt->formtype, tmppt->value ); break; + case VKIND_INT: printf("\t%d,I,%d: %d\n", tmppt->linenum, tmppt->formtype, (int)(tmppt->value) ); break; + case VKIND_TEXT: printf("\t%d,T,%d: %s\n", tmppt->linenum, tmppt->formtype, tmppt->text ); break; + case VKIND_COMMENT: printf("\t%d,C: {%s}\n", tmppt->linenum, tmppt->comment ); break; + case VKIND_COLON: printf("\t%d,s:\n", tmppt->linenum ); break; + default: printf("\t%d,U: \n", tmppt->linenum ); break; + } + tmppt = tmppt->nxt; + } + txline = txline->nxt; + } + printf("\n"); +} + + + +char *my_strcasestr( char *line, char *srchstr ) +{ /* Define portable version of "non-std" C-extension function that is not (yet?) available on all platforms. */ + int j=0, k; + while (line[j] != '\0') + { + k = 0; + while ((line[j+k] != '\0') && (srchstr[k] != '\0') && (toupper( line[j+k] ) == toupper( srchstr[k]))) + k++; + if (srchstr[k] == '\0') { return &(line[j]); } + j++; + } + return 0; +} + + +void check_valid_date( char *str ) +{ /* Ensure that a date string has valid delimiters ("-" or "/"); NO spaces. */ + /* Must have 3 terms, separated by non-space delimiter. */ + int j=0, k=0; + char *outstr, delim='-'; + outstr = strdup( str ); + + while (str[j] == ' ') /* Get past any initial white-space(s). */ + j++; + do /* Copy 1st term until next delimiter. */ + outstr[k++] = str[j++]; + while ((str[j-1] != '\0') && (str[j-1] != '-') && (str[j-1] != '/') && (str[j-1] != ' ') && (str[j-1] != '.') && (str[j-1] != ',')); + if ((str[j-1] != '\0') && (str[j-1] != '-') && (str[j-1] != '/')) + outstr[k-1] = delim; + if (str[j-1] == '\0') + j = j - 1; + else + delim = outstr[k-1]; + + while ((str[j] == ' ') || (str[j] == '-') || (str[j] == '/')) /* Get past any intervening white-space(s) or deliminters. */ + j++; + do /* Copy 2nd term until next delimiter. */ + outstr[k++] = str[j++]; + while ((str[j-1] != '\0') && (str[j-1] != '-') && (str[j-1] != '/') && (str[j-1] != ' ') && (str[j-1] != '.') && (str[j-1] != ',')); + if ((str[j-1] != '\0') && (str[j-1] != delim)) + outstr[k-1] = delim; + if (str[j-1] == '\0') + j = j - 1; + + while ((str[j] == ' ') || (str[j] == '-') || (str[j] == '/')) /* Get past any intervening white-space(s) or deliminters. */ + j++; + do /* Copy 3rd term until end. */ + outstr[k++] = str[j++]; + while ((str[j-1] != '\0') && (str[j-1] != ' ')); + + strcpy( str, outstr ); /* Save temporary result string back to original string. */ + free( outstr ); +} + + +int lookaheadvals( struct value_list *linept ) +{ /* Look ahead and count the number of any remaining values in the list of items for the given line pointer. */ + int nn=0; + while (linept != 0) + { + if ((linept->kind==VKIND_FLOAT) || (linept->kind==VKIND_TEXT) || (linept->kind==VKIND_INT)) + nn++; + linept = linept->nxt; + } + return nn; +} + + +void capgain_ready_warning(char ready_val[5][1024], char ready_comment[2][1024]) /* Used in Save_TaxFile, VKIND_TEXT, iscapgains true */ +{ + char msg[4096]; + sprintf(msg, "CapGain * Ready * Entries are NOT Written to the Save File\n"); + sprintf(msg + strlen(msg), "However, there are non-empty boxes present.\n\n"); + sprintf(msg + strlen(msg), "If you wish to preserve non-empty boxes, fill in the Buy Cost box.\n\n"); + sprintf(msg + strlen(msg), "%-12s%-12s%-12s\n\n", ready_val[0], ready_val[1], ready_comment[0]); + sprintf(msg + strlen(msg), "%-12s%-12s%-12s\n\n", ready_val[2], ready_val[3], ready_comment[1]); + sprintf(msg + strlen(msg), "%-12s%-12s%-12s\n", ready_val[4], ready_val[5], ready_comment[2]); + GeneralPopup( "Caution Advisory:", msg, 1); +} + + +void Save_Tax_File( char *fname ) +{ + struct taxline_record *txline; + struct value_list *tmppt; + int lastline=-1, semicolon, j, newline; + char *suffix, *tmpstr; + FILE *outfile; + + // printf("OTS_save_taxfile RET: f='%s' dir='%s', wc='%s', fname='%s'\n", fname, directory_dat, wildcards_fb, filename_fb ); + if (current_working_filename != 0) free( current_working_filename ); + current_working_filename = strdup( fname ); + + /* Update the data structure(s) by getting the form fields. */ + Update_box_info(); + + /* Prevent weird characters in the save-name. */ + if (1) /* 1 = Protect users from creating bad filenames. 0 = Let them do whatever. */ + { + j = strlen( current_working_filename ) - 1; /* Find leaf-name, to skip over path name. */ + while ((j >= 0) && (current_working_filename[j] != '/') && (current_working_filename[j] != '\\')) + j--; + j++; /* Will be at last slash or first character in file name. */ + while (current_working_filename[j] != '\0') + { + #ifdef __MINGW32__ + if ((current_working_filename[j] == ':') && (j == 1)) + ; /* Allow ':' as second character - only. */ + else + #endif + if ((current_working_filename[j] < '+') || (current_working_filename[j] > 'z') || + (current_working_filename[j] == ',')) + { + if (current_working_filename[j] != ' ') + current_working_filename[j] = '_'; + } + else + if ((current_working_filename[j] > '9') && (current_working_filename[j] < 'A')) + current_working_filename[j] = '_'; + else + if ((current_working_filename[j] > ']') && (current_working_filename[j] < 'a')) + current_working_filename[j] = '_'; + j++; + } + } + + suffix = my_strcasestr( current_working_filename, ".txt" ); + if ((suffix == 0) || (strcasecmp( suffix, ".txt" ) != 0)) + { + tmpstr = (char *)malloc( strlen( current_working_filename ) + 10 ); + strcpy( tmpstr, current_working_filename ); + strcat( tmpstr, ".txt" ); + current_working_filename = tmpstr; + } + + suffix = my_strcasestr( current_working_filename, "_out.txt" ); + if ((suffix != 0) && (strcasecmp( suffix, "_out.txt" ) == 0)) + { + warn_release = 2; + GeneralWarning( "Your are saving an 'input-file', but the file name you picked looks like an output file." ); + return; + } + + if ((my_strcasestr( current_working_filename, "_template.txt" ) != 0)) + { + warn_release = 2; + GeneralWarning( "Your are saving over the 'template' file. Please choose a new unique name." ); + return; + } + + outfile = fopen(current_working_filename, "w"); + if (outfile==0) + { + sprintf(wmsg,"ERROR: Output file '%s' could not be opened for writing.", current_working_filename ); + warn_release = 2; + GeneralWarning( wmsg ); + return; + } + if (yourfilename != 0) free( yourfilename ); + yourfilename = strdup( current_working_filename ); + fprintf(outfile,"%s", title_line); + + if (round_to_whole_nums) + fprintf(outfile,"\nRound_to_Whole_Dollars\n"); + + txline = taxlines_hd; + while (txline!=0) + { /*txline*/ + int numvals=0, numcoms=0, iscapgains, capgain_ready_flg=0, ReadyErrFlg=0, tilde_flg=0; + char ready_val[6][1024], ready_comment[3][1024]={{0}}; /* Used by capgain_ready_warning */ + int valcnt=0, comcnt=0; /* Counters for an individual gain */ + // printf("\nNewTaxLine: '%s' (linenum = %d)\n", txline->linename, txline->linenum ); + fprintf(outfile,"\n%s", txline->linename ); /* Write line-label, if any. */ + if (strncasecmp(txline->linename, "CapGains",7) == 0) + iscapgains = 1; + else + iscapgains = 0; + semicolon = 0; + newline = 0; + lastline = txline->linenum; + tmppt = txline->values_hd; + while (tmppt!=0) /* Now write the line-value(s), comment(s), and ";", if any. */ + { /*line_item*/ + if (valcnt == 6) /* Counters and flags to enable Capgain Reset */ + { + valcnt = 0; + comcnt = 0; + capgain_ready_flg = 0; + ReadyErrFlg = 0; + tilde_flg = 0; + } + + switch (tmppt->kind) + { + case VKIND_FLOAT: + if (newline) fprintf(outfile,"\n"); + fprintf(outfile," %6.2f ", tmppt->value ); + numvals++; + // printf(" FloatValue: '%6.2f' (linenum = %d)\n", tmppt->value, tmppt->linenum ); + break; + case VKIND_INT: + if (newline) fprintf(outfile,"\n"); + fprintf(outfile," %d ", (int)(tmppt->value) ); + numvals++; + // printf(" IntValue: '%d' (linenum = %d)\n", (int)(tmppt->value), tmppt->linenum ); + break; + case VKIND_TEXT: + if (iscapgains) + { + /* Handle capgain_ready_flg */ + if ( valcnt == 0 && (strcmp(tmppt->text, CAPGAIN_READY) == 0 ) ) capgain_ready_flg = 1; + if (capgain_ready_flg == 0) + { + tilde_flg=0; + if ( (strlen(tmppt->text) == 0 ) ) /* Check for empty capgains box */ + { + //GeneralWarning ("Detected Empty CapGains Box, Inserting '~' into save file."); + tilde_flg=1; + } + if (lastline != tmppt->linenum) + { int j; for (j=0; j < tmppt->linenum - lastline; j++) fprintf(outfile,"\n"); lastline++; } + if (tilde_flg==1) + fprintf(outfile," ~ "); + else + { + if ((valcnt == 1) || (valcnt == 3)) + { /*CheckCapGain_DateFormat*/ + char *orig; + orig = strdup( tmppt->text ); + check_valid_date( tmppt->text ); + if (strcmp( orig, tmppt->text ) != 0) + modify_formbox( tmppt->box, tmppt->text ); + free( orig ); + } /*CheckCapGain_DateFormat*/ + fprintf(outfile," %s ", tmppt->text ); + } + if (valcnt==5 && ReadyErrFlg==1) capgain_ready_warning(ready_val, ready_comment); /* Display Warning Message */ + } // capgain_ready_flg == 0 + else + { /* capgain_ready_flg = 1, "Ready" is in Buy Cost box, Do Error trapping. Do NOT save to input.txt file. */ + strcpy(ready_val[valcnt], tmppt->text) ; /* Collect the capgain data values in array ready_val */ + /* A "Ready" gain/loss should only contain empty or "~" values */ + if ( (valcnt > 0) && (strlen(tmppt->text) != 0) && (strcmp(tmppt->text, "~") != 0 ) ) ReadyErrFlg = 1; + if (valcnt==5 && ReadyErrFlg==1) capgain_ready_warning(ready_val, ready_comment); /* Display Warning Message */ + } + } /* iscapgains */ + else + { /*RegularValue*/ + if (newline) fprintf(outfile,"\n"); + fprintf(outfile," %s ", tmppt->text ); + } /*RegularValue*/ + valcnt++; + numvals++; + // printf(" TextValue: '%s' (linenum = %d)\n", tmppt->text, tmppt->linenum ); + break; + case VKIND_COMMENT: + if (tmppt->linenum != lastline) fprintf(outfile,"\n\t"); + if ( (strlen(tmppt->comment)>0)) + { + if (capgain_ready_flg == 0) fprintf(outfile," {%s}", tmppt->comment ); + else + { + strcpy(ready_comment[comcnt], tmppt->comment); /* CapGain Ready gain/loss */ + comcnt++; + } + } + // printf(" Comment: '%s' (linenum = %d)\n", tmppt->comment, tmppt->linenum ); + numcoms++; + break; + case VKIND_COLON: + if ((numvals < 2) && (numcoms == 0) && (lookaheadvals(tmppt->nxt) == 0)) + fprintf(outfile,"\t;"); + else + semicolon = 1; + // printf(" SemiColon: numvals = %d (linenum = %d)\n", numvals, tmppt->linenum ); + break; + } + newline = 1; + lastline = tmppt->linenum; + tmppt = tmppt->nxt; + } /*line_item*/ + + if (semicolon) + { + fprintf(outfile,"\n"); + fprintf(outfile," ;"); + } + txline = txline->nxt; + } /*txline*/ + + + fprintf(outfile,"\n"); + dump_any_markup_commands( outfile ); + fclose(outfile); + save_needed = 0; + printf("\nWrote form-data to file %s\n.", yourfilename ); + if (pending_compute == 2) + taxsolve(); +} + + + +void open_taxfile( char *filename ) +{ + if (yourfilename == 0) + yourfilename = strdup( filename ); + infile = fopen(filename,"r"); + if (infile==0) + { + printf("ERROR: Input file '%s' could not be opened.\n", filename); + GeneralWarning("Error: Tax file could not be opened."); + return; + } + else + { + Get_New_Tax_Form_Page( filename ); + } +} + + + +void save_taxfile( GtkWidget *wdg, void *data ) +{ + char *cpt, *param; + char *directory_save; // Pointer to directory to use; either current, or overriden by working_dir + if (verbose) printf("File-Save Dialog at: '%s'\n", directory_dat ); + param = (char *)data; + if (param[0] == '0') pending_compute = 0; + fb_clear_banned_files(); + fb_ban_files( "_out.txt" ); + fb_ban_files( "_template.txt" ); + fb_ban_files( "README" ); + strcpy( wildcards_fb, ".txt" ); + fb_extract_path_fname( yourfilename, directory_dat, filename_fb ); + cpt = strstr( filename_fb, "_template.txt" ); + if (cpt != 0) + strcpy( cpt, "_xxxx.txt" ); + + if (strlen(workdir) > 0) + directory_save = workdir; + else + directory_save = directory_dat; + printf("OTS_save_taxfile: dir='%s', wc='%s', fname='%s'\n", directory_save, wildcards_fb, filename_fb ); + Browse_Files( "File to Save As:", 2048, directory_save, wildcards_fb, filename_fb, Save_Tax_File ); +} + + +void predict_output_filename(char *indatafile, char *outfname) +{ + int j; + /* Base name of output file on input file. */ + strcpy( outfname, indatafile ); + j = strlen(outfname) - 1; + while ((j >= 0) && (outfname[j] != '.')) j--; + if (j < 0) strcat( outfname, "_out.txt" ); else strcpy( &(outfname[j]), "_out.txt" ); +} + + + +void set_tax_solver( char *fname ) +{ + if (verbose) printf("OTS_set_tax_solver RET: file='%s', dir='%s', wc='%s', fname='%s'\n", fname, toolpath, wildcards_fb, filename_fb ); + taxsolvecmd = strdup( fname ); + strcpy( taxsolvestrng, taxsolvecmd ); + + selected_form = form_other; + other_form_selected = 1; + if (strstr( taxsolvestrng, "taxsolve_HSA_f8889" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "HSA_Form_8889" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_f8606" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "Form_8606" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_US_1040_Sched_SE" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "US_1040_Sched_SE" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_f8829" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "Form_8829" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_f8995" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "Form_8995" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_f8959" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "Form_8959" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_f8960" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "Form_8960" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_f2210" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "Form_2210" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_f8812" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "Form_8812" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_CA_5805" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "Form_CA_5805" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_MI_1040" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "MI_1040" ); + } + else + if (strstr( taxsolvestrng, "taxsolve_OR_40" ) != 0) + { + supported_pdf_form = 1; + strcat( directory_dat, slashstr ); /* Set the directory name for the form template & example files. */ + strcat( directory_dat, "OR_40" ); + } +} + + +void canceltxslvr( GtkWidget *wdg, void *data ) +{ + gtk_widget_destroy( resultswindow ); + resultswindow = 0; +} + + + +int missingfile=0; + + +void filter_tabs( char *line ) +{ /* Replace tabs and with spaces for clean printouts. */ + char *ptr; + + ptr = strchr( line, '\r' ); + if (ptr != 0) + ptr[0] ='\0'; + + ptr = strchr( line, '\n' ); + if (ptr != 0) + ptr[0] ='\0'; + + ptr = strchr( line, '\t' ); + while (ptr != 0) + { + ptr[0] = ' '; + ptr = strchr( line, '\t' ); + } +} + + +void set_invocation_path( char *toolpath ) +{ + char tmpstr[MaxFname]; + int k; + strcpy(tmpstr, invocation_path); + k = strlen(tmpstr)-1; + while ((k > 0) && (tmpstr[k] != slashchr)) k--; + if (k > 0) k--; + while ((k > 0) && (tmpstr[k] != slashchr)) k--; + if (tmpstr[k] == slashchr) + tmpstr[k+1] = '\0'; + else +#if (PLATFORM_KIND==Posix_Platform) + {sprintf(tmpstr,".%c", slashchr);} + if (strstr( invocation_path, "bin" ) != 0) + sprintf( toolpath, "%sbin%c", tmpstr, slashchr); + else + strcpy( toolpath, "./" ); + #else + tmpstr[k] = '\0'; + sprintf( toolpath, "%sbin%c", tmpstr, slashchr); + #endif +} + + +void quote_file_name( char *fname ) /* Place quotes around a file name. With special care on Microsoft systems. */ +{ /* Enables proper operation when files or pathnames have spaces in them. */ + char *tmpstr; + if ((fname[0] == '\0') || (strstr( fname, "\"" ) != 0)) return; + tmpstr = (char *)malloc( strlen(fname) + 10 ); + #if (PLATFORM_KIND == Posix_Platform) + strcpy( tmpstr, "\"" ); + strcat( tmpstr, fname ); + #else + if (fname[1] == ':') + { /* Leading quote must be inserted after drive letter for Microsoft OS's. */ + int j; + tmpstr[0] = fname[0]; + tmpstr[1] = fname[1]; + tmpstr[2] = '"'; + j = 2; + do { tmpstr[j+1] = fname[j]; j++; } while (tmpstr[j] != '\0'); + } + else + { + strcpy( tmpstr, "\"" ); + strcat( tmpstr, fname ); + } + #endif + strcpy( fname, tmpstr ); + strcat( fname, "\"" ); + free(tmpstr); +} + + +void quote_MS_file_name( char *fname ) /* Place quotes around a file name. With special care on Microsoft systems. */ +{ /* Enables proper operation of Edge Viewer when files or pathnames have spaces in them. */ + #if (PLATFORM_KIND != Posix_Platform) + char *tmpstr; + int j=0, k=0; + if ((fname[0] == '\0') || (strstr( fname, "\"" ) != 0)) + return; + tmpstr = (char *)malloc( strlen(fname) + 512 ); + if (fname[1] == ':') + { /* Leading quote must be inserted after drive letter for Microsoft OS's. */ + int j; + tmpstr[0] = fname[0]; + tmpstr[1] = fname[1]; + tmpstr[2] = '"'; + j = 2; + do { tmpstr[j+1] = fname[j]; j++; } while (tmpstr[j] != '\0'); + strcpy( fname, tmpstr ); + strcat( fname, "\"" ); + } + else + { + while (fname[j] != '\0') + { + if (fname[j] == ' ') + { + tmpstr[k++] = '"'; + tmpstr[k++] = fname[j]; + tmpstr[k++] = '"'; + } + else + tmpstr[k++] = fname[j]; + j++; + } + tmpstr[k] = '\0'; + strcpy( fname, tmpstr ); + } + free(tmpstr); + #endif +} + + +void taxsolve() /* "Compute" the taxes. Run_TaxSolver. */ +{ + char cmd[MaxFname+512], outfname[MaxFname]; + GtkWidget *panel, *label; + GtkTreeStore *mylist; + GtkTreeIter iter; + FILE *viewfile; + char vline[9000], *errmsg=0; + int wd, ht, valid_results=1, linesread=0; + + if (current_working_filename == 0) + { + GeneralWarning( "No tax file selected." ); + return; + } + if (strlen(taxsolvestrng) > 0) + taxsolvecmd = taxsolvestrng; + if (taxsolvecmd == 0) + taxsolvecmd = getenv("taxsolvecmd"); + if (taxsolvecmd == 0) + { + set_invocation_path( toolpath ); + fb_clear_banned_files(); + fb_ban_files( ".txt" ); + fb_ban_files( ".pdf" ); + strcpy( wildcards_fb, "" ); + strcpy( filename_fb, "" ); + // printf("OTS_taxsolve: dir='%s', wc='%s', fname='%s'\n", toolpath, wildcards_fb, filename_fb ); + Browse_Files( "Select Tax Program to Use:", 2048, toolpath, wildcards_fb, filename_fb, set_tax_solver ); + place_window_atmouse(); /* Temporarily change the new window position policy. */ + GeneralWarning( "No tax solver selected. Re-try after selecting." ); + place_window_center(); /* Restore the normal window position policy. */ + return; + } + + if ((allforms_toggle) && ((selected_form == form_US_1040) || (selected_form == form_NY_IT201))) + strcpy( run_options, "-allforms" ); + else + strcpy( run_options, "" ); + + // if (round_to_whole_nums) + // strcat( run_options, " -round_to_whole_dollars" ); + + #if (PLATFORM_KIND == Posix_Platform) + sprintf(cmd,"'%s' %s '%s' &", taxsolvecmd, run_options, current_working_filename ); + #else + if ((strlen(taxsolvecmd) > 2 ) && (taxsolvecmd[1] == ':') && (taxsolvecmd[2] != '"')) + { /*Insert quotes around file name for Microsoft, in case pathname has spaces in it.*/ + int j; + char *tstr; + j = strlen( taxsolvecmd ) + 10; + tstr = (char *)malloc(j); + for (j = 0; j < 2; j++) tstr[j] = taxsolvecmd[j]; + j = 2; /* Leading quote must be inserted after drive letter for Microsoft OS's. */ + tstr[2] = '"'; j++; + do { tstr[j] = taxsolvecmd[j-1]; j++; } while (tstr[j-1] != '\0'); + strcat( tstr, "\"" ); + taxsolvecmd = tstr; + } + sprintf(cmd,"%s %s \"%s\"", taxsolvecmd, run_options, current_working_filename ); + #endif + + printf("Invoking '%s'\n", cmd ); + system(cmd); /* Run the TaxSolver. */ + Sleep_seconds( 0.1 ); + + /* Make a popup window telling where the results are, and showing them. */ + predict_output_filename( current_working_filename, outfname ); + wd = 620; ht = 550; + panel = make_window( wd, ht, "Results", &resultswindow ); + make_sized_label( panel, 1, 1, "Results written to file:", 12 ); + label = make_sized_label( panel, 30, 25, outfname, 8 ); + set_label_color( label, "#0000ff" ); + // make_button( panel, wd/2 - 15, ht - 35, " OK ", canceltxslvr, 0 ); + make_button( panel, 40, ht - 35, "Print Result File", print_outfile_directly, 0 ); + make_button( panel, wd - 85, ht - 35, " Close ", canceltxslvr, 0 ); + show_wind( resultswindow ); + UpdateCheck(); + Sleep_seconds( 0.25 ); + UpdateCheck(); + Sleep_seconds( 0.25 ); + mylist = make_selection_list( panel, 5, 50, wd - 10, ht - 50 - 50, "Results Preview:", 0, 0, 0 ); + viewfile = fopen( outfname, "rb" ); + if (viewfile == 0) + { + sprintf(vline,"Cannot open: %s", outfname); + printf("%s\n", vline ); + append_selection_list( mylist, &iter, vline ); + valid_results = 0; + } + else + { + int valid=1; + fgets( vline, 256, viewfile ); + while ((!feof(viewfile)) && valid) + { + filter_tabs( vline ); + append_selection_list( mylist, &iter, vline ); + linesread++; + + if (my_strcasestr( vline, "Error" ) != 0) + { + if ((errmsg == 0) && ((strncasecmp( vline, "Error", 5 ) == 0) || (strncasecmp( vline, "DATA Error", 10 ) == 0))) + { /* Any line starting with "Error" is considered to indicate an error-problem. */ + valid_results = 0; + errmsg = strdup( vline ); + } + } + + fgets( vline, 256, viewfile ); + if (strstr( vline, "Identity-Information:" ) != 0) + valid = 0; + } + fclose(viewfile); + } + if ((valid_results) && (linesread > 10) && (supported_pdf_form)) + make_button( panel, wd/2 - 80, ht - 35, "Fill-out PDF Forms", create_pdf_file_directly, 0 ); + show_wind( resultswindow ); + computed = 1; + compute_needed = 0; + if (errmsg) + GeneralPopup( "Error", errmsg, 1 ); +} + + + +void Run_TaxSolver( GtkWidget *wdg, void *x ) +{ + Update_box_info(); + if (save_needed) + { + warn_release = 2; + pending_compute = 1; + GeneralWarning( "Change(s) not saved. You must save before computing." ); + return; + } + taxsolve(); /* Compute Taxes. */ +} + + + + + +GtkWidget *printpopup=0, *print_label, *print_button; +GtkEntry *printerformbox; +char printer_command[MaxFname+256], wrkingfname[MaxFname]; +char fillout_pdf_command[8192], fillout_pdf_tool[2048]="", modify_pdf_tool[2048]=""; +int printdialogsetup; +int print_mode=0; +#if (PLATFORM_KIND==Posix_Platform) + char base_printer_command[]="lpr "; +#else + char base_printer_command[]="print "; +#endif +void acceptprinter_command( GtkWidget *wdg, void *data ); + + + +void set_pdf_tool_path() +{ + set_invocation_path( fillout_pdf_tool ); + strcat( fillout_pdf_tool, "fillout_PDF_forms" ); + quote_file_name( fillout_pdf_tool ); + + set_invocation_path( modify_pdf_tool ); + strcat( modify_pdf_tool, "universal_pdf_file_modifier" ); + quote_file_name( modify_pdf_tool ); +} + + +void cancelprintpopup( GtkWidget *wdg, void *data ) +{ gtk_widget_destroy( printpopup ); printpopup = 0; } + + +void togprntcmd_in( GtkWidget *wdg, void *data ) +{ + if (!printdialogsetup) return; + sprintf(printer_command,"%s \"%s\"", base_printer_command, current_working_filename ); + modify_formbox( printerformbox, printer_command ); + if (print_mode == 2) + { + modify_label( print_label, "Print Command" ); + gtk_button_set_label( GTK_BUTTON( print_button ), " Print It " ); + } + print_mode = 0; +} + + +void togprntcmd_out( GtkWidget *wdg, void *data ) +{ + if (!printdialogsetup) return; + predict_output_filename( current_working_filename, wrkingfname ); + sprintf(printer_command,"%s \"%s\"", base_printer_command, wrkingfname ); + modify_formbox( printerformbox, printer_command ); + if (print_mode == 2) + { + modify_label( print_label, "Print Command" ); + gtk_button_set_label( GTK_BUTTON( print_button ), " Print It " ); + } + print_mode = 1; +} + + +GtkWidget *status_win=0, *status_panel, *status_label; +struct + { int wd, ht, y_val, nfiles; + char *fnames[10]; + } statusw; +char *pdfviewer=0; + + +void dismiss_status_win( GtkWidget *wdg, void *data ) +{ + if (status_win != 0) + { gtk_widget_destroy( status_win ); status_win = 0; } +} + +int killed_status_win( GtkWidget *wdg, void *data ) +{ + status_win = 0; + return 0; /* Returning "0" causes window to be destroyed. */ +} + +void add_status_line( char *msg ) +{ + if (status_win == 0) return; + make_label( status_panel, 10, statusw.y_val, msg ); + statusw.y_val = statusw.y_val + 20; + UpdateCheck(); + show_wind( status_win ); + UpdateCheck(); +} + +void update_status_label( char *msg ) +{ + if (status_win == 0) return; + modify_label( status_label, msg ); + UpdateCheck(); +} + +void create_status_popup_window( int width, int height ) +{ + status_panel = make_scrolled_window_wkill( width, height, "Filling-out PDF Form(s) ...", &status_win, 1, 0, killed_status_win ); + status_label = make_label( status_panel, 1, 1, "Filling-out PDF Form(s):" ); + gtk_window_set_keep_above( (GtkWindow *)status_win, 1 ); + statusw.y_val = 28; + statusw.wd = width; statusw.ht = height; + show_wind( status_win ); +} + + +void get_cwd( char *pwd ) +{ + int j=0; + FILE *fp; + fp = popen( "echo %cd%", "rb" ); + if (fp != 0) + { + do pwd[j++] = getc( fp ); + while ((!feof(fp)) && (pwd[j-1] != '\n') && (pwd[j-1] != '\r')); + if (j > 0) j--; + pwd[j] = '\0'; + pclose(fp); + } + else + pwd[0] = '\0'; +} + + +void call_pdfviewer( char *pdfname ) +{ + char cmd[4096], tmppdfname[4096]; + strcpy( tmppdfname, pdfname ); + #if (PLATFORM_KIND==Posix_Platform) + quote_file_name( tmppdfname ); + #ifdef __APPLE__ + strcpy( cmd, "open -a "); + strcat( cmd, pdfviewer ); + #else + if (strcmp( pdfviewer, "default-pdf-viewer" ) == 0) + strcpy( cmd, "xdg-open" ); + else + strcpy( cmd, pdfviewer ); + #endif + strcat( cmd, " "); strcat( cmd, tmppdfname ); strcat( cmd, " &" ); + #else + strcpy( cmd, "start "); + if (strcmp( pdfviewer, "default-pdf-viewer" ) != 0) + { char pwd[4096]; + strcat( cmd, pdfviewer ); + strcat( cmd, " "); + if ((strstr( pdfviewer, "chrome") != 0) || (strstr( pdfviewer, "firefox") != 0)) + { /* Prepend 'file:///' + Path, to relative file name. */ + strcat( cmd, "\"file://" ); + get_cwd( pwd ); + strcat( cmd, pwd ); + strcat( cmd, "\\" ); + strcat( cmd, tmppdfname ); + strcat( cmd, "\"" ); + } + else + if ((strstr( pdfviewer, "iexplore" ) != 0) || (strstr( pdfviewer, "edge") != 0)) + { /* As above, but without quotes. */ + strcat( cmd, "file://" ); + get_cwd( pwd ); + strcat( cmd, pwd ); + strcat( cmd, "\\" ); + strcat( cmd, tmppdfname ); + } + else + strcat( cmd, tmppdfname ); + } + else + { /* Default PDF-Viewer. */ + strcat( cmd, " "); + quote_MS_file_name( tmppdfname ); + strcat( cmd, tmppdfname ); + } + #endif + printf("Issuing: %s\n", cmd ); + system( cmd ); +} + + +void consume_leading_trailing_whitespace( char *line ) +{ int j, k; + while (isspace( line[0] )) + { + j = 0; + do { line[j] = line[j+1]; j++; } + while (line[j-1] != '\0'); + } + k = strlen( line ) - 1; + while ((k >= 0) && (isspace( line[k] ))) + { + line[k] = '\0'; + k--; + } +} + + +char *check4tool( char *toolname ) +{ + char line[4096]="which "; + FILE *cmdresp; + strcat( line, toolname ); + cmdresp = popen( line, "r" ); + line[0] = '\0'; + if (cmdresp != 0) + { + fscanf( cmdresp, "%s", line ); + pclose( cmdresp ); + } + if (line[0] != '\0') + return strdup( line ); + else + return 0; +} + + + +void get_pdf_viewer() +{ + FILE *configfile; + char fname[4096], line[4096]; + + // printf("get_pdf_viewer:\n"); + pdfviewer = getenv( "PDF_VIEWER" ); /* First check if user has set PDF_Viewer environment variable. */ + if (pdfviewer != 0) return; + + if (verbose) printf(" Checking config file\n"); + set_invocation_path( toolpath ); /* Next check if user has set preferences in config-file. */ + strcpy( fname, toolpath ); + strcat( fname, "gui_settings.conf" ); + configfile = fopen( fname, "r" ); + if (configfile == 0) + printf("Did not find any 'gui_settings.conf' to read for optional settings.\n"); + else + { + /* Expect config file to have options like: PDF_VIEWER: acroread */ + fgets( line, 2048, configfile ); + while (!feof(configfile)) + { + consume_leading_trailing_whitespace( line ); + if ((line[0] != '#') && (line[0] != '\0')) + { + if (strncmp( line, "PDF_VIEWER:", 11 ) == 0) + { + pdfviewer = strdup( &(line[12]) ); + consume_leading_trailing_whitespace( pdfviewer ); + if (verbose) printf("Setting pdfviewer = '%s'\n", pdfviewer ); + } + else + printf("Unknown config-file option '%s'\n", line ); + } + fgets( line, 2048, configfile ); + } + fclose( configfile ); + } + if (pdfviewer == 0) /* If the above fails, then set viewer to a default. */ + { + printf(" (Did not see preferred PDF_VIEWER in gui_settings.conf - Using default viewer.)\n"); + #if (PLATFORM_KIND==Posix_Platform) + /* --- The following are methods for opening PDF document(s) on Apple or Linux. --- */ + // pdfviewer = strdup( "xpdf" ); + // pdfviewer = strdup( "acroread" ); + // pdfviewer = strdup( "atril" ); + #ifdef __APPLE__ + { // struct stat buf; + // if (stat( "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", &buf ) == 0) + // pdfviewer = strdup( "\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\"" ); + // else + pdfviewer = strdup( "Preview" ); + // pdfviewer = strdup( "Safari" ); + } + #else + pdfviewer = check4tool( "atril" ); + #endif + if (pdfviewer == 0) + pdfviewer = check4tool( "google-chrome" ); + if (pdfviewer == 0) + pdfviewer = check4tool( "firefox" ); + if (pdfviewer == 0) + pdfviewer = check4tool( "evince" ); + if (pdfviewer == 0) + pdfviewer = check4tool( "xpdf" ); + if (pdfviewer == 0) + pdfviewer = check4tool( "libreoffice" ); + if (pdfviewer == 0) + pdfviewer = check4tool( "ooffice" ); + if (pdfviewer == 0) + pdfviewer = check4tool( "acroread" ); + if (pdfviewer == 0) + pdfviewer = strdup( "xdg-open" ); + #else + /* --- The following is(are) method(s) for opening PDF document(s) on Microsoft. --- */ + pdfviewer = strdup( "default-pdf-viewer" ); /* Calls default pdf viewer properly. */ + #endif + if (pdfviewer == 0) + { + printf("Could not find a PDF viewer on your system.\n"); + // pdfviewer = strdup( "google-chrome" ); + } + else + printf("Using PDF viewer: '%s'\n", pdfviewer ); + } +} + + + + +GtkWidget *spdfpopup=0; +GtkEntry *spdffrmbx; + + +void cancelspdfpopup( GtkWidget *wdg, void *data ) +{ gtk_widget_destroy( spdfpopup ); spdfpopup = 0; } + + +void accept_pdfviewer( GtkWidget *wdg, void *data ) +{ char *selection; + selection = get_formbox( spdffrmbx ); + if (pdfviewer != 0) free( pdfviewer ); + #ifdef __APPLE__ + if (strcmp(selection, "google-chrome" ) == 0) + pdfviewer = strdup( "\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\"" ); + else + if (strcmp(selection, "firefox" ) == 0) + pdfviewer = strdup( "\"/Applications/Firefox.app/Contents/MacOS/firefox\"" ); + else + #endif + pdfviewer = strdup( selection ); + printf("Accepted PDF-Viewer as '%s'\n", pdfviewer ); + cancelspdfpopup( 0, 0 ); +} + + +void saveconfig( GtkWidget *wdg, void *data ) +{ + FILE *configfile, *infile; + char fname[4096], bckfile[4096], line[4096]; + + accept_pdfviewer( 0, 0 ); + if (pdfviewer == 0) return; + printf("Saving config file ...\n"); + set_invocation_path( toolpath ); + strcpy( fname, toolpath ); + strcat( fname, "gui_settings.conf" ); + + /* First make a backup config-file. */ + infile = fopen( fname, "r" ); + if (infile == 0) + printf("Did not find any 'gui_settings.conf' to read for optional settings.\n"); + else + { + strcpy( bckfile, toolpath ); + strcat( bckfile, "gui_settings.bak" ); + configfile = fopen( bckfile, "w" ); + if (configfile == 0) + printf("Could not open 'gui_settings.bak' for writing.\n"); + else + { + fgets( line, 2048, infile ); + while (!feof(infile)) + { + fprintf(configfile,"%s", line ); + fgets( line, 2048, infile ); + } + fclose( configfile ); + } + fclose( infile ); + } + + configfile = fopen( fname, "w" ); + if (configfile == 0) + printf("Could not open 'gui_settings.conf' for writing.\n"); + else + { + fprintf( configfile, "PDF_VIEWER: %s\n", pdfviewer ); + fclose( configfile ); + } +} + + + +void catch_pdfviewer_selection( GtkWidget *wdg, void *data ) +{ + char *text; + text = get_selection_from_list( wdg ); + if (strlen( text ) > 0) + modify_formbox( spdffrmbx, text ); +} + + +void set_pdfviewer( GtkWidget *wdg, void *data ) +{ + int wd=400, ht=300; + GtkWidget *panel; + + window_position_policy = GTK_WIN_POS_NONE; + panel = make_window( wd, ht, "Select Your PDF-Viewer", &spdfpopup ); + place_window_center(); + make_sized_label( panel, 15, 15, "Pick and Set PDF Viewer to Use:", 12 ); + { GtkTreeStore *spdfvlist; GtkTreeIter iter; + spdfvlist = make_selection_list( panel, 40, 40, 333, 119, "Some popular viewers ...", catch_pdfviewer_selection, 0, 0 ); + append_selection_list( spdfvlist, &iter, "" ); + #if (PLATFORM_KIND==Posix_Platform) + /* --- For Apple's and Linux --- */ + #ifdef __APPLE__ + append_selection_list( spdfvlist, &iter, "Google Chrome" ); + append_selection_list( spdfvlist, &iter, "Preview" ); + append_selection_list( spdfvlist, &iter, "Safari" ); + #else + append_selection_list( spdfvlist, &iter, "default-pdf-viewer" ); + append_selection_list( spdfvlist, &iter, "google-chrome" ); + #endif + append_selection_list( spdfvlist, &iter, "firefox" ); + append_selection_list( spdfvlist, &iter, "atril" ); + append_selection_list( spdfvlist, &iter, "xpdf" ); + append_selection_list( spdfvlist, &iter, "evince" ); + append_selection_list( spdfvlist, &iter, "libreoffice" ); + append_selection_list( spdfvlist, &iter, "ooffice" ); + #ifdef __APPLE__ + #endif + append_selection_list( spdfvlist, &iter, "acroread" ); + #else + /* --- For Microsoft --- */ + append_selection_list( spdfvlist, &iter, "default-pdf-viewer" ); + append_selection_list( spdfvlist, &iter, "chrome" ); + append_selection_list( spdfvlist, &iter, "firefox" ); + // append_selection_list( spdfvlist, &iter, "microsoft-edge:" ); /* Edge can't open local files. :-( */ + append_selection_list( spdfvlist, &iter, "iexplore" ); + append_selection_list( spdfvlist, &iter, "evince" ); + append_selection_list( spdfvlist, &iter, "xpdf" ); + append_selection_list( spdfvlist, &iter, "libreoffice" ); + append_selection_list( spdfvlist, &iter, "acroread" ); + #endif + } + make_label( panel, 20, 185, "PDF Viewer Executable:" ); + if (pdfviewer == 0) + get_pdf_viewer(); + if (pdfviewer == 0) + spdffrmbx = make_formbox( panel, 35, 200, 42, "", 500, accept_pdfviewer, 0 ); + else + spdffrmbx = make_formbox( panel, 35, 200, 42, pdfviewer, 500, accept_pdfviewer, 0 ); + + make_button( panel, 30, 260, " OK ", accept_pdfviewer, 0 ); + make_button( panel, 180, 260, "Save", saveconfig, 0 ); + make_button( panel, 320, 260, "Cancel", cancelspdfpopup, 0 ); + // gtk_window_activate_focus( GTK_WINDOW( spdfpopup ) ); + // gtk_window_set_transient_for( GTK_WINDOW( spdfpopup ), GTK_WINDOW( status_win ) ); + // gtk_window_set_transient_for( GTK_WINDOW( spdfpopup ), GTK_WINDOW( outer_window ) ); + // gtk_window_set_keep_above( GTK_WINDOW( spdfpopup ), 1 ); + show_wind( spdfpopup ); +} + + +void callup_pdfviewer( GtkWidget *wdg, void *data ) +{ + int k=0; + dismiss_status_win( 0, 0 ); + UpdateCheck(); + printf("\n"); + if (pdfviewer == 0) + { + get_pdf_viewer(); + } + if (pdfviewer == 0) + { + GeneralWarning( "Could not find a PDF viewer on your system.\n"); + return; + } + while (k < statusw.nfiles) + call_pdfviewer( statusw.fnames[k++] ); +} + + +void add_view_pdf_button() +{ + make_button( status_panel, 30, statusw.ht - 50, "(Set PDF Viewer)", set_pdfviewer, 0 ); + make_button( status_panel, statusw.wd/2 - 90, statusw.ht - 50, " Open in PDF Viewer ", callup_pdfviewer, 0 ); + make_button( status_panel, statusw.wd - 90, statusw.ht - 50, "Close", dismiss_status_win, &status_win ); + show_wind( status_win ); +} + + + +void togprntcmd_pdf( GtkWidget *wdg, void *data ) +{ + if (!printdialogsetup) return; + predict_output_filename( current_working_filename, wrkingfname ); + modify_formbox( printerformbox, wrkingfname ); + if (print_mode != 2) + { + modify_label( print_label, "File:" ); + gtk_button_set_label( GTK_BUTTON( print_button ), " OK " ); + } + print_mode = 2; +} + + +int schedule_PDF_conversion=0, pdf_conversion_step; + +void acceptprinter_command( GtkWidget *wdg, void *data ) +{ + if ((print_mode > 0) && (compute_needed)) + { + cancelprintpopup( 0, 0 ); + GeneralWarning( "Change(s) not Re-Computed. You should Compute-Tax before printing results." ); + return; + } + if (print_mode < 2) + { + get_formbox_text( printerformbox, printer_command, MaxFname ); + printf("Issuing: %s\n", printer_command); + system( printer_command ); + cancelprintpopup( 0, 0 ); + } + else + { /*Fill-out_PDF*/ + cancelprintpopup( 0, 0 ); + pdf_conversion_step = 1; + schedule_PDF_conversion = 1; + create_status_popup_window( 800, 125 ); + } +} + + +void setpdfoutputname( char *origname, char *suffix, char *newname ) +{ + int j; + strcpy( newname, origname ); + j = strlen( newname ) - 1; + while ((j >= 0) && (newname[j] != '.')) j--; + if (j >= 0) + newname[j] = '\0'; + strcat( newname, suffix ); +} + + +void prepare_universal_pdf_cmd( char *options, char *metadata, char *wrkingfname, char *markedpdf, char *outputname ) +{ char *tmpmetadata, *tmpwrkingfname, *tmpmarkedpdf, *tmpout; + + if (metadata==0) + { printf("Error in prepare_universal_pdf_cmd: metadata is null.\n"); return; } + if (wrkingfname==0) + { printf("Error in prepare_universal_pdf_cmd: wrkingfname is null.\n"); return; } + if (markedpdf==0) + { printf("Error in prepare_universal_pdf_cmd: markedpdf is null.\n"); return; } + if (outputname==0) + { printf("Error in prepare_universal_pdf_cmd: outputname is null.\n"); return; } + + tmpmetadata = (char *)malloc(4096); + tmpwrkingfname = (char *)malloc(4096); + tmpmarkedpdf = (char *)malloc(4096); + tmpout = (char *)malloc(4096); + + strcpy( fillout_pdf_command, modify_pdf_tool ); + strcat( fillout_pdf_command, " " ); + strcat( fillout_pdf_command, options ); + strcat( fillout_pdf_command, " " ); + strcpy( tmpmetadata, ots_path ); + strcat( tmpmetadata, "src" ); strcat( tmpmetadata, slashstr ); + strcat( tmpmetadata, "formdata" ); strcat( tmpmetadata, slashstr ); + strcat( tmpmetadata, metadata ); + quote_file_name( tmpmetadata ); + strcpy( tmpwrkingfname, wrkingfname ); + quote_file_name( tmpwrkingfname ); + strcpy( tmpmarkedpdf, ots_path ); + strcat( tmpmarkedpdf, "src" ); strcat( tmpmarkedpdf, slashstr ); + strcat( tmpmarkedpdf, "formdata" ); strcat( tmpmarkedpdf, slashstr ); + strcat( tmpmarkedpdf, markedpdf ); + quote_file_name( tmpmarkedpdf ); + strcat( fillout_pdf_command, tmpmetadata ); + strcat( fillout_pdf_command, " " ); + strcat( fillout_pdf_command, tmpwrkingfname ); + strcat( fillout_pdf_command, " " ); + strcat( fillout_pdf_command, tmpmarkedpdf ); + if (strlen(outputname) > 0) + { + strcat( fillout_pdf_command, " -o " ); + strcpy( tmpout, outputname ); + quote_file_name( tmpout ); + strcat( fillout_pdf_command, tmpout ); + } + free( tmpmetadata ); + free( tmpwrkingfname ); + free( tmpmarkedpdf ); + free( tmpout ); +} + + +#ifndef MY_TMPNAM_DEFINED +#define MY_TMPNAM_DEFINED 1 +char *my_tmp_dir=0, *my_tmp_suffix=".bat"; + +int my_tmpnam( char *fname ) /* Get a temporary file name for writing. Return 1 on success, 0 on failure. */ +{ + int k=0; + struct stat buf; + + if (my_tmp_dir == 0) + { + #ifdef __MINGW32__ + char *sptr; int j; + sptr = getenv( "TEMP" ); + if ((sptr == 0) || (sptr[0] == '\0')) + my_tmp_dir = strdup(""); + else + { + my_tmp_dir = (char *)malloc( strlen( sptr ) + 2 ); + strcpy( my_tmp_dir, sptr ); + j = strlen( my_tmp_dir ); + if ((my_tmp_dir[j-1] != '/') && (my_tmp_dir[j-1] != '\\')) + strcat( my_tmp_dir, "\\" ); + } + #else + my_tmp_dir = strdup( "/tmp/" ); + #endif + } + do + { char cnt[20]; + strcpy( fname, my_tmp_dir ); + strcat( fname, "tmpfile" ); + sprintf(cnt,"%d", k++ ); + strcat( fname, cnt ); + if (my_tmp_suffix == 0) + strcat( fname, ".dat" ); + else + strcat( fname, my_tmp_suffix ); + } + while ((stat( fname, &buf ) == 0) && (k < 10000)); + if (k == 10000) return 0; + else return 1; +} +#endif + + + +void execute_cmd( char *cmd ) +{ + #if (PLATFORM_KIND==Posix_Platform) + system( fillout_pdf_command ); + #else + char tmpfname[1024]; + FILE *T; /* Due to limitation of microsoft, we must use a temp-cmd file on MSwin. */ + my_tmpnam( tmpfname ); + T = fopen(tmpfname,"w"); + fprintf(T,"%s\n", fillout_pdf_command ); + fclose(T); + system( tmpfname ); + remove( tmpfname ); + // system( "erase tmpcmd.bat" ); /* remove does not work for some reason. */ + #endif +} + + + +typedef struct FORM_PDF_CONVERT_T +{ + int sel_form; + char *other_form_name; + char *form_meta_data_name; + char *form_pdf_name; +} FORM_PDF_CONVERT, *P_FORM_PDF_CONVERT; + +FORM_PDF_CONVERT form_pdfs[] = + { /* Top-tier forms: */ + { form_US_1040, "", "f1040_meta.dat", "f1040_pdf.dat" }, + { form_US_1040_Sched_C, "", "f1040sc_meta.dat", "f1040sc_pdf.dat" }, + { form_PA_40, "", "PA_40_meta.dat", "PA_40_pdf.dat" }, + { form_CA_540, "", "CA_540_meta.dat", "CA_540_pdf.dat" }, + { form_OH_IT1040, "", "OH_PIT_IT1040_meta.dat", "OH_PIT_IT1040_pdf.dat" }, + { form_VA_760, "", "VA_760_meta.dat", "VA_760_pdf.dat" }, + { form_NJ_1040, "", "NJ_1040_meta.dat", "NJ_1040_pdf.dat" }, + { form_NY_IT201, "", "NY_it201_meta.dat", "NY_it201_pdf.dat" }, + { form_MA_1, "", "MA_1_meta.dat", "MA_1_pdf.dat" }, + { form_NC_D400, "", "NC_meta.dat", "NC_pdf.dat" }, + { form_1040e, "", "f1040e_meta.dat", "f1040e_pdf.dat" }, + { form_4562, "", "f4562_meta.dat", "f4562_pdf.dat" }, + { form_8582, "", "f8582_meta.dat", "f8582_pdf.dat" }, + { form_AZ_140, "", "AZ_140_meta.dat", "AZ_140_pdf.dat" }, + { form_MI_1040, "", "MI_1040_meta.dat", "MI_1040_pdf.dat" }, + { form_OR_40, "taxsolve_OR_40", "OR_40_meta.dat", "OR_40_pdf.dat" }, + /* Other added forms: */ + { form_other, "taxsolve_HSA_f8889", "f8889_meta.dat", "f8889_pdf.dat" }, + { form_other, "taxsolve_f8606", "f8606_meta.dat", "f8606_pdf.dat" }, + { form_other, "taxsolve_US_1040_Sched_SE", "f1040sse_meta.dat", "f1040sse_pdf.dat" }, + { form_other, "taxsolve_f8829", "f8829_meta.dat", "f8829_pdf.dat" }, + { form_other, "taxsolve_f8995", "f8995_meta.dat", "f8995_pdf.dat" }, + { form_other, "taxsolve_f8959", "f8959_meta.dat", "f8959_pdf.dat" }, + { form_other, "taxsolve_f8960", "f8960_meta.dat", "f8960_pdf.dat" }, + { form_other, "taxsolve_f2210", "f2210_meta.dat", "f2210_pdf.dat" }, + { form_other, "taxsolve_f8812", "f8812_meta.dat", "f8812_pdf.dat" }, + { form_other, "taxsolve_CA_5805", "CA_5805_meta.dat", "CA_5805_pdf.dat" } + }; + + +void do_pdf_conversion() +{ + char outputname[4096], updf_options[1024]=""; + int f; + schedule_PDF_conversion = 0; + predict_output_filename( current_working_filename, wrkingfname ); + + // Found form_pdfs struct; NULL if no matching entry found + P_FORM_PDF_CONVERT ppdf = NULL; + + if (strlen(fillout_pdf_tool) < 1) set_pdf_tool_path(); + // Search through table for matching form type + for (f = 0; f < sizeof(form_pdfs)/sizeof(FORM_PDF_CONVERT); ++f) + { + // Pointer to the current FORM_PDF_CONVERT struct for search + P_FORM_PDF_CONVERT psp = &form_pdfs[f]; + + // Check for matching main form type (not 'form_other') + if ((psp->sel_form != form_other) && (psp->sel_form == selected_form)) + { + ppdf = psp; + break; + } + // Check for 'form_other', and matching name + if ((psp->sel_form == form_other) && (strstr( taxsolvestrng, psp->other_form_name ) != 0)) + { + ppdf = psp; + printf("%s: Found form_pdf: %d, %s\n", taxsolvestrng, ppdf->sel_form, ppdf->other_form_name ); + break; + } + } + + if (ppdf == NULL) + { + printf("Form type not supported.\n"); + make_button( status_panel, 30, statusw.ht - 50, " Ok ", dismiss_status_win, &status_win ); + return; + } + printf("Found form_pdf: %d, %s\n", ppdf->sel_form, ppdf->other_form_name); + // Found a matching entry, since ppdf is not NULL + statusw.nfiles = 0; + setpdfoutputname( wrkingfname, ".pdf", outputname ); + + if (rptwd_txline) + round_pdf_to_whole_dollars = interpret_boolean( rptwd_txline->text ); + if (round_pdf_to_whole_dollars) + strcpy( updf_options, "-round_to_whole_numbers" ); + + prepare_universal_pdf_cmd( "", ppdf->form_meta_data_name, wrkingfname, ppdf->form_pdf_name, outputname ); + printf("Issuing: %s\n", fillout_pdf_command ); + add_status_line( outputname ); + execute_cmd( fillout_pdf_command ); + update_status_label( "Completed Filling-out PDF Form:" ); + statusw.fnames[ statusw.nfiles ] = strdup( outputname ); statusw.nfiles = statusw.nfiles + 1; + add_view_pdf_button(); +} + + + +void print_outfile_directly( GtkWidget *wdg, void *data ) +{ + // predict_output_filename( current_working_filename, wrkingfname ); + // sprintf(printer_command,"%s \"%s\"", base_printer_command, wrkingfname ); + // printf("Issuing: %s\n", printer_command); + // system( printer_command ); + printout( wdg, data ); +} + +void create_pdf_file_directly( GtkWidget *wdg, void *data ) +{ + predict_output_filename( current_working_filename, wrkingfname ); + pdf_conversion_step = 1; + schedule_PDF_conversion = 1; + create_status_popup_window( 800, 125 ); +} + + +void printout( GtkWidget *wdg, void *data ) +{ + GtkWidget *rad, *panel; + int x1=70, x2, y1=30, dy=20, wd=750, ht=190, printht; + + Update_box_info(); + if (save_needed) + { + if (!computed) + GeneralWarning( "Change(s) not saved. You should Save input file before printing it." ); + else + GeneralWarning( "Change(s) not saved. You should Save + Re-Compute before printing." ); + return; + } + dismiss_status_win( 0, 0 ); + print_mode = 0; + panel = make_window( wd, ht, "Print Return Data", &printpopup ); + make_sized_label( panel, 1, 1, "Print Return Data:", 12 ); + rad = make_radio_button( panel, 0, x1, y1, "Print Input Data", togprntcmd_in, 0 ); + + if (supported_pdf_form) + { + make_radio_button( panel, rad, x1 + 170, y1, "Automatically Fill-out PDF Tax-Form", togprntcmd_pdf, 0 ); + x2 = x1 + 460; + } + else x2 = x1 + 160; + + y1 = y1 + dy; + rad = make_radio_button( panel, rad, x1, y1, "Print Output Data", togprntcmd_out, 0 ); + make_rectangular_separator( panel, x1 - 10, y1 - dy - 10, x2, y1 + dy ); + y1 = y1 + dy + 15; + print_label = make_label( panel, 10, y1 + 4, "Print Command:" ); + y1 = y1 + dy; + printdialogsetup = 0; + strcpy( printer_command, base_printer_command ); + strcat( printer_command, " " ); + if (computed) + { + set_radio_button( rad ); + predict_output_filename( current_working_filename, wrkingfname ); + strcat( printer_command, wrkingfname ); + print_mode = 1; + } + else + strcat( printer_command, current_working_filename ); + x1 = 20; + printerformbox = make_formbox_bypix( panel, x1, y1, wd - x1 - 10, printer_command, MaxFname, acceptprinter_command, 0 ); + printht = ht - 35; + print_button = make_button( panel, 50, printht, " Print It ", acceptprinter_command, 0 ); + make_button( panel, wd - 95, printht, "Cancel", cancelprintpopup, 0 ); + show_wind( printpopup ); + printdialogsetup = 1; +} + + + + +void slcttxprog( GtkWidget *wdg, void *data ) +{ /* Come here when user selects one of the opening-screen radio-buttons. */ + char *sel=(char *)data; + char strg[MaxFname], tmpstr[MaxFname]; + int k, prev; + + if (!ok_slcttxprog) return; + prev = selected_form; + if (sscanf(sel,"%d", &selected_form) != 1) printf("Internal error '%s'\n", sel ); + if (verbose) printf("\n Selected form = %d. (prev=%d)\n", selected_form, prev ); + if (selected_form == prev) return; + strcpy( strg, program_names[selected_form] ); + if (verbose) printf(" Form Name = '%s'\n", strg ); + if (strcmp(strg,"Other")==0) + { + selected_other = 1; + supported_pdf_form = 0; + other_form_selected = 0; + if (verbose) printf("invocation_path = '%s'\n", invocation_path ); + set_invocation_path( toolpath ); + fb_clear_banned_files(); + fb_ban_files( ".txt" ); + fb_ban_files( ".pdf" ); + fb_ban_files( ".dll" ); + fb_ban_files( ".dylib" ); + fb_ban_files( "convert_results2xfdf" ); + fb_ban_files( "notify_popup" ); + fb_ban_files( "ots_gui" ); + fb_ban_files( "universal_pdf_file_modifier" ); + + fb_ban_files( "taxsolve_CA_540" ); + fb_ban_files( "taxsolve_MA_1" ); + fb_ban_files( "taxsolve_NC_D400" ); + fb_ban_files( "taxsolve_NJ_1040" ); + fb_ban_files( "taxsolve_NY_IT201" ); + fb_ban_files( "taxsolve_OH_IT1040" ); + fb_ban_files( "taxsolve_PA_40_" ); + fb_ban_files( "taxsolve_US_1040_2024"); + fb_ban_files( "taxsolve_US_1040_Sched_C_" ); + fb_ban_files( "taxsolve_VA_760_" ); + fb_ban_files( "taxsolve_AZ_140_" ); + fb_ban_files( "taxsolve_MI_1040_" ); + + strcpy( wildcards_fb, "" ); + strcpy( filename_fb, "" ); + // printf("OTS_taxsolve: dir='%s', wc='%s', fname='%s'\n", toolpath, wildcards_fb, filename_fb ); + Browse_Files( "Select Tax Program to Use:", 2048, toolpath, wildcards_fb, filename_fb, set_tax_solver ); + + strcpy(tmpstr, invocation_path); + k = strlen(tmpstr)-1; + while ((k > 0) && (tmpstr[k] != slashchr)) k--; + if (k > 0) k--; + while ((k > 0) && (tmpstr[k] != slashchr)) k--; + if (tmpstr[k] == slashchr) tmpstr[k+1] = '\0'; + else {sprintf(tmpstr,".%c", slashchr);} + sprintf(directory_dat, "%stax_form_files%c", tmpstr, slashchr); + + return; + } + else + { + selected_other = 0; + supported_pdf_form = 1; + + sprintf(tmpstr,"%s%s", invocation_path, strg); + printf("Setting Tax Program to be: '%s'\n", tmpstr); + taxsolvecmd = strdup(tmpstr); + strcpy(taxsolvestrng, tmpstr); + + strcpy(tmpstr, invocation_path); + k = strlen(tmpstr)-1; + while ((k > 0) && (tmpstr[k] != slashchr)) k--; + if (k > 0) k--; + while ((k > 0) && (tmpstr[k] != slashchr)) k--; + if (tmpstr[k] == slashchr) tmpstr[k+1] = '\0'; + else {sprintf(tmpstr,".%c", slashchr);} + sprintf(directory_dat, "%stax_form_files%c", tmpstr, slashchr); + + sel = strstr( strg, "_2024" ); + if (sel != 0) + sel[0] = '\0'; + strcpy( tmpstr, strg ); + if (strlen(tmpstr) < 10) {printf("Internal error, name too short '%s'\n", tmpstr); return;} + strcpy( strg, &(tmpstr[9]) ); /* Remove the prefix "taxsolve_". */ + strcat( directory_dat, strg ); + printf("Setting Tax Data Directory to be: '%s'\n", directory_dat); + } +} + + + +#include "logo_image.c" /* <--- The image-data is included here, produced by "data2code". */ + + +void quit( GtkWidget *wdg, void *x ) +{ + printf("OTS Exiting.\n"); + exit(0); +} + + +void warn_about_save_needed() +{ + int xpos=20, ypos=20, winwdth, winhght=100; + GtkWidget *winframe, *label; + winwdth = 300; + winframe = make_window( winwdth, winhght, "Warning Message", &warnwin ); + label = make_sized_label( winframe, xpos, ypos, "Change(s) not saved !!", 12 ); + set_label_color( label, "#ff0000" ); + make_button( winframe, 10, winhght - 40, "Exit anyway, without saving", quit, &warnwin ); + make_button( winframe, winwdth - 60, winhght - 40, "Cancel", dismiss_general_warning, &warnwin ); + gtk_window_set_keep_above( (GtkWindow *)warnwin, 1 ); + show_wind( warnwin ); +} + + +void quit_wcheck( GtkWidget *wdg, void *x ) +{ + Update_box_info(); + if (save_needed) + { + warn_about_save_needed(); + return; + } + quit( 0, 0 ); +} + + + +static gboolean handle_draw_event( GtkWidget *wdg, cairo_t *cr, void *data ) +{ + unsigned char *logodata; + int imgwd, imght, x1, y1, x2, y2, new_width, new_height; + + if (operating_mode == 1) + { /*mode1*/ + logodata = cdti_convert_data_to_image( data_0, data_0_size, &imgwd, &imght ); + x1 = (winwidth - imgwd) / 2; + y1 = 10; + x2 = x1 + imgwd; + y2 = y1 + imght; + attach_image_from_pixbuf( mpanel, logodata, x1, y1, imgwd, imght, 1 ); + make_rectangular_separator( mpanel, x1 - 2, y1 - 2, x2 - 2, y2 + 2 ); + gtk_widget_show_all( outer_window ); + x1 = 20; x2 = winwidth - 20; + y1 = fronty1 - 8; y2 = fronty2; + make_rectangular_separator( mpanel, x1, y1, x2, y2 ); + } /*mode1*/ + else + { /*mode2*/ + gtk_window_get_size( GTK_WINDOW( outer_window ), &new_width, &new_height ); + if ((abs(new_width - winwidth) > 5) || (abs( new_height - winht ) > 5)) + { + winwidth = new_width; + winht = new_height; + need_to_resize = 1; + last_resize_time = Report_Time(); + } + } /*mode2*/ + return FALSE; +} + + + +int myfilterfunc( char *word ) +{ + if (my_strcasestr( word, ".txt") != 0) + { + if (my_strcasestr( word, "_out.txt" ) != 0) return 0; + if (my_strcasestr( word, "README_" ) != 0) return 0; + return 1; + } + else return 0; +} + + +//gboolean filterfunc( const GtkFileFilterInfo *finfo, gpointer data ) +//{ + // printf("Got '%s'\n", finfo->filename ); +// return myfilterfunc( finfo->filename ); +//} + + +void receive_filename( char *fname ) +{ + // printf("OTS_pick_file RET: f='%s', dir='%s', wc='%s', fname='%s'\n", fname, directory_dat, wildcards_fb, filename_fb ); + if (yourfilename != 0) free( yourfilename ); + yourfilename = strdup( fname ); + printf("You picked '%s'\n", yourfilename ); + if (myfilterfunc( yourfilename ) == 0) + { + warn_release = 1; + GeneralWarning("File name does not look like a tax input file."); + } + else + { + open_taxfile( yourfilename ); + } +} + + +void pick_file( GtkWidget *wdg, void *data ) +{ int j; + GtkFileFilter *rule; + + printf("Selected_Form = %d\n", selected_form ); + if ((selected_form == form_other) && (other_form_selected == 0)) + { + GeneralWarning("You must first select which Form to work on."); + return; + } + + rule = gtk_file_filter_new(); + gtk_file_filter_add_pattern( rule, "*.txt" ); + // gtk_file_filter_add_custom( rule, 15, filterfunc, 0, 0 ); + + // If workdir option is set, save the current directory_dat + // path to temp_dir, and then set it to the workdir path + if (strlen(workdir) > 0) + { + strcpy(temp_dir, directory_dat); + strcpy( directory_dat, workdir ); + } + + j = strlen( directory_dat ); + if ((j > 0) && (directory_dat[j-1] != slashchr)) + strcat( directory_dat, slashstr ); + if (verbose) printf("BrowsePath = '%s'\n", directory_dat ); + fb_clear_banned_files(); + fb_ban_files( "_out.txt" ); + fb_ban_files( "_template.txt" ); + fb_ban_files( "README" ); + strcpy( wildcards_fb, ".txt" ); + strcpy( filename_fb, "" ); + // printf("OTS_pick_file: dir='%s', wc='%s', fname='%s'\n", directory_dat, wildcards_fb, filename_fb ); + Browse_Files( "Select File", 2048, directory_dat, wildcards_fb, filename_fb, receive_filename ); + + // If modified, restore directory_dat path from temp_dir, so that templates + // are found properly during the call to pick_template. + if (strlen(workdir) > 0) + strcpy( directory_dat, temp_dir ); +} + + +void pick_template( GtkWidget *wdg, void *data ) +{ int j; + GtkFileFilter *rule; + DIR *dirpt; + struct dirent *dir_entry; + int match=0; + char *templatefile="", *fileanswer; + + printf("Selected_Form = %d\n", selected_form ); + if ((selected_form == form_other) && (other_form_selected == 0)) + { + GeneralWarning("You must first select which Form to work on."); + return; + } + rule = gtk_file_filter_new(); + gtk_file_filter_add_pattern( rule, "*.txt" ); + // gtk_file_filter_add_custom( rule, 15, filterfunc, 0, 0 ); + + j = strlen( directory_dat ); + if ((j > 0) && (directory_dat[j-1] != slashchr)) + strcat( directory_dat, slashstr ); + if (verbose) printf("BrowsePath = '%s'\n", directory_dat ); + fb_clear_banned_files(); + fb_ban_files( "_out.txt" ); + fb_ban_files( "README" ); + strcpy( wildcards_fb, "_template.txt" ); + strcpy( filename_fb, "" ); + // printf("OTS_pick_template: dir='%s', wc='%s', fname='%s'\n", directory_dat, wildcards_fb, filename_fb ); + + /* Expect only a single file in the named directory to match. */ + /* If so, then call "receive_filename" on that file. Otherwise drop through to the File-Browser. */ + dirpt = opendir( directory_dat ); + if (dirpt != 0) + { + dir_entry = readdir(dirpt); + while (dir_entry != 0) + { + if (strstr( dir_entry->d_name, "_template.txt" ) != 0) + { + match++; + templatefile = strdup( dir_entry->d_name ); + } + dir_entry = readdir(dirpt); + } + closedir( dirpt ); + if (match == 1) + { + printf(" Dir = '%s', File = '%s'\n", directory_dat, templatefile ); + fileanswer = (char *)malloc( strlen( directory_dat ) + strlen( templatefile ) + 100 ); + strcpy( fileanswer, directory_dat ); + strcat( fileanswer, "/" ); + strcat( fileanswer, templatefile ); + fb_reduce_pathname( fileanswer ); + printf("Directly opening: '%s'\n", fileanswer ); + receive_filename( fileanswer ); + return; + } + } + + Browse_Files( "Select File", 2048, directory_dat, wildcards_fb, filename_fb, receive_filename ); +} + + +void set_ots_path() +{ /* Expect invocation path to end with "bin" or "msbin", and remove that part. */ + int j; + ots_path = strdup( invocation_path ); + j = strlen( ots_path ) - 1; + while ((j >= 0) && (strstr( &(ots_path[j]), "bin" ) != &(ots_path[j]))) j--; + if (j < 0) { ots_path = strdup( "./" ); ots_path[1] = slashchr; } + else + if ((j > 1) && (ots_path[j-1] == 's')) ots_path[j-2] = '\0'; + else ots_path[j] = '\0'; +} + + +void helpabout1( GtkWidget *wdg, void *data ) +{ + char msg[4096]; + sprintf( msg, "OpenTaxSolver (OTS) GUI - Version %1.2f, %s\n", version, package_date ); + strcat( msg, " For the 2024 Tax Year. OTS release "); + strcat( msg, ots_release_package ); strcat( msg, "\n\n" ); + strcat( msg, "Use this GUI to open tax-forms and calculate taxes.\n"); + strcat( msg, " 1. First select a tax-form to do from the available programs listed.\n" ); + strcat( msg, " 2. Then to start a new blank return click 'Start New Return'.\n"); + strcat( msg, " Or to open a file you previously saved, or a working example,\n"); + strcat( msg, " click 'Open Saved Form' button, select your file or example,\n" ); + strcat( msg, " and click 'Ok'\n"); + strcat( msg, " 3. Fill out the form that pops up.\n"); + strcat( msg, " (Click the label on any line to see tax-instructions, if provided.)\n" ); + strcat( msg, " 4. Save your filled-out form to a name of your choice.\n"); + strcat( msg, " 5. Click 'Compute Tax' to see your results.\n"); + strcat( msg, " 6. Click 'Print' to fill-out or print-out your forms.\n\n"); + strcat( msg, "For help, additional information, and updates:\n" ); + strcat( msg, " Surf to: https://opentaxsolver.sourceforge.net/\n" ); + GeneralPopup( "OTS Information", msg, 1 ); +} + + +void helpabout2( GtkWidget *wdg, void *data ) +{ + char msg[4096]; + sprintf( msg, "OpenTaxSolver (OTS) GUI - Version %1.2f, %s\n", version, package_date ); + strcat( msg, " For the 2024 Tax Year. OTS release "); + strcat( msg, ots_release_package ); strcat( msg, "\n\n" ); + strcat( msg, "Use this GUI to fill-out tax forms and calculate taxes.\n"); + strcat( msg, " 1. Fill-out the line entries that apply to you.\n"); + strcat( msg, " (Click the label on any line to see tax-instructions, if provided.)\n" ); + strcat( msg, " 2. Save your filled-out form by clicking 'Save' button.\n"); + strcat( msg, " (If you started a new form ('_template'), then save your\n"); + strcat( msg, " version with a unique name that is meaningful to you.)\n"); + strcat( msg, " 3. Click 'Compute Tax' to see results.\n"); + strcat( msg, " 4. Click 'Print' to print-out the results or to automatically\n"); + strcat( msg, " fill-out the final forms.\n\n"); + strcat( msg, "For help, additional information, and updates:\n" ); + strcat( msg, " Surf to: https://opentaxsolver.sourceforge.net/\n" ); + GeneralPopup( "OTS Information", msg, 1 ); +} + + + +/*----------------------------------------------------------------------------*/ +/* Main - */ +/*----------------------------------------------------------------------------*/ + +int main(int argc, char *argv[] ) +{ + int argn, k, grayed_out=0, setwinsz=0; + char vrsnmssg[256], ots_pkg_mssg[256], tmpstr[MaxFname], *formid; + float x, y, dy, y1, y2; + GtkWidget *txprogstog, *button, *tmpwdg; + + sprintf(ots_pkg_mssg, "OTS Release %s", ots_release_package ); printf("%s\n\n", ots_pkg_mssg ); + sprintf(vrsnmssg, "GUI v%1.2f", version ); printf("%s\n", vrsnmssg ); + start_cmd = strdup(argv[0]); + invocation_path = strdup(argv[0]); + k = strlen(invocation_path)-1; + while ((k>0) && (invocation_path[k]!=slashchr)) k--; + if (invocation_path[k]==slashchr) k++; + invocation_path[k] = '\0'; + // printf("Invocation path = '%s'\n", invocation_path); + // printf("Start cmd: '%s'; invocation path = '%s'; slashchr = '%c'\n", start_cmd, invocation_path, slashchr); + set_ots_path(); + + /* Decode any command-line arguments. */ + argn = 1; k=1; + while (argn < argc) + { + if ((strcmp(argv[argn],"-verbose")==0) || (strcmp(argv[argn],"-v")==0)) + { + verbose = 1; + printf(" GUI Setting Verbose Mode = On.\n"); + } + else + if (strcmp(argv[argn],"-help")==0) + { + printf("OTS GUI v%1.2f, %s:\n", version, package_date ); + printf(" Command-line Options:\n"); + printf(" -verbose - Show debugging messages.\n"); + printf(" -winsz wd ht - Set the window size to wd x ht.\n"); + printf(" -debug - Set debug mode.\n"); + printf(" -taxsolver xx - Set path and name of the tax-solver executable.\n"); + printf(" -workdir yy - Set path for opening and saving data files.\n"); + printf(" {file-name}.txt - Set path and name of the tax data input file.\n\n"); + exit(0); + } + else + if (strcmp(argv[argn],"-taxsolver")==0) + { int kx; + argn++; + if (argn == argc) { printf("Missing entry after '-taxsolver'.\n"); exit(1); } + taxsolvecmd = strdup( argv[argn] ); + strcpy( taxsolvestrng, taxsolvecmd ); + selected_other = 1; + if (verbose) printf("invocation_path = '%s'\n", invocation_path ); + + strcpy(tmpstr, invocation_path); + kx = strlen(tmpstr)-1; + while ((kx > 0) && (tmpstr[kx] != slashchr)) kx--; + if (kx > 0) kx--; + while ((kx > 0) && (tmpstr[kx] != slashchr)) kx--; + if (tmpstr[kx] == slashchr) tmpstr[kx+1] = '\0'; + else {sprintf(tmpstr,".%c", slashchr);} + sprintf(directory_dat, "%stax_form_files%c", tmpstr, slashchr); + selected_form = form_other; + other_form_selected = 1; + ok_slcttxprog = 0; + } + else + if (strcmp(argv[argn],"-workdir")==0) + { + argn++; + if (argn == argc) { printf("Missing entry after '-workdir'.\n"); exit(1); } + strcpy(workdir, argv[argn]); + printf(" Setting WorkDir to be '%s'.\n", workdir ); + } + else + if (strcmp(argv[argn],"-winsz")==0) + { + argn++; + if (argn == argc) { printf("Missing entry after '%s'.\n", argv[argn-1] ); exit(1); } + if (sscanf(argv[argn],"%d",&winwidth) != 1) + { printf("Bad integer window-width after '%s'.\n", argv[argn-1] ); exit(1); } + argn++; + if (argn == argc) { printf("Missing entry after '%s'.\n", argv[argn-2] ); exit(1); } + if (sscanf(argv[argn],"%d",&winht) != 1) + { printf("Bad integer window-height after '%s'.\n", argv[argn-2] ); exit(1); } + printf(" Setting window size = %d x %d\n", winwidth, winht ); + setwinsz = 1; + } + else + if (strcmp( argv[argn], "-debug" ) == 0) + { + debug = 1; + #if (PLATFORM_KIND==Posix_Platform) + system( "pwd" ); + #else + system( "dir" ); + #endif + } + else + if (k==1) + { + current_working_filename = strdup(argv[argn]); + infile = fopen(current_working_filename,"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", argv[argn]); exit(1);} + k = 2; + ok_slcttxprog = 0; + } + else + { + printf("Unknown command-line parameter '%s'\n", argv[argn]); + /* exit(1); */ + } + argn = argn + 1; + } + + mpanel = init_top_outer_window( &argc, &argv, winwidth, winht, "OpenTaxSolver-GUI", 0, 0 ); + if (!setwinsz) + { /* Check for super-hi-res monitor screen. */ + int swd, sht; + GdkRectangle workarea = {0}; + gdk_monitor_get_workarea( + gdk_display_get_primary_monitor( gdk_display_get_default() ), + &workarea + ); + swd = workarea.width; + sht = workarea.height; + if (verbose) printf ("ScreenWidth=%d x ScreenHeight=%d\n", swd, sht ); + if (swd > 2500) + { /*Hi-DPI Screen*/ + printf("Screen size = %d x %d\n", swd, sht ); + if (swd > 3840) swd = 3840; /* Limit reported screen size to realistic values. */ + if (sht > 2160) sht = 2160; + winwidth = (int)((float)winwidth * (float)swd / 1920.0); + winht = (int)((float)winht * (float)sht / 1080.0); + printf("Detected HiDPI Screen. Setting window size = %d x %d\n", winwidth, winht ); + gtk_widget_set_size_request( outer_window, winwidth, winht ); + } + setwinsz = 1; + } + + gtk_window_set_resizable( GTK_WINDOW( outer_window ), 0 ); + // make_sized_label( mpanel, 180, 10, "Open-Tax-Solver", 20.0 ); + + /* When the window is given the "delete_event" signal by the window manager, exit the program. */ + g_signal_connect( outer_window, "delete_event", G_CALLBACK(quit), NULL ); + +// gtk_widget_set_app_paintable( outer_window, TRUE ); +// g_signal_connect( outer_window, "expose-event", G_CALLBACK(on_expose_event), NULL); + g_signal_connect( outer_window, "draw", G_CALLBACK( handle_draw_event ), NULL ); + + + make_rectangular_separator( mpanel, 59, 6, 387, 102 ); + + y = 105; + make_sized_label( mpanel, winwidth / 2 - 60, y, "2024 Tax Year", 11.0 ); + + /* Place warning about this being a 'development version' when being revised. */ + // tmpwdg = make_label( mpanel, winwidth / 2 - 120, y+15, "-- DEVELOPMENT VERSION ONLY --" ); + // set_label_color( tmpwdg, "#ff0000" ); + + y = y + 33; + make_sized_label( mpanel, 10, 135, "Select Tax Program:", 12.0 ); + + x = 30; + y = y + 25; + y1 = y; + dy = ((winht - 120) - y) / 7; + formid = setform( form_US_1040 ); + txprogstog = make_radio_button( mpanel, 0, x, y, "US 1040 (w/Scheds A,B,D)", slcttxprog, formid ); + add_tool_tip( txprogstog, "Also does the 8949 forms." ); + // gtk_widget_set_sensitive( txprogstog, grayed_out ); /* Gray-out for this version - Not Ready. */ + y = y + dy; + formid = setform( form_US_1040_Sched_C ); + make_radio_button( mpanel, txprogstog, x, y, "US 1040 Sched C", slcttxprog, formid ); + y = y + dy; + formid = setform( form_CA_540 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "CA State 540", slcttxprog, formid ); + // gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + y = y + dy; + formid = setform( form_NC_D400 ); + make_radio_button( mpanel, txprogstog, x, y, "NC State DC400", slcttxprog, formid ); + y = y + dy; + formid = setform( form_NJ_1040 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "NJ State 1040", slcttxprog, formid ); + // gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + y = y + dy; + formid = setform( form_AZ_140 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "AZ State 140", slcttxprog, formid ); + // gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + y = y + dy; + formid = setform( form_MI_1040 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "MI State 1040", slcttxprog, formid ); + // gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + fronty2 = y + dy; + + y = y1; + x = winwidth/2 + 40; + formid = setform( form_OH_IT1040 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "OH State IT1040", slcttxprog, formid ); + // gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + y = y + dy; + formid = setform( form_PA_40 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "PA State 40", slcttxprog, formid ); + // gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + y = y + dy; + formid = setform( form_VA_760 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "VA State 760", slcttxprog, formid ); + // gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + y = y + dy; + formid = setform( form_NY_IT201 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "NY State IT201", slcttxprog, formid ); + // gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + y = y + dy; + formid = setform( form_MA_1 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "MA State 1", slcttxprog, formid ); + if (0) /* Need to leave one of these in code, to prevent compiler warning about unused variable. */ + gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + + y = y + dy; + formid = setform( form_OR_40 ); + tmpwdg = make_radio_button( mpanel, txprogstog, x, y, "OR State 40", slcttxprog, formid ); + // gtk_widget_set_sensitive( tmpwdg, grayed_out ); /* Gray-out for this version - Not Ready. */ + + y = y + dy; + formid = setform( form_other ); + txprogstog = make_radio_button( mpanel, txprogstog, x, y, "Other", slcttxprog, formid ); + y2 = y + dy; + if (selected_other) set_radio_button( txprogstog ); + + fronty1 = y1; + if (y2 > fronty2) + fronty2 = y2; + // make_rectangular_separator( mpanel, 20, y1-5, winwidth - 20, y2 ); + + slcttxprog( 0, "0" ); /* Set default tax program. */ + + if (infile == 0) + { + button = make_button_wsizedcolor_text( mpanel, 30, winht - 95, "Start New Return", 14.0, "#000000", pick_template, 0 ); + add_tool_tip( button, "Start a fresh new blank return of the selected type." ); + + button = make_button_wsizedcolor_text( mpanel, (int)(0.5222 * (float)winwidth), winht - 95, "Open Saved Form", 14.0, "#000000", pick_file, 0 ); + add_tool_tip( button, "Open a previously saved or existing, tax form or example." ); + make_sized_label( mpanel, winwidth / 2 - 25, winht - 30, vrsnmssg, 8 ); + make_sized_label( mpanel, winwidth / 2 - 45, winht - 14, ots_pkg_mssg, 7 ); + } + else + Get_New_Tax_Form_Page( current_working_filename ); + + button = make_button( mpanel, 20, winht - 39, "Help", helpabout1, 0 ); + add_tool_tip( button, "Get information about this program, Help, and Updates." ); + button = make_button( mpanel, winwidth - 74, winht - 39, "Quit", quit, 0 ); + add_tool_tip( button, "Leave this program." ); + + Check_for_illegal_characters_in_the_file_path( argv[0] ); + + ok_slcttxprog = 1; + gtk_widget_show_all( outer_window ); + while (1) // gtk_main(); + { + UpdateCheck(); /* Check for, and serve, any pending GTK window/interaction events. */ + Sleep_seconds( 0.05 ); /* No need to spin faster than ~20 Hz update rate. */ + if ((need_to_resize) && (Report_Time() - last_resize_time > 0.35)) + { + if (verbose) printf(" Resizing to (%d, %d)\n", winwidth, winht ); + Update_box_info(); + Setup_Tax_Form_Page(0); + need_to_resize = 0; + } + if (schedule_PDF_conversion) do_pdf_conversion(); + } + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Makefile b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Makefile new file mode 100755 index 0000000..4157a8d --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Makefile @@ -0,0 +1,107 @@ +#============================ +# Makefile for OpenTaxSolver +#============================ + +# Compiler options +CC = cc +CFLAGS = +COPTIM = -O -Wall +LDFLAGS = -lm + +# For MSYS1.0, define "CFLAGS = -std=c99" +# in your build env. + +# Note that under Windows, in an MSYS2 shell, the ".exe" suffix is implied for +# the EXE_* file list macro values. This maintains compatiblity with *nix +# platforms, which don't use the ".exe" suffix for programs. However, in +# MSYS1, this handling is not automatic; currently, MSYS1 is being used to +# build standalone Windows versions of OTS, since MSYS 2.0 produces exe files +# which fault at startup. TODO: Resolve the MSYS2 build issue, and provide +# instructions for setting up a Windows MINGW build environment. + +# EFS = Executable File Suffix; not-defined (empty) for Linux. Includes the "." +# separator. To detect whether a ".exe" suffix should be added to executable +# file names, The "MSYSTEM" environment variable is detected. If detected, +# regardless of value, a ".exe" file extension is used. + +ifneq ($(strip $(MSYSTEM)),) + EFS := .exe +endif + +#==================== +#====== Macros ====== +#==================== + +#====== Taxsolver programs; in ../bin/ ====== +# Add new taxsolver modules to this list +TAXSOLVE := \ + taxsolve_US_1040_2024 \ + taxsolve_US_1040_Sched_C_2024 \ + taxsolve_PA_40_2024 \ + taxsolve_NJ_1040_2024 \ + taxsolve_VA_760_2024 \ + taxsolve_NC_D400_2024 \ + taxsolve_OH_IT1040_2024 \ + taxsolve_NY_IT201_2024 \ + taxsolve_MA_1_2024 \ + taxsolve_CA_540_2024 \ + taxsolve_HSA_f8889 \ + taxsolve_f8606 \ + taxsolve_US_1040_Sched_SE_2024 \ + taxsolve_f8812_2024 \ + taxsolve_f8829_2024 \ + taxsolve_f8995_2024 \ + taxsolve_f8959_2024 \ + taxsolve_f8960_2024 \ + taxsolve_f2210_2024 \ + taxsolve_CA_5805_2024 \ + taxsolve_AZ_140_2024 \ + taxsolve_MI_1040_2024 \ + taxsolve_OR_40_2024 + +# List of taxsolver programs in ../bin/ +EXE_TAXSOLVE := $(patsubst %,../bin/%$(EFS), $(TAXSOLVE)) + +#====== IO programs; in ../bin/ ====== +IO := \ + universal_pdf_file_modifier \ + convert_results2xfdf + +# List of ior programs in ../bin/ +EXE_IO := $(patsubst %,../bin/%$(EFS), $(IO)) + +#====== Top level programs ; in ../ ====== +TOP := \ + Run_taxsolve_GUI + +# List of top level programs +EXE_TOP := $(patsubst %,../%$(EFS), $(TOP)) + + +#=================== +#====== Rules ====== +#=================== + +all: $(EXE_TAXSOLVE) $(EXE_IO) $(EXE_TOP) + +# Pattern rule for taxsolver programs in ../bin/ +# includes dependency on taxsolve_routines.c +$(EXE_TAXSOLVE): ../bin/%$(EFS): %.c taxsolve_routines.c + $(CC) $(CFLAGS) $(COPTIM) -o $@ $< $(LDFLAGS) + +# Pattern rule for io programs in ../bin/ +$(EXE_IO): ../bin/%$(EFS): %.c + $(CC) $(CFLAGS) $(COPTIM) -o $@ $< $(LDFLAGS) + +# Pattern rule for top level programs in ../ +$(EXE_TOP): ../%$(EFS): %.c + $(CC) $(CFLAGS) $(COPTIM) -o $@ $< $(LDFLAGS) + + +clean: + rm -fv $(EXE_TAXSOLVE) $(EXE_IO) $(EXE_TOP) + +# +# +# +# diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Run_taxsolve_GUI.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Run_taxsolve_GUI.c new file mode 100755 index 0000000..229cac9 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/Run_taxsolve_GUI.c @@ -0,0 +1,260 @@ +/*** + Run_taxsolve_GUI.c - This program merely invokes "bin/ots_gui2.exe". + It is a convenience, because it is easily found at the top directory + of the OTS installation. So new users can make a shortcut to it. + And it enables starting the application by double-clicking on the + start-icon (or file), unlike the previously used command-script. + (Some window managers would open the command-script for editing + instead of executing it, since being a script, it was a text file. + Other window managers would ask whether to run or display, which + this is an uneeded extra step, and it did also confuse some users. + ) + + GNU Public License - GPL: + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. + + Compile: + cc -O Run_taxsolve_GUI.c -o ../Run_taxsolve_GUI +***/ + +#include +#include +#include +#include + +#define MaxStr 8192 + +char path[MaxStr], cmd[MaxStr], cmd2[MaxStr], bin_path[MaxStr]; +int verbose=0; + + +void caps_cpy( char *wrd ) +{ + int j=0; + while (wrd[j] != '\0') + { + wrd[j] = toupper( wrd[j] ); + j++; + } +} + + +void safe_strcpy( char *dst, char *src, int maxlen ) +{ + int j=0; + while ((j < maxlen-1) && (src[j] != '\0')) + { + dst[j] = src[j]; + j++; + } + dst[j] = '\0'; +} + +void safe_strcat( char *dst, char *src, int maxlen ) +{ + int j=0, k; + k = strlen( dst ); + while ((k < maxlen-1) && (src[j] != '\0')) + { + dst[k++] = src[j++]; + } + dst[k] = '\0'; +} + + +#ifndef PLATFORM_KIND + #define Posix_Platform 0 + #define Mingw_Platform 1 + #define MsVisC_Platform 2 + #ifdef __CYGWIN32__ + #ifndef __CYGWIN__ + #define __CYGWIN__ __CYGWIN32__ + #endif + #endif + #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MSYS__) + #define PLATFORM_KIND Mingw_Platform /* MinGW or like platform */ + #elif defined(__WIN32) || defined(WIN32) + #define PLATFORM_KIND MsVisC_Platform /* microsoft visual C */ + #else + #define PLATFORM_KIND Posix_Platform /* Posix/Linux/Unix */ + #endif +#endif + + +int main( int argc, char *argv[] ) +{ + char *substr; + int k=1, gui_version_to_invoke=2, gui_size=0, darkmode=0; + + while (k < argc) + { + if (strcmp( argv[k], "-gui3" ) == 0) + { + gui_version_to_invoke = 3; + printf("Will use 'ots_gui%d'.\n", gui_version_to_invoke ); + } + else + if (strcmp( argv[k], "-large" ) == 0) + { + gui_size = 1; + gui_version_to_invoke = 3; + printf("Will use Large-mode with 'ots_gui%d'.\n", gui_version_to_invoke ); + } + else + if (strcmp( argv[k], "-darkmode" ) == 0) + { + darkmode = 1; + gui_version_to_invoke = 3; + printf("Will use 'dark-mode' with 'ots_gui%d'.\n", gui_version_to_invoke ); + } + else + if (strcmp( argv[k], "-v" ) == 0) + { + verbose = 1; + printf("Verbose mode ON.\n"); + } + else + if (strcmp( argv[k], "-help" ) == 0) + { + printf("RunTaxSolve Help:\n"); + printf(" This program is a convenient script for starting the OTS GUI\n"); + printf(" in a way that is unified and portable to all platforms.\n"); + printf("\n"); + printf(" Options:\n"); + printf(" -v - Verbose mode,\n"); + printf(" -gui3 - Use the newer (Gtk-3) version of the OTS GUI.\n"); + printf(" -large - Large GUI mode for High-DPI screens.\n"); + printf(" -darkmode - Setss GUI to use 'dark-mode'.\n"); + printf("\n"); + exit(0); + } + else + printf("Unknown option '%s'\n", argv[k] ); + k++; + } + + strncpy( path, argv[0], MaxStr ); + if (verbose) printf("RunTaxSolve invoked as: '%s'\n", path ); + + #if (PLATFORM_KIND != Posix_Platform) + + { /*mswin*/ + char drive_letter='c'; + caps_cpy( path ); + if (verbose) printf("\tPath: '%s'\n", path ); + if (path[1] == ':') + { /*Absolute_reference*/ + drive_letter = path[0]; + if (verbose) printf("\tAbsolutePath: driveletter = %c\n", drive_letter ); + safe_strcpy( bin_path, &(path[2]), MaxStr ); + if (verbose) printf("\t BinPath = '%s'\n", bin_path ); + substr = strstr(bin_path,"\\RUN_TAXSOLVE_GUI"); + if (substr != 0) + { + substr[0] = '\0'; + safe_strcat( bin_path, "\\bin", MaxStr ); + sprintf(cmd,"set path=%c:%s;%%PATH%% & ", drive_letter, bin_path ); + + if (gui_size) + safe_strcat( cmd, "set GDK_SCALE=2 & ", MaxStr ); + if (darkmode) + safe_strcat( cmd, "set GTK_THEME=Adwaita:dark & ", MaxStr ); + + sprintf(cmd2,"start /B %c:\"%s\\ots_gui%d.exe\"", + drive_letter, bin_path, gui_version_to_invoke ); + safe_strcat( cmd, cmd2, MaxStr ); + } + else { printf("Unexpected Error\n"); exit(1); } + } /*Absolute_reference*/ + else + { /*Local_reference*/ + // printf("Start path must begin with drive-letter:\n"); + // if ((path[0] != '/') && (path[0] != '\\')) exit(1); + if (verbose) printf("\tLocalReference: (no colon in path)\n"); + safe_strcpy( bin_path, path, MaxStr ); + if (verbose) printf("\t BinPath = '%s'\n", bin_path ); + substr = strstr(bin_path,"RUN_TAXSOLVE_GUI"); + if (substr != 0) + { + substr[0] = '\0'; + if (strlen( bin_path ) > 0) + safe_strcat( bin_path, "bin", MaxStr ); + else + safe_strcpy( bin_path, "bin", MaxStr ); + sprintf(cmd,"set path=%s;%%PATH%% & ", bin_path ); + + if (gui_size) + safe_strcat( cmd, "set GDK_SCALE=2 & ", MaxStr ); + if (darkmode) + safe_strcat( cmd, "set GTK_THEME=Adwaita:dark & ", MaxStr ); + + sprintf(cmd2,"start /B %s\\ots_gui%d.exe", bin_path, gui_version_to_invoke ); + safe_strcat( cmd, cmd2, MaxStr ); + } + else { printf("Unexpected Error2\n"); exit(1); } + } /*Local_reference*/ + } /*mswin*/ + + #else + + { /*posix*/ + int j; + substr = strstr( path, "Run_taxsolve_GUI" ); + if (substr == 0) { printf("Could not find path.\nSaw: '%s'\n", bin_path); exit(1); } + substr[0] = '\0'; /* The "path" variable now holds the path to OTS's top directory. */ + if (verbose) printf("\tOTS Path = '%s'\n", path ); + + safe_strcpy( bin_path, path, MaxStr ); + j = strlen( bin_path ); + if ((j > 0) && (bin_path[j-1] != '/')) safe_strcat( bin_path, "/", MaxStr ); + if (j == 0) safe_strcpy( bin_path, "./", MaxStr ); + sprintf(cmd,"bin/ots_gui%d", gui_version_to_invoke ); + safe_strcat( bin_path, cmd, MaxStr ); + + #ifdef __APPLE__ + /* Apple's Finder starts OTS with "PWD" set to user's home-dir, instead of OTS-dir. */ + /* So "cd" to OTS just before starting GUI. */ + safe_strcpy( cmd, "cd \"", MaxStr ); + safe_strcat( cmd, path, MaxStr ); + safe_strcat( cmd, "\" ; ", MaxStr ); + if (gui_size) + safe_strcat( cmd, "export GDK_SCALE=2; ", MaxStr ); + if (darkmode) + safe_strcat( cmd, "export GTK_THEME=Adwaita:dark; ", MaxStr ); + safe_strcat( cmd, "\"", MaxStr ); + safe_strcat( cmd, bin_path, MaxStr ); + safe_strcat( cmd, "\" &", MaxStr ); + #else + /* Linux, etc. */ + safe_strcpy( cmd, "", MaxStr ); + if (gui_size) + safe_strcat( cmd, "export GDK_SCALE=2; ", MaxStr ); + if (darkmode) + safe_strcat( cmd, "export GTK_THEME=Adwaita:dark; ", MaxStr ); + safe_strcat( cmd, "\"", MaxStr ); + safe_strcat( cmd, bin_path, MaxStr ); + safe_strcat( cmd, "\" &", MaxStr ); + #endif + } /*posix*/ + + #endif + + printf("Issuing: '%s'\n", cmd ); + system( cmd ); + + return 0; +} + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/archive/taxsolve_US_1040_2024_01_07_2025.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/archive/taxsolve_US_1040_2024_01_07_2025.c new file mode 100755 index 0000000..7d54be3 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/archive/taxsolve_US_1040_2024_01_07_2025.c @@ -0,0 +1,2792 @@ +/************************************************************************/ +/* TaxSolve_usa_fed1040_2024.c - OpenTaxSolver for USFed1040 */ +/* Copyright (C) 2025 - Aston Roberts */ +/* */ +/* Tax Solver for US Fedral 1040 Income Tax return for 2024 Tax Year. */ +/* */ +/* OTS Project Home Page and Updates: */ +/* http://opentaxsolver.sourceforge.com/ */ +/* */ +/* Compile: cc taxsolve_US_1040_2024.c -o taxsolve_US_1040_2024 */ +/* Run: ./taxsolve_US_1040_2024 Fed1040_2024.txt */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ +/* */ +/* Aston Roberts 1-5-2025 aston_roberts@yahoo.com */ +/************************************************************************/ + +float thisversion=22.00; + +#include +#include +#include +#include +#include +#include +#include "taxsolve_routines.c" + +#define CAP_GAIN_ADJUSTMENT_CODES "BTNHDQXRWLESCMOZY" /* Form 8949 Instructions */ +#define MAXADJERRCNT 25 /* Max number of adj_code errors to print to terminal */ + +#define SINGLE 1 +#define MARRIED_FILING_JOINTLY 2 +#define MARRIED_FILING_SEPARAT 3 +#define HEAD_OF_HOUSEHOLD 4 +#define WIDOW 5 +#define Yes 1 +#define No 0 + +double SchedA[MAX_LINES], SchedB[MAX_LINES], SchedD[MAX_LINES], amtws[MAX_LINES]; +double Sched1[MAX_LINES], Sched2[MAX_LINES], Sched3[MAX_LINES]; +double Sched3_13a=0.0, Sched3_13b=0.0, Sched3_13c=0.0, Sched3_13d=0.0, + Sched3_13z=0.0; +double L1a=0.0, L1b=0.0, L1c=0.0, L1d=0.0, L1e=0.0, L1f=0.0, L1g=0.0, L1h=0.0, L1i=0.0; +double L2a=0.0; /* Tax-exempt interest (only for SocSec calculations). */ +double L3a=0.0; /* Qualified dividends. */ +double L4a=0.0; /* IRA distributions */ +double L5a=0.0; /* Pensions, and annuities. */ +double L6a=0.0; /* Social security benefits. */ +double L25a=0.0, L25b=0.0, L25c=0.0; +double L27a=0.0, L27b=0.0, L27c=0.0; +double Sched2_1a=0.0, Sched2_1b=0.0, Sched2_1c=0.0, Sched2_1d=0.0, Sched2_1e=0.0, Sched2_1f=0.0, Sched2_1y=0.0, Sched2_1z=0.0; +double S4_60b=0.0; /* First-time homebuyer credit repayment. Form 5405. */ +double qcgws[MAX_LINES]; /* Support for AMT calculation. (qual.div+cap.gain wrksht vals.)*/ +double amtws2c=0.0; /* Investment interest expense (difference between regular tax and AMT) - AMT entry */ +double amtws2g=0.0; /* Specified private activity bond interest exempt from regular tax - AMT entry */ +int Do_SchedD=No, Do_QDCGTW=No, Do_SDTW=No; +int status, under65=Yes, over65=No, dependent=No, force_print_all_pdf_forms=0; +int ForceItemize=0; +double localtax[10], loctaxlimit, homemort[10]; +double collectibles_gains=0.0, ws_sched_D[MAX_LINES]; + +char adj_code_err[MAXADJERRCNT][1024]; +int adjerrcnt=0; + + /* Following values taken from 1040-Instructions pg 110. */ /* Updated for 2024. */ +double brkpt[4][9]={ + { 0.0, 11600.0, 47150.0, 100525.0, 191950.0, 243725.0, 609350.0, 9e19 }, /* Single */ + { 0.0, 23200.0, 94300.0, 201050.0, 383900.0, 487450.0, 731,201.0, 9e19 }, /* Married, filing jointly. */ + { 0.0, 11600.0, 47150.0, 100525.0, 191950.0, 243725.0, 365600.0, 9e19 }, /* Married, filing separate. */ + { 0.0, 16550.0, 63100.0, 100500.0, 191150.0, 243700.0, 609350.0, 9e19 }, /* Head of Household. */ + }; + double txrt[4][9] ={ + { 0.1, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37 }, /* Single */ + { 0.1, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37 }, /* Married, filing jointly. */ + { 0.1, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37 }, /* Married, filing separate. */ + { 0.1, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37 }, /* Head of Household. */ + }; + + +double TaxRateFormula( double x, int status ) /* Returns tax due. */ +{ + double sum=0.0; + int bracket=0; + if (status == WIDOW) status = MARRIED_FILING_JOINTLY; /* Handle case of widow(er). */ + status = status - 1; /* Arrays start at zero; not one. */ + while (brkpt[status][bracket+1] < x) + { + sum = sum + (brkpt[status][bracket+1] - brkpt[status][bracket]) * txrt[status][bracket]; + bracket = bracket + 1; + } + return (x - brkpt[status][bracket]) * txrt[status][bracket] + sum; +} + + +void Report_bracket_info( double income, double actual_tax, int status ) +{ + int bracket=0; + if (status == WIDOW) status = MARRIED_FILING_JOINTLY; /* Handle case of widow(er). */ + status = status - 1; /* Arrays start at zero; not one. */ + while (brkpt[status][bracket+1] < income) bracket++; + printf(" You are in the %2.1f%% marginal tax bracket,\n and you are paying an effective %2.1f%% tax on your income.\n", + 100.0 * txrt[status][bracket], 100.0 * (actual_tax) / (income + 1e-9) ); + fprintf(outfile," You are in the %2.1f%% marginal tax bracket,\n and you are paying an effective %2.1f%% tax on your income.\n", + 100.0 * txrt[status][bracket], 100.0 * (actual_tax) / (income + 1e-9) ); +} + + +double TaxRateFunction( double income, int status ) /* Emulates table lookup or function appropriately. */ +{ + double x, dx, tx; + int k; + if (income < 100000.0) /* Quantize to match tax-table exactly. */ + { + if (income < 25.0) x = 5.0; else + if (income < 3000.0) x = 25.0; else x = 50.0; + dx = 0.5 * x; + k = income / x; + x = x * (double)k + dx; + tx = (int)(TaxRateFormula( x, status ) + 0.5); + } + else + tx = TaxRateFormula( income, status ); + return tx; +} + + + +void showschedA( int linenum ) +{ if (SchedA[linenum] > 0.0) fprintf(outfile," A%d = %6.2f\n", linenum, SchedA[linenum] ); } + +void showschedA_wMsg( int linenum, char *msg ) +{ if (SchedA[linenum] > 0.0) fprintf(outfile," A%d = %6.2f %s\n", linenum, SchedA[linenum], msg ); } + +void print2( char *msg ) +{ + printf("%s", msg ); + fprintf(outfile, "%s", msg ); +} + + +/*-----------------------------------------------------------------*/ +/* Qualified Dividends and Capital Gain Tax Worksheet for Line 16. */ +/* From page 37 of instructions. */ +/*-----------------------------------------------------------------*/ +void capgains_qualdividends_worksheets( int status ) /* Not updated for 2024. */ +{ + int j; + + qcgws[1] = L[15]; + qcgws[2] = L3a; + if (Do_SchedD) + qcgws[3] = NotLessThanZero(smallerof( SchedD[15], SchedD[16] )); + else + qcgws[3] = L[7]; + qcgws[4] = qcgws[2] + qcgws[3]; + qcgws[5] = NotLessThanZero( qcgws[1] - qcgws[4] ); + switch (status) + { + case SINGLE: case MARRIED_FILING_SEPARAT: qcgws[6] = 44625.0; break; + case MARRIED_FILING_JOINTLY: case WIDOW: qcgws[6] = 89250.0; break; + case HEAD_OF_HOUSEHOLD: qcgws[6] = 59750.0; break; + } + qcgws[7] = smallerof( qcgws[1], qcgws[6] ); + qcgws[8] = smallerof( qcgws[5], qcgws[7] ); + qcgws[9] = qcgws[7] - qcgws[8]; // This amount is taxed at 0% + qcgws[10] = smallerof( qcgws[1], qcgws[4] ); + qcgws[11] = qcgws[9]; + qcgws[12] = qcgws[10] - qcgws[11]; + switch (status) + { + case SINGLE: qcgws[13] = 492300.0; break; + case MARRIED_FILING_SEPARAT: qcgws[13] = 276900.0; break; + case MARRIED_FILING_JOINTLY: case WIDOW: qcgws[13] = 553850.0; break; + case HEAD_OF_HOUSEHOLD: qcgws[13] = 523050.0; break; + } + qcgws[14] = smallerof( qcgws[1], qcgws[13] ); + qcgws[15] = qcgws[5] + qcgws[9]; + qcgws[16] = NotLessThanZero( qcgws[14] - qcgws[15] ); + qcgws[17] = smallerof( qcgws[12], qcgws[16] ); + qcgws[18] = 0.15 * qcgws[17]; + qcgws[19] = qcgws[9] + qcgws[17]; + qcgws[20] = qcgws[10] - qcgws[19]; + qcgws[21] = 0.20 * qcgws[20]; + qcgws[22] = TaxRateFunction( qcgws[5], status ); + qcgws[23] = qcgws[18] + qcgws[21] + qcgws[22]; + qcgws[24] = TaxRateFunction( qcgws[1], status ); + qcgws[25] = smallerof( qcgws[23], qcgws[24] ); + for (j = 1; j <= 25; j++) + { + printf(" Qual. Div & Gains WorkSheet %d: %8.2f\n", j, qcgws[j] ); + if (j == 3) { if (Do_SchedD) fprintf(outfile,"\t\t3: Check Yes.\n"); else fprintf(outfile,"\t\t3: Check No.\n"); } + fprintf(outfile," Qual. Div & Gains WorkSheet %d: %8.2f\n", j, qcgws[j] ); + } + L[16] = Conditional_Round( qcgws[25] ); +} + + + + +/*----------------------------------------------------------------------------------------------*/ +/* Form-6251 - Alternative Minimum Tax (AMT) form detailed calculations. */ +/* This routine establishes the framework for the 6251 form, for the limited few who need it. */ +/* Form 6251 asks many highly specialized questions, which are assumed zero for most filers. */ +/* Those who should make the additional entries will no-doubt know who they are, and can */ +/* simply add them to this section. The balance of the routine will be helpful in either case. */ +/* --- Anyone indicated to fill-out Form 6251 should review the 6251 instruction booklet. --- */ +/*----------------------------------------------------------------------------------------------*/ +double form6251_AlternativeMinimumTax( int itemized ) /* Not updated for 2024. */ +{ + double thresholdA=0.0, thresholdB=0.0, thresholdC=0.0, amtexmption=0.0; + double offsetA=0.0; + double amtws2a=0.0, amtws2b=0.0, amtws2e=0.0; + int j, file_amt=1; + + printf("Review AMT form6251 routine for your situation.\n"); + fprintf(outfile,"Review AMT form6251 routine for your situation.\n"); + + /* Part I - Alternative Minimum Taxable Income (AMTI) */ + if (L[15] > 0.0) + amtws[1] = L[15]; + else + amtws[1] = L[11] - L[14]; + + if (itemized) + amtws2a = SchedA[7]; + else + amtws2a = L[12]; + + amtws2b = -(Sched1[1] + Sched1[8]); + + /* Following amounts assumed normally zero, but review and adjust if needed. */ + // amtws2c = 0.0; /* Investment interest expense. (Diff between regular tax and AMT). */ + // amtws2d = 0.0; /* Depletion (Diff between regular tax and AMT). */ + amtws2e = absolutev( Sched1[8] ); + // amtws2f = -0.0; /* Alternative tax net operating loss deduction, as negative amount. */ + // amtws2g = 0.0; /* Interest from specified private activity bonds exempt from the regular tax */ + // amtws2h = 0.0; /* Qualified small business stock (7% of gain excluded under section 1202) */ + // amtws2i = 0.0; /* Exercise incentive stock options (excess of AMT income over reg tax income) */ + // amtws2j = 0.0; /* Estates and trusts (amount from Schedule K-1 (Form 1041), box 12, code A) */ + // amtws2k = 0.0; /* Disposition of property (difference between AMT and regular tax gain or loss) */ + // amtws2l = 0.0; /* Deprec assets placed in service after 1986 (diff between regular tax and AMT) */ + // amtws2m = 0.0; /* Passive activities (difference between AMT and regular tax income or loss) */ + // amtws2n = 0.0; /* Loss limitations (difference between AMT and regular tax income or loss) */ + // amtws2o = 0.0; /* Circulation costs (difference between regular tax and AMT) */ + // amtws2p = 0.0; /* Long-term contracts (difference between AMT and regular tax income) */ + // amtws2q = 0.0; /* Mining costs (difference between regular tax and AMT) */ + // amtws2r = 0.0; /* Research and experimental costs (difference between regular tax and AMT) */ + // amtws2s = -0.0; /* Income from certain installment sales before 1/1/87 (As negaitive amount.) */ + // amtws2t = 0.0; /* Intangible drilling costs preference */ + + amtws[2] = amtws2a + amtws2b + amtws2c + amtws2e + amtws2g; + + for (j = 1; j <= 3; j++) + amtws[4] = amtws[4] + amtws[j]; + + if ((status == MARRIED_FILING_SEPARAT) && (amtws[4] > 831150.0)) + { + if (amtws[4] > 1084150.0) + amtws[4] = amtws[4] + 63250.0; + else + amtws[4] = amtws[4] + 0.25 * (amtws[4] - 831150.0); + } + + /* Part II */ + switch (status) + { + case SINGLE: case HEAD_OF_HOUSEHOLD: + thresholdA = 578150.0; + thresholdB = 903350.0; + thresholdC = 220700; + offsetA = 4414.0; + amtexmption = 81300.0; + break; + case MARRIED_FILING_JOINTLY: case WIDOW: + thresholdA = 1156300.0; + thresholdB = 1662300.0; + thresholdC = 220700.0; + offsetA = 4414.0; + amtexmption = 126500.0; + break; + case MARRIED_FILING_SEPARAT: + thresholdA = 578150.0; + thresholdB = 831150.0; + thresholdC = 110350.0; + offsetA = 2207.0; + amtexmption = 63250.0; + break; + default: printf("Status %d not handled.\n", status); exit(1); + } + + if (amtws[4] > thresholdA) + { /* Exemption Worksheet - page 9. */ + double ews[20]; + if (amtws[4] >= thresholdB) + amtexmption = 0.0; + else + { + ews[1] = amtexmption; + ews[2] = amtws[4]; + ews[3] = thresholdA; + ews[4] = NotLessThanZero( ews[2] - ews[3] ); + ews[5] = 0.25 * ews[4]; + ews[6] = NotLessThanZero( ews[1] - ews[5] ); + amtexmption = ews[6]; + /* Does not handle "Certain Children Under Age 24". */ + } + } + + amtws[5] = amtexmption; + amtws[6] = NotLessThanZero( amtws[4] - amtws[5] ); + if (amtws[6] > 0.0) + { /* AMT Lines 7 through 9, */ + + if ((L[7] != 0.0) || (L3a != 0.0) || ((SchedD[15] > 0.0) && (SchedD[16] > 0.0))) + { /* Part III */ + amtws[12] = amtws[6]; + amtws[13] = largerof( qcgws[4], ws_sched_D[13] ); + amtws[14] = SchedD[19]; + if (Do_SDTW) + amtws[15] = smallerof( amtws[13] + amtws[14], ws_sched_D[10] ); + else + amtws[15] = amtws[13]; + amtws[16] = smallerof( amtws[12], amtws[15] ); + amtws[17] = amtws[12] - amtws[16]; + if (amtws[17] <= thresholdC) + amtws[18] = 0.26 * amtws[17]; + else + amtws[18] = 0.28 * amtws[17] - offsetA; + switch (status) + { + case MARRIED_FILING_JOINTLY: case WIDOW: + amtws[19] = 89250.0; + break; + case SINGLE: case MARRIED_FILING_SEPARAT: + amtws[19] = 44625.0; + break; + case HEAD_OF_HOUSEHOLD: + amtws[19] = 59750.0; + } + if (Do_QDCGTW) + amtws[20] = NotLessThanZero( qcgws[5] ); + else + if (Do_SDTW) + amtws[20] = NotLessThanZero( ws_sched_D[14] ); + else + amtws[20] = NotLessThanZero( L[15] ); + amtws[21] = NotLessThanZero( amtws[19] - amtws[20] ); + amtws[22] = smallerof( amtws[12], amtws[13] ); + amtws[23] = smallerof( amtws[21], amtws[22] ); + amtws[24] = amtws[22] - amtws[23]; + switch (status) + { + case SINGLE: amtws[25] = 492300.0; break; + case MARRIED_FILING_SEPARAT: amtws[25] = 276900.0; break; + case MARRIED_FILING_JOINTLY: case WIDOW: amtws[25] = 553850.0; break; + case HEAD_OF_HOUSEHOLD: amtws[25] = 523050.0; break; + default: printf("Status %d not handled.\n", status); exit(1); + } + amtws[26] = amtws[21]; + if (Do_QDCGTW) + amtws[27] = NotLessThanZero( qcgws[5] ); + else + if (Do_SDTW) + amtws[27] = NotLessThanZero( ws_sched_D[21] ); + else + amtws[27] = NotLessThanZero( L[15] ); + amtws[28] = amtws[26] + amtws[27]; + amtws[29] = NotLessThanZero( amtws[25] - amtws[28] ); + amtws[30] = smallerof( amtws[24], amtws[29] ); + amtws[31] = 0.15 * amtws[30]; + amtws[32] = amtws[23] + amtws[30]; + if (absolutev( amtws[12] - amtws[32] ) > 0.005) + { /*lines 33-37*/ + amtws[33] = amtws[22] - amtws[32]; + amtws[34] = 0.20 * amtws[33]; + if (amtws[35] != 0.0) + { /*lines 35-37*/ + amtws[35] = amtws[17] + amtws[32] + amtws[33]; + amtws[36] = amtws[12] - amtws[35]; + amtws[37] = 0.25 * amtws[36]; + } /*lines 35-37*/ + } /*lines 33-37*/ + amtws[38] = amtws[18] + amtws[31] + amtws[34] + amtws[37]; + if (amtws[12] <= thresholdC) + amtws[39] = 0.26 * amtws[12]; + else + amtws[39] = 0.28 * amtws[12] - offsetA; + amtws[40] = smallerof( amtws[38], amtws[39] ); + amtws[7] = amtws[40]; + } /* Part III */ + else + { + if (amtws[6] <= thresholdC) + amtws[7] = 0.26 * amtws[6]; + else + amtws[7] = 0.28 * amtws[6] - offsetA; + } + amtws[9] = amtws[7] - amtws[8]; + } + amtws[10] = L[16] + Sched2_1a - Sched3[1]; + if (amtws[6] > 0.0) + amtws[11] = NotLessThanZero( amtws[9] - amtws[10] ); + printf(" AMTws[11] = Abs( %6.2f - %6.2f ) = Abs( %6.2f )\n", amtws[9], amtws[10], amtws[9] - amtws[10] ); + // Sched2_1a = amtws[11]; /* Redundant. Is assigned by return value below. */ + + /* These rules are stated on Form-6251 Instructions page-1. */ + if (amtws[7] > amtws[10]) + { + file_amt = Yes; + fprintf(outfile,"You MUST file AMT form 6251. (%g > %g)\n", amtws[7], amtws[10] ); + } + else + { + if (amtws2c + amtws2e + amtws2g + amtws[3] < 0.0) + { + file_amt = Yes; + fprintf(outfile,"You may need to file AMT form 6251. (sum(AMTws2c : AMTws3) = %g < 0.\n", + amtws2c + amtws2e + amtws2g + amtws[3] ); + fprintf(outfile," (See \"Who Must File\" on page-1 of Instructions for Form-6251.)\n"); + } + else + file_amt = No; + } + if (force_print_all_pdf_forms) + file_amt = 1; + if (file_amt) + fprintf(outfile,"PDFpage: 15 15\n"); /* Optional PDF Page. */ + for (j=0; j<100; j++) + { + if (j == 2) + { + char tmplabel[1024]; + sprintf( tmplabel, " AMT_Form_6251_L2a"); + showline_wlabelnz( tmplabel, amtws2a ); + sprintf( tmplabel, " AMT_Form_6251_L2b"); + showline_wlabelnz( tmplabel, amtws2b ); + sprintf( tmplabel, " AMT_Form_6251_L2c"); + showline_wlabelnz( tmplabel, amtws2c ); + sprintf( tmplabel, " AMT_Form_6251_L2e"); + showline_wlabelnz( tmplabel, amtws2e ); + sprintf( tmplabel, " AMT_Form_6251_L2g"); + showline_wlabelnz( tmplabel, amtws2g ); + } + if ((j == 11) || (amtws[j] != 0.0)) + { + printf(" AMT Form 6251 L%d = %8.2f\n", j, amtws[j] ); + fprintf(outfile," AMT_Form_6251_L%d = %8.2f\n", j, amtws[j] ); + } + if (file_amt && (j == 11)) + fprintf(outfile,"EndPDFpage.\nPDFpage: 16 16\n"); + } + if (file_amt) + fprintf(outfile,"EndPDFpage.\n"); + fprintf(outfile," AMTws[11] = OnlyIfMoreThanZero( %6.2f - %6.2f ) = %6.2f\n", amtws[9], amtws[10], amtws[11] ); + fprintf(outfile,"Your Alternative Minimum Tax = %8.2f\n", amtws[11] ); + printf("Your Alternative Minimum Tax = %8.2f\n", amtws[11] ); + return amtws[11]; +} + + + + + +struct FedReturnData + { + double fedline[MAX_LINES], schedD[MAX_LINES]; + int Exception, Itemized; + } LastYearsReturn; + + +void convert_slashes( char *fname ) +{ /* Convert slashes in file name based on machine type. */ + char *ptr; + #ifdef __MINGW32__ + char slash_sreach='/', slash_replace='\\'; + #else + char slash_sreach='\\', slash_replace='/'; + #endif + + ptr = strchr( fname, slash_sreach ); + while (ptr) + { + ptr[0] = slash_replace; + ptr = strchr( fname, slash_sreach ); + } +} + + +void ImportFederalReturnData( char *fedlogfile, struct FedReturnData *fed_data ) +{ + FILE *infile; + char fline[1000], word[1000]; + int linenum; + + for (linenum=0; linenumfedline[linenum] = 0.0; fed_data->schedD[linenum] = 0.0; } + convert_slashes( fedlogfile ); + printf("Opening LastYearsFedReturn: '%s'\n", fedlogfile ); + infile = fopen(fedlogfile, "r"); + if (infile==0) + { + printf("Error: Could not open federal return '%s'\n", fedlogfile); + fprintf(outfile,"Error: Could not open federal return '%s'\n", fedlogfile); + exit(1); + } + printf("Importing Last Year's Federal Return Data from file '%s'\n", fedlogfile ); + fed_data->Itemized = 1; /* Set initial default values. */ + read_line(infile,fline); linenum = 0; + while (!feof(infile)) + { + if (strstr(fline,"Use standard deduction.")!=0) fed_data->Itemized = 0; + next_word(fline, word, " \t="); + if ((strstr(word,"L")==word) && (strstr(fline," = ")!=0)) + { + if (sscanf(&word[1],"%d",&linenum)!=1) printf("Error: Reading fed line number '%s%s'\n",word,fline); + next_word(fline, word, " \t="); remove_certain_chars( word, "," ); + if (sscanf(word,"%lf", &fed_data->fedline[linenum])!=1) + printf("Error: Reading fed line %d '%s%s'\n",linenum,word,fline); + if (verbose) printf("FedLin[%d] = %2.2f\n", linenum, fed_data->fedline[linenum]); + } + if ((strstr(word,"D") == word) && (strstr(fline," = ") != 0)) + { + if (sscanf(&word[1],"%d",&linenum)!=1) printf("Error: Reading fed line number '%s%s'\n",word,fline); + next_word(fline, word, " \t="); remove_certain_chars( word, "," ); + if (sscanf(word,"%lf", &fed_data->schedD[linenum]) != 1) + { + if (strcasecmp(word,"yes") == 0) fed_data->schedD[linenum] = 1; + else + if (strcasecmp(word,"no") == 0) fed_data->schedD[linenum] = 0; + else + printf("Error: Reading fed schedD %d '%s%s'\n",linenum,word,fline); + } + if (verbose) printf("FedLin[%d] = %2.2f\n", linenum, fed_data->schedD[linenum]); + } + read_line(infile,fline); + } + fclose(infile); +} + + +void CapitalLossCarryOverWorksheet( char *fedlogfile, struct FedReturnData *LastYearsReturn ) /* Not updated for 2024. */ +{ /* From instructions page D-11. */ + double ws[50]; + int k; + + for (k=0; k < 50; k++) /* First, pre-initialize worksheet lines to zero. */ + ws[k] = 0.0; + + ImportFederalReturnData( fedlogfile, LastYearsReturn ); + if (LastYearsReturn->schedD[21] == 0.0) + { + printf(" No carry-over loss.\n"); + fprintf(outfile," No carry-over loss.\n"); + return; /* Use this worksheet only if last year's D[21] was a loss. */ + } + if ((absolutev(LastYearsReturn->schedD[21]) >= absolutev(LastYearsReturn->schedD[16])) && (LastYearsReturn->fedline[15] >= 0.0)) + { + printf(" No carry-over loss.\n"); + fprintf(outfile," No carry-over loss.\n"); + return; + } + + for (k=0; k<50; k++) ws[k] = 0.0; + ws[1] = LastYearsReturn->fedline[15]; + ws[2] = absolutev( LastYearsReturn->schedD[21] ); /* Loss from last year's Sched-D21 as positive amount. */ + ws[3] = NotLessThanZero( ws[1] + ws[2] ); + ws[4] = smallerof( ws[2], ws[3] ); + for (k=1; k<=4; k++) + { + printf("\tCarryOverWs%d = %2.2f\n", k, ws[k] ); + fprintf(outfile,"\tCarryOverWs%d = %2.2f\n", k, ws[k] ); + } + if (LastYearsReturn->schedD[7] < 0.0) + { /*lines5-8*/ + ws[5] = -LastYearsReturn->schedD[7]; + ws[6] = NotLessThanZero( LastYearsReturn->schedD[15] ); + ws[7] = ws[4] + ws[6]; + ws[8] = NotLessThanZero( ws[5] - ws[7] ); + if (ws[8] > 0.0) + SchedD[6] = ws[8]; + for (k=5; k<=8; k++) + { + printf("\tCarryOverWs%d = %2.2f\n", k, ws[k] ); + fprintf(outfile,"\tCarryOverWs%d = %2.2f\n", k, ws[k] ); + } + } /*lines5-8*/ + else + printf("\t(Skip CarryOverWs lines 5-8.)\n"); + + if (LastYearsReturn->schedD[15] < 0.0) + { /*lines9-13*/ + ws[9] = absolutev( LastYearsReturn->schedD[15] ); + ws[10] = NotLessThanZero( LastYearsReturn->schedD[7] ); + ws[11] = NotLessThanZero( ws[4] - ws[5] ); + ws[12] = ws[10] + ws[11]; + ws[13] = NotLessThanZero( ws[9] - ws[12] ); + if (ws[13] > 0.0) + SchedD[14] = ws[13]; + for (k=9; k<=13; k++) + { + printf("\tCarryOverWs%d = %2.2f\n", k, ws[k] ); + fprintf(outfile,"\tCarryOverWs%d = %2.2f\n", k, ws[k] ); + } + } /*lines9-13*/ + else + printf("\t(Skip CarryOverWorkSheet lines 9-13.)\n"); +} + + + +struct capgain_record + { + char *comment, *buy_date, *sell_date, *adj_code; + double buy_amnt, sell_amnt, adj_amnt; + struct capgain_record *nxt; + } *short_trades=0, *long_trades=0; + +double total_sales, total_costs=0.0, total_adjs; + + +void new_capgain( struct capgain_record **list, char *comment, double buy_amnt, + char *buy_date, double sell_amnt, char *sell_date, char *adj_code, double adj_amnt ) +{ /* Add a new entry to a list. */ + struct capgain_record *new_item, *prev; + + new_item = (struct capgain_record *)malloc( sizeof(struct capgain_record) ); + new_item->comment = strdup( comment ); /* Make new list item and fill-in its fields. */ + if (strlen( new_item->comment ) > 31) + new_item->comment[31] = '\0'; /* Limit comment length to avoid over-running column boundary. */ + new_item->buy_amnt = buy_amnt; + new_item->buy_date = strdup( buy_date ); + new_item->sell_amnt = sell_amnt; + new_item->sell_date = strdup( sell_date ); + new_item->adj_code = strdup( adj_code ); + new_item->adj_amnt = adj_amnt; + new_item->nxt = 0; + prev = *list; /* Insert onto end of list. */ + if (prev == 0) + *list = new_item; + else + { + while (prev->nxt != 0) prev = prev->nxt; + prev->nxt = new_item; + } +} + + +void print_capgain_list( struct capgain_record *list, int section, char *message, char *pdfmsg ) +{ + struct capgain_record *item; + char word[4096], row='a'; + char pdf_adj_code[20]; + + /* First write results in easily human-readable format. */ + total_sales = 0.0; + total_costs = 0.0; + total_adjs = 0.0; + fprintf(outfile,"\n%s\n", message ); + fprintf(outfile," %d. (a Description) (b Buy Date) (c Date Sold) (d Sold Price) (e Cost) (f Code) (g Adj) (h Gain)\n", section ); + fprintf(outfile," ------------------------------------------------------------------------------------------------------------------------\n"); + item = list; + while (item != 0) + { + strcpy( word, item->comment ); + if (strlen( word ) > 27) word[30] = '\0'; + if ((strlen(word) > 0) && (word[ strlen(word) - 1 ] == '}')) word[ strlen(word) - 1 ] = '\0'; + while (strlen( word ) < 27) strcat( word, " " ); /* Fields become formatted right-justified. */ + fprintf(outfile," %s %10s %10s %14.2f %14.2f %10s %14.2f %14.2f\n", word, item->buy_date, item->sell_date, item->sell_amnt, + absolutev(item->buy_amnt), item->adj_code, item->adj_amnt, item->sell_amnt + item->buy_amnt + item->adj_amnt ); + total_sales = total_sales + item->sell_amnt; + total_costs = total_costs + item->buy_amnt; + total_adjs = total_adjs + item->adj_amnt; + item = item->nxt; + } + fprintf(outfile," ------------------------------------------------------------------------------------------------------------------------\n"); + fprintf(outfile," %d. Totals: %14.2f %14.2f %14.2f %14.2f\n\n", + section + 1, total_sales, absolutev(total_costs), total_adjs, total_sales + total_costs + total_adjs ); + + /* Now re-list them for update by the PDF-Convertor. */ + fprintf(outfile,"PDFpage: %s\n", pdfmsg ); /* Optional PDF page. */ + item = list; + while (item != 0) + { + if (row > 'n') + { /* All form-entries filled, go to new form-page. */ + fprintf(outfile," F8949_2d = ...\n"); + fprintf(outfile," F8949_2e = ...\n"); + fprintf(outfile," F8949_2h = ...\n"); + fprintf(outfile,"EndPDFpage.\nPDFpage: %s\n", pdfmsg ); /* Overflow page. */ + row = 'a'; + } + fprintf(outfile," F8949_1%ca: %s\n", row, item->comment ); + fprintf(outfile," F8949_1%cb: %s\n", row, item->buy_date ); + fprintf(outfile," F8949_1%cc: %s\n", row, item->sell_date ); + fprintf(outfile," F8949_1%cd = %14.2f\n", row, item->sell_amnt ); + fprintf(outfile," F8949_1%ce = %14.2f\n", row, absolutev(item->buy_amnt) ); + if (strcmp(item->adj_code, "~") == 0 ) /* if match */ + strcpy(pdf_adj_code, " "); /* Convert "~" to " " for PDF form */ + else + { + strcpy(pdf_adj_code, item->adj_code); + } + fprintf(outfile," F8949_1%cf = %3s\n", row, pdf_adj_code ); + if (item->adj_amnt != 0.0) + fprintf(outfile," F8949_1%cg = %14.2f\n", row, item->adj_amnt ); + fprintf(outfile," F8949_1%ch = %14.2f\n", row, item->sell_amnt + item->buy_amnt + item->adj_amnt); + row++; + item = item->nxt; + } + fprintf(outfile," F8949_2d = %14.2f\n", total_sales ); + fprintf(outfile," F8949_2e = %14.2f\n", absolutev(total_costs) ); + fprintf(outfile," F8949_2g = %14.2f\n", total_adjs ); + fprintf(outfile," F8949_2h = %14.2f\n", total_sales + total_costs + total_adjs ); + fprintf(outfile,"EndPDFpage.\n\n"); +} + + +void free_capgain_list( struct capgain_record **list ) +{ + struct capgain_record *olditem; + + while (*list != 0) + { + olditem = *list; + *list = (*list)->nxt; + free( olditem->comment ); + free( olditem ); + } +} + + +int is_date1_beyond_date2 (struct date_rec date1, struct date_rec date2) +{ + if ( (date1.year > date2.year) + || ((date1.year == date2.year) && (date1.month > date2.month)) + || ((date1.year == date2.year) && (date1.month == date2.month) && (date1.day > date2.day)) ) + return (1); /* True - Date1 is beyond Date2 */ + else + return (0); /* False */ +} + +void adj_code_validity_check (char *adj_code, char *errmsg ) +{ + char *okcodes = CAP_GAIN_ADJUSTMENT_CODES; + char up_adj_code; + char lwrcasemsg[1024]; + int j=0, k; /* j is adj_code index, k is okcodes index */ + int errindex; + + if (adjerrcnt < MAXADJERRCNT) /* Capture up to MAXADJERRCNT errors */ + { + if (strcmp(adj_code, "~") != 0) /* check for no-data place holder, leave as is */ + { + while (adj_code[j] != '\0') + { + if ( ! isalpha(adj_code[j])) + { + adjerrcnt++; + errindex = adjerrcnt - 1; + strcpy(adj_code_err[errindex], errmsg); + } + else + { /* is alpha */ + k=0; + up_adj_code = toupper(adj_code[j]); + while ( (okcodes[k] != '\0') && (up_adj_code != okcodes[k]) ) k++; /* Look for uppercased match */ + if (okcodes[k] != '\0') /* Have an uppercased match */ + { + if ( adj_code[j] != up_adj_code) + { + adjerrcnt++; + strcpy (lwrcasemsg, errmsg); + strcat (lwrcasemsg, " * Case Error - Should be Capitalized *"); + errindex = adjerrcnt - 1; + strcpy(adj_code_err[errindex], lwrcasemsg); + } + } + else + { /* No uppercased match */ + adjerrcnt++; + errindex = adjerrcnt - 1; + strcpy(adj_code_err[errindex], errmsg); + } + } /* is alpha */ + j++; + } /* while adj_code */ + } /* strcmp */ + } /* if adjerrcnt < MAXADJERRCNT */ +} + +void Display_adj_code_err() +{ + int i, index; + + printf("\n\n\n***** CAUTION: Possible Invalid Form 8949 Adjustment Code *****\n"); + printf("***** Does NOT affect processing *****\n\n"); + printf("Code Section Description BuyDate DateSold\n"); + for ( i = 1; i <= adjerrcnt; i++) /* adjerrcnt will never exceed MAXADJERRCNT */ + { + index = i - 1; + printf("\n %s \n", adj_code_err[index] ); + } + } + + +/* Grab Spreadsheet for Capital Sales (Gain/Loss) of Form-8949 from a CSV or Tab-delimited file. */ +void get_CSV_8949( char *spreadsheet_name ) +{ + char sline[4096], word[4096], delim=','; + char descrip[512], date_bought[512], date_sold[512], adj_code[512], adjcodeerrmsg[4096]; + double proceeds, cost, adj_amnt; + struct date_rec buydate, selldate, annivdate; + enum {none, short_term, long_term} term_flg=none; + int err=0; + FILE *sfile; /* Spreadsheet-File. */ + + remove_certain_chars( spreadsheet_name, "\"" ); /* Allow spaces in file-paths. */ + printf("Opening Form-849 Spreadsheet: '%s'\n", spreadsheet_name ); + sfile = fopen( spreadsheet_name, "r" ); + if (sfile == 0) + { + printf("ERROR: Could not open f8949 spreadsheet file '%s' for reading.\n", spreadsheet_name ); + fprintf(outfile,"ERROR: Could not open f8949 spreadsheet file '%s' for reading.\n", spreadsheet_name ); + return; + } + Do_SchedD = Yes; + + /* Expect f8949 spreadsheet file name extension to be ".csv", ".tsv", or ".txt". */ + strcpy( word, spreadsheet_name ); + capitalize( word ); + if (strstr( word, ".CSV" )) + delim = ','; + else + if (strstr( word, ".TSV" )) + delim = '\t'; + else + if (strstr( word, ".TXT" )) + { /* Try to determine if file is CSV or TSV. */ + read_line_safe( sfile, sline, 4096 ); + if (strstr( sline, "\t" )) + delim = '\t'; + fclose( sfile ); /* Reload file. */ + sfile = fopen( spreadsheet_name, "r" ); + } + else + { + printf("ERROR: f8949 Spreadsheet file '%s' is not '.csv', '.tsv', or '.txt'.\n", spreadsheet_name ); + fprintf(outfile,"ERROR: f8949 Spreadsheet file '%s' is not '.csv', '.tsv', or '.txt'.\n", spreadsheet_name ); + fclose( sfile ); + return; + } + if (delim == ',') + fprintf(outfile," Reading Comma-delimited spreadsheet file.\n"); + else + fprintf(outfile," Reading Tab-delimited spreadsheet file.\n"); + + /* Expect 1st line of spreadsheet file to be: + Description, Date_Acquired, Date_Sold, Proceeds, Cost, Code, Adjustment + */ + read_line_safe( sfile, sline, 4096 ); + next_csv( sline, word, delim ); capitalize( word ); + if (!strstr( word, "DESCRIP" )) err++; + next_csv( sline, word, delim ); capitalize( word ); + if (!strstr( word, "ACQUIRED" )) err++; + next_csv( sline, word, delim ); capitalize( word ); + if (!strstr( word, "SOLD" )) err++; + next_csv( sline, word, delim ); capitalize( word ); + if (!strstr( word, "PROCEED" )) err++; + next_csv( sline, word, delim ); capitalize( word ); + if (!strstr( word, "COST" )) err++; + if (err) + { + printf("ERROR: f8949 Spreadsheet file '%s' does not have expected header-line.\n", spreadsheet_name ); + fprintf(outfile,"ERROR: f8949 Spreadsheet file '%s' does not have expected header-line.\n", spreadsheet_name ); + fclose( sfile ); + return; + } + + read_line_safe( sfile, sline, 4096 ); + while (!feof( sfile )) + { + consume_leading_trailing_whitespace( sline ); + if (strlen( sline ) > 1) + { /*valid_line*/ + if (verbose) fprintf(outfile,"ReadLine: '%s'\n", sline ); + term_flg = none; /* Initialize */ + next_csv( sline, descrip, delim ); + if (verbose) fprintf(outfile,"Descript = '%s', Line = '%s'\n", descrip, sline ); + next_csv( sline, date_bought, delim ); + if (verbose) fprintf(outfile,"BuyDate = '%s', Line = '%s'\n", date_bought, sline ); + if (mystrcasestr( date_bought, "various-short" ) != 0) + term_flg = short_term; + else + if ((mystrcasestr( date_bought, "various-long" ) != 0) || (mystrcasestr( date_bought, "inherited" ) != 0)) + term_flg = long_term; + else + gen_date_rec( date_bought, descrip, &buydate ); + + next_csv( sline, date_sold, delim ); + if (verbose) fprintf(outfile,"SoldDate = '%s', Line = '%s'\n", date_sold, sline ); + if (term_flg == none) /* Executes if term_flg Not otherwise set in case: 1 */ + { /*term_flg*/ + gen_date_rec( date_sold, descrip, &selldate ); + if (is_date1_beyond_date2( buydate, selldate )) + { + printf("DATA ERROR: Buy-date after sell-date in f8949 spreadsheet. '%s'\n Buy-date '%s' Sell-date '%s'\n", + descrip, date_bought, date_sold ); + fprintf(outfile,"DATA ERROR: Buy-date after sell-date in f8949 spreadsheet. '%s'\n Buy-date '%s' Sell-date '%s'\n", + descrip, date_bought, date_sold ); + exit(1); + } + /* "annivdate" will be the date of the one year holding period relative to the Buy-date */ + annivdate.year = buydate.year + 1; + annivdate.month = buydate.month; + annivdate.day = buydate.day; + if ((annivdate.month == 2) && (annivdate.day == 28) && (isleapyear(annivdate.year))) + annivdate.day=29; + else + if ((annivdate.month == 2) && (annivdate.day == 29) && !(isleapyear(annivdate.year))) + annivdate.day=28; + if (is_date1_beyond_date2(selldate, annivdate)) + term_flg = long_term; /* Holding Period Test */ + else + term_flg = short_term; + } /*term_flg*/ + + next_csv( sline, word, delim ); + if (verbose) fprintf(outfile,"Proceeds = '%s', Line = '%s'\n", word, sline ); + if (sscanf(word,"%lf",&proceeds)!=1) + { printf("ERROR: Bad float '%s', in Proceeds column of f8949 Spreadsheet file '%s'.\n", word, spreadsheet_name ); + fprintf(outfile,"ERROR: Bad float '%s', in Proceeds column of f8949 Spreadsheet file '%s'.\n", word, spreadsheet_name ); + exit(1); + } + + next_csv( sline, word, delim ); + if (verbose) fprintf(outfile,"Cost = '%s', Line = '%s'\n", word, sline ); + if (sscanf(word,"%lf",&cost)!=1) + { printf("ERROR: Bad float '%s', in Cost column of f8949 Spreadsheet file '%s'.\n", word, spreadsheet_name ); + fprintf(outfile,"ERROR: Bad float '%s', in Cost column of f8949 Spreadsheet file '%s'.\n", word, spreadsheet_name ); + exit(1); + } + if (cost > 0.0) cost = -cost; /* Cost/Buy amounts must be negative. (It is a cost.) */ + + next_csv( sline, adj_code, delim ); + if (verbose) fprintf(outfile,"AdjCode = '%s', Line = '%s'\n", adj_code, sline ); + strcpy( adjcodeerrmsg, adj_code ); /* Assemble Error Msg for later use if needed */ + strcat( adjcodeerrmsg, " " ); + strcat( adjcodeerrmsg, descrip ); + strcat( adjcodeerrmsg, " " ); + strcat( adjcodeerrmsg, date_bought ); + strcat( adjcodeerrmsg, " "); + strcat( adjcodeerrmsg, date_sold ); + adj_code_validity_check( adj_code, adjcodeerrmsg ); + + next_csv( sline, word, delim ); + if (verbose) fprintf(outfile,"AdjAmnt= '%s', Line = '%s'\n", word, sline ); + consume_leading_trailing_whitespace( word ); + if (word[0] == '\0') + adj_amnt = 0.0; + else + if (sscanf(word,"%lf",&adj_amnt)!=1) + { printf("ERROR: Bad float '%s', in Ajdustment column of f8949 Spreadsheet file '%s'.\n", word, spreadsheet_name ); + fprintf(outfile,"ERROR: Bad float '%s', in Proceeds column of f8949 Spreadsheet file '%s'.\n", word, spreadsheet_name ); + exit(1); + } + + if (term_flg == long_term) + { /*long-gain/loss*/ + new_capgain( &long_trades, descrip, cost, date_bought, proceeds, date_sold, adj_code, adj_amnt ); + } /*long-gain/loss*/ + else + { /*short-gain/loss*/ + new_capgain( &short_trades, descrip, cost, date_bought, proceeds, date_sold, adj_code, adj_amnt ); + } /*short-gain/loss*/ + + } /*valid_line*/ + read_line_safe( sfile, sline, 4096 ); + } + fclose( sfile ); +} + + +void get_gain_and_losses( char *label ) +{ + char word[4096], date_str1[512], date_str2[512], adj_code[512]; + char comment[4096], comment2[2048], comment3[2048], labelcommentmsg[4096], adjcodeerrmsg[4096]; + double amnt1, amnt2, adj_amnt; + int toggle=0 ; + struct date_rec buydate, selldate, annivdate; + enum {none, short_term, long_term} term_flg=none; + + get_parameter( infile, 'l', word, label ); /* CapGains or f8949_spreadsheet_file. */ + if (strstr( word, "f8949_spreadsheet")) + { + read_comment_filtered_line( infile, word, 4096 ); + if (strlen(word) > 1) + get_CSV_8949( word ); + get_parameter( infile, 's', word, label ); + } + + get_word(infile, word); + while (word[0]!=';') + { /*while_not_end*/ + if (feof(infile)) + {printf("ERROR: Unexpected EOF on '%s'\n", label ); fprintf(outfile,"ERROR: Unexpected EOF on '%s'\n", label ); exit(1);} + if (!Do_SchedD) + { fprintf(outfile,"\nForm(s) 8949:\n"); Do_SchedD = Yes; } + switch (toggle) + { /*switch_toggle*/ + case 0: toggle++; + term_flg = none; /* Initialize */ + if (sscanf(word,"%lf",&amnt1)!=1) + {printf("ERROR: Bad float '%s', reading %s.\n", word, label ); fprintf(outfile,"ERROR: Bad float '%s', reading %s.\n", word, label ); exit(1); } + if (amnt1 > 0.0) amnt1 = -amnt1; /* Buy amounts must be negative. (It is a cost.) */ + break; + case 1: toggle++; + /* Expect stock name in comment after first date (buy-date). */ + get_comment( infile, comment ); /* Get comment for use in DATA ERROR Messages */ + strcpy (labelcommentmsg, label); + if (strlen(label) + strlen(comment) < 4092 ) + { + strcat(labelcommentmsg, ", "); + strcat(labelcommentmsg, comment); + } + strcpy( date_str1, word ); + if (mystrcasestr( date_str1, "various-short" ) != 0) + term_flg = short_term; + else + if ((mystrcasestr( date_str1, "various-long" ) != 0) || (mystrcasestr( date_str1, "inherited" ) != 0)) + term_flg = long_term; + else + gen_date_rec( word, labelcommentmsg, &buydate ); + break; + case 2: toggle++; + if (sscanf(word,"%lf",&amnt2)!=1) + { printf("ERROR: Bad float '%s', reading %s.\n", word, label ); + fprintf(outfile,"ERROR: Bad float '%s', reading %s.\n", word, label ); + exit(1); + } + break; + case 3: toggle++; + strcpy( date_str2, word ); + get_comment( infile, comment2 ); /* Check for and consume any additional comment. */ + strcat( comment, comment2 ); + if (term_flg == none) /* Executes if term_flg Not otherwise set in case: 1 */ + { + gen_date_rec ( word, labelcommentmsg, &selldate ); + if (is_date1_beyond_date2 (buydate, selldate)) + { + printf("DATA ERROR: Buy-date after sell-date. '%s'\n Buy-date '%s' Sell-date '%s'\n", labelcommentmsg, date_str1, date_str2); + fprintf(outfile,"DATA ERROR: Buy-date after sell-date. '%s'\n Buy-date '%s' Sell-date '%s'\n", labelcommentmsg, date_str1, date_str2); + exit(1); + } + /* "annivdate" will be the date of the one year holding period relative to the Buy-date */ + annivdate.year = buydate.year + 1; + annivdate.month = buydate.month; + annivdate.day = buydate.day; + if ((annivdate.month == 2) && (annivdate.day == 28) && (isleapyear(annivdate.year))) + annivdate.day=29; + else + if ((annivdate.month == 2) && (annivdate.day == 29) && !(isleapyear(annivdate.year))) + annivdate.day=28; + if (is_date1_beyond_date2(selldate, annivdate)) + term_flg = long_term; /* Holding Period Test */ + else + term_flg = short_term; + } + break; + case 4: toggle++; + strcpy (adj_code, word); + strcpy (adjcodeerrmsg, adj_code); /* Assemble Error Msg for later use if needed */ + strcat (adjcodeerrmsg, " "); + strcat (adjcodeerrmsg, labelcommentmsg); + strcat (adjcodeerrmsg, " "); + strcat (adjcodeerrmsg, date_str1); + strcat (adjcodeerrmsg, " "); + strcat (adjcodeerrmsg, date_str2); + adj_code_validity_check (adj_code, adjcodeerrmsg); + break; + case 5: toggle = 0; + get_comment(infile, comment3); /* Check for and consume any additional comment. */ + strcat( comment, comment3 ); /* For consistency with Case 3 */ + if (strcmp(word, "~") == 0) adj_amnt = 0.00; + else + { + if (sscanf(word, "%lf", &adj_amnt) != 1 ) + { + printf("ERROR: Adj-Amnt - Bad float '%s', reading %s.\n", word, labelcommentmsg); + fprintf(outfile,"ERROR: Adj-Amnt - Bad float '%s', reading %s.\n", word, labelcommentmsg); + exit(1); + } + } + if (term_flg == long_term) + { /*long-gain/loss*/ + new_capgain( &long_trades, comment, amnt1, date_str1, amnt2, date_str2, adj_code, adj_amnt ); + } /*long-gain/loss*/ + else + { /*short-gain/loss*/ + new_capgain( &short_trades, comment, amnt1, date_str1, amnt2, date_str2, adj_code, adj_amnt ); + } /*short-gain/loss*/ + break; + } /*switch_toggle*/ + get_word(infile, word); + } /*while_not_end*/ + if (toggle!=0) + { + printf("ERROR: Imbalanced cap-gains entry (toggle=%d).\n", toggle); + fprintf(outfile,"ERROR: Imbalanced cap-gains entry (toggle=%d).\n", toggle); + exit(1); + } +} + + +/************************************************************************/ +/* Get_Cap_Gains - Get and calculate gains. Forms 8949 + Sched-D. */ +/* Like "get_params", but must get transaction dates. */ +/* Expect entries in triple pairs. */ +/* buy_amnt date */ +/* sell_amnt date */ +/* adj_code, adj_amnt */ +/* */ +/************************************************************************/ +void get_cap_gains() /* This is Schedule-D. */ /* Not updated for 2024. */ +{ + char word[4092], *LastYearsOutFile=0, labelx[1024]=""; + int j, doline22=0, got_collectibles=0; + double stcg=0.0, ltcg=0.0; /* Variables for short and long term gains. */ + double SchedDd[20], SchedDe[20], SchedDg[20]; + + for (j=0; j<20; j++) /* Initialize. */ + { SchedDd[j] = 0.0; SchedDe[j] = 0.0; SchedDg[j] = 0.0; } + + /* Form 8849 - Adjunct form to Schedule-D. */ + get_gain_and_losses( "CapGains-A/D" ); /* (A) Basis Reported to IRS. */ + if (short_trades) + { + print_capgain_list( short_trades, 1, "Form 8949 Part-I, Short-Term Cap Gains+Losses, CHECK (A) Basis Reported to IRS:", "13 13\n F8949_ckA X" ); + SchedDd[1] = total_sales; + SchedDe[1] = total_costs; + SchedDg[1] = total_adjs; + SchedD[1] = SchedDd[1] + SchedDe[1] + SchedDg[1]; + free_capgain_list( &short_trades ); + } + if (long_trades) + { + print_capgain_list( long_trades, 3, "Form 8949 Part-II, Long-Term Cap Gains+Losses, CHECK (D) Basis Reported to IRS:", "14 14\n F8949_ckD X" ); + SchedDd[8] = total_sales; + SchedDe[8] = total_costs; + SchedDg[8] = total_adjs; + SchedD[8] = SchedDd[8] + SchedDe[8] + SchedDg[8]; + free_capgain_list( &long_trades ); + } + + get_gain_and_losses( "CapGains-B/E" ); /* (B) Basis NOT Reported to IRS. */ + if (short_trades) + { + print_capgain_list( short_trades, 1, "Form 8949 Part-I, Short-Term Cap Gains+Losses, CHECK (B) Basis NOT Reported to IRS:", "13 13\n F8949_ckB X" ); + SchedDd[2] = total_sales; + SchedDe[2] = total_costs; + SchedDg[2] = total_adjs; + SchedD[2] = SchedDd[2] + SchedDe[2] +SchedDg[2] ; + free_capgain_list( &short_trades ); + } + if (long_trades) + { + print_capgain_list( long_trades, 3, "Form 8949 Part-II, Long-Term Cap Gains+Losses, CHECK (E) Basis NOT Reported to IRS:", "14 14\n F8949_ckE X" ); + SchedDd[9] = total_sales; + SchedDe[9] = total_costs; + SchedDg[9] = total_adjs; + SchedD[9] = SchedDd[9] + SchedDe[9] + SchedDg[9]; + free_capgain_list( &long_trades ); + } + + get_gain_and_losses( "CapGains-C/F" ); /* (C) Cannot check (A) or (B). */ + if (short_trades) + { + print_capgain_list( short_trades, 1, "Form 8949 Part-I, Short-Term Cap Gains+Losses, CHECK (C) Not reported on Form 1099-B.\n", "13 13\n F8949_ckC X" ); + SchedDd[3] = total_sales; + SchedDe[3] = total_costs; + SchedDg[3] = total_adjs; + SchedD[3] = SchedDd[3] + SchedDe[3] + SchedDg[3]; + free_capgain_list( &short_trades ); + } + if (long_trades) + { + print_capgain_list( long_trades, 3, "Form 8949 Part-II, Long-Term Cap Gains+Losses, CHECK (F) Not reported on Form 1099-B.\n", "14 14\n F8949_ckF X" ); + SchedDd[10] = total_sales; + SchedDe[10] = total_costs; + SchedDg[10] = total_adjs; + SchedD[10] = SchedDd[10] + SchedDe[10] + SchedDg[10]; + free_capgain_list( &long_trades ); + } + + stcg = SchedD[1] + SchedD[2] + SchedD[3]; + ltcg = SchedD[8] + SchedD[9] + SchedD[10]; + + GetLine( "D4", &SchedD[4] ); /* Short term gain from 6252 and short-term gain or loss from Forms 4684, 6781, 8824. */ + GetLine( "D5", &SchedD[5] ); /* Net short-term gain or loss from partnerships, S corps, estates, trusts from K-1. */ + + get_parameter( infile, 's', word, "D6" ); /* Carryover short-term loss from last year. Or, LastYear's Return Output File-name. */ + get_word(infile, word); + if (strcmp(word,";") != 0) + { + if (sscanf(word,"%lf",&SchedD[6]) != 1) LastYearsOutFile = strdup(word); + do + { get_word(infile,word); + if ((strlen(word) > 0) && (strcmp(word,";") != 0)) + fprintf(outfile,"Warning: Unexpected multiple values on line D6. '%s' ignored.\n If multi-part filename, then surround it in quotes (\").", word ); + } while (strcmp(word,";") != 0); + } + + GetLine( "D11", &SchedD[11] ); /* Gain from Form 4797. */ + GetLine( "D12", &SchedD[12] ); /* Partnership net long-term gain or loss. */ + GetLine( "D13", &SchedD[13] ); /* Cap Gains Distributions - 1099-DIV col. 2a. */ + GetLine( "D14", &SchedD[14] ); /* Carryover long-term loss from last year. Or, leave blank if last year's file entered in line D6. */ + + while (!got_collectibles) + { + get_parameter( infile, 'l', labelx, "D19 or Collectibles" ); + if (strcmp( labelx, "D19" ) == 0) + get_parameters( infile, 'f', &SchedD[19], labelx ); + else + if (strcmp( labelx, "Collectibles" ) == 0) + { + get_parameters( infile, 'f', &collectibles_gains, labelx ); + got_collectibles = 1; + } + else + { + printf("ERROR1: Found '%s' when expecting 'D19 or Collectibles'\n", labelx ); + fprintf(outfile,"ERROR1: Found '%s' when expecting 'D19 or Collectibles'\n", labelx ); + exit(1); + } + } + + // GetLine( "Collectibles", &collectibles_gains ); /* Gains or Losses from Collectibles. (Usually zero.) */ + if (collectibles_gains != 0.0) fprintf(outfile, "Collectibles_Gains = %6.2f\n", collectibles_gains ); + + if (LastYearsOutFile != 0) + CapitalLossCarryOverWorksheet( LastYearsOutFile, &LastYearsReturn ); + + if (SchedD[6] > 0.0) + { + /* fprintf(outfile,"Warning: D6 Carryover Loss must be NEGATIVE.\n"); */ + SchedD[6] = -SchedD[6]; + } + if (SchedD[14] > 0.0) + { + /* fprintf(outfile,"Warning: D14 Carryover Loss must be NEGATIVE.\n"); */ + SchedD[14] = -SchedD[14]; + } + + if ((SchedD[4] != 0.0) || (SchedD[5] != 0.0) || (SchedD[6] != 0.0) || (SchedD[11] != 0.0) || + (SchedD[12] != 0.0) || (SchedD[13] != 0.0) || (SchedD[14] != 0.0)) + { Do_SchedD = Yes; } /* Set Do_SchedD in case it was not already set by Cap-Gain/Loss in rows 1-3, or 8-10. */ + + if (Do_SchedD) + { /*Sched-D*/ + fprintf(outfile," Cap Gains/Losses Schedule-D\n"); + fprintf(outfile,"PDFpage: 11 11\n"); + // Do_QDCGTW = Yes; /* Tentatively set to do: Qualified Dividends and Capital Gain tax Worksheet. */ + fprintf(outfile,"\tNet Forms-8949 Short-term Gains = %10.2f\n", stcg ); + fprintf(outfile,"\tNet Forms-8949 Long-term Gains = %10.2f\n", ltcg); + fprintf(outfile," D1bd = %10.2f\n D1be = %10.2f\n D1bg = %10.2f\n D1bh = %10.2f\n", SchedDd[1], absolutev(SchedDe[1]), SchedDg[1], SchedD[1] ); + fprintf(outfile," D2d = %10.2f\n D2e = %10.2f\n D2g = %10.2f\n D2h = %10.2f\n", SchedDd[2], absolutev(SchedDe[2]), SchedDg[2],SchedD[2] ); + + fprintf(outfile," D3d = %10.2f\n D3e = %10.2f\n D3g = %10.2f\n D3h = %10.2f\n", SchedDd[3], absolutev(SchedDe[3]), SchedDg[3], SchedD[3] ); + + fprintf(outfile," D4 = %6.2f\n", SchedD[4] ); + fprintf(outfile," D5 = %6.2f\n", SchedD[5] ); + fprintf(outfile," D6 = %6.2f (Carry-over Loss)\n", SchedD[6] ); + SchedD[7] = SchedD[1] + SchedD[2] + SchedD[3] + SchedD[4] + SchedD[5] + SchedD[6]; + fprintf(outfile," D7 = %6.2f { Net short-term capital gain or loss }\n", SchedD[7] ); + + fprintf(outfile," D8bd = %10.2f\n D8be = %10.2f\n D8bg = %10.2f\n D8bh = %10.2f\n", SchedDd[8], absolutev(SchedDe[8]), SchedDg[8], SchedD[8] ); + + fprintf(outfile," D9d = %10.2f\n D9e = %10.2f\n D9g = %10.2f\n D9h = %10.2f\n", SchedDd[9], absolutev(SchedDe[9]), SchedDg[9], SchedD[9] ); + + fprintf(outfile," D10d = %10.2f\n D10e = %10.2f\n D10g = %10.2f\n D10h = %10.2f\n", SchedDd[10], + absolutev(SchedDe[10]), SchedDg[10], SchedD[10] ); + + fprintf(outfile," D11 = %6.2f\n", SchedD[11] ); + fprintf(outfile," D12 = %6.2f\n", SchedD[12] ); + fprintf(outfile," D13 = %6.2f\n", SchedD[13] ); + fprintf(outfile," D14 = %6.2f (Carry-over Loss)\n", SchedD[14] ); + SchedD[15] = SchedD[8] + SchedD[9] + SchedD[10] + SchedD[11] + SchedD[12] + SchedD[13] + SchedD[14]; + fprintf(outfile," D15 = %6.2f { Net long-term capital gain or loss }\n", SchedD[15] ); + fprintf(outfile,"EndPDFpage.\nPDFpage: 12 12\n"); + + /* Part ||| */ + SchedD[16] = SchedD[7] + SchedD[15]; + fprintf(outfile," D16 = %6.2f\n", SchedD[16]); + if (SchedD[16] > 0.0) + { /*gain*/ + L[7] = SchedD[16]; + if ((SchedD[15] > 0.0) && (SchedD[16] > 0.0)) + { /* Lines 17-21 */ + double wsd[50]; + + fprintf(outfile," D17 = yes\n CkD17y X\n"); + + /* '28% Rate Gain Worksheet' on instructions page D-13. */ + wsd[1] = collectibles_gains; /* Gain or losses from "Collectibles" only. Usually zero. */ + wsd[2] = 0.0; /* Any 1202 exclusions, usually 0.0. */ + wsd[3] = 0.0; /* Total collectibles on forms 4684, 6245, 6781, 8824. Usually no. */ + wsd[4] = 0.0; /* Total collectibles 1099-Div box 2d, 2439 box 1d, or K-1's. Usually no. */ + wsd[5] = SchedD[14]; + if (SchedD[7] < 0.0) wsd[6] = SchedD[7]; else wsd[6] = 0.0; + wsd[7] = NotLessThanZero( wsd[1] + wsd[2] + wsd[3] + wsd[4] + wsd[5] + wsd[6] ); + SchedD[18] = wsd[7]; + fprintf(outfile," D18 = %6.2f\n", SchedD[18]); + + /* 'Unrecaptured Section 1250 Gain Worksheet' on page D14, usually 0. */ + fprintf(outfile," D19 = %6.2f\n", SchedD[19]); + + if ((SchedD[18] == 0.0) && (SchedD[19] == 0.0)) + { /*yes*/ + fprintf(outfile," D20 = Yes\n CkD20y X\n"); + // printf("Complete 'Qualified Dividends and Capital Gain tax Worksheet', instructions page 43.\n"); + Do_QDCGTW = Yes; + } /*yes*/ + else + { /*no*/ + fprintf(outfile," D20 = No\n CkD20n X\n"); + // printf("Complete 'Schedule D Tax Worksheet', instructions page D-15.\n"); + Do_SDTW = Yes; + Do_QDCGTW = No; + } /*no*/ + doline22 = 0; + } /* Lines 17-21 */ + else + { + printf(" D17 = no\n CkD17n X\n"); + doline22 = Yes; + } + } /*gain*/ + else + if (SchedD[16] < 0.0) + { /*loss*/ /* Schedule-D line 21. Skip to here from line 16 if a loss. */ + double maxloss; + + if (status == MARRIED_FILING_SEPARAT) maxloss = -1500.0; else maxloss = -3000.0; + if (SchedD[16] < maxloss) SchedD[21] = maxloss; else SchedD[21] = SchedD[16]; + fprintf(outfile," D21 = %6.2f\n", SchedD[21]); + L[7] = SchedD[21]; + doline22 = Yes; + } + else + { /*Zero gain/loss.*/ + L[7] = 0.0; + doline22 = Yes; + } + + if (doline22) + { + if (L3a > 0.0) + { /*yes*/ + fprintf(outfile," D22 = Yes\n CkD22y X\n"); + // printf("Complete 'Qualified Dividends and Capital Gain tax Worksheet', instructions page 44.\n"); + Do_QDCGTW = Yes; + } /*yes*/ + else + { /*no*/ + fprintf(outfile," D22 = No\n CkD22n X\n"); + // Do_QDCGTW = No; + } /*no*/ + } + + fprintf(outfile,"EndPDFpage.\n\n"); + } /*Sched-D*/ +} + + +/*--------------------------------------------------------*/ +/* 'Schedule D Tax Worksheet', instructions page D 16+17. */ +/*--------------------------------------------------------*/ +void sched_D_tax_worksheet( int status ) /* Not updated for 2024. */ +{ + double ws[100]; + int k; + + for (k = 0; k < 100; k++) /* Initialize worksheet to zero's. */ + ws[k] = 0.0; + ws[1] = L[15]; + ws[2] = L3a; + ws[3] = 0.0; /* Form 4952, line 4g. Usually 0.0. */ + ws[4] = 0.0; /* Form 4952, line 4e. Usually 0.0. */ + ws[5] = NotLessThanZero( ws[3] - ws[4] ); + ws[6] = NotLessThanZero( ws[2] - ws[5] ); + ws[7] = smallerof( SchedD[15], SchedD[16] ); + ws[8] = smallerof( ws[3], ws[4] ); + ws[9] = NotLessThanZero( ws[7] - ws[8] ); + ws[10] = ws[6] + ws[9]; + ws[11] = SchedD[18] + SchedD[19]; + ws[12] = smallerof( ws[9], ws[11] ); + ws[13] = ws[10] - ws[12]; + ws[14] = NotLessThanZero( ws[1] - ws[13] ); + switch (status) + { case SINGLE: case MARRIED_FILING_SEPARAT: ws[15] = 44625.0; break; + case MARRIED_FILING_JOINTLY: case WIDOW: ws[15] = 89250.0; break; + case HEAD_OF_HOUSEHOLD: ws[15] = 58750.0; break; + } + ws[16] = smallerof( ws[1], ws[15] ); + ws[17] = smallerof( ws[14], ws[16] ); + ws[18] = NotLessThanZero( ws[1] - ws[10] ); + switch (status) + { case SINGLE: case MARRIED_FILING_SEPARAT: ws[19] = smallerof( ws[1], 182100.0 ); break; + case MARRIED_FILING_JOINTLY: case WIDOW: ws[19] = smallerof( ws[1], 364200.0 ); break; + case HEAD_OF_HOUSEHOLD: ws[19] = smallerof( ws[1], 182100.0 ); break; + } + ws[20] = smallerof( ws[14], ws[19] ); + ws[21] = largerof( ws[18], ws[20] ); + ws[22] = ws[16] - ws[17]; /* This amount is taxed at 0%. */ + if (ws[1] != ws[16]) + { /*lines23-43*/ + ws[23] = smallerof( ws[1], ws[13] ); + ws[24] = ws[22]; + ws[25] = NotLessThanZero( ws[23] - ws[24] ); + switch (status) + { case SINGLE: ws[26] = 492300.0; break; + case MARRIED_FILING_SEPARAT: ws[26] = 276900.0; break; + case MARRIED_FILING_JOINTLY: + case WIDOW: ws[26] = 553850.0; break; + case HEAD_OF_HOUSEHOLD: ws[26] = 523050.0; break; + } + ws[27] = smallerof( ws[1], ws[26] ); + ws[28] = ws[21] + ws[22]; + ws[29] = NotLessThanZero( ws[27] - ws[28] ); + ws[30] = smallerof( ws[25], ws[29] ); + ws[31] = 0.15 * ws[30]; + ws[32] = ws[24] + ws[30]; + if (absolutev( ws[1] - ws[32] ) < 0.01) + { /*lines33-43*/ + ws[33] = ws[23] - ws[32]; + ws[34] = 0.20 * ws[33]; + if (SchedD[19] != 0.0) + { /*lines35-40*/ + ws[35] = smallerof( ws[9], SchedD[19] ); + ws[36] = ws[10] + ws[21]; + ws[37] = ws[1]; + ws[38] = NotLessThanZero( ws[36] - ws[37] ); + ws[39] = NotLessThanZero( ws[35] - ws[38] ); + ws[40] = 0.25 * ws[39]; + } /*lines35-40*/ + if (SchedD[18] != 0.0) + { /*lines41-43*/ + ws[41] = ws[21] + ws[22] + ws[30] + ws[33] + ws[39]; + ws[42] = ws[1] - ws[41]; + ws[43] = 0.28 * ws[42]; + } /*lines41-43*/ + } /*lines33-43*/ + } /*lines23-43*/ + ws[44] = TaxRateFunction( ws[21], status ); + ws[45] = ws[31] + ws[34] + ws[40] + ws[43] + ws[44]; + ws[46] = TaxRateFunction( ws[1], status ); + ws[47] = smallerof( ws[45], ws[46] ); + L[16] = Conditional_Round( ws[47] ); + for (k = 0; k < 100; k++) + { + ws_sched_D[k] = ws[k]; /* Save worksheet values for AMT, if needed. */ + if (ws[k] != 0.0) + fprintf(outfile," Sched-D tax Worksheet line %d = %6.2f\n", k, ws[k]); + } +} + + + +/*--------------------------------------------------------*/ +/* Social Security Worksheet - From Instructions page 32. */ +/*--------------------------------------------------------*/ +void SocSec_Worksheet() /* Not updated for 2024. */ +{ /* Depends on Sched1, lines 11-25, and 1040 lines 1-8. Sets L[6]. */ + double ws[100], negative_amount_sched1_7=0.0; + int k; + if (L6a == 0.0) return; + for (k = 0; k < 100; k++) /* Initialize worksheet to all zero's. */ + ws[k] = 0.0; + ws[1] = L6a; + ws[2] = 0.5 * ws[1]; + if (Sched1[7] < 0.0) /* Do not include any Unemployment Compensation Exclusion (UCE) in SocSec calculations. */ + negative_amount_sched1_7 = Sched1[7]; /* Remove any UCE from L8 by subtracting it. */ + ws[3] = L[1] + L[2] + L[3] + L[4] + L[5] + L[7] + L[8] - negative_amount_sched1_7; + ws[4] = L2a; + ws[5] = ws[2] + ws[3] + ws[4]; + for (k = 11; k <= 20; k++) + ws[6] = ws[6] + Sched1[k]; + ws[6] = ws[6] + Sched1[23] + Sched1[25]; + for (k = 0; k <= 6; k++) + fprintf(outfile,"\tSocSecWorkSheet[%d] = %6.2f\n", k, ws[k] ); + if (ws[6] >= ws[5]) + { + L[6] = 0.0; /* Which is "L6b". */ + fprintf(outfile,"\tSocSecWorkSheet[7]: Check 'No'\n" ); + printf("None of your social security benefits are taxable.\n"); + fprintf(outfile,"None of your social security benefits are taxable.\n"); + return; + } + ws[7] = ws[5] - ws[6]; + fprintf(outfile,"\tSocSecWorkSheet[7] = %6.2f (Check 'Yes')\n", ws[7] ); + if (status == MARRIED_FILING_JOINTLY) + ws[8] = 32000.0; /* Not updated for 2024. */ + else + ws[8] = 25000.0; + fprintf(outfile,"\tSocSecWorkSheet[8] = %6.2f\n", ws[8] ); + if (ws[8] >= ws[7]) + { + L[6] = 0.0; + fprintf(outfile,"\tSocSecWorkSheet[9]: Check 'No'\n" ); + printf("None of your social security benefits are taxable.\n"); + fprintf(outfile,"None of your social security benefits are taxable.\n"); + return; + } + ws[9] = ws[7] - ws[8]; + fprintf(outfile,"\tSocSecWorkSheet[9] = %6.2f (Check 'Yes')\n", ws[9] ); + if (status == MARRIED_FILING_JOINTLY) + ws[10] = 12000.0; /* Not updated for 2024. */ + else + ws[10] = 9000.0; + ws[11] = NotLessThanZero( ws[9] - ws[10] ); + ws[12] = smallerof( ws[9], ws[10] ); + ws[13] = Conditional_Round( ws[12] / 2.0 ); + ws[14] = smallerof( ws[2], ws[13] ); + ws[15] = NotLessThanZero( Conditional_Round( 0.85 * ws[11] )); + ws[16] = ws[14] + ws[15]; + ws[17] = Conditional_Round( 0.85 * ws[1]); + ws[18] = smallerof( ws[16], ws[17] ); + for (k = 10; k <= 18; k++) + fprintf(outfile,"\tSocSecWorkSheet[%d] = %6.2f\n", k, ws[k] ); + L[6] = ws[18]; /* Which is "L6b". */ +} + + + +void pull_comment( char *line, char *word ) +{ + int j=0, k=0; + while ((line[j] != '\0') && (line[j] != '{')) j++; + if (line[j] != '\0') + { + j++; + while ((line[j+k] != '\0') && (line[j+k] != '}')) + { + word[k] = line[j+k]; k++; + } + } + word[k] = '\0'; +} + + +void Grab_ScheduleB_Payer_Lines( char *infname, FILE *outfile ) +{ /* Copy Schedule-B Line entries from input file, to output file -- only. Does not process data read. */ + /* Used for PDF form-FILING only. Not used by tax-calculations. */ + int state=0, cnt=0, pg=0, ncnt=15, newentry=0; + double value; + double total=0.0; + char line[2048], word1[1024], word2[1024], pgstr[10]=""; + FILE *infile; + + infile = fopen( infname, "rb" ); + if (infile == 0) + { + printf("Can no longer read '%s'.\n", infname ); + return; + } + fprintf(outfile,"\nSchedules Data:\n"); + fgets( line, 200, infile ); + while (!feof(infile)) + { + next_word( line, word1, " \t\n\r" ); + switch (state) + { + case 0: + if (strcmp( word1, "L2b" ) == 0) + { + state = 8; ncnt = 15; + pg = 0; cnt = 0; newentry = 1; + strcpy( pgstr, "B1_" ); + } + else + if (strcmp( word1, "L3b" ) == 0) + { + if (pg > 0) + { + fprintf(outfile,"EndPDFpage.\n"); + } + state = 9; ncnt = 16; total = 0.0; + pg = 0; cnt = 0; newentry = 1; + strcpy( pgstr, "B5_" ); + } + break; + case 8: + if (word1[0] == ';') + { + state = 0; + if (pg > 0) + { + fprintf(outfile,"Btotal = %8.2f\n", total ); + fprintf(outfile,"EndPDFpage.\n"); + pg = 0; + } + } + else + if ((word1[0] != '\0') && (word1[0] != '{')) + { + pull_comment( line, word2 ); + cnt++; + if (cnt == ncnt) + { + if (pg > 0) + { + fprintf(outfile,"Btotal = %8.2f\n", total ); + fprintf(outfile,"EndPDFpage.\n"); + } + fprintf(outfile,"PDFpage: 10 10\n"); + fprintf(outfile,"SchedB_Additional_form: Schedule B - Additional Interest Income\n"); + strcpy( pgstr, "Baddi_" ); + cnt = 1; ncnt = 30; total = 0.0; + pg++; + } + fprintf(outfile," %s%d_Text: %s\n", pgstr, cnt, word2 ); + remove_certain_chars( word1, "," ); + if (sscanf( word1, "%lf", &value ) != 1) + printf(" Error reading L2b value '%s'\n", word1 ); + else + { + fprintf(outfile," %s%d %8.2f\n", pgstr, cnt, value ); + total = total + value; + } + } + break; + case 9: + if (word1[0] == ';') + { + state = 0; + if (pg > 0) + { + fprintf(outfile,"Btotal = %8.2f\n", total ); + fprintf(outfile,"EndPDFpage.\n"); + pg = 0; + } + } + else + if ((word1[0] != '\0') && (word1[0] != '{')) + { + pull_comment( line, word2 ); + cnt++; + if (cnt == ncnt) + { + if (pg > 0) + { + fprintf(outfile,"Btotal = %8.2f\n", total ); + fprintf(outfile,"EndPDFpage.\n"); + } + fprintf(outfile,"PDFpage: 10 10\n"); + fprintf(outfile,"SchedB_Additional_form: Schedule B - Additional Dividend Income\n"); + strcpy( pgstr, "Baddi_" ); + cnt = 1; ncnt = 30; total = 0.0; + pg++; + } + fprintf(outfile," %s%d_Text: %s\n", pgstr, cnt, word2 ); + remove_certain_chars( word1, "," ); + if (sscanf( word1, "%lf", &value ) != 1) + printf(" Error reading L3b value '%s'\n", word1 ); + else + { + fprintf(outfile," %s%d %8.2f\n", pgstr, cnt, value ); + total = total + value; + } + } + break; + } + if (!newentry) + fgets( line, 200, infile ); + else + newentry = 0; + } + if (pg > 0) + { + printf("Error: Missing ending ';' on L%d\n", state ); + fprintf(outfile,"Btotal = %6.2f\n", total ); + fprintf(outfile,"EndPDFpage.\n"); + } + fclose(infile); +} + + +void Calc_StudentLoan_Sched1L21() /* Instructions page 96 */ +{ /* Depends on Sched1 lines 11-25, and 1040 L[9]. */ + /* Sets Sched1 lines 21, which impacts Sched1 line 26 and 1040 line 10. */ + int j; + if (Sched1[21] != 0.0) + { /* Student loan interest calculation pg 93. */ + double ws[20], sum=0.0; + ws[1] = smallerof( Sched1[21], 2500.0 ); + ws[2] = L[9]; + for (j=11; j <= 20; j++) + sum = sum + Sched1[j]; + sum = sum + Sched1[23] + Sched1[25]; + ws[3] = sum; + ws[4] = ws[2] - ws[3]; + if (status != MARRIED_FILING_JOINTLY) + ws[5] = 75000.0; /* Not updated for 2024. */ + else + ws[5] = 155000.0; /*MFJ*/ + if (ws[4] > ws[5]) + { + ws[6] = ws[4] - ws[5]; + if (status == MARRIED_FILING_JOINTLY) + ws[7] = ws[6] / 30000.0; + else + ws[7] = ws[6] / 15000.0; + if (ws[7] >= 1.0) + ws[7] = 1.0; + ws[8] = ws[1] * ws[7]; + } + else + ws[8] = 0.0; + ws[9] = ws[1] - ws[8]; + Sched1[21] = ws[9]; + } +} + + + + +/*----------------------------------------------------------------------*/ +/* Main */ +/*----------------------------------------------------------------------*/ +int main( int argc, char *argv[] ) /* Not updated for 2024. */ +{ + int argk, j, k, itemize=0; + char word[2000], outfname[2000], *infname="", labelx[1024]=""; + time_t now; + double exemption_threshold=0.0, tmpval=0.0; + double S_STD_DEDUC, MFS_STD_DEDUC, MFJ_STD_DEDUC, HH_STD_DEDUC, std_deduc; + char *Your1stName, *YourLastName, *Spouse1stName, *SpouseLastName, *socsec, socsectmp[100]; + double NumDependents=0.0; + int StdDedChart_NumBoxesChecked=0, nnn; + int SchedB7a=0, SchedB7aa=-1, SchedB8=0, gotB7a=0; + char SchedB7b[1024]=""; + double ntcpe=0.0, pyei=0.0; + double S1_1099K_err=0.0, Sched2_17[50]; + char *S2_17a_Type, *S2_17z_Type, *S3_6z_Type, *S3_13z_Type; + double charityCC=0.0, charityOT=0.0, charityCO=0.0; + + /* Decode any command-line arguments. */ + printf("US 1040 2024 - v%3.2f\n", thisversion); + argk = 1; k=1; + while (argk < argc) + { + if (strcmp(argv[argk],"-verbose")==0) { verbose = Yes; } + else + if (strcmp(argv[argk],"-allforms")==0) { force_print_all_pdf_forms = 1; } + else + if (strcmp(argv[argk],"-round_to_whole_dollars")==0) { round_to_whole_dollars = 1; } + else + if (k==1) + { + infname = strdup( argv[argk] ); + infile = fopen( infname,"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", infname ); exit(1);} + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname, infname); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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[argk]); exit(1);} + argk = argk + 1; + } + + if (infile==0) {printf("Error: No input file on command line.\n"); exit(1);} + + /* Pre-initialize all lines to zeros. */ + for (j=0; j 0.0) Do_QDCGTW = Yes; + GetLineF( "L3b", &L[3] ); /* Ordinary Dividends. (Sched-B) */ + GetLineF( "L4a", &L4a ); /* IRAs distributions. */ + GetLineF( "L4b", &L[4] ); /* Taxable IRAs distributions. */ + GetLineF( "L5a", &L5a ); /* Pensions and annuities. */ + GetLineF( "L5b", &L[5] ); /* Taxable pensions, and annuities. */ + GetLineF( "L6a", &L6a ); /* Social Security benefits. Forms SSA-1099 box-5. */ + + GetLine( "L13", &L[13] ); /* Qualified business income deduction. */ + GetLine( "L19", &L[19] ); /* Child tax credit/credit for other dependents. */ + + GetLine( "L25a", &L25a ); /* Federal income tax withheld, Forms W-2, 1099 */ + GetLine( "L25b", &L25b ); /* Federal income tax withheld, Forms W-2, 1099 */ + GetLine( "L25c", &L25c ); /* Federal income tax withheld, Forms W-2, 1099 */ + L[25] = L25a + L25b + L25c; + GetLine( "L26", &L[26] ); /* Estimated tax payments for 2024. */ + GetLine( "L27", &L[27] ); /* Earned Income Credit (EIC). */ + GetLine( "L28", &L[28] ); /* Refundable credit: Sch. 8812 */ + GetLine( "L29", &L[29] ); /* American Opportunity Credit, Form 8863, line 8 */ + + GetLine( "ApplyTo2024", &L[36] ); /* Percent of OverPayment you want applied to your 2024 estimated tax. */ + if ((L[36] < 0.0) || (L[36] > 100.0)) + { + printf("Error: 'ApplyTo2024' value (%g) out-of-range (0-100).\n", L[36] ); + fprintf(outfile,"Error: 'ApplyTo2024' value (%g) out-of-range (0-100).\n", L[36] ); + L[36] = 0.0; + } + + GetLine( "L38", &L[38] ); /* Estimated Tax Under-payment Penalty */ + + get_cap_gains(); /* Capital gains. (Schedule-D). This popuates "schedD[]" and L[7]. */ + + + /* Determine your Std. Deduction value. */ + fprintf(outfile, "StdDedChart_NumBoxesChecked = %d\n", StdDedChart_NumBoxesChecked ); + if (StdDedChart_NumBoxesChecked == 0) + { + S_STD_DEDUC = 14600.0; /* Updated for 2024. */ + MFJ_STD_DEDUC = 29200.0; + MFS_STD_DEDUC = 14600.0; + HH_STD_DEDUC = 21900.0; + } + else + { /* Std. Deduction chart for People who were Born Before January 2, 1960, or Were Blind, pg 34. */ + switch (StdDedChart_NumBoxesChecked) /* Does not handle if someone claims you or joint-spouse as dependent. */ + { /* (Qualifying Widow/er has same amounts as MFJ, so not broken into separate variable.) */ + case 1: + S_STD_DEDUC = 15700.0; /* Not updated for 2024. */ + MFJ_STD_DEDUC = 29200.0; + MFS_STD_DEDUC = 15350.0; + HH_STD_DEDUC = 22650.0; + break; + case 2: + S_STD_DEDUC = 17550.0; + MFJ_STD_DEDUC = 30700.0; + MFS_STD_DEDUC = 16850.0; + HH_STD_DEDUC = 24500.0; + break; + case 3: + MFJ_STD_DEDUC = 32200.0; + MFS_STD_DEDUC = 18350.0; + S_STD_DEDUC = 17550.0; /* Cannot happen, but set to appease compiler. */ + HH_STD_DEDUC = 24500.0; /* .. */ + break; + case 4: + MFJ_STD_DEDUC = 33700.0; + MFS_STD_DEDUC = 19850.0; + S_STD_DEDUC = 17550.0; /* Cannot happen, but set to appease compiler. */ + HH_STD_DEDUC = 24500.0; /* .. */ + break; + default: fprintf(outfile,"Error: StdDedChart_NumBoxesChecked (%d) not equal to 1, 2, 3, or 4.\n", StdDedChart_NumBoxesChecked ); + printf("Error: StdDedChart_NumBoxesChecked (%d) not equal to 1, 2, 3, or 4.\n", StdDedChart_NumBoxesChecked ); + exit(1); + } + fprintf(outfile," (Assuming no one is claiming you, or your joint-spouse, as a dependent.)\n"); + } + + switch (status) + { + case SINGLE: + std_deduc = S_STD_DEDUC; break; + case MARRIED_FILING_SEPARAT: + std_deduc = MFS_STD_DEDUC; break; + case WIDOW: + case MARRIED_FILING_JOINTLY: + std_deduc = MFJ_STD_DEDUC; break; + case HEAD_OF_HOUSEHOLD: + std_deduc = HH_STD_DEDUC; break; + default: printf("Case (Line 12) not handled.\n"); fprintf(outfile,"Case (Line 12) not handled.\n"); exit(1); + } + + + + /* -- Schedule-1 -- Additional Income and Adjustments */ + + GetLineF( "S1_1099K_err", &S1_1099K_err ); /* Amounts on 1099-K forms reported in error or for personal loss. */ + GetLineF( "S1_1", &Sched1[1] ); /* Taxable refunds. */ + GetLineF( "S1_2a", &Sched1[2] ); /* Alimony received. */ + GetTextLineF( "S1_2b:" ); /* Date of divorce or separation. */ + + GetLineF( "S1_3", &Sched1[3] ); /* Business income/loss. */ + showline_wlabel( "S1_3", Sched1[3] ); /* This line was set in get_cap_gains() above. */ + + GetLineFnz( "S1_4", &Sched1[4] ); /* Other gains or losses. Form 4794. */ + + GetLineFnz( "S1_5", &Sched1[5] ); /* Rent realestate, royalties, partnerships, S corp. (Sched E)*/ + + GetLineFnz( "S1_6", &Sched1[6] ); /* Farm income/loss. (Sched F) */ + + GetLineFnz( "S1_7", &Sched1[7] ); /* Unemployment compensation */ + + GetLineFnz( "S1_8a", &Sched1[8] ); /* Net operating loss */ + Sched1[9] = -absolutev( Sched1[8] ); + GetLineFnz( "S1_8b", &Sched1[8] ); /* Gambling income */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8c", &Sched1[8] ); /* Cancellation of debt */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8d", &Sched1[8] ); /* Foreign earned income exclusion from Form 2555 */ + Sched1[9] = Sched1[9] - absolutev( Sched1[8] ); + GetLineFnz( "S1_8e", &Sched1[8] ); /* Income from Form 8853 */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8f", &Sched1[8] ); /* Income from Form 8889 */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8g", &Sched1[8] ); /* Alaska Permanent Fund dividends */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8h", &Sched1[8] ); /* Jury duty pay */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8i", &Sched1[8] ); /* Prizes and awards */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8j", &Sched1[8] ); /* Activity not engaged in for profit income */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8k", &Sched1[8] ); /* Stock options */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8l", &Sched1[8] ); /* Income from the rental of personal property if ... */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8m", &Sched1[8] ); /* Olympic and Paralympic medals + prizes */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8n", &Sched1[8] ); /* Section 951(a) inclusion */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8o", &Sched1[8] ); /* Section 951A(a) inclusion */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8p", &Sched1[8] ); /* Section 461(l) excess business loss adjustment */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8q", &Sched1[8] ); /* Taxable distributions from an ABLE account */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8r", &Sched1[8] ); /* Scholarship and fellowship grants not reported on Form W-2 */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8s", &Sched1[8] ); /* Nontaxable Medicaid waiver payments included on line 1a or 1d */ + Sched1[9] = Sched1[9] + -absolutev( Sched1[8] ); + GetLineFnz( "S1_8t", &Sched1[8] ); /* Pension from a nonqualifed deferred compensation plan or section 457 plan */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8u", &Sched1[8] ); /* Wages earned while incarcerated */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8z", &Sched1[8] ); /* Other income. */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetTextLineF( "S1_8z_Type:" ); + + showline_wlabel( "S1_9", Sched1[9] ); + + for (j=1; j <= 7; j++) + Sched1[10] = Sched1[10] + Sched1[j]; + Sched1[10] = Sched1[10] + Sched1[9]; + showline_wlabel( "S1_10", Sched1[10] ); + L[8] = Sched1[10]; + L[9] = L[1] + L[2] + L[3] + L[4] + L[5] + L[6] + L[7] + L[8]; + + GetLineF( "S1_11", &Sched1[11] ); /* Educator expenses */ + GetLineF( "S1_12", &Sched1[12] ); /* Bus. exp.: reservists, artists, ... Attach Form 2106 */ + GetLineF( "S1_13", &Sched1[13] ); /* Health savings account deduction. Attach Form 8889 */ + GetLineF( "S1_14", &Sched1[14] ); /* Moving expenses. Attach Form 3903 */ + GetLineF( "S1_15", &Sched1[15] ); /* Deductable part of self-employment tax. Attach Schedule SE */ + GetLineF( "S1_16", &Sched1[16] ); /* Self-employed SEP, SIMPS1_E, and qualified plans */ + GetLineF( "S1_17", &Sched1[17] ); /* Self-employed health insurance deduction */ + GetLineF( "S1_18", &Sched1[18] ); /* Penalty on early withdrawal of savings */ + GetLineF( "S1_19a", &Sched1[19] ); /* Alimony paid */ + + GetTextLineF( "AlimRecipSSN:" ); + GetTextLineF( "DivorceDate:" ); + + GetLineF( "S1_20", &Sched1[20] ); /* IRA deduction */ + GetLineF( "S1_21", &Sched1[21] ); /* Student loan interest deduction */ + GetLineF( "S1_23", &Sched1[23] ); /* Archer MSA deduction */ + + GetLineF( "S1_24a", &Sched1[24] ); /* Jury duty pay */ + Sched1[25] = Sched1[24]; + GetLineF( "S1_24b", &Sched1[24] ); /* Deductible expenses of rental of personal property */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24c", &Sched1[24] ); /* Nontaxable Olympic and Paralympic medals & prizes */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24d", &Sched1[24] ); /* Reforestation amortization and expenses */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24e", &Sched1[24] ); /* Repayment of supplemental unemployment benefits */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24f", &Sched1[24] ); /* Contributions to section 501(c)(18)(D) pension plans */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24g", &Sched1[24] ); /* Contributions by certain chaplains to section 403(b) plans */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24h", &Sched1[24] ); /* Attorney fees and court costs for unlawful discrimination claims */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24i", &Sched1[24] ); /* Attorney fees and court costs for award from the IRS */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24j", &Sched1[24] ); /* Housing deduction from Form 2555 */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24k", &Sched1[24] ); /* Excess deductions of section 67(e) expenses from Schedule K-1 */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24z", &Sched1[24] ); /* Other adjustments. */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetTextLineF( "S1_24z_Type:" ); + showline_wlabel( "S1_25", Sched1[25] ); + + SocSec_Worksheet(); /* This calc. depends on line L6a and Sched1[11-25]. Calculates L6b, which is L[6]. */ + L[9] = L[1] + L[2] + L[3] + L[4] + L[5] + L[6] + L[7] + L[8]; + Calc_StudentLoan_Sched1L21(); + + for (j=11; j <= 23; j++) + Sched1[26] = Sched1[26] + Sched1[j]; + Sched1[26] = Sched1[26] + Sched1[25]; + showline_wlabel( "S1_26", Sched1[26] ); + L[10] = Sched1[26]; + + /* -- End of Schedule-1 -- */ + + + /* -- Schedule A - Input -- */ + GetLine( "A1", &SchedA[1] ); /* Unreimbursed medical expenses. */ + for (j=0; j<10; j++) + localtax[j] = 0.0; + if (status != MARRIED_FILING_SEPARAT) + loctaxlimit = 10000.0; + else + loctaxlimit = 5000.0; + GetLine( "A5a", &localtax[1] ); /* State and local income taxes. Or sales taxes. */ + get_parameter( infile, 'l', labelx, "CheckBoxA5a or A5b" ); + if (strcmp( labelx, "CheckBoxA5a" ) == 0) + { + get_parameters( infile, 'b', &j, "CheckBoxA5a" ); + if (j) + fprintf(outfile,"CheckBoxA5a X\n"); + GetLine( "A5b", &localtax[2] ); + } + else + if (strcmp( labelx, "A5b" ) == 0) + { + get_parameters( infile, 'f', &localtax[2], "A5b" ); + } + else + { + printf("Error: Found '%s' when expecteding CheckBoxA5a or A5b,\n", labelx ); + fprintf(outfile,"Error: Found '%s' when expecteding CheckBoxA5a or A5b,\n", labelx ); + exit(1); + } + // GetLine( "A5b", &localtax[2] ); /* State and local real estate taxes. */ /* Optionally read-in just above. */ + GetLine( "A5c", &localtax[3] ); /* State and local personal property (eg. automobile) taxes. */ + GetLine( "A6", &SchedA[6] ); /* Other taxes. */ + GetLine( "A8a", &homemort[0] ); /* Home mortgage interest and points reported to you on Form 1098.*/ + GetLine( "A8b", &homemort[1] ); /* Home mortgage interest not reported to you on Form 1098.*/ + GetLine( "A8c", &homemort[2] ); /* Points not reported to you on Form 1098.*/ + homemort[3] = 0; + // GetLine( "A8d", &homemort[3] ); /* Mortgage insurance premiums. */ + GetOptionalLine( "A8d or A9", labelx, &tmpval ); + if (strcmp( labelx, "A9" ) == 0) + { + homemort[3] = 0.0; + SchedA[9] = tmpval; + } + else + if (strcmp( labelx, "A8d" ) == 0) + { + homemort[3] = tmpval; + GetLine( "A9", &SchedA[9] ); + } + else + { + printf("Error: Found '%s' when expecteding A8d,\n", labelx ); + fprintf(outfile,"Error: Found '%s' when expecteding A8d,\n", labelx ); + exit(1); + } + // GetLine( "A9", &SchedA[9] ); /* Investment interest. Attach Form 4952*/ /* Optionally read-in just above. */ + + GetLine( "A11", &charityCC ); /* Charity Contributions by Cash or Check. */ + SchedA[11] = charityCC; /* Charity contributions by cash or check.*/ + + GetLine( "A12", &charityOT ); /* Charity Contributions Other Than cash or check. */ + SchedA[12] = charityOT; /* Contributions other than cash or check.*/ + + GetLine( "A13", &charityCO ); /* Charity Contributions Carried Over from last year. */ + SchedA[13] = charityCO; /* Carryover from prior year*/ + + + GetLine( "A15", &SchedA[15] ); /* Casualty or theft loss(es).*/ + GetLine( "A16", &SchedA[16] ); /* Other expenses*/ + + /* Look for optional Force-Itemize line. (Remove *optional* logic for 2024, once A18 is on ALL templates.) */ + get_parameter( infile, 'l', labelx, "A18 or B7a"); + if (strcmp( labelx, "A18" ) == 0) + { + // GetYesNo( "A18", &ForceItemize ); + get_parameters( infile, 'b', &ForceItemize, labelx ); + } + else + if (strcmp( labelx, "B7a" ) == 0) + { + // GetYesNo( "B7a", &SchedB7a ); + get_parameters( infile, 'b', &SchedB7a, labelx ); + gotB7a = 1; + } + else + { + printf("Error: Found '%s' when expecteding A18 or B7a.\n", labelx ); + fprintf(outfile,"Error: Found '%s' when expecteding A18 or B7a\n", labelx ); + exit(1); + } + + L[11] = L[9] - L[10]; + + /* -- Calculate Schedule A -- */ + SchedA[2] = L[11]; + SchedA[3] = Conditional_Round( 0.075 * SchedA[2] ); + SchedA[4] = NotLessThanZero( SchedA[1] - SchedA[3] ); + localtax[4] = localtax[1] + localtax[2] + localtax[3]; + localtax[5] = smallerof( localtax[4], loctaxlimit ); + SchedA[7] = localtax[5] + SchedA[6]; + homemort[5] = homemort[0] + homemort[1] + homemort[2] + homemort[3]; + SchedA[10] = homemort[5] + SchedA[9]; + SchedA[14] = SchedA[11] + SchedA[12] + SchedA[13]; + SchedA[17] = SchedA[4] + SchedA[7] + SchedA[10] + SchedA[14] + SchedA[15] + SchedA[16]; + + if ((std_deduc < SchedA[17]) || (ForceItemize)) + { /*Select_to_Itemize*/ + itemize = Yes; + L[12] = SchedA[17]; /* Use itemized value. */ + if (ForceItemize) + { + printf(" You elected to itemize deductions, even though they may be less than your Standard Deduction.\n"); + fprintf(outfile," You elected to itemize deductions, even though they may be less than your Standard Deduction.\n"); + printf(" (Itemizations = %6.2f, Std-Deduction = %6.2f)\n", SchedA[17], std_deduc ); + fprintf(outfile," (Itemizations = %6.2f, Std-Deduction = %6.2f)\n", SchedA[17], std_deduc ); + } + else + { + printf(" (Itemizations > Std-Deduction, %6.2f > %6.2f)\n", SchedA[17], std_deduc ); + fprintf(outfile," (Itemizations > Std-Deduction, %6.2f > %6.2f)\n", SchedA[17], std_deduc ); + } + fprintf(outfile,"Itemizing.\n"); + } /*Select_to_Itemize*/ + else + { /*Select_to_use_StdDeduction*/ + itemize = No; + L[12] = std_deduc; /* Take the Std.Deduction. */ + printf(" (Itemizations < Std-Deduction, %6.2f < %6.2f)\n", SchedA[17], std_deduc ); + fprintf(outfile," (Itemizations < Std-Deduction, %6.2f < %6.2f)\n", SchedA[17], std_deduc ); + fprintf(outfile,"Use standard deduction.\n"); + } /*Select_to_use_StdDeduction*/ + + + /* -- Display Schedule A -- */ + showschedA(1); + showschedA(2); + showschedA(3); + showschedA(4); + showline_wlabel( "A5a", localtax[1] ); + showline_wlabel( "A5b", localtax[2] ); + showline_wlabel( "A5c", localtax[3] ); + showline_wlabel( "A5d", localtax[4] ); + showline_wlabel( "A5e", localtax[5] ); + showschedA(6); + showschedA(7); + showline_wlabel( "A8a", homemort[0] ); + showline_wlabel( "A8b", homemort[1] ); + showline_wlabel( "A8c", homemort[2] ); + showline_wlabel( "A8d", homemort[3] ); + showline_wlabel( "A8e", homemort[5] ); + showschedA(9); + showschedA(10); + showschedA(11); + showschedA(12); + showschedA_wMsg(13, "Carryover from prior year" ); + showschedA(14); + showschedA(15); + showschedA(16); + showschedA(17); + if (ForceItemize) + fprintf(outfile,"CheckBoxA18 = X\n"); + + showline_wlabel( "L6b", L[6] ); + showline( 7 ); + showline( 8 ); + showline( 9 ); + showline_wlabel( "S1_20", Sched1[20] ); + showline_wlabelnz( "S1_21", Sched1[21] ); + showline_wlabel( "S1_22", Sched1[22] ); + showline( 10 ); + showline_wlabelmsg( "L11", L[11], "Adjusted Gross Income" ); + + + if ((L[2] != 0.0) || (L[3] != 0.0)) + { + fprintf(outfile," Schedule-B:\n"); + fprintf(outfile," B2 = %6.2f\n", L[2] ); + fprintf(outfile," B4 = %6.2f\n", L[2] ); + fprintf(outfile," B6 = %6.2f\n", L[3] ); + } + + + if (under65 == 0) over65 = 1; + switch (status) /* Check for minimum income to file. (min2file) */ /* Updated for 2024. */ + { /* Listed in Instructions page-9, in Chart A - For Most People. */ + case SINGLE: if (under65) exemption_threshold = 14600.0; + else exemption_threshold = 16550.0; + break; + case MARRIED_FILING_JOINTLY: if (under65==2) exemption_threshold = 29200.0; + else + if (under65==1) exemption_threshold = 30750.0; + else exemption_threshold = 32300.0; + if (under65 != 2) over65 = 1; + break; + case MARRIED_FILING_SEPARAT: exemption_threshold = 5.0; + break; + case HEAD_OF_HOUSEHOLD: if (under65) exemption_threshold = 21900.0; + else exemption_threshold = 23850.0; + break; + case WIDOW: if (under65) exemption_threshold = 29200.0; + else exemption_threshold = 30750.0; + } + if (L[11] < exemption_threshold) + { + printf(" (L11 = %3.2f < Threshold = %3.2f)\n", L[11], exemption_threshold ); + printf("You may not need to file a return, due to your income level.\n\n"); + fprintf(outfile,"You may not need to file a return, due to your income level.\n\n"); + } + + showline( 12 ); + showline( 13 ); /* Qualified business income ded., read-in above. */ + + L[14] = L[12] + L[13]; + showline( 14 ); + + L[15] = NotLessThanZero( L[11] - L[14] ); + showline_wlabelmsg( "L15", L[15], "Taxable Income" ); + + L[16] = TaxRateFunction( L[15], status ); + + if (L[15] <= 0.0) + { /*exception*/ /* See rules on top of "Schedule D Tax Worksheet", pg 16 of Sched-D Instructions. */ + printf(" Exception (Sched-D Instructions page D-16) - Do not use QDCGT or Sched-D Tax Worksheets.\n"); + } /*exception*/ + else + { /*no_exception*/ + if ((!Do_SDTW) && (!Do_QDCGTW) && ((L3a > 0.0) || (Sched1[13] > 0.0) || ((SchedD[15] > 0.0) && (SchedD[16] > 0.0)) )) + Do_QDCGTW = Yes; + if (Do_QDCGTW) + { + fprintf(outfile,"Doing 'Qualified Dividends and Capital Gain tax Worksheet', page 37.\n"); + capgains_qualdividends_worksheets( status ); + } + else + if (Do_SDTW) + { + fprintf(outfile,"Doing 'Schedule D Tax Worksheet', page D16.\n"); + sched_D_tax_worksheet( status ); + } + } /*no_exception*/ + + showline_wlabelmsg( "L16", L[16], "Tax" ); + + if (!gotB7a) + GetYesNo( "B7a", &SchedB7a ); + GetYesNo( "B7aa", &SchedB7aa ); + GetString( "B7b", SchedB7b ); + GetYesNo( "B8", &SchedB8 ); + + if (SchedB7a) + fprintf(outfile,"CkB7a_Y X\n"); + else + fprintf(outfile,"CkB7a_N X\n"); + + if (SchedB7aa == 1) + fprintf(outfile,"CkB7aa_Y X\n"); + else + if (SchedB7aa == 0) + fprintf(outfile,"CkB7aa_N X\n"); + + if (strlen( SchedB7b ) > 0) + fprintf(outfile,"B7b = %s\n", SchedB7b ); + + if (SchedB8) + fprintf(outfile,"CkB8_Y X\n"); + else + fprintf(outfile,"CkB8_N X\n"); + + + /* -- Alternative Minimum Tax (AMT) Entries (if needed) -- */ + GetLine( "AMTws2c", &amtws2c ); + GetLine( "AMTws2g", &amtws2g ); + GetLine( "AMTws3", &amtws[3] ); + GetLine( "AMTws8", &amtws[8] ); + + + /* -- Schedule 2 -- Additional Taxes */ + + GetLine( "S2_1a", &Sched2_1a ); /* Excess advance premium tax credit repayment. Form 8962. */ + /* (Needed by AMT form6251.) */ + GetLine( "S2_1b", &Sched2_1b ); /* Repayment of new clean vehicle credit(s) transferred to dealer. */ + GetLine( "S2_1c", &Sched2_1c ); /* Repayment of previously owned clean vehicle credit(s) transferred to dealer. */ + GetLine( "S2_1d", &Sched2_1d ); /* Recapture of net EPE from Form 4255, line 2a, column (l). */ + GetLine( "S2_1e", &Sched2_1e ); /* Excessive payments (EP) from Form 4255. */ + GetLine( "S2_1f", &Sched2_1f ); /* 20% EP from Form 4255. */ + GetLine( "S2_1y", &Sched2_1y ); /* Other additions to tax (see instructions). */ + + Sched2_1z = Sched2_1a + Sched2_1b + Sched2_1c + Sched2_1d + Sched2_1e + Sched2_1f + Sched2_1y; + Sched2[1] = Sched2_1z; + + GetLine( "S2_4", &Sched2[4] ); /* Self-employment tax. Sched SE. */ + GetLine( "S2_5", &Sched2[5] ); /* Social security and Medicare tax from Form 4137. */ + GetLine( "S2_6", &Sched2[6] ); /* Uncollected Social security and Medicare tax from Form 8919 */ + Sched2[7] = Sched2[5] + Sched2[6]; + GetLine( "S2_8", &Sched2[8] ); /* Additional tax on IRAs or other tax-favored accounts, Form 5329 */ + GetLine( "S2_9", &Sched2[9] ); /* Household employment taxes. Sched H */ + GetLine( "S2_10", &Sched2[10] ); /* First-time homebuyer credit repayment. Form 5405. */ + + GetLine( "S2_11", &Sched2[11] ); /* Additional Medicare Tax. Attach Form 8959 */ + GetLine( "S2_12", &Sched2[12] ); /* Net investment income tax. Attach Form 8960 */ + GetLine( "S2_13", &Sched2[13] ); /* Uncollected social security ... from Form W-2, box 12 */ + GetLine( "S2_14", &Sched2[14] ); /* Interest on tax due on installment income */ + GetLine( "S2_15", &Sched2[15] ); /* Interest on the deferred tax on gain from certain installment sales */ + GetLine( "S2_16", &Sched2[16] ); /* Recapture of low-income housing credit. Attach Form 8611 */ + + for (j=0; j < 50; j++) /* Clear temporary storage variables. */ + Sched2_17[j] = 0.0; + + j = 0; + GetLine( "S2_17a", &Sched2_17[j] ); /* Recapture of other credits. */ + S2_17a_Type = GetTextLine( "S2_17a_Type:" ); + Sched2[18] = Sched2_17[j++]; + GetLine( "S2_17b", &Sched2_17[j] ); /* Recapture of federal mortgage subsidy. */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17c", &Sched2_17[j] ); /* Additional tax on HSA distributions. Attach Form 8889 */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17d", &Sched2_17[j] ); /* Additional tax on an HSA, Attach Form 8889 */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17e", &Sched2_17[j] ); /* Additional tax on Archer MSA distributions. */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17f", &Sched2_17[j] ); /* Additional tax on Medicare Advantage MSA distributions. Form 8853 */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17g", &Sched2_17[j] ); /* Recapture of a charitable contribution deduction */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17h", &Sched2_17[j] ); /* Income you received from a nonqualified deferred compensation */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17i", &Sched2_17[j] ); /* Compensation received from nonqualified deferred compensation plan */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17j", &Sched2_17[j] ); /* Section 72(m)(5) excess benefits tax */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17k", &Sched2_17[j] ); /* Golden parachute payments */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17l", &Sched2_17[j] ); /* Tax on accumulation distribution of trusts */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17m", &Sched2_17[j] ); /* Excise tax on insider stock compensation */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17n", &Sched2_17[j] ); /* Look-back interest under section 167(g) or 460(b) */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17o", &Sched2_17[j] ); /* Tax on non-effectively connected income */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17p", &Sched2_17[j] ); /* Any interest from Form 8621, line 16f */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17q", &Sched2_17[j] ); /* Any interest from Form 8621, line 24 */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17z", &Sched2_17[j] ); /* Any other taxes. */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + S2_17z_Type = GetTextLine( "S2_17z_Type:" ); + nnn = j - 1; + GetLine( "S2_19", &Sched2[19] ); /* Additional tax from Schedule 8812. */ + GetLine( "S2_20", &Sched2[20] ); /* Section 965 net tax liability installment from Form 965-A. */ + + + GetLine( "S3_1", &Sched3[1] ); /* Foreign tax credit. Form 1116. (Needed by AMT form6251.) */ + + Sched2[2] = form6251_AlternativeMinimumTax( itemize ); /* (Depends on Sched2_1a & Sched3[1].) */ + if (Sched2[2] == 0.0) + fprintf(outfile," (Not subject to Alternative Minimum Tax.)\n"); + else + fprintf(outfile," (You must pay Alternative Minimum Tax.)\n"); + + showline_wlabelnz( "S2_1a", Sched2_1a ); + showline_wlabelnz( "S2_1b", Sched2_1b ); + showline_wlabelnz( "S2_1c", Sched2_1c ); + showline_wlabelnz( "S2_1d", Sched2_1d ); + showline_wlabelnz( "S2_1e", Sched2_1e ); + showline_wlabelnz( "S2_1f", Sched2_1f ); + showline_wlabelnz( "S2_1y", Sched2_1y ); + showline_wlabelnz( "S2_1z", Sched2_1z ); + showline_wlabelmsg_nz( "S2_2", Sched2[2], " Alternative Minimum Tax" ); + Sched2[3] = Sched2[1] + Sched2[2]; + + for (j=3; j <= 16; j++) + { + sprintf(word,"S2_%d", j ); + showline_wlabelnz( word, Sched2[j] ); + } + showline_wlabelnz( "S2_17a", Sched2_17[0] ); + printf("S2_17a_Type: %s\n", S2_17a_Type ); + fprintf(outfile,"S2_17a_Type: %s\n", S2_17a_Type ); + for (j=2; j <= nnn; j++) + { + sprintf(word,"S2_17%c", 'a' + j - 1 ); + showline_wlabelnz( word, Sched2_17[j] ); + } + fprintf(outfile,"S2_17z_Type: %s\n", S2_17z_Type ); + + Sched2[21] = Sched2[4] + Sched2[18] + Sched2[19]; + for (j=7; j <= 16; j++) + Sched2[21] = Sched2[21] + Sched2[j]; + for (j=18; j <= 21; j++) + { + sprintf(word,"S2_%d", j ); + showline_wlabelnz( word, Sched2[j] ); + } + L[23] = Sched2[21]; + + /* -- End of Schedule 2 */ + + + L[17] = Sched2[3]; + showline( 17 ); + + L[18] = L[16] + L[17]; + showline( 18 ); + + showline( 19 ); + + + /* -- Schedule 3 -- Part I - Nonrefundable Credits */ + showline_wlabel( "S3_1", Sched3[1] ); + + GetLine( "S3_2", &Sched3[2] ); /* Child / dependent care expense credits. Form 2441. */ + showline_wlabel( "S3_2", Sched3[2] ); + + GetLine( "S3_3", &Sched3[3] ); /* Education credits. Form 8863. */ + showline_wlabel( "S3_3", Sched3[3] ); + + GetLine( "S3_4", &Sched3[4] ); /* Retirement savings contributions credit. Form 8880. */ + showline_wlabel( "S3_4", Sched3[4] ); + + GetLine( "S3_5a", &Sched3[5] ); /* Residential energy credits. Form 5695. */ + showline_wlabel( "S3_5a", Sched3[5] ); + Sched3[8] = Sched3[8] + Sched3[5]; + + GetLine( "S3_5b", &Sched3[5] ); /* Residential energy credits. Form 5695. */ + showline_wlabel( "S3_5b", Sched3[5] ); + Sched3[8] = Sched3[8] + Sched3[5]; + + GetLineFnz( "S3_6a", &Sched3[6] ); /* General business credit. Form 3800. */ + showline_wlabel( "S3_6a", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6b", &Sched3[6] ); /* Credit for prior year minimum tax. Form 8801. */ + showline_wlabel( "S3_6b", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6c", &Sched3[6] ); /* Adoption credit. Attach Form 8839 */ + showline_wlabel( "S3_6c", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6d", &Sched3[6] ); /* Credit for the elderly or disabled. Attach Schedule R */ + showline_wlabel( "S3_6d", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6e", &Sched3[6] ); /* Alternative motor vehicle credit. Attach Form 8910 */ + showline_wlabel( "S3_6e", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6f", &Sched3[6] ); /* Qualified plug-in motor vehicle credit. Attach Form 8936 */ + showline_wlabel( "S3_6e", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6g", &Sched3[6] ); /* Mortgage interest credit. Attach Form 8396 */ + showline_wlabel( "S3_6g", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6h", &Sched3[6] ); /* District of Columbia first-time homebuyer credit. Attach Form 8859 */ + showline_wlabel( "S3_6h", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6i", &Sched3[6] ); /* Qualified electric vehicle credit. Attach Form 8834 */ + showline_wlabel( "S3_6i", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6j", &Sched3[6] ); /* Alternative fuel vehicle refueling property credit. Attach Form 8911 */ + showline_wlabel( "S3_6j", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6k", &Sched3[6] ); /* Credit to holders of tax credit bonds. Attach Form 8912 */ + showline_wlabel( "S3_6j", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6l", &Sched3[6] ); /* Amount on Form 8978, line 14. */ + showline_wlabel( "S3_6l", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6m", &Sched3[6] ); /* Credit for previously owned clean vehicles. Form 8936. */ + showline_wlabel( "S3_6m", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6z", &Sched3[6] ); /* Other nonrefundable credits. */ + showline_wlabel( "S3_6z", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + S3_6z_Type = GetTextLine( "S3_6z_Type:" ); + printf("S3_6z_Type: %s\n", S3_6z_Type ); + fprintf(outfile,"S3_6z_Type: %s\n", S3_6z_Type ); + + showline_wlabel( "S3_7", Sched3[7] ); + + for (j=1; j <= 4; j++) + Sched3[8] = Sched3[8] + Sched3[j]; + Sched3[8] = Sched3[8] + Sched3[7]; + showline_wlabelnz( "S3_8", Sched3[8] ); + L[20] = Sched3[8]; + showline( 20 ); + + GetLine( "S3_9", &Sched3[9] ); /* Net premium tax credit. Form 8962. */ + showline_wlabelnz( "S3_9", Sched3[9] ); + + GetLine( "S3_10", &Sched3[10] ); /* Amnt paid in filing extension req. */ + showline_wlabelnz( "S3_10", Sched3[10] ); + + GetLine( "S3_11", &Sched3[11] ); /* Excess Soc. Sec. + tier 1 RRTA tax withheld */ + showline_wlabelnz( "S3_11", Sched3[11] ); + + GetLine( "S3_12", &Sched3[12] ); /* Credits for federal tax on fuels. Attach form 4136. */ + showline_wlabelnz( "S3_12", Sched3[12] ); + + GetLine( "S3_13a", &Sched3_13a ); /* Credits from Form 2439 */ + showline_wlabelnz( "S3_13a", Sched3_13a ); + + GetLine( "S3_13b", &Sched3_13b ); /* Credit for repayment of amounts included in income from prior years. */ + showline_wlabelnz( "S3_13b", Sched3_13b ); + + GetLine( "S3_13c", &Sched3_13c ); /* Elective payment amount. Form 3800, Part III, line 6, column (i). */ + showline_wlabelnz( "S3_13c", Sched3_13c ); + + GetLine( "S3_13d", &Sched3_13d ); /* Deferred amount of net 965 tax liability */ + showline_wlabelnz( "S3_13d", Sched3_13d ); + + GetLine( "S3_13z", &Sched3_13z ); /* Credits from Other */ + showline_wlabelnz( "S3_13z", Sched3_13z ); + + S3_13z_Type = GetTextLine( "S3_13z_Type:" ); + printf("S3_13z_Type: %s\n", S3_13z_Type ); + fprintf(outfile,"S3_13z_Type: %s\n", S3_13z_Type ); + + Sched3[14] = Sched3_13a + Sched3_13b + Sched3_13c + Sched3_13d; + showline_wlabelnz( "S3_14", Sched3[14] ); + + for (j = 9; j <= 12; j++) + Sched3[15] = Sched3[15] + Sched3[j]; + Sched3[15] = Sched3[15] + Sched3[14]; + showline_wlabel( "S3_15", Sched3[15] ); + L[31] = Sched3[15]; + + /* -- End of Schedule 3 -- */ + + + + L[21] = L[19] + L[20]; + showline( 21 ); + + L[22] = NotLessThanZero( L[18] - L[21] ); + showline( 22 ); + + L[23] = Sched2[21]; /* Also set above. */ + showline( 23 ); + + L[24] = L[22] + L[23]; + showline_wmsg( 24, "Total Tax" ); + + Report_bracket_info( L[15], L[24], status ); + + showline_wlabelnz( "L25a", L25a ); + showline_wlabelnz( "L25b", L25b ); + showline_wlabelnz( "L25c", L25c ); + showline_wlabelnz( "L25d", L[25] ); + showline( 26 ); + showline_wlabelnz( "L27a", L[27] ); + showline_wlabelnz( "L27b", ntcpe ); + showline_wlabelnz( "L27c", pyei ); + showline( 28 ); + showline( 29 ); + showline( 30 ); + showline( 31 ); + for (j=27; j<=31; j++) + L[32] = L[32] + L[j]; + showline_wmsg( 32, "Total other payments and refundable credits" ); + L[33] = L[25] + L[26] + L[32]; + showline_wmsg( 33, "Total Payments" ); + + /* Refund or Owe sections. */ + if (L[33] > L[24]) + { /* Refund */ + L[34] = L[33] - L[24]; + fprintf(outfile,"L34 = %6.2f Amount you Overpaid!!!\n", L[34] ); + L[35] = (1.0 - L[36]/100.0) * L[34]; + fprintf(outfile,"L35a = %6.2f Amount of overpayment you want refunded to you.\n", L[35] ); + L[36] = L[34] - L[35]; + if (L[36] > 0.0) + showline_wmsg( 36, "Amount of overpayment you want applied to next year's estimated taxes." ); + } + else + { /* Tax-Due */ + L[37] = L[24] - L[33]; + fprintf(outfile,"L37 = %6.2f DUE !!!\n", L[37] ); + fprintf(outfile," (Which is %2.1f%% of your Total Federal Tax.)\n", 100.0 * L[37] / (L[16] + 1e-9) ); + } + ShowLineNonZero( 38 ); + fprintf(outfile,"------------------------------\n"); + + + fprintf(outfile,"\n{ --------- Identity-Information: --------- }\n"); + Your1stName = GetTextLineF( "Your1stName:" ); + YourLastName = GetTextLineF( "YourLastName:" ); + writeout_line = 0; + socsec = GetTextLineF( "YourSocSec#:" ); + strcpy( socsectmp, socsec ); /* Copy to buffer, since formatting could add 2-chars. */ + format_socsec( socsectmp, 0 ); + fprintf(outfile,"YourSocSec#: %s\n", socsectmp ); + free( socsec ); + writeout_line = 1; + Spouse1stName = GetTextLineF( "Spouse1stName:" ); + SpouseLastName = GetTextLineF( "SpouseLastName:" ); + writeout_line = 0; + socsec = GetTextLineF( "SpouseSocSec#:" ); + strcpy( socsectmp, socsec ); /* Copy to buffer, since formatting could add 2-chars. */ + format_socsec( socsectmp, 0 ); + fprintf(outfile,"SpouseSocSec#: %s\n", socsectmp ); + free( socsec ); + writeout_line = 1; + if (strlen( YourLastName ) > 0) + { + if (strcmp( YourLastName, SpouseLastName ) == 0) + fprintf(outfile,"YourNames: %s & %s, %s\n", Your1stName, Spouse1stName, YourLastName ); + else + if (strlen( SpouseLastName ) > 0) + fprintf(outfile,"YourNames: %s %s & %s %s\n", Your1stName, YourLastName, Spouse1stName, SpouseLastName ); + else + fprintf(outfile,"YourNames: %s %s\n", Your1stName, YourLastName ); + } + GetTextLineF( "Number&Street:" ); + GetTextLineF( "Apt#:" ); + + // GetTextLineF( "TownStateZip:" ); + GetTextLineF( "Town/City:" ); + GetTextLineF( "State:" ); + GetTextLineF( "ZipCode:" ); + + GetTextLineF( "YourOccupat:" ); + GetTextLineF( "SpouseOccupat:" ); + + get_word(infile, labelx ); /* Look for optional Dependent fields. */ + while (!feof(infile)) + { /*OptionalLine*/ + read_comment_filtered_line( infile, word, 512 ); + // printf("\nLine '%s' = '%s'\n", labelx, word ); + if (word[0] != '\0') + { /*valid_entry*/ + if (strncmp( labelx,"Dep", 3 ) == 0) + { + if (strstr( labelx,"SocSec" ) != 0) + format_socsec( word, 1 ); + fprintf(outfile, "%s \"%s\"\n", labelx, word ); + } + else + if (strncmp( labelx,"CkDep", 5 ) == 0) + { + if (toupper(word[0]) == 'Y') + fprintf(outfile, "%s X\n", labelx ); + } + } /*valid_entry*/ + get_word(infile, labelx ); + } /*OptionalLine*/ + + fclose(infile); + Grab_ScheduleB_Payer_Lines( infname, outfile ); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + + printf("\nListing results from file: %s\n\n", outfname); + Display_File( outfname ); + + if (adjerrcnt != 0 ) Display_adj_code_err(); + + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/convert_results2xfdf.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/convert_results2xfdf.c new file mode 100755 index 0000000..11586d2 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/convert_results2xfdf.c @@ -0,0 +1,338 @@ +/************************************************************************* + convert_results2xfdf.c - This program reads an OTS result output file, + along with a cross-reference file, and produces the corresponding "xfdf" + file. This can then be fed to a PDFTK tool, along with the corresponding + government supplied PDF fill-in form file. The PDFTK tool then fills + out the fields of the PDF file with the OTS result data. + + The cross-reference file pairs the line-labels in the OTS result file + with their corresponding field-names in the government supplied PDF + fill-in form file. The "xfdf" file needs these field names. + + Compile: + cc -O convert_results2xfdf.c -o convert_results2xfdf + + Usage: + convert_results2xfdf xref.data result_out.txt + (It then produces "result_out.xfdf".) + + This program implements a method to use XFDF that was originally + developed and provided by Daniel Walker. Therefore, major credit + goes to Daniel. ( dwalker at fifo99.com ) + + GNU Public License - GPL: + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. + + Author: Skeet Moncur (the elder) Email: skeeter_mon at yahoo.com + Date: Feb 9, 2022 +**************************************************************************/ +#include +#include +#include + +#define MAXLN 10000 + +float version=0.02; + +enum form_flags { DOLLAR_AND_CENTS, DOLLAR_AND_CENTS_ONE, DOLLAR_ONLY, + USE_KEY_IN_FORM, IF_SET, FOUR_DIGITS, KEY_VALUE }; + +struct xref_rec + { + char *linelabel, *fieldname, *centsfield; + enum form_flags format; + struct xref_rec *nxt; + } *xref_list=0; + +int verbose=0; + + +void add_xref( char *linelabel, char *format, char *fieldname, char *centsfield, int linenum ) +{ + struct xref_rec *new; + new = (struct xref_rec *)calloc( 1, sizeof( struct xref_rec ) ); + new->linelabel = strdup( linelabel ); + new->fieldname = strdup( fieldname ); + new->centsfield = strdup( centsfield ); + if (verbose) + printf(" AddingXref( '%s', '%s', '%s', '%s', %d )\n", + linelabel, format, fieldname, centsfield, linenum ); + if (strcmp( format, "DOLLAR_AND_CENTS" ) == 0) + new->format = DOLLAR_AND_CENTS; + else + if (strcmp( format, "DOLLAR_AND_CENTS_ONE" ) == 0) + new->format = DOLLAR_AND_CENTS_ONE; + else + if (strcmp( format, "DOLLAR_ONLY" ) == 0) + new->format = DOLLAR_ONLY; + else + if (strcmp( format, "USE_KEY_IN_FORM" ) == 0) + new->format = USE_KEY_IN_FORM; + else + if (strcmp( format, "IF_SET" ) == 0) + new->format = IF_SET; + else + if (strcmp( format, "FOUR_DIGITS" ) == 0) + new->format = FOUR_DIGITS; + else + if (strcmp( format, "KEY_VALUE" ) == 0) + new->format = KEY_VALUE; + else + { + printf("Error: Unknown XFDF format '%s' for label '%s' on line %d\n", + format, linelabel, linenum ); + exit(1); + } + new->nxt = xref_list; + xref_list = new; +} + + +int m_round( double x ) +{ + if (x >= 0.0) return (int)(x + 0.5); + else return (int)(x - 0.5); +} + + +void set_xfdf( FILE *outfile, char *label, char *value ) +{ + double x; + struct xref_rec *xref_item; + + if (verbose) printf(" SetXFDF( '%s', '%s' )\n",label, value ); + xref_item = xref_list; + while ((xref_item != 0) && (strcmp( xref_item->linelabel, label ) != 0)) + xref_item = xref_item->nxt; + if (xref_item == 0) return; + else + { + switch (xref_item->format) + { + case DOLLAR_ONLY: + fprintf(outfile, "\t\n", xref_item->fieldname ); + if (sscanf( value, "%lf", &x ) != 1) + { + printf("Error: Value on line %s is not numeric (%s)\n", label, value ); + exit(1); + } + fprintf(outfile, "\t %d\n", m_round( x ) ); + fprintf(outfile,"\t\n"); + break; + + case DOLLAR_AND_CENTS: + fprintf(outfile, "\t\n", xref_item->fieldname ); + if (sscanf( value, "%lf", &x ) != 1) + { + printf("Error: Value on line %s is not numeric (%s)\n", label, value ); + exit(1); + } + fprintf(outfile, "\t %d\n", (int)x ); + fprintf(outfile, "\t\n"); + fprintf(outfile, "\t\n", xref_item->centsfield ); + fprintf(outfile, "\t %d\n", abs( (int)(100.0 * (x - (int)x)) ) ); + fprintf(outfile, "\t\n"); + break; + + case DOLLAR_AND_CENTS_ONE: + fprintf(outfile, "\t\n", xref_item->fieldname ); + fprintf(outfile, "\t %s\n", value ); + fprintf(outfile, "\t\n"); + break; + + case FOUR_DIGITS: + fprintf(outfile, "\t\n", xref_item->fieldname ); + if (sscanf( value, "%lf", &x ) != 1) + { + printf("Error: Value on line %s is not numeric (%s)\n", label, value ); + exit(1); + } + fprintf(outfile, "\t %4.f\n", 10000.0 * x ); + fprintf(outfile, "\t\n"); + break; + + case USE_KEY_IN_FORM: /* Base on line lable. */ + fprintf(outfile, "\t\n", xref_item->fieldname ); + fprintf(outfile, "\t %s\n", xref_item->centsfield ); + fprintf(outfile, "\t\n"); + break; + + case IF_SET: /* Base on line value. */ + if (value[0] == xref_item->centsfield[0]) + { + fprintf(outfile, "\t\n", xref_item->fieldname ); + fprintf(outfile, "\t %s\n", xref_item->centsfield ); + fprintf(outfile, "\t\n"); + } + break; + + case KEY_VALUE: /* Not used. */ + fprintf(outfile, "\t\n", xref_item->fieldname ); + fprintf(outfile, "\t %s\n", xref_item->centsfield ); + fprintf(outfile, "\t\n"); + break; + } + } +} + + +void next_word( char *line, char *word, char *delim ) +{ + int k=0, j=0, m=0, flag=1; + while ((line[k] != '\0') && (line[k] != '"') && (flag)) /* Consume any leading delimiters */ + { + j = 0; + while ((delim[j] != '\0') && (line[k] != delim[j])) j = j + 1; + if (line[k] != delim[j]) flag = 0; else { k++; } + } + if (line[k] == '"') + { /*quoted*/ + k++; + while ((line[k] != '\0') && (line[k] != '"')) + word[m++] = line[k++]; /* Copy chars until next quote. */ + if (line[k] == '\0') printf("Warning: Missing end-quote\n"); + else k++; + } /*quoted*/ + else + { /*normal*/ + while ((line[k] != '\0') && (!flag)) /* Copy chars until next delimiter. */ + { + word[m++] = line[k++]; + if (line[k] != '\0') + { + j = 0; + while ((delim[j] != '\0') && (line[k] != delim[j])) j = j + 1; + if (line[k] == delim[j]) flag = 1; + } + } + } /*normal*/ + j = 0; /* Shorten line. */ + while (line[k] != '\0') line[j++] = line[k++]; + line[j] = '\0'; /* Terminate the char-strings. */ + word[m] = '\0'; +} + + +void show_help() +{ + printf("\nConvert_Results2Xfdf Version %g\n", version ); + printf(" This program reads an OTS result output file,\n"); + printf(" along with a cross-reference file, and produces the corresponding 'xfdf'\n"); + printf(" file. This can then be fed to a PDFTK tool, along with the corresponding\n"); + printf(" government supplied PDF fill-in form file. The PDFTK tool then fills\n"); + printf(" out the fields of the PDF file with the OTS result data.\n"); + printf("\n"); + printf(" The cross-reference file pairs the line-labels in the OTS result file\n"); + printf(" with their corresponding field-names in the government supplied PDF\n"); + printf(" fill-in form file. The 'xfdf' file needs these field names.\n"); + printf("\n"); + printf(" Usage:\n"); + printf(" convert_results2xfdf xref.data result_out.txt\n"); + printf(" (It then produces 'result_out.xfdf'.)\n"); + exit(0); +} + + +/* ----------------------------------------------------------- */ +int main( int argc, char *argv[] ) +{ + char *fname[2]={0,0}, line[MAXLN], word[MAXLN], label[MAXLN], outfname[MAXLN], + format[MAXLN], fieldname[MAXLN], centsfieldname[MAXLN], value[MAXLN]; + FILE *infile, *outfile; + int k=1, m=0, linenum=0; + + while (k < argc) + { + if (strcmp( argv[k], "-verbose" ) == 0) + verbose = 1; + else + if (strcmp( argv[k], "-help" ) == 0) + show_help(); + else + if (m < 2) + fname[m++] = strdup( argv[k] ); + else + { + printf("Error: Too many file names on command line.\n"); + exit(1); + } + k++; + } + if (m < 2) { printf("Missing file on command line.\n"); exit(1); } + + /* First read the xref file. */ + infile = fopen( fname[0], "r" ); + if (infile == 0) { printf("Could not open '%s'.\n", fname[0] ); exit(1); } + fscanf(infile, "%s", word ); + if (strcmp( word, "XFDF_CrossRef:" ) != 0) + { + printf("Error: First file does not look like a Cross-Ref file. Missing magic header word.\n"); + exit(1); + } + fgets( line, MAXLN, infile ); linenum++; + while (!feof(infile)) + { + next_word( line, label, " \t\n\r," ); + if (label[0] != '\0') + { + next_word( line, format, " \t\n\r," ); + next_word( line, fieldname, " \t\n\r," ); + next_word( line, centsfieldname, " \t\n\r," ); + add_xref( label, format, fieldname, centsfieldname, linenum ); + } + fgets( line, MAXLN, infile ); linenum++; + } + fclose( infile ); + + /* Now read in the results file, and write out the XFDF file. */ + infile = fopen( fname[1], "r" ); + if (infile == 0) { printf("Could not open '%s'.\n", fname[1] ); exit(1); } + linenum = 0; + + strcpy( outfname, fname[1] ); + k = strlen( outfname ) - 1; + while ((k >= 0) && (outfname[k] != '.')) k--; + if (k >= 0) outfname[k] = '\0'; + strcat( outfname, ".xfdf" ); + printf(" Writing: %s\n", outfname ); + outfile = fopen( outfname, "w" ); + fprintf(outfile, "\n"); + fprintf(outfile, "\n"); + fprintf(outfile, " \n"); + + fgets( line, MAXLN, infile ); linenum++; + while (!feof(infile)) + { + next_word( line, label, " \t\n\r=" ); + if (label[0] != '\0') + { + next_word( line, value, " \t\n\r=" ); + if (strcmp( label, "Status" ) != 0) + set_xfdf( outfile, label, value ); + else + { + set_xfdf( outfile, value, label ); + } + } + fgets( line, MAXLN, infile ); linenum++; + } + fclose( infile ); + + fprintf(outfile, " \n"); + fprintf(outfile, "");; + fclose( outfile ); + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/AZ_140_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/AZ_140_meta.dat new file mode 100755 index 0000000..674f7d0 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/AZ_140_meta.dat @@ -0,0 +1,259 @@ +Page 1 + + TxtColor: 0 0 0.6 + + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + round_to_whole_numbers + + Your1stName: 85 141 + YourLastName: 448 141 + YourSocSec#: 784 141 + Spouse1stName:85 178 + SpouseLastName: 448 178 + SpouseSocSec#: 784 178 + Number&Street: 85 215 + Apt#: 535 215 + DaytimePhone#: 689 215 + Town/City: 85 252 + State: 332 252 + ZipCode: 478 252 + PriorLastNames: 613 252 + + L4Chk 114 272 + L4a_InjuredSpouseChk 307 272 + L5Chk 114 290 + L6Chk 114 326 + L7Chk 114 346 + + L8 113 381 + L9 113 401 + L10a 113 418 + L10b 369 418 + L11a 113 438 + + L10_NeedMoreSpaceChk 645 455 + Dep1_FirstName: 107 536 + Dep1_LastName: 242 536 + Dep1_SocSec#: 410 536 + Dep1_Relation: 528 536 + + Dep2_FirstName: 107 554 + Dep2_LastName: 242 554 + Dep2_SocSec#: 410 554 + Dep2_Relation: 528 554 + + Dep3_FirstName: 107 571 + Dep3_LastName: 242 571 + Dep3_SocSec#: 410 571 + Dep3_Relation: 528 571 + + L11_NeedMoreSpaceChk 656 594 + L11b_PG1_FirstName: 109 666 + L11b_PG1_LastName: 242 666 + L11b_PG1_SocSec#: 407 666 + L11b_PG1_Relation: 528 666 + L11b_PG1_Months: 639 666 + L11c_PG2_FirstName: 109 684 + L11c_PG2_LastName: 242 684 + L11c_PG2_SocSec#: 407 684 + L11c_PG2_Relation: 528 684 + L11c_PG2_Months: 639 684 + + L12 761 703 10 + L13_Filing140SBIChk 247 724 + L13 761 723 10 + L14 761 741 10 + L15 761 760 10 + L16 761 777 10 + L17 761 795 10 + L18 761 812 10 + L19 761 830 10 + L20 629 850 10 + L21 629 869 10 + L22 629 888 10 + L23 629 905 10 + L24 761 923 10 + L25 761 941 10 + L26 761 960 10 + L27 761 978 10 + L28 761 997 10 + L29a 761 1016 10 + L29b 761 1035 10 + L30 761 1053 10 + L31 761 1071 10 + L32 761 1090 10 + L33 761 1108 10 + L34a 325 1127 10 + L34b 540 1127 10 + L34 761 1126 10 + L35 761 1145 10 + + +Page 2 + + TxtColor: 0 0 0.6 + + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + round_to_whole_numbers + + YourName: 77 86 + YourSocSec#: 624 86 + L36 764 106 10 + L37 764 124 10 + L38 764 143 10 + L39 764 162 10 + L40e 351 181 + L40 764 181 10 + L41 764 198 10 + L42 764 216 10 + L43_DeductionsItemizedChk 535 236 + L43_DeductionsStandardChk 639 236 + L43 764 234 10 + L44_CharitableChk 475 254 + L44 764 254 10 + L45 764 272 10 + L46 764 289 10 + L47 764 309 10 + L48 764 327 10 + L49 764 344 10 + L50 764 363 10 + L51 764 382 10 + L52 764 399 10 + L53 764 418 10 + L54a 309 436 10 + L54b 534 436 10 + L54 764 436 10 + L55 764 454 10 + L56 764 473 10 + L57 764 492 10 + L58_Filing308IChk 549 511 + L58_Filing334Chk 621 511 + L58_Filing349Chk 684 511 + L58 764 509 10 + L59 764 530 10 + L60 764 547 10 + L61 764 566 10 + L62 764 585 10 + L63 764 602 10 + L64 460 622 5 + L65 659 622 5 + L66 251 640 5 + L67 460 640 5 + L68 659 640 5 + L69 251 658 5 + L70 460 658 5 + L71 659 658 5 + L72 251 676 5 + L73 460 676 5 + L74 659 676 5 + L75_DemocraticChk 435 697 + L75_LibertarianChk 541 697 + L75_RepublicanChk 645 697 + L76 764 714 10 + L77_1AnnualizedOtherChk 119 734 + L77_2FarmerFishermanChk 242 734 + L77_Filing221Chk 385 734 + L78 764 751 10 + L79 764 775 10 + L79_ForeignAcctChk 709 783 + L80 764 848 10 + + +Optional_Page 3 + TxtColor: 0 0 0.6 + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + round_to_whole_numbers + + YourName: 74 86 + YourSocSec#: 622 86 + + SD1C 712 611 10 + SD2C 712 637 10 + SD3C 712 664 10 + SD4C 712 690 10 + SD5C 712 719 10 + SD6C 712 754 10 + SD7C 712 782 10 + + +Optional_Page 4 + TxtColor: 0 0 0.6 + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + round_to_whole_numbers + + YourName: 74 86 + YourSocSec#: 622 86 + + +Optional_Page 5 + TxtColor: 0 0 0.6 + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + round_to_whole_numbers + + YourName: 74 73 + YourSocSec#: 622 73 + + OA_A 757 236 10 + OA_B 757 260 10 + OA_C 757 284 10 + OA_D 757 310 10 + OA_E 757 338 10 + OA_Fa 757 363 10 + OA_Fb 757 388 10 + OA_Ga 757 422 10 + OA_Gb 757 454 10 + OA_Ha 757 502 10 + OA_Hb 757 549 10 + OA_Hc 757 596 10 + OA_I 757 621 10 + OA_J 757 685 10 + OA_K 757 710 10 + OA_L 757 744 10 + OA_M 757 769 10 + OA_N 757 796 10 + OA_O 757 828 10 + OA_P 757 854 10 + OA_Q 757 878 10 + OA_R 757 905 10 + OA_S 757 930 10 + OA_T 757 956 10 + + +Optional_Page 6 + TxtColor: 0 0 0.6 + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + round_to_whole_numbers + + YourName: 74 73 + YourSocSec#: 622 73 + + OS_A 733 271 10 + OS_B 733 297 10 + OS_C 733 325 10 + OS_D 733 351 10 + OS_E 733 377 10 + OS_F 733 404 10 + OS_G 733 430 10 + OS_H 733 455 10 + OS_I 733 481 10 + OS_J 733 506 10 + OS_K 733 533 10 + OS_L 733 593 10 + OS_M 733 620 10 + OS_N 733 646 10 + OS_O 733 672 10 + OS_P 733 762 10 + OS_Q 733 824 10 + OS_R 733 857 10 + OS_S 733 888 10 + OS_T 733 913 10 + OS_U 733 939 10 + OS_V 733 965 10 + OS_W 733 996 10 + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/AZ_140_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/AZ_140_pdf.dat new file mode 100755 index 0000000..70cc6a9 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/AZ_140_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/CA_540_instructions.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/CA_540_instructions.dat new file mode 100755 index 0000000..d1795af --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/CA_540_instructions.dat @@ -0,0 +1,157 @@ +Instructions: + +[L12] State Wages + +Enter your state wages from all states from each of your Federal +Form(s) W-2, Wage and Tax Statement. This amount appears on +Form W-2, box 16. + +If you received wages and do not have a Form W-2, see "Attachments to +your tax return. + +[L34] Tax from Schedule G-1 and Form FTB 5870A + +If you received a qualified lump-sum distribution in 2020 and you +were born before January 2, 1936, get California Schedule G-1, Tax on +Lump-Sum Distributions, to figure your tax by special methods that may +result in less tax. Attach Schedule G-1 to your tax return. + +If you received accumulation distributions from foreign trusts or from +certain domestic trusts, get form FTB 5870A, Tax on Accumulation +Distribution of Trusts, to figure the additional tax. Attach form +FTB 5870A to your tax return. + +[L40] Nonrefundable Child and Dependent Care Expenses Credit + +Claim this credit if you paid someone to care for your qualifying child +under the age of 13, other dependent who is physically or mentally +incapable of caring for him or herself, or spouse/RDP if physically +or mentally incapable of caring for him or herself. The care must be +provided in California. To claim this credit, your federal AGI must be +$100,000 or less and you must complete and attach form FTB 3506, +Child and Dependent Care Expenses Credit, included in the booklet. + +[L71] California Income Tax Withheld + +Enter the total California income tax withheld from your federal Forms: +# # W-2, Wage and Tax Statement, box 17 +# # W-2G, Certain Gambling Winnings, box 15 +# # 1099-DIV, Dividends and Distributions, box 15 +# # 1099-INT, Interest Income, box 17 +# # 1099-MISC, Miscellaneous Income, box 16 +# # 1099-OID, Original Issue Discount, box 14 +# # 1099-R, Distributions from Pensions, Annuities, Retirement, or Profit + Sharing Plans, IRAs, Insurance Contracts, etc., box 12 + +Do not include city, local, or county tax withheld, tax withheld by +other states, or nonconsenting nonresident (NCNR) member's tax +from Schedule K-1 (568), line 15e. Do not include withholding from +Forms 592-B, Resident and Nonresident Withholding Tax Statement, or +Form 593, Real Estate Withholding Tax Statement, on this line. For more +details, see instructions for line 73. + +Generally, tax should not be withheld on federal Form 1099-MISC. If you +want to pre-pay tax on income reported on federal Form 1099-MISC, use +Form 540-ES, Estimated Tax for Individuals. + +[L72] 2020 CA Estimated Tax and Other Payments + +Enter the total of any: +# # California estimated tax payments you made using 2020 + Form 540-ES, electronic funds withdrawal, Web Pay, or credit card. +# # Overpayment from your 2018 California income tax return that you + applied to your 2020 estimated tax. +# # Payment you sent with form FTB 3519, Payment for Automatic + Extension for Individuals. +# # California estimated tax payments made on your behalf by + an estate, trust, or S corporation on Schedule K-1 (541) or + Schedule K-1 (100S). + +[L91] Use Tax. + +You are required to enter a number on this line. If the amount due is +zero, you must check the applicable box to indicate that you either owe +no use tax, or you paid your use tax obligation directly to the California +Department of Tax and Fee Administration. + +You may owe use tax if you make purchases from out-of-state retailers +(for example, purchases made by telephone, online, by mail, or in +person) where California sales or use tax was not paid and you use +those items in California. + +[L112] Interest and Penalties + +Interest. Interest will be charged on any late filing or late payment +penalty from the original due date of the return to the date paid. In +addition, if other penalties are not paid within 15 days, interest will be +charged from the date of the billing notice until the date of payment. +Interest compounds daily and the interest rate is adjusted twice a year. +The FTB website has a chart of interest rates in effect since 1976. Go to +ftb.ca.gov and search for interest rates. + +Late Filing of Tax Return. If you do not file your tax return by +October 15, 2020, you will incur a late filing penalty plus interest from +the original due date of the tax return. The maximum total penalty is +25% of the tax not paid if the tax return is filed after October 15, 2020. +The minimum penalty for filing a tax return more than 60 days late is +$135 or 100% of the balance due, whichever is less. + +Late Payment of Tax. If you fail to pay your total tax liability by +April 15, 2020, you will incur a late payment penalty plus interest. The +penalty is 5% of the tax not paid when due plus 1/2% for each month, or +part of a month, the tax remains unpaid. We may waive the late payment +penalty based on reasonable cause. Reasonable cause is presumed +when 90% of the tax shown on the return is paid by the original due +date of the return. However, the imposition of interest is mandatory. If, +after April 15, 2020, you find that your estimate of tax due was too low, +pay the additional tax as soon as possible to avoid or minimize further +accumulation of penalties and interest. + +Late Payment of Use Tax. To avoid late payment penalties for use +tax, you must report and pay the use tax with a timely filed income tax +return, or California Individual Use Tax return. +Other Penalties. We may impose other penalties if a payment is +returned for insufficient funds. We may also impose penalties for +negligence, substantial understatement of tax, and fraud. + +[L113] Underpayment of Estimated Tax + +You may be subject to an estimated tax penalty if any of the following is true: + +# # Your withholding and credits are less than 90% of your current tax + year liability. + +# # Your withholding and credits are less than 100% of your prior + year tax liability (110% if AGI is more than $150,000 or $75,000 if + married/RDP filing separately). + +# # You did not pay enough through withholding to keep the amount + you owe with your tax return under $500 ($250 if married/RDP filing + separately). + +# # You did not make the required estimate payments, if you pay an + installment after the date it is due, or if you underpay any installment, + a penalty may be assessed on the portion of estimated tax that was + underpaid from the due date of the installment to the date of payment + or the due date of your return, whichever is earlier. Get the 2020 + form FTB 5805, Underpayment of Estimated Tax by Individuals and + Fiduciaries, for more information. + +The FTB can figure the penalty for you when you file your tax return and +send you a bill. + +Is line 97 less than $500 ($250 if married/RDP filing separately)? + +Yes Stop. You may not be subject to an estimated payment penalty. + +No Continue. You may be subject to an estimated payment penalty. + +Is line 97 less than 10% of the amount on line 48? Form 540 filers: this +excludes the tax on lump-sum distributions on Form 540, line 34. + +Yes Stop. You may not be subject to an estimated payment penalty. + +No You may be subject to an estimated payment penalty; get form +FTB 5805, Underpayment of Estimated Tax by Individuals and +Fiduciaries (or form FTB 5805F, Underpayment of Estimated Tax by +Farmers and Fishermen). diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/CA_540_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/CA_540_meta.dat new file mode 100755 index 0000000..2066337 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/CA_540_meta.dat @@ -0,0 +1,529 @@ +Page 1 + + TxtColor: 0 0 0.6 + + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + + round_to_whole_numbers + no_zero_entries + +Your1stName: 60 184 +YourMidInit: 284 184 +YourLastName: 316 184 +YourSocSec#: 663 184 0 11 + +Spouse1stName: 60 228 +SpouseMidInit: 284 228 +SpouseLastName: 316 228 +SpouseSocSec#: 663 228 0 11 + +Number&Street: 60 313 +Apt#: 598 313 +Town: 60 357 +State: 615 357 +ZipCode: 665 357 0 11 + +YourDOB: 109 473 0 5.6 +SpouseDOB: 497 473 0 5.6 + +CountyName: 111 582 + +FontSz 18 + CkSameAddress: 766 604 + CkSingle: 118 806 + CkMFJ: 118 843 + CkMFS: 118 916 + CkHH: 382 806 + CkQW: 382 843 + CkDep: 710 953 +FontSz 10 + +L7a 585 1022 +L7 770 1024 +L8a 585 1058 +L8 770 1060 +L9a 585 1096 +L9 770 1098 + + +Page 2 + + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + +YourName: 145 88 +YourSocSec#: 475 88 + +L10Dep1FrstName: 210 162 +L10Dep1LastName: 210 200 +L10Dep1SSN: 210 236 +L10Dep1Relation: 210 272 + +L10Dep2FrstName: 444 162 +L10Dep2LastName: 444 200 +L10Dep2SSN: 444 236 +L10Dep2Relation: 444 272 + +L10Dep3FrstName: 674 162 +L10Dep3LastName: 674 200 +L10Dep3SSN: 674 236 +L10Dep3Relation: 674 272 + +L10a 550 308 +L10 706 310 14 +L11 706 346 14 +L12 470 401 14 +L13 715 438 14 +L14 715 475 14 +L15 715 511 14 +L16 715 549 14 +L17 715 585 14 +L18 715 694 14 + +showevenifzero L19 +L19 715 731 14 + +FontSz 18 + CkTxTable: 281 788 + CkTxRateSchd: 412 788 + CkFTB3800: 281 824 + CkFTB3803: 412 824 +FontSz 10 + +L31 715 823 14 +L32 715 861 14 + +showevenifzero L33 +L33 715 897 14 + +L34 715 933 14 +L35 715 970 14 +L40 715 1026 14 +L43 715 1062 14 +L44 715 1100 14 + + +Page 3 + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + +YourName: 145 88 +YourSocSec#: 474 88 + +L45 715 127 14 +L46 715 164 14 +L47 715 200 14 +showevenifzero L48 +L48 715 236 14 + +L61 715 291 14 +L62 715 329 14 +L63 715 365 14 +L64 715 401 14 + +L71 715 457 14 +L72 715 494 14 +L73 715 531 14 +L74 715 566 14 +L75 715 603 14 +L76 715 640 14 +L77 715 678 14 +L78 715 714 14 +showevenifzero L91 +L91 612 769 14 +FontSz 16 +CkNoUseTaxOwed 282 805 +CkPayedUseTaxCDTFA 460 806 +CkFYHealthCoverage 646 862 +FontSz 10 +L92 612 897 14 +L93 715 952 14 +L94 715 990 14 +L95 715 1025 14 +L96 715 1062 14 +L97 715 1099 14 + + +Page 4 + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + +YourName: 144 88 +YourSocSec#: 476 88 + +L98 715 125 14 +L99 715 161 14 +L100 715 196 14 +L400 715 254 14 +L401 715 290 14 +L403 715 326 14 +L405 715 363 14 + +L406 715 400 14 +L407 715 436 14 +L408 715 474 14 +L410 715 512 14 +L413 715 549 14 + +L110 715 914 14 + +Page 5 + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + +YourName: 144 88 +YourSocSec#: 475 88 + +L111 715 143 14 +L112 715 194 14 +L113 715 249 14 +L114 715 288 14 +L115 715 360 14 +L116 715 508 14 +L117 715 618 14 + +RouteNumL116: 119 507 +AccntNum:116: 345 507 +RouteNumL117: 119 617 +AccntNumL117: 345 617 + +FontSz 18 +CkFTB5805: 215 254 +CkFTB5805F: 380 254 +CkCheckingL116: 237 493 +CkSavingsL116: 237 530 +CkCheckingL117: 237 603 +CkSavingsL117: 237 640 + +CkHCinfoYes 761 807 +CkHCinfoNo 831 807 +FontSz 10 + + +Page 6 + +YourName: 148 86 +YourSocSec#: 476 87 + +FontSz 18 +CkDiscussYes 687 496 +CkDiscussNo 762 496 +FontSz 10 + + + +Page 7 + +YourNames: 60 158 +YourSocSec#: 710 158 + +SchedCA540_A1a 386 241 9 +SchedCA540_A1ab 555 241 9 +SchedCA540_A1ac 731 241 9 + +SchedCA540_A1b 386 274 9 +SchedCA540_A1bb 555 274 9 +SchedCA540_A1bc 731 274 9 + +SchedCA540_A1c 386 307 9 +SchedCA540_A1cb 555 307 9 +SchedCA540_A1cc 731 307 9 + +SchedCA540_A1d 386 349 9 +SchedCA540_A1db 555 349 9 +SchedCA540_A1dc 731 349 9 + +SchedCA540_A1e 386 383 9 +SchedCA540_A1eb 555 383 9 +SchedCA540_A1ec 731 383 9 + +SchedCA540_A1f 386 418 9 +SchedCA540_A1fb 555 418 9 +SchedCA540_A1fc 731 418 9 + +SchedCA540_A1g 386 458 9 +SchedCA540_A1gb 555 458 9 +SchedCA540_A1gc 731 458 9 + +SchedCA540_A1h 386 493 9 +SchedCA540_A1hb 555 493 9 +SchedCA540_A1hc 731 493 9 + +SchedCA540_A1ic 731 528 9 + +SchedCA540_A1z 386 563 9 +SchedCA540_A1zb 555 563 9 +SchedCA540_A1zc 731 563 9 + +SchedCA540_A2a 199 602 9 +SchedCA540_A2 386 602 9 +SchedCA540_A2b 555 602 9 +SchedCA540_A2c 731 602 9 +SchedCA540_A3a 199 639 9 +SchedCA540_A3 386 639 9 +SchedCA540_A3b 555 639 9 +SchedCA540_A3c 731 639 9 +SchedCA540_A4a 199 676 9 +SchedCA540_A4 386 676 9 +SchedCA540_A4b 555 676 9 +SchedCA540_A4c 731 676 9 + +SchedCA540_A5a 199 735 9 +SchedCA540_A5 386 735 9 +SchedCA540_A5b 555 735 9 +SchedCA540_A5c 731 735 9 + +SchedCA540_A6a 199 770 9 +SchedCA540_A6 386 770 9 +SchedCA540_A6b 555 770 9 + +SchedCA540_A7 386 803 9 +SchedCA540_A7b 555 803 9 +SchedCA540_A7c 731 803 9 + +SchedCA540_B1 386 860 9 +SchedCA540_B1b 555 860 9 +SchedCA540_B2 386 900 9 +SchedCA540_B2c 731 900 9 +SchedCA540_B3 386 934 9 +SchedCA540_B3b 555 934 9 +SchedCA540_B3c 731 934 9 +SchedCA540_B4 386 966 9 +SchedCA540_B4b 555 966 9 +SchedCA540_B4c 731 966 9 +SchedCA540_B5 386 1003 9 +SchedCA540_B5b 555 1003 9 +SchedCA540_B5c 731 1003 9 +SchedCA540_B6 386 1039 9 +SchedCA540_B6b 555 1039 9 +SchedCA540_B6c 731 1039 9 +SchedCA540_B7 386 1076 9 +SchedCA540_B7b 555 1076 9 + + +Page 8 + +SchedCA540_B8A 386 181 9 +SchedCA540_B8Ac 731 181 9 +SchedCA540_B8B 386 220 9 +SchedCA540_B8Bb 555 220 9 +SchedCA540_B8C 386 256 9 +SchedCA540_B8Cb 555 256 9 +SchedCA540_B8Cc 731 256 9 +SchedCA540_B8D 386 294 9 +SchedCA540_B8Dc 731 294 9 +SchedCA540_B8E 386 330 9 +SchedCA540_B8Ec 731 330 9 +SchedCA540_B8F 386 365 9 +SchedCA540_B8Fb 555 365 9 +SchedCA540_B8G 386 400 9 +SchedCA540_B8H 386 438 9 + +SchedCA540_B8I 386 472 9 +SchedCA540_B8J 386 506 9 +SchedCA540_B8K 386 540 9 +SchedCA540_B8Kc 731 540 9 +SchedCA540_B8L 386 600 9 +SchedCA540_B8M 386 636 9 +SchedCA540_B8N 386 672 9 +SchedCA540_B8Nb 555 672 9 +SchedCA540_B8O 386 707 9 +SchedCA540_B8Ob 555 707 9 +SchedCA540_B8P 386 746 9 +SchedCA540_B8Pb 555 746 9 +SchedCA540_B8Pc 731 746 9 + +SchedCA540_B8Q 386 783 9 +SchedCA540_B8R 386 818 9 +SchedCA540_B8S 386 860 9 +SchedCA540_B8T 386 910 9 +SchedCA540_B8U 386 945 9 + +SchedCA540_B8V 386 986 9 +SchedCA540_B8Vb 555 986 9 +SchedCA540_B8Vc 731 986 9 + +SchedCA540_B8Za: 130 1041 9 +SchedCA540_B8Z 386 1041 9 +SchedCA540_B8Zb 555 1041 9 +SchedCA540_B8Zc 731 1041 9 + + +Page 9 + +SchedCA540_B9A 386 181 9 +SchedCA540_B9Ab 555 181 9 +SchedCA540_B9Ac 731 181 9 + +SchedCA540_B9B1b 555 216 9 +SchedCA540_B9B2b 555 252 9 +SchedCA540_B9B3b 555 288 9 + +SchedCA540_B10 386 380 9 +SchedCA540_B10b 555 380 9 +SchedCA540_B10c 731 380 9 + +SchedCA540_C11 386 477 9 +SchedCA540_C11b 555 477 9 +SchedCA540_C12 386 512 9 +SchedCA540_C12b 555 512 9 +SchedCA540_C12c 731 512 9 +SchedCA540_C13 386 550 9 +SchedCA540_C13b 555 550 9 +SchedCA540_C14 386 585 9 +SchedCA540_C14c 731 585 9 +SchedCA540_C15 386 620 9 +SchedCA540_C15b 555 620 9 +SchedCA540_C16 386 655 9 +SchedCA540_C17 386 694 9 +SchedCA540_C17b 555 694 9 +SchedCA540_C18 386 730 9 +SchedCA540_C19 386 765 9 +SchedCA540_C19c 731 765 9 +AlimRecipSSN: 210 802 0 9 +AlimRecipName: 176 843 +SchedCA540_C20 386 880 9 +SchedCA540_C20b 555 880 9 +SchedCA540_C20c 731 880 9 +SchedCA540_C21 386 915 9 +SchedCA540_C21c 731 915 9 +SchedCA540_C23 386 990 9 + + +Page 10 + +SchedCA540_C24A 400 180 9 +SchedCA540_C24B 400 232 9 +SchedCA540_C24Bb 565 232 9 +SchedCA540_C24Bc 731 232 9 +SchedCA540_C24C 400 289 9 +SchedCA540_C24Cb 565 289 9 +SchedCA540_C24D 400 325 9 +SchedCA540_C24Db 565 325 9 +SchedCA540_C24E 400 364 9 + +SchedCA540_C24F 400 400 9 +SchedCA540_C24Fb 565 400 9 +SchedCA540_C24Fc 731 400 9 + +SchedCA540_C24G 400 437 9 +SchedCA540_C24Gb 565 437 9 +SchedCA540_C24Gc 731 437 9 + +SchedCA540_C24H 400 472 9 + +SchedCA540_C24I 400 526 9 +SchedCA540_C24Ib 565 526 9 +SchedCA540_C24J 400 565 9 +SchedCA540_C24Jb 565 565 9 +SchedCA540_C24K 400 601 9 +SchedCA540_C24Kb 565 601 9 + +SchedCA540_C24Z 400 654 9 +SchedCA540_C24Zb 565 654 9 +SchedCA540_C24Zc 731 654 9 +SchedCA540_C24Ztype: 98 653 + +SchedCA540_C25 400 691 9 +SchedCA540_C25b 565 691 9 +SchedCA540_C25c 731 691 9 + +SchedCA540_C26 400 728 9 +SchedCA540_C26b 565 728 9 +SchedCA540_C26c 731 728 9 + +SchedCA540_C27 400 764 9 +SchedCA540_C27b 565 764 9 +SchedCA540_C27c 731 764 9 + + +Page 11 + +FontSz 18 +CkItemizeCA: 556 164 +FontSz 10 + +SchedCA540_Part2_1 225 275 9 +SchedCA540_Part2_2 225 331 9 +SchedCA540_Part2_3 225 368 9 +showevenifzero SchedCA540_Part2_4a +SchedCA540_Part2_4a 407 403 9 +SchedCA540_Part2_4c 736 403 9 +SchedCA540_Part2_5aa 407 444 9 +SchedCA540_Part2_5ab 572 444 9 +SchedCA540_Part2_5ba 407 479 9 +SchedCA540_Part2_5ca 407 518 9 +SchedCA540_Part2_5da 407 554 9 +SchedCA540_Part2_5ea 407 662 9 +SchedCA540_Part2_5eb 572 662 9 +SchedCA540_Part2_5ec 736 662 9 +SchedCA540_Part2_6type: 219 695 +SchedCA540_Part2_6a 407 700 9 +SchedCA540_Part2_6b 572 700 9 +SchedCA540_Part2_6c 736 700 9 +SchedCA540_Part2_7a 407 736 9 +SchedCA540_Part2_7b 572 736 9 +SchedCA540_Part2_7c 736 736 9 + +SchedCA540_Part2_8aa 407 790 9 +SchedCA540_Part2_8ac 736 790 9 +SchedCA540_Part2_8ba 407 827 9 +SchedCA540_Part2_8bc 736 827 9 +SchedCA540_Part2_8ca 407 864 9 +SchedCA540_Part2_8cc 736 864 9 + +! SchedCA540_Part2_8da 407 900 9 +! SchedCA540_Part2_8db 572 900 9 + +SchedCA540_Part2_8ea 407 937 9 +SchedCA540_Part2_8eb 572 937 9 +SchedCA540_Part2_8ec 736 937 9 +SchedCA540_Part2_9a 407 974 9 +SchedCA540_Part2_9b 572 974 9 +SchedCA540_Part2_9c 736 974 9 +SchedCA540_Part2_10a 407 1010 9 +SchedCA540_Part2_10b 572 1010 9 +SchedCA540_Part2_10c 736 1010 9 + + +Page 12 + +SchedCA540_Part2_11a 406 188 9 +SchedCA540_Part2_11b 572 188 9 +SchedCA540_Part2_11c 736 188 9 +SchedCA540_Part2_12a 406 224 9 +SchedCA540_Part2_12b 572 224 9 +SchedCA540_Part2_12c 736 224 9 +SchedCA540_Part2_13a 406 260 9 +SchedCA540_Part2_13b 572 260 9 +SchedCA540_Part2_13c 736 260 9 +SchedCA540_Part2_14a 406 300 9 +SchedCA540_Part2_14b 572 300 9 +SchedCA540_Part2_14c 736 300 9 +SchedCA540_Part2_15a 406 358 9 +SchedCA540_Part2_15b 572 358 9 +SchedCA540_Part2_15c 736 358 9 +SchedCA540_Part2_16a 406 405 9 +SchedCA540_Part2_16b 572 405 9 +SchedCA540_Part2_16c 736 405 9 +SchedCA540_Part2_17a 406 445 9 +SchedCA540_Part2_17b 572 445 9 +SchedCA540_Part2_17c 736 445 9 +SchedCA540_Part2_18 738 477 9 + +SchedCA540_Part2_19 580 550 9 +SchedCA540_Part2_20 580 587 9 +SchedCA540_Part2_21type: 355 624 9 +SchedCA540_Part2_21 580 624 9 +SchedCA540_Part2_22 580 660 9 +SchedCA540_Part2_23 355 698 9 +SchedCA540_Part2_24 580 733 9 +SchedCA540_Part2_25 739 770 9 +SchedCA540_Part2_26 739 807 9 +SchedCA540_Part2_27spec: 355 844 9 +SchedCA540_Part2_27 739 844 9 +SchedCA540_Part2_28 739 881 9 +SchedCA540_Part2_29 739 1009 9 +SchedCA540_Part2_30 739 1099 9 + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/CA_540_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/CA_540_pdf.dat new file mode 100755 index 0000000..8a102f7 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/CA_540_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/CA_5805_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/CA_5805_meta.dat new file mode 100755 index 0000000..6c22a62 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/CA_5805_meta.dat @@ -0,0 +1,273 @@ +Page 1 + + TxtColor: 0 0 0.6 + + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + + round_to_whole_numbers + +YourName: 62 199 +YourSocSec#: 732 199 +CkQuest1Yes 757 583 +CkQuest1No 835 583 +CkQuest2Yes 758 694 +CkQuest2No 835 694 +CkQuest3Yes 757 748 +CkQuest3No 835 749 +CkQuest3NA 796 785 +Wthd_Per_1 173 858 18 +Wthd_Per_2 482 859 18 +Wthd_Per_3 173 895 18 +Wthd_Per_4 482 895 18 +CkQuest4Yes 757 950 +CkQuest4No 835 950 + +Page 2 + +L1 679 163 18 +L2 459 199 18 +L3 679 235 18 +L4 679 291 18 +L5 679 363 18 +L6 679 418 18 +L7 460 567 18 +L8 460 622 18 +L9 679 659 18 +L10 679 713 18 +L11 679 750 18 +L12 679 842 18 +L13 679 897 18 + +Page 3 + +SchdAI_1a 394 455 12 +SchdAI_1b 514 455 12 +SchdAI_1c 637 455 12 +SchdAI_1d 756 455 12 +!SchdAI_2a 394 491 12 +!SchdAI_2b 514 491 12 +!SchdAI_2c 637 491 12 +!SchdAI_2d 756 491 12 +SchdAI_3a 394 528 12 +SchdAI_3b 514 528 12 +SchdAI_3c 637 528 12 +SchdAI_3d 756 528 12 +SchdAI_4a 394 603 12 +SchdAI_4b 514 602 12 +SchdAI_4c 635 602 12 +SchdAI_4d 756 602 12 +!SchdAI_5a 394 638 12 +!SchdAI_5b 514 638 12 +!SchdAI_5c 635 638 12 +!SchdAI_5d 756 638 12 +SchdAI_6a 394 675 12 +SchdAI_6b 514 675 12 +SchdAI_6c 635 675 12 +SchdAI_6d 756 675 12 +SchdAI_7a 394 730 12 +SchdAI_7b 514 730 12 +SchdAI_7c 635 730 12 +SchdAI_7d 756 730 12 +SchdAI_8a 394 766 12 +SchdAI_8b 514 766 12 +SchdAI_8c 635 766 12 +SchdAI_8d 756 766 12 +SchdAI_9a 394 803 12 +SchdAI_9b 514 803 12 +SchdAI_9c 635 803 12 +SchdAI_9d 756 803 12 +SchdAI_10a 394 878 12 +SchdAI_10b 514 878 12 +SchdAI_10c 635 878 12 +SchdAI_10d 756 878 12 +SchdAI_11a 394 932 12 +SchdAI_11b 514 932 12 +SchdAI_11c 635 932 12 +SchdAI_11d 756 932 12 +SchdAI_12a 394 969 12 +SchdAI_12b 514 969 12 +SchdAI_12c 635 969 12 +SchdAI_12d 756 969 12 +SchdAI_13a 394 1023 12 +SchdAI_13b 514 1023 12 +SchdAI_13c 635 1023 12 +SchdAI_13d 756 1023 12 + +Page 4 + +L14aa 393 217 12 +L14ab 515 217 12 +L14ac 635 217 12 +L14ad 757 217 12 +L14ba 393 253 12 +L14bb 515 253 12 +L14bc 635 253 12 +L14bd 757 253 12 +L14ca 393 290 12 +L14cb 515 290 12 +L14cc 635 290 12 +L14cd 757 290 12 + +!L14da 393 327 12 +!L14db 515 326 12 +!L14dc 636 327 12 +!L14dd 757 327 12 +!L14ea 393 363 12 +!BL14eb 515 363 12 +!L14ec 635 363 12 +!L14ed 757 363 12 +!SchdAI_15a 393 400 12 +!SchdAI_15b 515 400 12 +!SchdAI_15c 635 400 12 +!SchdAI_15d 757 400 12 + +SchdAI_16a 393 363 12 +SchdAI_16b 515 363 12 +SchdAI_16c 635 363 12 +SchdAI_16d 757 363 12 +SchdAI_17b 515 436 12 +SchdAI_17c 635 436 12 +SchdAI_17d 757 436 12 +SchdAI_18a 393 473 12 +SchdAI_18b 515 473 12 +SchdAI_18c 635 473 12 +SchdAI_18d 757 473 12 +SchdAI_19a 393 529 12 +SchdAI_19b 515 529 12 +SchdAI_19c 635 529 12 +SchdAI_19d 757 529 12 +SchdAI_20b 515 565 12 +SchdAI_20c 635 565 12 +SchdAI_20d 757 565 12 +SchdAI_21a 393 601 12 +SchdAI_21b 515 601 12 +SchdAI_21c 635 601 12 +SchdAI_21d 757 601 12 +SchdAI_22a 393 656 12 +SchdAI_22b 515 656 12 +SchdAI_22c 635 656 12 +SchdAI_22d 757 656 12 +SchdAI_23a 107 766 18 +SchdAI_23b 305 766 18 +SchdAI_23c 504 766 18 +SchdAI_23d 701 766 18 + +Page 5 + +no_round_to_whole_numbers + +WSII_1a 525 155 12 +WSII_1b 608 155 12 +WSII_1c 690 155 12 +WSII_1d 773 155 12 +WSII_2a 525 210 12 +WSII_2b 608 210 12 +WSII_2c 690 210 12 +WSII_2d 773 210 12 +WSII_3a 525 255 12 +WSII_3b 608 255 12 +WSII_3c 690 255 12 +WSII_3d 773 255 12 +WSII_4a 525 275 12 +WSII_4b 608 275 12 +WSII_4c 690 275 12 +WSII_4d 773 275 12 +WSII_5a 525 297 12 +WSII_5b 608 297 12 +WSII_5c 690 297 12 +WSII_5d 773 297 12 +WSII_6a 525 323 12 +WSII_6b 608 323 12 +WSII_6c 690 323 12 +WSII_6d 773 323 12 +WSII_7a 525 344 12 +WSII_7b 608 344 12 +WSII_7c 690 344 12 +WSII_7d 773 344 12 +WSII_8a 525 370 12 +WSII_8b 608 370 12 +WSII_8c 690 370 12 +WSII_8d 773 370 12 +WSII_9a 525 404 12 +WSII_9b 608 404 12 +WSII_9c 690 404 12 +WSII_9d 773 404 12 +WSII_10a 525 513 12 +WSII_10b 608 513 12 +WSII_11a 525 564 12 +WSII_11b 608 564 12 +WSII_12a 525 641 12 +WSII_12b 608 641 12 +WSII_12c 690 641 12 +WSII_12d 773 641 12 +WSII_13a 525 692 12 +WSII_13b 608 692 12 +WSII_13c 690 692 12 +WSII_13d 773 692 12 +WSII_14 773 735 12 +FAIWS_1a 480 1022 +FAIWS_1b 590 1022 +FAIWS_1c 700 1022 +FAIWS_1d 810 1022 +FAIWS_3a 480 1085 +FAIWS_3b 590 1085 +FAIWS_3c 700 1085 +FAIWS_3d 810 1085 + +Page 6 + +FontSz 8 + +L6WS_1a 312 102 6 +L6WS_1b 752 102 6 +L6WS_1c 312 671 6 +L6WS_1d 752 671 6 +L6WS_2a 312 158 6 +L6WS_2b 752 158 6 +L6WS_2c 312 726 6 +L6WS_2d 752 726 6 +L6WS_3a 312 177 6 +L6WS_3b 752 177 6 +L6WS_3c 312 745 6 +L6WS_3d 752 745 6 +L6WS_4a 312 204 6 +L6WS_4b 752 204 6 +L6WS_4c 312 772 6 +L6WS_4d 752 772 6 +L6WS_5a 312 231 6 +L6WS_5b 752 231 6 +L6WS_5c 312 799 6 +L6WS_5d 752 799 6 +L6WS_6a 312 305 6 +L6WS_6b 752 305 6 +L6WS_6c 312 873 6 +L6WS_6d 752 873 6 +L6WS_7a 312 333 6 +L6WS_7b 752 333 6 +L6WS_7c 312 901 6 +L6WS_7d 752 901 6 +L6WS_8a 312 377 6 +L6WS_8b 752 377 6 +L6WS_8c 312 945 6 +L6WS_8d 752 945 6 +L6WS_9a 312 422 6 +L6WS_9b 752 422 6 +L6WS_9c 312 990 6 +L6WS_9d 752 990 6 +L6WS_10a 312 437 6 +L6WS_10b 752 437 6 +L6WS_10c 312 1009 6 +L6WS_10d 752 1009 6 +L6WS_11a 312 463 6 +L6WS_11b 752 463 6 +L6WS_11c 312 1033 6 +L6WS_11d 752 1033 6 +L6WS_12a 312 493 6 +L6WS_12b 752 493 6 +L6WS_12c 312 1063 6 +L6WS_12d 752 1063 6 +L6WS_13a 312 536 6 +L6WS_13b 752 536 6 +L6WS_13c 312 1107 6 +L6WS_13d 752 1107 6 diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/CA_5805_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/CA_5805_pdf.dat new file mode 100755 index 0000000..1d1c634 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/CA_5805_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/MA_1_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/MA_1_meta.dat new file mode 100755 index 0000000..858f8d1 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/MA_1_meta.dat @@ -0,0 +1,163 @@ +Page 1 + +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + +FontSz 10 +no_zero_entries +no_commas +round_to_whole_numbers +solid_status_check 12 4 20 . + +Your1stName: 51 158 0 15.4 +YourInitial: 298 158 0 +YourLastName: 336 158 0 15.4 +YourSocSec#: 701 158 0 14.3 +Spouse1stName: 51 213 0 15.4 +SpouseInitial: 298 213 0 +SpouseLastName: 336 213 0 15.4 +SpouseSocSec#: 701 213 0 14.3 +Number&Street: 52 269 0 11 +Town: 450 269 0 14.6 +State: 732 269 0 15 +Zipcode: 781 269 0 15 +Check_single 66 714 0 +Check_mfj 158 714 0 +Check_sep 66 734 0 +Check_hh 492 714 0 +La 253 658 8 13 +Lb 700 658 8 13 +2a. 782 807 4 13 +2bnum 608 840 2 13 +2b. 761 838 5 13 +Check_2cyou 243 877 0 +Check_2csp 328 877 0 +2cnum 628 870 1 13 +2c. 780 870 4 13 +Check_2dyou 243 910 0 +Check_2dsp 328 910 0 +2dnum 628 906 1 13 +2d. 780 906 4 13 +2e. 741 933 6 13 +2f. 741 965 6 13 +2g. 741 996 6 13 + + +Page 2 +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + +Your1stName: 50 129 0 15.4 +YourInitial: 289 129 0 +YourLastName: 312 129 0 15.4 +YourSocSec#: 701 129 0 14.3 + +L3 700 172 8 13 +L4 700 204 8 13 +L5 700 237 8 13 +L6a 700 269 8 13 +L6b 700 300 8 13 +L7 700 331 8 13 +L8a 700 364 8 13 +L8b 700 396 8 13 +L9 700 427 8 13 +L10 700 459 8 13 +L11a 778 509 4 13 +L11b 778 540 4 13 +L14a 558 662 5 13 +L14 779 661 4 13 +L15 700 694 8 13 +L16 700 725 8 13 +L17 700 757 8 13 +L18 700 789 8 13 +L19 700 832 8 13 +L20 700 863 8 13 +L21 700 895 8 13 +L22 700 938 8 13 +L23a_inc 161 996 8 13 +L23a 517 996 8 13 +L23b_inc 161 1032 8 13 +L23b 517 1032 8 13 +L23 700 1063 8 13 + + +Page 3 +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + +Your1stName: 50 129 0 15.4 +YourInitial: 288 129 0 +YourLastName: 312 129 0 15.4 +YourSocSec#: 701 129 0 14.3 + +L24 700 166 8 13 +L25 700 216 8 13 +L26 700 248 8 13 + +L28a 435 328 8 13 +L28b 435 361 8 13 +L28 700 383 8 13 +L29 700 424 8 13 +L30 700 456 8 13 +L31 700 488 8 13 +L32 700 519 8 13 + +L33a 779 584 4 13 +L33b 779 615 4 13 +L33c 779 645 4 13 +L33d 779 680 4 13 +L33e 779 710 4 13 +L33f 779 742 4 13 +L33 758 773 5 13 +L34 758 804 5 13 +L35a 128 869 4 13 +L35b 345 869 4 13 +L35 779 869 4 13 +L36 700 901 8 13 +L37 700 932 8 13 +L38a 509 992 8 13 +L38b 509 1025 8 13 +L38c 509 1058 8 13 +L38 700 1091 8 13 + + +Page 4 +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + +Your1stName: 50 129 0 15.4 +YourInitial: 288 129 0 +YourLastName: 312 129 0 15.4 +YourSocSec#: 701 129 0 14.3 + +L39 700 170 8 13 +L40 700 201 8 13 +L41 700 234 8 13 +L42 700 264 8 13 +L43a 249 313 1 13 +L43b 433 313 4 13 +L43c 691 320 +L43 777 313 4 13 +L44 777 380 4 13 +L46a 378 445 2 13 +L46num 443 445 +L46 777 443 4 13 +L47 700 478 8 13 +L48 700 510 8 13 +L49 700 541 8 13 +L50 700 573 8 13 +L51 700 617 8 13 +L52 700 649 8 13 +L53 700 691 8 13 +L54 700 788 8 13 +RoutingNum: 75 756 9 13 +AccntNum: 392 756 9 13 +Check_CheckingAccnt 809 716 +Check_SavingsAccnt 809 735 +Payment_Interest: 125 882 5 13 +Payment_Penalty: 344 882 5 13 +M2210_Amount: 604 882 5 13 +Check_EnclosedM2210: 508 861 +Check_SelfEmployed: 212 996 +Check_DORdiscuss: 498 996 +Check_DoNotEfile: 831 996 diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/MA_1_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/MA_1_pdf.dat new file mode 100755 index 0000000..0f77c67 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/MA_1_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/MI_1040_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/MI_1040_meta.dat new file mode 100755 index 0000000..c096eaf --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/MI_1040_meta.dat @@ -0,0 +1,106 @@ +Page 1 + +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + +TxtColor: 0 0 0.6 +FontSz 10 +no_zero_entries +round_to_whole_numbers +! solid_status_check 6 6 20 . + +YourSocSec#: 593 168 0 17.3 +SpouseSocSec#: 593 224 0 17.3 +Your1stName: 75 157 +YourInitial: 283 157 +YourLastName: 325 157 +Spouse1stName: 75 193 +SpouseInitial: 283 193 +SpouseLastName: 325 193 +SchoolDist: 605 267 0 12 +SepFullName: 1445 706 +Number&Street: 75 230 +Town: 75 266 +State: 406 266 +Zipcode: 465 266 +Check_single 92 400 +Check_mfj 94 436 +Check_sep 92 473 + +CkFarmFish 545 326 + +CkResident 544 400 +CkNonRes 544 436 +CkPartyear 544 473 + +L9a 595 563 +L9aa 743 563 12 + +L9b 595 602 +L9bb 743 602 12 + +L9c 595 638 +L9cc 743 638 12 + +L9d 595 675 +L9dd 743 675 12 + +L9e 590 711 +L9ee 743 711 12 + +L9 743 748 12 +L10 715 785 15 +L11 716 822 15 +L12 716 858 15 +L13 716 894 15 +L14 716 932 15 +L15 716 968 15 +L16 716 1005 15 +L17 716 1041 15 + + + +Page 2 + +YourSocSec#: 575 78 0 18.6 +L18a 485 158 15 +L18b 716 158 15 + +L19a 485 194 15 +L19b 716 194 15 + +L20 716 232 15 +L21 716 288 15 +L22 716 324 15 +L23 716 361 15 +L24 716 397 15 +L25 716 469 15 +L26 716 505 15 +L27a 478 580 15 +L27 716 580 15 +L28 716 618 15 +L29 716 654 15 +L30 716 691 15 +L31 716 725 15 +Ck32a 138 801 +Ck32b 138 838 +L32 716 836 15 +L33 716 873 15 + + +Page 3 + +YourSocSec#: 576 78 0 18.6 +interest 197 177 6 +penalty 357 177 6 +L34 716 176 15 +L35 716 213 15 +L36 716 250 15 +L37 716 287 15 + +Routing#: 310 380 +Account#: 505 380 +CkChecking 696 379 +CkSavings 807 379 + + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/MI_1040_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/MI_1040_pdf.dat new file mode 100755 index 0000000..bac63fd Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/MI_1040_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/NC_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/NC_meta.dat new file mode 100755 index 0000000..112e6f9 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/NC_meta.dat @@ -0,0 +1,97 @@ +Page 1 + +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + +TxtColor: 0 0 0.6 +FontSz 10 +no_zero_entries +round_to_whole_numbers +solid_status_check 6 6 20 . + +YourSocSec#: 98 232 0 14.5 +SpouseSocSec#: 582 232 0 14.5 +Your1stName: 112 285 0 11.7 +YourInitial: 430 285 0 +YourLastName: 500 285 0 11.7 +Spouse1stName: 112 329 0 11.7 +SpouseInitial: 430 329 +SpouseLastName: 500 329 0 11.7 +SepFullName: 445 706 +SepSocSec: 445 731 +Number&Street: 112 377 0 11.7 +Apt#: 775 377 0 11.7 +Town: 112 423 0 11.7 +State: 472 423 0 11.7 +Zipcode: 526 423 0 11.7 +Check_single 114 684 +Check_mfj 114 703 +Check_sep 114 723 +Check_hh 114 744 +Check_widow 114 763 + +Ck_FullYr_Res_Yes 560 585 +Ck_FullYr_Res_No 597 585 +Ck_SpouseFullYr_Res_Yes 560 603 +Ck_SpouseFullYr_Res_No 597 603 +Ck_Vet_Yes 371 627 +Ck_Vet_No 414 627 +Ck_SpouseVet_Yes 689 627 +Ck_SpouseVet_No 732 627 + +L6 594 788 8 11.7 +L7 594 824 8 11.7 +L8 594 861 8 11.7 +L9 594 899 8 11.7 +L10a 564 938 +L10 594 938 8 11.7 +L11 594 977 8 11.7 +Check_UsedStdDed: 114 966 +Check_ItemizedDed: 317 966 +L12a 215 1021 8 11.7 +L12 594 1023 8 11.7 +show_cents +L13 630 1060 8 5 +round_to_whole_numbers +L14 594 1106 8 11.7 +L15 594 1144 8 11.7 + +Page 2 +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + +YourLastName: 146 86 0 11.7 +YourSocSec#: 638 86 0 14.5 +L16 701 131 8 11.7 +L17 701 166 8 11.7 +Check_NoUseTax 567 204 +L18 701 202 8 11.7 +L19 701 240 8 11.7 + +L20a 246 281 8 11.7 +L20b 495 281 8 11.7 +L21a 246 330 8 11.7 +L21b 495 330 8 11.7 +L21c 246 380 8 11.7 +L21d 495 380 8 11.7 + +L22 701 418 8 11.7 +L23 701 456 8 11.7 +L24 701 495 8 11.7 +L25 701 531 8 11.7 +Check_L25: 674 528 +L26a 701 569 8 11.7 +L26b 118 615 6 11.7 +L26c 291 615 6 11.7 +L26d 701 615 8 11.7 +L26e 701 652 8 11.7 +FontSz 14 +L27 701 690 8 11.7 +FontSz 10 +L28 701 726 8 11.7 +L29 701 764 8 11.7 +L30 701 801 8 11.7 +L31 701 839 8 11.7 +L32 701 877 8 11.7 +L33 701 916 8 11.7 +L34 701 954 8 11.7 diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/NC_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/NC_pdf.dat new file mode 100755 index 0000000..ef38f6f Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/NC_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/NJ_1040_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/NJ_1040_meta.dat new file mode 100755 index 0000000..8543e9b --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/NJ_1040_meta.dat @@ -0,0 +1,179 @@ +Page 1 + +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + +TxtColor: 0 0 0.6 +FontSz 10 +no_zero_entries +showevenifzero L45 +round_to_whole_numbers +no_show_decimal_pt +solid_status_check 18 8 30 . + + YourSocSec#: 100 190 0 19 + SpouseSocSec#: 100 248 0 19 + YourNames: 389 199 0 + Number&Street: 387 251 0 + Town: 387 308 0 + State: 703 308 0 + Zipcode: 772 308 0 13.1 + CountyCode 159 307 0 20 + Check_single 91 479 0 + Check_mfj 91 505 0 + Check_sep 91 531 0 + Check_hh 91 554 0 + Check_widow 91 579 0 + Check_Spouse 340 677 0 + Check_DomPartner 501 677 0 + SpouseSocSec#Sep: 450 522 0 19 + L6a 656 675 0 + L6 792 675 0 + Check_Over65 220 718 0 + Check_SpOver65 339 718 0 + L7a 654 712 0 + L7 792 712 0 + Check_Blind 219 755 0 + Check_SpBlind 339 755 0 + L8a 654 750 0 + L8 792 750 0 + Check_Vet 219 781 0 + Check_SpVet 339 782 0 + L9a 654 779 0 + L9 792 779 0 + + L10a 626 809 2 19 + L10 792 809 + L11a 626 840 2 19 + L11 792 840 + L12a 626 869 2 19 + L12 792 869 + ! Enter00afterDecimals + L13 673 904 8 19 + +Dep1_Name: 64 980 +Dep2_Name: 64 1010 +Dep3_Name: 64 1041 +Dep4_Name: 64 1072 + +Dep1_SocSec#: 384 980 0 8.7 +Dep2_SocSec#: 384 1010 0 8.7 +Dep3_SocSec#: 384 1041 0 8.7 +Dep4_SocSec#: 384 1072 0 8.7 + +Dep1_BirthYear: 682 980 +Dep2_BirthYear: 682 1010 +Dep3_BirthYear: 682 1041 +Dep4_BirthYear: 682 1072 + + +Page 2 +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + + YourSocSec#: 687 81 0 12.2 + YourNames: 486 118 0 + no_commas + L15 595 155 11 19 + L16a 595 188 11 19 + L16b 547 221 10 19 + L17 595 252 11 19 + L18 595 285 11 19 + L19 595 316 11 19 + L20a 595 346 11 19 + L20b 547 375 10 19 + L21 595 406 11 19 + L22 595 439 11 19 + L23 595 474 11 19 + L24 595 504 11 19 + L25 595 534 11 19 + L26 595 566 11 19 + L27 595 594 11 19 + L28a 547 625 9 19 + L28b 547 657 9 19 + L28c 653 687 9 19 + L28 652 687 9 19 + L29 595 718 11 19 + L30 652 748 9 19 + L31 653 779 9 19 + L32 653 809 9 19 + L33 653 840 9 19 + L34 653 869 9 19 + L35 653 900 9 19 + L36 653 929 9 19 + L37a 123 963 9 19 + L37b 363 963 9 19 + L37c 653 963 9 19 + L38 597 993 11 19 + L39 599 1023 11 19 + L40a 538 1052 11 19 + + +! L39_Block 124 1053 5 19 +! L39_Lot 402 1053 5 19 +! L39_Qual: 710 1053 5 19 +! L39_CntyCode: 235 1083 4 19 +! L39chkG 439 1085 0 + Check_HomeOwner 498 1082 + Check_Tenant 643 1082 + Check_Both_OwnerTenant 776 1082 + L41 653 1105 9 19 + +Page 3 +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + + YourSocSec#: 687 82 0 12.2 + YourNames: 485 118 0 + + L42 653 158 9 19 + L43 653 189 9 19 + L44 653 229 9 19 + L45 653 259 9 19 + L46 653 289 9 19 + L47 653 319 9 19 + L48 653 348 9 19 + L49 653 378 9 19 + + L50 653 409 9 19 + L51 653 442 9 19 + L52 653 474 9 19 + L53a 653 529 9 19 + L53b 653 567 9 19 + L53 653 605 9 19 + + L54 623 653 10 19 + L55 623 685 10 19 + L56 769 714 4 19 + L57 623 745 10 19 + + L58 710 777 7 19 + L59 710 826 7 19 + L60 710 856 7 19 + L61 710 885 7 19 + L62 710 916 7 19 + L63 623 946 10 19 + L64 710 979 7 19 + L65 710 1026 7 19 + L66 623 1057 10 19 + L67 623 1092 10 19 + +Page 4 + + YourSocSec#: 687 82 0 12.2 + YourNames: 485 118 0 + + L68 624 158 10 19 + L69 624 188 10 19 + L70 739 220 6 19 + L71 739 253 6 19 + L72 739 285 6 19 + L73 739 317 6 19 + L74 738 348 6 19 + L75 739 389 6 19 + L76 739 426 6 19 + L77 739 468 6 19 + L78 624 499 10 19 + L79 624 530 10 19 + L80 624 572 10 19 + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/NJ_1040_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/NJ_1040_pdf.dat new file mode 100755 index 0000000..bbe9e2a Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/NJ_1040_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/NY_it201_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/NY_it201_meta.dat new file mode 100755 index 0000000..2dbd262 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/NY_it201_meta.dat @@ -0,0 +1,313 @@ +Page 1 + +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + +FontSz 10 +no_zero_entries +no_commas +round_to_whole_numbers + + Your1stName: 72 195 + YourInitial: 217 195 + YourLastName: 249 195 + YourDOB 554 195 0 7 + YourSocSec#: 702 195 0 8 + + Spouse1stName: 72 232 + SpouseInitial: 217 232 + SpouseLastName: 249 232 + SpouseDOB 554 232 0 7 + SpouseSocSec#: 702 232 0 8 + + Number&Street: 72 268 0 + AptNumber: 570 268 + Town: 72 304 0 + StateName: 338 304 0 + Zipcode: 377 304 0 11 + + Number&Street: 72 341 0 + AptNumber: 570 341 + Town: 72 378 0 + Zipcode: 377 378 0 11 + + FontSz 16 + Check_single 177 418 0 + Check_mfj 177 454 0 + Check_sep 177 491 0 + Check_hh 177 528 0 + Check_widow 177 564 0 + + Check_YesItemiz 363 602 + Check_NoItemiz 424 602 + Check_Depend 363 638 + Check_NotDep 424 638 + + CkD1y: 799 416 + CkD1n: 859 416 + + CkD2_1y: 799 453 + CkD2_1n: 859 453 + + CkE1_1y: 799 637 + CkE1_1n: 859 637 + E2_DaysNYC: 813 673 + + F1_MonthsYouNYC 839 708 + F2_MonthsSpNYC 839 744 + G_SpecCondCode 782 781 + G_SpecCondCode2 839 781 + FontSz 10 + + County 700 268 + SchooldDist 700 305 + SchoolCode 819 342 + + H1_Name1st: 75 836 + H1_MidInit: 227 836 + H1_NameLst: 273 836 + H1_Relat: 425 836 + H1_SocSec: 567 836 + H1_DOB: 750 836 + + H2_Name1st: 75 873 + H2_MidInit: 227 873 + H2_NameLst: 273 873 + H2_Relat: 425 873 + H2_SocSec: 567 873 + H2_DOB: 750 873 + + H3_Name1st: 75 910 + H3_MidInit: 227 910 + H3_NameLst: 273 910 + H3_Relat: 425 910 + H3_SocSec: 567 910 + H3_DOB: 750 910 + + H4_Name1st: 75 947 + H4_MidInit: 227 947 + H4_NameLst: 273 947 + H4_Relat: 425 947 + H4_SocSec: 567 947 + H4_DOB: 750 947 + + H5_Name1st: 75 985 + H5_MidInit: 227 985 + H5_NameLst: 273 985 + H5_Relat: 425 985 + H5_SocSec: 567 985 + H5_DOB: 750 985 + + H6_Name1st: 75 1020 + H6_MidInit: 227 1020 + H6_NameLst: 273 1020 + H6_Relat: 425 1020 + H6_SocSec: 567 1020 + H6_DOB: 750 1020 + + H7_Name1st: 75 1060 + H7_MidInit: 227 1060 + H7_NameLst: 273 1060 + H7_Relat: 425 1060 + H7_SocSec: 567 1060 + H7_DOB: 750 1060 + +Page 2 +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + + YourSocSec#: 291 85 0 8 + L1 705 151 12 8 + L2 705 178 12 8 + L3 705 198 12 8 + L4 705 216 12 8 + L5 705 235 12 8 + L6 705 253 12 8 + L7 705 271 12 8 + L8 705 291 12 8 + Ck_IRA_bene 627 308 + L9 705 308 12 8 + Ck_Pens_bene 627 326 + L10 705 326 12 8 + L11 705 345 12 8 + + L12 486 381 12 8 + L13 705 398 12 8 + L14 705 416 12 8 + L15 705 434 12 8 + L16_Other 230 454 + L16 705 454 12 8 + L17 705 479 12 8 + L18_Ident 350 499 + L18 705 499 12 8 + L19 705 525 12 8 + L20 705 601 12 8 + L21 705 618 12 8 + L22 705 636 12 8 + L23 705 656 12 8 + L24 705 674 12 8 + L25 486 748 12 8 + L26 486 766 12 8 + L27 486 784 12 8 + L28 486 803 12 8 + L29 486 822 12 8 + L30 486 840 12 8 + L31 486 858 12 8 + L32 705 876 12 8 + L33 705 902 12 8 + Check_Std 406 1007 + Check_Item 575 1007 + L34 705 1004 12 8 + L35 705 1031 12 8 + L36_entry 685 1050 12 8 + L37 705 1078 12 8 + + +Page 3 +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + + YourNames: 75 85 + YourSocSec#: 484 85 0 6.5 + L38 705 151 12 8 + L39 705 177 12 8 + L40 486 198 12 8 + L41 486 216 12 8 + L42 486 234 12 8 + L43 705 253 12 8 + L44 705 279 12 8 + L45 705 299 12 8 + L46 705 325 12 8 + L47 486 381 12 8 + L47a 486 398 12 8 + L48 486 418 12 8 + L49 486 455 12 8 + L50 486 475 12 8 + L51 486 492 12 8 + L52 486 510 12 8 + L53 486 528 12 8 + L54 486 564 12 8 + L54a 258 601 12 8 + L54b 258 638 12 8 + L54c 486 656 12 8 + L54d 486 675 12 8 + L54e 486 693 12 8 + L55 486 711 12 8 + L56 486 730 12 8 + L57 486 748 12 8 + L58 705 766 12 8 + L59 705 803 12 8 + L60 705 840 12 8 + L61 705 884 12 8 + + + +Page 4 +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + + YourSocSec#: 381 83 0 6.5 + + L62 705 96 12 8 + L63 486 143 12 8 + L64 486 161 12 8 + L65 486 180 12 8 + L66 486 198 12 8 + L67 486 216 12 8 + L68 486 233 12 8 + L69 486 253 12 8 + L69a 486 271 12 8 + L70 486 290 12 8 +! L70a 486 308 12 8 + L71 486 326 12 8 + L72 486 345 12 8 + L73 486 363 12 8 + L74 486 381 12 8 + L75 486 399 12 8 + L76 705 426 12 8 + L77 705 480 12 8 + L78 705 501 12 8 + L78a 705 535 12 8 + L78b 705 562 12 8 + L79 486 636 12 8 + L80 705 691 12 8 + L81 484 730 12 8 + L82 484 748 12 8 + L83b 224 839 + L83c 570 839 + L84date: 459 866 + L84 705 866 12 8 + + YourOccupation: 569 1022 + + +Optional_Page 5 + + YourNames: 75 195 + YourSocSec#: 682 195 0 6.5 + IT196_1 486 279 12 8 + IT196_2 486 307 12 8 + IT196_3 486 333 12 8 + IT196_4 705 363 12 8 + Check_5a 119 446 + Check_5b 295 446 + IT196_5 486 445 12 8 + IT196_6 486 473 12 8 + IT196_7 486 500 12 8 + IT196_8 486 546 12 8 + IT196_9 705 574 12 8 + IT196_10 486 646 12 8 + IT196_11 486 737 12 8 + IT196_12 486 765 12 8 + IT196_14 486 821 12 8 + IT196_15 705 848 12 8 + IT196_16 486 913 12 8 + IT196_16a 270 940 12 8 + IT196_17 486 967 12 8 + IT196_18 486 994 12 8 + IT196_19 705 1022 12 8 + + +Optional_Page 6 + + YourSocSec#: 381 85 0 6.5 + IT196_20 705 160 12 8 + IT196_21 486 241 12 8 + IT196_22 486 269 12 8 + IT196_23 486 296 12 8 + IT196_24 486 352 12 8 + IT196_25 486 380 12 8 + IT196_26 486 407 12 8 + IT196_27 486 434 12 8 + IT196_28 705 462 12 8 + + IT196_29 486 527 12 8 + IT196_30 486 572 12 8 + IT196_31 486 609 12 8 + IT196_32 486 638 12 8 + IT196_33 486 672 12 8 + IT196_34 486 709 12 8 + IT196_35 486 738 12 8 + IT196_36 486 776 12 8 + IT196_37 486 802 12 8 + IT196_38 486 839 12 8 + IT196_39 705 868 12 8 + Check_IT196_DedNotLimited 89 957 + Check_IT196_DedMaybeLimited 89 994 + IT196_40 705 1031 12 8 + + +Optional_Page 7 + + YourSocSec#: 499 85 0 6.5 + IT196_41 705 160 12 8 + IT196_42 705 187 12 8 + IT196_43 705 215 12 8 + IT196_44 705 241 12 8 + IT196_45 705 270 12 8 + IT196_46 705 297 12 8 + IT196_47 705 324 12 8 + IT196_48 705 352 12 8 + IT196_49 705 380 12 8 + + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/NY_it201_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/NY_it201_pdf.dat new file mode 100755 index 0000000..ae1e5c5 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/NY_it201_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/OH_PIT_IT1040_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/OH_PIT_IT1040_meta.dat new file mode 100755 index 0000000..e1851d2 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/OH_PIT_IT1040_meta.dat @@ -0,0 +1,219 @@ +Page 1 + +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi +MediaBox 594 770 +FontSz 11 +no_zero_entries +round_to_whole_numbers + +YourSocSec#: 60 206 9 12.3 +Your1stName: 60 261 0 13.7 +YourMidInit: 386 261 +YourLastName: 420 261 0 13.7 +Spouse1stName: 60 310 0 13.7 +SpouseMidInit: 386 310 +SpouseLastName: 420 310 0 13.7 +SpouseSocSec#: 403 206 9 13.3 +Number&Street: 60 367 0 13.7 +AddressLine2: 60 422 0 13.7 +Town: 60 474 0 13.7 +State: 497 474 0 13.7 +Zipcode: 553 474 0 13.7 +OhioCounty: 671 474 0 13.7 + +CkFYrRes: 59 585 +CkPYrRes: 164 585 +CkFYrResSp: 59 639 +CkPYrResSp: 164 639 + +FontSz 12 + Check_single 505 582 + Check_mfj 505 622 + Check_sep 505 658 + Check_hh 505 582 + Check_widow 505 582 +FontSz 11 +SpouseSocSec#Sep: 670 655 9 13.3 + +L1 696 802 9 13.8 +L2a 696 838 9 13.8 +L2b 696 875 9 13.8 +L3 696 912 9 13.8 +L4 780 948 5 13.8 +Exemptions 500 972 2 13.8 +L5 696 984 9 13.8 +L6 696 1022 9 13.8 +L7 696 1058 9 13.8 + + +Page 2 + +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + + YourSocSec#: 107 92 9 10.9 + L7a 696 121 9 13.8 + L8a 696 158 9 13.8 + L8b 696 194 9 13.8 + L8c 696 231 9 13.8 + L9 696 267 9 13.8 + L10 696 304 9 13.8 + L11 696 342 9 13.8 + L12 696 377 9 13.8 + L13 696 413 9 13.8 + L14 696 451 9 13.8 + L15 696 488 9 13.8 + L16 696 525 9 13.8 + L17 696 562 9 13.8 + L18 696 600 9 13.8 + L19 696 636 9 13.8 + L20 696 671 9 13.8 + L21 696 710 9 13.8 + L22 696 747 9 13.8 + + L23 696 782 9 13.8 + L24 696 818 9 13.8 + L25 696 857 9 13.8 + + L26g 696 931 9 13.8 + L27 696 984 9 13.8 + + +Page 3 + +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + + YourSocSec#: 379 147 9 10.9 + SchedA1 696 211 9 13.8 + SchedA2 696 250 9 13.8 + SchedA3 696 286 9 13.8 + SchedA4 696 322 9 13.8 + SchedA5 696 357 9 13.8 + SchedA6 696 395 9 13.8 + SchedA7 696 433 9 13.8 + SchedA8 696 474 9 13.8 + SchedA9 696 525 9 13.8 + SchedA10 696 561 9 13.8 + SchedA11 696 598 9 13.8 + SchedA12 696 635 9 13.8 + SchedA13 696 708 9 13.8 + SchedA14 696 746 9 13.8 + SchedA15 696 782 9 13.8 + SchedA16 696 820 9 13.8 + SchedA17 696 855 9 13.8 + SchedA18 696 892 9 13.8 + SchedA19 696 929 9 13.8 + SchedA20 696 966 9 13.8 + SchedA21 696 1002 9 13.8 + SchedA22 696 1038 9 13.8 + SchedA23 696 1076 9 13.8 + SchedA24 696 1113 9 13.2 + + +Page 4 + +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + + YourSocSec#: 110 88 9 10.9 + SchedA25 703 142 9 13.2 + SchedA26 703 180 9 13.2 + SchedA27 703 215 9 13.2 + SchedA28 703 253 9 13.2 + + SchedA29 703 288 9 13.2 + SchedA30 703 322 9 13.2 + SchedA31 703 376 9 13.2 + + SchedA32 703 415 9 13.2 + SchedA33 703 452 9 13.2 + + SchedA34 703 488 9 13.2 + + SchedA35 703 527 9 13.2 + SchedA36 703 579 9 13.2 + SchedA37 703 616 9 13.2 + SchedA38 703 653 9 13.2 + + SchedA39 703 690 9 13.2 + SchedA40 703 728 9 13.2 + + SchedA41 703 781 9 13.2 + SchedA42 703 817 9 13.2 + SchedA43 703 853 9 13.2 + SchedA44 703 890 9 13.2 + SchedA45 703 927 9 13.2 + SchedA46 703 966 9 13.2 + +Page 5 + +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + + YourSocSec#: 381 112 9 10.9 + Credits1 703 211 9 13.2 + Credits2 703 250 9 13.2 + Credits3 703 285 9 13.2 + Credits4 703 322 9 13.2 + Credits5 703 358 9 13.2 + Credits6 703 399 9 13.2 + Credits7 703 433 9 13.2 + Credits8 703 470 9 13.2 + Credits9 703 507 9 13.2 + Credits10 703 543 9 13.2 + Credits11 703 578 9 13.2 + JFC 312 618 2 13.2 + Credits12 703 616 9 13.2 + Credits13 703 651 9 13.2 + Credits14 703 689 9 13.2 + Credits15 703 725 9 13.2 + Credits16 703 762 9 13.2 + Credits17 703 799 9 13.2 + Credits18 703 835 9 13.2 + Credits19 703 873 9 13.2 + Credits20 703 910 9 13.2 + Credits21 703 945 9 13.2 + Credits22 703 983 9 13.2 + Credits23 703 1021 9 13.2 + Credits24 703 1059 9 13.2 + + +Page 6 + +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + + YourSocSec#: 381 109 9 10.9 + + Credits25 703 137 9 13.2 + Credits26 703 177 9 13.2 + Credits27 703 214 9 13.2 + Credits28 703 250 9 13.2 + Credits29 703 287 9 13.2 + Credits30 703 323 9 13.2 + +! DateBeganResidence: 205 376 0 10.3 +! DateEndResidence: 372 376 0 10.5 +! OtherState: 668 376 0 13.2 + + Credits31 703 360 9 13.2 + Credits32 703 396 9 13.2 + Credits33 703 432 9 13.2 + Credits34 703 468 9 13.2 + Credits35 703 504 9 13.2 + Credits36 703 544 9 13.2 + Credits37 703 597 9 13.2 + Credits38 703 635 9 13.2 + Credits39 703 670 9 13.2 + Credits40 703 744 9 13.2 + Credits41 703 782 9 13.2 + Credits42 703 818 9 13.2 + Credits43 703 853 9 13.2 + Credits44 703 890 9 13.2 + Credits45 703 928 9 13.2 + Credits46 703 965 9 13.2 + + +END_OF_INPUT diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/OH_PIT_IT1040_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/OH_PIT_IT1040_pdf.dat new file mode 100755 index 0000000..8475939 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/OH_PIT_IT1040_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/OR_40_instructions.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/OR_40_instructions.dat new file mode 100755 index 0000000..5552f1e --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/OR_40_instructions.dat @@ -0,0 +1,616 @@ +Instructions: +[FileName1040:] Enter the path and filename to the Form 1040 output file. This +is a primary source for information required for the OR-40 form, so complete it +first. Review the output file for complete list of the Form 1040 fields used, +and their values, in the section 'Imported 1040 Data'. + +[Dep1Code:] Dependent codes are: + SD Biological or adopted child. + SC Stepchild. + FC Foster child. + SB Sibling, half sibling, stepsibling, or sibling-in-law. + PT Parent, stepparent, or parent-in-law. + SP Spouse or RDP. + GP Grandparent or great-grandparent. + GC Grandchild or great-grandchild. + AU Parent's sibling or the sibling's spouse or RDP. + NN Sibling's child, grandchild, or other descendant. + OR Child's spouse or RDP, cousin, or other related individual. + NR Unrelated qualifying individual. + +[Dep2Code:] See instructions for Dep1Code. +[Dep3Code:] See instructions for Dep1Code. + +[CkL6aRegular] If you can't be claimed as a dependent on someone else's return, +check the "Regular" exemption box below line 6a (CkL6aRegular) ; otherwise, +check the "Someone else can claim you as a dependent" box (CLK6aDep) , even if +the other person doesn't actually claim you as a dependent. If you're married +and filing a joint return (or filing separately but your spouse has no income) +and your spouse can't be claimed as a dependent on someone else's return, check +the "Regular" exemption box below line 6b (CkL6bRegular); otherwise, check the +"Someone else can claim your spouse as a dependent" box (CkL6bDep), even if the +other person doesn't actually claim your spouse as a dependent. + +Severe disability exemption. You or your spouse may qualify for the additional +"severe disability" exemption, even if someone else can claim you or your spouse +as a dependent, if any of the following apply to you or your spouse: +- You permanently lost the use of one or both legs or feet. +- You permanently lost the use of both hands. +- You're permanently blind. +- You have a permanent condition that, without special equipment or outside +help, limits your ability to earn a living, maintain a household, or transport +yourself. +- You're unable to earn a living due to a permanent +condition or an impairment of indefinite duration. +To confirm that you or your spouse qualify for the additional exemption, a +licensed physician must write a letter describing the nature and extent of the +disability. Keep the letter with your records in case we request a copy. If you +qualify for this additional exemption, check the "Severe disability" box below +line 6a. If your spouse qualifies, check the box below line 6b. + +[CkL6aDisabled] See instructions for CkL6aRegular. +[CkL6aDep] See instructions for CkL6aRegular. +[CkL6bRegular] See instructions for CkL6aRegular. +[CkL6bDisabled] See instructions for CkL6aRegular. +[CkL6bDep] See instructions for CkL6aRegular. + +[CkDep1Dis] Child with a disability. The additional "Child with a disability" +exemption is for a dependent child, age 21 or younger, who was eligible for +early intervention or special education services, as defined by the State Board +of Education of the state where the child attended school, as of the end of the +tax year. The child must have had an eligible disability under the federal +Individuals with Disabilities Education Act. +Eligible disabilities include: +- Autism spectrum disorder. +- Communication disorder. +- Deafblindness. +- Developmental delay. +- Emotional disturbance. +- Hearing impairment (including deafness). +- Intellectual disability. +- Orthopedic impairment. +- Other health impairment. +- Specific learning disability. +- Traumatic brain injury. +- Visual impairment (including blindness). +Each year, you must be able to provide an eligibility statement and a cover +sheet from the child's IEP (Individualized Education Program) or IFSP +(Individualized Family Service Plan). Keep these with your tax records. + +[CkDep2Dis] See instructions for CkDep1Dis. + +[CkDep3Dis] See instructions for CkDep1Dis. + +[L6c] Enter your total number of dependents, including the total(s) from +Schedule OR-ADD-DEP, line 6. + +[L6d] See instructions for CkDep1Dis. Total number of children with a +disability. Enter the total number of boxes checked for this additional +exemption, including the total(s) from Schedule OR-ADD-DEP, line 7. + +[L10_worksheet_L4] +Lines from worksheet not listed here are auto-calculated. See output file for all +worksheet values. From 'Instructions for Federal tax liability subtraction +worksheet': +Line 4: Enter the total of any other taxes, plus any tax recaptures +or other additions to tax that include only income tax, from Form 1040, Schedule +2, lines 8, 16, and 17. If you're repaying a 2008 first-time homebuyer credit +and filing federal Form 5405 , include the amount from Schedule 2, line 10. +Include any tax on non-effectively connected income from Form 1040-NR, line 23a. +Don't include any additions to tax from Schedule 2, line 17 that are penalties, +interest, excise tax, or other amounts that aren't income tax. If you have no +other taxes, enter 0. + +[L10_worksheet_L7] Lines from worksheet not listed here are auto-calculated. See +output file for all worksheet values. From 'Instructions for Federal tax +liability subtraction worksheet': +Line 7: Enter your total premium tax credit amount from federal Form 8962, line +24. This is your allowable premium credit regardless of any excess advance +payments you received or credit you're claiming on your federal return. + +[CkStdDedOverride] If you need to enter a different standard deduction, set this +to 'Yes' to disable auto calculation of the standard deduction, and enter a +value in the 'StdDedOverride' field below. + +See the exceptions below for: +- Dependents who can be claimed on another taxpayer's return. +- Non-U.S. citizens without permanent resident status. +- Spouses filing separate returns + +Exception 1: +Standard deduction-Dependents who can be claimed on another taxpayer's return. +If someone else can claim you as a dependent, your standard deduction is limited +to the larger of: +- Your earned income plus $450, up to the maximum +allowed for your filing status (see Table 5); or +- $1,300. +This limit applies even if the other person doesn't actually claim you as a +dependent on their return. If you're a dependent and not married, use the +worksheet to figure your standard deduction. If you're a dependent and married, +see "Deductions and modifications" in Publication OR-17. See worksheet in the +From OR-40 Instructions. + +Exception 2: +Standard deduction-Non-U.S. citizen without permanent resident status. Your +standard deduction is $0, but you may claim itemized deductions. + +Exception 2: +Standard deduction-Married filing separately. The standard deduction for married +individuals filing separately is $0 if one spouse itemizes. This applies even if +the standard deduction is more than your itemized deductions. + +[StdDedOverride] See instructions for CkStdDedOverride above. + +[CkL17a] Standard deduction-Age 65 or older, or blind. If you or your spouse +turned age 65 by January 1, 2025, or were blind at the end of the tax year, +you're entitled to a larger standard deduction. If you or your spouse are +permanently blind, you may also qualify for the severe disability exemption +claimed on lines 6a and 6b. +NOTE: This calculation is done automatically: +Check the applicable boxes below line 17, then multiply the number of boxes +checked by: +- $1,200 if single or head of household filing status; or +- $1,000 for all other filers. +Add this amount to the standard deduction for your filing status from Table 5. +Enter the total on line 17 + +[CkL17b] See instructions for Clk17a. +[CkL17c] See instructions for Clk17a. +[CkL17d] See instructions for Clk17a. + +[CkL20a] Other tax methods. If you qualify, you can compute your Oregon tax +using any of the following methods: Farm income averaging method. Did you have +income from a farm? You may use the federal farm income averaging method to +compute your Oregon tax even if you didn't use farm income averaging on your +federal return. Use Publication OR-FIA and Schedule ORFIA-40 to compute the +Oregon tax using this method. You can download them from our website or contact +us to order them. If you use farm income averaging to calculate your tax, enter +the tax amount from Schedule OR-FIA-40, line 24 and check box 20a. Don't include +the schedule with your return. Keep it with your records. + +[CkL20b] Farm asset capital gain method. Did you sell or exchange capital assets +primarily used in farming because you were getting out of a farming business? +Or, did you sell or exchange a farming business in which you held at least a 10 +percent ownership interest? If so, you may be eligible for a reduced tax rate on +the net capital gain from the proceeds. Use Worksheet FCG inside Publication +OR-FCG to compute the Oregon tax using this method. You can download it from our +website or contact us to order it. Enter the tax amount from Worksheet FCG, +line 9, and check box 20b. Don't include the worksheet with your return. Keep it +with your records. + +[CkL20c] Oregon qualified business income reduced tax rate. Did you have +business income from a sole proprietorship, partnership, or S corporation in +which you materially participated? If so, you may qualify to use this reduced +tax rate. For details, see Schedule OR-PTE-FY and instructions on our website or +contact us to order them. Note: If you elect to use this reduced tax rate for +qualifying income, the election is irrevocable and must be made on your original +return. An original return includes an amended return filed on or before the due +date, including extensions. You can't change the election after your original +return has been filed. If you elect to use the reduced rate to calculate your +tax, enter the tax amount from Schedule OR-PTE-FY, line 14a and check box 20c. +Include the schedule with your Oregon return. + +[AltMethodTaxAmt] Enter a value here only if ClkL20a, ClkL20b, or ClkL20c is set +to Yes. This value is ignored if all 3 are set to No, and the result from the +standard tax table or tax formula is automatically inserted. + +[L21] Interest on certain installment sales. Did you have installment sales that +required you to pay interest on the deferred tax liability for federal purposes? +If so, you must also compute interest for Oregon using the same method as for +federal. The annual interest rate is 8 percent for 2024 and 9 percent for 2025. + +[L26] Political contribution credit. If your federal AGI isn't more than $75,000 +($150,000 if you're filing a joint return), you may claim a standard credit of +up to $50 ($100 if you're filing a joint return) for cash contributions you made +during 2024 to any: +- Qualified political party. +- Qualified candidate for federal, state, or local elective office, or the + candidate's campaign, for an election in Oregon. +- Political action committee certified in Oregon. + +[L32] Oregon income tax withheld. Enter the total Oregon tax withheld from your +wages and other income. State tax withheld from wages is shown in box 17 of Form +W-2 and in the State area of various 1099 forms. Don't include FICA (Social +Security) tax withheld or tax withheld from your wages by other states. You +must include a legible, unaltered copy of your Form W-2 from each job and any +Form 1099 showing Oregon income tax withheld with your Oregon return. + +If you don't have a Form W-2 or 1099, you must provide other proof of Oregon tax +withheld. Proof may include a copy of a final paycheck stub or a letter from +your employer. If you file before February 1, 2025, we can only accept a Form +W-2 or 1099 as proof. + +If you have tax to pay, you may want to increase the amount your employer or +other payer withholds from your wages. You can find withholding information and +do a "paycheck checkup" on our website. + +[L33] Prior-year refund applied as estimated tax payment. Enter the amount of +any prior-year refund you applied as a payment of 2024 estimated tax. If we +adjusted your applied refund, be sure to use the adjusted amount. If you need to +verify your applied refund amount, log into or create your Revenue Online +account on our website or contact us. + +[L34] Estimated tax payments for 2024. Enter the total estimated tax payments +you made before April 15, 2025. For calendar-year filers, these payments were +due April 15, 2024; June 17, 2024; September 16, 2024; and January 15, 2025. If +you're filing on extension, include any extension payment made on or before the +due date (without extensions), but don't include any payments made after April +15, 2025. Don't include the amount reported on line 33. If you need to verify +your estimated payments, log into or create your Revenue Online account on our +website or contact us. + +[L35] Estimated tax payments from Schedule OR-K-1, line 20. An Oregon +pass-through entity (PTE) or an out-of-state PTE with Oregon-source income may +choose to make estimated Oregon tax payments on its owners' behalf. PTEs report +these payments to us on Form OR-19 and to owners on Schedule OR-K-1. + +Enter the amount from Schedule OR-K-1, line 20. If the PTE didn't provide +Schedule OR-K-1 to you, enter the amount of estimated tax paid on your behalf +that the PTE reported to us on Form OR-19. Don't include any PTE elective tax +payments or credit from Schedule OR- 21-K-1. See Publication OR-17 for +information about the PTE elective tax and related credit. + +[L36] Earned income credit. Oregon's earned income credit is a percentage of the +earned income tax credit (EITC) claimed on your federal return. The percentage +is based on the age of your youngest dependent at the end of the tax year. Note +to RDPs: You may claim this credit if you would otherwise qualify for the EITC +using your "as if" federal return. Schedule OR-EIC-ITIN. If you can't claim any +or all of the federal EITC because you, your spouse, or your child(ren) do not +have an SSN that is valid for work or are using an ITIN, you may qualify for +Oregon's earned income credit for ITIN filers. See Schedule OR-EICITIN +Instructions for more information. The schedule and instructions are available +in English and Spanish. Download them from our website or contact us to order +them. + +Use the worksheet in the Form OR-40 instructions to figure your credit. + +[L37] Oregon Kids Credit. The Oregon Kids Credit is available for certain +taxpayers with qualifying dependent children who were under the age of six at +the end of the tax year. See "Exemption credit" in Publication OR-17 for +information about qualifying children. Eligibility. To be eligible for the +Oregon Kids Credit, you must: + +1. Use a filing status other than married filing separately. If you're married +and filing separate returns, you do not qualify for this credit. +2. Have one or more dependents age five or younger at the end of 2024 listed on +your Oregon return.* +3. Have qualifying income under $30,750. + +If you're eligible, use the Oregon Kids Credit worksheet to figure your credit. +Credit amount. For 2024, the maximum amount of the Oregon Kids Credit is $1,000 +per qualifying dependent, for up to five dependents. Your credit amount may be +limited by your income. + +* Note for divorced, separated, or unmarried parents: +If a child is listed as a dependent on your Oregon return only because the + +custodial parent released the child's dependent exemption to you, the child +doesn't qualify for purposes of this credit. If you're the custodial parent of +an otherwise qualifying child, you may be able to claim this credit even if the +child's dependent exemption has been released to the other parent. + +Use the worksheet in the Form OR-40 instructions to figure your credit. + +[L43] Your 2024 tax must be paid by April 15, 2025, even if you requested an +extension of time to file your return. Your 2024 return must be filed by April +15, 2025. If you requested an extension, your return must be filed by October +15, 2025. Round the total of penalties and interest to the nearest whole +dollar. For more information and examples showing how penalties and interest are +calculated, see "Interest and penalties" in Publication OR-17. See OR-40 +instructions for calculations. + +[L44] Interest on underpayment of estimated tax. +Underpayment interest is charged if: +- Your tax after all credits and withholding is $1,000 or more; +- You were required to make estimated tax payments; +- One or more of your required installments was underpaid; and +- You don't qualify for an exception. + +Note: You could be charged interest on underpayment of estimated tax even if +line 41 shows an overpayment. + +See Form OR-10 Instructions to determine if you owe underpayment interest or +qualify for an exception. Download Form OR-10 and the instructions from our +website or contact us to order them. + +If you owe underpayment interest, enter the amount from line 4 of Form OR-10. If +you qualify for an exception, enter the exception number from line 1 of the form +inside box 44a. If you used the Annualized Income Worksheet (located in Form +OR-10 Instructions) to figure your interest, check box 44b. Include Form OR-10 +with your return. Keep your underpayment interest worksheets and any required +statements with your records. + +[L48] Apply refund as estimated tax payment. Enter the amount of your refund you +want to apply as an estimated tax payment for a later year. The payment will be +applied to the 2025 tax year unless you're filing this return after January 15, +2026. For more information about open estimated tax accounts, see "Payments and +refunds" in Publication OR-17. + +Instructions for amended returns. Enter the amount, if any, from a refund on +your original return that you've already applied as an estimated tax payment for +a later year. If line 5 of the Amended worksheet shows a refund and you want to +apply some or all of it as an estimated tax payment, include the amount you want +to apply. + +[L49] Charitable checkoff donations. Enter the amount from line 30 of Schedule +OR-DONATE. For more information, see the instructions on the schedule. You can +download Schedule OR-DONATE from our website or contact us to order it. + +Note: If your refund-after any application as a payment of estimated tax-is less +than your total donation amount, your donations will be prorated. + +To make direct donations instead, you can find each charity's address listed on +our website. Don't mail your donations to us. + +Instructions for amended returns. Enter the amount, if any, from a refund on +your original return that you applied as charitable donations using Schedule +ORDONATE. If line 5 of the Amended worksheet shows a refund, you can donate some +or all of it to one or more of the listed charities. Include this amount and an +amended Schedule OR-DONATE with your amended return. Note: The refund from your +amended return will be applied as a donation for the calendar year in which +you're filing it. + +[L50] Political party checkoff. You may use your refund to contribute $3 to the +Oregon political party of your choice. If you're filing a joint return, you and +your spouse may each contribute $3. Note: Your contribution will reduce your +refund and does not qualify for the political contribution credit. + +To make a contribution: +1. Designate the political party of your choice using the party's code from the +alphabetized list below. +- If you contribute, enter one code in box 50a. +- If your spouse contributes on a joint return, enter one code in box 50b. + +Enter only one code per taxpayer. Spouses filing a joint return don't have to +enter the same code. +- Constitution Party of Oregon [code 500]. +- Democratic Party of Oregon [code 501]. +- Independent Party of Oregon [code 502]. +- Libertarian Party of Oregon [code 503]. +- Oregon Republican Party [code 504]. +- Pacific Green Party of Oregon [code 505]. +- Progressive Party [code 506]. +- We the People Party [code 508]. +- Working Families Party of Oregon [code 507] + +2. Enter your total contribution amount. +- If you or your spouse contribute, enter $3. +- If both you and your spouse contribute on a joint return, enter $6. + +Note: Your political party contribution won't be made if: + +- Your refund-after any application as a payment of estimated tax or charitable + checkoff donation-is less than your total contribution amount. +- You enter an amount but don't designate a party (or parties). +- You designate a party (or parties) but don't enter an amount. +- You enter more than one party code per taxpayer. + +Instructions for amended returns. Enter the amount, if any, from a refund on +your original return that you applied as a political party contribution. If line +5 of the Amended worksheet shows a refund and you didn't make the maximum +political party contribution on your original return, you may use the refund to +make a contribution on your amended return. + +[L51] Oregon higher education savings plan deposits. Enter the amount from line +5 of Schedule OR-529. For minimum deposit amounts and other information, see the +schedule instructions. You can download Schedule OR-529 and instructions from +our website or contact us to order them. + +You can also use Schedule OR-529 to provide your information to the Oregon +Treasury Savings Network if you'd like them to set up an Oregon College Savings +Plan account for you. However, you can make contributions from a refund on your +return only after the account has been created. See Schedule OR-529 Instructions +for details. + +Note: If the amount of your refund-after any application as a payment of +estimated tax, charitable checkoff donation, or political party contribution-is +less than the total amount you want to deposit, no deposit will be made. + +Instructions for amended returns. Enter the amount, if any, from a refund on +your original return that you applied as an Oregon higher education savings plan +deposit. If line 5 of the Amended worksheet shows a refund, add the amount you +want to apply as a deposit and include an amended Schedule OR-529 with your +amended return. The refund will be applied for the year in which you're filing +the amended return. + +[CkL54DepOutUS] Check the box if the final destination for your refund would be +an account outside the United States. Note: If you check this box, you will be +issued a paper check. + +[CkAcctChecking] Check the appropriate box, either checking or savings, but not both. + +[CkAcctSavings] Check the appropriate box, either checking or savings, but not both. + + +[AcctRoutingNumber:] Enter your nine-digit routing number. Routing numbers begin +with the digits 01 through 12, 21 through 32, or 61 through 72. + +[AcctNumber:] Enter your account number. Account numbers can be up to 17 +characters (both numbers and letters). Don't include hyphens, spaces, or +special symbols. + +[SchA_L1] You can deduct only the part of your medical and dental expenses that +exceeds 7.5 percent of the amount of your federal adjusted gross income on Form +OR-40, line 7, or Form OR-40-N or OR-40-P, line 29F. + +Examples of medical and dental payments you can deduct. + +To the extent you weren't reimbursed, and with certain limitations, you can +generally deduct what you paid for: +- Insurance premiums for medical and dental care, including Medicare Parts B and D. +- Prescription medicines and insulin. +- Healthcare professionals, including medical doctors, dentists, physical + therapists, and psychologists. +- Medical examinations, X-rays, laboratory fees, diagnostic tests, and other services. +- Hospital care and nursing help. +- Ambulance service and other travel costs. +- Nicotine cessation, medical weight-loss, and addiction treatment. +- Hearing aids, eyeglasses, wheelchairs, guide dogs, and other medical aids. +- Lodging costs and travel for treatment away from home. +- Lactation supplies. + +See Schedule OR-A instructions for full list of inclusions and exclusions and +worksheets. + +[SchA_L5] You may deduct certain state or local income taxes or foreign income +taxes you paid during the tax year, such as income taxes paid to a state other +than Oregon, mandatory contributions to certain employment-related programs in +other states, and taxes on real or personal property located in the United +States that are based on the property's value (known as ad valorem tax). +Income-based taxes paid to a local government within Oregon, such as Portland's +Arts Tax, may be deducted because they're not paid to the State of Oregon. + +Enter the total of the state and local income taxes you paid to a local +government or to a state other than Oregon, reduced as explained above for any +credits you're claiming for income taxes paid to another state. Note: If you +deducted sales tax paid instead of income tax paid on your federal Schedule A, +you must enter 0 on line 5. + +[SchA_L6] Enter the state or local taxes you paid on real estate you own that +wasn't used for business, but only if the taxes are assessed uniformly at a like +rate on all real property throughout the community, and the proceeds are used +for general community or governmental purposes. See IRS Publication 530, Tax +Information for Homeowners, for more information. + +Don't include the following: + +- Taxes on real property located outside the United States or its possessions. +- Itemized charges for services to specific property or persons (for example, a + flat fee charged by the county for mowing a lawn that has grown beyond the + permitted height). +- Charges for improvements that tend to increase the value of your property, + such as sidewalk assessments + +[SchA_L7] Personal property taxes. Enter the state or local personal property +taxes you paid that were: +- Based only on the property's value (ad valorem) and +- Imposed on a yearly basis. + +[SchA_L10] List the type and amount of other deductible taxes that aren't +already included on lines 5, 6, or 7. + +[SchA_L10_Type] List the type and amount of other deductible taxes that aren't +already included on lines 5, 6, or 7. + + +[SchA_L12] Enter the home mortgage interest and points reported to you on +federal Form 1098, Mortgage Interest Statement. + +[SchA_L13] Enter the home mortgage interest you paid to a recipient who didn't +provide you with a Form 1098. If the recipient was the person from whom you +bought the home, enter the person's name, address, and Social Security number +(SSN) (if an individual) or employer identification number (EIN) on the dotted +line next to line 13. + +[SchA_L14] Points are shown on your settlement statement. You may deduct points +paid to borrow money but not for other purposes. Points paid to refinance a +mortgage must be deducted over the life of the loan. See IRS Publication 936 for +more information. + +[SchA_L16] Enter the interest you paid on money you borrowed to buy property +held for investment. Use the amount you calculated using federal Form 4952, if +applicable. + +- Don't include interest paid on money you borrowed to buy bonds issued by the + Commonwealth of Puerto Rico or the territories of Puerto Rico, Guam, Samoa, or + the Virgin Islands. Income from these bonds isn't taxable by Oregon. + +- If you're deducting interest paid on money you borrowed to buy U.S. bonds, + notes, or other obligations, you'll need to reduce your subtraction for this + income on your Oregon return. See "Interest and dividends on U.S. bonds and + notes" in Publication OR-17 for more information. + +- You'll have an addition on your Oregon return if you have income from bonds + and notes issued by another state, or political subdivision of another state. + The income from these bonds and notes isn't subject to federal tax, but it is + taxable by Oregon. However, you may reduce your addition by the amount of + related investment expense that you couldn't include in your federal itemized + deductions. See "Interest on state and local government bonds of other states" + in Publication OR-17 for more information. + +[SchA_L18] Enter the total value of the gifts you made in cash or by check, +including unreimbursed out-of-pocket expenses. + +[SchA_L19] Enter the total value of your contributions of property other than by +cash or check. For used items, such as clothing or furniture, you may deduct +their fair market value at the time you donated them. Fair market value is what +a willing buyer would voluntarily pay a willing seller for the item. If the +amount of your deduction is more than $500 (before applying any income limits), +complete federal Form 8283, Noncash Charitable Contributions. Keep a copy of +this form with your Oregon tax records; we may ask for it later. For additional +requirements, see the instructions for Form 8283. + +[SchA_L20] Enter contributions that you couldn't deduct in an earlier year +because they exceeded that year's limits. Your total contributions for this +year, including any carryover amount, can't exceed this year's limits. + +[SchA_L22] List the type and amount of your miscellaneous itemized deductions, +and enter the total on line 22. Don't include employee business expenses, tax +preparation fees, or other deductions subject to the 2 percent of AGI limitation + +[SchA_L22_Type:] List the type and amount of your miscellaneous itemized deductions, +and enter the total on line 22. Don't include employee business expenses, tax +preparation fees, or other deductions subject to the 2 percent of AGI limitation + +[SchASC_A1:] Additions are items the federal government doesn't tax but Oregon +does. For detailed information, see "Additions" in Publication OR-17. Enter the +code and the amount of each addition in Section A. The federal and Oregon +amounts may be different. Use each code only once. See publication OR-CODES for +the list of codes. + +[SchASC_B1:] Subtractions are items the federal government taxes but Oregon +doesn't. Note: You can only subtract amounts that are included in your Oregon +income. Amounts that aren't included in your Oregon income can't be subtracted. +For detailed information, see "Subtractions" in Publication OR-17. Enter the +code and the amount of each subtraction in Section B. The federal and Oregon +amounts may be different, but the amount in the Oregon column can't be more than +the amount in the federal column. Use each code only once. See publication +OR-CODES for the list of codes. See Schedule OR-ASC instructions for common +subtractions, and the Special Oregon medical subtraction worksheet. + +[SchASC_C1:] Tax recaptures increase your tax for the year when you must forfeit +a prior credit. For information about forfeiting a credit, see "Additions to +tax" in Publication OR-17. For recaptures with a code between 950 and 999, +enter the code and the amount of tax you're adding. Use each code only once. See +Schedule OR-ASC instructions for common subtractions, and the Special Oregon +medical subtraction worksheet. See publication OR-CODES for the list of codes. + +[SchASC_D1:] Standard credits are nonrefundable credits that can only be claimed +on the current year's tax return. Credit amounts that aren't used in the current +tax year are lost. If you're also claiming carryforward or refundable credits, +use your standard credits first. + +Step 1: Enter the code and the amount for each credit you're claiming with a +code from 802 through 834. If you're using code 802 or 815 to claim credits for +taxes paid to more than one other state on income that was also taxed by Oregon, +enter each credit on a separate line. Note: The credit for taxes paid to another +state on mutually-taxed income (codes 802 and 815) is for taxpayers who have +mutually taxed income in more than one state. Except for codes 802 and 815, use +each code only once. + +Step 2: If you're claiming a credit for income taxes paid to another state on +mutually-taxed income, enter that state's two-letter postal abbreviation in the +corresponding box. If you aren't claiming this credit, leave the box blank. + +For detailed information, see "Standard credits" in Publication OR-17. See +publication OR-CODES for the list of codes. + +[SchASC_E1:] Carryforward credits are nonrefundable credits for which any unused +portion in the current tax year may be carried forward to the next tax year. The +number of years that a credit may be carried forward varies according to the +carryforward rules of that credit. When we process your return, we'll apply +your credits against your tax in the order in which they're listed on the +schedule. If you're claiming more than one type of carryforward credit and the +total you can use is more than your tax liability for the year, enter your +credits in the order in which they expire. Start with credits that expire +earlier, followed by credits that expire later. List all credits you have +available even if you can't use them this year. For detailed information about +each credit, see "Carryforward credits" in Publication OR-17. See publication +OR-CODES for the list of codes. See Schedule OR-ASC instructions for examples. + +[SchASC_F1:] Like standard credits, refundable credits can be claimed only on +the current year's tax return, but any amount that is more than your tax will be +refunded to you. For detailed information about other refundable credits, see +"Refundable credits" in Publication OR-17. For credits with a code between 890 +and 949, enter the code and the amount you're claiming. Use each code only once. +See publication OR-CODES for the list of codes. diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/OR_40_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/OR_40_meta.dat new file mode 100755 index 0000000..2063160 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/OR_40_meta.dat @@ -0,0 +1,245 @@ +Page 1 + +TxtColor: 0 0 0.6 +FontSz 12 +Typeface Courier +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + +FiscalYearEnd: 62 191 0 14.3 +CkAmended 62 233 +NOLTaxYear: 216 284 0 14.3 +CkCalcAsIfFed 60 324 +CkShortYear 60 361 +CkExtFiled 324 178 +CkFormOR24 324 214 +CkFormOR243 324 251 +CkFedForm8379 324 288 +CkFedForm8886 324 324 +CkDisasterRelief 324 361 +YourFName: 62 467 +YourInit: 447 467 +YourDOB: 513 467 0 14.3 +YourLName: 62 522 +YourSSN: 62 577 0 14.3 +CkYFirstSSN 336 581 +CkYAppITIN 632 581 +CkYDeceased 787 581 +SpouseFName: 62 650 +SpouseInit: 447 650 +SpouseDOB: 513 650 0 14.3 +SpouseLName: 62 706 +SpouseSSN: 62 761 0 14.3 +CkSFirstSSN 336 765 +CkSAppITIN 632 765 +CkSDeceased 787 765 +Address: 62 834 +City: 62 888 +State: 579 888 +Zip: 656 888 0 14.3 +Country: 62 944 +Phone: 579 944 0 14.3 +CkSingle 93 1021 +CkMFJ 236 1021 +CkMFS 445 1021 +CkHH 93 1058 +CkQW 445 1058 +Page 2 +YourLName: 61 192 +YourSSN: 567 192 0 14.3 +L6a 865 284 0 14.3 +CkL6aRegular 258 324 +CkL6aDisabled 368 324 +CkL6aDep 533 324 +L6b 865 357 0 14.3 +CkL6bRegular 258 398 +CkL6bDisabled 368 398 +CkL6bDep 533 398 +Dep1FirstName: 73 541 +Dep1Initial: 369 541 +Dep1LastName: 424 541 +Dep1DOB: 73 595 0 14.3 +Dep1SSN: 314 595 0 14.3 +Dep1Code: 578 595 0 14.3 +CkDep1Dis 654 600 +Dep2FirstName: 73 669 +Dep2Initial: 369 669 +Dep2LastName: 424 669 +Dep2DOB: 73 724 0 14.3 +Dep2SSN: 314 724 0 14.3 +Dep2Code: 578 724 0 14.3 +CkDep2Dis 654 728 +Dep3FirstName: 73 797 +Dep3Initial: 369 797 +Dep3LastName: 424 797 +Dep3DOB: 73 852 0 14.3 +Dep3SSN: 314 852 0 14.3 +Dep3Code: 578 852 0 14.3 +CkDep3Dis 654 856 +L6c 843 925 2 14.3 +L6d 843 980 2 14.3 +L6e 843 1035 2 14.3 +Page 3 +YourLName: 61 192 +YourSSN: 567 192 0 14.3 +L7 579 284 11 14.4 +L8 579 339 11 14.4 +L9 579 393 11 14.4 +L10 579 448 11 14.4 +L11 579 504 11 14.4 +L12 579 559 11 14.4 +L13 579 614 11 14.4 +L14 579 668 11 14.4 +L15 579 724 11 14.4 +L16 579 796 11 14.4 +L17 579 852 11 14.4 +CkL17a 236 893 +CkL17b 379 893 +CkL17c 621 893 +CkL17d 764 893 +L18 579 999 11 14.4 +L19 579 1054 11 14.4 +Page 4 +YourLName: 61 192 +YourSSN: 567 192 0 14.3 +L20 579 284 11 14.4 +CkL20a 127 361 +CkL20b 336 361 +CkL20c 523 361 +L21 579 412 11 14.4 +L22 579 467 11 14.4 +L23 579 522 11 14.4 +L24 579 577 11 14.4 +L25 579 650 11 14.4 +L26 579 705 11 14.4 +L27 579 760 11 14.4 +L28 579 815 11 14.4 +L29 579 870 11 14.4 +L30 579 925 11 14.4 +L31 579 980 11 14.4 +Page 5 +YourLName: 61 192 +YourSSN: 567 192 0 14.3 +L32 579 284 11 14.4 +L33 579 338 11 14.4 +L34 579 412 11 14.4 +L35 579 467 11 14.4 +L36 579 522 11 14.4 +L37 579 577 11 14.4 +L39 579 705 11 14.4 +L40 579 760 11 14.4 +L41 579 833 11 14.4 +L42 579 888 11 14.4 +L43 579 943 11 14.4 +L44 579 998 11 14.4 +L44a 380 1054 0 14.4 +CkL44b 643 1058 +Page 6 +YourLName: 61 192 +YourSSN: 567 192 0 14.3 +L45 579 284 11 14.4 +L46 579 339 11 14.4 +L47 579 394 11 14.4 +L48 579 449 11 14.4 +L49 579 504 11 14.4 +L50 579 559 11 14.4 +L50a: 281 614 3 14.4 +L50b: 480 613 3 14.4 +L51 579 650 11 14.4 +L52 579 705 11 14.4 +L53 579 760 11 14.4 +CkL54DepOutUS 786 820 +CkAcctChecking 94 893 +CkAcctSavings 94 930 +AcctRoutingNumber: 271 925 9 14.4 +AcctNumber: 513 925 17 14.4 +Page 7 +YourLName: 61 192 +YourSSN: 567 192 0 14.3 +Page 8 +YourLName: 61 192 +YourSSN: 567 192 0 14.3 +! OR-A Itemized Deductions +Page 9 +YourLName: 62 191 +YourSSN: 62 246 0 14.3 +SchA_L1 579 375 11 14.4 +SchA_L2 579 430 11 14.4 +SchA_L3 579 485 11 14.4 +SchA_L4 579 540 11 14.4 +SchA_L5 579 632 11 14.4 +SchA_L6 579 687 11 14.4 +SchA_L7 579 742 11 14.4 +SchA_L9 579 852 11 14.4 +SchA_L10 579 907 11 14.4 +SchA_L10_Type: 94 963 +SchA_L11 579 998 11 14.4 +Page 10 +SchA_L12 579 210 11 14.4 +SchA_L13 579 265 11 14.4 +SchA_L14 579 320 11 14.4 +SchA_L16 579 430 11 14.4 +SchA_L17 579 485 11 14.4 +SchA_L18 579 577 11 14.4 +SchA_L19 579 632 11 14.4 +SchA_L20 579 687 11 14.4 +SchA_L21 579 742 11 14.4 +SchA_L22 579 870 11 14.4 +SchA_L22_Type: 94 926 +SchA_L23 579 1035 11 14.4 +! OR-ASC Oregon Adjustments +Page 11 +YourLName: 62 283 +YourSSN: 62 338 0 14.3 +SchASC_A1: 359 411 3 14.4 +SchASC_A2 513 411 14 14.4 +SchASC_A3: 359 466 3 14.4 +SchASC_A4 513 466 14 14.4 +SchASC_A5 513 540 14 14.4 +SchASC_B1: 359 613 3 14.4 +SchASC_B2 513 613 14 14.4 +SchASC_B3: 359 668 3 14.4 +SchASC_B4 513 668 14 14.4 +SchASC_B5: 359 723 3 14.4 +SchASC_B6 513 723 14 14.4 +SchASC_B7 513 796 14 14.4 +SchASC_C1: 359 870 3 14.4 +SchASC_C2 513 870 14 14.4 +SchASC_C3: 359 925 3 14.4 +SchASC_C4 513 925 14 14.4 +SchASC_C5 513 999 14 14.4 +Page 12 +SchASC_D1: 249 265 3 14.4 +SchASC_D2: 392 265 0 14.3 +SchASC_D3 513 265 14 14.4 +SchASC_D4: 249 320 3 14.4 +SchASC_D5: 392 320 0 14.3 +SchASC_D6 513 320 14 14.4 +SchASC_D7: 249 375 3 14.4 +SchASC_D8: 392 375 0 14.3 +SchASC_D9 513 375 14 14.4 +SchASC_D10: 249 430 3 14.4 +SchASC_D11: 392 430 0 14.3 +SchASC_D12 513 430 14 14.4 +SchASC_D13: 249 485 3 14.4 +SchASC_D14: 392 485 0 14.3 +SchASC_D15 513 485 14 14.4 +SchASC_D16 513 558 14 14.4 +SchASC_E1: 359 650 3 14.4 +SchASC_E2 513 650 14 14.4 +SchASC_E3 513 705 14 14.4 +SchASC_E4 513 760 14 14.4 +SchASC_E5: 359 833 3 14.4 +SchASC_E6 513 833 14 14.4 +SchASC_E7 513 888 14 14.4 +SchASC_E8 513 943 14 14.4 +SchASC_E9 513 1016 14 14.4 +Page 13 +SchASC_F1: 359 228 3 14.4 +SchASC_F2 513 228 14 14.4 +SchASC_F3: 359 283 3 14.4 +SchASC_F4 513 283 14 14.4 +SchASC_F5: 359 338 3 14.4 +SchASC_F6 513 338 14 14.4 +SchASC_F7 513 411 14 14.4 + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/OR_40_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/OR_40_pdf.dat new file mode 100755 index 0000000..7294d06 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/OR_40_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/PA_40_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/PA_40_meta.dat new file mode 100755 index 0000000..55b1383 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/PA_40_meta.dat @@ -0,0 +1,87 @@ +Page 1 + +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + +FontSz 10 +no_zero_entries +round_to_whole_numbers +solid_status_check 11 4 20 . + + YourSocSec#: 122 194 0 12 + SpouseSocSec#: 360 194 0 12 + YourLastName: 116 259 + Your1stName: 116 305 + MidInitial: 484 305 + Spouse1stName: 116 354 + SpouseMidInit: 484 354 + SpouseLastName: 116 401 + + Number&Street: 116 451 0 + Town: 116 550 0 + State: 440 550 0 + Zipcode: 510 550 0 13 + + Check_R_PennResident 652 225 0 + Check_N_NonResident 652 243 0 + Check_P_PartYrResid 652 259 0 + + Check_single 652 315 0 + Check_mfj 652 333 0 + Check_sep 652 349 0 + + Phone: 116 598 0 11 + SchoolCode: 510 598 0 11 + SchooldDist: 735 579 + YourOccupation: 650 617 + SpouseOccupat: 752 617 + + L1a 655 654 12 + L1b 655 686 12 + L1c 655 718 12 + L2 655 750 12 + L3 655 782 12 + L4 655 816 12 + Check_4Loss 573 820 + Check_5Loss 573 853 + Check_6Loss 573 887 + L5 655 852 12 + L6 655 886 12 + L7 655 919 12 + L8 655 951 12 + L9 655 983 12 + L10 655 1016 12 + L11 655 1048 12 + + +Page 2 +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + + YourSocSec#: 196 120 0 12 + YourNames: 465 120 0 + + L12 662 154 12 + L13 662 188 12 + L14 662 222 12 + L15 662 254 12 + L16 662 285 12 + L17 662 318 12 + L18 662 350 12 + L20 455 418 12 + L21 662 452 12 + L22 662 486 12 + L23 662 517 12 + L24 662 551 12 + L25 662 583 12 + L26 662 614 12 + L27 662 647 12 + L28 662 680 12 + L29 662 714 12 + L30 662 747 12 + L31 662 781 12 + L32 662 814 12 + L33 662 846 12 + L34 662 879 12 + L35 662 913 12 + L36 662 946 12 diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/PA_40_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/PA_40_pdf.dat new file mode 100755 index 0000000..a3a8656 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/PA_40_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/VA_760_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/VA_760_meta.dat new file mode 100755 index 0000000..bc0510e --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/VA_760_meta.dat @@ -0,0 +1,95 @@ +Page 1 + +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + +FontSz 10 +no_zero_entries +no_commas +round_to_whole_numbers + + Your1stName: 80 149 0 + YourMI: 273 149 0 + YourLastName: 318 149 0 + YourSocSec#: 560 156 0 14.6 + Y1st4: 786 156 0 14.6 + YourDOB: 560 246 0 14.6 + YourDrivLic: 490 368 0 14.6 + YourDLdate: 705 368 0 14.6 + + Spouse1stName: 80 193 0 + SpouseMI: 273 193 0 + SpouseLastName: 318 193 0 + SpouseSocSec#: 560 191 0 14.6 + S1st4: 786 191 0 14.6 + SpouseDOB: 560 281 0 14.6 + SpouseDrivLic: 490 402 0 14.6 + SpouseDLdate: 705 402 0 14.6 + + Number&Street: 80 238 0 + Town: 80 281 0 + State: 319 281 0 + Zipcode: 420 281 0 10 + + FilingStatus: 71 516 0 + ExmpSpouse: 592 476 + ExmpDeps: 666 476 + NExemptionsA 732 476 + ExemptionsA 820 476 + YouOver65 542 533 + SpouseOver65 595 533 + YouBlind 645 533 + SpouseBlind 689 533 + NExemptionsB 732 533 + ExemptionsB 820 533 + + L1 655 586 9 14.5 + L2 655 624 9 14.5 + L3 655 659 9 14.5 + L4 655 703 9 14.5 + YourAgeDed 143 710 5 14.5 + SpouseAgeDed 400 710 5 14.5 + L5 655 740 9 14.5 + L6 655 776 9 14.5 + L7 655 815 9 14.5 + L8 655 851 9 14.5 + L9 655 890 9 14.5 + L10 655 927 9 14.5 + L11 655 963 9 14.5 + L12 655 1005 9 14.5 + L13 655 1040 9 14.5 + L14 655 1080 9 14.5 + L15 655 1115 9 14.5 + + +Page 2 +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + + YourSocSec#: 643 79 0 14.6 + L16 643 117 9 14.5 + STA_VAGI 354 158 9 13.5 + L17 643 158 9 14.5 + L18 643 197 9 14.5 + L19a 643 235 9 14.5 + L19b 643 270 9 14.5 + L20 643 304 9 14.5 + L21 643 340 9 14.5 + L22 643 376 9 14.5 + L23 643 413 9 14.5 + L24 643 452 9 14.5 + + L25 643 490 9 14.5 + L26 643 526 9 14.5 + + L27 643 563 9 14.5 + L28 643 603 9 14.5 + L29 643 640 9 14.5 + L30 643 678 9 14.5 + L31 643 714 9 14.5 + L32 643 751 9 14.5 + L33 643 792 9 14.5 + L34 643 828 9 14.5 + L35 643 866 9 14.5 + L36 643 904 9 14.5 + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/VA_760_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/VA_760_pdf.dat new file mode 100755 index 0000000..256146a Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/VA_760_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040_instructions.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040_instructions.dat new file mode 100755 index 0000000..0b384da --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040_instructions.dat @@ -0,0 +1,538 @@ +Instructions: +[L1] Wages, Salaries, Tips, etc. + +Enter the total of your wages, salaries, +tips, etc. If a joint return, also include +your spouse's income. For most people, +the amount to enter on this line should +be shown in box 1 of your Form(s) W-2. +But the following types of income also +must be included in the total on line 1. +- All wages received as a household employee. +- Any Medicaid waiver payments you received +that you choose to include in earned income +for purposes of claiming a credit or other +tax benefit, even if you didn't receive a +Form W-2 reporting these payments. +- Tip income you didn't report to +your employer. This should include any +allocated tips shown in box 8 on your +Form(s) W-2 unless you can prove that +your unreported tips are less than the +amount in box 8. Allocated tips aren't in- +cluded as income in box 1. Also include the value +of any noncash tips you received, such +as tickets, passes, or other items of val- +ue. Although you don't report these non- +cash tips to your employer, you must re- +port them on line 1. +- Dependent care benefits, which +should be shown in box 10 of your +Form(s) W-2. But first complete Form +2441 to see if you can exclude part or all +of the benefits. +- Employer-provided adoption bene- +fits, which should be shown in box 12 of +your Form(s) W-2 with code T +- Scholarship and fellowship grants +not reported on Form W-2. +- Excess elective deferrals. The +amount deferred should be shown in +box 12 of your Form W-2, and the "Re- +tirement plan" box in box 13 should be +checked. +- Disability pensions shown on +Form 1099-R if you haven't reached the +minimum retirement age set by your em- +ployer. +- Corrective distributions from a re- +tirement plan shown on Form 1099-R of +excess elective deferrals and excess con- +tributions (plus earnings). +- Wages from Form 8919, line 6. + +[L2a] Tax-Exempt Interest + +If you received any tax-exempt interest +(including any tax-exempt original issue +discount (OID)), such as from municipal +bonds, each payer should send you a +Form 1099-INT or a Form 1099-OID. In +general, your tax-exempt stated interest +should be shown in box 8 of Form +1099-INT or, for a tax-exempt OID +bond, in box 2 of Form 1099-OID and +your tax-exempt OID should be shown +in box 11 of Form 1099-OID. + +Also include on line 2a any exempt-interest +dividends from a mutual fund or other +regulated investment company. This amount +will be seen in box 11 of Form 1099-DIV. + +Do not include interest earned on your +IRA, health savings account, Archer or +Medicare Advantage MSA, or Coverdell +education savings account. + +[L2b] Taxable Interest + +Each payer should send you a Form 1099-INT +or Form 1099-OID. Enter your total taxable +interest income on this line 2b. + +[L3a] Qualified Dividends + +Enter your total qualified dividends on +line 3a. Qualified dividends also are in- +cluded in the ordinary dividend total re- +quired to be shown on line 3b. Qualified +dividends are eligible for a lower tax +rate than other ordinary income. Gener- +ally, these dividends are shown in +box 1b of Form(s) 1099-DIV. + +[L3b] Ordinary Dividends + +Each payer should send you a Form +1099-DIV. Enter your total ordinary div- +idends on line 3b. This amount should +be shown in box 1a of Form(s) +1099-DIV. + +You must fill in and attach Schedule B +if the total is over $1,500 or you +received, as a nominee, ordinary dividends +that actually belong to someone else. + +Nondividend Distributions +Some distributions are a return of your +cost (or other basis). They won't be +taxed until you recover your cost (or +other basis). You must reduce your cost +(or other basis) by these distributions + +[L4a] You should receive a Form 1099-R +showing the total amount of any distri- +bution from your IRA before income tax +or other deductions were withheld. This +amount should be shown in box 1 of +Form 1099-R. Unless otherwise noted in +the line 4a and 4b instructions, an IRA +includes a traditional IRA, Roth IRA, +simplified employee pension (SEP) +IRA, and a savings incentive match plan +for employees (SIMPLE) IRA. Except +as provided next, leave line 4a blank and +enter the total distribution (from Form +1099-R, box 1) on line 4b. +Exception 1. Enter the total distribution +on line 4a if you rolled over part or all of +the distribution from one: +# Roth IRA to another Roth IRA, or +# IRA (other than a Roth IRA) to a +qualified plan or another IRA (other +than a Roth IRA). + +(See instructions for more exceptions 2-4.) + +[L4b] If you (and/or your spouse) +received IRA distributions, figure the +taxable amount of each distribution and +enter the taxable amounts on line 4b. +But enter the amounts of those +distributions on line 4a. + +[QCD] If part, or all, of your L4b went to +Qualified Charitable Distributions, set QCD +to "Yes". Otherwise leave QCD as "No". + +[L5a] Pensions and Annuities + +You should receive a Form 1099-R +showing the total amount of your pension +and annuity payments before income +tax or other deductions were with-held. +This amount should be shown in +box 1 of Form 1099-R. Pension and an- +nuity payments include distributions +from 401(k), 403(b), and governmental +457(b) plans. Don't include the following +payments on lines 4c and 4d. +Instead, report them on line 1. +# Disability pensions received before +you reach the minimum retirement age +set by your employer. +# Corrective distributions (including +any earnings) of excess elective defer- +rals or other excess contributions to re- +tirement plans. The plan must advise +you of the year(s) the distributions are +includible in income. + +[L5b] Taxable Pensions and Annuities + +Your payments are fully taxable if (a) +you didn't contribute to the cost (see +Cost, later) of your pension or annuity, +or (b) you got your entire cost back tax +free before 2021. But see Insurance Pre- +miums for Retired Public Safety Offi- +cers, later. If your pension or annuity is +fully taxable, enter the total pension or +annuity payments (from Form(s) +1099-R, box 1) on line 5b; don't make +an entry on line 5a. + +Fully taxable pensions and annuities +also include military retirement pay +shown on Form 1099-R. For details on +military disability pensions, see Pub. +525. If you received a Form +RRB-1099-R, see Pub. 575 to find out +how to report your benefits. + + +[L6b] Taxable Pensions and Annuities + +Enter the pension or annuity payments +from Form(s) 1099-R, box 1 on line 4d. + +Your payments are fully taxable if (a) +you didn't contribute to the cost (see +Cost, later) of your pension or annuity, +or (b) you got your entire cost back tax +free before 2021. But see Insurance Pre- +miums for Retired Public Safety Offi- +cers, later. If your pension or annuity is +fully taxable, enter the total pension or +annuity payments (from Form(s) +1099-R, box 1) on line 4d; don't make +an entry on line 4c. +Fully taxable pensions and annuities +also include military retirement pay +shown on Form 1099-R. For details on +military disability pensions, see Pub. +525. If you received a Form +RRB-1099-R, see Pub. 575 to find out +how to report your benefits. + +(See instructions pages 25-27 for more information.) + +[L6a] Social Security Benefits + +You should receive a Form SSA-1099 +showing in box 3 the total social securi- +ty benefits paid to you. Box 4 will show +the amount of any benefits you repaid in +2021. If you received railroad retirement +benefits treated as social security, you +should receive a Form RRB-1099. + +(See instructions page 27 for more information.) + +[L13] Qualified Business Income Deduction +(Section 199A Deduction) + +To figure your Qualified Business In- +come Deduction, use Form 8995 or +Form 8995-A as applicable. +Use Form 8995 if: +# You have qualified business in- +come, qualified REIT dividends, or +qualified PTP income (loss), +# Your 2021 taxable income before +the qualified business income deduction +is less than or equal to $160,900 +($160,925 if married filing separately or +$329,800 if married filing jointly), and +# You aren't a patron in a specified +agricultural or horticultural cooperative. +If you don't meet these requirements, +use Form 8995-A, Qualified Business +Income Deduction. See the instructions +for Forms 8995 and 8995-A, for more +information for figuring and reporting +your qualified business income deduc- +tion. + +[L19] Child Tax Credit and Credit +for Other Dependents + +Form 8862, who must file. You must +file Form 8862 to claim the child tax +credit or credit for other dependents if +your child tax credit or additional child +tax credit for a year after 2015 was de- +nied or reduced for any reason other +than a math or clerical error. Attach a +completed Form 8862 to your 2021 re- +turn. Don't file Form 8862 if you filed +Form 8862 for 2018 and the child tax +credit or additional child tax credit was +allowed for that year. See Form 8862 +and its instructions for details. + +(See instructions pages 34-36 for more information.) + +[L25a] Federal Income Tax Withheld - Form(s) W-2 + +Enter the amounts shown as federal income tax +withheld on your Form(s) W-2. The amounts withheld +should be shown in box 2 of Form W-2. Attach your +Form(s) W-2 to your return. + +[L25b] Federal Income Tax Withheld - Form(s) 1099 + +Include on line 25b any federal income +tax withheld on your Form(s) 1099-R. +The amount withheld should be shown +in box 4. Attach your Form(s) 1099-R to +the front of your return if federal income +tax was withheld. + +If you received a 2021 Form 1099 +showing federal income tax withheld on +dividends, taxable or tax-exempt interest +income, unemployment compensation, +social security benefits, railroad retire- +ment benefits, or other income you re- +ceived, include the amount withheld in +the total on line 25b. This should be +shown in box 4 of Form 1099, box 6 of +Form SSA-1099, or box 10 of Form +RRB-1099. + +[L25c] Federal Income Tax Withheld - Other Forms + +Include on line 25c any federal income +tax withheld on your Form(s) W-2G. +The amount withheld should be shown +in box 4. Attach Form(s) W-2G to the +front of your return if federal income tax +was withheld. + +If you had Additional Medicare Tax +withheld, include the amount shown on +Form 8959, line 24, in the total on +line 25c. Attach Form 8959. + +Include on line 25c any federal in- +come tax withheld that is shown on a +Schedule K-1. + +Also include on line 25c any tax +withheld that is shown on Form 1042-S, +Form 8805, or Form 8288-A. You +should attach the form to your return to +claim a credit for the withholding. + +[L26] Estimated Tax Payments + +Enter any estimated federal income tax +payments you made for 2021. Include +any overpayment that you applied to +your 2021 estimated tax from: + - Your 2021 return, or + - An amended return (Form 1040-X). + +[L27] Earned Income Credit (EIC) + +The EIC is a credit for certain people who work. The credit may +give you a refund even if you don't owe any tax or didn't have +any tax withheld. + +To Take the EIC: +# Follow the steps on pages 38 - 54 of the Instructions Booklet. +# Complete the worksheet that applies to you. +# If you have a qualifying child, complete and attach Schedule EIC. + +If your are filing as Married/Sep, review IRS instructions about restrictions. + +[L28] Additional Child Tax Credit + +This credit is for certain people who +have at least one qualifying child for the +child tax credit (as defined in Steps 1, 2, +and 3 in the Who Qualifies as Your Dependent +section). The additional child tax credit may give +you a refund even if you don't owe any tax or didn't +have any tax withheld. + +(See instructions page 55 for more information.) + +[L29] American Opportunity Credit + +If you meet the requirements to claim an +education credit (see the instructions for +Schedule 3, line 3), enter the amount, +if any, from Form 8863, line 8. +You may be able to increase an educa- +tion credit and reduce your total tax or +increase your tax refund if the student +chooses to include all or part of a Pell +grant or certain other scholarships or fel- +lowships in income. See Pub. 970 and +the Instructions for Form 8863 for more +information. + +(See instructions page 55 for more information.) + +[L30] Recovery Rebate Credit + +The recovery rebate credit was paid out +to eligible individuals in two rounds of +advance payments called economic im- +pact payments. The economic impact +payments were based on your 2018 or +2021 tax year information. The recovery +rebate credit is figured like the economic +impact payments except that the credit +eligibility and the credit amount are +based on your 2021 tax year informa- +tion. If you didn't receive the full +amount of the recovery rebate credit as +economic impact payments, you may be +able to claim the recovery rebate credit +on your 2021 Form 1040 or 1040-SR. + +Generally, you are eligible to claim +the recovery rebate credit if in 2021 you +were a U.S. citizen or U.S. resident ali- +en, weren't a dependent of another tax- +payer, and have a valid social security +number. This includes someone who +died in 2021, if you are preparing a re- +turn for that person. Use the Recovery +Rebate Credit Worksheet to figure the +credit, if any, you can claim. For more +information on the recovery rebate cred- +it, go to IRS.gov/RRC. + +[L38] Estimated Tax Penalty + +You may owe this penalty if: + - Line 37 is at least $1,000 and it is +more than 10% of the tax shown on your +return, or + - You didn't pay enough estimated +tax by any of the due dates. This is true +even if you are due a refund. +For most people, the "tax shown on +your return" is the amount on your 2021 +Form 1040 or 1040-SR, line 24, minus +the total of any amounts shown on lines +27, 28, 29, and 30; Schedule 3, lines 8 +and 11; and Forms 7202 (lines 24 and +35), 8828, 4137, 5329 (Parts III through +IX only), 8885, and 8919. + +Exception: You won't owe the penalty +if your 2021 tax return was for a tax +year of 12 full months and either of the +following applies. + 1. You had no tax shown on your + 2021 return and you were a U.S. citizen + or resident for all of 2021. + 2. The total of lines 25d, 26, and + Schedule 3, line 10, on your 2021 return + is at least 100% of the tax shown on + your 2021 return (110% of that amount + if you aren't a farmer or fisherman, and + your adjusted gross income (AGI) + shown on your 2021 return was more + than $150,000 (more than $75,000 if + married filing separately for 2021)). + Your estimated tax payments for 2021 + must have been made on time and for + the required amount. + +[A9] Investment Interest + +Investment interest is interest paid on +money you borrowed that is allocable to +property held for investment. It doesn't +include any interest allocable to passive +activities or to securities that generate +tax-exempt income. +Complete and attach Form 4952 to +figure your deduction. +Exception. You don't have to file Form +4952 if all three of the following apply. +1. Your investment interest expense +is less than your investment income +from interest and ordinary dividends mi- +nus any qualified dividends. +2. You have no other deductible in- +vestment expenses. +3. You have no disallowed invest- +ment interest expense from 2018. + +[CharityCC] Gifts to Charity by Cash or Check + +You can deduct contributions or gifts +you gave to organizations that are religious, +charitable, educational, scientific, +or literary in purpose. You can also deduct +what you gave to organizations that +work to prevent cruelty to children or +animals. Certain whaling captains may +be able to deduct expenses paid in 2021 +for Native Alaskan subsistence bowhead +whale hunting activities. See Pub. 526 +for details. +To verify an organization's charitable +status, you can: +# Check with the organization to + which you made the donation. The organization + should be able to provide you with + verification of its charitable status. +# Use IRS's online search tool at + IRS.gov/TEOS to see if an organization + is eligible to receive tax-deductible + contributions (Publication 78 data). + +[CharityOT] Gifts to Charity OTHER THAN cash or check + +Enter the total value of your Charity +Donatations by property other than cash +or check, unless a limit on deducting +gifts applies to you. If your deduction +is limited, you may have a carryover to +next year. See Publication 526 for more +information. + +If you donated used items, such as clothing +or furniture, deduct their fair market value +at the time you gave them. Fair market value +is what a willing buyer would pay a willing +seller when neither has to buy or sell and +both are aware of the conditions of the sale. +For more details on determining the value of +donated property, see Pub. 561. +If the amount of your deduction is more than +$500, you must complete and attach Form 8283. + +[CharityCO] CARRY OVER Gifts to Charity from last year + +You may have contributions that you +couldn't deduct in an earlier year because +they exceeded the limits on the +amount you could deduct. In most cases, +you have 5 years to use contributions +that were limited in an earlier year. The +same limits apply this year to your carryover +amounts as applied to those amounts in the +earlier year. After applying those limits, +enter the amount of your carryover that you are +allowed to deduct this year. +See Publication 526 for details. + +[A18] Elect to Itemize Check-Box + +Normally leave this as "No". + +Only select "Y" if you want to force itemzation +even when it will be less than your standard deduction. +There are certain rare situations when this is beneficial +due to state taxes, etc. diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040_meta.dat new file mode 100755 index 0000000..219f2ba --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040_meta.dat @@ -0,0 +1,955 @@ +Page 1 + + TxtColor: 0 0 0.6 + + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + no_zero_entries +! round_to_whole_numbers + + + Your1stName: 83 147 + YourLastName: 370 147 + YourSocSec#: 730 147 0 6.5 + Spouse1stName: 83 184 + SpouseLastName: 370 184 + SpouseSocSec#: 730 184 0 6.5 +! CkHealthCoverage 721 217 + Number&Street: 83 221 + Apt#: 642 221 + Town/City: 83 258 + State: 530 258 + ZipCode: 630 258 + + CkSingle 158 317 + CkMFJ 158 335 + CkMFS 158 354 + CkHH 542 317 + CkQW 542 353 + + CkNonRes 158 409 + ChkVirtYes 770 470 + ChkVirtNo 825 470 + ChkYouDep 277 490 + ChkSpouseDep 432 490 + ChkSpouseSep 146 507 + + CkYouOver65 179 534 + CkYouBlind 399 534 + CkSpouseOver65 553 534 + CkSpouseBlind 773 534 + +Dep1_FirstName: 144 591 +Dep1_LastName: 278 591 +Dep2_FirstName: 144 609 +Dep2_LastName: 278 609 +Dep3_FirstName: 144 627 +Dep3_LastName: 278 627 +Dep4_FirstName: 144 646 +Dep4_LastName: 278 646 +Dep1_SocSec#: 410 591 0 8.7 +Dep2_SocSec#: 410 606 0 8.7 +Dep3_SocSec#: 410 628 0 8.7 +Dep4_SocSec#: 410 646 0 8.7 +Dep1_Relation: 544 591 +Dep2_Relation: 544 609 +Dep3_Relation: 544 627 +Dep4_Relation: 544 646 +CkDep1_ChildTxCrd: 692 590 +CkDep1_CrdOtherDep: 813 590 +CkDep2_ChildTxCrd: 692 608 +CkDep2_CrdOtherDep: 813 608 +CkDep3_ChildTxCrd: 692 626 +CkDep3_CrdOtherDep: 813 626 +CkDep4_ChildTxCrd: 692 645 +CkDep4_CrdOtherDep: 813 645 +CkMoreThan4Dep: 122 644 + +ForeignCntry 83 295 +ForeignState 410 295 +ForeignPostCd 630 295 + + L1a 770 664 12 + L1b 770 682 12 + L1c 770 700 12 + L1d 770 719 12 + L1e 770 738 12 + L1f 770 756 12 + L1g 770 774 12 + L1h 770 792 12 + L1i 628 811 12 + L1z 770 829 12 + + L2a 388 847 12 + L2b 770 847 12 + L3a 388 866 12 + L3b 770 866 12 + + L4a 388 884 12 + L4b 770 884 12 + QCD 875 884 + L5a 388 902 12 + L5b 770 902 12 + L6a 388 922 12 + L6b 770 922 12 + + L7 772 957 12 + L8 772 976 12 + L9 772 994 12 + L10 772 1013 12 + L11 772 1032 12 + L12 772 1049 12 + L13 772 1067 12 + L14 772 1087 12 + L15 772 1105 12 + + +Page 2 + + L16 771 68 12 + L17 771 86 12 + L18 771 105 12 + L19 771 123 12 + L20 771 141 12 + L21 771 160 12 + showevenifzero L22 + L22 771 179 12 + L23 771 197 12 + L24 771 215 12 + + L25a 626 253 12 + L25b 626 270 12 + L25c 626 290 12 + L25d 771 307 12 + L26 771 326 12 + L27 626 345 12 + L28 626 363 12 + L29 626 381 12 + L31 626 417 12 + + L32 771 436 12 + L33 771 454 12 + L34 771 473 12 + L35a 771 491 12 + CkL35aRef 710 491 + L36 626 546 12 + L37 771 580 12 + L38 626 602 12 + + ! Routing + Account Numbers + L35b: 267 506 0 14.5 + CkL35cChecking 577 509 + CkL35cSavings 664 509 + L35d: 267 526 0 14.5 + + PIN_3rdParty: 776 664 0 14.1 + PIN_Your: 775 748 0 12.0 + PIN_Spouse: 775 794 0 12.0 + + Ck3rdPartyYes 626 635 + Ck3rdPartyNo 780 635 + + YourOccupat: 505 744 + SpouseOccupat: 505 790 + + +Page 3 + YourNames: 92 156 + YourSocSec#: 720 156 + no_zero_entries + S1_1099K_err 770 195 + S1_1 778 277 12 + S1_2a 778 295 12 + S1_2b: 606 315 12 + S1_3 778 333 12 + S1_4 778 352 12 + S1_5 778 369 12 + S1_6 778 387 12 + S1_7 778 406 12 + display_without_sign S1_8a + S1_8a 625 442 12 + S1_8b 625 461 12 + S1_8c 625 479 12 + display_without_sign S1_8d + S1_8d 625 497 12 + S1_8e 625 516 12 + S1_8f 625 534 12 + S1_8g 625 552 12 + S1_8h 625 570 12 + S1_8i 625 589 12 + S1_8j 625 607 12 + S1_8k 625 627 12 + S1_8l 625 663 12 + + S1_8m 625 682 12 + + S1_8n 625 702 12 + S1_8o 625 719 12 + S1_8p 625 736 12 + S1_8q 625 754 12 + S1_8r 625 772 12 + + display_without_sign S1_8s + S1_8s 625 811 12 + S1_8t 625 835 12 + S1_8u 625 865 12 + S1_8v 625 901 12 + + S1_8z 625 940 12 + S1_8z_Type: 115 940 + S1_9 778 956 12 + S1_10 778 993 12 + +Page 4 + S1_11 776 104 12 + S1_12 776 141 12 + S1_13 776 159 12 + S1_14 776 177 12 + S1_15 776 196 12 + S1_16 776 215 12 + S1_17 776 232 12 + S1_18 776 250 12 + S1_19a 776 270 12 + + AlimRecipSSN: 617 288 0 8 + DivorceDate: 612 307 8 + + S1_20 776 324 12 + S1_21 776 344 12 + S1_23 776 381 12 + + S1_24a 625 415 12 + S1_24b 625 453 12 + S1_24c 625 489 12 + S1_24d 625 507 12 + S1_24e 625 544 12 + S1_24f 625 563 12 + S1_24g 625 582 12 + S1_24h 625 619 12 + + S1_24i 625 654 12 + S1_24j 625 672 12 + S1_24k 625 690 12 + S1_24z 625 728 12 + S1_24z_Type: 110 726 + + S1_25 776 745 12 + S1_26 776 783 12 + + +Page 5 + YourNames: 92 157 + YourSocSec#: 720 157 + no_zero_entries + S2_1a 625 230 12 + S2_1b 625 295 12 + S2_1c 625 358 12 + S2_1d 625 386 12 + S2_1e 625 468 12 + S2_1f 625 552 12 + S2_1y 625 579 12 + + S2_1z 778 609 12 + S2_2 778 637 12 + S2_3 778 662 12 + + S2_4 778 708 12 + S2_5 625 738 12 + S2_6 625 763 12 + S2_7 778 791 12 + S2_8 778 838 12 + S2_9 778 865 12 + S2_10 778 891 12 + S2_11 778 918 12 + S2_12 778 946 12 + S2_13 778 994 12 + S2_14 778 1020 12 + S2_15 778 1048 12 + S2_16 778 1075 12 + +Page 6 + S2_17a 625 156 12 + S2_17a_Type: 172 160 + S2_17b 625 185 12 + S2_17c 625 211 12 + S2_17d 625 259 12 + S2_17e 625 287 12 + S2_17f 625 316 12 + S2_17g 625 361 12 + S2_17h 625 405 12 + S2_17i 625 451 12 + S2_17j 625 477 12 + S2_17k 625 505 12 + S2_17l 625 532 12 + S2_17m 625 562 12 + S2_17n 625 591 12 + S2_17o 625 637 12 + S2_17p 625 683 12 + S2_17q 625 710 12 + S2_17z 625 754 12 + S2_17z_Type: 121 754 + S2_18 775 782 12 + S2_19 775 809 12 + S2_20 625 838 12 + S2_21 775 884 12 + + +Page 7 + YourNames: 92 157 + YourSocSec#: 720 157 + S3_1 778 195 12 + S3_2 778 213 12 + S3_3 778 230 12 + S3_4 778 250 12 + S3_5a 778 270 12 + S3_5b 778 288 12 + + S3_6a 625 325 12 + S3_6b 625 343 12 + S3_6c 625 361 12 + S3_6d 625 381 12 +! S3_6e 625 537 12 + S3_6f 625 417 12 + S3_6g 625 434 12 + S3_6h 625 453 12 + S3_6i 625 472 12 + S3_6j 625 490 12 + S3_6k 625 508 12 + S3_6l 625 527 12 + S3_6m 625 545 12 + S3_6z 625 582 12 + S3_6z_Type: 110 580 + + S3_7 778 600 12 + S3_8 778 620 12 + + S3_9 778 655 12 + S3_10 778 671 12 + S3_11 778 691 12 + S3_12 778 711 12 + S3_13a 625 748 12 + S3_13b 625 785 12 + S3_13c 625 802 12 + S3_13d 625 822 12 + S3_13z 625 858 12 + OtherRefundCred 117 858 + S3_14 778 877 12 + S3_15 778 895 12 + + +Page 8 + YourNames: 92 156 + YourSocSec#: 740 156 + A1 641 196 12 + A2 509 216 12 + A3 641 235 12 + A4 775 252 12 + A5a 641 345 12 + CheckBoxA5a 594 345 + A5b 641 362 12 + A5c 641 381 12 + A5d 641 398 12 + A5e 641 435 12 + A6 641 472 12 + A7 775 490 12 + A8a 641 583 12 + A8b 641 692 12 + A8c 641 729 12 + ! A8d 641 748 12 + A8e 641 767 12 + A9 641 785 12 + A10 775 802 12 + A11 641 840 12 + A12 641 877 12 + A13 641 895 12 + A14 775 912 12 + A15 775 967 12 + A16 775 1022 12 + A17 775 1060 12 + CheckBoxA18 724 1095 + + +Page 9 + YourNames: 92 156 + YourSocSec#: 746 156 + + B1_1_Text: 223 233 + B1_2_Text: 223 252 + B1_3_Text: 223 270 + B1_4_Text: 223 288 + B1_5_Text: 223 306 + B1_6_Text: 223 324 + B1_7_Text: 223 343 + B1_8_Text: 223 361 + B1_9_Text: 223 379 + B1_10_Text: 223 398 + B1_11_Text: 223 415 + B1_12_Text: 223 434 + B1_13_Text: 223 452 + B1_14_Text: 223 471 + + B1_1 775 233 12 + B1_2 775 252 12 + B1_3 775 270 12 + B1_4 775 288 12 + B1_5 775 306 12 + B1_6 775 324 12 + B1_7 775 343 12 + B1_8 775 361 12 + B1_9 775 379 12 + B1_10 775 398 12 + B1_11 775 415 12 + B1_12 775 434 12 + B1_13 775 452 12 + B1_14 775 471 12 + B2 775 490 12 + B3 775 525 12 + B4 775 545 12 + + B5_1_Text: 326 583 + B5_2_Text: 223 602 + B5_3_Text: 223 620 + B5_4_Text: 223 638 + B5_5_Text: 223 656 + B5_6_Text: 223 675 + B5_7_Text: 223 692 + B5_8_Text: 223 710 + B5_9_Text: 223 728 + B5_10_Text: 223 747 + B5_11_Text: 223 765 + B5_12_Text: 223 783 + B5_13_Text: 223 800 + B5_14_Text: 223 820 + B5_15_Text: 223 838 + + B5_1 775 583 12 + B5_2 775 602 12 + B5_3 775 620 12 + B5_4 775 638 12 + B5_5 775 656 12 + B5_6 775 675 12 + B5_7 775 692 12 + B5_8 775 710 12 + B5_9 775 728 12 + B5_10 775 747 12 + B5_11 775 765 12 + B5_12 775 782 12 + B5_13 775 800 12 + B5_14 775 820 12 + B5_15 775 838 12 + B6 775 856 12 + + CkB7a_Y 822 1004 + CkB7a_N 856 1004 + CkB7aa_Y 822 1060 + CkB7aa_N 856 1060 + B7b 414 1097 + CkB8_Y 822 1150 + CkB8_N 856 1150 + + +Optional_Page 10 + + YourNames: 135 142 + YourSocSec#: 492 142 + + TxtColor: 0 0 0 + FontSz 16 + SchedB_Additional_form: 200 180 + FontSz 10 + TxtColor: 0 0 0.6 + + Baddi_1_Text: 139 244 + Baddi_2_Text: 139 271 + Baddi_3_Text: 139 299 + Baddi_4_Text: 139 326 + Baddi_5_Text: 139 353 + Baddi_6_Text: 139 381 + Baddi_7_Text: 139 408 + Baddi_8_Text: 139 436 + Baddi_9_Text: 139 463 + Baddi_10_Text: 139 490 + Baddi_11_Text: 139 518 + Baddi_12_Text: 139 545 + Baddi_13_Text: 139 572 + Baddi_14_Text: 139 600 + Baddi_15_Text: 139 627 + Baddi_16_Text: 139 654 + Baddi_17_Text: 139 682 + Baddi_18_Text: 139 709 + Baddi_19_Text: 139 736 + Baddi_20_Text: 139 764 + Baddi_21_Text: 139 791 + Baddi_22_Text: 139 818 + Baddi_23_Text: 139 846 + Baddi_24_Text: 139 873 + Baddi_25_Text: 139 901 + Baddi_26_Text: 139 928 + Baddi_27_Text: 139 955 + Baddi_28_Text: 139 983 + Baddi_29_Text: 139 1010 + + Baddi_1 650 244 12 + Baddi_2 650 271 12 + Baddi_3 650 299 12 + Baddi_4 650 326 12 + Baddi_5 650 353 12 + Baddi_6 650 381 12 + Baddi_7 650 408 12 + Baddi_8 650 436 12 + Baddi_9 650 463 12 + Baddi_10 650 490 12 + Baddi_11 650 518 12 + Baddi_12 650 545 12 + Baddi_13 650 572 12 + Baddi_14 650 600 12 + Baddi_15 650 627 12 + Baddi_16 650 654 12 + Baddi_17 650 682 12 + Baddi_18 650 709 12 + Baddi_19 650 736 12 + Baddi_20 650 764 12 + Baddi_21 650 791 12 + Baddi_22 650 818 12 + Baddi_23 650 846 12 + Baddi_24 650 873 12 + Baddi_25 650 901 12 + Baddi_26 650 928 12 + Baddi_27 650 955 12 + Baddi_28 650 983 12 + Baddi_29 650 1010 12 + Btotal 650 1036 12 + + +Optional_Page 11 + YourNames: 92 174 + YourSocSec#: 736 174 + CkDisposeQualOpport_Y 616 195 + CkDisposeQualOpport_N 681 195 + + no_zero_entries + D1ad 443 351 12 + D1ae 551 351 12 + D1ah 771 351 12 + D1bd 443 451 12 + D1be 551 451 12 + D1bg 661 451 12 + D1bh 771 451 12 + D2d 443 490 12 + D2e 551 490 12 + D2g 661 490 12 + D2h 771 490 12 + D3d 443 525 12 + D3e 551 525 12 + D3g 661 525 12 + D3h 771 525 12 + D4 771 547 12 + D5 771 581 12 + display_without_sign D6 + D6 771 620 12 + D7 771 656 12 + D8ad 443 834 12 + D8ae 551 834 12 + D8ah 771 834 12 + D8bd 443 893 12 + D8be 551 893 12 + D8bg 661 893 12 + D8bh 771 893 12 + D9d 443 929 12 + D9e 551 929 12 + D9g 661 929 12 + D9h 771 929 12 + D10d 443 964 12 + D10e 551 964 12 + D10g 661 964 12 + D10h 771 964 12 + D11 771 1003 12 + D12 771 1023 12 + D13 771 1043 12 + display_without_sign D14 + D14 771 1078 12 + D15 771 1114 12 + + +Optional_Page 12 + no_zero_entries + D16 751 138 12 + CkD17y 103 324 + CkD17n 103 343 + D18 751 398 12 + D19 751 453 12 + CkD20y 103 508 + CkD20n 103 563 + display_without_sign D21 + D21 751 656 12 + CkD22y 103 784 + CkD22n 103 838 + + +Optional_Page 13 + + YourNames: 90 158 + YourSocSec#: 580 158 + + F8949_ckA 78 378 + F8949_ckB 78 398 + F8949_ckC 78 416 + + FontSz 8 + F8949_1aa: 70 562 + F8949_1ab: 268 562 10 + F8949_1ac: 347 562 10 + F8949_1ad 432 562 12 + F8949_1ae 528 562 12 + F8949_1af 616 562 6 + F8949_1ag 694 562 12 + F8949_1ah 790 562 12 + + F8949_1ba: 70 600 + F8949_1bb: 268 600 10 + F8949_1bc: 347 600 10 + F8949_1bd 432 600 12 + F8949_1be 528 600 12 + F8949_1bf 616 600 6 + F8949_1bg 694 600 12 + F8949_1bh 790 600 12 + + F8949_1ca: 70 636 + F8949_1cb: 268 636 10 + F8949_1cc: 347 636 10 + F8949_1cd 432 636 12 + F8949_1ce 528 636 12 + F8949_1cf 616 636 6 + F8949_1cg 694 636 12 + F8949_1ch 790 636 12 + + F8949_1da: 70 673 + F8949_1db: 268 673 10 + F8949_1dc: 347 673 10 + F8949_1dd 432 673 12 + F8949_1de 528 673 12 + F8949_1df 616 673 6 + F8949_1dg 694 673 12 + F8949_1dh 790 673 12 + + F8949_1ea: 70 711 + F8949_1eb: 268 711 10 + F8949_1ec: 347 711 10 + F8949_1ed 432 711 12 + F8949_1ee 528 711 12 + F8949_1ef 616 711 6 + F8949_1eg 694 711 12 + F8949_1eh 790 711 12 + + F8949_1fa: 70 747 + F8949_1fb: 268 747 10 + F8949_1fc: 347 747 10 + F8949_1fd 432 747 12 + F8949_1fe 528 747 12 + F8949_1ff 616 747 6 + F8949_1fg 694 747 12 + F8949_1fh 790 747 12 + + F8949_1ga: 70 784 + F8949_1gb: 268 784 10 + F8949_1gc: 347 784 10 + F8949_1gd 432 784 12 + F8949_1ge 528 784 12 + F8949_1gf 616 784 6 + F8949_1gg 694 784 12 + F8949_1gh 790 784 12 + + F8949_1ha: 70 820 + F8949_1hb: 268 820 10 + F8949_1hc: 347 820 10 + F8949_1hd 432 820 12 + F8949_1he 528 820 12 + F8949_1hf 616 820 6 + F8949_1hg 694 820 12 + F8949_1hh 790 820 12 + + F8949_1ia: 70 856 + F8949_1ib: 268 856 10 + F8949_1ic: 347 856 10 + F8949_1id 432 856 12 + F8949_1ie 528 856 12 + F8949_1if 616 856 6 + F8949_1ig 694 856 12 + F8949_1ih 790 856 12 + + F8949_1ja: 70 893 + F8949_1jb: 268 893 10 + F8949_1jc: 347 893 10 + F8949_1jd 432 893 12 + F8949_1je 528 893 12 + F8949_1jf 616 893 6 + F8949_1jg 694 893 12 + F8949_1jh 790 893 12 + + F8949_1ka: 70 930 + F8949_1kb: 268 930 10 + F8949_1kc: 347 930 10 + F8949_1kd 432 930 12 + F8949_1ke 528 930 12 + F8949_1kf 616 930 6 + F8949_1kg 694 930 12 + F8949_1kh 790 930 12 + + F8949_1la: 70 966 + F8949_1lb: 268 966 10 + F8949_1lc: 347 966 10 + F8949_1ld 432 966 12 + F8949_1le 528 966 12 + F8949_1lf 616 966 6 + F8949_1lg 694 966 12 + F8949_1lh 790 966 12 + + F8949_1ma: 70 1004 + F8949_1mb: 268 1004 10 + F8949_1mc: 347 1004 10 + F8949_1md 432 1004 12 + F8949_1me 528 1004 12 + F8949_1mf 616 1004 6 + F8949_1mg 694 1004 12 + F8949_1mh 790 1004 12 + + F8949_1na: 70 1040 + F8949_1nb: 268 1040 10 + F8949_1nc: 347 1040 10 + F8949_1nd 432 1040 12 + F8949_1ne 528 1040 12 + F8949_1nf 616 1040 6 + F8949_1ng 694 1040 12 + F8949_1nh 790 1040 12 + + F8949_2d 432 1090 12 + F8949_2e 528 1090 12 + F8949_2g 694 1090 12 + F8949_2h 790 1090 12 + FontSz 10 + + +Optional_Page 14 + + YourNames: 90 102 + YourSocSec#: 580 102 + + F8949_ckD 78 325 + F8949_ckE 78 343 + F8949_ckF 78 361 + + FontSz 8 + showevenifzero F8949_1* + F8949_1aa: 70 504 + F8949_1ab: 268 504 10 + F8949_1ac: 347 504 10 + F8949_1ad 432 504 12 + F8949_1ae 528 504 12 + F8949_1af 616 504 6 + F8949_1ag 694 504 12 + F8949_1ah 790 504 12 + + F8949_1ba: 70 540 + F8949_1bb: 268 540 10 + F8949_1bc: 347 540 10 + F8949_1bd 432 540 12 + F8949_1be 528 540 12 + F8949_1bf 616 540 6 + F8949_1bg 694 540 12 + F8949_1bh 790 540 12 + + F8949_1ca: 70 576 + F8949_1cb: 268 576 10 + F8949_1cc: 347 576 10 + F8949_1cd 432 576 12 + F8949_1ce 528 576 12 + F8949_1cf 616 576 6 + F8949_1cg 694 576 12 + F8949_1ch 790 576 12 + + F8949_1da: 70 614 + F8949_1db: 268 614 10 + F8949_1dc: 347 614 10 + F8949_1dd 432 614 12 + F8949_1de 528 614 12 + F8949_1df 616 614 6 + F8949_1dg 694 614 12 + F8949_1dh 790 614 12 + + F8949_1ea: 70 650 + F8949_1eb: 268 650 10 + F8949_1ec: 347 650 10 + F8949_1ed 432 650 12 + F8949_1ee 528 650 12 + F8949_1ef 616 650 6 + F8949_1eg 694 650 12 + F8949_1eh 790 650 12 + + F8949_1fa: 70 686 + F8949_1fb: 268 686 10 + F8949_1fc: 347 686 10 + F8949_1fd 432 686 12 + F8949_1fe 528 686 12 + F8949_1ff 616 686 6 + F8949_1fg 694 686 12 + F8949_1fh 790 686 12 + + F8949_1ga: 70 722 + F8949_1gb: 268 722 10 + F8949_1gc: 347 722 10 + F8949_1gd 432 722 12 + F8949_1ge 528 722 12 + F8949_1gf 616 722 6 + F8949_1gg 694 722 12 + F8949_1gh 790 722 12 + + F8949_1ha: 70 759 + F8949_1hb: 268 759 10 + F8949_1hc: 347 759 10 + F8949_1hd 432 759 12 + F8949_1he 528 759 12 + F8949_1hf 616 750 6 + F8949_1hg 694 759 12 + F8949_1hh 790 759 12 + + F8949_1ia: 70 796 + F8949_1ib: 268 796 10 + F8949_1ic: 347 796 10 + F8949_1id 432 796 12 + F8949_1ie 528 796 12 + F8949_1if 616 796 6 + F8949_1ig 694 796 12 + F8949_1ih 790 796 12 + + F8949_1ja: 70 832 + F8949_1jb: 268 832 10 + F8949_1jc: 347 832 10 + F8949_1jd 432 832 12 + F8949_1je 528 832 12 + F8949_1jf 616 832 6 + F8949_1jg 694 832 12 + F8949_1jh 790 832 12 + + F8949_1ka: 70 868 + F8949_1kb: 268 868 10 + F8949_1kc: 347 868 10 + F8949_1kd 432 868 12 + F8949_1ke 528 868 12 + F8949_1kf 616 868 6 + F8949_1kg 694 868 12 + F8949_1kh 790 868 12 + + F8949_1la: 70 905 + F8949_1lb: 268 905 10 + F8949_1lc: 347 905 10 + F8949_1ld 432 905 12 + F8949_1le 528 905 12 + F8949_1lf 616 905 6 + F8949_1lg 694 905 12 + F8949_1lh 790 905 12 + + F8949_1ma: 70 943 + F8949_1mb: 268 943 10 + F8949_1mc: 347 943 10 + F8949_1md 432 943 12 + F8949_1me 528 943 12 + F8949_1mf 616 943 6 + F8949_1mg 694 943 12 + F8949_1mh 790 943 12 + + F8949_1na: 70 982 + F8949_1nb: 268 982 10 + F8949_1nc: 347 982 10 + F8949_1nd 432 982 12 + F8949_1ne 528 982 12 + F8949_1nf 616 982 6 + F8949_1ng 694 982 12 + F8949_1nh 790 982 12 + + F8949_2d 432 1034 12 + F8949_2e 528 1034 12 + F8949_2g 694 1034 12 + F8949_2h 790 1034 12 + FontSz 10 + + + +Optional_Page 15 + YourNames: 92 155 + YourSocSec#: 736 155 + + AMT_Form_6251_L1 767 235 12 + + AMT_Form_6251_L2a 767 271 12 + display_without_sign AMT_Form_6251_L2b + AMT_Form_6251_L2b 767 290 12 + AMT_Form_6251_L2c 767 307 12 + AMT_Form_6251_L2d 767 327 12 + AMT_Form_6251_L2e 767 346 12 + display_without_sign AMT_Form_6251_L2f + AMT_Form_6251_L2f 767 363 12 + AMT_Form_6251_L2g 767 381 12 + AMT_Form_6251_L2h 767 400 12 + AMT_Form_6251_L2i 767 418 12 + AMT_Form_6251_L2j 767 435 12 + AMT_Form_6251_L2k 767 455 12 + AMT_Form_6251_L2l 767 472 12 + AMT_Form_6251_L2m 767 490 12 + AMT_Form_6251_L2n 767 510 12 + AMT_Form_6251_L2o 767 528 12 + AMT_Form_6251_L2p 767 545 12 + AMT_Form_6251_L2q 767 564 12 + AMT_Form_6251_L2r 767 583 12 + display_without_sign AMT_Form_6251_L2s + AMT_Form_6251_L2s 767 602 12 + AMT_Form_6251_L2t 767 620 12 + + AMT_Form_6251_L3 767 639 12 + AMT_Form_6251_L4 767 674 12 + AMT_Form_6251_L5 767 785 12 + showevenifzero AMT_Form_6251_L6 + AMT_Form_6251_L6 767 839 12 + AMT_Form_6251_L7 767 913 12 + AMT_Form_6251_L8 767 1005 12 + AMT_Form_6251_L9 767 1023 12 + AMT_Form_6251_L10 767 1114 12 + showevenifzero AMT_Form_6251_L11 + AMT_Form_6251_L11 767 1132 12 + + +Optional_Page 16 + + AMT_Form_6251_L12 767 140 12 + AMT_Form_6251_L13 767 214 12 + AMT_Form_6251_L14 767 252 12 + AMT_Form_6251_L15 767 324 12 + AMT_Form_6251_L16 767 343 12 + AMT_Form_6251_L17 767 362 12 + AMT_Form_6251_L18 767 398 12 + AMT_Form_6251_L19 767 453 12 + showevenifzero AMT_Form_6251_L20 + AMT_Form_6251_L20 767 544 12 + showevenifzero AMT_Form_6251_L21 + AMT_Form_6251_L21 767 563 12 + AMT_Form_6251_L22 767 581 12 + AMT_Form_6251_L23 767 601 12 + AMT_Form_6251_L24 767 618 12 + AMT_Form_6251_L25 767 672 12 + AMT_Form_6251_L26 767 727 12 + showevenifzero AMT_Form_6251_L27 + AMT_Form_6251_L27 767 800 12 + AMT_Form_6251_L28 767 820 12 + AMT_Form_6251_L29 767 839 12 + AMT_Form_6251_L30 767 858 12 + showevenifzero AMT_Form_6251_L29 + AMT_Form_6251_L31 767 876 12 + AMT_Form_6251_L32 767 895 12 + AMT_Form_6251_L33 767 929 12 + AMT_Form_6251_L34 767 948 12 + AMT_Form_6251_L35 767 985 12 + AMT_Form_6251_L36 767 1003 12 + AMT_Form_6251_L37 767 1020 12 + AMT_Form_6251_L38 767 1041 12 + AMT_Form_6251_L39 767 1075 12 + AMT_Form_6251_L40 767 1111 12 + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040_pdf.dat new file mode 100755 index 0000000..e4d5dd1 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040sc_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040sc_meta.dat new file mode 100755 index 0000000..37e1a59 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040sc_meta.dat @@ -0,0 +1,142 @@ +Page 1 + + TxtColor: 0 0 0.6 + + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + no_zero_entries + ! round_to_whole_numbers + + YourName: 103 158 + YourSocSec#: 695 158 + PrincipalBus: 103 194 + BusinessName: 103 232 + ActivityCode: 755 194 0 14 + BusinessEIN: 692 232 0 14 + FontSz 8 + Number&Street: 380 252 + TownStateZip: 380 270 + FontSz 10 + + CkFcash: 257 289 + CkFaccrual: 355 289 + CkFother: 465 289 + CkParticipate: 785 306 + CkNotParticipate: 840 306 + CkAcquired: 785 323 + CkReq1099: 785 343 + CkNotReq1099: 840 343 + CkWillFile1099: 785 362 + CkNotFile1099: 840 362 + CkW2: 663 417 + + L1 742 417 15 + L2 742 435 15 + L3 742 455 15 + L4 742 473 15 + L5 742 490 15 + L6 742 509 15 + L7 742 527 15 + L8 315 565 15 + L9 315 603 15 + L10 315 620 15 + L11 315 639 15 + L12 315 658 15 + L13 315 711 15 + L14 315 747 15 + L15 315 767 15 + L16a 315 805 15 + L16b 315 821 15 + L17 315 839 15 + + L18 742 565 15 + L19 742 583 15 + L20a 742 620 15 + L20b 742 638 15 + L21 742 656 15 + L22 742 674 15 + L23 742 693 15 + L24a 742 730 15 + L24b 742 748 15 + L25 742 766 15 + L26 742 784 15 + L27a 742 803 15 + L27b 742 839 15 + L28 742 858 15 + L29 742 876 15 + L30 742 966 15 + L31 742 1021 15 + + Ck32a: 727 1095 + Ck32b: 727 1114 + + +Page 2 + + Ck33aCost: 286 142 + Ck33bMarket: 395 142 + Ck33cOther: 606 142 + Ck34Yes: 736 178 + Ck34No: 825 178 + L35 733 214 16 + L36 733 250 16 + L37 733 286 16 + L38 733 324 16 + L39 733 361 16 + L40 733 397 16 + L41 733 433 16 + L42 733 472 16 + L43mm: 590 561 + L43dd: 635 561 + L43yy: 685 561 0 8 + L44a 178 637 + L44b 515 637 + L44c 724 637 + Ck45Yes: 749 675 + Ck45No: 824 675 + Ck46Yes: 749 711 + Ck46No: 822 711 + Ck47aYes: 749 748 + Ck47aNo: 825 748 + Ck47bYes: 749 785 + Ck47bNo: 825 785 + + Part_IV_1a 80 832 + Part_IV_1b 733 832 + Part_IV_2a 80 871 + Part_IV_2b 733 871 + Part_IV_3a 80 908 + Part_IV_3b 733 908 + Part_IV_4a 80 945 + Part_IV_4b 733 945 + Part_IV_5a 80 981 + Part_IV_5b 733 981 + Part_IV_6a 80 1016 + Part_IV_6b 733 1016 + Part_IV_7a 80 1052 + Part_IV_7b 733 1052 + Part_IV_8a 80 1088 + Part_IV_8b 733 1088 + Part_IV_9a 80 1125 + Part_IV_9b 733 1125 + + L48a_descr: 96 839 + L48a_amnt 738 839 16 + L48b_descr: 96 875 + L48b_amnt 738 875 16 + L48c_descr: 96 912 + L48c_amnt 738 912 16 + L48d_descr: 96 948 + L48d_amnt 738 948 16 + L48e_descr: 96 985 + L48e_amnt 738 985 16 + L48f_descr: 96 1021 + L48f_amnt 738 1021 16 + L48g_descr: 96 1057 + L48g_amnt 738 1057 16 + L48h_descr: 96 1094 + L48h_amnt 738 1094 16 + L48i_descr: 96 1129 + L48i_amnt 738 1129 16 + + L48 738 1151 16 diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040sc_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040sc_pdf.dat new file mode 100755 index 0000000..aa33f98 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040sc_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040se_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040se_meta.dat new file mode 100755 index 0000000..8965389 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040se_meta.dat @@ -0,0 +1,34 @@ +Page 1 + + TxtColor: 0 0 0.6 + + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + no_zero_entries + ! round_to_whole_numbers + + YourName: 64 159 + YourSocSec#: 707 159 + ChkIreq1099sNo 823 223 + 1b_A: 146 381 + 4_A 505 556 12 + 18_A 505 832 12 + 19_text: 170 850 + 19_A 505 850 12 + 20_A: 505 868 12 + 21_A: 505 923 12 + 23b: 631 996 12 + 23d: 631 1033 12 + 23e: 631 1052 12 + 24: 759 1069 12 + 25: 759 1088 12 + 26: 759 1143 12 + +Page 2 + + TxtColor: 0 0 0.6 + + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + no_zero_entries + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040sse_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040sse_meta.dat new file mode 100755 index 0000000..0526f9b --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040sse_meta.dat @@ -0,0 +1,47 @@ +Page 1 + + TxtColor: 0 0 0.6 + + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + + no_zero_entries + + + YourName: 86 156 + YourSocSec#: 755 156 + + Check_A 863 252 + L1a 777 308 + display_without_sign L1b + L1b 777 344 + L2 777 398 11 + L3 777 418 11 + L4a 777 436 11 + L4b 777 473 11 + L4c 777 510 11 + L5a 631 547 11 + L5b 777 565 11 + L6 777 583 11 + + L8a 631 674 11 + L8b 631 693 11 + L8c 631 712 11 + L8d 777 730 11 + L9 777 748 11 + L10 777 767 11 + L11 777 785 11 + L12 777 820 11 + L13 631 874 11 + +! L15 777 967 11 +! L16 777 1041 11 +! L17 777 1078 11 + + +Page 2 + + L14 777 123 11 + L15 777 143 11 + L16 777 178 11 + L17 777 198 11 diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040sse_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040sse_pdf.dat new file mode 100755 index 0000000..8068c2c Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f1040sse_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f2210_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f2210_meta.dat new file mode 100755 index 0000000..dd5231d --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f2210_meta.dat @@ -0,0 +1,204 @@ +Page 1 + + TxtColor: 0 0 0.6 + + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi +! round_to_whole_numbers + +YourName: 55 178 +YourSocSec#: 691 178 +L1 768 601 12 +L2 768 637 12 +L3 768 655 12 +L4 768 692 12 +L5 598 710 12 +L6 768 728 12 +L7 768 747 12 +L8 768 765 12 +L9 768 783 12 +CkL9No 90 823 +CkL9Yes 90 841 +CkBoxA 90 952 +CkBoxB 90 989 +CkBoxC 90 1026 +CkBoxD 90 1062 +CkBoxE 90 1097 + +Page 2 + + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + +SecA_10a 445 215 12 +SecA_10b 555 215 12 +SecA_10c 665 215 12 +SecA_10d 775 215 12 +SecA_11a 445 325 12 +SecA_11b 555 325 12 +SecA_11c 665 325 12 +SecA_11d 775 325 12 + +SecA_12b 555 398 12 +SecA_12c 665 398 12 +SecA_12d 775 398 12 + +SecA_13b 555 418 12 +SecA_13c 665 418 12 +SecA_13d 775 418 12 + +SecA_14b 555 455 12 +SecA_14c 665 455 12 +SecA_14d 775 455 12 +SecA_15a 445 510 12 +SecA_15b 555 510 12 +SecA_15c 665 510 12 +SecA_15d 775 510 12 + +SecA_16b 555 546 12 +SecA_16c 665 546 12 + +SecA_17a 445 601 12 +SecA_17b 555 601 12 +SecA_17c 665 601 12 +SecA_17d 775 601 12 +SecA_18a 445 656 12 +SecA_18b 555 656 12 +SecA_18c 665 656 12 + +L19 775 746 12 + +Page 3 + + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + +SchdAI_1a 445 196 12 +SchdAI_1b 555 196 12 +SchdAI_1c 665 196 12 +SchdAI_1d 775 196 12 + +SchdAI_3a 445 233 12 +SchdAI_3b 555 233 12 +SchdAI_3c 665 233 12 +SchdAI_3d 775 233 12 +SchdAI_4a 445 288 12 +SchdAI_4b 555 288 12 +SchdAI_4c 665 288 12 +SchdAI_4d 775 288 12 + +SchdAI_6a 445 325 12 +SchdAI_6b 555 325 12 +SchdAI_6c 665 325 12 +SchdAI_6d 775 325 12 +SchdAI_7a 445 398 12 +SchdAI_7b 555 398 12 +SchdAI_7c 665 398 12 +SchdAI_7d 775 398 12 +SchdAI_8a 445 416 12 +SchdAI_8b 555 416 12 +SchdAI_8c 665 416 12 +SchdAI_8d 775 416 12 +SchdAI_9a 445 471 12 +SchdAI_9b 555 471 12 +SchdAI_9c 665 471 12 +SchdAI_9d 775 471 12 +SchdAI_10a 445 490 12 +SchdAI_10b 555 490 12 +SchdAI_10c 665 490 12 +SchdAI_10d 775 490 12 +SchdAI_11a 445 508 12 +SchdAI_11b 555 508 12 +SchdAI_11c 665 508 12 +SchdAI_11d 775 508 12 +SchdAI_12a 445 545 12 +SchdAI_12b 555 545 12 +SchdAI_12c 665 545 12 +SchdAI_12d 775 545 12 +SchdAI_13a 445 563 12 +SchdAI_13b 555 563 12 +SchdAI_13c 665 563 12 +SchdAI_13d 775 563 12 +SchdAI_14a 445 581 12 +SchdAI_14b 555 581 12 +SchdAI_14c 665 581 12 +SchdAI_14d 775 581 12 +SchdAI_15a 445 600 12 +SchdAI_15b 555 600 12 +SchdAI_15c 665 600 12 +SchdAI_15d 775 600 12 +SchdAI_16a 445 655 12 +SchdAI_16b 555 655 12 +SchdAI_16c 665 655 12 +SchdAI_16d 775 655 12 +SchdAI_17a 445 673 12 +SchdAI_17b 555 673 12 +SchdAI_17c 665 673 12 +SchdAI_17d 775 673 12 +SchdAI_18a 445 710 12 +SchdAI_18b 555 710 12 +SchdAI_18c 665 710 12 +SchdAI_18d 775 710 12 +SchdAI_19a 445 728 12 +SchdAI_19b 555 728 12 +SchdAI_19c 665 728 12 +SchdAI_19d 775 728 12 + +SchdAI_21a 445 765 12 +SchdAI_21b 555 765 12 +SchdAI_21c 665 765 12 +SchdAI_21d 775 765 12 + +SchdAI_22b 555 820 12 +SchdAI_22c 665 820 12 +SchdAI_22d 775 820 12 +SchdAI_23a 445 838 12 +SchdAI_23b 555 838 12 +SchdAI_23c 665 838 12 +SchdAI_23d 775 838 12 +SchdAI_24a 445 856 12 +SchdAI_24b 555 856 12 +SchdAI_24c 665 856 12 +SchdAI_24d 775 856 12 + +SchdAI_25b 555 875 12 +SchdAI_25c 665 875 12 +SchdAI_25d 775 875 12 +SchdAI_26a 445 893 12 +SchdAI_26b 555 893 12 +SchdAI_26c 665 893 12 +SchdAI_26d 775 893 12 +SchdAI_27a 445 930 12 +SchdAI_27b 555 930 12 +SchdAI_27c 665 930 12 +SchdAI_27d 775 930 12 +SchdAI_28a 445 966 12 +SchdAI_28b 555 966 12 +SchdAI_28c 665 966 12 +SchdAI_28d 775 966 12 + +SchdAI_30a 445 1040 12 +SchdAI_30b 555 1040 12 +SchdAI_30c 665 1040 12 +SchdAI_30d 775 1040 12 +SchdAI_31a 445 1058 12 +SchdAI_31b 555 1058 12 +SchdAI_31c 665 1058 12 +SchdAI_31d 775 1058 12 +SchdAI_32a 445 1076 12 +SchdAI_32b 555 1076 12 +SchdAI_32c 665 1076 12 +SchdAI_32d 775 1076 12 +SchdAI_33a 445 1095 12 +SchdAI_33b 555 1095 12 +SchdAI_33c 665 1095 12 +SchdAI_33d 775 1095 12 + +SchdAI_35a 445 1131 12 +SchdAI_35b 555 1131 12 +SchdAI_35c 665 1131 12 +SchdAI_35d 775 1131 12 +SchdAI_36a 445 1150 12 +SchdAI_36b 555 1150 12 +SchdAI_36c 665 1150 12 +SchdAI_36d 775 1150 12 diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f2210_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f2210_pdf.dat new file mode 100755 index 0000000..7aeec1f Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f2210_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f4794_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f4794_meta.dat new file mode 100755 index 0000000..369c329 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f4794_meta.dat @@ -0,0 +1,10 @@ +Page 1 + + + + +Page 2 + + + + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f4797_instructions.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f4797_instructions.dat new file mode 100755 index 0000000..ddb8e3f --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f4797_instructions.dat @@ -0,0 +1,117 @@ +Instructions: + +[L7] Partners and S corporation shareholders receive a +Schedule K-1 (Form 1065 or Form 1120-S), which +includes amounts that must be reported on Form 4797. +Following the Instructions for Schedule K-1, enter any +amounts from your Schedule K-1 (Form 1120-S), box 9, or +Schedule K-1 (Form 1065), box 10, in Part I of Form 4797. +If the amount from line 7 is a gain and you have +nonrecaptured section 1231 losses from prior years, see +the instructions for line 8, later. If the amount from line 7 is +a gain and you did not have nonrecaptured section 1231 +losses from prior years, enter the gain from line 7 as a +long-term capital gain on the Schedule D for the return you +are filing. + +[L8] Your nonrecaptured section 1231 losses are your net +section 1231 losses deducted during the 5 preceding tax +years that have not yet been applied against any net +section 1231 gain to determine how much net section +1231 gain is treated as ordinary income under this rule. +You had a net section 1231 loss if section 1231 losses +exceeded section 1231 gains. Gains are included only to +the extent taken into account in figuring gross income. +Losses are included only to the extent taken into account +in figuring taxable income except that the limitation on +capital losses does not apply. +Your net section 1231 gain on line 7 is treated as +ordinary income to the extent of your nonrecaptured +section 1231 losses. See the example in Instructions + +[L9] For recordkeeping purposes, if line 9 is zero, the amount +on line 7 is the amount of net section 1231 loss recaptured +in 2024. If line 9 is more than zero, you have recaptured all +of your net section 1231 losses from prior years. +If line 9 is more than zero, enter the amount from line 8 +on line 12. Enter the gain from line 9 as a long-term capital +gain on the Schedule D for the return you are filing. + +[L10] Report on line 10 ordinary gains and losses, not included +on lines 11 through 16, including gains and losses from +property held 1 year or less. +If you receive ordinary income from a sale or other +disposition of property and deducted the cost of the +property under the tangible property de minimis safe +harbor, report the income on line 10. +Deduct the loss from a qualifying abandonment of +business or investment property on line 10. See +Abandonments in Pub. 544 for more information. + +[L18a] You must complete this line if there is a gain on Form +4797, line 3; a loss on Form 4797, line 11; and a loss on Form 4684, line 35, column (b)(ii). Enter on this line the +smaller of the loss on Form 4797, line 11, or the loss on +Form 4684, line 35, column (b)(ii). To figure which loss is +smaller, treat both losses as positive numbers. Enter the +loss from income-producing property on Schedule A +(Form 1040), line 16. Identify it as from “Form 4797, +line 18a.” Do not include any loss from property used as +an employee. + +[L20] The gross sales price includes money, the FMV of other +property received, and any existing mortgage or other +debt the buyer assumes or takes the property subject to. +For casualty or theft gains, include insurance or other +reimbursement you received or expect to receive for each +item. Include on this line your insurance coverage, +whether or not you are submitting a claim for +reimbursement. +For section 1255 property disposed of in a sale, +exchange, or involuntary conversion, enter the amount +realized. For section 1255 property disposed of in any +other way, enter the FMV. + +[L21] Reduce the cost or other basis of the property by the +amount of any enhanced oil recovery credit or disabled +access credit. However, do not adjust the cost or other +basis for any of the items taken into account on line 22. + +[L22] Follow the steps in the instructions + +[L23] For section 1255 property, enter the adjusted basis of the +section 126 property disposed of. + +[L25a] See Instruction details + +[L26a] See Instruction details + +[L27b] Enter 100% of line 27a on line 27b except as follows: +• 80% if the farmland was disposed of within the 6th year after it was acquired. +• 60% if disposed of within the 7th year. +• 40% if disposed of within the 8th year. +• 20% if disposed of within the 9th year. + +[L28a] If the property was placed in service before 1987, enter +the total expenses after 1975 that: +• Were deducted by the taxpayer or any other person as +intangible drilling and development costs under section +263(c) (except previously expensed mining costs that +were included in income upon reaching the producing +state), and +• Would have been reflected in the adjusted basis of the +property if they had not been deducted. +If the property was placed in service after 1986, enter +the total expenses that: +• Were deducted under section 263, 616, or 617 by the +taxpayer or any other person; and +• But for such deduction, would have been included in the +basis of the property; plus +• The deduction under section 611 that reduced the +adjusted basis of such property. +If you disposed of a portion of section 1254 property or +an undivided interest in it, see section 1254(a)(2). + +[L29a] Use 100% if the property is disposed of less than 10 years +after receipt of payments excluded from income. Use +100% minus 10% for each year, or part of a year, that the property was held over 10 years after receipt of the +excluded payments. Use zero if 20 years or more. diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8606_instructions.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8606_instructions.dat new file mode 100755 index 0000000..5424c27 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8606_instructions.dat @@ -0,0 +1,169 @@ +Instructions: +[Complete_Part_One?] Complete this part only if one or more of the following apply. +• You made nondeductible contributions to a traditional IRA for 2024. +• You took distributions from a traditional, traditional SEP, or traditional SIMPLE IRA in 2024 and you made nondeductible +contributions to a traditional IRA in 2024 or an earlier year. For this purpose, “distributions” does not include rollovers (but does +include certain 2024 retirement plan distribution repayments treated as rollovers (see instructions)). Also, it does not include qualified +charitable distributions, one-time distributions to fund an HSA, conversions, recharacterizations, or returns of certain contributions. +• You converted part, but not all, of your traditional, traditional SEP, and traditional SIMPLE IRAs to Roth, Roth SEP, or +Roth SIMPLE IRAs in 2024 and you made nondeductible contributions to a traditional IRA in 2024 or an earlier year. + +[L1] If you used the IRA Deduction Worksheet in the Form +1040 instructions or as referred to in the Form 1040-NR +instructions, subtract line 12 of the worksheet (or the +amount you chose to deduct on Schedule 1 (Form 1040), +line 20, if less) from the smaller of line 10 or line 11 of the +worksheet. Enter the result on line 1 of Form 8606. You +can’t deduct the amount included on line 1. +If you used the worksheet Figuring Your Reduced IRA +Deduction for 2024 in Pub. 590-A, enter on line 1 of Form +8606 any nondeductible contributions from the +appropriate lines of that worksheet. +If you didn’t have any deductible contributions, you can +make nondeductible contributions up to your contribution +limit (see Overall Contribution Limit for Traditional and +Roth IRAs, earlier). Enter on line 1 of Form 8606 your +nondeductible contributions. +Include on line 1 any repayment of a qualified reservist +distribution. +Don’t include on line 1 contributions that you had +returned to you with the related earnings (or less any +loss). See Return of IRA Contributions, earlier. + +[L2] Generally, if this is the first year you are required to file +Form 8606, enter -0-. Otherwise, use the Total Basis Chart +to find the amount to enter on line 2. +However, you may need to enter an amount that is +more than -0- (even if this is the first year you are required +to file Form 8606) or increase or decrease the amount +from the chart if your basis changed because of any of the +following. +• You had a return of excess traditional IRA contributions +(see Return of Excess Traditional IRA Contributions, +earlier). +• Incident to divorce, you transferred or received part or +all of a traditional, traditional SEP, or traditional SIMPLE +IRA (see the last bulleted item under Line 7, later). +• You rolled over any nontaxable portion of your qualified +retirement plan to a traditional, traditional SEP, or +traditional SIMPLE IRA that wasn’t previously reported on +Form 8606, line 2. Include the nontaxable portion on +line 2. + +[L4] f you made contributions to traditional IRAs for 2024 in +2024 and 2025 and you have both deductible and +nondeductible contributions, you can choose to treat the +contributions made in 2024 first as nondeductible +contributions and then as deductible contributions, or vice +versa. - See instruction example + +[L6] Enter the total value of all your traditional, traditional SEP, +and traditional SIMPLE IRAs as of December 31, 2024, +plus any outstanding rollovers. A statement should be sent +to you by January 31, 2025, showing the value of each +IRA on December 31, 2024. However, if you +recharacterized any amounts originally contributed, enter +on line 6 the total value, taking into account all +recharacterizations of those amounts, including +recharacterizations made after December 31, 2024. + +[L7] See Instructions + +[L8] if, in 2024, you converted any amounts from traditional, +traditional SEP, or traditional SIMPLE IRAs to a Roth, Roth +SEP, or Roth SIMPLE IRA, enter on line 8 the net amount +you converted. + +[L15b] Enter the amount on line 15a attributable to qualified disaster distributions, if any, from 2024 Form(s) +8915-F (see instructions). Also, enter this amount on 2024 Form(s) 8915-F, line 18, as applicable (see +instructions) + +[Complete_Part_Two?] Complete this part if you converted part or all of your traditional, traditional SEP, and traditional SIMPLE IRAs to a Roth, Roth SEP, or Roth SIMPLE IRA in 2024. + +[L16] If you didn’t complete line 8, see the instructions for that +line. Then, enter on line 16 the amount you would have +entered on line 8 had you completed it. + +[L17] If you didn’t complete line 11, enter on line 17 the amount +from line 2 (or the amount you would have entered on +line 2 if you had completed that line) plus any +contributions included on line 1 that you made before the +conversion. + +[Complete-Part_Three?] Complete this part only if you took a distribution from a Roth, Roth SEP, or Roth SIMPLE IRA in 2024. For this purpose, a +distribution does not include a rollover (but does include certain 2024 retirement plan distribution repayments treated as +rollovers (see instructions)). Also, it does not include a qualified charitable distribution, one-time distribution to fund an +HSA, recharacterization, or return of certain contributions (see instructions). + +[L19] See Instructions + +[L20] f you had a qualified first-time homebuyer distribution +from your Roth, Roth SEP, or Roth SIMPLE IRA and you +made a contribution (including a conversion or a rollover +from a qualified retirement plan) to a Roth IRA for any year +from 1998 through 2019, enter the amount of your +qualified expenses on line 20, but don’t enter more than +$10,000 reduced by the total of all your prior qualified +first-time homebuyer distributions. For details, see Are +Distributions Taxable? in chapter 2 of Pub. 590-B. + +[L22] CAUTION: If you completed the 2024 Line 25c Worksheet, +include on line 22, the amount, if any, from line 6 +of the worksheet. + +Figure the amount to enter on line 22 as follows. +(other than an amount rolled over or recharacterized or a +returned contribution), enter on line 22 the total of all your +regular contributions to Roth or Roth SIMPLE IRAs for +1998 through 2023 (excluding rollovers from other Roth, +Roth SEP, or Roth SIMPLE IRAs and any contributions +that you had returned to you), adjusted for any +recharacterizations. +• If you did take such a distribution before 2024, see the +Basis in Regular Roth IRA Contributions Worksheet to +figure the amount to enter. +• Increase the amount on line 22 by any amount rolled in +from a designated Roth, Roth SEP, or Roth SIMPLE +account that is treated as investment in the contract. +• Increase or decrease the amount on line 22 by any +basis in regular contributions received or transferred +incident to divorce. Also attach a statement similar to the +one explained in the last bulleted item under Line 7, +earlier. +• Increase the amount on line 22 by the amounts +received as a military gratuity or Servicemembers’ Group +Life Insurance (SGLI) payment that was rolled over to your +Roth, Roth SEP, or Roth SIMPLE IRA. +[L24] Figure the amount to enter on line 24 as follows. +• If you have never made a Roth, Roth SEP, or Roth +SIMPLE IRA conversion or rolled over an amount from a +qualified retirement plan to a Roth, Roth SEP, or Roth +SIMPLE IRA, enter -0- on line 24. +• If you took a Roth IRA distribution (other than an +amount rolled over or recharacterized or a returned +contribution) before 2024 in excess of your basis in regular +Roth IRA contributions, see the Basis in Roth IRA +Conversions and Rollovers From Qualified Retirement +Plans to Roth IRAs chart to figure the amount to enter on +line 24. +• If you didn’t take such a distribution before 2024, enter +on line 24 the total of all your conversions to Roth IRAs. +These amounts are shown on line 14c of your 1998, 1999, +and 2000 Forms 8606 and line 16 of your 2001 through +2023 Forms 8606. Also include on line 24 any amounts +rolled over from a qualified retirement plan to a Roth, Roth +SEP, or Roth SIMPLE IRA for 2008, 2009, and 2011 +through 2024 reported on your Form 1040, 1040-SR, +1040A, or 1040-NR, and for 2010 reported on line 21 of +your Form 8606. Don’t include amounts rolled in from a +designated Roth, Roth SEP, or Roth SIMPLE account +because these amounts are included on line 22. +• Increase or decrease the amount on line 24 by any +basis in conversions to Roth, Roth SEP, or Roth SIMPLE +IRAs and amounts rolled over from a qualified retirement +plan to a Roth, Roth SEP, or Roth SIMPLE IRA received or +transferred incident to divorce. Also attach a statement +similar to the one explained in the last bulleted item under +Line 7, earlier. + +[L25b] See Instruction examples diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8606_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8606_meta.dat new file mode 100755 index 0000000..d9d5382 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8606_meta.dat @@ -0,0 +1,54 @@ +Page 1 + + TxtColor: 0 0 0.6 + + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi +! round_to_whole_numbers + +Name: 85 159 +SocSec#: 727 159 +Number&Street: 246 195 +Apt#: 770 194 +TownStateZip: 246 232 +ForeignCountry: 246 268 +ForeignState: 482 268 +ForeignPostcode: 727 268 + +L1 777 490 +L2 777 509 +L3 777 528 +L4 777 618 +L5 777 638 +L6 777 691 +L7 777 783 +L8 777 820 +L9 634 840 +! L10 675 875 +L10intpart 672 875 +L10rest 692 875 +L11 634 912 +L12 634 950 +L13 777 968 +L14 777 987 +L15a 777 1005 +L15b 777 1060 +L15c 777 1114 + + +Page 2 + +L16 782 195 +L17 782 231 +L18 782 268 +L19 782 416 +L20 782 453 +L21 782 473 +L22 782 508 +L23 782 545 +L24 782 582 +L25a 782 602 +L25b 782 655 +L25c 782 726 + + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8606_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8606_pdf.dat new file mode 100755 index 0000000..07d1fe3 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8606_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8812_instructions.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8812_instructions.dat new file mode 100755 index 0000000..23166ab --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8812_instructions.dat @@ -0,0 +1,35 @@ +Instructions: +[L4] Add the number of boxes checked under “Child tax credit” in column +(4) of the Dependents section on Form 1040, 1040-SR, or 1040-NR +and enter the result on line 4. + +[L6] Add the number of boxes checked under “Credit for other dependents” +in column (4) of the Dependents section on Form 1040, 1040-SR, or +1040-NR and enter the result on line 6. + +[L13] When completing Credit Limit Worksheet A, you may be instructed to complete Credit Limit Worksheet B if you meet certain conditions. Complete Credit Limit Worksheet B only if you meet all of the +following.Check this box if you do not want to claim the additional child tax +credit. If you check this box, skip Parts II-A and II-B, and enter -0- on +line 27. +1. You are claiming one or more of the following credits. +a. Mortgage interest credit, Form 8396. +b. Adoption credit, Form 8839. +c. Residential clean energy credit, Form 5695, Part I. +d. District of Columbia first-time homebuyer credit, Form 8859. + +[L18a]If you have net earnings from self-employment and you use either optional method to figure those net earnings, use the Earned Income +Worksheet, later, to figure the amount to enter on line 18a; otherwise, +all other taxpayers can use the Earned Income Chart, later, to figure +the amount to enter on line 18a. +2. You are not filing Form 2555. +3. Line 4 of Schedule 8812 is more than zero. + +[L18b] Enter on line 18b the total amount of nontaxable combat pay that you +(and your spouse if filing jointly) received in 2024. This amount will +be reported either on line 1i of Form 1040, or 1040-SR, or should be +shown in Form W-2, box 12, with code Q. + +[L21] If you are completing Part II-B and your employer withheld or you +paid Additional Medicare Tax or tier 1 RRTA tax, use the Additional +Medicare Tax and RRTA Tax Worksheet, later, to figure the amount to +enter on line 21. diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8812_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8812_meta.dat new file mode 100755 index 0000000..f2b69c5 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8812_meta.dat @@ -0,0 +1,53 @@ +Page 1 + + TxtColor: 0 0 0.6 + + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + ! round_to_whole_numbers + + YourName: 82 179 + SocSec#: 721 179 0 6.5 + + L1 778 218 12 + L2a 630 234 12 + L2c 630 251 12 + L2b 630 272 12 + L2d 778 290 12 + L3 778 310 12 + L4 680 326 + L5 778 345 12 + L6 680 380 + + L7 778 438 12 + L8 778 456 12 + L9 778 510 12 + showevenifzero L10 + L10 778 583 12 + L11 778 603 12 + L12 778 621 12 + L13 778 694 12 + L14 778 712 12 + + +Page 2 + + L16a 778 160 12 + L16b 778 216 12 + L17 778 251 12 + L18a 624 270 12 + L18b 478 289 12 + L19 624 345 12 + + showevenifzero L20 + L20 778 363 12 + L21 624 546 12 + L22 624 583 12 + L23 624 601 12 + L24 624 675 12 + L25 778 695 12 + L26 778 711 12 + L27 778 766 12 + + + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8812_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8812_pdf.dat new file mode 100755 index 0000000..62f8484 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8812_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8829_instructions.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8829_instructions.dat new file mode 100755 index 0000000..9583781 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8829_instructions.dat @@ -0,0 +1,34 @@ +form 8829 instructions 2024 + +[L1] To determine the area on lines 1 and 2, you can use square feet +or any other reasonable method if it accurately figures your +business percentage on line 7 + +[L4] Example. Your home is used Monday through Friday for 12 +hours per day for 250 days during the year. It is also used on 50 +Saturdays for 8 hours per day. Enter 3,400 hours on line 4 (3,000 +hours for weekdays plus 400 hours for Saturdays). + +[L5] If you started or stopped using your home for daycare in 2024, +you must prorate the number of hours based on the number of +days the home was available for daycare. Do not enter 8,784. +Instead, multiply 24 hours by the number of days available and +enter the result. + +[L8] If all the gross income from your trade or business is from the +business use of your home, enter on line 8 the amount from +Schedule(s) C, line 29 with adjsutments (See Instructions) +or +If some of the income is from a place of business other than +your home, you must first determine the part of your gross +income (Schedule C, line 7, and gains from Form 8949, +Schedule D, and Form 4797) from the business use of your +home. (See Instructions) + +[L9a] See instructions for Columns a and B before enter data for rows 9-22 + + +[L31] Enter any amount from your 2023 Form 8829, line 44 + + + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8829_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8829_meta.dat new file mode 100755 index 0000000..b5d66a9 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8829_meta.dat @@ -0,0 +1,66 @@ +Page 1 + +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi +! round_to_whole_numbers + + +TxtColor: 0 0 0.6 +YourName: 88 158 12 +YourSocSec#: 700 158 12 +L1 755 214 12 +L2 755 233 12 +L3 755 250 12 +L4 582 288 12 +L5 582 324 12 +L6 532 342 12 +L7 755 379 12 +L8 755 434 12 +L9a 458 471 12 +L10a 458 489 12 +L11a 458 508 12 +L12a 458 526 12 +L9b 590 471 12 +L10b 590 489 12 +L11b 590 508 12 +L12b 590 526 12 +L13 590 544 12 +L14 754 563 12 +L15 754 581 12 +L16a 458 600 12 +L17a 458 618 12 +L18a 458 637 12 +L19a 458 655 12 +L20a 458 673 12 +L21a 458 691 12 +L22a 458 710 12 +L23a 458 728 12 +L16b 590 600 12 +L17b 590 618 12 +L18b 590 637 12 +L19b 590 655 12 +L20b 590 673 12 +L21b 590 691 12 +L22b 590 710 12 +L23b 590 728 12 +L24 590 747 12 +L25 590 765 12 +L26 755 783 12 +L27 755 802 12 +L28 755 820 12 +L29 590 839 12 +L30 590 858 12 +L31 590 876 12 +L32 755 894 12 +L33 755 912 12 +L34 755 930 12 +L35 755 949 12 +L36 755 986 12 +L37 755 1022 12 +L38 755 1040 12 +L39 755 1059 12 +L40 755 1077 12 +L41 755 1096 12 +L42 755 1115 12 +L43 755 1151 12 +L44 755 1169 12 diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8829_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8829_pdf.dat new file mode 100755 index 0000000..935784a Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8829_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8889_instructions.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8889_instructions.dat new file mode 100755 index 0000000..15dff40 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8889_instructions.dat @@ -0,0 +1,51 @@ +Instructions: + +[L2] Include on line 2 only those amounts you, or others on your +behalf, contributed to your HSA for 2024. Also, include +amounts contributed for 2024 made in 2025 by the +unextended deadline for filing your 2024 federal income tax +return, April 15, 2025. If you were serving in, or in support of, +the U.S. Armed Forces in a designated combat zone or +contingency operation, you may be able to file later. See Pub. +3 for details. Thus, you may contribute to your 2024 HSA +through April 15, 2025, or a later date if you served in a +designated combat zone or contingency operation. + +[L3] If you were, or were considered, an eligible individual +for the entire year and you did not change your type of +coverage, enter $4,150 for a self-only HDHP or $8,300 for a +family HDHP on line 3. (See Instructions if not an eligible individual) + +[L4] Enter the amount you and your employer contributed to your Archer MSAs for 2020 from Form 8853, +lines 1 and 2. If you or your spouse had family coverage under an HDHP at any time during 2020, also +include any amount contributed to your spouse's Archer MSAs. + +[l5] If you were not an eligible individual on the first day of +the last month of your tax year, use the Line 3 Limitation +Chart and Worksheet (in these instructions) to determine the +amount to enter on line 3. (See (6) in this list.) + +[L6] If, at the end of 2024, you were age 55 or older and +unmarried or married with self-only HDHP coverage for the +entire year, you can increase the amount determined in (3) or +(4) by $1,000 (the additional contribution amount). The +$1,000 additional contribution amount is not allocable among +spouses, unlike the $8,300 family contribution discussed +below. For the Line 3 Limitation Chart and Worksheet, the +additional contribution amount is included for each month +you are an eligible individual. + +[L7] If, at the end of 2024, you were age 55 or older and married, +use the Additional Contribution Amount Worksheet ((See Instructions for Worksheet)) if both of the following apply. +1. You or your spouse had family coverage under an +HDHP and were, or were considered to be, an eligible +individual on the first day of the month. +2. You were not enrolled in Medicare for the month. + +[L14b] Include on line 14b any distributions you received in 2024 +that qualified as a rollover contribution to another HSA. See +Rollovers, earlier. Also include any excess contributions (and +the earnings on those excess contributions) included on +line 14a that were withdrawn by the due date, including +extensions, of your return. See the instructions for line 13, +earlier. diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8889_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8889_meta.dat new file mode 100755 index 0000000..36bb70d --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8889_meta.dat @@ -0,0 +1,43 @@ +Page 1 + + TxtColor: 0 0 0.6 + + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + + no_zero_entries + round_to_whole_numbers + + YourName: 103 164 + YourSocSec#: 731 166 + + CkSelf-Only: 736 268 + CkFamily: 821 268 + L2 775 325 12 + L3 775 380 12 + L4 775 435 12 + showevenifzero L5 + L5 775 455 12 + L6 775 491 12 + L7 775 527 12 + L8 775 546 12 + L9 629 564 12 + L10 629 583 12 + L11 775 602 12 + showevenifzero L12 + L12 775 620 12 + showevenifzero L13 + L13 775 638 12 + L14a 775 693 12 + L14b 775 747 12 + L14c 775 766 12 + L15 775 785 12 + showevenifzero L16 + L16 775 821 12 + Ck17a: 713 858 + L17b 775 913 12 + L18 775 987 12 + L19 775 1005 12 + L20 775 1023 12 + L21 775 1059 12 + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8889_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8889_pdf.dat new file mode 100755 index 0000000..c4b79b9 Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8889_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8959_instructions.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8959_instructions.dat new file mode 100755 index 0000000..fc94868 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8959_instructions.dat @@ -0,0 +1,43 @@ +Instructions: + +[L1] Enter your Medicare wages and tips from box 5 of your Form W-2. If you have more +than one Form W-2, enter the total of the amounts from box 5 of all Forms W-2. If you are filing a +joint return, also include your spouse’s wages and tips. + +[L2] Enter unreported tips from line 6 of +Form 4137, Social Security and Medicare Tax on Unreported Tip Income. If you are filing a joint +return, also include the amount from line 6 of your spouse's Form 4137. There may be a Penalty for +not reporting tips.- See Instructions + +[L3] Enter wages from line 6 of Form 8919, Uncollected Social +Security and Medicare Tax on Wages. If you are filing a joint return, also include the amount from +line 6 of your spouse's Form 8919. + +[L8] Enter your self-employment income from Schedule SE (Form +1040), Part I, line 6. Combine amounts from this line if you have multiple Schedules SE. + +[L14] Enter the total of your RRTA compensation and tips. The amount of RRTA compensation for a +railroad employee is reported on Form W-2, box 14. If you have more than one Form W-2, enter the +total of the RRTA compensation amounts from box 14 of all Forms W-2. If you are filing a joint +return, also include your spouse’s RRTA compensation. An employee representative subject to RRTA +taxes should include the total compensation subject to Tier 1 Medicare tax as reported on line 2 of +Form CT-2 (include the total of the compensation amounts from line 2 of all Forms CT-2 filed for +2024). + +[L19] Enter the amount of Medicare tax withheld, if any, reported on Form W-2, box 6. If you have +more than one Form W-2, add the amounts in box 6 of all your Forms W-2 and enter the total here. If +you are filing a joint return, include your spouse’s Medicare tax withheld. Also include any +uncollected Medicare tax on tips from Form W-2, box 12, code B, and any uncollected Medicare tax on +the taxable cost of group-term life insurance over $50,000 (for former employees) from Form W-2, +box 12, code N. If you have more than one Form W-2, add the amounts in box 12, codes B and N, of +all your Forms W-2 and enter the total here. If you are filing a joint return, also include these +amounts, if any, from your spouse's Form(s) W-2. However, don't include any amounts reported on +Form W-2, box 12, codes B and N, for uncollected RRTA Medicare tax. Note. Both Medicare tax and +Additional Medicare Tax withholding are reported together on Form W-2, box 6. + +[L23] Enter the amount of Additional Medicare Tax withheld, if any, reported on Form W-2, box 14. +If you have more than one Form W-2, add the amounts in box 14 of all your Forms W-2 and enter the +total here. If you are filing a joint return, include your spouse’s Additional Medicare Tax +withheld. An employee representative subject to RRTA taxes should include the total Additional +Medicare Tax paid as reported on line 3 of Form CT-2 (include the total Additional Medicare Tax +paid from line 3 of all Forms CT-2 filed for 2024). diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8959_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8959_meta.dat new file mode 100755 index 0000000..ea3a477 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8959_meta.dat @@ -0,0 +1,34 @@ +Page 1 + + TxtColor: 0 0 0.6 + + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + ! round_to_whole_numbers + +YourName: 55 155 +YourSocSec#: 690 155 +L1 626 215 12 +L2 626 233 12 +L3 626 251 12 +L4 626 270 12 +L5 626 343 12 +L6 770 361 12 +L7 770 398 12 +L8 626 453 12 +L9 626 526 12 +L10 626 545 12 +L11 626 563 12 +L12 770 581 12 +L13 770 617 12 +L14 626 673 12 +L15 626 746 12 +L16 770 765 12 +L17 770 801 12 +L18 770 856 12 +L19 626 911 12 +L20 626 930 12 +L21 626 966 12 +L22 770 1003 12 +L23 770 1040 12 +L24 770 1095 12 diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8959_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8959_pdf.dat new file mode 100755 index 0000000..11cd32f Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8959_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8960_instructions.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8960_instructions.dat new file mode 100755 index 0000000..673acd6 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8960_instructions.dat @@ -0,0 +1,221 @@ +Instructions: + +[Sec6013g] If you’re making the section 6013(g) or 6013(h) election (see Election To File Jointly +With Nonresident Spouse—Section 6013(g) or 6013(h), earlier), check the corresponding checkbox. + + +[Sec1141_10g] If you’re making or have made a section 1.1411-10(g) election (see Regulations +Section 1.1411-10(g) Election, earlier), check the corresponding checkbox and attach a statement to +your return, as described earlier under Content requirements of election. + +[L1] Enter the amount of taxable interest received. Include the +following amount from your return. +• Form 1040 or 1040-SR, line 2b. +• Form 1041, line 1. +• Form 1041-QFT, line 1a. +• Form 1040-NR, taxable interest received for period of U.S. +residency shown on attached statement. +See Special computational rules for qualified funeral trusts +(QFTs) and Dual-status individual, earlier. +Adjustments to interest. Interest income earned in the +ordinary course of your non-section 1411 trade or business is +excluded from net investment income. If this type of interest +income is included on line 1, use line 7 to adjust your net +investment income. +If line 1 includes self-charged interest income received from a +partnership or S corporation that’s a nonpassive activity (other +than a trade or business of trading in financial instruments or +commodities), see Line 7—Other Modifications to Investment +Income, later, for a possible adjustment to net investment +income. + +[L2] Enter the amount of ordinary dividends received. Include the +following amount from your return. +• Form 1040 or 1040-SR, line 3b. +• Form 1041, line 2a. +• Form 1041-QFT, line 2a. +• Form 1040-NR, ordinary dividends received for period of U.S. +residency shown on attached statement. +See Special computational rules for qualified funeral trusts +(QFTs) and Dual-status individual, earlier. +Adjustments to dividends. If line 2 includes dividends from +employer securities held in an employee stock ownership plan +(ESOP) that are deductible under section 404(k) or Alaska +Permanent Fund Dividends, include those amounts as negative +modifications on line 7. See Line 7—Other Modifications to +Investment Income, later. + +[L3] Enter the gross income from all annuities, except annuities paid +from the following. +• Section 401—Qualified pension, profit-sharing, and stock +bonus plans. +• Section 403(a)—Qualified annuity plans purchased by an +employer for an employee. +• Section 403(b)—Annuities purchased by public schools or +section 501(c)(3) tax-exempt organizations. +• Section 408—Individual retirement accounts (IRAs) or +annuities. +• Section 408A—Roth IRAs. +• Section 457(b)—Deferred compensation plans of a state and +local government and tax-exempt organization. +• Amounts paid in consideration for services (for example, +distributions from a foreign retirement plan that are paid in the +form of an annuity and include investment income that was +earned by the retirement plan). + +[L4a] Enter the following amount from your properly completed return. +• Schedule 1 (Form 1040), line 3. +• Schedule 1 (Form 1040), line 5. +• Form 1041, line 3. +• Form 1041, line 5. +• Form 1041-QFT, the portion of line 4 that’s income and loss +that properly would be reported by a trust filing Form 1041 on +Form 1041, line 5. +• Form 1040-NR, the amount properly reported on the +attachment to your Form 1040-NR representing the amount that +you would properly include on Schedule 1 (Form 1040), line 5, if +you were filing Form 1040 or 1040-SR and including income and +loss only for your period of U.S. residency. + +[L4b] Use line 4b to adjust the amounts included on line 4a, for gains +and losses that are excluded from the calculation of net +investment income. Enter the amount of gains (as a negative +number) and losses (as a positive number). Enter the net +positive or net negative amount for the following items included +on line 4a that aren’t included in determining net investment +income. +• Net income or loss from a section 162 trade or business that’s +not a passive activity and isn’t engaged in a trade or business of +trading financial instruments or commodities. +• Net income or loss from a section 1411 trade or business +that’s taken into account in determining self-employment +income. +• Royalties derived in the ordinary course of a section 162 trade +or business that’s not a passive activity. +• Passive losses of a former passive activity that are allowed as +a deduction in the current year under section 469(f)(1)(A). +In addition, use line 4b to adjust for certain types of +nonpassive rental income or loss derived in the ordinary course +of a section 162 trade or business. For example, line 4b includes +the following items. + +[L5a] Calculate and enter the amount of net gain or loss from the +disposition of property by combining the following amounts from +your properly completed return. +• Form 1040 or 1040-SR, line 7, and Schedule 1 (Form 1040), +line 4. +• Form 1041, lines 4 and 7. +• Form 1041-QFT, line 3, and the portion of line 4 attributed to +ordinary gain/(loss). +• Form 1040-NR, the amounts properly reported on the +attachment to your Form 1040-NR representing the amounts that +you would enter on Form 1040 or 1040-SR, line 7, and Schedule +1 (Form 1040), line 4, if you were filing Form 1040 or 1040-SR +and including net gain or loss only for your period of U.S. +residency. + +[L5b] Use line 5b to adjust the amounts included on line 5a for gains +and losses that are excluded from the calculation of net +investment income. Enter the amount of gains (as a negative +number) and losses (as a positive number) included on line 5a +that are excluded from net investment income. +See Instructions for Examples and Woksheets + +[L5c] Enter the amount from the worksheet for lines 5a–5d, line 3d. +Attach a statement as described in Required statements, earlier, +to your return for the year of the disposition. + +[L6] If you own stock, directly or indirectly, in a CFC or a PFIC (other +than certain CFCs and PFICs held in a section 1411 trade or +business or PFICs marked to market under a provision of Code +chapter 1 other than section 1296), use line 6 for adjustments +necessary to calculate your net investment income. + +See Instructions + +[L7] Use line 7 to report additional net investment income +modifications to net investment income that aren’t otherwise +specified on lines 1–6. For example, use line 7 to report additions +and modifications to net investment income. + +See Instructions for Worksheet + +[L9a]Enter on Form 8960, line 9a, interest expense you paid or +accrued during the tax year deducted on Schedule A (Form +1040), line 9. Estates and trusts enter the amount from Form +4952, line 8 (if not required to file Form 4952, use the form as a +worksheet). For individuals filing a Form 1040-NR, include only +the amount of investment interest expense deduction for your +U.S. residency period. + +See Instruction for Notes + +[L9b]Include state, local, and foreign income taxes you paid for the tax +year that are attributable to net investment income. Form +1040-NR filers include only taxes paid for the U.S. residency +period of the tax year. Sales taxes aren’t deductible in computing +net investment income. You may not take a deduction for any +foreign income taxes paid for the tax year if you took a credit for +any portion of them. See section 275(a)(4). + +See Instructions for Worksheets for lines 9 and 10 + +[L9c] Investment expenses you incur that are directly connected to the +production of investment income are deductible expenses in +determining your net investment income. Generally, these +amounts are reported on Form 4952, line 5. See Form 4952 for +the instructions for line 5 for more information. The amounts +reported on line 9c are the amounts allowable after the +application of the deduction limitations imposed by sections 67 +and 68. + +[L10] Use line 10 to report additional deductions and modifications to +net investment income that aren’t otherwise reflected on lines 1– +9. Enter amounts on line 10 as positive numbers. +Note. Enter the amount on line 10 after the application of +section 67 or 68. See Lines 9 and 10—Application of Itemized +Deduction Limitations on Deductions Properly Allocable to +Investment Income Worksheet in these instructions for +assistance in figuring the amount to report on line 10. + +See Caution regarding miscellaneous itemized deductions, +earlier. + +[L13] If you didn’t exclude any amounts from your gross income under +section 911 and you don’t own a CFC or PFIC, your MAGI is your +AGI as reported on Form 1040 or 1040-SR. If you exclude +amounts under section 911 or own certain CFCs or PFICs, your +MAGI is your AGI as modified by certain rules described in +Regulations section 1.1411-10(e)(1). + +See Instructions + +[L18b] The undistributed net investment income of an estate or trust +(reported on line 18c) equals its net investment income (reported +on line 18a) reduced by the net investment income included in +the distributions to beneficiaries deductible by the estate or trust +under section 651 or 661, and by the net investment income for +which the estate or trust was entitled to a section 642(c) +deduction, in each case as calculated under Regulations section +1.642(c)-2 and the allocation and ordering rules under +Regulations section 1.662(b)-2. In the case of the S portion of an +Electing Small Business Trust, as defined by section 1361(e), +net investment income is further reduced by the net investment +income for which the trust was entitled to a section 170 +deduction. See Section 641(c)(2)(E). + +[L19a] If the estate or trust doesn’t own a CFC or PFIC, enter its AGI for +regular income tax purposes. +If the estate or trust owns a CFC or PFIC, it may need to make +adjustments. See Line 13—Modified Adjusted Gross Income +(MAGI), earlier. + +[L19b] See the instructions for Form 1041, Schedule G, line 1a, and the +instructions for Form 1041-QFT, line 12, for the dollar amount at +which the highest tax bracket begins for the tax year and enter +that amount here. + +In the case of a QFT, see Special computational rules for +qualified funeral trusts (QFTs), earlier, to determine the amount +to report on Form 8960, line 19b. + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8960_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8960_meta.dat new file mode 100755 index 0000000..673443b --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8960_meta.dat @@ -0,0 +1,46 @@ +Page 1 + + TxtColor: 0 0 0.6 + + CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi + ! round_to_whole_numbers + +YourName: 55 159 +YourSocSec#: 720 159 +CkSec6013g 279 178 +CkSec6013h 279 196 +CkSec1141_10g 279 214 +L1 770 233 12 +L2 770 251 12 +L3 770 270 12 +L4a 626 306 12 +L4b 626 343 12 +L4c 770 361 12 +L5a 626 380 12 +L5b 626 416 12 +L5c 626 453 12 +L5d 770 471 12 +L6 770 490 12 +L7 770 508 12 +L8 770 526 12 +L9a 626 563 12 +L9b 626 581 12 +L9c 626 600 12 +L9d 770 618 12 +L10 770 636 12 +L11 770 655 12 +L12 770 710 12 +L13 626 746 12 +L14 626 765 12 +L15 626 783 12 +L16 770 801 12 +L17 770 838 12 +L18a 626 875 12 +L18b 626 911 12 +L18c 626 948 12 +L19a 626 966 12 +L19b 626 985 12 +L19c 626 1003 12 +L20 770 1021 12 +L21 770 1058 12 diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8960_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8960_pdf.dat new file mode 100755 index 0000000..4953c3a Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8960_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8995_instructions.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8995_instructions.dat new file mode 100755 index 0000000..d76efed --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8995_instructions.dat @@ -0,0 +1,77 @@ +Instructions: + +[L1_i_a:] If you aggregated multiple trades or businesses into a single +business, enter the aggregation group name. For example, +Aggregation 1, 2, 3, etc., instead of entering the business name, +and leave line 1(b) blank. +Note. If you aggregated trades or businesses, you must attach +Schedule B (Form 8995-A) or similar schedule. +If you’re relying on the safe harbor contained in Rev. Proc. +2019-38, enter each enterprise as identified on the statement +required for use on the safe harbor. For example, Enterprise 1, 2, +3, etc. + +[L1_i_b:] Enter on line 1(b) the employer identification number (EIN). If +you don’t have an EIN, enter your social security number (SSN) +or individual taxpayer identification number (ITIN). If you’re the +sole owner of an LLC that isn’t treated as a separate entity for +federal income tax purposes, enter the EIN given to the LLC. If +you don’t have an EIN, enter the owner's name and tax +identification number. + +[L1_i_c] Enter on line 1(c) the net QBI or (loss) for the trade, business, +or aggregation reported in the corresponding row. Do not include +here any losses or deductions suspended from use in calculating +taxable income in the current year or any portion of qualified +losses or deductions previously suspended by other Code +provisions that are allowed in calculating taxable income in the +current year. For qualified business net (loss) carryforward from +the prior year, see instructions for line 3. + + +[L3] Include here the qualified portion of trade or business (loss) +carryforward allowed in calculating taxable income in the current +year, even if the loss was from a trade or business that is no +longer in existence. See Determining Your Qualified Business +Income, earlier, and Tracking Losses or Deductions Suspended +by Other Provisions, later. Losses and deductions that remain +suspended by other Code provisions are not qualified losses and +deductions and must be tracked separately for use when +subsequently allowed in calculating taxable income. + +[L6] Enter income as a positive number and losses as a negative +number. + +[L7] Include here the qualified portion of PTP (loss) carryforward +allowed in calculating taxable income in the current year, even if +the loss was from a PTP that you no longer hold an interest in or +is no longer in existence. Losses and deductions that remain +suspended by other Code provisions are not qualified losses and +deductions and must be tracked separately from any qualified +trade or business losses for use when subsequently allowed in +calculating taxable income. + +[L12] Enter the amount from your tax return as follows. +• Form 1040, 1040-SR, or 1040-NR, line 3a, plus your net +capital gain. If you’re not required to file Schedule D (Form +1040), your net capital gain is the amount reported on Form +1040, 1040-SR, or 1040-NR, line 7. If you file Schedule D (Form +1040), your net capital gain is the smaller of Schedule D (Form +1040), line 15 or 16, unless line 15 or 16 is zero or less, in which +case nothing is added to the qualified dividends. +• Form 1041, line 2b(2), plus your net capital gain. For estates +or trusts required to file Schedule D (Form 1041), add the +qualified dividends to the smaller of Schedule D (Form 1041), +line 18a(2), or line 19(2), unless either line 18a(2) or 19(2) is zero +or less, in which case nothing is added to the qualified dividends. +• Form 1041-N, line 2b, plus the smaller of Form 1041-N, +Schedule D, line 10 or 11, unless line 10 or 11 is zero or less, in +which case nothing is added to the qualified dividends. +• Form 990-T filers who are trusts, Schedule D (Form 1041), the +smaller of line 18a(2) or 19(2), unless either line 18a(2) or 19(2) +is zero or less, in which case the net capital gain for purposes of +section 199A is zero. +• S-corporation portion of an ESBT, your ESBT Tax Worksheet, +line 2b, plus the smaller of your ESBT’s Schedule D (Form +1041), line 18a(2) or 19(2) is zero or less, in which case nothing +is added to your qualified dividends. diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8995_meta.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8995_meta.dat new file mode 100755 index 0000000..06aae67 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8995_meta.dat @@ -0,0 +1,45 @@ +Page 1 + +CoordReference: 40, 750 61, 64 + 550, 50 841, 1134 110-dpi +! round_to_whole_numbers + +TxtColor: 0 0 0.6 +YourName: 60 176 +YourSocSec#: 676 176 +L1_i_a: 104 362 +L1_i_b: 608 362 +L1_i_c 771 362 11 +L1_ii_a: 104 398 +L1_ii_b: 608 398 +L1_ii_c 771 398 11 +L1_iii_a: 104 434 +L1_iii_b: 608 434 +L1_iii_c 771 434 11 +L1_iv_a: 104 472 +L1_iv_b: 608 472 +L1_iv_c 771 472 11 +L1_v_a: 104 508 +L1_v_b: 608 508 +L1_v_c 771 508 11 +L2 627 545 11 +display_without_sign L3 +L3 627 564 11 +L4 627 583 11 +L5 771 600 11 +L6 627 638 11 +display_without_sign L7 +L7 627 673 11 +L8 627 712 11 +L9 771 730 11 +L10 771 746 11 +L11 627 768 11 +L12 627 802 11 +L13 627 820 11 +L14 771 838 11 +L15 771 875 11 +display_without_sign L16 +L16 771 893 11 +display_without_sign L17 +L17 771 930 11 + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8995_pdf.dat b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8995_pdf.dat new file mode 100755 index 0000000..166b41b Binary files /dev/null and b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/formdata/f8995_pdf.dat differ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_AZ_140_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_AZ_140_2024.c new file mode 100755 index 0000000..04697cb --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_AZ_140_2024.c @@ -0,0 +1,798 @@ +/*********************************************************************** + TaxSolve_AZ_140_2024.c - Arizina State Tax Program. + Project: http://opentaxsolver.sourceforge.com/ + Date: 1-2-2025 + + GNU Public License - GPL: + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA + + Original Author: E. Strnod 9/12/2024 + ***********************************************************************/ + +float thisversion = 3.01; + +#include +#include +#include +#include +#include + +#include "taxsolve_get_fed_return_data.c" + +#define Yes 1 +#define No 0 + +#define STANDARD_DEDUCTION 0 +#define ITEMIZED_DEDUCTIONS 1 +#define QUALIFYING_PARENTS_AND_GRANDPARENTS_EXEMPTION_AMOUNT 10000; +#define AGE_65_OR_OVER_EXEMPTION_AMOUNT 2100 +#define BLIND_EXEMPTION_AMOUNT 1500 +#define OTHER_EXEMPTION_AMOUNT 2300 + + +/*----------------------------------------------------------------------------*/ + +double getAZStdDedAmt() +{ + double azStdDedAmt[5][1]={ /* Updated for 2024. */ + {0.0}, + { 14600.0 }, /* Single */ + { 29200.0 }, /* Married, filing jointly. */ + { 14600.0 }, /* Married, filing separate. */ + { 21900.0 } /* Head of Household. */ + }; + return azStdDedAmt[status][0]; +} + +double getAZTaxAmt( double azTaxableIncome ) +{ + double taxAmt = 0.0; + taxAmt = 0.025 * azTaxableIncome; /* Updated for 2024. */ + return taxAmt; +} + +int main( int argc, char *argv[] ) +{ + int i, j, k, deduction = 0, includePage4 = 0, numtaxpayers=1; + char word[4000], outfname[4000], prelim_1040_outfilename[5000], *infname = 0; + time_t now; + double L10a = 0.0, L10b = 0.0, L11a = 0.0; + double L29a = 0.0, L29b = 0.0; + double L34a = 0.0, L34b = 0.0; + double L40e = 0.0; + double L54a = 0.0, L54b = 0.0; + double SD1C = 0.0, SD2C = 0.0, SD3C = 0.0, SD4C = 0.0, SD5C = 0.0, SD6C = 0.0; + double OA_A = 0.0, OA_B = 0.0, OA_C = 0.0, OA_D = 0.0, OA_E = 0.0, OA_Fa = 0.0, OA_Fb = 0.0; + double OA_Ga = 0.0, OA_Gb = 0.0, OA_Ha = 0.0, OA_Hb = 0.0, OA_Hc = 0.0, OA_I = 0.0; + double OA_J = 0.0, OA_K = 0.0, OA_L = 0.0, OA_M = 0.0, OA_N = 0.0, OA_O = 0.0, OA_P = 0.0, + OA_Q = 0.0, OA_R = 0.0, OA_S = 0.0, OA_T = 0.0; + double OS_A = 0.0, OS_B = 0.0, OS_C = 0.0, OS_D = 0.0, OS_E = 0.0, OS_F = 0.0, OS_G = 0.0, + OS_H = 0.0, OS_I = 0.0, OS_J = 0.0, OS_K = 0.0, OS_L = 0.0, OS_M = 0.0, OS_N = 0.0, + OS_O = 0.0, OS_P = 0.0, OS_Q = 0.0, OS_R = 0.0, OS_S = 0.0, OS_T = 0.0, + OS_U = 0.0, OS_V = 0.0, OS_W = 0.0; + + printf("Arizona Form 140, 2023 - v%3.2f\n", thisversion); + + #if (0) + add_pdf_markup( "NotReady", 1, 240, 40, 17, 1, 1.0, 0, 0, "\"This program is NOT ready for 2024.\"" ); + #ifdef microsoft + system( "start bin\\notify_popup -delay 3 -expire 10 \"Warning: This program is NOT ready for 2024.\"" ); + #else + system( "bin/notify_popup -delay 3 -expire 10 \"Warning: This program is NOT ready for 2024.\" &" ); + #endif + #endif + + /* Decode any command-line arguments. */ + i = 1; + k = 1; + while (i < argc) { + if (strcmp(argv[i], "-verbose") == 0) { + verbose = 1; + } else if (k == 1) { + infname = strdup(argv[i]); + infile = fopen(infname, "r"); + if (infile == 0) { + printf("ERROR: Parameter file '%s' could not be opened.\n", + infname); + exit(1); + } + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname, infname); + j = strlen(outfname) - 1; + while ((j >= 0) && (outfname[j] != '.')) + j--; + if (j < 0) + strcat(outfname, "_out.txt"); + else + strcpy(&(outfname[j]), "_out.txt"); + 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 lines, something like: + Title: Form XXXX Return + L2 {Returns and Allowances} + . . . + */ + + /* Accept Form's "Title" line, and put out with date-stamp for your records. */ + read_line(infile, word); + now = time(0); + fprintf(outfile, "\n%s, v%2.2f, %s\n", word, thisversion, ctime(&now)); + + /* ----- Accept form data and process the numbers. ------ */ + /* ----- Place all your form-specific code below here .... ------ */ + + // Example: + // GetLineF( "L2", &L[2] ); + // GetLineF( "L3", &L[3] ); + // L[4] = L[2] - L[3]; + // showline_wlabel( "L4", L[4] ); + + get_parameter( infile, 's', word, "FileName1040:" ); /* Preliminary Fed Return Output File-name. */ + get_word(infile, prelim_1040_outfilename ); + ImportFederalReturnData( prelim_1040_outfilename, &PrelimFedReturn ); + + // transfer heading info to AZ form 1040 + fprintf(outfile, "Your1stName: %s\n", Your1stName ); + fprintf(outfile, "YourLastName: %s\n", YourLastName ); + fprintf(outfile, "YourSocSec#: %s\n", your_socsec ); + fprintf(outfile, "Spouse1stName: %s\n", Spouse1stName ); + fprintf(outfile, "SpouseLastName: %s\n", SpouseLastName ); + fprintf(outfile, "SpouseSocSec#: %s\n", spouse_socsec ); + fprintf(outfile, "Number&Street: %s\n", street_address ); + fprintf(outfile, "Apt#: %s\n", apartment ); + + // get daytime phone + GetTextLineF("DaytimePhone#:" ); + + fprintf(outfile, "Town/City: %s\n", town ); + fprintf(outfile, "State: %s\n", state ); + fprintf(outfile, "ZipCode: %s\n", zipcode ); + + // get prior last names + GetTextLineF("PriorLastNames:" ); + + get_parameter(infile, 's', word, "L4a_InjuredSpouse:"); + get_parameter(infile, 'b', &j, "L4a_InjuredSpouse:"); + + // filing status checkboxes + if (status == MARRIED_FILING_JOINTLY) { + fprintf(outfile, "L4Chk X\n"); + if (j != 0) + fprintf(outfile, "L4a_InjuredSpouseChk X\n"); + numtaxpayers = 2; + } else if (status == HEAD_OF_HOUSEHOLD) { + fprintf(outfile, "L5Chk X\n"); + // TODO L5 includes space to name qualifying child or dependent; + // this is also in 1040, but not collected by OTS. Ideally, it + // could be captured there and made use of here. + numtaxpayers = 1; + } else if (status == MARRIED_FILING_SEPARAT) { + fprintf(outfile, "L6Chk X\n"); + numtaxpayers = 1; + } else if (status == SINGLE) { + fprintf(outfile, "L7Chk X\n"); + numtaxpayers = 1; + } + + GetLineF("L8", &L[8]); // age 65+ filers + GetLineF("L9", &L[9]); // blind filers + GetLineF("L10a", &L10a); // dependents under 17 + GetLineF("L10b", &L10b); // dependents 17+ + GetLineF("L11a", &L11a); // qualifying parents / grandparents + + // dependents (if more than 3, optional page 4 will be activated below.) + for (j = 1; j <= 3; j++) // why is this 1-based?! + if (strlen(PrelimFedReturn.Dep1stName[j]) > 0) { + fprintf(outfile, "Dep%d_FirstName: %s\n", j, PrelimFedReturn.Dep1stName[j]); + fprintf(outfile, "Dep%d_LastName: %s\n", j, PrelimFedReturn.DepLastName[j]); + fprintf(outfile, "Dep%d_SocSec#: %s\n", j, PrelimFedReturn.DepSocSec[j]); + fprintf(outfile, "Dep%d_Relation: %s\n", j, PrelimFedReturn.DepRelation[j]); + } + if (strlen(PrelimFedReturn.Dep1stName[4]) > 0) { + fprintf(outfile, "L10_NeedMoreSpaceChk X\n"); + includePage4 = 1; + } + + get_parameter(infile, 's', word, "L11_NeedMoreSpace:"); + get_parameter(infile, 'b', &j, "L11_NeedMoreSpace:"); + if (j != 0) { + fprintf(outfile, "L11_NeedMoreSpaceChk X\n"); + includePage4 = 1; + } + GetTextLineF("L11b_PG1_FirstName:"); + GetTextLineF("L11b_PG1_LastName:"); + GetTextLineF("L11b_PG1_SocSec#:"); + GetTextLineF("L11b_PG1_Relation:"); + GetTextLineF("L11b_PG1_Months:"); + + get_parameter(infile, 's', word, "L11b_PG1_65Over:"); + get_parameter(infile, 'b', &j, "L11b_PG1_65Over:"); + if (j != 0) + fprintf(outfile, "L11b_PG1_65OverChk X\n"); + + get_parameter(infile, 's', word, "L11b_PG1_DiedTaxYr:"); + get_parameter(infile, 'b', &j, "L11b_PG1_DiedTaxYr:"); + if (j != 0) + fprintf(outfile, "L11b_PG1_DiedTaxYrChk X\n"); + + GetTextLineF("L11c_PG2_FirstName:"); + GetTextLineF("L11c_PG2_LastName:"); + GetTextLineF("L11c_PG2_SocSec#:"); + GetTextLineF("L11c_PG2_Relation:"); + GetTextLineF("L11c_PG2_Months:"); + + get_parameter(infile, 's', word, "L11c_PG2_65Over:"); + get_parameter(infile, 'b', &j, "L11c_PG2_65Over:"); + if (j != 0) + fprintf(outfile, "L11c_PG2_65OverChk X\n"); + + get_parameter(infile, 's', word, "L11c_PG2_DiedTaxYr:"); + get_parameter(infile, 'b', &j, "L11c_PG2_DiedTaxYr:"); + if (j != 0) + fprintf(outfile, "L11c_PG2_DiedTaxYrChk X\n"); + + // L12 Federal adjusted gross income here + L[12] = PrelimFedReturn.fedline[11]; /* Fed Wages (Fed 1040 line 11). */ + showline(12); + + + get_parameter(infile, 's', word, "L13_Filing140SBI:"); + get_parameter(infile, 'b', &j, "L13_Filing140SBI:"); + if (j != 0) + fprintf(outfile, "L13_Filing140SBIChk X\n"); + + // Additions + GetLineF("L13", &L[13]); + GetLineF("L15", &L[15]); + GetLineF("L16", &L[16]); + GetLineF("L17", &L[17]); + + // Other Additions to Arizona Gross Income (Schedule) + GetLine("OA_A", &OA_A); + GetLine("OA_B", &OA_B); + GetLine("OA_C", &OA_C); + GetLine("OA_D", &OA_D); + GetLine("OA_E", &OA_E); + GetLine("OA_Fa", &OA_Fa); + GetLine("OA_Fb", &OA_Fb); + GetLine("OA_Ga", &OA_Ga); + GetLine("OA_Gb", &OA_Gb); + GetLine("OA_Ha", &OA_Ha); + GetLine("OA_Hb", &OA_Hb); + GetLine("OA_Hc", &OA_Hc); + GetLine("OA_I", &OA_I); + GetLine("OA_J", &OA_J); + GetLine("OA_K", &OA_K); + GetLine("OA_L", &OA_L); + GetLine("OA_M", &OA_M); + GetLine("OA_N", &OA_N); + GetLine("OA_O", &OA_O); + GetLine("OA_P", &OA_P); + GetLine("OA_Q", &OA_Q); + GetLine("OA_R", &OA_R); + GetLine("OA_S", &OA_S); + + // Add lines OA_A thru OA_R for OA_S and L18 + OA_T = OA_A + OA_B + OA_C + OA_D + OA_E + OA_Fa + OA_Fb + OA_Ga + OA_Gb + OA_Ha + OA_Hb + OA_Hc + OA_I + + OA_J + OA_K + OA_L + OA_M + OA_N + OA_O + OA_P + OA_Q + OA_R + OA_T; + L[18] = OA_T; + + showline(18); + + // modified federal adjusted gross income + L[14] = L[12] - L[13]; + + showline(14); + + // subtotal + // do AFTER L18 is calculated!! + L[19] = L[14] + L[15] + L[16] + L[17] + L[18]; + showline(19); + + // Subtractions + + // TODO lines 20-23 (Net Capital Gain/Loss) are (I think) handled by US_1040 but are not in struct FedReturnData. + // Since this appears to be an optional form in OTS and I am not sure yet how this is done, punting and + // having the user enter these values again here if they apply. + GetLineF("L20", &L[20]); + GetLineF("L21", &L[21]); + GetLineF("L22", &L[22]); + GetLineF("L23", &L[23]); + + L[24] = L[23] * 0.25; /* Updated for 2024. */ + showline(24); + + GetLineF("L25", &L[25]); + GetLineF("L26", &L[26]); + GetLineF("L27", &L[27]); + GetLineF("L28", &L[28]); + GetLine("L29a", &L29a); + + // validate 29a - no greater than $2500 per taxpayer + if (L29a > 2500.0 * numtaxpayers) { + printf("Error: Line 29a entry '%9.2f' (Exclusion for U.S. Gov't, AZ State or Local Gov't Pensions) may not exceed $2500 per taxpayer. Limiting.\n", L29a); + fprintf(outfile,"Error: Line 29a entry '%9.2f' (Exclusion for U.S. Gov't, AZ State or Local Gov't Pensions) may not exceed $2500 per taxpayer. Limiting.\n", L29a); + L29a = 2500.0 * numtaxpayers; // exit(1); + } + showline_wlabel( "L29a", L29a ); + + GetLineF("L29b", &L29b); + GetLineF("L30", &L[30]); + GetLineF("L31", &L[31]); + GetLineF("L32", &L[32]); + GetLineF("L33", &L[33]); + GetLineF("L34a", &L34a); + GetLineF("L34b", &L34b); + + L[34] = L34a + L34b; + showline(34); + + // Subtract lines 24 thru 34c from L19 and place in L35 + L[35] = L[19] - (L[24] + L[25] + L[26] + L[27] + L[28] + L29a + L29b + L[30] + L[31] + L[32] + L[33] + L[34]); + showline(35); + + // Exemptions + + + // Other Subtractions from Arizona Gross Income (Schedule) + GetLine("OS_A", &OS_A); + GetLine("OS_B", &OS_B); + GetLine("OS_C", &OS_C); + GetLine("OS_D", &OS_D); + GetLine("OS_E", &OS_E); + GetLine("OS_F", &OS_F); + GetLine("OS_G", &OS_G); + GetLine("OS_H", &OS_H); + GetLine("OS_I", &OS_I); + GetLine("OS_J", &OS_J); + GetLine("OS_K", &OS_K); + GetLine("OS_L", &OS_L); + GetLine("OS_M", &OS_M); + GetLine("OS_N", &OS_N); + GetLine("OS_O", &OS_O); + GetLine("OS_P", &OS_P); + GetLine("OS_Q", &OS_Q); + GetLine("OS_R", &OS_R); + GetLine("OS_S", &OS_S); + GetLine("OS_T", &OS_T); + GetLine("OS_U", &OS_U); + GetLine("OS_V", &OS_V); + + // Add lines OS_A thru OS_S for OS_T and L36 + OS_W = OS_A + OS_B + OS_C + OS_D + OS_E + OS_F + OS_G + OS_H + OS_I + OS_J + OS_K + OS_L + OS_M + OS_N + + OS_O + OS_P + OS_Q + OS_R + OS_S + OS_T + OS_U + OS_V; + L[36] = OS_W; + showline(36); + + // whole name for subsequent page + fprintf(outfile,"YourName: %s, %s\n", YourLastName, Your1stName); + + + // do AFTER L36 is calculated!! + L[37] = L[35] - L[36]; + showline(37); + + // multiply L8 (number of filers over 65) by 2100 (make it a constant) + // and place in L38. + // validate this against 1040 + if (PrelimFedReturn.Over65 + PrelimFedReturn.SpouseOver65 != L[8]) { + printf("Warning: Number of filers over 65 does not match Fed return Over65/SpouseOver65 responses.\n"); + fprintf(outfile, "Warning: Number of filers over 65 does not match Fed return Over65/SpouseOver65 responses.\n"); + } + L[38] = L[8] * AGE_65_OR_OVER_EXEMPTION_AMOUNT; + showline(38); + + // multiply L9 (number of filers blind) by 1500 (make it a constant) + // and place in L39. + // validate this against 1040 + if (PrelimFedReturn.Blind + PrelimFedReturn.SpouseBlind != L[9]) { + printf("Warning: Number of filers blind does not match Fed return YouBlind/SpouseBlind responses.\n"); + fprintf(outfile, "Warning: Number of filers blind does not match Fed return YouBlind/SpouseBlind responses.\n"); + } + L[39] = L[9] * BLIND_EXEMPTION_AMOUNT; + showline(39); + + // Other Exemptions - collect total number in 40e, multiply by 2300 (make it a constant) and place in L40 + // (part 3 list collection not handled here.) + GetLineF("L40e", &L40e); + L[40] = L40e * OTHER_EXEMPTION_AMOUNT; + showline(40); + if (L40e > 0) + includePage4 = 1; + + + // multiply number in box 11a (qualifying parents & grandparents) by 10,000 and place in L41 + L[41] = L11a * QUALIFYING_PARENTS_AND_GRANDPARENTS_EXEMPTION_AMOUNT; + showline(41); + + // subtract lines 38 through 41 from L37 and place greater of 0 or result in L42 + L[42] = NotLessThanZero( L[37] - L[38] - L[39] - L[40] - L[41] ); + showline(42); + + // Balance of Tax + get_parameter( infile, 's', word, "L43_Deductions:" ); /* Itemized, Standard */ + get_parameter( infile, 'l', word, "L43_Deductions:"); + GetLine("L43", &L[43]); + if (strncasecmp(word,"Itemized",8)==0) { + deduction = ITEMIZED_DEDUCTIONS; + fprintf(outfile, "L43_DeductionsItemizedChk X\n"); + + } else if (strncasecmp(word,"Standard",8)==0) { + deduction = STANDARD_DEDUCTION; + fprintf(outfile, "L43_DeductionsStandardChk X\n"); + // calculate the standard deduction amount (use constants) and place in L43. + L[43] = getAZStdDedAmt(); + } else { + printf("Error: unrecognized deduction type '%s'. Exiting.\n", word); + fprintf(outfile,"Error: unrecognized deduction '%s'. Exiting.\n", word); + exit(1); + } + showline(43); + +/* // this is checked automatically below, after the worksheet is done, if amount is > 0. + get_parameter( infile, 's', word, "L44C_Charitable:" ); Yes, No + get_parameter( infile, 'b', &j, "L44C_Charitable:"); + if (j != 0) { + fprintf(outfile, "L44C_CharitableChk X\n"); + stdWithCharContrib = j; + }*/ + // Standard Deductions Increase for Charitable Contributions (Worksheet) + GetLine("SD1C", &SD1C); + GetLine("SD2C", &SD2C); + GetLine("SD3C", &SD3C); + + // Add lines 1C thru 3C for 4C + SD4C = SD1C + SD2C + SD3C; + + GetLine("SD5C", &SD5C); + + // subtract 5C from 4C for 6C (minimum 0) + SD6C = (SD5C > SD4C ? 0 : SD4C - SD5C); + if (SD6C > 0) { + // validate that 43I is not checked, if worksheet was filled out + if (deduction == ITEMIZED_DEDUCTIONS) { + printf("Error: Charitable contributions entered in Standard Deduction worksheet with Itemized deduction selection. Exiting.\n"); + fprintf(outfile,"Error: Charitable contributions entered Standard Deduction worksheet with Itemized deduction selection. Exiting.\n"); + exit(1); + } + fprintf(outfile, "L44_CharitableChk X\n"); + } + + + // multiply 6C by 33% for 7C and place result in L44 + L[44] = SD6C * 0.33; /* Updated for 2024. */ + showline(44); + + // subtract L43 and L44 from L42 and place greater of 0 or result in L45 (taxable income) + L[45] = NotLessThanZero( L[42] - L[44] - L[43] ); + showline(45); + + // calculate tax amount and place in L46 + L[46] = getAZTaxAmt( L[45] ); + showline(46); + + GetLineF( "L47", &L[47] ); + + // Add L46 and L47 and place total in L48 (tax subtotal) + L[48] = L[46] + L[47]; + showline(48); + + // TODO hairball dependent tax credit calculation for L49 :-( Punting and collecting the final result for now: + GetLineF("L49", &L[49]); + + // TODO hairball family income tax credit calculation for L50 :-( Punting and collecting the final result for now: + GetLineF("L50", &L[50]); + + GetLineF("L51", &L[51]); + + // subtract L49, L50 & L51 from L48 and place result in L52; if SUM of L49, L50 & L51 is > L48, zero L52. + int credits = L[49] + L[50] + L[51]; + L[52] = (credits > L[48] ? 0 : L[48] - credits); + showline(52); + + GetLineF("L53", &L[53]); + GetLineF("L54a", &L54a); + GetLineF("L54b", &L54b); + L[54] = L54a + L54b; + showline(54); + GetLineF("L55", &L[55]); + GetLineF("L56", &L[56]); + GetLineF("L57", &L[57]); + + get_parameter(infile, 's', word, "L58_Filing308I:"); + get_parameter(infile, 'b', &j, "L58_Filing308I:"); + if (j != 0) + fprintf(outfile, "L58_Filing308IChk X\n"); + + get_parameter(infile, 's', word, "L58_Filing334:"); + get_parameter(infile, 'b', &j, "L58_Filing334:"); + if (j != 0) + fprintf(outfile, "L58_Filing334Chk X\n"); + + get_parameter(infile, 's', word, "L58_Filing349:"); + get_parameter(infile, 'b', &j, "Filing349:"); + if (j != 0) + fprintf(outfile, "L58_Filing349Chk X\n"); + + GetLineF("L58", &L[58]); + + // Add lines 53 through 58 and place result in L59 + L[59] = L[53] + L[54] + L[55] + L[56] + L[57] + L[58]; + showline(59); + + // Tax Due or Overpayment + GetLine("L62", &L[62]); + + // If L52 > L59, subtract L59 from L52, place result in L60, and skip lines 61, 62 and 63 + if (L[52] > L[59]) { + L[60] = L[52] - L[59]; + showline(60); + + if (L[62] > 0) { + printf("Error: Line 62 entry '%9.2f' (amount of overpayment to be applied to next tax year) does not apply, as there is an amount due. Exiting.\n", L[62]); + fprintf(outfile,"Error: Line 62 entry '%9.2f' (amount of overpayment to be applied to next tax year) does not apply, as there is an amount due. Exiting.\n", L[62]); + exit(1); + } + } else { + // (Line 61) If L59 > L52, subtract L52 from L59 and place result in L61 + if (L[59] > L[52]) { + L[61] = L[59] - L[52]; + showline(61); + } + + + if (L[62] > L[61]) { + printf("Error: Line 62 entry '%9.2f' (amount of overpayment to be applied to next tax year) exceeds overpayment '%9.2f'. Exiting.\n", L[62], L[61]); + fprintf(outfile,"Error: Line 62 entry '%9.2f' (amount of overpayment to be applied to next tax year) exceeds overpayment '%9.2f'. Exiting.\n", L[62], L[61]); + exit(1); + } + + showline(62); + + // (line 63) Subtract L62 from L61 and place result in L63 + L[63] = L[61] - L[62]; + showline(63); + } + + // Voluntary Gifts + GetLineF("L64", &L[64]); + GetLineF("L65", &L[65]); + GetLineF("L66", &L[66]); + GetLineF("L67", &L[67]); + GetLineF("L68", &L[68]); + GetLineF("L69", &L[69]); + GetLineF("L70", &L[70]); + GetLineF("L71", &L[71]); + GetLineF("L72", &L[72]); + GetLineF("L73", &L[73]); + GetLineF("L74", &L[74]); + + get_parameter( infile, 's', word, "L75_PoliticalParty" ); /* none, Democratic, Libertarian, Republican */ + get_parameter( infile, 'l', word, "L75_PoliticalParty"); + + j = strncasecmp(word,"none",4); + if (j==0 && L[68] == 0.0) { + // no political gift amount entered and 'none' political party selected, so we can stop checking party selection + } else if (j==0 && L[68] != 0.0) { + // political gift amount entered but no party selected + printf("Error: political party '%s' selected but gift amount entered. Exiting.\n", word); + fprintf(outfile,"Error: political party '%s' selected but gift amount entered. Exiting.\n", word); + exit(1); + } else if (j!=0 && L[68] == 0.0) { + // no political gift amount entered but something other than "none" entered as party + printf("Error: political party '%s' selected but no gift amount entered. Exiting.\n", word); + fprintf(outfile,"Error: political party '%s' selected but no gift amount entered. Exiting.\n", word); + exit(1); + } else if (strncasecmp(word,"Democratic",10)==0) { + fprintf(outfile, "L75_DemocraticChk X\n"); + } else if (strncasecmp(word,"Libertarian",11)==0) { + fprintf(outfile, "L75_LibertarianChk X\n"); + } else if (strncasecmp(word,"Republican",10)==0) { + fprintf(outfile, "L75_RepublicanChk X\n"); + } else { + printf("Error: unrecognized political party '%s'. Exiting.\n", word); + fprintf(outfile,"Error: unrecognized political party '%s'. Exiting.\n", word); + exit(1); + } + + // Penalty + GetLineF("L76", &L[76]); + + get_parameter(infile, 's', word, "L77_1AnnualizedOther:"); + get_parameter(infile, 'b', &j, "L77_1AnnualizedOther:"); + if (j != 0) + fprintf(outfile, "L77_1AnnualizedOtherChk X\n"); + + get_parameter(infile, 's', word, "L77_2FarmerFisherman:"); + get_parameter(infile, 'b', &j, "L77_2FarmerFisherman:"); + if (j != 0) + fprintf(outfile, "L77_2FarmerFishermanChk X\n"); + + get_parameter(infile, 's', word, "L77_Filing221:"); + get_parameter(infile, 'b', &j, "L77_Filing221:"); + if (j != 0) + fprintf(outfile, "L77_Filing221Chk X\n"); + + // add lines 64 through 74 and 76 and enter total in L78 + L[78] = L[64] + L[65] + L[66] + L[67] + L[68] + L[69] + L[70] + L[71] + L[72] + L[73] + L[74] + L[76]; + showline(78); + + // Refund or Amount Owed + // subtract L78 from L63 and place abs value in L79 if greater than zero or if less than or equal to 0, place abs value in L80 + double balance = L[63] - L[78]; + if (balance <= 0) { + // Add lines 60 and 78; enter the amount you owe on line 80 + L[80] = L[60] + L[78]; + // TODO these next instructions (under line 80) are a little confusing (slightly contradictory with the prior): + // "If you are making voluntary gifts on lines 64 - 74 in excess of your overpayment, + // enter the difference on line 80." (Not modifying the prior calculation for this, as it seems to be handled.) + showline(80); // amount owed + } else { + L[79] = balance; + showline(79); // refund + } + + get_parameter(infile, 's', word, "L79_ForeignAcct:"); + get_parameter(infile, 'b', &j, "L79_ForeignAcct:"); + if (j != 0) + fprintf(outfile, "L79_ForeignAcctChk X\n"); + + // Standard Deductions worksheet (optional) + if (SD6C > 0) { + // include the optional worksheet page + // TODO (no documentation found on format of this command in outfile; copying from US 1040) + fprintf(outfile, "PDFpage: 3 3\n"); /* Optional PDF Page. */ + showline_wlabel("SD1C", SD1C); + showline_wlabel("SD2C", SD2C); + showline_wlabel("SD3C", SD3C); + showline_wlabel("SD4C", SD4C); + showline_wlabel("SD5C", SD5C); + showline_wlabel("SD6C", SD6C); + showline_wlabel("SD7C", L[44]); + showline(44); + fprintf(outfile, "EndPDFpage.\n"); + } + + if (includePage4 > 0) { + // include the optional page to list additional dependents + // TODO (no documentation found on format of this command in outfile; copying US 1040) + fprintf(outfile,"PDFpage: 4 4\nEndPDFpage.\n"); /* Optional PDF Page. */ + // This page will not be filled out; it is being provided for the user to fill out manually. + } + + if (L[18] > 0.0) { + // include optional page to list other additions + // TODO (no documentation found on format of this command in outfile; copying US 1040) + fprintf(outfile,"PDFpage: 5 5\n"); /* Optional PDF Page. */ + // Other Additions to Arizona Gross Income (Schedule) + showline_wlabel("OA_A", OA_A); + showline_wlabel("OA_B", OA_B); + showline_wlabel("OA_C", OA_C); + showline_wlabel("OA_D", OA_D); + showline_wlabel("OA_E", OA_E); + showline_wlabel("OA_Fa", OA_Fa); + showline_wlabel("OA_Fb", OA_Fb); + showline_wlabel("OA_Ga", OA_Ga); + showline_wlabel("OA_Gb", OA_Gb); + showline_wlabel("OA_Ha", OA_Ha); + showline_wlabel("OA_Hb", OA_Hb); + showline_wlabel("OA_Hc", OA_Hc); + showline_wlabel("OA_I", OA_I); + showline_wlabel("OA_J", OA_J); + showline_wlabel("OA_K", OA_K); + showline_wlabel("OA_L", OA_L); + showline_wlabel("OA_M", OA_M); + showline_wlabel("OA_N", OA_N); + showline_wlabel("OA_O", OA_O); + showline_wlabel("OA_P", OA_P); + showline_wlabel("OA_Q", OA_Q); + showline_wlabel("OA_R", OA_R); + showline_wlabel("OA_S", OA_S); + showline_wlabel("OA_T", OA_T); + showline(18); + fprintf(outfile,"EndPDFpage.\n"); /* Optional PDF Page. */ + } + + if (L[36] > 0.0) { + // include optional page to list other subtractions + fprintf(outfile,"PDFpage: 6 6\n"); /* Optional PDF Page. */ + // TODO (no documentation found on format of this command in outfile; copying US 1040) + // Other Subtractions from Arizona Gross Income (Schedule) + showline_wlabel("OS_A", OS_A); + showline_wlabel("OS_B", OS_B); + showline_wlabel("OS_C", OS_C); + showline_wlabel("OS_D", OS_D); + showline_wlabel("OS_E", OS_E); + showline_wlabel("OS_F", OS_F); + showline_wlabel("OS_G", OS_G); + showline_wlabel("OS_H", OS_H); + showline_wlabel("OS_I", OS_I); + showline_wlabel("OS_J", OS_J); + showline_wlabel("OS_K", OS_K); + showline_wlabel("OS_L", OS_L); + showline_wlabel("OS_M", OS_M); + showline_wlabel("OS_N", OS_N); + showline_wlabel("OS_O", OS_O); + showline_wlabel("OS_P", OS_P); + showline_wlabel("OS_Q", OS_Q); + showline_wlabel("OS_R", OS_R); + showline_wlabel("OS_S", OS_S); + showline_wlabel("OS_T", OS_T); + showline_wlabel("OS_U", OS_U); + showline_wlabel("OS_V", OS_V); + showline_wlabel("OS_W", OS_W); + showline(36); + fprintf(outfile,"EndPDFpage.\n"); /* Optional PDF Page. */ + + } + + + /* ----- .... Until here. ----- */ + + /*** + Summary of useful functions: + GetLine( "label", &variable ) - Looks for "label" in input file, and places the corresponding sum of + values following that label (until ";") into variable. + GetLineF( "label", &variable ) - Like GetLine() above, but also writes the result to the output file. + GetLineFnz(( "label", &variable ) - Like GetLine(), but only writes non-zero values to the output file. + GetLine1( "label", &variable ) - Like GetLine() above, but expects single value (no sum, no ";" in input file). + + c = SmallerOf( a, b ); - Selects smaller of two values. + c = LargerOf( a, b ); - Selects larger of two values. + c = NotLessThanZero( a ); - Selects positive value or zero. Prevents negative values. + + showline( j ) - Writes currency value of L[j] to output file with label in nice format. + shownum( j ) - Writes integer value of L[j] to output file with label in nice format. + showline_wmsg( j, "msg" ) - Like showline, but adds the provided message to the output line. + ShowLineNonZero( j ) - Like showline, but only writes non-zero values. + ShowLineNonZero_wMsg( j, "msg" ) - Like showline_wmsg, but only writes non-zero values. + showline_wlabel( "label", value ) - For custom line names and variables not in the default L[] array. + showline_wlabelnz( "label", value ) - Like showline_wlabel, but only writes non-zero values. + showline_wlabelmsg( "label", value, "msg" ) - Like showline_wlabel,but adds the provided message to the output line. + ***/ + + fclose(infile); + grab_any_pdf_markups(infname, outfile); + fclose(outfile); + + printf("\nListing results from file: %s\n\n", outfname); + Display_File(outfname); + + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_CA_540_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_CA_540_2024.c new file mode 100755 index 0000000..2f71f3d --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_CA_540_2024.c @@ -0,0 +1,1854 @@ +/************************************************************************/ +/* TaxSolve_CA_540_2024.c - California state 540 tax form. */ +/* Copyright (C) 2025 - Aston Roberts */ +/* */ +/* Compile: gcc taxsolve_CA_540_2024.c -lm -o taxsolve_CA_540_2024 */ +/* Run: ./taxsolve_CA_540_2024 CA_540_2024.txt */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ +/* */ +/* Aston Roberts 1-2-2025 aston_roberts@yahoo.com */ +/************************************************************************/ + +float thisversion=22.03; + +#include +#include +#include +#include +#include +#include + +#include "taxsolve_routines.c" + +#define SINGLE 1 +#define MARRIED_FILING_JOINTLY 2 +#define MARRIED_FILING_SEPARAT 3 +#define HEAD_OF_HOUSEHOLD 4 +#define WIDOW 5 + +int status=0; /* Value for filing status. */ +double sched540part2[MAX_LINES], sched540part2_sub[MAX_LINES], sched540part2_add[MAX_LINES], + sched540part2_5a=0.0, sched540part2_5b=0.0, sched540part2_5c=0.0, sched540part2_5d=0.0, + sched540part2_8a=0.0, sched540part2_8b=0.0, sched540part2_8c=0.0, + sched540part2_add8a=0.0, sched540part2_add8b=0.0, sched540part2_add8c=0.0, sched540part2_sub8d=0.0; + char *Your1stName="", *YourLastName="", *your_socsec="", + *Spouse1stName="", *SpouseLastName="", *spouse_socsec="", + *street_address="", *apartment="", *town="", *zipcode=""; + + +double TaxRateFormula( double income, int status ) +{ /* Updated for 2024. */ + double tax; + if ((status==SINGLE) || (status==MARRIED_FILING_SEPARAT)) + { + if (income < 10756.00) tax = 0.01 * income; else + if (income < 25499.00) tax = 107.56 + 0.02 * (income - 10756.00); else + if (income < 40245.00) tax = 402.42 + 0.04 * (income - 25499.00); else + if (income < 55866.00) tax = 992.26 + 0.06 * (income - 40245.00); else + if (income < 70606.00) tax = 1929.52 + 0.08 * (income - 55866.00); else + if (income < 360659.00) tax = 3108.72 + 0.093 * (income - 70606.00); else + if (income < 432787.00) tax = 30083.65 + 0.103 * (income - 360659.00); else + if (income < 721314.00) tax = 37512.83 + 0.113 * (income - 432787.00); + else tax = 70116.38 + 0.123 * (income - 721314.00); + } + else + if ((status==MARRIED_FILING_JOINTLY) || (status==WIDOW)) + { + if (income < 21512.00) tax = 0.01 * income; else + if (income < 50998.00) tax = 215.12 + 0.02 * (income - 21512.00); else + if (income < 80490.00) tax = 804.84 + 0.04 * (income - 50998.00); else + if (income < 111732.00) tax = 1984.52 + 0.06 * (income - 80490.00); else + if (income < 141212.00) tax = 3859.04 + 0.08 * (income - 111732.00); else + if (income < 721318.00) tax = 6217.44 + 0.093 * (income - 141212.00); else + if (income < 865574.00) tax = 60167.30 + 0.103 * (income - 721318.00); else + if (income < 1442628.00) tax = 75025.67 + 0.113 * (income - 865574.00); + else tax = 140232.77 + 0.123 * (income - 1442628.00); + } + else + { /* Head of Household. */ + if (income < 21527.00) tax = 0.01 * income; else + if (income < 51000.00) tax = 215.27 + 0.02 * (income - 21527.00); else + if (income < 65744.00) tax = 804.73 + 0.04 * (income - 51000.00); else + if (income < 81364.00) tax = 1394.49 + 0.06 * (income - 65744.00); else + if (income < 96107.00) tax = 2331.69 + 0.08 * (income - 81364.00); else + if (income < 490493.00) tax = 3511.13 + 0.093 * (income - 96107.00); else + if (income < 588593.00) tax = 40189.03 + 0.103 * (income - 490493.00); else + if (income < 980987.00) tax = 50293.33 + 0.113 * (income - 588593.00); + else tax = 94633.85 + 0.123 * (income - 980987.00); + } + return (int)(tax+0.5); +} + + +void Report_bracket_info( double income, int status ) +{ + double tx, rate; + tx = TaxRateFormula( income, status ); + if ((status==SINGLE) || (status==MARRIED_FILING_SEPARAT)) + { + if (income < 10756.00) rate = 0.01; else + if (income < 25499.00) rate = 0.02; else + if (income < 40245.00) rate = 0.04; else + if (income < 55866.00) rate = 0.06; else + if (income < 70606.00) rate = 0.08; else + if (income < 360659.00) rate = 0.093; else + if (income < 432787.00) rate = 0.103; else + if (income < 721314.00) rate = 0.113; else rate = 0.123; + } + else + if ((status==MARRIED_FILING_JOINTLY) || (status==WIDOW)) + { + if (income < 21512.00) rate = 0.01; else + if (income < 50998.00) rate = 0.02; else + if (income < 80490.00) rate = 0.04; else + if (income < 111732.00) rate = 0.06; else + if (income < 141212.00) rate = 0.08; else + if (income < 721318.00) rate = 0.093; else + if (income < 865574.00) rate = 0.103; else + if (income < 1442628.00) rate = 0.113; else rate = 0.123; + } + else + { + if (income < 21527.00) rate = 0.01; else + if (income < 51000.00) rate = 0.02; else + if (income < 65744.00) rate = 0.04; else + if (income < 81364.00) rate = 0.06; else + if (income < 96107.00) rate = 0.08; else + if (income < 490493.00) rate = 0.093; else + if (income < 588593.00) rate = 0.103; else + if (income < 980987.00) rate = 0.113; else rate = 0.123; + } + printf(" You are in the %2.1f%% marginal tax bracket,\n and you are paying an effective %2.1f%% tax on your total income.\n", + 100.0 * rate, 100.0 * tx / income ); + fprintf(outfile," You are in the %2.1f%% marginal tax bracket,\n and you are paying an effective %2.1f%% tax on your total income.\n", + 100.0 * rate, 100.0 * tx / income ); +} + + +double TaxRateFunction( double income, int status ) /* Emulates table lookup or function appropriately. */ +{ + double x, tx; + int k; + + if (income < 100000.0) /* Quantize to match tax-table exactly. */ + { + if (income < 99951.0) + { + k = (income + 49) / 100; + x = 100 * (double)k; + } + else x = 99975.0; + tx = (int)(TaxRateFormula( x, status )); + } + else + tx = TaxRateFormula( income, status ); + return tx; +} + + +void test_tax_function() +{ + double income; + for (income=50.0; income < 100000.0; income = income + 100.0) + printf("%g: %8g %8g %8g\n", income, + TaxRateFunction( income, SINGLE ), + TaxRateFunction( income, MARRIED_FILING_JOINTLY ), + TaxRateFunction( income, HEAD_OF_HOUSEHOLD ) ); + exit(0); +} + + +/*----------------------------------------------------------------------------*/ + + +struct FedReturnData + { + double fedline[MAX_LINES], schedA[MAX_LINES], + fed_L1a, fed_L1b, fed_L1c, fed_L1d, fed_L1e, fed_L1f, fed_L1g, fed_L1h, fed_L1z, + fed_L2a, fed_L3a, + fed_L4a, fed_L4b, fed_L5a, fed_L5b, fed_L6a, fed_L6b, + schedA5a, schedA5b, schedA5c, schedA5, + schedA8a, schedA8b, schedA8c, schedA8d, + sched1[MAX_LINES], s1_8[30], s1_24[30], s2_17[30], s3_6[30], s3_13[30], + fedl8b, fedl9b, fedl15a, fedl16a, fedl20a; + int Exception, Itemized; + char AlimRecipSSN[512], *AlimRecipName, OtherIncomeType[512], + OtherAdjustmentsType[512], OtherTaxesType[512], + Dep1stName[10][512], DepLastName[10][512], + DepSocSec[10][512], DepRelation[10][512]; + } PrelimFedReturn; + + +void convert_slashes( char *fname ) +{ /* Convert slashes in file name based on machine type. */ + char *ptr; + #ifdef __MINGW32__ + char slash_sreach='/', slash_replace='\\'; + #else + char slash_sreach='\\', slash_replace='/'; + #endif + ptr = strchr( fname, slash_sreach ); + while (ptr) + { + ptr[0] = slash_replace; + ptr = strchr( fname, slash_sreach ); + } +} + + +void grab_line_value( char *label, char *fline, double *value ) +{ + char twrd[2048]; + next_word(fline, twrd, " \t=;"); + if ((twrd[0] != '\0') && (sscanf(twrd,"%lf", value) != 1)) + { + printf("Error: Reading Fed %s '%s%s'\n", label, twrd, fline); + fprintf(outfile,"Error: Reading Fed %s '%s%s'\n", label, twrd, fline); + } +} + + +void grab_line_string( char *fline, char *strng ) +{ /* Grab a string and copy it into pre-allocated character array. */ + char twrd[2048]; + strng[0] = '\0'; + do + { + next_word(fline, twrd, " \t=" ); + if (twrd[0] != ';') + { strcat( strng, twrd ); strcat( strng, " " ); } + } + while ((fline[0] != '\0') && (strstr( twrd, ";" ) == 0)); +} + + +void grab_line_alloc( char *fline, char **strng ) +{ /* Grab a string and allocate space for it. */ + char twrd[4096]; + grab_line_string( fline, twrd ); + if (twrd[0] != '\0') + *strng = strdup( twrd ); +} + + +int ImportFederalReturnData( char *fedlogfile, struct FedReturnData *fed_data ) +{ + FILE *infile; + char fline[2000], word[2000], tword[2000]; + int linenum, j; + + for (linenum=0; linenumfedline[linenum] = 0.0; + fed_data->schedA[linenum] = 0.0; + fed_data->sched1[linenum] = 0.0; + } + fed_data->fed_L1a = 0; + fed_data->fed_L1b = 0; + fed_data->fed_L1c = 0; + fed_data->fed_L1d = 0; + fed_data->fed_L1e = 0; + fed_data->fed_L1f = 0; + fed_data->fed_L1g = 0; + fed_data->fed_L1h = 0; + fed_data->fed_L1z = 0; + fed_data->fed_L2a = 0; + fed_data->fed_L3a = 0; + fed_data->fed_L4a = 0; + fed_data->fed_L4b = 0; + fed_data->fed_L5a = 0; + fed_data->fed_L5b = 0; + fed_data->fed_L6a = 0; + fed_data->fed_L6b = 0; + fed_data->schedA5a = 0.0; + fed_data->schedA5b = 0.0; + fed_data->schedA5c = 0.0; + fed_data->schedA8a = 0.0; + fed_data->schedA8b = 0.0; + fed_data->schedA8c = 0.0; + fed_data->schedA8d = 0.0; + + fed_data->fedl8b = 0.0; + fed_data->fedl9b = 0.0; + fed_data->fedl15a = 0.0; + fed_data->fedl16a = 0.0; + fed_data->fedl20a = 0.0; + for (j=0; j < 30; j++) + { + fed_data->s1_8[j] = 0.0; + fed_data->s1_24[j] = 0.0; + fed_data->s2_17[j] = 0.0; + fed_data->s3_6[j] = 0.0; + fed_data->s3_13[j] = 0.0; + } + strcpy( fed_data->AlimRecipSSN, "" ); + fed_data->AlimRecipName = strdup( "" ); + strcpy( fed_data->OtherIncomeType, "" ); + strcpy( fed_data->OtherAdjustmentsType, "" ); + strcpy( fed_data->OtherTaxesType, "" ); + for (j=0; j < 5; j++) + { + strcpy( fed_data->Dep1stName[j], "" ); + strcpy( fed_data->DepLastName[j], "" ); + strcpy( fed_data->DepSocSec[j], "" ); + strcpy( fed_data->DepRelation[j], "" ); + } + convert_slashes( fedlogfile ); + infile = fopen(fedlogfile, "r"); + if (infile==0) + { + printf("Error: Could not open Federal return '%s'\n", fedlogfile); + fprintf(outfile,"Error: Could not open Federal return '%s'\n", fedlogfile); + exit( 1 ); + } + fed_data->Itemized = 1; /* Set initial default values. */ + read_line(infile,fline); linenum = 0; + while (!feof(infile)) + { + if (strstr(fline,"Use standard deduction.")!=0) fed_data->Itemized = 0; + next_word(fline, word, " \t="); + if ((word[0] == 'L') && (strstr(fline," = ")!=0)) + { /*L*/ + if (strcmp(word,"L1a") == 0) + grab_line_value( word, fline, &(fed_data->fed_L1a) ); + else + if (strcmp(word,"L1b") == 0) + grab_line_value( word, fline, &(fed_data->fed_L1b) ); + else + if (strcmp(word,"L1c") == 0) + grab_line_value( word, fline, &(fed_data->fed_L1c) ); + else + if (strcmp(word,"L1d") == 0) + grab_line_value( word, fline, &(fed_data->fed_L1d) ); + else + if (strcmp(word,"L1e") == 0) + grab_line_value( word, fline, &(fed_data->fed_L1e) ); + else + if (strcmp(word,"L1f") == 0) + grab_line_value( word, fline, &(fed_data->fed_L1f) ); + else + if (strcmp(word,"L1g") == 0) + grab_line_value( word, fline, &(fed_data->fed_L1g) ); + else + if (strcmp(word,"L1h") == 0) + grab_line_value( word, fline, &(fed_data->fed_L1h) ); + else + if (strcmp(word,"L1z") == 0) + grab_line_value( word, fline, &(fed_data->fed_L1z) ); + else + if (strcmp(word,"L2a") == 0) + grab_line_value( word, fline, &(fed_data->fed_L2a) ); + else + if (strcmp(word,"L3a") == 0) + grab_line_value( word, fline, &(fed_data->fed_L3a) ); + else + if (strcmp(word,"L4a") == 0) + grab_line_value( word, fline, &(fed_data->fed_L4a) ); + else + if (strcmp(word,"L4b") == 0) + grab_line_value( word, fline, &(fed_data->fed_L4b) ); + else + if (strcmp(word,"L5a") == 0) + grab_line_value( word, fline, &(fed_data->fed_L5a) ); + else + if (strcmp(word,"L5b") == 0) + grab_line_value( word, fline, &(fed_data->fed_L5b) ); + else + if (strcmp(word,"L6a") == 0) + grab_line_value( word, fline, &(fed_data->fed_L6a) ); + else + if (strcmp(word,"L6b") == 0) + grab_line_value( word, fline, &(fed_data->fed_L6b) ); + else + if (strcmp(word,"L8a") == 0) + grab_line_value( word, fline, &(fed_data->fedline[8]) ); + else + if (strcmp(word,"L8b") == 0) + grab_line_value( word, fline, &(fed_data->fedl8b) ); + else + if (strcmp(word,"L9a") == 0) + grab_line_value( word, fline, &(fed_data->fedline[9]) ); + else + if (strcmp(word,"L9b") == 0) + grab_line_value( word, fline, &(fed_data->fedl9b) ); + else + if (strcmp(word,"L15a") == 0) + grab_line_value( word, fline, &(fed_data->fedl15a) ); + else + if (strcmp(word,"L15b") == 0) + grab_line_value( word, fline, &(fed_data->fedline[15]) ); + else + if (strcmp(word,"L16a") == 0) + grab_line_value( word, fline, &(fed_data->fedl16a) ); + else + if (strcmp(word,"L16b") == 0) + grab_line_value( word, fline, &(fed_data->fedline[16]) ); + else + if (strcmp(word,"L20a") == 0) + grab_line_value( word, fline, &(fed_data->fedl20a) ); + else + if (strcmp(word,"L20b") == 0) + grab_line_value( word, fline, &(fed_data->fedline[20]) ); + else + { + if (sscanf(&word[1],"%d",&linenum)!=1) + { + printf("Error: Reading Fed line number '%s%s'\n",word,fline); + fprintf(outfile,"Error: Reading Fed line number '%s%s'\n",word,fline); + } + next_word(fline, word, " \t="); + if (sscanf(word,"%lf", &fed_data->fedline[linenum])!=1) + { + printf("Error: Reading Fed line %d '%s%s'\n",linenum,word,fline); + fprintf(outfile,"Error: Reading Fed line %d '%s%s'\n",linenum,word,fline); + } + if (verbose) printf("FedLin[%d] = %2.2f\n", linenum, fed_data->fedline[linenum]); + } + } /*L*/ + else + + if (strcmp(word, "Your1stName:" ) == 0) + grab_line_alloc( fline, &Your1stName ); + else + if (strcmp(word, "YourLastName:" ) == 0) + grab_line_alloc( fline, &YourLastName ); + else + if (strcmp(word, "YourSocSec#:" ) == 0) + grab_line_alloc( fline, &your_socsec ); + else + if (strcmp(word, "Spouse1stName:" ) == 0) + grab_line_alloc( fline, &Spouse1stName ); + else + if (strcmp(word, "SpouseLastName:" ) == 0) + grab_line_alloc( fline, &SpouseLastName ); + else + if (strcmp(word, "SpouseSocSec#:" ) == 0) + grab_line_alloc( fline, &spouse_socsec ); + else + if (strcmp(word, "Number&Street:" ) == 0) + grab_line_alloc( fline, &street_address ); + else + if (strcmp(word, "Apt#:" ) == 0) + grab_line_alloc( fline, &apartment ); + else + if (strcmp(word, "Town/City:" ) == 0) + grab_line_alloc( fline, &town ); + else + if (strcmp(word, "ZipCode:" ) == 0) + grab_line_alloc( fline, &zipcode ); + else + + if (strncmp(word, "AlimRecipSSN", 12) == 0) + grab_line_string( fline, fed_data->AlimRecipSSN ); + else + if (strcmp( word, "S1_8z_Type:" ) == 0) + grab_line_string( fline, fed_data->OtherIncomeType ); + else + if (strcmp( word, "S1_24z_Type:" ) == 0) + grab_line_string( fline, fed_data->OtherAdjustmentsType ); + else + if (strcmp( word, "S2_17z_Type:" ) == 0) + grab_line_string( fline, fed_data->OtherTaxesType ); + else + + if (strcmp(word, "Dep1_FirstName:") == 0) + grab_line_string( fline, fed_data->Dep1stName[1] ); + else + if (strcmp(word, "Dep1_LastName:") == 0) + grab_line_string( fline, fed_data->DepLastName[1] ); + else + if (strcmp(word, "Dep1_SocSec#:") == 0) + grab_line_string( fline, fed_data->DepSocSec[1] ); + else + if (strcmp(word, "Dep1_Relation:") == 0) + grab_line_string( fline, fed_data->DepRelation[1] ); + else + + if (strcmp(word, "Dep2_FirstName:") == 0) + grab_line_string( fline, fed_data->Dep1stName[2] ); + else + if (strcmp(word, "Dep2_LastName:") == 0) + grab_line_string( fline, fed_data->DepLastName[2] ); + else + if (strcmp(word, "Dep2_SocSec#:") == 0) + grab_line_string( fline, fed_data->DepSocSec[2] ); + else + if (strcmp(word, "Dep2_Relation:") == 0) + grab_line_string( fline, fed_data->DepRelation[2] ); + else + + if (strcmp(word, "Dep3_FirstName:") == 0) + grab_line_string( fline, fed_data->Dep1stName[3] ); + else + if (strcmp(word, "Dep3_LastName:") == 0) + grab_line_string( fline, fed_data->DepLastName[3] ); + else + if (strcmp(word, "Dep3_SocSec#:") == 0) + grab_line_string( fline, fed_data->DepSocSec[3] ); + else + if (strcmp(word, "Dep3_Relation:") == 0) + grab_line_string( fline, fed_data->DepRelation[3] ); + else + + if ((word[0] == 'A') && (strstr(word,"AMT")!=word) && (strstr(fline," = ")!=0)) + { + if (strcmp(word,"A5a") == 0) + grab_line_value( word, fline, &(fed_data->schedA5a) ); + else + if (strcmp(word,"A5b") == 0) + grab_line_value( word, fline, &(fed_data->schedA5b) ); + else + if (strcmp(word,"A5c") == 0) + grab_line_value( word, fline, &(fed_data->schedA5c) ); + else + if (strcmp(word,"A8a") == 0) + grab_line_value( word, fline, &(fed_data->schedA8a) ); + else + if (strcmp(word,"A8b") == 0) + grab_line_value( word, fline, &(fed_data->schedA8b) ); + else + if (strcmp(word,"A8c") == 0) + grab_line_value( word, fline, &(fed_data->schedA8c) ); + else + if (strcmp(word,"A8d") == 0) + grab_line_value( word, fline, &(fed_data->schedA8d) ); + else + { + if (sscanf(&word[1],"%d",&linenum)!=1) + { + printf("Error: Reading Fed line number '%s%s'\n",word,fline); + fprintf(outfile,"Error: Reading Fed line number '%s%s'\n",word,fline); + } + next_word(fline, word, " \t="); + if (sscanf(word,"%lf", &fed_data->schedA[linenum])!=1) + { + printf("Error: Reading Fed schedA %d '%s%s'\n",linenum,word,fline); + fprintf(outfile, "Error: Reading Fed schedA %d '%s%s'\n",linenum,word,fline); + } + if (verbose) printf("FedLin.A[%d] = %2.2f\n", linenum, fed_data->schedA[linenum]); + } + } + else + if ((strncmp( word, "S1_", 3 ) == 0) && (strstr(fline," = ")!=0)) + { + next_word( &(word[3]), tword, " \t: =" ); + if ((tword[0] == '8') && (tword[1] >= 'a') && (tword[1] <= 'z')) + { int j; + if ((tword[1] >= 'a') && (tword[1] <= 'z')) + { + j = tword[1] - 'a'; + next_word(fline, word, " \t="); + if (sscanf( word, "%lf", &fed_data->s1_8[j] ) != 1) + { + printf("Error: Reading Fed s1_8%c '%s%s'\n", 'a' + j, word, fline); + fprintf(outfile, "Error: Reading Fed s1_8%c '%s%s'\n", 'a' + j, word, fline); + } + if (verbose) printf("FedLin.S1_8%c] = %2.2f\n", 'a' + j, fed_data->s1_8[j] ); + } + else + printf("Error: Unexpected line '%s'\n", word ); + } + else + if ((strncmp( tword, "24", 2 ) == 0) && (tword[2] >= 'a') && (tword[2] <= 'z')) + { int j; + if ((tword[2] >= 'a') && (tword[2] <= 'z')) + { + j = tword[2] - 'a'; + next_word(fline, word, " \t="); + if (sscanf( word, "%lf", &fed_data->s1_24[j] ) != 1) + { + printf("Error: Reading Fed s1_24%c '%s%s'\n", 'a' + j, word, fline); + fprintf(outfile, "Error: Reading Fed s1_24%c '%s%s'\n", 'a' + j, word, fline); + } + if (verbose) printf("FedLin.S1_24%c = %2.2f\n", 'a' + j, fed_data->s1_24[j] ); + } + else + printf("Error: Unexpected line '%s'\n", word ); + } + else + { + if (sscanf( tword, "%d", &linenum ) != 1) + { + printf("Error: Reading Fed line number 'S1_%s %s'\n", tword, fline); + fprintf(outfile,"Error: Reading Fed line number 'S1_%s %s'\n", tword, fline); + } + next_word(fline, word, " \t="); + if (sscanf(word,"%lf", &fed_data->sched1[linenum])!=1) + { + printf("Error: Reading Fed sched1 %d '%s%s'\n", linenum, word, fline); + fprintf(outfile, "Error: Reading Fed sched1 %d '%s%s'\n", linenum, word, fline); + } + if (verbose) printf("FedLin.S1[%d] = %2.2f\n", linenum, fed_data->sched1[linenum]); + } + } + else + + if ((strncmp( word, "S2_", 3 ) == 0) && (strstr(fline," = ")!=0)) + { + next_word( &(word[3]), tword, " \t: =" ); + if ((strncmp( tword, "17", 2 ) == 0) && (tword[2] >= 'a') && (tword[2] <= 'z')) + { int j; + if ((tword[2] >= 'a') && (tword[2] <= 'z')) + { + j = tword[2] - 'a'; + next_word(fline, word, " \t="); + if (sscanf( word, "%lf", &fed_data->s2_17[j] ) != 1) + { + printf("Error: Reading Fed s2_17%c '%s%s'\n", 'a' + j, word, fline); + fprintf(outfile, "Error: Reading Fed s2_17%c '%s%s'\n", 'a' + j, word, fline); + } + if (verbose) printf("FedLin.S2_17%c = %2.2f\n", 'a' + j, fed_data->s2_17[j] ); + } + else + printf("Error: Unexpected line '%s'\n", word ); + } + } + else + + if ((strncmp( word, "S3_", 3 ) == 0) && (strstr(fline," = ")!=0)) + { + next_word( &(word[3]), tword, " \t: =" ); + if ((strncmp( tword, "6", 1 ) == 0) && (tword[1] >= 'a') && (tword[1] <= 'z')) + { int j; + if ((tword[1] >= 'a') && (tword[1] <= 'z')) + { + j = tword[1] - 'a'; + next_word(fline, word, " \t="); + if (sscanf( word, "%lf", &fed_data->s3_6[j] ) != 1) + { + printf("Error: Reading Fed s3_6%c '%s%s'\n", 'a' + j, word, fline); + fprintf(outfile, "Error: Reading Fed s3_6%c '%s%s'\n", 'a' + j, word, fline); + } + if (verbose) printf("FedLin.S3_6%c = %2.2f\n", 'a' + j, fed_data->s3_6[j] ); + } + else + printf("Error: Unexpected line '%s'\n", word ); + } + else + if ((strncmp( tword, "13", 2 ) == 0) && (tword[2] >= 'a') && (tword[2] <= 'z')) + { int j; + if ((tword[2] >= 'a') && (tword[2] <= 'z')) + { + j = tword[2] - 'a'; + next_word(fline, word, " \t="); + if (sscanf( word, "%lf", &fed_data->s3_13[j] ) != 1) + { + printf("Error: Reading Fed s3_13%c '%s%s'\n", 'a' + j, word, fline); + fprintf(outfile, "Error: Reading Fed s3_13%c '%s%s'\n", 'a' + j, word, fline); + } + if (verbose) printf("FedLin.S3_13%c = %2.2f\n", 'a' + j, fed_data->s3_13[j] ); + } + else + printf("Error: Unexpected line '%s'\n", word ); + } + } + + else + if (strcmp(word,"Status") == 0) + { + next_word(fline, word, " \t="); + if (strncasecmp(word,"Single",4)==0) status = SINGLE; else + if (strncasecmp(word,"Married/Joint",13)==0) status = MARRIED_FILING_JOINTLY; else + if (strncasecmp(word,"Married/Sep",11)==0) status = MARRIED_FILING_SEPARAT; else + if (strncasecmp(word,"Head_of_House",4)==0) status = HEAD_OF_HOUSEHOLD; else + if (strncasecmp(word,"Widow",4)==0) status = WIDOW; + else + { + printf("Error: unrecognized status '%s'. Exiting.\n", word); + fprintf(outfile,"Error: unrecognized status '%s'. Exiting.\n", word); + return 0; + } + } + read_line(infile,fline); + } + fclose(infile); + return 1; +} + + +char *pull_initial( char *name ) +{ /* Expect names like: "John, D.", and pull initial out. */ + int j=0; + char midinitial[10]; + while ((name[j] != '\0') && (name[j] == ' ')) + j++; + while ((name[j] != '\0') && (name[j] != ',') && (name[j] != ' ')) + j++; + if ((name[j] == ',') || (name[j] == ' ')) + { + name[j++] = '\0'; + while ((name[j] != '\0') && (isspace( name[j] ))) + j++; + midinitial[0] = name[j]; + midinitial[1] = '\0'; + } + else + strcpy( midinitial, "" ); + return strdup( midinitial ); +} + +void display_part2column( int j, int col ) +{ + switch (col) + { + case 0: + if (sched540part2[j] != 0.0) + fprintf(outfile," SchedCA540_Part2_%d = %6.2f\n", j, sched540part2[j] ); + break; + case 'a': + if (sched540part2[j] != 0.0) + fprintf(outfile," SchedCA540_Part2_%da = %6.2f\n", j, sched540part2[j] ); + break; + case 'b': + if (sched540part2_sub[j] != 0.0) + fprintf(outfile," SchedCA540_Part2_%db = %6.2f\n", j, sched540part2_sub[j] ); + break; + case 'c': + if (sched540part2_add[j] != 0.0) + fprintf(outfile," SchedCA540_Part2_%dc = %6.2f\n", j, sched540part2_add[j] ); + break; + default: fprintf(outfile," Bad Case\n"); + } +} + + +void display_part2( int j ) +{ + display_part2column( j, 'a' ); + display_part2column( j, 'b' ); + display_part2column( j, 'c' ); +} + + +/*----------------------------------------------------------------------------*/ +/* --- Main --- */ +/*----------------------------------------------------------------------------*/ +int main( int argc, char *argv[] ) +{ + int argk, j, k, iline7, iline8, iline9, iline10, CkFYHealthCoverage=0, L7a=0; + double min2file=0.0, sched540A[MAX_LINES], sched540B[MAX_LINES], sched540C[MAX_LINES], + sched540Ab[MAX_LINES], sched540Ac[MAX_LINES], + sched540Bb[MAX_LINES], sched540Bc[MAX_LINES], + sched540Cb[MAX_LINES], sched540Cc[MAX_LINES], + threshA=0, std_ded=0; + char word[4000], *infname=0, outfname[4000], prelim_1040_outfilename[5000]; + char YourName[2048]="", YourNames[2048]="", + *YourMidInitial="", *SpouseMidInitial=""; + double sched540A1a_sub=0.0, sched540A1b_sub=0.0, sched540A1c_sub=0.0, sched540A1d_sub=0.0, + sched540A1e_sub=0.0, sched540A1f_sub=0.0, sched540A1g_sub=0.0, sched540A1h_sub=0.0, + sched540A1z_sub=0.0; + double sched540A1a_add=0.0, sched540A1b_add=0.0, sched540A1c_add=0.0, sched540A1d_add=0.0, + sched540A1e_add=0.0, sched540A1f_add=0.0, sched540A1g_add=0.0, sched540A1h_add=0.0, + sched540A1i_add=0.0, sched540A1z_add=0.0; + double sched540Bc8a=0.0, sched540Bb8b=0.0, sched540Bb8c=0.0, sched540Bc8c=0.0, sched540Bc8d=0.0, + sched540Bc8e=0.0, sched540Bb8f=0.0, sched540Bc8k=0.0, sched540Bb8n=0.0, + sched540Bb8o=0.0, sched540Bb8p=0.0, sched540Bc8p=0.0, sched540Bb8v=0.0, sched540Bc8v=0.0, + sched540Bb8z=0.0, sched540Bc8z=0.0, + sched540Cb24b=0.0, sched540Cc24b=0.0, sched540Cb24c=0.0, sched540Cb24d=0.0, + sched540Cb24f=0.0, sched540Cc24f=0.0, sched540Cb24g=0.0, sched540Cc24g=0.0, + sched540Cb24i=0.0, sched540Cb24j=0.0, sched540Cb24k=0.0, sched540Cb24z=0.0, + sched540Cc24z=0.0; + int CkPayedUseTaxCDTFA=0; + char labelx[1024]=""; + time_t now; + + /* Decode any command-line arguments. */ + argk = 1; k=1; + while (argk < argc) + { + if (strcmp(argv[argk],"-verbose")==0) { verbose = 1; } + else + if (strcmp(argv[argk],"-round_to_whole_dollars")==0) { round_to_whole_dollars = 1; } + else + if (k==1) + { + infname = strdup(argv[argk]); + infile = fopen(argv[argk],"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", argv[argk]); exit(1);} + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname,argv[argk]); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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[argk]); exit(1);} + argk = argk + 1; + } + // test_tax_function(); + + if (infile==0) {printf("Error: No input file on command line.\n"); exit(1);} + + /* Pre-initialize all lines to zeros. */ + for (j=0; j 0) fprintf(outfile," L8a = %d\n", iline8 ); + + get_parameter( infile, 's', word, "L9" ); /* Senior?, 1 if you or spouse, 2 if both. */ + get_parameter( infile, 'i', &iline9, "L9" ); + L[9] = iline9 * 149.0; /* Updated for 2024. */ + showline(9); + if (iline9 > 0) fprintf(outfile," L9a = %d\n", iline9 ); + + get_parameter( infile, 's', word, "L10" ); /* Number of Dependents. */ + get_parameter( infile, 'i', &iline10, "L10"); + L[10] = iline10 * 461.0; /* Updated for 2024. */ + showline(10); + if (iline10 > 0) fprintf(outfile," L10a = %d\n", iline10 ); + + L[11] = L[7] + L[8] + L[9] + L[10]; + showline_wmsg(11, "Exemption amount"); + + /* Taxable Income. */ + GetLineF( "L12", &L[12] ); /* State Wages (W2 box 16). */ + + L[13] = PrelimFedReturn.fedline[11]; /* Fed Wages (Fed 1040 line 11). */ + showline(13); + + + /* -- Sched540 Part I -- */ + + GetLine("CA540_Subtr_A1a", &sched540A1a_sub ); + GetLine("CA540_Addit_A1a", &sched540A1a_add ); + + GetLine("CA540_Subtr_A1b", &sched540A1b_sub ); + GetLine("CA540_Addit_A1b", &sched540A1b_add ); + + GetLine("CA540_Subtr_A1c", &sched540A1c_sub ); + GetLine("CA540_Addit_A1c", &sched540A1c_add ); + + GetLine("CA540_Subtr_A1d", &sched540A1d_sub ); + GetLine("CA540_Addit_A1d", &sched540A1d_add ); + + GetLine("CA540_Subtr_A1e", &sched540A1e_sub ); + GetLine("CA540_Addit_A1e", &sched540A1e_add ); + + GetLine("CA540_Subtr_A1f", &sched540A1f_sub ); + GetLine("CA540_Addit_A1f", &sched540A1f_add ); + + GetLine("CA540_Subtr_A1g", &sched540A1g_sub ); + GetLine("CA540_Addit_A1g", &sched540A1g_add ); + + GetLine("CA540_Subtr_A1h", &sched540A1h_sub ); + GetLine("CA540_Addit_A1h", &sched540A1h_add ); + + GetLine("CA540_Addit_A1i", &sched540A1i_add ); + + GetLine("CA540_Subtr_A2", &(sched540Ab[2]) ); + GetLine("CA540_Addit_A2", &(sched540Ac[2]) ); + GetLine("CA540_Subtr_A3", &(sched540Ab[3]) ); + GetLine("CA540_Addit_A3", &(sched540Ac[3]) ); + GetLine("CA540_Subtr_A4", &(sched540Ab[4]) ); + GetLine("CA540_Addit_A4", &(sched540Ac[4]) ); + GetLine("CA540_Subtr_A5", &(sched540Ab[5]) ); + GetLine("CA540_Addit_A5", &(sched540Ac[5]) ); + // GetLine("CA540_Subtr_A6", &(sched540Ab[6]) ); /* Soc Sec subtraction handled below. */ + GetLine("CA540_Subtr_A7", &(sched540Ab[7]) ); + GetLine("CA540_Addit_A7", &(sched540Ac[7]) ); + + GetLine("CA540_Subtr_B1", &(sched540Bb[1]) ); + GetLine("CA540_Addit_B2", &(sched540Bc[2]) ); + GetLine("CA540_Subtr_B3", &(sched540Bb[3]) ); + GetLine("CA540_Addit_B3", &(sched540Bc[3]) ); + GetLine("CA540_Subtr_B4", &(sched540Bb[4]) ); + GetLine("CA540_Addit_B4", &(sched540Bc[4]) ); + GetLine("CA540_Subtr_B5", &(sched540Bb[5]) ); + GetLine("CA540_Addit_B5", &(sched540Bc[5]) ); + GetLine("CA540_Subtr_B6", &(sched540Bb[6]) ); + GetLine("CA540_Addit_B6", &(sched540Bc[6]) ); + GetLine("CA540_Subtr_B7", &(sched540Bb[7]) ); + + GetLine("CA540_Addit_B8a", &sched540Bc8a ); + GetLine("CA540_Subtr_B8b", &sched540Bb8b ); + + GetLine("CA540_Subtr_B8c", &sched540Bb8c ); + GetLine("CA540_Addit_B8c", &sched540Bc8c ); + GetLine("CA540_Addit_B8d", &sched540Bc8d ); + GetLine("CA540_Addit_B8e", &sched540Bc8e ); + GetLine("CA540_Subtr_B8f", &sched540Bb8f ); + GetLine("CA540_Addit_B8k", &sched540Bc8k ); + GetLine("CA540_Subtr_B8n", &sched540Bb8n ); + GetLine("CA540_Subtr_B8o", &sched540Bb8o ); + GetLine("CA540_Subtr_B8p", &sched540Bb8p ); + GetLine("CA540_Addit_B8p", &sched540Bc8p ); + GetLine("CA540_Subtr_B8v", &sched540Bb8v ); + GetLine("CA540_Addit_B8v", &sched540Bc8v ); + GetLine("CA540_Subtr_B8z", &sched540Bb8z ); + GetLine("CA540_Addit_B8z", &sched540Bc8z ); + + GetLine("CA540_Subtr_C11", &(sched540Cb[11]) ); + GetLine("CA540_Subtr_C12", &(sched540Cb[12]) ); + GetLine("CA540_Addit_C12", &(sched540Cc[12]) ); + GetLine("CA540_Subtr_C13", &(sched540Cb[13]) ); + GetLine("CA540_Addit_C14", &(sched540Cc[14]) ); + GetLine("CA540_Subtr_C15", &(sched540Cb[15]) ); + GetLine("CA540_Subtr_C17", &(sched540Cb[17]) ); + GetLine("CA540_Addit_C19", &(sched540Cc[19]) ); + PrelimFedReturn.AlimRecipName = GetTextLine( "CA540_AlimonyRecipName:" ); + GetLine("CA540_Subtr_C20", &(sched540Cb[20]) ); + GetLine("CA540_Addit_C20", &(sched540Cc[20]) ); + GetLine("CA540_Addit_C21", &(sched540Cc[21]) ); + + GetLine("CA540_Subtr_C24b", &sched540Cb24b ); + GetLine("CA540_Addit_C24b", &sched540Cc24b ); + GetLine("CA540_Subtr_C24c", &sched540Cb24c ); + GetLine("CA540_Subtr_C24d", &sched540Cb24d ); + GetLine("CA540_Subtr_C24f", &sched540Cb24f ); + GetLine("CA540_Addit_C24f", &sched540Cc24f ); + GetLine("CA540_Subtr_C24g", &sched540Cb24g ); + GetLine("CA540_Addit_C24g", &sched540Cc24g ); + GetLine("CA540_Subtr_C24i", &sched540Cb24i ); + GetLine("CA540_Subtr_C24j", &sched540Cb24j ); + GetLine("CA540_Subtr_C24k", &sched540Cb24k ); + GetLine("CA540_Subtr_C24z", &sched540Cb24z ); + GetLine("CA540_Addit_C24z", &sched540Cc24z ); + + showline_wlabelnz( " SchedCA540_A1a", PrelimFedReturn.fed_L1a ); + showline_wlabelnz( " SchedCA540_A1b", PrelimFedReturn.fed_L1b ); + showline_wlabelnz( " SchedCA540_A1c", PrelimFedReturn.fed_L1c ); + showline_wlabelnz( " SchedCA540_A1d", PrelimFedReturn.fed_L1d ); + showline_wlabelnz( " SchedCA540_A1e", PrelimFedReturn.fed_L1e ); + showline_wlabelnz( " SchedCA540_A1f", PrelimFedReturn.fed_L1f ); + showline_wlabelnz( " SchedCA540_A1g", PrelimFedReturn.fed_L1g ); + showline_wlabelnz( " SchedCA540_A1h", PrelimFedReturn.fed_L1h ); + showline_wlabelnz( " SchedCA540_A1z", PrelimFedReturn.fed_L1z ); + + showline_wlabelnz( " SchedCA540_A1ab", sched540A1a_sub ); + showline_wlabelnz( " SchedCA540_A1bb", sched540A1b_sub ); + showline_wlabelnz( " SchedCA540_A1cb", sched540A1c_sub ); + showline_wlabelnz( " SchedCA540_A1db", sched540A1d_sub ); + showline_wlabelnz( " SchedCA540_A1eb", sched540A1e_sub ); + showline_wlabelnz( " SchedCA540_A1fb", sched540A1f_sub ); + showline_wlabelnz( " SchedCA540_A1gb", sched540A1g_sub ); + showline_wlabelnz( " SchedCA540_A1hb", sched540A1h_sub ); + sched540A1z_sub = sched540A1a_sub + sched540A1b_sub + sched540A1c_sub + sched540A1d_sub + + sched540A1e_sub + sched540A1f_sub + sched540A1g_sub + sched540A1h_sub; + showline_wlabelnz( " SchedCA540_A1zb", sched540A1z_sub ); + + showline_wlabelnz( " SchedCA540_A1ac", sched540A1a_add ); + showline_wlabelnz( " SchedCA540_A1bc", sched540A1b_add ); + showline_wlabelnz( " SchedCA540_A1cc", sched540A1c_add ); + showline_wlabelnz( " SchedCA540_A1dc", sched540A1d_add ); + showline_wlabelnz( " SchedCA540_A1ec", sched540A1e_add ); + showline_wlabelnz( " SchedCA540_A1fc", sched540A1f_add ); + showline_wlabelnz( " SchedCA540_A1gc", sched540A1g_add ); + showline_wlabelnz( " SchedCA540_A1hc", sched540A1h_add ); + showline_wlabelnz( " SchedCA540_A1ic", sched540A1i_add ); + sched540A1z_add = sched540A1a_add + sched540A1b_add + sched540A1c_add + sched540A1d_add + + sched540A1e_add + sched540A1f_add + sched540A1g_add + sched540A1h_add + + sched540A1i_add; + showline_wlabelnz( " SchedCA540_A1zc", sched540A1z_add ); + + + sched540A[1] = PrelimFedReturn.fed_L1z; + sched540B[10] = sched540B[10] + sched540A[1]; + + sched540Bb[10] = sched540Bb[10] + sched540A1z_sub; + + sched540Bc[10] = sched540Bc[10] + sched540A1z_add; + + + showline_wlabelnz( " SchedCA540_A2a", PrelimFedReturn.fed_L2a ); + + sched540A[2] = PrelimFedReturn.fedline[2]; + sched540B[10] = sched540B[10] + sched540A[2]; + showline_wlabelnz( " SchedCA540_A2", sched540A[2] ); + + sched540Bb[10] = sched540Bb[10] + sched540Ab[2]; + showline_wlabelnz( " SchedCA540_A2b", sched540Ab[2] ); + + sched540Bc[10] = sched540Bc[10] + sched540Ac[2]; + showline_wlabelnz( " SchedCA540_A2c", sched540Ac[2] ); + + showline_wlabelnz( " SchedCA540_A3a", PrelimFedReturn.fed_L3a ); + + sched540A[3] = PrelimFedReturn.fedline[3]; + sched540B[10] = sched540B[10] + sched540A[3]; + showline_wlabelnz( " SchedCA540_A3", sched540A[3] ); + + sched540Bb[10] = sched540Bb[10] + sched540Ab[3]; + showline_wlabelnz( " SchedCA540_A3b", sched540Ab[3] ); + + sched540Bc[10] = sched540Bc[10] + sched540Ac[3]; + showline_wlabelnz( " SchedCA540_A3c", sched540Ac[3] ); + + + showline_wlabelnz( " SchedCA540_A4a", PrelimFedReturn.fed_L4a ); + + sched540A[4] = PrelimFedReturn.fed_L4b; + sched540B[10] = sched540B[10] + sched540A[4]; + showline_wlabelnz( " SchedCA540_A4", sched540A[4] ); + + sched540Bb[10] = sched540Bb[10] + sched540Ab[4]; + showline_wlabelnz( " SchedCA540_A4b", sched540Ab[4] ); + + sched540Bc[10] = sched540Bc[10] + sched540Ac[4]; + showline_wlabelnz( " SchedCA540_A4c", sched540Ac[4] ); + + + showline_wlabelnz( " SchedCA540_A5a", PrelimFedReturn.fed_L5a ); + + sched540A[5] = PrelimFedReturn.fed_L5b; + sched540B[10] = sched540B[10] + sched540A[5]; + showline_wlabelnz( " SchedCA540_A5", sched540A[5] ); + + sched540Bb[10] = sched540Bb[10] + sched540Ab[5]; + showline_wlabelnz( " SchedCA540_A5b", sched540Ab[5] ); + + sched540Bc[10] = sched540Bc[10] + sched540Ac[5]; + showline_wlabelnz( " SchedCA540_A5c", sched540Ac[5] ); + + showline_wlabelnz( " SchedCA540_A6a", PrelimFedReturn.fed_L6a ); + + sched540A[6] = PrelimFedReturn.fed_L6b; + sched540B[10] = sched540B[10] + sched540A[6]; + showline_wlabelnz( " SchedCA540_A6", sched540A[6] ); + + sched540Ab[6] = sched540A[6]; /* Subtract SocSec payments from AGI in CA. */ + sched540Bb[10] = sched540Bb[10] + sched540Ab[6]; + showline_wlabelnz( " SchedCA540_A6b", sched540Ab[6] ); + + sched540A[7] = PrelimFedReturn.fedline[7]; + sched540B[10] = sched540B[10] + sched540A[7]; + showline_wlabelnz( " SchedCA540_A7", sched540A[7] ); + + sched540Bb[10] = sched540Bb[10] + sched540Ab[7]; + showline_wlabelnz( " SchedCA540_A7b", sched540Ab[7] ); + + sched540Bc[10] = sched540Bc[10] + sched540Ac[7]; + showline_wlabelnz( " SchedCA540_A7c", sched540Ac[7] ); + + for (j=1; j <= 7; j++) + { + sched540B[j] = PrelimFedReturn.sched1[j]; + sched540B[10] = sched540B[10] + sched540B[j]; + if (sched540B[j] != 0.0) + fprintf(outfile," SchedCA540_B%d = %6.2f\n", j, sched540B[j] ); + + sched540Bb[10] = sched540Bb[10] + sched540Bb[j]; + if (sched540Bb[j] != 0.0) + fprintf(outfile," SchedCA540_B%db = %6.2f\n", j, sched540Bb[j] ); + + sched540Bc[10] = sched540Bc[10] + sched540Bc[j]; + if (sched540Bc[j] != 0.0) + fprintf(outfile," SchedCA540_B%dc = %6.2f\n", j, sched540Bc[j] ); + } + + for (j=0; j < 26; j++) + { + if (PrelimFedReturn.s1_8[j] != 0.0) + fprintf(outfile," SchedCA540_B8%c = %6.2f\n", 'A' + j, PrelimFedReturn.s1_8[j] ); + } + + if (PrelimFedReturn.OtherIncomeType[0] != '\0') + fprintf(outfile," SchedCA540_B8Za: %s\n", PrelimFedReturn.OtherIncomeType ); + + sched540Bc[9] = sched540Bc[9] + sched540Bc8a; + showline_wlabelnz( " SchedCA540_B8Ac", sched540Bc8a ); + + sched540Bb[9] = sched540Bb[9] + sched540Bb8b; + showline_wlabelnz( " SchedCA540_B8Bb", sched540Bb8b ); + + sched540Bb[9] = sched540Bb[9] + sched540Bb8c; + showline_wlabelnz( " SchedCA540_B8Cb", sched540Bb8c ); + + sched540Bc[9] = sched540Bc[9] + sched540Bc8c; + showline_wlabelnz( " SchedCA540_B8Cc", sched540Bc8c ); + + sched540Bc[9] = sched540Bc[9] + sched540Bc8d; + showline_wlabelnz( " SchedCA540_B8Dc", sched540Bc8d ); + + sched540Bc[9] = sched540Bc[9] + sched540Bc8e; + showline_wlabelnz( " SchedCA540_B8Ec", sched540Bc8e ); + + sched540Bb[9] = sched540Bb[9] + sched540Bb8f; + showline_wlabelnz( " SchedCA540_B8Fb", sched540Bb8f ); + + sched540Bc[9] = sched540Bc[9] + sched540Bc8k; + showline_wlabelnz( " SchedCA540_B8Kc", sched540Bc8k ); + + sched540Bb[9] = sched540Bb[9] + sched540Bb8n; + showline_wlabelnz( " SchedCA540_B8Nb", sched540Bb8n ); + + sched540Bb[9] = sched540Bb[9] + sched540Bb8o; + showline_wlabelnz( " SchedCA540_B8Ob", sched540Bb8o ); + + sched540Bb[9] = sched540Bb[9] + sched540Bb8p; + showline_wlabelnz( " SchedCA540_B8Pb", sched540Bb8p ); + + sched540Bc[9] = sched540Bc[9] + sched540Bc8p; + showline_wlabelnz( " SchedCA540_B8Pc", sched540Bc8p ); + + sched540Bb[9] = sched540Bb[9] + sched540Bb8v; + showline_wlabelnz( " SchedCA540_B8Vb", sched540Bb8v ); + + sched540Bc[9] = sched540Bc[9] + sched540Bc8v; + showline_wlabelnz( " SchedCA540_B8Vc", sched540Bc8v ); + + sched540Bb[9] = sched540Bb[9] + sched540Bb8z; + showline_wlabelnz( " SchedCA540_B8Zb", sched540Bb8z ); + + sched540Bc[9] = sched540Bc[9] + sched540Bc8z; + showline_wlabelnz( " SchedCA540_B8Zc", sched540Bc8z ); + + sched540B[9] = PrelimFedReturn.sched1[9]; + showline_wlabelnz( " SchedCA540_B9A", sched540B[9] ); + showline_wlabelnz( " SchedCA540_B9Ab", sched540Bb[9] ); + showline_wlabelnz( " SchedCA540_B9Ac", sched540Bc[9] ); + + sched540Bb[10] = sched540Bb[10] + sched540Bb[9]; + sched540Bc[10] = sched540Bc[10] + sched540Bc[9]; + + sched540B[10] = sched540B[10] + sched540B[9]; + showline_wlabelnz( " SchedCA540_B10", sched540B[10] ); + showline_wlabelnz( " SchedCA540_B10b", sched540Bb[10] ); + showline_wlabelnz( " SchedCA540_B10c", sched540Bc[10] ); + + + for (j=11; j <= 23; j++) + { + sched540C[j] = PrelimFedReturn.sched1[j]; + sched540C[26] = sched540C[26] + sched540C[j]; + if (sched540C[j] != 0.0) + fprintf(outfile," SchedCA540_C%d = %6.2f\n", j, sched540C[j] ); + + sched540Cb[26] = sched540Cb[26] + sched540Cb[j]; + if (sched540Cb[j] != 0.0) + fprintf(outfile," SchedCA540_C%db = %6.2f\n", j, sched540Cb[j] ); + + sched540Cc[26] = sched540Cc[26] + sched540Cc[j]; + if (sched540Cc[j] != 0.0) + fprintf(outfile," SchedCA540_C%dc = %6.2f\n", j, sched540Cc[j] ); + } + + if (PrelimFedReturn.AlimRecipSSN[0] != '\0') + fprintf(outfile," AlimRecipSSN: %s\n", PrelimFedReturn.AlimRecipSSN ); + if (PrelimFedReturn.AlimRecipName[0] != '\0') + fprintf(outfile," AlimRecipName: %s\n", PrelimFedReturn.AlimRecipName ); + + for (j=0; j < 30; j++) + { + if (PrelimFedReturn.s1_24[j] != 0.0) + fprintf(outfile," SchedCA540_C24%c = %6.2f\n", 'A' + j, PrelimFedReturn.s1_24[j] ); + } + + sched540Cb[25] = sched540Cb[25] + sched540Cb24b; + showline_wlabelnz( " SchedCA540_C24Bb", sched540Cb24b ); + + sched540Cc[25] = sched540Cc[25] + sched540Cc24b; + showline_wlabelnz( " SchedCA540_C24Bc", sched540Cc24b ); + + sched540Cb[25] = sched540Cb[25] + sched540Cb24c; + showline_wlabelnz( " SchedCA540_C24Cb", sched540Cb24c ); + + sched540Cb[25] = sched540Cb[25] + sched540Cb24d; + showline_wlabelnz( " SchedCA540_C24Db", sched540Cb24d ); + + sched540Cb[25] = sched540Cb[25] + sched540Cb24f; + showline_wlabelnz( " SchedCA540_C24Fb", sched540Cb24f ); + + sched540Cc[25] = sched540Cc[25] + sched540Cc24f; + showline_wlabelnz( " SchedCA540_C24Fc", sched540Cc24f ); + + sched540Cb[25] = sched540Cb[25] + sched540Cb24g; + showline_wlabelnz( " SchedCA540_C24Gb", sched540Cb24g ); + + sched540Cc[25] = sched540Cc[25] + sched540Cc24g; + showline_wlabelnz( " SchedCA540_C24Gc", sched540Cc24g ); + + sched540Cb[25] = sched540Cb[25] + sched540Cb24i; + showline_wlabelnz( " SchedCA540_C24Ib", sched540Cb24i ); + + sched540Cb[25] = sched540Cb[25] + sched540Cb24j; + showline_wlabelnz( " SchedCA540_C24Jb", sched540Cb24j ); + + sched540Cb[25] = sched540Cb[25] + sched540Cb24k; + showline_wlabelnz( " SchedCA540_C24Kb", sched540Cb24k ); + + sched540Cb[25] = sched540Cb[25] + sched540Cb24z; + showline_wlabelnz( " SchedCA540_C24Zb", sched540Cb24z ); + + sched540Cc[25] = sched540Cc[25] + sched540Cc24z; + showline_wlabelnz( " SchedCA540_C24Zc", sched540Cc24z ); + + if (PrelimFedReturn.OtherAdjustmentsType[0] != '\0') + fprintf(outfile," SchedCA540_C24Ztype: %s\n", PrelimFedReturn.OtherAdjustmentsType ); + + sched540C[25] = PrelimFedReturn.sched1[25]; + showline_wlabelnz( " SchedCA540_C25", sched540C[25] ); + showline_wlabelnz( " SchedCA540_C25b", sched540Cb[25] ); + showline_wlabelnz( "SchedCA540_C25c", sched540Cc[25] ); + + sched540C[26] = sched540C[26] + sched540C[25]; + sched540Cb[26] = sched540Cb[26] + sched540Cb[25]; + sched540Cc[26] = sched540Cc[26] + sched540Cc[25]; + + showline_wlabelnz( " SchedCA540_C26", sched540C[26] ); + showline_wlabelnz( " SchedCA540_C26b", sched540Cb[26] ); + showline_wlabelnz( "SchedCA540_C26c", sched540Cc[26] ); + + sched540C[27] = sched540B[10] - sched540C[26]; + sched540Cb[27] = sched540Bb[10] - sched540Cb[26]; + sched540Cc[27] = sched540Bc[10] - sched540Cc[26]; + + showline_wlabelnz( " SchedCA540_C27", sched540C[27] ); + showline_wlabelnz( " SchedCA540_C27b", sched540Cb[27] ); + showline_wlabelnz( "SchedCA540_C27c", sched540Cc[27] ); + + + /* -- Sched540 Part II -- */ + + // GetLine("CA540_P2_1", &(sched540part2[1]) ); /* Medical and dental expenses */ + sched540part2[1] = PrelimFedReturn.schedA[1]; + sched540part2[2] = PrelimFedReturn.fedline[11]; + sched540part2[3] = 0.075 * sched540part2[2]; + sched540part2[4] = NotLessThanZero( sched540part2[1] - sched540part2[3] ); + GetLine("CA540_P2_Add_4", &(sched540part2_add[4]) ); + + sched540part2_5a = PrelimFedReturn.schedA5a; + sched540part2_5b = PrelimFedReturn.schedA5b; + sched540part2_5c = PrelimFedReturn.schedA5c; + sched540part2_5d = sched540part2_5a + sched540part2_5b + sched540part2_5c; + if (status != MARRIED_FILING_SEPARAT) + sched540part2[5] = smallerof( sched540part2_5d, 10000.0 ); /* Will be Line 5e. */ + else + sched540part2[5] = smallerof( sched540part2_5d, 5000.0 ); + + GetLine("CA540_P2_Sub_5a", &(sched540part2_sub[5]) ); + sched540part2_sub[5] = sched540part2_5a; + sched540part2_add[5] = sched540part2_5d - sched540part2[5]; + + sched540part2[6] = PrelimFedReturn.schedA[6]; + GetLine("CA540_P2_Sub_6", &(sched540part2_sub[6]) ); + GetLine("CA540_P2_Add_6", &(sched540part2_add[6]) ); + + if (PrelimFedReturn.OtherTaxesType[0] != '\0') + fprintf(outfile," SchedCA540_Part2_6type: %s\n", PrelimFedReturn.OtherTaxesType ); + + sched540part2[7] = sched540part2[5] + sched540part2[6]; + sched540part2_sub[7] = sched540part2_sub[5] + sched540part2_sub[6]; + sched540part2_add[7] = sched540part2_add[5] + sched540part2_add[6]; + + sched540part2_8a = PrelimFedReturn.schedA8a; + GetLine("CA540_P2_Add_8a", &sched540part2_add8a ); + sched540part2_8b = PrelimFedReturn.schedA8b; + GetLine("CA540_P2_Add_8b", &sched540part2_add8b ); + sched540part2_8c = PrelimFedReturn.schedA8c; + GetLine("CA540_P2_Add_8c", &sched540part2_add8c ); + sched540part2[8] = sched540part2_8a + sched540part2_8b + sched540part2_8c; + sched540part2_sub[8] = sched540part2_sub8d; + sched540part2_add[8] = sched540part2_add8a + sched540part2_add8b + sched540part2_add8c; + sched540part2[9] = PrelimFedReturn.schedA[9]; + GetLine("CA540_P2_Sub_9", &(sched540part2_sub[9]) ); + GetLine("CA540_P2_Add_9", &(sched540part2_add[9]) ); + sched540part2[10] = sched540part2[8] + sched540part2[9]; + sched540part2_sub[10] = sched540part2_sub[8] + sched540part2_sub[9]; + sched540part2_add[10] = sched540part2_add[8] + sched540part2_add[9]; + sched540part2[11] = PrelimFedReturn.schedA[11]; + GetLine("CA540_P2_Sub_11", &(sched540part2_sub[11]) ); + GetLine("CA540_P2_Add_11", &(sched540part2_add[11]) ); + sched540part2[12] = PrelimFedReturn.schedA[12]; + GetLine("CA540_P2_Sub_12", &(sched540part2_sub[12]) ); + GetLine("CA540_P2_Add_12", &(sched540part2_add[12]) ); + sched540part2[13] = PrelimFedReturn.schedA[13]; + GetLine("CA540_P2_Sub_13", &(sched540part2_sub[13]) ); + GetLine("CA540_P2_Add_13", &(sched540part2_add[13]) ); + sched540part2[14] = sched540part2[11] + sched540part2[12]+ sched540part2[13]; + sched540part2_sub[14] = sched540part2_sub[11] + sched540part2_sub[12]+ sched540part2_sub[13]; + sched540part2_add[14] = sched540part2_add[11] + sched540part2_add[12]+ sched540part2_add[13]; + sched540part2[15] = PrelimFedReturn.schedA[15]; + GetLine("CA540_P2_Sub_15", &(sched540part2_sub[15]) ); + GetLine("CA540_P2_Add_15", &(sched540part2_add[15]) ); + sched540part2[16] = PrelimFedReturn.schedA[16]; + GetLine("CA540_P2_Sub_16", &(sched540part2_sub[16]) ); + GetLine("CA540_P2_Add_16", &(sched540part2_add[16]) ); + + sched540part2[17] = sched540part2[4] + sched540part2[7] + sched540part2[10] + sched540part2[14] + + sched540part2[15] + sched540part2[16]; + sched540part2_sub[17] = sched540part2_sub[4] + sched540part2_sub[7] + sched540part2_sub[10] + sched540part2_sub[14] + + sched540part2_sub[15] + sched540part2_sub[16]; + sched540part2_add[17] = sched540part2_add[4] + sched540part2_add[7] + sched540part2_add[10] + sched540part2_add[14] + + sched540part2_add[15] + sched540part2_add[16]; + + sched540part2[18] = sched540part2[17] - sched540part2_sub[17] + sched540part2_add[17]; + + GetLine("CA540_P2_19", &(sched540part2[19]) ); + GetLine("CA540_P2_20", &(sched540part2[20]) ); + GetLine("CA540_P2_21", &(sched540part2[21]) ); + sched540part2[22] = sched540part2[19] + sched540part2[20] + sched540part2[21]; + sched540part2[23] = PrelimFedReturn.fedline[11]; + sched540part2[24] = NotLessThanZero( 0.02 * sched540part2[23] ); + sched540part2[25] = NotLessThanZero( sched540part2[22] - sched540part2[24] ); + sched540part2[26] = sched540part2[18] + sched540part2[25]; + // GetLine( "Adj", &sched540part2[27] ); /* Now read above. */ + sched540part2[28] = sched540part2[26] + sched540part2[27]; + switch (status) + { + case SINGLE: + case MARRIED_FILING_SEPARAT: threshA = 244857.0; std_ded = 5540.0; break; /* Updated for 2024. */ + case HEAD_OF_HOUSEHOLD: threshA = 367291.0; std_ded = 11080.0; break; + case MARRIED_FILING_JOINTLY: + case WIDOW: threshA = 489719.0; std_ded = 11080.0; break; + } + if (L[13] > threshA) + { /*Itemized Deductions Worksheet*/ /* Page 67. */ + double ws[40]; + // printf("Yes, Fed AGI (%6.2f) is more than threshold (%6.2f).\n", L[13], threshA ); + for (j=1; j <= 10; j++) ws[j] = 0.0; + ws[1] = sched540part2[28]; + ws[2] = PrelimFedReturn.schedA[4] + PrelimFedReturn.schedA[9] + PrelimFedReturn.schedA[15] + PrelimFedReturn.schedA[16]; + ws[3] = ws[1] - ws[2]; + if (ws[3] == 0.0) + sched540part2[29] = ws[1]; + else + { + ws[4] = 0.8 * ws[3]; + ws[5] = L[13]; + ws[6] = threshA; + ws[7] = ws[5] - ws[6]; + if (ws[7] == 0.0) + sched540part2[29] = ws[1]; + else + { + ws[8] = 0.06 * ws[7]; + ws[9] = smallerof( ws[4], ws[8] ); + ws[10] = ws[1] - ws[9]; + sched540part2[29] = ws[10]; + } + } + for (j=1; j <= 10; j++) + if (ws[j] != 0.0) fprintf(outfile," ItemizedDedWS%d = %6.2f\n", j, ws[j] ); + } /*Itemized Deductions Worksheet*/ + else + { + // printf("No, Fed AGI (%6.2f) is less than threshold (%6.2f).\n", L[13], threshA ); + sched540part2[29] = sched540part2[28]; + } + sched540part2[30] = largerof( sched540part2[29], std_ded ); + + /* Display the Part-II calculations. */ + display_part2column( 1, 0 ); + display_part2column( 2, 0 ); + display_part2column( 3, 0 ); + fprintf(outfile," SchedCA540_Part2_%da = %6.2f\n", 4, sched540part2[4] ); + fprintf(outfile," SchedCA540_Part2_%dc = %6.2f\n", 4, sched540part2_add[4] ); + if (sched540part2_5a != 0.0) + fprintf(outfile," SchedCA540_Part2_5aa = %6.2f\n", sched540part2_5a ); + if (sched540part2_sub[5] != 0.0) + fprintf(outfile," SchedCA540_Part2_5ab = %6.2f\n", sched540part2_sub[5] ); + if (sched540part2_5b != 0.0) + fprintf(outfile," SchedCA540_Part2_5ba = %6.2f\n", sched540part2_5b ); + if (sched540part2_5c != 0.0) + fprintf(outfile," SchedCA540_Part2_5ca = %6.2f\n", sched540part2_5c ); + if (sched540part2_5d != 0.0) + fprintf(outfile," SchedCA540_Part2_5da = %6.2f\n", sched540part2_5d ); + if (sched540part2[5] != 0.0) + fprintf(outfile," SchedCA540_Part2_5ea = %6.2f\n", sched540part2[5] ); + if (sched540part2_sub[5] != 0.0) + fprintf(outfile," SchedCA540_Part2_5eb = %6.2f\n", sched540part2_sub[5] ); + if (sched540part2_add[5] != 0.0) + fprintf(outfile," SchedCA540_Part2_5ec = %6.2f\n", sched540part2_add[5] ); + + display_part2( 6 ); + display_part2( 7 ); + + if (sched540part2_8a != 0.0) + fprintf(outfile," SchedCA540_Part2_8aa = %6.2f\n", sched540part2_8a ); + if (sched540part2_add8a != 0.0) + fprintf(outfile," SchedCA540_Part2_8ac = %6.2f\n", sched540part2_add8a ); + if (sched540part2_8b != 0.0) + fprintf(outfile," SchedCA540_Part2_8ba = %6.2f\n", sched540part2_8b ); + if (sched540part2_add8b != 0.0) + fprintf(outfile," SchedCA540_Part2_8bc = %6.2f\n", sched540part2_add8b ); + if (sched540part2_8c != 0.0) + fprintf(outfile," SchedCA540_Part2_8ca = %6.2f\n", sched540part2_8c ); + if (sched540part2_add8c != 0.0) + fprintf(outfile," SchedCA540_Part2_8cc = %6.2f\n", sched540part2_add8c ); + if (sched540part2[8] != 0.0) + fprintf(outfile," SchedCA540_Part2_8ea = %6.2f\n", sched540part2[8] ); + if (sched540part2_sub[8] != 0.0) + fprintf(outfile," SchedCA540_Part2_8eb = %6.2f\n", sched540part2_sub[8] ); + if (sched540part2_add[8] != 0.0) + fprintf(outfile," SchedCA540_Part2_8ec = %6.2f\n", sched540part2_add[8] ); + + for (j=9; j <= 17; j++) + display_part2( j ); + display_part2column( 18, 0 ); + + L[18] = sched540part2[30]; + + for (j=19; j <= 30; j++) + display_part2column( j, 0 ); + + /* -- End Sched540 Part II -- */ + + + L[14] = sched540Cb[27]; /* CA Adjustments, Schedule CA 540 line 27 column B. */ + showline(14); + + L[15] = L[13] - L[14]; + if (L[15] < 0.0) fprintf(outfile,"L15 = (%f6.2)\n", -L[15] ); + else showline(15); + + L[16] = sched540Cc[27]; /* CA Adjustments, Schedule CA 540 line 37 column C. */ + showline(16); + + L[17] = L[15] + L[16]; /* CA Adjusted Gross Income (AGI). */ + showline(17); + + switch (status) + { /* Minimum AGI (Line 17) required to file. */ /* Updated for 2024. */ + case SINGLE: + case HEAD_OF_HOUSEHOLD: + if (iline9 == 0) + min2file = 17818.0; /*Under65*/ + else + min2file = 25268.0; /*65over*/ + break; + case MARRIED_FILING_JOINTLY: + if (iline9 == 0) + min2file = 35642.0; /*BothUnder65*/ + else + if (iline9 == 1) + min2file = 43092.0; /*OneUnder65*/ + else + min2file = 50542.0; /*Both65over*/ + break; + case WIDOW: + if (iline9 == 0) + min2file = 33185.0; /*Under65*/ + else + min2file = 36793.0; /*65over*/ + break; + default: min2file = 5.0; + } + if (L[17] <= min2file) + fprintf(outfile,"You may not need to file CA Taxes, due to your California Adjusted Gross Income (%6.2f <= %6.2f).\n", + L[17], min2file ); + + showline(18); /* Computed above. */ + + L[19] = NotLessThanZero( L[17] - L[18] ); + showline_wmsg(19,"Taxable Income"); /* Taxable income. */ + + /* Tax. */ + if (L[19] < 100000.00) + fprintf(outfile,"Check box from: Tax Table.\nCkTxTable: X\n"); + else + fprintf(outfile,"Check box from: Tax Rate Schedule.\nCkTxRateSchd: X\n"); + L[31] = TaxRateFunction( L[19], status ); + showline( 31 ); + Report_bracket_info( L[19], status ); + + if (L[13] > threshA) + { /*Line32-Exemption-credits-worksheet*/ + double ws_a, ws_b, ws_c, ws_d, ws_e, ws_f, ws_g, ws_h, ws_i, ws_j, ws_k, ws_l, ws_m, ws_n; + printf(" Doing AGI Limitations worksheet.\n"); + ws_a = L[13]; + ws_b = threshA; + ws_c = ws_a - ws_b; + if (status != MARRIED_FILING_SEPARAT) + ws_d = ceil(ws_c / 2500.0); + else + ws_d = ceil(ws_c / 1250.0); + ws_e = 6.0 * ws_d; + ws_f = iline7 + iline8 + iline9; + ws_g = ws_e * ws_f; + ws_h = L[7] + L[8] + L[9]; + ws_i = NotLessThanZero( ws_h - ws_g ); + ws_j = iline10; + ws_k = ws_e * ws_j; + ws_l = L[10]; + ws_m = NotLessThanZero( ws_l - ws_k ); + ws_n = ws_i + ws_m; + fprintf(outfile," AGI Worksheet:\n a: %6.2f\n", ws_a); + fprintf(outfile," b: %6.2f\n", ws_b); + fprintf(outfile," c: %6.2f\n", ws_c); + fprintf(outfile," d: %6.2f\n", ws_d); + fprintf(outfile," e: %6.2f\n", ws_e); + fprintf(outfile," f: %6.2f\n", ws_f); + fprintf(outfile," g: %6.2f\n", ws_g); + fprintf(outfile," h: %6.2f\n", ws_h); + fprintf(outfile," i: %6.2f\n", ws_i); + fprintf(outfile," j: %6.2f\n", ws_j); + fprintf(outfile," k: %6.2f\n", ws_k); + fprintf(outfile," l: %6.2f\n", ws_l); + fprintf(outfile," m: %6.2f\n", ws_m); + fprintf(outfile," n: %6.2f\n", ws_n); + fprintf(outfile," Your exemptions may be limited. Used Exemptions-Credits-Worksheet for Line 21.\n"); + fprintf(outfile," WorkSheet[n]=%6.2f (vs. L11=%6.2f)\n", ws_n, L[11] ); + L[32] = ws_n; + } + else L[32] = L[11]; + showline(32); + + L[33] = NotLessThanZero( L[31] - L[32] ); + showline(33); + + GetLineF( "L34", &L[34] ); + showline(34); /* Taxes on distributions (sched G-1 or form FTB 5870A) */ + + L[35] = L[33] + L[34]; + showline(35); + + /* Special Credits. */ + GetLineF( "L40", &L[40] ); /* Nonrefundable Child + Dependent Care Expenses Credit (pg 11). */ + fprintf(outfile," "); /* Indent next entry. */ + GetLineF( "L43", &L[43] ); /* Special credit 1 */ + GetLineF( "L44", &L[44] ); /* Special credit 2 */ + GetLineF( "L45", &L[45] ); /* Special credit 3+ */ + GetLineF( "L46", &L[46] ); /* Nonrefundable renter's credit */ + + L[47] = L[40] + L[43] + L[44] + L[45] + L[46]; + showline(47); /* Total credits. */ + + L[48] = NotLessThanZero( L[35] - L[47] ); + showline(48); + + /* Other taxes. */ + GetLineF( "L61", &L[61] ); /* Alternative minimum tax Sched P. */ + + GetLineF( "L62", &L[62] ); /* Mental Health Services Tax. */ + + GetLineF( "L63", &L[63] ); /* Other taxes and credit recapture. */ + + L[64] = L[48] + L[61] + L[62] + L[63]; + showline_wmsg( 64, "Total Tax" ); /* Total tax. */ + + /* Payments. */ + GetLineF( "L71", &L[71] ); /* CA income tax withheld. */ + + GetLineF( "L72", &L[72] ); /* Estimated tax paid. */ + + GetLineF( "L73", &L[73] ); /* Realestate withholding. */ + + // GetLineF( "L74", &L[74] ); /* Excess SDI. */ + + /* Allow un-needed L74 for now. (Remove *optional* logic for 2024, once reoved from on ALL templates.) */ + get_parameter( infile, 'l', labelx, "L74 or L75"); + if (strcmp( labelx, "L74" ) == 0) + { + get_parameters( infile, 'f', &L[74], labelx ); + GetLineF( "L75", &L[75] ); /* Earned Income Tax Credit (EITC). */ + } + else + if (strcmp( labelx, "L75" ) == 0) + { + get_parameters( infile, 'f', &L[75], labelx ); + showline(75); + } + else + { + printf("Error: Found '%s' when expecteding A18 or B7a.\n", labelx ); + fprintf(outfile,"Error: Found '%s' when expecteding A18 or B7a\n", labelx ); + exit(1); + } + + + GetLineF( "L76", &L[76] ); /* Young Child Tax Credit (YCTC). */ + + GetLineF( "L77", &L[77] ); /* Net Premium Assistance Subsidy (PAS). */ + + L[78] = L[71] + L[72] + L[73] + L[74] + L[75] + L[76] + L[77]; + showline_wmsg(78,"Total Payments"); + + GetLineF( "L91", &L[91] ); /* Use Tax. */ + + // GetYesNo( "CkPayedUseTaxCDTFA", &CkPayedUseTaxCDTFA ); + // GetYesNo( "CkFYHealthCoverage", &CkFYHealthCoverage ); + // GetLineF( "L92", &L[92] ); /* Individual Shared Responsibility (ISR) Penalty. */ + + get_parameter( infile, 'l', word, "CkFYHealthCoverage" ); + get_parameters( infile, 'b', &CkPayedUseTaxCDTFA, "CkPayedUseTaxCDTFA" ); + get_parameter( infile, 'l', word, "CkFYHealthCoverage" ); + if (L[91] == 0.0) + { + if (CkPayedUseTaxCDTFA == 0) + fprintf(outfile," CkNoUseTaxOwed = X\n"); + else + fprintf(outfile," CkPayedUseTaxCDTFA = X\n"); + } + if (strcmp( word, "CkFYHealthCoverage" ) == 0) + { + get_parameters( infile, 'b', &CkFYHealthCoverage, "CkFYHealthCoverage" ); + if (CkFYHealthCoverage != 0) + fprintf(outfile, "CkFYHealthCoverage X\n"); + /* Now go ahead and get the expected next line. */ + GetLineF( "L92", &L[92] ); /* Individual Shared Responsibility (ISR) Penalty. */ + } + else + if (strcmp( word, "L92" ) == 0) + { /* Get remaining part of line. */ + get_parameters( infile, 'f', &L[92], "L92" ); + fprintf(outfile, "L92 = %6.2f\n", L[92] ); + } + + + if (L[78] > L[91]) + { + L[93] = L[78] - L[91]; + showline(93); + } + else + if (L[91] > L[78]) + { + L[94] = L[91] - L[78]; + showline_wmsg(94, "Use Tax balance" ); + } + + if (L[93] > L[92]) + { + L[95] = L[93] - L[92]; + showline(95); + } + else + if (L[92] > L[93]) + { + L[96] = L[92] - L[93]; + showline(96); + } + + GetLine( "L98", &L[98] ); /* Amount of refund to apply to next tear's estimated withholding. */ + GetLine( "L112", &L[112] ); /* Interest, late penalties. */ + GetLine( "L113", &L[113] ); /* Underpayment of estimated tax penalty. (FTB 5805) */ + + /* Refund / Tax-Due. */ + if (L[95] > L[64]) + { + L[97] = L[95] - L[64]; + fprintf(outfile,"L97 = %6.2f REFUND!!!\n", L[97] ); + showline(98); + L[99] = L[97] - L[98]; + showline(99); + showline(112); + showline(113); + L[115] = L[99] - (L[110] + L[112] + L[113]); + showline(115); + } + else + { + L[100] = L[64] - L[95]; + fprintf(outfile,"L100 = %6.2f DUE !!!\n", L[100] ); + fprintf(outfile," (Which is %2.1f%% of your total tax.)\n", 100.0 * L[100] / (L[64] + 1e-9) ); + L[111] = L[94] + L[96] + L[100] + L[110]; + showline(111); + showline(112); + showline(113); + L[114] = L[111] + L[112] + L[113]; + showline(114); + } + + fprintf(outfile,"\nSelect any charity contributions and complete\n form accordingly.\n"); + + fprintf(outfile,"\n{ --------- }\n"); + writeout_line = 0; + // Your1stName = GetTextLineF( "Your1stName:" ); + YourMidInitial = pull_initial( Your1stName ); + fprintf(outfile,"Your1stName: %s\n", Your1stName ); + fprintf(outfile,"YourMidInit: %s\n", YourMidInitial ); + // YourLastName = GetTextLineF( "YourLastName:" ); + fprintf(outfile,"YourLastName: %s\n", YourLastName ); + // your_socsec = GetTextLineF( "YourSocSec#:" ); + format_socsec( your_socsec, 1 ); + fprintf(outfile,"YourSocSec#: %s\n", your_socsec ); + + if ((status != SINGLE) && (status != WIDOW)) + { + // Spouse1stName = GetTextLineF( "Spouse1stName:" ); + SpouseMidInitial = pull_initial( Spouse1stName ); + fprintf(outfile,"Spouse1stName: %s\n", Spouse1stName ); + fprintf(outfile,"SpouseMidInit: %s\n", SpouseMidInitial ); + // SpouseLastName = GetTextLineF( "SpouseLastName:" ); + fprintf(outfile,"SpouseLastName: %s\n", SpouseLastName ); + // spouse_socsec = GetTextLineF( "SpouseSocSec#:" ); + format_socsec( spouse_socsec, 1 ); + fprintf(outfile,"SpouseSocSec#: %s\n", spouse_socsec ); + } + else + { + Spouse1stName[0] = '\0'; + SpouseLastName[0] = '\0'; + } + writeout_line = 1; + + if (strlen( YourLastName ) > 0) + { + strcpy( YourName, Your1stName ); + strcat( YourName, " " ); + strcat( YourName, YourLastName ); + YourName[26] = '\0'; /* Limit to no longer than about 25 characters. */ + fprintf(outfile,"YourName: %s\n", YourName ); + + if (strcmp( YourLastName, SpouseLastName ) == 0) + sprintf(YourNames,"%s & %s, %s", Your1stName, Spouse1stName, YourLastName ); + else + if (strlen( SpouseLastName ) > 0) + sprintf(YourNames,"%s %s & %s %s", Your1stName, YourLastName, Spouse1stName, SpouseLastName ); + else + sprintf(YourNames,"%s %s", Your1stName, YourLastName ); + fprintf(outfile,"YourNames: %s\n", YourNames ); + } + // GetTextLineF( "Number&Street:" ); + Show_String_wLabel( "Number&Street:", street_address ); + // GetTextLineF( "Apt#:" ); + Show_String_wLabel( "Apt#:", apartment ); + // GetTextLineF( "Town:" ); + Show_String_wLabel( "Town:", town ); + fprintf(outfile,"State: CA\n"); + // GetTextLineF( "Zipcode:" ); + Show_String_wLabel( "ZipCode:", zipcode ); + GetTextLineF( "YourDOB:" ); + GetTextLineF( "SpouseDOB:" ); + + for (j=1; j <=3; j++) + if (strlen(PrelimFedReturn.Dep1stName[j]) > 0) + { + fprintf(outfile,"L10Dep%dFrstName: %s\n", j, PrelimFedReturn.Dep1stName[j] ); + fprintf(outfile,"L10Dep%dLastName: %s\n", j, PrelimFedReturn.DepLastName[j] ); + fprintf(outfile,"L10Dep%dSSN: %s\n", j, PrelimFedReturn.DepSocSec[j] ); + fprintf(outfile,"L10Dep%dRelation: %s\n", j, PrelimFedReturn.DepRelation[j] ); + } + + get_word(infile, labelx ); /* Look for optional fields. */ + while (!feof(infile)) + { /*OptionalLine*/ + read_comment_filtered_line( infile, word, 512 ); + // printf("\nLine '%s' = '%s'\n", labelx, word ); + if (word[0] != '\0') + { /*valid_entry*/ + if (strstr( labelx,"WantHealthInfo" ) != 0) + { + if (toupper(word[0]) == 'Y') + fprintf(outfile, "CkHCinfoYes X\n"); + else + fprintf(outfile, "CkHCinfoNo X\n"); + } + else + if (strstr( labelx,"Discuss" ) != 0) + { + if (toupper(word[0]) == 'Y') + fprintf(outfile, "CkDiscussYes X\n"); + else + fprintf(outfile, "CkDiscussNo X\n"); + } + } /*valid_entry*/ + get_word(infile, labelx ); + } /*OptionalLine*/ + + fclose(infile); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + Display_File( outfname ); + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_CA_5805_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_CA_5805_2024.c new file mode 100755 index 0000000..679c00e --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_CA_5805_2024.c @@ -0,0 +1,896 @@ +/************************************************************************/ +/* TaxSolve_CA_5805-2024.c */ +/* User contributed. */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA. */ +/* */ +/************************************************************************/ + +float thisversion=6.00; + +#include +#include +#include +#include +#include + +#include "taxsolve_routines.c" + +#define SINGLE 1 +#define MARRIED_FILING_JOINTLY 2 +#define MARRIED_FILING_SEPARAT 3 +#define HEAD_OF_HOUSEHOLD 4 +#define WIDOW 5 +#define INDIVIDUAL 1 +#define ESTATE 2 +#define Yes 1 +#define No 0 +#define NotApplicable 3 +#define Short 1 +#define Annualized 2 + +/* The following two tax functions copied from taxsolve_CA_540_2024.c. */ +/* 2024 tax rates are used in California for calculating estimated taxes */ + +double TaxRateFormula( double income, int status ) +{ /* Updated for 2024. */ + double tax; + if ((status==SINGLE) || (status==MARRIED_FILING_SEPARAT)) + { + if (income < 10756.00) tax = 0.01 * income; else + if (income < 25499.00) tax = 107.56 + 0.02 * (income - 10756.00); else + if (income < 40245.00) tax = 402.42 + 0.04 * (income - 25499.00); else + if (income < 55866.00) tax = 992.26 + 0.06 * (income - 40245.00); else + if (income < 70606.00) tax = 1929.52 + 0.08 * (income - 55866.00); else + if (income < 360659.00) tax = 3108.72 + 0.093 * (income - 70606.00); else + if (income < 432787.00) tax = 30083.65 + 0.103 * (income - 360659.00); else + if (income < 721314.00) tax = 37512.83 + 0.113 * (income - 432787.00); + else tax = 70116.38 + 0.123 * (income - 721314.00); + } + else + if ((status==MARRIED_FILING_JOINTLY) || (status==WIDOW)) + { + if (income < 21512.00) tax = 0.01 * income; else + if (income < 50998.00) tax = 215.12 + 0.02 * (income - 21512.00); else + if (income < 80490.00) tax = 804.84 + 0.04 * (income - 50998.00); else + if (income < 111732.00) tax = 1984.52 + 0.06 * (income - 80490.00); else + if (income < 141212.00) tax = 3859.04 + 0.08 * (income - 111732.00); else + if (income < 721318.00) tax = 6217.44 + 0.093 * (income - 141212.00); else + if (income < 865574.00) tax = 60167.30 + 0.103 * (income - 721318.00); else + if (income < 1442628.00) tax = 75025.67 + 0.113 * (income - 865574.00); + else tax = 140232.77 + 0.123 * (income - 1442628.00); + } + else + { /* Head of Household. */ + if (income < 21527.00) tax = 0.01 * income; else + if (income < 51000.00) tax = 215.27 + 0.02 * (income - 21527.00); else + if (income < 65744.00) tax = 804.73 + 0.04 * (income - 51000.00); else + if (income < 81364.00) tax = 1394.49 + 0.06 * (income - 65744.00); else + if (income < 96107.00) tax = 2331.69 + 0.08 * (income - 81364.00); else + if (income < 490493.00) tax = 3511.13 + 0.093 * (income - 96107.00); else + if (income < 588593.00) tax = 40189.03 + 0.103 * (income - 490493.00); else + if (income < 980987.00) tax = 50293.33 + 0.113 * (income - 588593.00); + else tax = 94633.85 + 0.123 * (income - 980987.00); + } + return (int)(tax+0.5); +} + + +double TaxRateFunction( double income, int status ) /* Emulates table lookup or function appropriately. */ +{ + double x, tx; + int k; + + if (income < 100000.0) /* Quantize to match tax-table exactly. */ + { + if (income < 99951.0) + { + k = (income + 49) / 100; + x = 100 * (double)k; + } + else x = 99975.0; + tx = (int)(TaxRateFormula( x, status )); + } + else + tx = TaxRateFormula( income, status ); + return tx; +} + + +double /* Reoccuring threshold values. */ /* Not updated for 2024. */ + thresh_sep_single = 237035.0, + thresh_mfj = 474075.0, + thresh_HoH = 355558.0; + +double /* Other recurring values */ /* Not updated for 2024 */ + line_11_multiplier = 0.04799165, + line_12_multiplier = 0.00019; + +double L6WS(int column, double IIIL4, double ScdA, double IIIL5, double FAIWSL3, int status){ + + double L[14]; + int i; + + L[1] = IIIL4; + L[2] = ScdA; + L[3] = L[1] - L[2]; + L[4] = IIIL5; + L[5] = L[1] * L[4]; + if(L[3] == 0){ + fprintf(outfile, " Line 6 Worksheet - Column (%c),\n", column); + for(i = 1; i <= 5; i++) + fprintf(outfile, "L6WS_%d%c %0.2lf\n", i, column, L[i]); + return(L[5]); + } + L[6] = L[3] * L[4]; + L[7] = Round(L[6] * 0.80); + L[8] = FAIWSL3; + if((status == MARRIED_FILING_JOINTLY) || (status == WIDOW)) + L[9] = thresh_mfj; + else if((status == SINGLE) || (status == MARRIED_FILING_SEPARAT)) + L[9] = thresh_sep_single; + else if(status == HEAD_OF_HOUSEHOLD) + L[9] = thresh_HoH; + L[10] = L[8] - L[9]; + L[11] = Round(L[10] * 0.06); + L[12] = SmallerOf(L[7], L[11]); + L[13] = Round(L[5] - L[12]); + + fprintf(outfile, " Line 6 Worksheet - Column (%c),\n", column); + for(i = 1; i <= 13; i++) + fprintf(outfile, "L6WS_%d%c %0.2lf\n", i, column, L[i]); + return(L[13]); +} + +/*----------------------------------------------------------------------------*/ + +int main( int argc, char *argv[] ) +{ + int i, j, k, status, entity = INDIVIDUAL, Quest4 = Yes; + char word[4000], outfname[4000], *infname=0; + time_t now; + + int Quest2, Quest3 = 0, Num_Days = -1; /* negative Num_Days used as a flag below */ + double Wthd_Per_1, Wthd_Per_2, Wthd_Per_3, Wthd_Per_4, CA_AGI; + double a10add, b10add, c10add, d10add; + + + /* line entry variables L[n] are declared in taxsolve_routines.c */ + + double a[24], b[24], c[24], d[24]; /* cells in grid of Part III Annualizd Income Installment Method Schedule */ + /* comprised of lines 1-13 and 15-23; e.g., cell 1(a) will be in variable a[1] */ + /* lines 14a-14e declared individually */ + + double L14aa = 0, L14ab = 0, L14ac = 0, L14ad = 0; + double L14ba = 0, L14bb = 0, L14bc = 0, L14bd = 0; + double L14ca = 0, L14cb = 0, L14cc = 0, L14cd = 0; + double L14da = 0, L14db = 0, L14dc = 0, L14dd = 0; + double L14ea = 0, L14eb = 0, L14ec = 0, L14ed = 0; + + double FAIWS_a[4], FAIWS_b[4], FAIWS_c[4], FAIWS_d[4]; /* cells in grid for Federal Annualized Income Worksheet */ + + double L6WS_a[14], L6WS_b[14], L6WS_c[14], L6WS_d[14]; /* cells in grid for Line 6 Worksheet */ + + double A[15], B[15], C[15], D[15]; /* cells in grid of Worksheet II */ + /* e.g., cell 1(a) will be in variable A[1] */ + + printf("Form 5805, 2024 - v%3.2f\n", thisversion); + + /* Decode any command-line arguments. */ + i = 1; k=1; + while (i < argc) + { + if (strcmp(argv[i],"-verbose")==0) { verbose = 1; } + else + if (k==1) + { + infname = strdup(argv[i]); + infile = fopen(infname,"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", infname ); exit(1);} + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname,infname); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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= 1000000.00) || (status == MARRIED_FILING_SEPARAT && CA_AGI >= 500000.00)) + L[6] = L[2]; +else + L[6] = SmallerOf(L[2], L[5]); +showline( 6 ); + +/* Short Method */ + +/* Need to read these Short Method inputs even if Short Method is not used; */ +/* otherwise, error message re: unexpected input item is thrown */ + + GetLineF( "L8", &L[8] ); + + GetInteger( "Num_Days", &Num_Days); + + if(Quest2 == No){ /* Not using Annualized Income Installment Method */ + + L[7] = L[3]; + L[9] = L[7 ]+ L[8]; + L[10] = L[6] - L[9]; + + for(i = 7; i <= 10; i++) + showline( i ); + + if(L[10] <= 0){ + fprintf(outfile, "Line 10 is zero or less. Stop here. You do not owe the penalty.\nDo not file form FTB 5805.\n"); + exit(0); + } + + L[11] = L[10] * line_11_multiplier; + + if(Num_Days > -1){ + + L[12] = L[10] * Num_Days * line_12_multiplier; + L[13] = L[11] - L[12]; + + showline( 11 ); + showline( 12 ); + + showline_wmsg(13, "PENALTY. Enter this amount on Form 540, line 113; Form 540NR, line 123; or Form 541, line 44.\n Also, check the box for FTB 5805.\n"); + } + } + else{ /* Using the Annualized Income Installment Method */ + + /* Annualized Income Installment Method */ + + /* Inputs must be read even if Annualized Income Installment Method is not used; */ + /* otherwise, error message re: unexpected input is thrown */ + + GetLine( "SchdAI_1a", &a[1] ); + GetLine( "SchdAI_1b", &b[1] ); + GetLine( "SchdAI_1c", &c[1] ); + GetLine( "SchdAI_1d", &d[1] ); + + if(entity == ESTATE){ + + a[2] = 6.0; + b[2] = 3.0; + c[2] = 1.71429; + d[2] = 1.09091; + + } + else{ + a[2] = 4.0; + b[2] = 2.4; + c[2] = 1.5; + d[2] = 1.0; + } + +// GetLine1( "SchdAI_2a", &a[2] ); +// GetLine1( "SchdAI_2b", &b[2] ); +// GetLine1( "SchdAI_2c", &c[2] ); +// GetLine1( "SchdAI_2d", &d[2] ); + + GetLine( "SchdAI_4a", &a[4] ); + GetLine( "SchdAI_4b", &b[4] ); + GetLine( "SchdAI_4c", &c[4] ); + GetLine( "SchdAI_4d", &d[4] ); + +// GetLine( "SchdAI_6a", &a[6] ); +// GetLine( "SchdAI_6b", &b[6] ); +// GetLine( "SchdAI_6c", &c[6] ); +// GetLine( "SchdAI_6d", &d[6] ); + + GetLine( "SchdAI_7a", &a[7] ); + b[7] = a[7]; + c[7] = a[7]; + d[7] = a[7]; + + GetLine( "SchdAI_10a_add", &a10add ); + GetLine( "SchdAI_10b_add", &b10add ); + GetLine( "SchdAI_10c_add", &c10add ); + GetLine( "SchdAI_10d_add", &d10add ); + + GetLine( "SchdAI_11a", &a[11] ); + GetLine( "SchdAI_11b", &b[11] ); + GetLine( "SchdAI_11c", &c[11] ); + GetLine( "SchdAI_11d", &d[11] ); + + GetLine( "SchdAI_13a", &a[13] ); + GetLine( "SchdAI_13b", &b[13] ); + GetLine( "SchdAI_13c", &c[13] ); + GetLine( "SchdAI_13d", &d[13] ); + + GetLine( "SchdAI_14ba", &L14ba ); + GetLine( "SchdAI_14bb", &L14bb ); + GetLine( "SchdAI_14bc", &L14bc ); + GetLine( "SchdAI_14bd", &L14bd ); + + GetLine( "SchdAI_14da", &L14da ); + GetLine( "SchdAI_14db", &L14db ); + GetLine( "SchdAI_14dc", &L14dc ); + GetLine( "SchdAI_14dd", &L14dd ); + + GetLine( "FAIWS_1a", &FAIWS_a[1]); + GetLine( "FAIWS_1b", &FAIWS_b[1]); + GetLine( "FAIWS_1c", &FAIWS_c[1]); + GetLine( "FAIWS_1d", &FAIWS_d[1]); + + GetLine( "L6WS_2a", &L6WS_a[2]); + GetLine( "L6WS_2b", &L6WS_b[2]); + GetLine( "L6WS_2c", &L6WS_c[2]); + GetLine( "L6WS_2d", &L6WS_d[2]); + + GetLine( "WSII_2a", &A[2]); + GetLine( "WSII_2b", &B[2]); + GetLine( "WSII_2c", &C[2]); + GetLine( "WSII_2d", &D[2]); + + GetLine( "WSII_10a", &A[10]); + GetLine( "WSII_10b", &B[10]); +// GetLine( "WSII_10c", &C[10]); + + GetLine( "WSII_12a", &A[12]); + GetLine( "WSII_12b", &B[12]); + GetLine( "WSII_12c", &C[12]); + GetLine( "WSII_12d", &D[12]); + + a[3] = a[1] * a[2]; + b[3] = b[1] * b[2]; + c[3] = c[1] * c[2]; + d[3] = d[1] * d[2]; + + a[5] = a[2]; + b[5] = b[2]; + c[5] = c[2]; + d[5] = d[2]; + + a[6] = a[4] * a[5]; /* calculation for lower income filers */ + b[6] = b[4] * b[5]; /* these values will be overwritten if higher income thresholds are exceeded */ + c[6] = c[4] * c[5]; + d[6] = d[4] * d[5]; + + FAIWS_a[3] = FAIWS_a[1] * a[5]; + fprintf(outfile, "FAIWS_1a\t%0.2lf\n", FAIWS_a[1]); + fprintf(outfile, "FAIWS_2a\t%0.2lf\n", a[5]); + fprintf(outfile, "FAIWS_3a\t%0.2lf\n", FAIWS_a[3]); + + if(a[4] > 0){ + if((((status == MARRIED_FILING_JOINTLY) || (status == WIDOW)) && (FAIWS_a[3] > thresh_mfj)) || \ + (((status == SINGLE) || (status == MARRIED_FILING_SEPARAT)) && (FAIWS_a[3] > thresh_sep_single)) || \ + ((status == HEAD_OF_HOUSEHOLD) && (FAIWS_a[3] > thresh_HoH))){ + a[6] = L6WS('a', a[4], L6WS_a[2], a[5], FAIWS_a[3], status); + } + } + + FAIWS_b[3] = FAIWS_b[1] * b[5]; + fprintf(outfile, "FAIWS_1b\t%0.2lf\n", FAIWS_b[1]); + fprintf(outfile, "FAIWS_2b\t%0.2lf\n", b[5]); + fprintf(outfile, "FAIWS_3b\t%0.2lf\n", FAIWS_b[3]); + + if(b[4] > 0){ + if((((status == MARRIED_FILING_JOINTLY) || (status == WIDOW)) && (FAIWS_b[3] > thresh_mfj)) || \ + (((status == SINGLE) || (status == MARRIED_FILING_SEPARAT)) && (FAIWS_b[3] > thresh_sep_single)) || \ + ((status == HEAD_OF_HOUSEHOLD) && (FAIWS_b[3] > thresh_HoH))){ + b[6] = L6WS('b', b[4], L6WS_b[2], b[5], FAIWS_b[3], status); + } + } + + FAIWS_c[3] = FAIWS_c[1] * c[5]; + fprintf(outfile, "FAIWS_1c\t%0.2lf\n", FAIWS_c[1]); + fprintf(outfile, "FAIWS_2c\t%0.2lf\n", c[5]); + fprintf(outfile, "FAIWS_3c\t%0.2lf\n", FAIWS_c[3]); + + if(c[4] > 0){ + if((((status == MARRIED_FILING_JOINTLY) || (status == WIDOW)) && (FAIWS_c[3] > thresh_mfj)) || \ + (((status == SINGLE) || (status == MARRIED_FILING_SEPARAT)) && (FAIWS_c[3] > thresh_sep_single)) || \ + ((status == HEAD_OF_HOUSEHOLD) && (FAIWS_c[3] > thresh_HoH))){ + c[6] = L6WS('c', c[4], L6WS_c[2], c[5], FAIWS_c[3], status); + } + } + + FAIWS_d[3] = FAIWS_d[1] * d[5]; + fprintf(outfile, "FAIWS_1d\t%0.2lf\n", FAIWS_d[1]); + fprintf(outfile, "FAIWS_2d\t%0.2lf\n", d[5]); + fprintf(outfile, "FAIWS_3d\t%0.2lf\n", FAIWS_d[3]); + + if(d[4] > 0){ + if((((status == MARRIED_FILING_JOINTLY) || (status == WIDOW)) && (FAIWS_d[3] > thresh_mfj)) || \ + (((status == SINGLE) || (status == MARRIED_FILING_SEPARAT)) && (FAIWS_d[3] > thresh_sep_single)) || \ + ((status == HEAD_OF_HOUSEHOLD) && (FAIWS_d[3] > thresh_HoH))){ + d[6] = L6WS('d', d[4], L6WS_d[2], d[5], FAIWS_d[3], status); + } + } + + a[8] = LargerOf(a[6], a[7]); + b[8] = LargerOf(b[6], b[7]); + c[8] = LargerOf(c[6], c[7]); + d[8] = LargerOf(d[6], d[7]); + + a[9] = a[3] - a[8]; + b[9] = b[3] - b[8]; + c[9] = c[3] - c[8]; + d[9] = d[3] - d[8]; + + a[10] = TaxRateFunction( a[9], status); + b[10] = TaxRateFunction( b[9], status); + c[10] = TaxRateFunction( c[9], status); + d[10] = TaxRateFunction( d[9], status); + + a[10] += a10add; + b[10] += b10add; + c[10] += c10add; + d[10] += d10add; + + a[12] = a[10] - a[11]; + b[12] = b[10] - b[11]; + c[12] = c[10] - c[11]; + d[12] = d[10] - d[11]; + + L14aa = NotLessThanZero(a[12] - a[13]); + L14ab = NotLessThanZero(b[12] - b[13]); + L14ac = NotLessThanZero(c[12] - c[13]); + L14ad = NotLessThanZero(d[12] - d[13]); + + L14ca = L14aa + L14ba; /* first lower case letter is row; second lower case letter is column */ + L14cb = L14ab + L14bb; + L14cc = L14ac + L14bc; + L14cd = L14ad + L14bd; + + L14ea = L14ca - L14da; + L14eb = L14cb - L14db; + L14ec = L14cc - L14dc; + L14ed = L14cd - L14dd; + + a[16] = Round(L14ea * 0.27); + b[16] = Round(L14eb * 0.63); + c[16] = Round(L14ec * 0.63); + d[16] = Round(L14ed * 0.90); + + a[18] = NotLessThanZero(a[16] - a[17]); + a[19] = Round(L[6] * 0.30); + a[21] = a[19]; + a[22] = NotLessThanZero(a[21] - a[18]); + a[23] = SmallerOf(a[18], a[21]); + A[1] = a[23]; + + b[17] = a[23]; + b[18] = NotLessThanZero(b[16] - b[17]); + b[19] = Round(L[6] * 0.40); + b[20] = a[22]; + b[21] = b[19] + b[20]; + b[22] = NotLessThanZero(b[21] - b[18]); + b[23] = SmallerOf(b[18], b[21]); + B[1] = b[23]; + + c[17] = a[23] + b[23]; + c[18] = NotLessThanZero(c[16] - c[17]); + c[19] = 0; + c[20] = b[22]; + c[21] = c[19] + c[20]; + c[22] = NotLessThanZero(c[21] - c[18]); + c[23] = SmallerOf(c[18], c[21]); + C[1] = c[23]; + + d[17] = a[23] + b[23] + c[23]; + d[18] = NotLessThanZero(d[16] - d[17]); + d[19] = Round(L[6] * 0.30); + d[20] = c[22]; + d[21] = d[19] + d[20]; + d[22] = NotLessThanZero(d[21] - d[18]); + d[23] = SmallerOf(d[18], d[21]); + D[1] = d[23]; + + } + /* WORKSHEET II */ + + /* A[2], B[2], C[2], D[2] contain estimated taxes paid each period. Add uneven withholding in period */ + /* or total of evenly withheld amounts allocated to each period based on number of days in period */ + /* Withholding is either uneven or even (in which case Wthd_Per_1, Wthd_Per_2, Wthd_Per_3, and */ + /* Wthd_Per_4 should all be blank or zero. */ + + if(Quest3 == Yes){ + A[2] = A[2] + Wthd_Per_1; + B[2] = B[2] + Wthd_Per_2; + C[2] = C[2] + Wthd_Per_3; + D[2] = D[2] + Wthd_Per_4; + } + else{ + A[2] = A[2] + L[3] * (90.0 / 365.0); + B[2] = B[2] + L[3] * (61.0 / 365.0); + C[2] = C[2] + L[3] * (92.0 / 365.0); + D[2] = D[2] + L[3] * (122.0 / 365.0); + } + + A[6] = A[2]; + + if(A[1] >= A[6]) + A[8] = A[1] - A[6]; + else + A[9] = A[6] - A[1]; + + A[11] = A[8] * A[10]/365 * 0.05; + A[13] = A[8] * A[12]/366 * 0.07; + + B[3] = A[9]; + B[4] = B[2] + B[3]; + B[5] = A[7] + A[8]; + B[6] = NotLessThanZero(B[4] - B[5]); + if(B[6] == 0) + B[7] = B[5] - B[4]; + else + B[7] = 0; + if(B[1] >= B[6]) + B[8] = B[1] - B[6]; + else + B[9] = B[6] - B[1]; + + B[11] = B[8] * B[10]/365 * 0.05; + B[13] = B[8] * B[12]/366 * 0.07; + + C[3] = B[9]; + C[4] = C[2] + C[3]; + C[5] = B[7] + B[8]; + C[6] = NotLessThanZero(C[4] - C[5]); + if(C[6] == 0) + C[7] = C[5] - C[4]; + else + C[7] = 0; + if(C[1] >= C[6]) + C[8] = C[1] - C[6]; + else + C[9] = C[6] - C[1]; + + C[11] = C[8] * C[10]/365 * 0.05; + C[13] = C[8] * C[12]/366 * 0.07; + + D[3] = C[9]; + D[4] = D[2] + D[3]; + D[5] = C[7] + C[8]; + D[6] = NotLessThanZero(D[4] - D[5]); + + if(D[1] >= D[6]) + D[8] = D[1] - D[6]; + else + D[9] = D[6] - D[1]; + + D[13] = D[8] * D[12]/366 * 0.07; + + A[0] = A[11] + B[11] + C[11] + A[13] + B[13] + C[13] + D[13]; /* line 14 of WSII */ + + if(Quest2 == Yes){ + + for(i = 18; i <= 14; i++){ + fprintf(outfile, "SecA_%d%s %0.2lf\n", i, "a", A[i]); + fprintf(outfile, "SecA_%d%s %0.2lf\n", i, "b", B[i]); + fprintf(outfile, "SecA_%d%s %0.2lf\n", i, "c", C[i]); + fprintf(outfile, "SecA_%d%s %0.2lf\n", i, "d", D[i]); + } + + i = 1; + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "a", a[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "b", b[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "c", c[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "d", d[i]); + + i = 2; + fprintf(outfile, "SchdAI_%d%s %0.1lf\n", i, "a", a[i]); + fprintf(outfile, "SchdAI_%d%s %0.1lf\n", i, "b", b[i]); + fprintf(outfile, "SchdAI_%d%s %0.5lf\n", i, "c", c[i]); + fprintf(outfile, "SchdAI_%d%s %0.5lf\n", i, "d", d[i]); + + for(i = 3; i <= 9; i++){ + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "a", a[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "b", b[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "c", c[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "d", d[i]); + } + + i = 10; + fprintf(outfile, "SchdAI_%d%s %0.2lf = calculated: %0.2lf + additions: %0.2lf\n", i, "a", a[i], a[10] - a10add, a10add); + fprintf(outfile, "SchdAI_%d%s %0.2lf = calculated: %0.2lf + additions: %0.2lf\n", i, "b", b[i], b[10] - b10add, b10add); + fprintf(outfile, "SchdAI_%d%s %0.2lf = calculated: %0.2lf + additions: %0.2lf\n", i, "c", c[i], c[10] - c10add, c10add); + fprintf(outfile, "SchdAI_%d%s %0.2lf = calculated: %0.2lf + additions: %0.2lf\n", i, "d", d[i], d[10] - d10add, d10add); + + for(i = 11; i <= 13; i++){ + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "a", a[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "b", b[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "c", c[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "d", d[i]); + } + + fprintf(outfile, "%s %0.2lf\n", "L14aa", L14aa); + fprintf(outfile, "%s %0.2lf\n", "L14ab", L14ab); + fprintf(outfile, "%s %0.2lf\n", "L14ac", L14ac); + fprintf(outfile, "%s %0.2lf\n", "L14ad", L14ad); + fprintf(outfile, "%s %0.2lf\n", "L14ba", L14ba); + fprintf(outfile, "%s %0.2lf\n", "L14bb", L14bb); + fprintf(outfile, "%s %0.2lf\n", "L14bc", L14bc); + fprintf(outfile, "%s %0.2lf\n", "L14bd", L14bd); + fprintf(outfile, "%s %0.2lf\n", "L14ca", L14ca); + fprintf(outfile, "%s %0.2lf\n", "L14cb", L14cb); + fprintf(outfile, "%s %0.2lf\n", "L14cc", L14cc); + fprintf(outfile, "%s %0.2lf\n", "L14cd", L14cd); + fprintf(outfile, "%s %0.2lf\n", "L14da", L14da); + fprintf(outfile, "%s %0.2lf\n", "L14db", L14db); + fprintf(outfile, "%s %0.2lf\n", "L14dc", L14dc); + fprintf(outfile, "%s %0.2lf\n", "L14dd", L14dd); + fprintf(outfile, "%s %0.2lf\n", "L14ea", L14ea); + fprintf(outfile, "%s %0.2lf\n", "L14eb", L14eb); + fprintf(outfile, "%s %0.2lf\n", "L14ec", L14ec); + fprintf(outfile, "%s %0.2lf\n", "L14ed", L14ed); + + for(i = 15; i <= 23; i++){ + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "a", a[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "b", b[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "c", c[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "d", d[i]); + } + + for(i = 1; i <= 13; i++){ + if((i != 3) && (i != 4) && (i != 5) && (i != 7)) + fprintf(outfile, "WSII_%d%s %0.2lf\n", i, "a", A[i]); + fprintf(outfile, "WSII_%d%s %0.2lf\n", i, "b", B[i]); + fprintf(outfile, "WSII_%d%s %0.2lf\n", i, "c", C[i]); + if((i != 7) && (i != 9)) + fprintf(outfile, "WSII_%d%s %0.2lf\n", i, "d", D[i]); + } + fprintf(outfile, "WSII_%d %0.2lf %s\n", 14, A[0], "PENALTY"); + + if((A[8] == 0) && (B[8] == 0) && (C[8] == 0) && (D[8] == 0)) + fprintf(outfile, "As line 8 on WSII is zero for all payment periods, you don't owe a penalty.\n"); + else + fprintf(outfile, "%s\n%s\n%s\n", "There is an underpayment for one or more periods. See the instructions and if", "you have not already done so, enter the number of days any payment was late", "into the GUI so this program can calculate the penalty."); + } + + /*** + Summary of useful functions: + GetLine( "label", &variable ) - Looks for "label" in input file, and places the corresponding sum of + values following that label (until ";") into variable. + GetLineF( "label", &variable ) - Like GetLine() above, but also writes the result to the output file. + GetLineFnz(( "label", &variable ) - Like GetLine(), but only writes non-zero values to the output file. + GetLine1( "label", &variable ) - Like GetLine() above, but expects single value (no sum, no ";" in input file). + + c = SmallerOf( a, b ); - Selects smaller of two values. + c = LargerOf( a, b ); - Selects larger of two values. + c = NotLessThanZero( a ); - Selects positive value or zero. Prevents negative values. + + showline( j ) - Writes currency value of L[j] to output file with label in nice format. + shownum( j ) - Writes integer value of L[j] to output file with label in nice format. + showline_wmsg( j, "msg" ) - Like showline, but adds the provided message to the output line. + ShowLineNonZero( j ) - Like showline, but only writes non-zero values. + ShowLineNonZero_wMsg( j, "msg" ) - Like showline_wmsg, but only writes non-zero values. + showline_wlabel( "label", value ) - For custom line names and variables not in the default L[] array. + showline_wlabelnz( "label", value ) - Like showline_wlabel, but only writes non-zero values. + showline_wlabelmsg( "label", value, "msg" ) - Like showline_wlabel,but adds the provided message to the output line. + + ***/ + + fclose(infile); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + + printf("\nListing results from file: %s\n\n", outfname); + Display_File( outfname ); + + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_HSA_f8889.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_HSA_f8889.c new file mode 100755 index 0000000..535e1f4 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_HSA_f8889.c @@ -0,0 +1,171 @@ +/************************************************************************/ +/* TaxSolve_HSA_f8889.c - */ +/* Copyright (C) 2025 - A. Roberts */ +/* */ +/* Compile: */ +/* cc taxsolve_HSA_f8889.c -o ../bin/taxsolve_HSA_f8889 */ +/* */ +/* Documentation & Updates: */ +/* http://opentaxsolver.sourceforge.net/ */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ +/* */ +/* Updated/checked for 2024 tax year. */ +/************************************************************************/ + +float thisversion=22.00; + +#include +#include +#include +#include +#include + +#include "taxsolve_routines.c" +#define Yes 1 +#define No 0 + +/*----------------------------------------------------------------------------*/ + +int main( int argc, char *argv[] ) +{ + int i, j, k; + char word[4000], outfname[4000], *answ, *infname=0; + time_t now; + double L14a=0.0, L14b=0.0, L14c=0.0, L17b=0.0; + + printf("Form 8889 HSA, 2024 - v%3.2f\n", thisversion ); + + /* Decode any command-line arguments. */ + i = 1; k=1; + while (i < argc) + { + if (strcmp(argv[i],"-verbose")==0) { verbose = 1; } + else + if (k==1) + { + infname = strdup(argv[i]); + infile = fopen(infname,"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", infname ); exit(1);} + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname,infname); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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 L[13]) + fprintf(outfile,"Caution: Since L2 > L13, you may have to pay additional tax. See instructions.\n\n"); + + GetLineF( "L14a", &L14a ); + GetLineF( "L14b", &L14b ); + L14c = L14a - L14b; + showline_wlabel( "L14c", L14c ); + GetLineF( "L15", &L[15] ); + L[16] = NotLessThanZero( L14c - L[15] ); + showline_wmsg( 16, "Taxable HSA distributions. Include this on Sched-1 Line 8e on your 1040 Form." ); + + writeout_line = 0; /* Suppress GetLineF's from immediately writing to outfile. */ + answ = GetTextLineF( "L17a:" ); + next_word( answ, word, " \t;" ); + if (toupper( word[0] ) == 'Y') + fprintf(outfile,"Ck17a: X\n"); + writeout_line = 1; + + if (toupper( word[0] ) != 'Y') + { + L17b = 0.20 * L[16]; + showline_wlabel( "L17b", L17b ); + } + + GetLineF( "L18", &L[18] ); + GetLineF( "L19", &L[19] ); + L[20] = L[18] + L[19]; + showline_wmsg( 20, "Total income. Include this on Sched-1 Line 8z on your 1040 Form." ); + + L[21] = 0.10 * L[20]; + showline_wmsg( 21, "Additional tax. Include this on Sched-2 Line 17d on your 1040 Form." ); + + fclose(infile); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + + printf("\nListing results from file: %s\n\n", outfname); + Display_File( outfname ); + + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_MA_1_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_MA_1_2024.c new file mode 100755 index 0000000..1143da7 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_MA_1_2024.c @@ -0,0 +1,560 @@ +/************************************************************************/ +/* taxsolve_ma_1_2024.c - OpenTaxSolver for Mass Form 1 */ +/* Copyright (C) 2025 */ +/* */ +/* OTS Project Home Page and Updates: */ +/* http://opentaxsolver.sourceforge.com/ */ +/* */ +/* Compile: cc taxsolve_ma_1_2024.c -o taxsolve_ma_1_2024 */ +/* Run: ./taxsolve_ma_1_2024 Mass1_2024.txt */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ +/* */ +/* Robert Heller 2-10-2004 heller@deepsoft.com */ +/* Updated 1-26-05 Aston Roberts & Robert Heller */ +/* ... */ +/* Updated 1-16-2025 Aston Roberts */ +/************************************************************************/ + +#include +#include + +float thisversion=22.00; + +#include "taxsolve_routines.c" + +#define SINGLE 1 +#define MARRIED_FILING_JOINTLY 2 +#define MARRIED_FILING_SEPARAT 3 +#define HEAD_OF_HOUSEHOLD 4 +#define WIDOW 5 +#define Yes 1 +#define No 0 + + +double Sum( double *v, int start_slot, int end_slot ) +{ + int j; + double result = 0.0; + for (j=start_slot; j <= end_slot; j++) result += v[j]; + return result; +} + + +double ComputeTax(double taxableIncome) +{ double taxrate=0.05; /* Updated for 2024. */ + if (taxableIncome < 24000.0) + return (int)(taxrate * (taxableIncome + 25.0) + 0.5); + else + return taxableIncome * taxrate; +} + + +/*----------------------------------------------------------------------------*/ +/* --- Main --- */ +/*----------------------------------------------------------------------------*/ +int main( int argc, char *argv[] ) +{ + int i, j, k, status=0, i65, iblind, ndep, ndep12=0; + int flag, notaxstatus=0; + char word[4000], *infname=0, outfname[4000], *answ; + time_t now; + double Exemptions[10], L_a=0.0, L_b=0.0; + double AGI; + double Unemployment, Lottery; + double MassRetirement[2]; + double L6a=0.0, L6b=0.0; + double L23a_inc=0.0, L23a=0.0, L23b_inc=0.0, L23b=0.0, L28a=0.0, L28b=0.0, + L33[6], L35a=0.0, L35b=0.0, L38a=0.0, L38b=0.0, L38c=0.0; + double L43a=0.0, L43b=0.0; + + printf("Massachusetts Form-1 2024 - v%3.2f\n", thisversion); + + /* Decode any command-line arguments. */ + i = 1; k=1; + while (i < argc) + { + if (strcmp(argv[i],"-verbose")==0) { verbose = 1; } + else + if (k==1) + { + infname = strdup(argv[i]); + 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]); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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 0.0) + { + fprintf(outfile," 2bnum = %d Number of dependents\n", ndep ); + fprintf(outfile," 2b. = %6.2f %d x 1,000\n", Exemptions[1], ndep ); + } + + i65 = 0; iblind = 0; + get_parameter( infile, 's', word, "Age65You"); + get_parameter( infile, 'b', &flag, "Your age over 65?"); + if (flag) + { + i65++; + fprintf(outfile,"Check_2cyou X\n"); + } + get_parameter( infile, 's', word, "Age65Spouse"); + get_param_single_line( infile, 'b', &flag, "Spouse age over 65?"); + if (flag) + { + i65++; + fprintf(outfile,"Check_2csp X\n"); + } + Exemptions[2] = (double)i65 * 700.0; + if (Exemptions[2] > 0) + { + fprintf(outfile," 2cnum = %d Age 65 or over\n", i65 ); + fprintf(outfile," 2c. = %6.2f %d x 700\n", Exemptions[2], i65 ); + } + + get_parameter( infile, 's', word, "BlindYou"); + get_parameter( infile, 'b', &flag, "Your Blindness?"); + if (flag) + { + iblind++; + fprintf(outfile,"Check_2dyou X\n"); + } + get_parameter( infile, 's', word, "BlindSpouse"); + get_param_single_line( infile, 'b', &flag, "Spouse Blindness?"); + if (flag) + { + iblind++; + fprintf(outfile,"Check_2dsp X\n"); + } + Exemptions[3] = (double)iblind * 2200.0; + if (Exemptions[3] > 0) + { + fprintf(outfile," 2dnum = %d Blindness\n", iblind ); + fprintf(outfile," 2d. = %6.2f %d x 2,200\n", Exemptions[3], iblind ); + } + + GetLine( "Med/Dental", &(Exemptions[4]) ); + fprintf(outfile," 2e. = %6.2f\n", Exemptions[4] ); + + GetLine( "Adoption", &(Exemptions[5]) ); + fprintf(outfile," 2f. = %6.2f\n", Exemptions[5] ); + + L[2] = Sum( Exemptions, 0, 5 ); + fprintf(outfile," 2g. = %6.2f Total Exemptions\n", L[2] ); + + GetLine( "L3", &L[3] ); /* Wages, salery, tips (W-2). */ + showline(3); + + GetLine( "L4", &L[4] ); /* Taxable pensions. */ + ShowLineNonZero(4); + + GetLineF( "L5", &L[5] ); + + GetLineF( "L6a", &L6a ); + GetLineF( "L6b", &L6b ); + L[6] = L6a + L6b; + + GetLine( "L7", &L[7] ); /* Rental, royality, REMIC. */ + ShowLineNonZero(7); + + GetLineF( "L8a", &Unemployment ); /* Unemployment */ + GetLineF( "L8b", &Lottery ); /* Lottery */ + L[8] = Unemployment + Lottery; + if (L[8] > 0) + { + sprintf(word,"a. %6.2f + b. %6.2f", Unemployment, Lottery); + showline_wmsg( 8, word ); + } + + GetLine( "L9", &L[9] ); /* Other Income, Alimony received. */ + ShowLineNonZero(9); + + L[10] = Sum( L, 3, 9 ); + showline_wmsg( 10, "TOTAL 5.0% INCOME" ); + + /* Amount paid to SS, Medicare, RR, US, or Mass retirement */ + GetLine( "L11a", &MassRetirement[0] ); /* You */ + if (MassRetirement[0] > 2000) MassRetirement[0] = 2000; + showline_wlabel( "L11a", MassRetirement[0] ); + + GetLine( "L11b", &MassRetirement[1] ); /* Spouse */ + if (MassRetirement[1] > 2000) MassRetirement[1] = 2000; + showline_wlabel( "L11b", MassRetirement[1] ); + + L[11] = Sum(MassRetirement, 0, 1); + if (L[11] > 0) + { + sprintf(word,"you %6.2f + spouse %6.2f", MassRetirement[0], MassRetirement[1]); + showline_wmsg(11,word); + } + + GetLine( "L14a", &L[14] ); /* Rental Paid */ + showline_wlabel( "L14a", L[14] ); + L[14] = L[14] / 2.0; + if (status == MARRIED_FILING_SEPARAT) + L[14] = smallerof( L[14] , 2000.0 ); /* Updated for 2024. */ + else + L[14] = smallerof( L[14] , 4000.0 ); + ShowLineNonZero(14); + + GetLine( "L15", &L[15] ); /* Other Deductions (sched Y, L19) */ + ShowLineNonZero(15); + + L[16] = Sum( L, 11, 15 ); + showline_wmsg(16,"Total Deductions"); + + L[17] = NotLessThanZero( L[10] - L[16] ); + showline(17); + + L[18] = L[2]; + showline(18); + + L[19] = NotLessThanZero( L[17] - L[18] ); + showline(19); + + GetLine( "L20", &L[20] ); /* Interest and Dividends -- Sched B */ + L[20] = NotLessThanZero( L[20] ); + showline(20); + + L[21] = L[19] + L[20]; + showline_wmsg(21, "Total 5.0% Taxable Income"); + + L[22] = ComputeTax( L[21] ); + showline_wmsg(22,"5.0% Tax"); + + GetLineF( "L23a", &L23a_inc ); /* 8.5% income */ + if (L23a_inc > 0.0) + { + L23a = NotLessThanZero( L23a_inc * 0.085 ); + showline_wlabel( "L23a_inc", L23a_inc ); + showline_wlabel( "L23a", L23a ); + } + + GetLineF( "L23b", &L23b_inc ); /* 12% income */ + if (L23b_inc > 0.0) + { + L23b = NotLessThanZero( L23b_inc * 0.12 ); + showline_wlabel( "L23b_inc", L23b_inc ); + showline_wlabel( "L23b", L23b ); + } + + L[23] = L23a + L23b; + showline(23); + + GetLine( "L24", &L[24] ); /* Tax on long-term capital gains, sched D */ + ShowLineNonZero(24); + + GetLine( "L25", &L[25] ); /* Credit Capture amount Sch. H-2 */ + ShowLineNonZero(25); + + GetLine( "L26", &L[26] ); /* Additional tax on installment sale */ + ShowLineNonZero(26); + + L28a = Sum( L, 22, 26 ); + showline_wlabel( "L28a", L28a ); + + if (L[19] > 1053750.0) /* Updated for 2024. */ + { + L28b = 0.04 * (L[19] - 1053750.0); + showline_wlabel( "L28b", L28b ); + } + L[28] = L28a + L28b; + + if ((status == SINGLE) || (status == HEAD_OF_HOUSEHOLD) || (status == MARRIED_FILING_JOINTLY)) + { /* AGI Worksheet pg 12. */ + double ws[20], threshA, threshB; + for (j=0; j<20; j++) ws[j] = 0.0; + ws[1] = NotLessThanZero( L[10] ); + ws[2] = 0.0; /* Sched Y lines 1-10. Assumed zero, adjust otherwise. */ + ws[3] = NotLessThanZero( ws[1] - ws[2] ); + ws[5] = L[20]; + ws[6] = 0.0; /* Assumed zero. */ + ws[7] = ws[3] + ws[4] + ws[5] + ws[6]; + AGI = ws[7]; + for (j=1; j<=7; j++) + fprintf(outfile," AGI_Worksheet[%d] = %6.2f\n", j, ws[j] ); + fprintf(outfile," AGI = %6.2f\n", AGI ); + if (status != MARRIED_FILING_SEPARAT) + { /*not_sep*/ + switch (status) + { + case SINGLE: + threshA = 8000.0; /* Updated for 2024. */ + threshB = 14000.0; + break; + case HEAD_OF_HOUSEHOLD: + threshA = 14400.0 + 1000.0 * ndep; + threshB = 25200.0 + 1750.0 * ndep; + break; + case MARRIED_FILING_JOINTLY: + threshA = 16400.0 + 1000.0 * ndep; + threshB = 28700.0 + 1750.0 * ndep; + break; + default: fprintf(outfile,"Bad filing status.\n"); + printf("Bad filing status.\n"); exit(1); break; + } + if (AGI <= threshA) + { + notaxstatus = 1; + fprintf(outfile," (%6.2f <= %6.2f)\n", AGI, threshA ); + fprintf(outfile,"You qualify for No Tax Status.\n"); + } else + if (AGI <= threshB) + fprintf(outfile,"See Form 1 Line 29 special instructions for Limited Income.\n"); + } /*not_sep*/ +} + + if (notaxstatus) L[28] = 0.0; + showline_wmsg(28, "Total Income Tax"); + + GetLine1( "L29", &L[29] ); /* Limited Income Credit */ + GetLine1( "L30", &L[30] ); /* Income tax paid to another state or jurisdiction (from Schedule OJC). */ + GetLine1( "L31", &L[31] ); /* Other credits from Sch Z, line 14 */ + if (notaxstatus) { L[29] = 0.0; L[3] = 0.0; } + ShowLineNonZero(29); + ShowLineNonZero(30); + ShowLineNonZero(31); + + L[32] = NotLessThanZero( L[28] - (L[29] + L[30] + L[31]) ); + showline_wmsg(32,"Income Tax After Credits"); + + GetLine1( "L33a", &L33[0] ); /* Endangered Wildlife */ + if (L33[0] != 0) showline_wlabel( "L33a", L33[0] ); + GetLine1( "L33b", &L33[1] ); /* Organ Transplant */ + if (L33[1] != 0) showline_wlabel( "L33b", L33[1] ); + GetLine1( "L33c", &L33[2] ); /* Mass AIDS */ + if (L33[2] != 0) showline_wlabel( "L33c", L33[2] ); + GetLine1( "L33d", &L33[3] ); /* Mass US Olympic */ + if (L33[3] != 0) showline_wlabel( "L33d", L33[3] ); + GetLine1( "L33e", &L33[4] ); /* Mass Military Family Relief */ + if (L33[4] != 0) showline_wlabel( "L33e", L33[4] ); + GetLine1( "L33f", &L33[5] ); /* Homeless Animal Prevention And Care */ + if (L33[5] != 0) showline_wlabel( "L33f", L33[5] ); + L[33] = Sum( L33, 0, 5 ); + ShowLineNonZero( 33 ); + + GetLine1( "L34", &L[34] ); /* Use tax due on out-of-state purchases */ + showline(34); + + GetLine1( "L35a", &L35a ); /* Health Care Penalty (you) */ + showline_wlabel( "L35a", L35a ); + GetLine1( "L35b", &L35b ); /* Health Care Penalty (spouse) */ + showline_wlabel( "L35b", L35b ); + L[35] = L35a + L35b; + if (L[35] != 0) + showline_wmsg( 35, "Health Care penalty" ); + + GetLine1( "L36", &L[36] ); /* AMENDED RETURN ONLY. Overpayment from original return. */ + L[36] = NotLessThanZero( L[36] ); + ShowLineNonZero( 36 ); + + L[37] = Sum( L, 32, 36 ); + showline_wmsg(37,"Income Tax After Credits Contributions, Use Tax + HC Penalty"); + + /* Payments section. */ + + GetLineFnz( "L38a", &L38a ); /* Mass income tax withheld, Forms W-2 */ + GetLineFnz( "L38b", &L38b ); /* Mass income tax withheld, Forms 1099 */ + GetLineFnz( "L38c", &L38c ); /* Mass income tax withheld, Other forms. */ + L[38] = L38a + L38b + L38c; + ShowLineNonZero(38); + + GetLine( "L39", &L[39] ); /* Last year's overpayment you want applied to 2024 estimated tax */ + ShowLineNonZero(39); + + GetLine( "L40", &L[40] ); /* 2024 estimated tax payments */ + ShowLineNonZero(40); + + GetLine( "L41", &L[41] ); /* Payments made with extension */ + ShowLineNonZero(41); + + GetLine( "L42", &L[42] ); /* Payments w/original return. Use only if amending return. */ + ShowLineNonZero(42); + + GetLineF( "L43a", &L43a ); /* Earned income credit (EIC): Number of dependent children. */ + + GetLineF( "L43b", &L43b ); /* Earned income credit (EIC): amount from US Return */ + if (L43b != 0.0) + { + // fprintf(outfile, " L43b = %6.2f\n", L43b ); + fprintf(outfile, " L43c = \"0.40\"\n"); + } + L[43] = L43b * 0.40; + ShowLineNonZero(43); + + GetLine( "L44", &L[44] ); /* Senior Circuit Breaker Credit, sched CB */ + ShowLineNonZero(44); + + get_parameter( infile, 's', word, "L46num" ); /* Number of dependent household members under 13 or over 65. */ + get_parameters( infile, 'i', &ndep12, "L46num"); + fprintf(outfile,"L46num = %d\n", ndep12 ); + L[46] = ndep12 * 180.0; + ShowLineNonZero(46); + + GetLine( "L47", &L[47] ); /* Refundable credits, Sched CMS. */ + ShowLineNonZero(47); + + L[48] = Sum( L, 43, 47 ); + showline_wmsg( 48, "total refundable credits"); + + GetLine( "L49", &L[49] ); /* Excess Paid Family Leave withholding. */ + ShowLineNonZero(49); + + L[50] = Sum( L, 38, 42 ) + Sum( L, 48, 49 ); + showline_wmsg( 50, "total"); + + GetLine( "L52", &L[52] ); /* Overpayment to be applied to next year's estimated tax */ + + /* Refund or Owe section. */ + if (L[37] < L[50]) + { + L[51] = L[50] - L[37]; + fprintf(outfile,"L51 = %6.2f Overpayment!\n", L[51] ); + if (L[52] > L[51]) + L[52] = L[51]; + showline_wmsg( 52, "Overpayment to be applied to next year's estimated tax" ); + L[53] = L[51] - L[52]; + fprintf(outfile,"L53 = %6.2f THIS IS YOUR REFUND\n", L[53] ); + } + else + { + L[54] = L[37] - L[50]; + fprintf(outfile,"L54 = %6.2f TAX DUE !!!\n", L[54] ); + fprintf(outfile," (Which is %2.1f%% of your total tax.)\n", 100.0 * L[54] / (L[37] + 1e-9) ); + if ((L[54] > 400.0) && (L[50] < 0.80 * L[37])) + fprintf(outfile," You may owe Underpayment of Estimated Tax penalty.\n"); + } + + fprintf(outfile,"\n{ --------- }\n"); + GetTextLineF( "Your1stName:" ); + GetTextLineF( "YourInitial:" ); + GetTextLineF( "YourLastName:" ); + answ = GetTextLine( "YourSocSec#:" ); + format_socsec( answ , 1 ); + fprintf(outfile,"YourSocSec#: %s\n", answ ); + GetTextLineF( "Spouse1stName:" ); + GetTextLineF( "SpouseInitial:" ); + GetTextLineF( "SpouseLastName:" ); + answ = GetTextLine( "SpouseSocSec#:" ); + format_socsec( answ , 1 ); + fprintf(outfile,"SpouseSocSec#: %s\n", answ ); + GetTextLineF( "Number&Street:" ); + GetTextLineF( "Town:" ); + GetTextLineF( "State:" ); + GetTextLineF( "Zipcode:" ); + + GetTextLineF( "RoutingNum:" ); + GetTextLineF( "AccntNum:" ); + answ = GetTextLine( "AccountType:" ); + if (strcasecmp( answ, "Savings" ) == 0) + fprintf(outfile," Check_SavingsAccnt X\n"); + if (strcasecmp( answ, "Checking" ) == 0) + fprintf(outfile," Check_CheckingAccnt X\n"); + GetTextLineF( "Payment_Interest:" ); + GetTextLineF( "Payment_Penalty:" ); // Payment penalty you calculated. + GetTextLineF( "M2210_Amount:" ); // M-2210 amount. + check_if_yes( "Check_SelfEmployed:" ); // Yes, if Self-Employed. (answer: Yes, No, n/a) + check_if_yes( "Check_DORdiscuss:" ); // Yes, if you wish to discuss w/DOR. (answer: Yes, No, n/a) + check_if_yes( "Check_DoNotEfile:" ); // Yes, if you do not want preparer to e-file. (answer: Yes, No, n/a) + + fclose(infile); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + + printf("\nListing results from file: %s\n\n", outfname); + Display_File( outfname ); + printf("\nResults writen to file: %s\n", outfname); + + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_MI_1040_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_MI_1040_2024.c new file mode 100755 index 0000000..5467ef2 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_MI_1040_2024.c @@ -0,0 +1,362 @@ +/************************************************************************ + TaxSolve_MI_1040_2024.c - Michigan 2024 MI-1040 State Taxes. + Copyright (C) 2025 - C. Kindman + + GNU Public License - GPL: + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. + + 2-4-2025 http://opentaxsolver.sourceforge.com/ + + ************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include "taxsolve_routines.c" + +float thisversion=1.01; + +#define SINGLE 1 +#define MARRIED_FILING_JOINTLY 2 +#define MARRIED_FILING_SEPARAT 3 +#define Yes 1 +#define No 0 + +double flat_tax_rate = 0.0425; /* Updated for 2024. */ + + +/* ------------------- Main -------------------------------------- */ +int main( int argc, char *argv[] ) +{ + int j, jj, k, status; + char word[1000], *infname=0, outfname[1000], *socsec, socsectmp[500], labelx[1000]; + time_t now; + int residency=0, L9a=0, L9b=0, L9c=0, L9d=0, L9e=0; + double L9aa=0.0, L9bb=0.0, L9cc=0.0, L9dd=0.0, L9ee=0.0, L18a=0.0, L19a=0.0, L27a=0.0; + double interest=0.0, penalty=0.0; + + /*-----------------------------------------*/ + /* --- Decode any command line options. -- */ + /*-----------------------------------------*/ + printf("MI-1040 2024 - v%3.2f\n", thisversion); + jj = 1; k=1; + while (jj < argc) + { + if (strcmp(argv[jj],"-verbose")==0) { verbose = 1; } + else + if (strcmp(argv[jj],"-round_to_whole_dollars")==0) { round_to_whole_dollars = 1; } + else + if (k==1) + { + infname = strdup(argv[jj]); + infile = fopen(argv[jj],"r"); + if (infile==0) + { + printf("ERROR: Parameter file '%s' could not be opened.\n", argv[jj]); + fprintf(outfile,"ERROR: Parameter file '%s' could not be opened.\n", argv[jj]); + exit(1); + } + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname,argv[jj]); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + outfile = fopen(outfname,"w"); + if (outfile==0) + { + printf("ERROR: Output file '%s' could not be opened.\n", outfname); + fprintf(outfile,"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[jj]); + fprintf(outfile,"Unknown command-line parameter '%s'\n", argv[jj]); + exit(1); + } + jj++; + } + + if (infile==0) + { + printf("Error: No input file on command line.\n"); + fprintf(outfile,"Error: No input file on command line.\n"); + exit(1); + } + + + /*--------------------------*/ + /* ---- Get Input Data ---- */ + /*--------------------------*/ + + /* Pre-initialize all lines to zeros. */ + for (j = 0; j < MAX_LINES; j++) { L[j] = 0.0; } + + /* Accept parameters from input file. */ + /* Expect D-400 lines, something like: + Title: MI-1040 1999 Return + L6 34900.0 {Wages} + */ + + /* Accept Form's "Title" line, and put out with date-stamp for your records. */ + read_line( infile, word ); + now = time(0); + fprintf(outfile,"\n%s, v%2.2f, %s\n", word, thisversion, ctime( &now )); + check_form_version( word, "Title: MI-1040" ); + + get_parameter( infile, 's', word, "Status"); /* 1=single, 2=married/joint, 3=married/separate/ */ + get_parameter( infile, 'l', word, "Status ?"); + if ((word[0]>'0') && (word[0]<'6')) status = word[0]-48; else + if (strncasecmp(word,"Single",4)==0) status = SINGLE; else + if (strncasecmp(word,"Married/Joint",13)==0) status = MARRIED_FILING_JOINTLY; else + if (strncasecmp(word,"Married/Sep",11)==0) status = MARRIED_FILING_SEPARAT; + else + { + printf("Error: unrecognized status '%s'. Must be: Single, Married/joint, Married/sep/\nExiting.\n", word); + fprintf(outfile,"Error: unrecognized status '%s'. Must be: Single, Married/joint, Married/sep.\nExiting.\n", word); + exit(1); + } + fprintf(outfile,"Status = %s (%d)\n", word, status); + + + check_if_yes( "CkFarmFish" ); + + // ResidencyStatus Resident { (answer: Resident, Nonresident, PartYear ) } + GetLineString( "ResidencyStatus", word ); + if (strcasecmp( word, "Resident" ) == 0) + residency = 1; + else + if (strcasecmp( word, "Nonresident" ) == 0) + residency = 2; + else + if (strcasecmp( word, "PartYear" ) == 0) + residency = 3; + +printf("Residency = %d, word = '%s'\n", residency, word ); + + GetInteger( "L9a", &L9a ); /* Number of exemptions. */ +printf("L9a = %d\n", L9a ); + GetInteger( "L9b", &L9b ); /* */ +printf("L9b = %d\n", L9b ); + GetInteger( "L9c", &L9c ); /* */ +printf("L9c = %d\n", L9c ); + GetInteger( "L9d", &L9d ); /* */ + GetInteger( "L9e", &L9e ); /* Claimed as dependent */ + + GetLine( "L10", &L[10] ); /* Adjusted Gross Income from your U.S. Form 1040 */ + GetLine( "L11", &L[11] ); /* Additions from Schedule 1, line 9. */ + GetLine( "L13", &L[13] ); /* Subtractions from Schedule 1, line 31.*/ + GetLine( "L15", &L[15] ); /* Exemption allowance. Enter amount from line 9f or Schedule NR, line 19. */ + + GetLine( "L18a", &L18a ); + GetLine( "L18b", &L[18] ); + GetLine( "L19a", &L19a ); + GetLine( "L19b", &L[19] ); + + GetLine( "L21", &L[21] ); + GetLine( "L22", &L[22] ); + GetLine( "L23", &L[23] ); + + GetLine( "L25", &L[25] ); + GetLine( "L26", &L[26] ); + GetLine( "L27a", &L27a ); + + GetLine( "L28", &L[28] ); + GetLine( "L29", &L[29] ); + GetLine( "L30", &L[30] ); + GetLine( "L31", &L[31] ); + + check_if_yes( "Ck32a" ); + check_if_yes( "Ck32b" ); + GetLine( "L32c", &L[32] ); + + GetLine( "Interest", &interest ); + GetLine( "Penalty", &penalty ); + GetLine( "L36", &L[36] ); + + + /*-------------------------------*/ + /* ---- Do Tax Calculations ---- */ + /*-------------------------------*/ + + L9aa = 5600.0 * L9a; + L9bb = 3300.0 * L9b; + L9cc = 500.0 * L9c; + L9dd = 5600.0 * L9d; + L9ee = 1500.0 * L9e; + L[9] = L9aa + L9bb + L9cc + L9dd + L9ee; + L[12] = L[10] + L[11]; + L[14] = NotLessThanZero( L[12] - L[13] ); + L[16] = NotLessThanZero( L[14] - L[15] ); + L[17] = flat_tax_rate * L[16]; + L[20] = NotLessThanZero( L[17] - L[18] - L[19] ); + L[24] = L[20] + L[21] + L[22] + L[23]; + L[27] = 0.30 * L27a; + + for (j=25; j <= 32; j++) + L[33] = L[33] + L[j]; + + if (L[33] < L[24]) + { /*Owe*/ + L[34] = L[24] - L[33] + interest + penalty; + + } /*Owe*/ + else + { /*Refund*/ + L[35] = L[33] - L[24]; + L[37] = L[35] - L[36]; + + } /*Refund*/ + + + /*-------------------------*/ + /* ---- Print Results ---- */ + /*-------------------------*/ + + showline_wlabelnz( "L9a", L9a ); + showline_wlabelnz( "L9aa", L9aa ); + + showline_wlabelnz( "L9b", L9b ); + showline_wlabelnz( "L9bb", L9bb ); + + showline_wlabelnz( "L9c", L9c ); + showline_wlabelnz( "L9cc", L9cc ); + + showline_wlabelnz( "L9d", L9d ); + showline_wlabelnz( "L9dd", L9dd ); + + showline_wlabelnz( "L9e", L9e ); + showline_wlabelnz( "L9ee", L9ee ); + + showline(9); /* */ + showline(10); /* */ + showline(11); /* */ + showline(12); /* */ + showline(13); /* */ + showline_wmsg(14, "Income subject to tax." ); /* Income subject to tax. */ + showline(15); /* */ + showline_wmsg(16, "Taxable income." ); /* */ + showline_wmsg(17, "Tax." ); /* */ + + showline_wlabelnz( "L18a", L18a ); + showline_wlabelnz( "L18b", L[18] ); + + showline_wlabelnz( "L19a", L19a ); + showline_wlabelnz( "L19b", L[19] ); + + for (j=20; j <= 26; j++) + showline(j); + + showline_wlabelnz( "L27a", L27a ); + + for (j=27; j <= 33; j++) + showline(j); + + showline_wlabelnz( "interest", interest ); + showline_wlabelnz( "penalty", penalty ); + ShowLineNonZero_wMsg( 34, "You OWE." ); + showline(35); + showline(36); + ShowLineNonZero_wMsg( 37, "REFUND." ); + + + + fprintf(outfile,"\n{ --------- }\n"); + GetTextLineF( "Your1stName:" ); + GetTextLineF( "YourInitial:" ); + GetTextLineF( "YourLastName:" ); + + writeout_line = 0; + socsec = GetTextLineF( "YourSocSec#:" ); + strcpy( socsectmp, socsec ); /* Copy to buffer, since formatting could add 2-chars. */ + format_socsec( socsectmp, 0 ); + fprintf(outfile,"YourSocSec#: %s\n", socsectmp ); + free( socsec ); + writeout_line = 1; + + GetTextLineF( "Spouse1stName:" ); + GetTextLineF( "SpouseInitial:" ); + GetTextLineF( "SpouseLastName:" ); + writeout_line = 0; + socsec = GetTextLineF( "SpouseSocSec#:" ); + strcpy( socsectmp, socsec ); /* Copy to buffer, since formatting could add 2-chars. */ + format_socsec( socsectmp, 0 ); + fprintf(outfile,"SpouseSocSec#: %s\n", socsectmp ); + free( socsec ); + writeout_line = 1; + + GetTextLineF( "Number&Street:" ); + GetTextLineF( "Town:" ); + GetTextLineF( "State:" ); + GetTextLineF( "Zipcode:" ); + + GetTextLineF( "SchoolDist:" ); + + switch (residency) + { + case 1: fprintf(outfile,"CkResident X\n"); break; + case 2: fprintf(outfile,"CkNonRes X\n"); break; + case 3: fprintf(outfile,"CkPartyear X\n"); break; + } + + get_word(infile, labelx ); /* Look for optional fields. */ + read_comment_filtered_line( infile, word, 512 ); + fprintf(outfile,"%s \"%s\"\n", labelx, word ); + get_word(infile, labelx ); /* Look for optional fields. */ + read_comment_filtered_line( infile, word, 512 ); + fprintf(outfile,"%s \"%s\"\n", labelx, word ); + check_if_yes( "CkChecking" ); + check_if_yes( "CkSavings" ); + + fclose(infile); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + Display_File( outfname ); + printf("\nResults written to file '%s'\n", outfname); + return 0; +} + + + + +/*** Summary of useful functions: + + GetLine( "label", &variable ) - Looks for "label" in input file, and places the corresponding sum of + values following that label (until ";") into variable. + GetLineF( "label", &variable ) - Like GetLine() above, but also writes the result to the output file. + GetLineFnz(( "label", &variable ) - Like GetLine(), but only writes non-zero values to the output file. + GetLine1( "label", &variable ) - Like GetLine() above, but expects single value (no sum, no ";" in input file). + + c = SmallerOf( a, b ); - Selects smaller of two values. + c = LargerOf( a, b ); - Selects larger of two values. + c = NotLessThanZero( a ); - Selects positive value or zero. Prevents negative values. + + showline( j ) - Writes currency value of L[j] to output file with label in nice format. + shownum( j ) - Writes integer value of L[j] to output file with label in nice format. + showline_wmsg( j, "msg" ) - Like showline, but adds the provided message to the output line. + ShowLineNonZero( j ) - Like showline, but only writes non-zero values. + ShowLineNonZero_wMsg( j, "msg" ) - Like showline_wmsg, but only writes non-zero values. + showline_wlabel( "label", value ) - For custom line names and variables not in the default L[] array. + showline_wlabelnz( "label", value ) - Like showline_wlabel, but only writes non-zero values. + showline_wlabelmsg( "label", value, "msg" ) - Like showline_wlabel,but adds the provided message to the output line. +***/ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_NC_D400_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_NC_D400_2024.c new file mode 100755 index 0000000..d3a0940 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_NC_D400_2024.c @@ -0,0 +1,483 @@ +/************************************************************************/ +/* TaxSolve_NC_D400_2024.c - North Carolina 2024 NC-DC400 State Taxes. */ +/* Copyright (C) 2025 - S.Jenkins */ +/* */ +/* Compile: gcc taxsolve_NC_D400_2024.c -o taxsolve_NC_D400_2024 */ +/* Run: ./taxsolve_NC_D400_2024 */ +/* Uses log from TaxSolve Federal 1040. */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ +/* */ +/* 1-2-2025 http://opentaxsolver.sourceforge.com/ */ +/* Earlier versions - Lincoln Baxter (lab@lincolnbaxter.com) */ +/* */ +/************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include "taxsolve_routines.c" + +float thisversion=22.00; + +#define SINGLE 1 +#define MARRIED_FILING_JOINTLY 2 +#define MARRIED_FILING_SEPARAT 3 +#define HEAD_OF_HOUSEHOLD 4 +#define WIDOW 5 +#define Yes 1 +#define No 0 + +double flat_tax_rate = 0.045; /* Updated for 2024. */ + + +struct FedReturnData + { + double fedline[MAX_LINES]; + int Itemized, Limited, Limited_L6; + double Sched_A[MAX_LINES]; + }; + + +void convert_slashes( char *fname ) +{ /* Convert slashes in file name based on OS type. */ + char *ptr; + #ifdef __MINGW32__ + char slash_sreach='/', slash_replace='\\'; + #else + char slash_sreach='\\', slash_replace='/'; + #endif + + ptr = strchr( fname, slash_sreach ); + while (ptr) + { + ptr[0] = slash_replace; + ptr = strchr( fname, slash_sreach ); + } +} + + +void ImportFederalReturnData( char *fedlogfile, struct FedReturnData *fed_data ) +{ + FILE *infile; + char fline[1000], word[1000]; + int linenum; + + convert_slashes( fedlogfile ); + infile = fopen(fedlogfile, "r"); + if (infile==0) + { + printf("Error: Could not open federal return '%s'\n", fedlogfile); + fprintf(outfile,"\nError: Could not open federal return '%s'\n", fedlogfile); + #ifdef __MINGW32__ + system("dir"); + #else + system("pwd"); + system("ls -l"); + #endif + exit(1); + } + printf(" Reading file: %s\n", fedlogfile ); + + /* Set initial default values. */ + fed_data->Itemized = 1; + fed_data->Limited = 1; + fed_data->Limited_L6 = 1; + for (linenum=0; linenumfedline[linenum] = 0.0; + for (linenum=0; linenumSched_A[linenum] = 0.0; + + read_line(infile,fline); linenum = 0; + while (!feof(infile)) + { + if ( verbose ) printf( "Read Line: %s" ,fline ); + if (strstr(fline,"Use standard deduction.")!=0) fed_data->Itemized = 0; + if (strstr(fline,"Deductions not limited")!=0) + { + fed_data->Limited = 0; + if ( strstr(fline,"line 6") ) fed_data->Limited_L6 = 0; + } + next_word(fline, word, " \t="); + if ((strstr(word,"A")==word) && (isdigit(word[1])) && (strstr(fline," = ")!=0)) + { + if (sscanf(&word[1],"%d",&linenum)!=1) printf("Error: Reading fed sched-A line number '%s%s'\n",word,fline); + next_word(fline, word, " ="); + if (sscanf(word,"%lf", &fed_data->Sched_A[linenum])!=1) printf("Error: Reading fed sched-A line %d '%s%s'\n",linenum,word,fline); + if (verbose) printf("Sched_A[%d] = %2.2f\n", linenum, fed_data->Sched_A[linenum]); + } + if ((strstr(word,"L")==word) && (strstr(fline," = ")!=0)) + { + if (sscanf(&word[1],"%d",&linenum)!=1) printf("Error: Reading fed line number '%s%s'\n",word,fline); + next_word(fline, word, " ="); + if (sscanf(word,"%lf", &fed_data->fedline[linenum])!=1) printf("Error: Reading fed line %d '%s%s'\n",linenum,word,fline); + if (verbose) printf("FedLin[%d] = %2.2f\n", linenum, fed_data->fedline[linenum]); + } + read_line(infile,fline); + } + fclose(infile); +} + + +/* ------------------------------------------------------------------------------------ */ +/* --- Main --- */ +/* ------------------------------------------------------------------------------------ */ +int main( int argc, char *argv[] ) +{ + int j, jj, k, status; + char word[1000], *infname=0, outfname[1000], *socsec, socsectmp[100]; + time_t now; + struct FedReturnData fed_data; + double stdded, min_payment=0.0, min2file, ChildDeduction=0.0; + int L10a=0; + double L12a=0.0, L20a=0.0, L20b=0.0, L21a=0.0, L21b=0.0, L21c=0.0, L21d=0.0; + + /*-----------------------------------------*/ + /* --- Decode any command line options. -- */ + /*-----------------------------------------*/ + printf("NC D400 2024 - v%3.2f\n", thisversion); + jj = 1; k=1; + while (jj < argc) + { + if (strcmp(argv[jj],"-verbose")==0) { verbose = 1; } + else + if (strcmp(argv[jj],"-round_to_whole_dollars")==0) { round_to_whole_dollars = 1; } + else + if (k==1) + { + infname = strdup(argv[jj]); + infile = fopen(argv[jj],"r"); + if (infile==0) + { + printf("ERROR: Parameter file '%s' could not be opened.\n", argv[jj]); + fprintf(outfile,"ERROR: Parameter file '%s' could not be opened.\n", argv[jj]); + exit(1); + } + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname,argv[jj]); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + outfile = fopen(outfname,"w"); + if (outfile==0) + { + printf("ERROR: Output file '%s' could not be opened.\n", outfname); + fprintf(outfile,"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[jj]); + fprintf(outfile,"Unknown command-line parameter '%s'\n", argv[jj]); + exit(1); + } + jj++; + } + + if (infile==0) + { + printf("Error: No input file on command line.\n"); + fprintf(outfile,"Error: No input file on command line.\n"); + exit(1); + } + + + /*--------------------------*/ + /* ---- Get Input Data ---- */ + /*--------------------------*/ + + /* Pre-initialize all lines to zeros. */ + for (j = 0; j < MAX_LINES; j++) { L[j] = 0.0; } + + /* Accept parameters from input file. */ + /* Expect D-400 lines, something like: + Title: NC-400 1999 Return + L6 34900.0 {Wages} + */ + + /* Accept Form's "Title" line, and put out with date-stamp for your records. */ + read_line( infile, word ); + now = time(0); + fprintf(outfile,"\n%s, v%2.2f, %s\n", word, thisversion, ctime( &now )); + check_form_version( word, "Title: NC State Tax Form 400 for 2024" ); + + /* get_parameter(infile, kind, x, emssg ) */ + get_parameter( infile, 's', word, "FedReturn" ); /* File name of Federal Return log file. */ + if ( verbose ) printf( "word: %s\n", word ); + get_word( infile, word ); + ImportFederalReturnData( word, &fed_data); + + get_parameter( infile, 's', word, "Status"); /* 1=single, 2=married/joint, 3=married/separate, 4=house-head, 5=widow */ + get_parameter( infile, 'l', word, "Status ?"); + if ((word[0]>'0') && (word[0]<'6')) status = word[0]-48; else + if (strncasecmp(word,"Single",4)==0) status = SINGLE; else + if (strncasecmp(word,"Married/Joint",13)==0) status = MARRIED_FILING_JOINTLY; else + if (strncasecmp(word,"Married/Sep",11)==0) status = MARRIED_FILING_SEPARAT; else + if (strncasecmp(word,"Head_of_House",4)==0) status = HEAD_OF_HOUSEHOLD; else + if (strncasecmp(word,"Widow",4)==0) status = WIDOW; + 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); + } + fprintf(outfile,"Status = %s (%d)\n", word, status); + + GetLine( "L7", &L[7] ); /* Additions to Fed AGI - From Sched-S Part A, Line 6. */ + GetLine( "L9", &L[9] ); /* Deductions from Fed AGI - From Sched-S Part B, Line 14. */ + + GetInteger( "L10a", &L10a ); /* Number of Dependents. */ + + GetLine( "L11", &L[11] ); /* Enter 0 to use Std Deduction; Otherwise Itemized Ded. from Sched-S part C, Line 23. */ + GetLine( "L13", &L[13] ); /* Enter 1.0 for full-year residents. Otherwise amount from Sched-S part D, Line 26. */ + GetLine( "L16", &L[16] ); /* Tax credits. (D-400TC part 3 line 20) */ + GetLine( "L18", &L[18] ); /* Consumer Use Tax. (pgs 9+10) */ + GetLine( "L20a", &L20a ); /* North Carolina Income Tax Withheld (yours) */ + GetLine( "L20b", &L20b ); /* North Carolina Income Tax Withheld (spouses) */ + L[20] = L20a + L20b; + GetLine( "L21a", &L21a ); /* Other tax payments. 2024 Estimated Tax. */ + GetLine( "L21b", &L21b ); /* Other tax payments. Paid with Extension. */ + GetLine( "L21c", &L21c ); /* Other tax payments. Partnership. */ + GetLine( "L21d", &L21d ); /* Other tax payments. S Corporation. */ + + + + /*-------------------------------*/ + /* ---- Do Tax Calculations ---- */ + /*-------------------------------*/ + + L[6] = fed_data.fedline[11]; /* Taxable income from Fed1040 Line 11, AGI. */ + L[6] = Conditional_Round( L[6] ); + + switch (status) + { /* Updated for 2024. */ + case SINGLE: stdded = 12750.0; /* NC std single deduction. */ + min2file = 12750.0; + break; + case MARRIED_FILING_JOINTLY: stdded = 25500.0; /* NC std Married/joint deduction. */ + min2file = 25500.0; + break; + case WIDOW: stdded = 25500.0; /* NC std widow(er) deduction. */ + min2file = 25500.0; + break; + case MARRIED_FILING_SEPARAT: stdded = 12750.0; /* NC std Married/sep deduction. */ + min2file = 12750.0; + break; + case HEAD_OF_HOUSEHOLD: stdded = 19125.0; /* NC std Head of house deduction. */ + min2file = 19125.0; + break; + default: + stdded = 0; printf("Unknown status\n"); fprintf(outfile,"Unknown status\n"); + exit(1); + } + + if (L[6] <= min2file) + fprintf(outfile, "You may not need to file NC tax return, due to your income.\n"); + + L[8] = L[6] + L[7]; + + switch (status) + { /* Child Deduction Table. */ /* Updated for 2024. */ + case MARRIED_FILING_JOINTLY: + case WIDOW: + if (L[6] <= 40000.0) ChildDeduction = 3000.0; else + if (L[6] <= 60000.0) ChildDeduction = 2500.0; else + if (L[6] <= 80000.0) ChildDeduction = 2000.0; else + if (L[6] <= 100000.0) ChildDeduction = 1500.0; else + if (L[6] <= 120000.0) ChildDeduction = 1000.0; else + if (L[6] <= 140000.0) ChildDeduction = 500.0; else + ChildDeduction = 0.0; + break; + case HEAD_OF_HOUSEHOLD: + if (L[6] <= 30000.0) ChildDeduction = 3000.0; else + if (L[6] <= 45000.0) ChildDeduction = 2500.0; else + if (L[6] <= 60000.0) ChildDeduction = 2000.0; else + if (L[6] <= 75000.0) ChildDeduction = 1500.0; else + if (L[6] <= 90000.0) ChildDeduction = 1000.0; else + if (L[6] <= 105000.0) ChildDeduction = 500.0; else + ChildDeduction = 0.0; + break; + case SINGLE: case MARRIED_FILING_SEPARAT: + if (L[6] <= 20000.0) ChildDeduction = 3000.0; else + if (L[6] <= 30000.0) ChildDeduction = 2500.0; else + if (L[6] <= 40000.0) ChildDeduction = 2000.0; else + if (L[6] <= 500000.0) ChildDeduction = 1500.0; else + if (L[6] <= 60000.0) ChildDeduction = 1000.0; else + if (L[6] <= 70000.0) ChildDeduction = 500.0; else + ChildDeduction = 0.0; + break; + default: ChildDeduction = 0.0; + } + L[10] = (double)L10a * ChildDeduction; + + if (L[11] < stdded) + L[11] = stdded; + + L12a = L[9] + L[10] + L[11]; + + L[12] = L[8] - L12a; + + L[14] = L[13] * L[12]; /* NC Taxable Income. */ + + L[15] = flat_tax_rate * L[14]; /* NC Income Tax. */ + L[15] = Conditional_Round( L[15] ); + + L[17] = L[15] - L[16]; + + /* Calculate USE tax, if not entered on L18 + * based on Use Tax Worksheet on page 9. + * Estimate as: 0.000675 * L[14] + * If you made purchases greater that $1000 that need + * to be reported, or taxes paid to another state, then + * fill out the Work Sheet in the instructions and enter + * the amount on L18 in data file. + */ + + printf( "Assuming you have calculated your USE tax (%2.2f) according to instructions pg 9\n", L[18] ); + + L[19] = L[17] + L[18]; + + L[21] = L21a + L21b + L21c + L21d; + + L[23] = L[20] + L[21] + L[22]; + + L[25] = L[23] - L[24]; + + if (L[19] > L[25]) + { + L[26] = L[19] - L[25]; /* You OWE */ + printf(" (Which is %2.1f%% of the total amount owed.)\n", 100.0 * L[26] / (L[19] + 1e-9) ); + + /* Check for under payment see form D422 Part I */ + min_payment = 0.9 * L[19]; /* Estimate min required tax payments, form D422 Part I */ + if ((L[23] < min_payment) && (L[19] > 1000.00)) + { + /* We would calculate penalty here... */ + printf("WARNING: Possible underpayment of est. taxes penalty. Calculation not performed.\n"); + } + L[27] = L[26]; /* Assumes no penalties. */ + } + else + { + L[28] = L[25] - L[19]; + L[33] = L[29] + L[30] + L[31] + L[32]; + L[34] = L[28] - L[33]; /* REFUND */ + } + + + /*-------------------------*/ + /* ---- Print Results ---- */ + /*-------------------------*/ + + showline(6); /* Taxable fed income */ + showline(7); /* Additions to fed income */ + showline(8); + showline(9); /* Deductions */ + if (L10a > 0) + fprintf(outfile, "L10a %d\n", L10a ); + showline(10); + showline(11); + if (L[11] <= stdded) + fprintf(outfile," Check_UsedStdDed: X\n"); + else + fprintf(outfile," Check_ItemizedDed: X\n"); + showline_wlabel( "L12a", L12a ); + showline(12); + if (L[13] < 1.0) showline(13); /* Part-yr */ + showline_wmsg(14, "North Carolina Taxable Income"); + showline_wmsg(15, "North Carolina Income Tax"); + showline(16); + showline(17); + if (L[18] == 0.0) + fprintf(outfile,"Check_NoUseTax X\n"); + showline(18); + showline(19); + showline_wlabel( "L20a", L20a ); + showline_wlabel( "L20b", L20b ); + showline_wlabelmsg( "L20", L[20], "North Carolina Tax Withheld"); + showline_wlabel( "L21a", L21a ); + showline_wlabel( "L21b", L21b ); + showline_wlabel( "L21c", L21c ); + showline_wlabel( "L21d", L21d ); + showline(22); + showline(23); + showline(25); + if (L[19] > L[25]) + { + showline_wlabelmsg( "L26a", L[26], "TAX DUE" ); + showline_wmsg( 27, "Pay this amount" ); + fprintf(outfile," (Which is %2.1f%% of your total tax.)\n", 100.0 * L[26] / (L[19] + 1e-9) ); + if ((L[23] < min_payment) && (L[19] > 1000.00)) + { + fprintf(outfile," You may owe underpayment interest and penalties.\n"); + fprintf(outfile," See page 6+7 instructions to calculate them according to your situation.\n"); + } + } + else + { + showline_wmsg(28, "OVERPAYMENT"); + showline(29); + showline(30); + showline(31); + showline(32); + showline(33); + showline(34); + } + + do_all_caps = 1; + fprintf(outfile,"\n{ --------- }\n"); + GetTextLineF( "Your1stName:" ); + GetTextLineF( "YourInitial:" ); + GetTextLineF( "YourLastName:" ); + + writeout_line = 0; + socsec = GetTextLineF( "YourSocSec#:" ); + strcpy( socsectmp, socsec ); /* Copy to buffer, since formatting could add 2-chars. */ + format_socsec( socsectmp, 0 ); + fprintf(outfile,"YourSocSec#: %s\n", socsectmp ); + free( socsec ); + writeout_line = 1; + + GetTextLineF( "Spouse1stName:" ); + GetTextLineF( "SpouseInitial:" ); + GetTextLineF( "SpouseLastName:" ); + writeout_line = 0; + socsec = GetTextLineF( "SpouseSocSec#:" ); + strcpy( socsectmp, socsec ); /* Copy to buffer, since formatting could add 2-chars. */ + format_socsec( socsectmp, 0 ); + fprintf(outfile,"SpouseSocSec#: %s\n", socsectmp ); + free( socsec ); + writeout_line = 1; + + GetTextLineF( "Number&Street:" ); + GetTextLineF( "Apt#:" ); + GetTextLineF( "Town:" ); + GetTextLineF( "State:" ); + GetTextLineF( "Zipcode:" ); + + fclose(infile); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + Display_File( outfname ); + printf("\nResults written to file '%s'\n", outfname); + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_NJ_1040_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_NJ_1040_2024.c new file mode 100755 index 0000000..57ee62c --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_NJ_1040_2024.c @@ -0,0 +1,688 @@ +/************************************************************************/ +/* TaxSolve_NJ_1040_2024.c - */ +/* Copyright (C) 2025 - Aston Roberts */ +/* */ +/* Compile: gcc taxsolve_NJ_1040_2024.c -o taxsolve_NJ_1040_2024 */ +/* Run: ./taxsolve_NJ_1040_2024 NJ_1040_2024.txt */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ +/* */ +/* Aston Roberts 1-3-2025 aston_roberts@yahoo.com */ +/************************************************************************/ + +float thisversion=22.00; + +#include +#include + +#include "taxsolve_routines.c" + +double COJ[MAX_LINES], S[MAX_LINES], F[MAX_LINES]; + +#define SINGLE 1 +#define MARRIED_FILING_JOINTLY 2 +#define MARRIED_FILING_SEPARAT 3 +#define HEAD_OF_HOUSEHOLD 4 +#define WIDOW 5 + + +double TaxRateFormula( double x, int status ) /* Checked/Updated for 2024. */ +{ + if ((status==SINGLE) || (status==MARRIED_FILING_SEPARAT)) /* Single, Married/sep */ + { + if (x < 20000.0) return x * 0.014; else + if (x < 35000.0) return x * 0.0175 - 70.0; else + if (x < 40000.0) return x * 0.035 - 682.5; else + if (x < 75000.0) return x * 0.05525 - 1492.5; else + if (x < 500000.0) return x * 0.0637 - 2126.25; else + if (x < 1000000.0) return x * 0.0897 - 15126.25; + else return x * 0.1075 - 32926.25; + } + else + if ((status==MARRIED_FILING_JOINTLY) || (status==HEAD_OF_HOUSEHOLD) || (status==WIDOW)) + { /* Married/Joint, HouseHead, widower. */ + if (x < 20000.0) return x * 0.014; else + if (x < 50000.0) return x * 0.0175 - 70.0; else + if (x < 70000.0) return x * 0.0245 - 420.0; else + if (x < 80000.0) return x * 0.035 - 1154.5; else + if (x < 150000.0) return x * 0.05525 - 2775.0; else + if (x < 500000.0) return x * 0.0637 - 4042.5; else + if (x < 1000000.0) return x * 0.0897 - 17042.5; + else return x * 0.1075 - 34842.5; + } + else { printf("Status not covered.\n"); exit(1); } +} + + +void Report_bracket_info( double x, int status ) +{ + double tx, rate; + tx = TaxRateFormula( x, status ); + if ((status==SINGLE) || (status==MARRIED_FILING_SEPARAT)) /* Single, Married/sep */ + { + if (x < 20000.0) rate = 0.014; else + if (x < 35000.0) rate = 0.0175; else + if (x < 40000.0) rate = 0.035; else + if (x < 75000.0) rate = 0.05525; else + if (x < 500000.0) rate = 0.0637; else + if (x < 1000000.0) rate = 0.0897; + else rate = 0.1075; + } + else + { /* Married/Joint, HouseHead, widower. */ + if (x < 20000.0) rate = 0.014; else + if (x < 50000.0) rate = 0.0175; else + if (x < 70000.0) rate = 0.0245; else + if (x < 80000.0) rate = 0.035; else + if (x < 150000.0) rate = 0.05525; else + if (x < 500000.0) rate = 0.0637; else + if (x < 100000.0) rate = 0.0897; + else rate = 0.1075; + } + printf(" You are in the %2.1f%% marginal tax bracket,\n and you are paying an effective %2.1f%% tax on your total income.\n", + 100.0 * rate, 100.0 * tx / x ); + fprintf(outfile," You are in the %2.1f%% marginal tax bracket,\n and you are paying an effective %2.1f%% tax on your total income.\n", + 100.0 * rate, 100.0 * tx / x ); +} + + +double TaxRateFunction( double income, int status ) /* Emulates table lookup or function appropriately. */ +{ + double x, dx, tx; + int k; + + if (income < 100000.0) /* Quantize to match tax-table exactly. */ + { + x = 50.0; + dx = 0.5 * x; + k = (income - 0.000001) / x; + x = x * (double)k + dx; + tx = (int)(TaxRateFormula( x, status ) + 0.5); + } + else + tx = TaxRateFormula( income, status ); + return tx; +} + + +void place_blocked_value( char *phrase, int numpre, int numpost, char *label ) +{ /* Pad and quote a string so there are numpre chars before the radix point. */ + int j=0, k=0; + char *buf; + while ((phrase[j] != '.') && (phrase[j] != '\0')) j++; + buf = (char *)malloc( strlen( phrase ) + numpre + numpost + 1 ); + if (j < numpre) + k = numpre - j; + for (j = 0; j < k; j++) + buf[j] = ' '; + buf[j] = '\0'; + strcat( buf, phrase ); + fprintf(outfile, "%s = \"%s\"\n", label, buf ); + free( buf ); +} + + +/*----------------------------------------------------------------------------*/ + +int main( int argc, char *argv[] ) +{ + int i, j, k, status=0, answer=0, HomeOwner=0, Tenant=0, eligible_proptax_ded=1; + char word[1000], *infname=0, outfname[4000]; + time_t now; + double L16b=0.0, L20b=0.0, L28a=0.0, L28b=0.0, L37a=0.0, L37b=0.0, L37c=0.0; + double COJ_b[10], COJ_9a=0.0, proptxcredit, filing_threshold; + double H[10], Hb[10]; /* Worksheet H, added by BWB. */ + double I[10], Ib[10]; /* Worksheet I. */ + char *Your1stName="", *YourLastName="", *YourInitial="", *Spouse1stName="", *SpouseLastName="", *SpouseInitial=""; + char YourNames[2048]=""; + + /* Intercept any command-line arguments. */ + printf("NJ 1040 2024 - v%3.1f\n", thisversion); + i = 1; k=1; + while (i < argc) + { + if (strcmp(argv[i],"-verbose")==0) verbose = 1; + else + if (strcmp(argv[i],"-round_to_whole_dollars")==0) { round_to_whole_dollars = 1; } + else + if (k==1) + { + infname = strdup(argv[i]); + 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]); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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 0) || (L[8] > 0))) + { /* Not eligible for property tax deduction as per right column on p. 23 of instructions. */ + eligible_proptax_ded = 0; + if (L[39] != 0.0) + { + printf("You are not eligible for property tax deduction as per right column on p. 23 of instructions.\n"); + fprintf(outfile,"You are not eligible for property tax deduction as per right column on p. 23 of instructions.\n"); + } + } + + if (COJ_9a == 0.0) + { /*Worksheet-H*/ + H[3] = L[39]; Hb[3] = L[39]; + fprintf(outfile," H3a = %6.2f H3b = %6.2f\n", H[3], Hb[3]); + H[4] = H[2]; Hb[4] = 0.0; + fprintf(outfile," H4a = %6.2f H4b = %6.2f\n", H[4], Hb[4]); + H[5] = H[3] - H[4]; Hb[5] = Hb[3] - Hb[4]; + fprintf(outfile," H5a = %6.2f H5b = %6.2f\n", H[5], Hb[5]); + H[6] = TaxRateFunction( H[5], status ); + Hb[6] = TaxRateFunction( Hb[5], status ); + fprintf(outfile," H6a = %6.2f H6b = %6.2f\n", H[6], Hb[6]); + H[7] = Hb[6] - H[6]; + showline_wrksht('H',7,H); + if (eligible_proptax_ded) + { /*eligible*/ + if (H[7] >= proptxcredit) + { /*yes*/ + fprintf(outfile," H8. Yes. (Take Property Tax Deduction.)\n"); + L[41] = H[4]; + L[42] = H[5]; + L[43] = H[6]; + L[57] = 0.0; + } /*yes*/ + else + { /*no*/ + fprintf(outfile," H8. No. (Take Property Tax Credit.)\n"); + L[41] = 0.0; + L[42] = Hb[5]; + L[43] = Hb[6]; + L[57] = proptxcredit; + } /*no*/ + } /*eligible*/ + else + { /*not_eligble*/ + L[41] = 0.0; + L[42] = Hb[5]; + L[43] = Hb[6]; + L[57] = 0.0; + } /*not_eligble*/ + } /*Worksheet-H*/ + else + { /*Sched COJ +Worksheet-I*/ + fprintf(outfile,"\nSchedule COJ Credit for Income or Wage Taxes Paid to Other Jurisdiction (Previously Sched A):\n"); + showline_wlabel("COJ_1", COJ[1]); + COJ[2] = L[29]; + showline_wlabel("COJ_2", COJ[2]); + COJ[3] = smallerof( 1.0, (COJ[1] / COJ[2]) ); + fprintf(outfile," COJ_3 = %6.2f %%\n", 100.0 * COJ[3] ); + COJ[4] = L[39]; + fprintf(outfile," COJ_4a = %6.2f COJ_4b = %6.2f\n", COJ[4], COJ[4] ); + fprintf(outfile," (5a = %6.2f)\n", H[1] ); + COJ[5] = H[2]; + fprintf(outfile," COJ_5a = %6.2f COJ_5b = %6.2f\n", COJ[5], 0.0); + COJ[6] = COJ[4] - COJ[5]; + COJ_b[6] = COJ[4] - 0.0; + fprintf(outfile," COJ_6a = %6.2f COJ_6b = %6.2f\n", COJ[6], COJ_b[6]); + COJ[7] = TaxRateFunction( COJ[6], status ); + COJ_b[7] = TaxRateFunction( COJ_b[6], status ); + fprintf(outfile," COJ_7a = %6.2f COJ_7b = %6.2f\n", COJ[7], COJ_b[7] ); + COJ[8] = COJ[3] * COJ[7]; + COJ_b[8] = COJ[3] * COJ_b[7]; + fprintf(outfile," COJ_8a = %6.2f COJ_8b = %6.2f\n", COJ[8], COJ_b[8] ); + fprintf(outfile," (9a = %6.2f)\n", COJ_9a ); + COJ[9] = smallerof( smallerof( COJ_9a, COJ[8] ), COJ[7] ); + COJ_b[9] = smallerof( smallerof( COJ_9a, COJ_b[8] ), COJ_b[7] ); + fprintf(outfile," COJ_9a = %6.2f COJ_9b = %6.2f\n", COJ[9], COJ_b[9] ); + + fprintf(outfile,"\nWorksheet I:\n"); + I[1] = COJ[7]; Ib[1] = COJ_b[7]; + fprintf(outfile," I1a = %6.2f I1b = %6.2f\n", I[1], Ib[1] ); + I[2] = COJ[9]; Ib[2] = COJ_b[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 (eligible_proptax_ded) + { /*eligible*/ + if (Ib[4] >= proptxcredit) + { + fprintf(outfile," Sched-I, Yes: Take PropTax Deduction\n\n"); + L[41] = COJ[5]; // fprintf(outfile,"L36c = %6.2f\n", L[36]); + L[42] = COJ[6]; + L[43] = COJ[7]; + L[44] = I[2]; + L[57] = 0.0; + } + else + { + fprintf(outfile," Sched-I, No: Take PropTax Credit\n\n"); + L[41] = 0.0; + L[42] = COJ_b[6]; + L[43] = COJ_b[7]; + L[44] = Ib[2]; + L[57] = proptxcredit; + } + } /*eligible*/ + else + { /*not_eligible*/ + L[41] = 0.0; + L[42] = COJ_b[6]; + L[43] = COJ_b[7]; + L[44] = Ib[2]; + L[57] = 0.0; + } /*not_eligible*/ + } /*SchedA+Worksheet-I*/ + + if (L[40] > 0.0) + fprintf(outfile, "L40a = %6.2f\n", L[40]); + + showline_wmsg( 41, "Property Tax Deduction" ); + + fprintf(outfile,"\n"); /* NJ Taxable Income.*/ + // L[42] = L[39] - L[41]; /* Handled above in Sched-1. */ + if (L[42] > 0.0) + showline_wmsg( 42, "NJ Taxable Income" ); + + // L[43] = TaxRateFunction( L[42], status ); /* Handled above in Schedules+Worksheets, A, G, H, I. */ + if ((L[29] < filing_threshold) || (L[43] < 0.0)) + L[43] = 0.0; + showline_wmsg(43, "TAX"); + Report_bracket_info( L[42], status ); + + if (COJ[1] > 0.0) + showline_wmsg( 44, "Credit for Taxes paid to other jurisdictions." ); + + L[45] = L[43] - L[44]; + showline_wmsg( 45, "Balance of Tax"); + + GetLineF( "L46", &L[46] ); /* Sheltered Workshop Tax Credit. */ + GetLineF( "L47", &L[47] ); /* Gold Star Family Counseling Credit. */ + GetLineF( "L48", &L[48] ); /* Credit for Employer of Organ/Bone Marrow Donor */ + + L[49] = L[46] + L[47] + L[48]; + showline_wmsg( 49, "Total Credits." ); + + L[50] = NotLessThanZero( L[45] - L[49] ); + showline_wmsg( 50, "Balance of Tax after Credits." ); + + GetLineF( "L51", &L[51] ); /* Use-Tax Due on Internet, Mail-Order or other out-of-state purchaes. */ + GetLineF( "L52", &L[52] ); /* Interest on underpayment of estimated tax. */ + GetLineF( "L53", &L[53] ); /* Shared Responsibility (Med. Insurance) Payment. */ + + L[54] = L[50] + L[51] + L[52] + L[53]; + showline_wmsg( 54, "Total Tax Due" ); /* Total Tax + Penalty. */ + + GetLine( "L55", &L[55] ); /* Withheld amount. */ + showline_wmsg( 55, "Total NJ Income Tax Withheld" ); + + showline_wmsg( 56, "Property tax Credit" ); + + GetLineF( "L57", &L[57] ); /* NJ Estimated Tax Payments/Credit from last year's return. */ + GetLineF( "L58", &L[58] ); /* NJ Earned Income Tax Credit. (See Sched pg 38.) */ + GetLineF( "L59", &L[59] ); /* EXCESS NJ UI/HC/WD Withheld, (See pg 38.) */ + GetLineF( "L60", &L[60] ); /* EXCESS NJ Disability Insurance Withheld, (See pg 38.) */ + GetLineF( "L61", &L[61] ); /* EXCESS NJ Family Leave Insurance Withheld, (See pg 38.) */ + GetLineF( "L62", &L[62] ); /* Wounded Warrior Caregivers Credit */ + GetLineF( "L63", &L[63] ); /* Pass-Through Business Alternatve Income Tax Credit */ + GetLineF( "L64", &L[64] ); /* Child and Dependent Care Credit. */ + GetLineF( "L65", &L[65] ); /* NJ Child Tax Credit. */ + + for (j=55; j <= 65; j++) + L[66] = L[66] + L[j]; + showline_wmsg( 66, "Total Withholding Payments & Credits" ); + + for (j=69; j <= 77; j++) + L[78] = L[78] + L[j]; + + if (L[66] < L[54]) + { + L[67] = L[54] - L[66]; + fprintf(outfile, "L67 = %6.2f DUE !!!\n", L[67] ); + fprintf(outfile," (Which is %2.1f%% of your total tax.)\n", 100.0 * L[67] / (L[54] + 1e-9) ); + showline_wmsg( 78, "( Total Adjustments to tax due )"); + L[79] = L[67] + L[78]; + showline_wmsg( 79, "Balance Due" ); + } + else + { + L[68] = L[66] - L[54]; + fprintf(outfile, "L68 = %6.2f Overpayment\n", L[68] ); + + showline_wmsg( 78, "( Total Adjustments to overpayment )"); + L[80] = L[68] - L[78]; + showline_wmsg( 80, "Refund !!!" ); + } + + fprintf(outfile,"\n{ --------- }\n"); + Your1stName = GetTextLineF( "Your1stName:" ); + YourInitial = GetTextLineF( "YourInitial:" ); + YourLastName = GetTextLineF( "YourLastName:" ); + GetTextLineF( "YourSocSec#:" ); + Spouse1stName = GetTextLineF( "Spouse1stName:" ); + SpouseInitial = GetTextLineF( "SpouseInitial:" ); + SpouseLastName = GetTextLineF( "SpouseLastName:" ); + GetTextLineF( "SpouseSocSec#:" ); + if (strlen( YourLastName ) > 0) + { + strcpy( YourNames, YourLastName ); + strcat( YourNames, ", " ); + strcat( YourNames, Your1stName ); + if (YourInitial[0] != '\0') + { + strcat( YourNames, ", " ); + strcat( YourNames, YourInitial ); + } + if (Spouse1stName[0] != '\0') + { + strcat( YourNames, ", " ); + if ((SpouseLastName[0] != '\0') && (strcmp( YourLastName, SpouseLastName ) != 0)) + { + strcat( YourNames, SpouseLastName ); + strcat( YourNames, ", " ); + } + strcat( YourNames, Spouse1stName ); + if (SpouseInitial[0] != '\0') + { + strcat( YourNames, ", " ); + strcat( YourNames, SpouseInitial ); + } + } + fprintf(outfile,"YourNames: %s\n", YourNames ); + } + GetTextLineF( "Number&Street:" ); + GetTextLineF( "Town:" ); + GetTextLineF( "State:" ); + GetTextLineF( "Zipcode:" ); + + fclose(infile); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + Display_File( outfname ); + printf("\nResults written to file: %s\n", outfname); + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_NY_IT201_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_NY_IT201_2024.c new file mode 100755 index 0000000..df38b07 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_NY_IT201_2024.c @@ -0,0 +1,1864 @@ +/************************************************************************/ +/* TaxSolve_NY_IT-201_2024.c - NY State Tax form IT-201 for 2024. */ +/* Copyright (C) 2003-2025 - Aston Roberts, Skeet Monker */ +/* */ +/* Compile: gcc taxsolve_NY_IT201_2024.c -o taxsolve_NY_IT201_2024 */ +/* Run: ./taxsolve_NY_IT201_2024 NY_IT201_2024.txt */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ +/* */ +/* Aston Roberts - aston_roberts@yahoo.com */ +/* Modified for NY taxes 2005-2025 - Skeet Monker */ +/* Corrections 2023 taxes - Jason Striegel */ +/************************************************************************/ + +float thisversion=22.02; + +#include "taxsolve_routines.c" + +double A[10], S[10]; + +#define SINGLE 1 +#define MARRIED_FILING_JOINTLY 2 +#define MARRIED_FILING_SEPARAT 3 +#define HEAD_OF_HOUSEHOLD 4 +#define WIDOW 5 +#define Yes 1 +#define No 0 +#define True 1 +#define False 0 + +int status=0; + +char statusnames[10][20]={"0","Single","Married/Joint","Married/Sep","Head_of_House","Widow"}; +char *Your1stName="", *YourLastName="", *YourInitial="", + *Spouse1stName="", *SpouseLastName="", *SpouseInitial=""; +char *YourSocSec=0, *SpouseSocSec=0, *MailAddress=0, *AptNumber=0, + Town[2048]="", StateName[1024]="", Zipcode[1024]=""; + +double L47a=0.0; /* NYC resident tax on line 47 */ +double L69a=0.0; /* NYC school tax credit (rate reduction amount) */ + +struct FedReturnData + { + double fedline[MAX_LINES], schedA[MAX_LINES], schedD[MAX_LINES], + sched[8][MAX_LINES], fed_L4b, fed_L5b, fed_L6b, + schedA5a, schedA5b, schedA5c, schedA8a, schedA8b, schedA8c; + int Exception, Itemized; + } PrelimFedReturn; + +struct dependent_info + { + char *Name1st, *NameLst, *Relat, *SocSec; + } Dep_info[10]; +int nDeps=0; + + +void convert_slashes( char *fname ) +{ /* Convert slashes in file name based on machine type. */ + char *ptr; + #ifdef __MINGW32__ + char slash_sreach='/', slash_replace='\\'; + #else + char slash_sreach='\\', slash_replace='/'; + #endif + + ptr = strchr( fname, slash_sreach ); + while (ptr) + { + ptr[0] = slash_replace; + ptr = strchr( fname, slash_sreach ); + } +} + + +char *pull_initial( char *name ) +{ /* Expect names like: "John, D.", and pull initial out. */ + int j=0; + char midinitial[10]; + while ((name[j] != '\0') && (name[j] != ',')) + j++; + if (name[j] == ',') + { + name[j++] = '\0'; + while ((name[j] != '\0') && (isspace( name[j] ))) + j++; + midinitial[0] = name[j]; + midinitial[1] = '\0'; + } + else + strcpy( midinitial, "" ); + return strdup( midinitial ); +} + + + void grab_line_string( char *fline, char *strng ) + { /* Grab a string and copy it into pre-allocated character array. */ + char twrd[2048]; + strng[0] = '\0'; + do + { + next_word(fline, twrd, " \t=" ); + if (twrd[0] != ';') + { strcat( strng, twrd ); strcat( strng, " " ); } + } + while ((fline[0] != '\0') && (strstr( twrd, ";" ) == 0)); + } + + + +int ImportFederalReturnData( char *fedlogfile, struct FedReturnData *fed_data ) +{ + FILE *infile; + char fline[4000], word[4000], tword[2000]; + int linenum, j; + + for (linenum=0; linenumfedline[linenum] = 0.0; + fed_data->schedA[linenum] = 0.0; + fed_data->schedD[linenum] = 0.0; + for (j=0; j < 8; j++) fed_data->sched[j][linenum] = 0.0; + } + fed_data->fed_L4b = 0.0; + fed_data->fed_L5b = 0.0; + fed_data->fed_L6b = 0.0; + fed_data->schedA5a = 0.0; + fed_data->schedA5b = 0.0; + fed_data->schedA5c = 0.0; + fed_data->schedA8a = 0.0; + fed_data->schedA8b = 0.0; + fed_data->schedA8c = 0.0; + convert_slashes( fedlogfile ); + infile = fopen(fedlogfile, "r"); + if (infile==0) + { + printf("Error: Could not open Federal return '%s'\n", fedlogfile); + fprintf(outfile,"Error: Could not open Federal return '%s'\n", fedlogfile); + return 0; + } + fed_data->Itemized = 1; /* Set initial default values. */ + read_line(infile,fline); linenum = 0; + while (!feof(infile)) + { + if (strstr(fline,"Use standard deduction.")!=0) fed_data->Itemized = 0; + next_word(fline, word, " \t="); + if ((strstr(word,"L")==word) && (strstr(fline," = ")!=0)) + { + if (strcmp(word,"L9b") != 0) + { + if (sscanf(&word[1],"%d",&linenum)!=1) + { + printf("Error: Reading Fed line number '%s%s'\n",word,fline); + fprintf(outfile,"Error: Reading Fed line number '%s%s'\n",word,fline); + } + next_word(fline, tword, " \t="); + if (sscanf(tword,"%lf", &fed_data->fedline[linenum])!=1) + { + printf("Error: Reading Fed line %d '%s%s'\n",linenum,tword,fline); + fprintf(outfile,"Error: Reading Fed line %d '%s%s'\n",linenum,tword,fline); + } + if (round_to_whole_dollars) + fed_data->fedline[linenum] = Round( fed_data->fedline[linenum] ); + if (strcmp(word,"L4b") == 0) + fed_data->fed_L4b = fed_data->fedline[linenum]; + if (strcmp(word,"L5b") == 0) + fed_data->fed_L5b = fed_data->fedline[linenum]; + if (strcmp(word,"L6b") == 0) + fed_data->fed_L6b = fed_data->fedline[linenum]; + + if (verbose) printf("FedLin[%d] = %2.2f\n", linenum, fed_data->fedline[linenum]); + } + } + else + if ((strstr(word,"A")==word) && (strstr(word,"AMT")!=word) && (strstr(fline," = ")!=0)) + { /*Schedule-A*/ + if (strcmp( word, "A5a" ) == 0) + { + next_word(fline, word, " \t="); + if (sscanf(word,"%lf", &fed_data->schedA5a) != 1) + { + printf("Error: Reading Fed SchedA5a %d '%s%s'\n",linenum,word,fline); + fprintf(outfile, "Error: Reading Fed SchedA %d '%s%s'\n",linenum,word,fline); + } + if (round_to_whole_dollars) + fed_data->schedA5a = Round( fed_data->schedA5a ); + if (verbose) printf("FedLinSchedA5a = %2.2f\n", fed_data->schedA5a ); + } + else + if (strcmp( word, "A5b" ) == 0) + { + next_word(fline, word, " \t="); + if (sscanf(word,"%lf", &fed_data->schedA5b) != 1) + { + printf("Error: Reading Fed SchedA5b %d '%s%s'\n",linenum,word,fline); + fprintf(outfile, "Error: Reading Fed SchedA %d '%s%s'\n",linenum,word,fline); + } + if (round_to_whole_dollars) + fed_data->schedA5b = Round( fed_data->schedA5b ); + if (verbose) printf("FedLinSchedA5b = %2.2f\n", fed_data->schedA5b ); + } + else + if (strcmp( word, "A5c" ) == 0) + { + next_word(fline, word, " \t="); + if (sscanf(word,"%lf", &fed_data->schedA5c) != 1) + { + printf("Error: Reading Fed SchedA5c %d '%s%s'\n",linenum,word,fline); + fprintf(outfile, "Error: Reading Fed SchedA %d '%s%s'\n",linenum,word,fline); + } + if (round_to_whole_dollars) + fed_data->schedA5c = Round( fed_data->schedA5c ); + if (verbose) printf("FedLinSchedA5c = %2.2f\n", fed_data->schedA5c ); + } + else + if (strcmp( word, "A8a" ) == 0) + { + next_word(fline, word, " \t="); + if (sscanf(word,"%lf", &fed_data->schedA8a) != 1) + { + printf("Error: Reading Fed SchedA8a %d '%s%s'\n",linenum,word,fline); + fprintf(outfile, "Error: Reading Fed SchedA %d '%s%s'\n",linenum,word,fline); + } + if (round_to_whole_dollars) + fed_data->schedA8a = Round( fed_data->schedA8a ); + if (verbose) printf("FedLinSchedA8a = %2.2f\n", fed_data->schedA8a ); + } + else + if (strcmp( word, "A8b" ) == 0) + { + next_word(fline, word, " \t="); + if (sscanf(word,"%lf", &fed_data->schedA8b) != 1) + { + printf("Error: Reading Fed SchedA8b %d '%s%s'\n",linenum,word,fline); + fprintf(outfile, "Error: Reading Fed SchedA %d '%s%s'\n",linenum,word,fline); + } + if (round_to_whole_dollars) + fed_data->schedA8b = Round( fed_data->schedA8b ); + if (verbose) printf("FedLinSchedA8b = %2.2f\n", fed_data->schedA8b ); + } + else + if (strcmp( word, "A8c" ) == 0) + { + next_word(fline, word, " \t="); + if (sscanf(word,"%lf", &fed_data->schedA8c) != 1) + { + printf("Error: Reading Fed SchedA8c %d '%s%s'\n",linenum,word,fline); + fprintf(outfile, "Error: Reading Fed SchedA %d '%s%s'\n",linenum,word,fline); + } + if (round_to_whole_dollars) + fed_data->schedA8c = Round( fed_data->schedA8c ); + if (verbose) printf("FedLinSchedA8c = %2.2f\n", fed_data->schedA8c ); + } + else + { /*normal*/ + if (sscanf(&word[1],"%d",&linenum)!=1) + { + printf("Error: Reading Fed line number '%s%s'\n",word,fline); + fprintf(outfile,"Error: Reading Fed line number '%s%s'\n",word,fline); + } + next_word(fline, word, " \t="); + if (sscanf(word,"%lf", &fed_data->schedA[linenum])!=1) + { + printf("Error: Reading Fed schedA %d '%s%s'\n",linenum,word,fline); + fprintf(outfile, "Error: Reading Fed schedA %d '%s%s'\n",linenum,word,fline); + } + if (round_to_whole_dollars) + fed_data->schedA[linenum] = Round( fed_data->schedA[linenum] ); + if (verbose) printf("FedLinSchedA[%d] = %2.2f\n", linenum, fed_data->schedA[linenum]); + } /*normal*/ + } /*Schedule-A*/ + else + if ((strstr(word,"D")==word) && (strstr(fline," = ")!=0) && (strstr(word,"Dep")!=word)) + { /*Schedule-D*/ + if (sscanf(&word[1],"%d",&linenum)!=1) + { + printf("Error: Reading Fed line number '%s%s'\n",word,fline); + fprintf(outfile,"Error: Reading Fed line number '%s%s'\n",word,fline); + } + next_word(fline, word, " \t="); + if (strcmp(word,"d") == 0) + { /*Basis,Sale,Gain line. Capture last value.*/ + next_word(fline, word, " \teh=" ); + while (word[0] != '\0') + { + if (sscanf(word,"%lf", &fed_data->schedD[linenum]) != 1) + fprintf(outfile,"Error: Reading Fed schedD %d '%s %s'\n", linenum, word, fline); + if (round_to_whole_dollars) + fed_data->schedD[linenum] = Round( fed_data->schedD[linenum] ); + next_word(fline, word, " \teh=" ); + } + } /*Schedule-D*/ + else + if (sscanf(word,"%lf", &fed_data->schedD[linenum]) != 1) + { + if (strncasecmp(word,"yes",1) == 0) fed_data->schedD[linenum] = 1; + else + if (strncasecmp(word,"no",1) == 0) fed_data->schedD[linenum] = 0; + else + { + printf("Error: Reading fed schedD %d '%s%s'\n", linenum, word, fline); + fprintf(outfile,"Error: Reading Fed schedD %d '%s%s'\n", linenum, word, fline); + } + } + else + if (round_to_whole_dollars) + fed_data->schedD[linenum] = Round( fed_data->schedD[linenum] ); + if (verbose) printf("FedLin[%d] = %2.2f\n", linenum, fed_data->schedD[linenum]); + } + else + if (strcmp(word,"S1_2a") == 0) + { + next_word(fline, word, " \t=:"); + if (sscanf(word,"%lf", &fed_data->sched[1][2]) != 1) + { + printf("Error: Reading Fed sched1 line 2 '%s'\n", word ); + fprintf(outfile,"Error: Reading Fed sched1 line 2 '%s'\n", word ); + } + if (round_to_whole_dollars) + fed_data->sched[1][2] = Round( fed_data->sched[1][2] ); + } + else + if (strcmp(word,"S1_2b:") == 0) + { + ; // ignore this entry. + } + else + if ((strncmp(word,"S1_",3) == 0) && (strstr( word, "_Type" ) == 0)) + { + next_word( &(word[3]), tword, " \t=:"); + if (sscanf( tword, "%d", &linenum) != 1) + { + printf("Error: Reading Fed sched1 line-number '%s'\n", word ); + fprintf(outfile,"Error: Reading Fed sched1 line-number '%s'\n", word ); + } + else + { + next_word(fline, word, " \t=:"); + if (sscanf(word,"%lf", &fed_data->sched[1][linenum]) != 1) + { + printf("Error: Reading Fed sched1 line %d '%s'\n", linenum, word ); + fprintf(outfile,"Error: Reading Fed sched1 line %d '%s'\n", linenum, word ); + } + if (round_to_whole_dollars) + fed_data->sched[1][linenum] = Round( fed_data->sched[1][linenum] ); + } + } + else + if ((strncmp(word,"S2_",3) == 0) && (strstr( word, "_Type" ) == 0)) + { + next_word( &(word[3]), tword, " \t=:"); + if (sscanf( tword, "%d", &linenum) != 1) + { + printf("Error: Reading Fed sched2 line-number '%s'\n", word ); + fprintf(outfile,"Error: Reading Fed sched2 line-number '%s'\n", word ); + } + else + { + next_word(fline, word, " \t=:"); + if (sscanf(word,"%lf", &fed_data->sched[2][linenum]) != 1) + { + printf("Error: Reading Fed sched2 line %d '%s'\n", linenum, word ); + fprintf(outfile,"Error: Reading Fed sched2 line %d '%s'\n", linenum, word ); + } + if (round_to_whole_dollars) + fed_data->sched[2][linenum] = Round( fed_data->sched[2][linenum] ); + } + } + else + if (strncmp(word,"S3_",3) == 0) + { + next_word( &(word[3]), tword, " \t=:"); + if (sscanf( tword, "%d", &linenum) != 1) + { + printf("Error: Reading Fed sched3 line-number '%s'\n", word ); + fprintf(outfile,"Error: Reading Fed sched3 line-number '%s'\n", word ); + } + else + if ((linenum != 6) && (linenum != 13)) + { + next_word(fline, word, " \t=:"); + if (sscanf(word,"%lf", &fed_data->sched[3][linenum]) != 1) + { + printf("Error: Reading Fed sched3 line %d '%s'\n", linenum, word ); + fprintf(outfile,"Error: Reading Fed sched3 line %d '%s'\n", linenum, word ); + } + if (round_to_whole_dollars) + fed_data->sched[3][linenum] = Round( fed_data->sched[3][linenum] ); + } + } + else + if (strcmp(word,"Status") == 0) + { + next_word(fline, word, " \t="); + fprintf(outfile," Status %s\n", word ); + if (strncasecmp(word,"Single",4)==0) + status = SINGLE; + else + if (strncasecmp(word,"Married/Joint",13)==0) + status = MARRIED_FILING_JOINTLY; + else + if (strncasecmp(word,"Married/Sep",11)==0) + status = MARRIED_FILING_SEPARAT; + else + if (strncasecmp(word,"Head_of_House",4)==0) + status = HEAD_OF_HOUSEHOLD; + else + if (strncasecmp(word,"Widow",4)==0) + status = WIDOW; + else + { + printf("Error: unrecognized status '%s'. Exiting.\n", word); + fprintf(outfile,"Error: unrecognized status '%s'. Exiting.\n", word); + return 0; + } + } + else + if (strcmp(word,"Your1stName:") == 0) + { + Your1stName = strdup( fline ); + YourInitial = pull_initial( Your1stName ); + } + else + if (strcmp(word,"YourLastName:") == 0) + { + YourLastName = strdup( fline ); + } + else + if (strcmp(word,"YourSocSec#:") == 0) + { + YourSocSec = strdup( fline ); + } + else + if (strcmp(word,"Spouse1stName:") == 0) + { + Spouse1stName = strdup( fline ); + SpouseInitial = pull_initial( Spouse1stName ); + } + else + if (strcmp(word,"SpouseLastName:") == 0) + { + SpouseLastName = strdup( fline ); + } + else + if (strcmp(word,"SpouseSocSec#:") == 0) + { + SpouseSocSec = strdup( fline ); + } + else + if (strcmp(word,"Number&Street:") == 0) + { + MailAddress = strdup( fline ); + } + else + if (strcmp(word,"Apt#:") == 0) + { + AptNumber = strdup( fline ); + } + else + if (strcmp(word,"TownStateZip:") == 0) + { /* Expect: town name, NY, 10033 */ + next_word( fline, Town, "," ); + next_word( fline, StateName, " \t," ); + next_word( fline, Zipcode, " \t," ); + } + else + if ((strncmp(word,"Dep",3) == 0) && (strstr(word,"_FirstName:") != 0)) + { + if (strncmp(word,"Dep1_",5) == 0) j = 1; else + if (strncmp(word,"Dep2_",5) == 0) j = 2; else + if (strncmp(word,"Dep3_",5) == 0) j = 3; else + if (strncmp(word,"Dep4_",5) == 0) j = 4; else + if (strncmp(word,"Dep5_",5) == 0) j = 5; else j = -1; + if (j > 0) + { + grab_line_string( fline, word ); // next_word( fline, word, " \t\n\r" ); + Dep_info[j].Name1st = strdup( word ); + read_line(infile,fline); + next_word( fline, word, " \t\n\r" ); + if (strstr( word, "_LastName:" ) == 0) + { printf("Error: expected dependent %d last name, but found '%s'\n", j, word ); } + grab_line_string( fline, word ); // next_word( fline, word, " \t\n\r" ); + Dep_info[j].NameLst = strdup( word ); + read_line(infile,fline); + next_word( fline, word, " \t\n\r" ); + if (strstr( word, "_SocSec#:" ) == 0) + { printf("Error: expected dependent %d SocSec#, but found '%s'\n", j, word ); } + grab_line_string( fline, word ); // next_word( fline, word, " \t\n\r" ); + Dep_info[j].SocSec = strdup( word ); + read_line(infile,fline); + next_word( fline, word, " \t\n\r" ); + if (strstr( word, "_Relation:" ) == 0) + { printf("Error: expected dependent %d Relation, but found '%s'\n", j, word ); } + grab_line_string( fline, word ); // next_word( fline, word, " \t\n\r" ); + Dep_info[j].Relat = strdup( word ); + nDeps = j; + } + } + read_line(infile,fline); + } + fclose(infile); + return 1; +} + + + +double TaxRateFunction( double income, int status ) +{ + double tax; + switch (status) + { + case MARRIED_FILING_JOINTLY: case WIDOW: /* Updated for 2024. */ + if (income <= 17150.0) tax = 0.04 * income; else /* Data from Instructions pg 45. */ + if (income <= 23600.0) tax = 686.0 + 0.045 * (income - 17150.0); else + if (income <= 27900.0) tax = 976.0 + 0.0525 * (income - 23600.0); else + if (income <= 161550.0) tax = 1202.0 + 0.0550 * (income - 27900.0); else + if (income <= 323200.0) tax = 8553.0 + 0.0600 * (income - 161550.0); else + if (income <= 2155350.0) tax = 18252.0 + 0.0685 * (income - 323200.0); else + if (income <= 5000000.0) tax = 143754.0 + 0.0965 * (income - 2155350.0); else + if (income <= 25000000.0) tax = 418263.0 + 0.103 * (income - 5000000.0); else + tax = 2478263.0 + 0.109 * (income - 25000000.0); + break; + case SINGLE: case MARRIED_FILING_SEPARAT: + if (income <= 8500.0) tax = 0.04 * income; else + if (income <= 11700.0) tax = 340.0 + 0.045 * (income - 8500.0); else + if (income <= 13900.0) tax = 484.0 + 0.0525 * (income - 11700.0); else + if (income <= 80650.0) tax = 600.0 + 0.0550 * (income - 13900.0); else + if (income <= 215400.0) tax = 4271.0 + 0.0600 * (income - 80650.0); else + if (income <= 1077550.0) tax = 12356.0 + 0.0685 * (income - 215400.0); else + if (income <= 5000000.0) tax = 71413.0 + 0.0965 * (income - 1077550.0); else + if (income <= 25000000.0) tax = 449929.0 + 0.103 * (income - 5000000.0); else + tax = 2509929.0 + 0.109 * (income - 25000000.0); + break; + case HEAD_OF_HOUSEHOLD: + if (income <= 12080.0) tax = 0.04 * income; else + if (income <= 17650.0) tax = 512.0 + 0.045 * (income - 12800.0); else + if (income <= 20900.0) tax = 730.0 + 0.0525 * (income - 17650.0); else + if (income <= 107650.0) tax = 901.0 + 0.0550 * (income - 20900.0); else + if (income <= 269300.0) tax = 5672.0 + 0.0600 * (income - 107650.0); else + if (income <= 1616450.0) tax = 15371.0 + 0.0685 * (income - 269300.0); else + if (income <= 5000000.0) tax = 107651.0 + 0.0965 * (income - 1616450.0); else + if (income <= 25000000.0) tax = 434163.0 + 0.103 * (income - 5000000.0); else + tax = 2494163.0 + 0.109 * (income - 25000000.0); + break; + default: printf("Error: Unhandled status\n"); exit(0); break; + } + return tax; +} + + +void Report_bracket_info( double income, double tx, int status ) +{ + double rate; + switch (status) + { + case MARRIED_FILING_JOINTLY: case WIDOW: /* Updated for 2024. */ + if (income <= 17150.0) rate = 0.04; else + if (income <= 23600.0) rate = 0.045; else + if (income <= 27900.0) rate = 0.0525; else + if (income <= 161550.0) rate = 0.0550; else + if (income <= 323200.0) rate = 0.0600; else + if (income <= 2155350.0) rate = 0.0685; else + if (income <= 5000000.0) rate = 0.0965; else + if (income <= 25000000.0) rate = 0.103; else rate = 0.109; + break; + case SINGLE: case MARRIED_FILING_SEPARAT: + if (income <= 8500.0) rate = 0.04; else + if (income <= 11700.0) rate = 0.045; else + if (income <= 13900.0) rate = 0.0525; else + if (income <= 80650.0) rate = 0.0550; else + if (income <= 215400.0) rate = 0.0600; else + if (income <= 1077550.0) rate = 0.0685; else + if (income <= 5000000.0) rate = 0.0965; else + if (income <= 25000000.0) rate = 0.103; else rate = 0.109; + break; + case HEAD_OF_HOUSEHOLD: + if (income <= 12800.0) rate = 0.04; else + if (income <= 17650.0) rate = 0.045; else + if (income <= 20900.0) rate = 0.0525; else + if (income <= 107650.0) rate = 0.0550; else + if (income <= 269300.0) rate = 0.0600; else + if (income <= 1616450.0) rate = 0.0685; else + if (income <= 5000000.0) rate = 0.0965; else + if (income <= 25000000.0) rate = 0.103; else rate = 0.109; + break; + default: printf("Error: Unhandled status\n"); exit(0); break; + } + printf("tx = %g, income = %g\n", tx, income ); + if (income == 0.0) income = 0.0001; /* Prevent divide by zero. */ + printf(" You are in the %2.1f%% marginal tax bracket,\n and you are paying an effective %2.1f%% tax on your total income.\n", + 100.0 * rate, 100.0 * tx / income ); + fprintf(outfile," You are in the %2.1f%% marginal tax bracket,\n and you are paying an effective %2.1f%% tax on your total income.\n", + 100.0 * rate, 100.0 * tx / income ); +} + + +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); +} + + +double NYcityTaxRateFunction( double income, int status ) /* From Instructions page 40. */ +{ + double tax, dx; + int m; + + if (income < 25.0) dx = 12.5; else + if (income < 50.0) dx = 25.0; else dx = 50.0; + + m = income / dx; /* Round income to nearest $50. */ + if (income < 65000.0) + income = m * dx + 0.5 * dx; /* Place into center of a $50 bracket. */ + + if ((status==MARRIED_FILING_JOINTLY) || (status==WIDOW)) /* Updated for 2024. */ + { + if (income < 21600.0) tax = income * 0.03078; else + if (income < 45000.0) tax = (income - 21600.00) * 0.03762 + 665.00; else + if (income < 90000.0) tax = (income - 45000.00) * 0.03819 + 1545.0; else + tax = (income - 90000.00) * 0.03876 + 3264.0; + } + else + if ((status==SINGLE) || (status==MARRIED_FILING_SEPARAT)) + { + if (income < 12000.0) tax = income * 0.03078; else + if (income < 25000.0) tax = (income - 12000.00) * 0.03762 + 369.0; else + if (income < 50000.0) tax = (income - 25000.00) * 0.03819 + 858.0; else + tax = (income - 50000.00) * 0.03876 + 1813.00; + } + else + if (status==HEAD_OF_HOUSEHOLD) + { + if (income < 14400.00) tax = income * 0.03078; else + if (income < 30000.00) tax = (income - 14400.00) * 0.03762 + 443.0; else + if (income < 60000.00) tax = (income - 30000.00) * 0.03819 + 1030.0; else + tax = (income - 60000.00) * 0.03876 + 2176.0; + } + else {printf("Status not covered.\n"); exit(1);} + + if (income < 65000.0) tax = (int)(tax + 0.5); /* Round result to whole dollar. */ + return tax; +} + + +void worksheet1() /*Tax Computation Worksheet 1 (pg 46) */ /* Updated for 2024. */ +{ double ws[100]; + printf(" Doing Tax Computation Worksheet 1.\n"); + ws[1] = L[33]; + ws[2] = L[38]; + ws[3] = 0.055 * ws[2]; + if (ws[1] >= 157650.0) + ws[9] = ws[3]; + else + { + ws[4] = TaxRateFunction( ws[2], status ); + ws[5] = ws[3] - ws[4]; + ws[6] = ws[1] - 107650.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 worksheet2() /*Tax Computation Worksheet 2 (pg 47) */ +{ double ws[100]; + printf(" Doing Tax Computation Worksheet 2.\n"); + ws[1] = L[33]; + ws[2] = L[38]; + ws[3] = TaxRateFunction( ws[2], status ); + ws[4] = 333.0; + ws[5] = 807.0; + ws[6] = ws[1] - 161550.0; + ws[7] = smallerof( ws[6], 50000.0 ); + /* Divide by 50k and round to forth decimal place. */ + ws[8] = 0.0001 * (double)Round( 10000.0 * (ws[7] / 50000.0) ); + ws[9] = ws[5] * ws[8]; + ws[10] = ws[3] + ws[4] + ws[9]; + L[39] = ws[10]; +} + + +void worksheet3() /*Tax Computation Worksheet 3 (pg 47) */ +{ double ws[100]; + printf(" Doing Tax Computation Worksheet 3.\n"); + ws[1] = L[33]; + ws[2] = L[38]; + ws[3] = TaxRateFunction( ws[2], status ); + ws[4] = 1140.0; + ws[5] = 2747.0; + ws[6] = ws[1] - 323200.0; + ws[7] = smallerof( ws[6], 50000.0 ); + /* Divide by 50k and round to forth decimal place. */ + ws[8] = 0.0001 * (double)Round( 10000.0 * (ws[7] / 50000.0) ); + ws[9] = ws[5] * ws[8]; + ws[10] = ws[3] + ws[4] + ws[9]; + L[39] = ws[10]; +} + + +void worksheet4() /*Tax Computation Worksheet 4 (pg 47) */ +{ double ws[100]; + printf(" Doing Tax Computation Worksheet 4.\n"); + ws[1] = L[33]; + ws[2] = L[38]; + ws[3] = TaxRateFunction( ws[2], status ); + ws[4] = 3887.0; + ws[5] = 60350.0; + ws[6] = ws[1] - 2155350.0; + ws[7] = smallerof( ws[6], 50000.0 ); + /* Divide by 50k and round to forth decimal place. */ + ws[8] = 0.0001 * (double)Round( 10000.0 * (ws[7] / 50000.0) ); + ws[9] = ws[5] * ws[8]; + ws[10] = ws[3] + ws[4] + ws[9]; + L[39] = ws[10]; +} + + +void worksheet5() /*Tax Computation Worksheet 5 (pg 48) */ +{ double ws[100]; + printf(" Doing Tax Computation Worksheet 5.\n"); + ws[1] = L[33]; + ws[2] = L[38]; + ws[3] = TaxRateFunction( ws[2], status ); + ws[4] = 64237.0; + ws[5] = 32500.0; + ws[6] = ws[1] - 5000000.0; + ws[7] = smallerof( ws[6], 50000.0 ); + /* Divide by 50k and round to forth decimal place. */ + ws[8] = 0.0001 * (double)Round( 10000.0 * (ws[7] / 50000.0) ); + ws[9] = ws[5] * ws[8]; + ws[10] = ws[3] + ws[4] + ws[9]; + L[39] = ws[10]; +} + + +void worksheet6() /*Tax Computation Worksheet 6 (pg 48) */ +{ double ws[100]; + printf(" Doing Tax Computation Worksheet 6.\n"); + ws[1] = L[38]; + ws[2] = 0.109 * ws[1]; + L[39] = ws[2]; +} + + +void worksheet7() /*Tax Computation Worksheet 7 (pg 48) */ +{ double ws[100]; + printf(" Doing Tax Computation Worksheet 7.\n"); + ws[1] = L[33]; + ws[2] = L[38]; + ws[3] = 0.06 * ws[2]; + if (ws[1] < 157650.0) + { + ws[4] = TaxRateFunction( ws[2], status ); + ws[5] = ws[3] - ws[4]; + ws[6] = ws[1] - 107650.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]; + } + else + ws[9] = ws[3]; + L[39] = ws[9]; +} + + +void worksheet8() /*Tax Computation Worksheet 8 (pg 49) */ +{ double ws[100]; + printf(" Doing Tax Computation Worksheet 8.\n"); + ws[1] = L[33]; + ws[2] = L[38]; + ws[3] = TaxRateFunction( ws[2], status ); + ws[4] = 568.0; + ws[5] = 1831.0; + ws[6] = ws[1] - 215400.0; + ws[7] = smallerof( ws[6], 50000.0 ); + /* Divide by 50k and round to forth decimal place. */ + ws[8] = 0.0001 * (double)Round( 10000.0 * (ws[7] / 50000.0) ); + ws[9] = ws[5] * ws[8]; + ws[10] = ws[3] + ws[4] + ws[9]; + L[39] = ws[10]; +} + + +void worksheet9() /*Tax Computation Worksheet 9 (pg 49) */ +{ double ws[100]; + printf(" Doing Tax Computation Worksheet 9.\n"); + ws[1] = L[33]; + ws[2] = L[38]; + ws[3] = TaxRateFunction( ws[2], status ); + ws[4] = 2399.0; + ws[5] = 30172.0; + ws[6] = ws[1] - 1077550.0; + ws[7] = smallerof( ws[6], 50000.0 ); + /* Divide by 50k and round to forth decimal place. */ + ws[8] = 0.0001 * (double)Round( 10000.0 * (ws[7] / 50000.0) ); + ws[9] = ws[5] * ws[8]; + ws[10] = ws[3] + ws[4] + ws[9]; + L[39] = ws[10]; +} + + +void worksheet10() /*Tax Computation Worksheet 10 (pg 49) */ +{ double ws[100]; + printf(" Doing Tax Computation Worksheet 10.\n"); + ws[1] = L[33]; + ws[2] = L[38]; + ws[3] = TaxRateFunction( ws[2], status ); + ws[4] = 32571.0; + ws[5] = 32500.0; + ws[6] = ws[1] - 5000000.0; + ws[7] = smallerof( ws[6], 50000.0 ); + /* Divide by 50k and round to forth decimal place. */ + ws[8] = 0.0001 * (double)Round( 10000.0 * (ws[7] / 50000.0) ); + ws[9] = ws[5] * ws[8]; + ws[10] = ws[3] + ws[4] + ws[9]; + L[39] = ws[10]; +} + + +void worksheet11() /*Tax Computation Worksheet 11 (pg 50) */ +{ double ws[100]; + printf(" Doing Tax Computation Worksheet 11.\n"); + ws[1] = L[38]; + ws[2] = 0.0109 * ws[1]; + L[39] = ws[2]; +} + + +void worksheet12() /*Tax Computation Worksheet 12 (pg 50) */ +{ double ws[100]; + printf(" Doing Tax Computation Worksheet 12.\n"); + ws[1] = L[33]; + ws[2] = L[38]; + ws[3] = 0.06 * ws[2]; + if (ws[1] >= 157650.0) + ws[9] = ws[3]; + else + { + ws[4] = TaxRateFunction( ws[2], status ); + ws[5] = ws[3] - ws[4]; + ws[6] = ws[1] - 107650.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 worksheet13() /*Tax Computation Worksheet 13 (pg 50) */ +{ double ws[100]; + printf(" Doing Tax Computation Worksheet 13.\n"); + ws[1] = L[33]; + ws[2] = L[38]; + ws[3] = TaxRateFunction( ws[2], status ); + ws[4] = 787.0; + ws[5] = 2289.0; + ws[6] = ws[1] - 269300.0; + ws[7] = smallerof( ws[6], 50000.0 ); + /* Divide by 50k and round to forth decimal place. */ + ws[8] = 0.0001 * (double)Round( 10000.0 * (ws[7] / 50000.0) ); + ws[9] = ws[5] * ws[8]; + ws[10] = ws[3] + ws[4] + ws[9]; + L[39] = ws[10]; +} + + +void worksheet14() /*Tax Computation Worksheet 14 (pg 51) */ +{ double ws[100]; + printf(" Doing Tax Computation Worksheet 14.\n"); + ws[1] = L[33]; + ws[2] = L[38]; + ws[3] = TaxRateFunction( ws[2], status ); + ws[4] = 3076.0; + ws[5] = 45261.0; + ws[6] = ws[1] - 1616450.0; + ws[7] = smallerof( ws[6], 50000.0 ); + /* Divide by 50k and round to forth decimal place. */ + ws[8] = 0.0001 * (double)Round( 10000.0 * (ws[7] / 50000.0) ); + ws[9] = ws[5] * ws[8]; + ws[10] = ws[3] + ws[4] + ws[9]; + L[39] = ws[10]; +} + + +void worksheet15() /*Tax Computation Worksheet 15 (pg 51) */ +{ double ws[100]; + printf(" Doing Tax Computation Worksheet 15.\n"); + ws[1] = L[33]; + ws[2] = L[38]; + ws[3] = TaxRateFunction( ws[2], status ); + ws[4] = 48337.0; + ws[5] = 32500.0; + ws[6] = ws[1] - 5000000.0; + ws[7] = smallerof( ws[6], 50000.0 ); + /* Divide by 50k and round to forth decimal place. */ + ws[8] = 0.0001 * (double)Round( 10000.0 * (ws[7] / 50000.0) ); + ws[9] = ws[5] * ws[8]; + ws[10] = ws[3] + ws[4] + ws[9]; + L[39] = ws[10]; +} + + +void worksheet16() /*Tax Computation Worksheet 16 (pg 50) */ +{ double ws[100]; + printf(" Doing Tax Computation Worksheet 16.\n"); + ws[1] = L[38]; + ws[2] = 0.109 * ws[1]; + L[39] = ws[2]; +} + + +void tax_computation_worksheet( int status ) /* Called for Line-39 when Line-33 > $107,650. */ +{ /* Worksheets from pages 45-50. Come here when AGI L[33] > $107,650. */ + switch (status) /* Updated for 2024. */ + { + case MARRIED_FILING_JOINTLY: case WIDOW: // 1-6 + if (L[33] <= 25000000.0) + { + if (L[38] <= 161550.0) + worksheet1(); + else + if ((L[33] > 161550.0) && (L[38] <= 323200.0)) + worksheet2(); + else + if ((L[33] > 323200.0) && (L[38] > 323200.0) && (L[38] <= 2155350.0)) + worksheet3(); + else + if ((L[33] > 215535.0) && (L[38] > 2155350.0) && (L[38] <= 5000000.0)) + worksheet4(); + else + if ((L[33] > 5000000.0) && (L[38] > 5000000.0)) + worksheet5(); + else + { + printf("AGI Case not handled.\n"); + fprintf(outfile,"AGI Case not handled. L33=%6.2f, L38=%6.2f\n", L[33], L[38] ); + exit(1); + } + } + else + worksheet6(); + break; + case SINGLE: case MARRIED_FILING_SEPARAT: // 7 - 11 + if (L[33] <= 25000000.0) + { + if (L[38] <= 215400.0) + worksheet7(); + else + if ((L[33] > 215535.0) && (L[38] <= 1077550.0)) + worksheet8(); + else + if ((L[33] > 107750.0) && (L[38] <= 5000000.0)) + worksheet9(); + else + if ((L[33] > 5000000.0) && (L[38] <= 5000000.0)) + worksheet10(); + else + { + printf("AGI Case not handled.\n"); + fprintf(outfile,"AGI Case not handled. L33=%6.2f, L38=%6.2f\n", L[33], L[38] ); + exit(1); + } + } + else + worksheet11(); + break; + case HEAD_OF_HOUSEHOLD: // 12-16 + + if (L[33] <= 25000000.0) + { + if (L[38] <= 269300.0) + worksheet12(); + else + if ((L[33] > 269300.0) && (L[38] <= 1616450.0)) + worksheet13(); + else + if ((L[33] > 1616450.0) && (L[38] <= 5000000.0)) + worksheet14(); + else + if ((L[33] > 5000000.0) && (L[38] > 5000000.0)) + worksheet15(); + else + { + printf("AGI Case not handled.\n"); + fprintf(outfile,"AGI Case not handled. L33=%6.2f, L38=%6.2f\n", L[33], L[38] ); + exit(1); + } + } + else + worksheet16(); + break; + default: printf("Case not handled.\n"); fprintf(outfile,"Case not handled.\n"); exit(1); + } +} + + +/*----------------------------------------------------------------------------*/ + +int main( int argc, char *argv[] ) +{ + int j, k, argk, day, month, yyyy, itemize=0, all_forms=0; + char word[1000], *infname=0, outfname[1000], *answ; + time_t now; + int Dependent, Exemptions, nyc_resident, L36=0; + double itemized_ded, std_ded=0.0, LTC=0, AddAdj=0.0, CollegeDed=0.0; + double form_IT196[MAX_LINES], form_IT196_16a=0.0, dedthresh; + double L54a=0.0, L54b=0.0, L54c=0.0, L54d=0.0, L54e=0.0; + char prelim_1040_outfilename[5000]; + char YourNames[2048]=""; + + /* Intercept any command-line arguments. */ + printf("NY-IT201 - 2011 - v%3.1f\n", thisversion); + argk = 1; k=1; + while (argk < argc) + { + if (strcmp(argv[argk],"-verbose")==0) verbose = 1; + else + if (strcmp(argv[argk],"-round_to_whole_dollars")==0) { round_to_whole_dollars = True; } + else + if (strcmp(argv[argk],"-allforms")==0) { all_forms = True; } /* Force printing of all form pages. */ + else + if (k==1) + { + infname = strdup(argv[argk]); + infile = fopen(argv[argk],"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", argv[argk]); exit(1);} + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname,argv[argk]); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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[argk]); exit(1);} + argk = argk + 1; + } + + if (infile==0) {printf("Error: No input file on command line.\n"); exit(1);} + + /* Pre-initialize all lines to zeros. */ + for (j=0; j 0.1) + { + printf(" Warning: L[17] = %6.2f, while Fed-line[9] = %6.2f\n", L[17], PrelimFedReturn.fedline[9] ); + fprintf(outfile," Warning: L[17] = %6.2f, while Fed-line[9] = %6.2f\n", L[17], PrelimFedReturn.fedline[9] ); + } + + // GetLineF( "L18", &L[18] ); /* Total federal adjustments to income (pg 14) */ + L[18] = PrelimFedReturn.sched[1][26]; + showline(18); + + L[19] = L[17] - L[18]; + showline_wmsg( 19, "Federal adjusted gross income" ); + + GetLineF( "L20", &L[20] ); /* Interest income from non-NY state or local bonds */ + + GetLineF( "L21", &L[21] ); /* Public employee retirement contributions (pg 15) */ + + GetLineF( "L22", &L[22] ); /* College choice tuition saving distributions */ + + GetLineF( "L23", &L[23] ); /* Other (pg 16) */ + + for (j = 19; j <= 23; j++) L[24] = L[24] + L[j]; + showline(24); + + L[25] = L[4]; /* Taxable refunds, credits, offsets */ + showline(25); + + GetLineF( "L26", &L[26] ); /* Pensions of NYS and local governments and the federal government (see page 16) */ + + L[27] = L[15]; /* Taxable amount of social security benefits */ + showline(27); + + GetLineF( "L28", &L[28] ); /* Interest income on U.S. government bonds */ + + GetLine( "L29", &L[29] ); /* Pension and annuity income exclusion */ + if (L[29] > 20000.0) + { + if (status == MARRIED_FILING_JOINTLY) + { + L[29] = smallerof( L[29], 40000.0 ); + showline_wmsg( 29, "(Limited to 40,000.)" ); + } + else + { + L[29] = smallerof( L[29], 20000.0 ); + showline_wmsg( 29, "(Limited to 20,000.)" ); + } + } + else + showline(29); + + GetLine( "L30", &L[30] ); /* College choice tuition savings deduction / earnings distributions */ + if (status == MARRIED_FILING_JOINTLY) + L[30] = smallerof( L[30], 10000.0 ); + else + L[30] = smallerof( L[30], 5000.0 ); + showline(30); + + GetLineF( "L31", &L[31] ); /* Other (see page 21) */ + + for (j=25; j <= 31; j++) + L[32] = L[32] + L[j]; + showline(32); + + L[33] = L[24] - L[32]; + showline_wmsg(33,"New York adjusted gross income (AGI)"); + + /* NYS Itemized Deductions - Form IT-196*/ + GetLine( "LTcare%", <C ); + GetLine( "AddAdj", &AddAdj ); + GetLine( "CollegeDed", &CollegeDed ); + + form_IT196[1] = PrelimFedReturn.schedA[1]; + form_IT196[2] = L[19]; + form_IT196[3] = 0.10 * form_IT196[2]; + form_IT196[4] = NotLessThanZero( form_IT196[1] - form_IT196[3] ); + form_IT196[5] = PrelimFedReturn.schedA5a; + form_IT196[6] = PrelimFedReturn.schedA5b; + form_IT196[7] = PrelimFedReturn.schedA5c; + form_IT196[8] = PrelimFedReturn.schedA[6]; + for (j=5; j <= 8; j++) + form_IT196[9] = form_IT196[9] + form_IT196[j]; + form_IT196[10] = PrelimFedReturn.schedA8a; + form_IT196[11] = PrelimFedReturn.schedA8b; + form_IT196[12] = PrelimFedReturn.schedA8c; + form_IT196[14] = PrelimFedReturn.schedA[9]; + for (j=10; j <= 14; j++) + form_IT196[15] = form_IT196[15] + form_IT196[j]; + form_IT196_16a = PrelimFedReturn.schedA[11]; + form_IT196[16] = form_IT196_16a; + form_IT196[17] = PrelimFedReturn.schedA[12]; + form_IT196[18] = PrelimFedReturn.schedA[13]; + for (j=16; j <= 18; j++) + form_IT196[19] = form_IT196[19] + form_IT196[j]; + form_IT196[20] = PrelimFedReturn.schedA[15]; + form_IT196[39] = PrelimFedReturn.schedA[16]; + + switch (status) /* Determine the Deduction Threshold (IT196 pg 18). */ + { + case WIDOW: + case MARRIED_FILING_JOINTLY: dedthresh = 338850.0; break; + case HEAD_OF_HOUSEHOLD: dedthresh = 310600.0; break; + case SINGLE: dedthresh = 282400.0; break; + case MARRIED_FILING_SEPARAT: + default: dedthresh = 169400.0; break; + } + + if (L[19] <= dedthresh) + { + form_IT196[40] = form_IT196[4] + form_IT196[9] + form_IT196[15] + form_IT196[19] + form_IT196[20] + + form_IT196[28] + form_IT196[39]; + fprintf(outfile,"Check_IT196_DedNotLimited = X\n"); + } + else + { double dedwksht[100]; /* Total itemized deductions worksheet. IT196instr pg 18. */ + fprintf(outfile,"Check_IT196_DedMaybeLimited = X\n"); + for (j=0; j< 100; j++) dedwksht[j] = 0.0; + dedwksht[1] = form_IT196[4] + form_IT196[9] + form_IT196[15] + form_IT196[19] + form_IT196[20] + + form_IT196[28] + form_IT196[39]; + dedwksht[2] = form_IT196[4] + form_IT196[14] + form_IT196_16a + form_IT196[20] + form_IT196[29] + + form_IT196[30] + form_IT196[37]; + if (dedwksht[2] < dedwksht[1]) + { + dedwksht[3] = dedwksht[1] - dedwksht[2]; + dedwksht[4] = 0.80 * dedwksht[3]; + dedwksht[5] = L[19]; + dedwksht[6] = dedthresh; + if (dedwksht[6] < dedwksht[5]) + { + dedwksht[7] = dedwksht[5] - dedwksht[6]; + dedwksht[8] = 0.03 * dedwksht[7]; + dedwksht[9] = smallerof( dedwksht[4], dedwksht[8] ); + dedwksht[10] = dedwksht[1] - dedwksht[9]; + form_IT196[40] = dedwksht[10]; + } + else + { /* Deduction not limited. */ + form_IT196[40] = dedwksht[1]; + } + } + else + { /* Deduction not limited. */ + form_IT196[40] = dedwksht[1]; + } + for (j=1; j <= 10; j++) + showline_wrksht_nz( " DedWrksht_", j, dedwksht ); + } + itemized_ded = form_IT196[40]; // Tentative only for now, finalized below. + + get_parameter( infile, 'l', word, "IT196_41 or L36" ); + if (strcmp( word, "IT196_41" ) == 0) + { + get_parameters( infile, 'f', &form_IT196[41], word ); + GetLine( "IT196_43", &form_IT196[43] ); + GetLine( "IT196_44", &form_IT196[44] ); + GetLine( "IT196_48", &form_IT196[48] ); + get_parameter( infile, 's', word, "L36" ); /* Number of Dependent Exemptions (Pg 76, line e) */ + } + + form_IT196[42] = form_IT196[40] - form_IT196[41]; + form_IT196[45] = form_IT196[42] + form_IT196[43] + form_IT196[44]; + if (L[33] > 100000.0) + { double ws[20]; + for (j=0; j<20; j++) ws[j] = 0.0; + if (L[33] < 475000.0) + { /*wrksheet3 - IT196-Pg20*/ + ws[1] = L[33]; + switch (status) + { + case SINGLE: + case MARRIED_FILING_SEPARAT: ws[2] = 100000.0; break; + case HEAD_OF_HOUSEHOLD: ws[2] = 150000.0; break; + case WIDOW: + case MARRIED_FILING_JOINTLY: ws[2] = 200000.0; break; + } + ws[3] = ws[1] - ws[2]; + if (ws[3] >= 0.0) + { + ws[4] = smallerof( ws[3], 50000.0 ); + ws[5] = 0.0001 * (double)Round( 10000.0 * (ws[4] / 50000.0) ); + ws[6] = 0.25 * form_IT196[45]; + ws[7] = ws[5] * ws[6]; + form_IT196[46] = ws[7]; + } + } /*wrksheet3 - IT196-Pg20*/ + else + if (L[33] < 525000.0) + { /*wrksheet4 - IT196-Pg20*/ + ws[1] = L[33] - 475000.0; + ws[2] = 0.0001 * (double)Round( 10000.0 * (ws[1] / 50000.0) ); + ws[3] = 0.25 * form_IT196[45]; + ws[4] = ws[2] * ws[3]; + ws[5] = ws[3] + ws[4]; + form_IT196[46] = ws[5]; + } /*wrksheet4 - IT196-Pg20*/ + else + if (L[33] < 1000000.0) + { + form_IT196[46] = 0.50 * form_IT196[45]; + } + else + if (L[33] < 10000000.0) + { /*wrksheet5 - IT196-Pg20*/ + ws[1] = form_IT196[45]; + ws[2] = 0.50 * form_IT196[19]; + ws[3] = ws[1] - ws[2]; + form_IT196[46] = ws[3]; + } /*wrksheet5 - IT196-Pg20*/ + else + { /*wrksheet6 - IT196-Pg20*/ + ws[1] = form_IT196[45]; + ws[2] = 0.25 * form_IT196[19]; + ws[3] = ws[1] - ws[2]; + form_IT196[46] = ws[3]; + } /*wrksheet6 - IT196-Pg20*/ + } + form_IT196[47] = form_IT196[45] - form_IT196[46]; + form_IT196[49] = form_IT196[47] + form_IT196[48]; + itemized_ded = form_IT196[49]; + + for (j=1; j <= 16; j++) /* Display the IT196 lines. */ + showline_wrksht_nz( "IT196_", j, form_IT196 ); + fprintf(outfile,"IT196_16a = %6.2f\n", form_IT196_16a ); + fprintf(outfile," (Note: IT-196 Line-16 assumes Gifts are all qualified contributions.)\n"); + for (j=17; j <= 49; j++) /* Display remaining IT196 lines. */ + showline_wrksht_nz( "IT196_", j, form_IT196 ); + + + + switch (status) /* Determine the Std. Deduction. Instructions Pg. 11. */ + { + case SINGLE: if (Dependent) std_ded = 3100.0; + else std_ded = 8000.0; /* Updated for 2024. */ + break; + case MARRIED_FILING_JOINTLY: std_ded = 16050.0; break; + case MARRIED_FILING_SEPARAT: std_ded = 8000.0; break; + case HEAD_OF_HOUSEHOLD: std_ded = 11200.0; break; + case WIDOW: std_ded = 16050.0; break; + } + + if (std_ded > itemized_ded) + { + L[34] = std_ded; + fprintf(outfile,"Check_Std = X\n"); + showline_wmsg(34,"(Mark Std-deduction)"); + itemize = False; + } + else + { + L[34] = itemized_ded; + fprintf(outfile,"Check_Item = X\n"); + showline_wmsg(34,"(Mark Itemized-deduction)"); + itemize = True; + } + + if ((itemize) || (all_forms)) + { + fprintf(outfile,"PDFpage: 5 5\n"); + fprintf(outfile,"EndPDFpage.\n"); + fprintf(outfile,"PDFpage: 6 6\n"); + fprintf(outfile,"EndPDFpage.\n"); + fprintf(outfile,"PDFpage: 7 7\n"); + fprintf(outfile,"EndPDFpage.\n"); + } + + L[35] = L[33] - L[34]; + if (L[35] < 0.0) L[35] = 0.0; + else showline(35); + + // get_parameter( infile, 's', word, "L36" ); /* Number of Dependent Exemptions (Pg 76, line e) */ + get_parameters( infile, 'i', &L36, "L36" ); + if (L36 > 0) + fprintf(outfile, "L36_entry %d\n", L36 ); + L[36] = 1000.0 * (double)L36; + showline(36); + + L[37] = L[35] - L[36]; + if (L[37] < 0.0) + L[37] = 0.0; + showline_wmsg(37,"taxable income"); + L[38] = L[37]; + showline(38); + + if (L[33] <= 107650.0) + L[39] = TaxRateLookup( L[38], status ); + else + tax_computation_worksheet( status ); + showline(39); + Report_bracket_info( L[38], L[39], status ); + + /* Household credit. */ + get_parameter( infile, 's', word, "Exemptions" ); /* NY dependent exemptions, Pgs 15-16. */ + get_parameter( infile, 'i', &Exemptions, "Exemptions" ); + if (Dependent) + L[40] = 0.0; + else /* From tables starting on page 22. */ + if (status==SINGLE) + { + if (L[19] < 5000.0) L[40] = 75.0; else + if (L[19] < 6000.0) L[40] = 60.0; else + if (L[19] < 7000.0) L[40] = 50.0; else + if (L[19] < 20000.0) L[40] = 45.0; else + if (L[19] < 25000.0) L[40] = 40.0; else + if (L[19] < 28000.0) L[40] = 20.0; else L[40] = 0.0; + } + else /* Status = MARRIED_FILING_JOINTLY, MARRIED_FILING_SEPARAT, Head_of_house, Widow */ + if (status!=MARRIED_FILING_SEPARAT) + { + if (L[19] < 5000.0) L[40] = 90.0 + 15.0 * (Exemptions-1); else + if (L[19] < 6000.0) L[40] = 75.0 + 15.0 * (Exemptions-1); else + if (L[19] < 7000.0) L[40] = 65.0 + 15.0 * (Exemptions-1); else + if (L[19] < 20000.0) L[40] = 60.0 + 15.0 * (Exemptions-1); else + if (L[19] < 22000.0) L[40] = 60.0 + 10.0 * (Exemptions-1); else + if (L[19] < 25000.0) L[40] = 50.0 + 10.0 * (Exemptions-1); else + if (L[19] < 28000.0) L[40] = 40.0 + 5.0 * (Exemptions-1); else + if (L[19] < 32000.0) L[40] = 20.0 + 5.0 * (Exemptions-1); else L[40] = 0.0; + } + else + { + if (L[19] < 5000.0) L[40] = 45.0 + 8.0 * (Exemptions-1); else + if (L[19] < 6000.0) L[40] = 37.5 + 8.0 * (Exemptions-1); else + if (L[19] < 7000.0) L[40] = 32.5 + 8.0 * (Exemptions-1); else + if (L[19] < 20000.0) L[40] = 30.0 + 8.0 * (Exemptions-1); else + if (L[19] < 22000.0) L[40] = 30.0 + 5.0 * (Exemptions-1); else + if (L[19] < 25000.0) L[40] = 25.0 + 5.0 * (Exemptions-1); else + if (L[19] < 28000.0) L[40] = 20.0 + 3.0 * (Exemptions-1); else + if (L[19] < 32000.0) L[40] = 10.0 + 3.0 * (Exemptions-1); else L[40] = 0.0; + } + showline_wmsg(40,"NY state household credit"); /* NY state household credit, (pg 29). */ + + GetLineF( "L41", &L[41] ); /* Resident credit, Form IT-112-R or IT-112-C, pg 98 */ + + GetLineF( "L42", &L[42] ); /* Other New York State nonrefundable credits */ + + L[43] = L[40] + L[41] + L[42]; + showline(43); + + L[44] = L[39] - L[43]; + if (L[44] < 0.0) L[44] = 0.0; + else showline(44); + + GetLineF( "L45", &L[45] ); /* Net Other New York State taxes, Form IT-201-ATT, line 30 */ + + L[46] = L[44] + L[45]; + showline_wmsg(46,"Total New York State taxes"); + + get_parameter( infile, 's', word, "NYC_Resident" ); + get_parameters( infile, 'b', &nyc_resident, "NYC_Resident (yes/no) ?"); + + GetLine( "L50", &L[50] ); /* Part-year New York City resident tax */ + GetLine( "L51", &L[51] ); /* Other New York City taxes */ + GetLine( "L53", &L[53] ); /* NY City nonrefundable credits */ + + GetLine( "L54a", &L54a ); /* MCTMT net earnings base for Zone 1 */ + GetLine( "L54b", &L54b ); /* MCTMT net earnings base for Zone 2 */ + GetLine( "L54c", &L54c ); /* MCTMT for Zone 1 */ + GetLine( "L54d", &L54d ); /* MCTMT for Zone 2 */ + GetLine( "L55", &L[55] ); /* Yonkers resident income tax surcharge */ + GetLine( "L56", &L[56] ); /* Yonkers non-resident earnings tax (Form &-203) */ + GetLine( "L57", &L[57] ); /* Part-year Yonkers resident income tax surcharge */ + + if (nyc_resident) + { /*NYC*/ + + /* TODO - see page 23. should adjust for itemized charitable deductions */ + L[47] = L[38]; /* NYC taxable income */ + showline(47); + + L47a = NYcityTaxRateFunction( L[47], status ); /* NYC resident tax */ + showline_wlabel( "L47a", L47a ); + + /* NYC Household credit. */ + if (Dependent) L[48] = 0.0; + else + if (status==SINGLE) /* From table 4, 5, or 6 on page 30. */ + { + if (L[19] < 10000.0) L[48] = 15.0; else + if (L[19] < 12500.0) L[48] = 10.0; else L[48] = 0.0; + } + else /* Status = 2, 4, or 5. */ + if (status!=MARRIED_FILING_SEPARAT) + { + if (L[19] < 15000.0) L[48] = 30.0 * Exemptions; else + if (L[19] < 17500.0) L[48] = 25.0 * Exemptions; else + if (L[19] < 20000.0) L[48] = 15.0 * Exemptions; else + if (L[19] < 22500.0) L[48] = 10.0 * Exemptions; else L[48] = 0.0; + } + else + { + if (L[19] < 15000.0) L[48] = 15.0 * Exemptions; else + if (L[19] < 17500.0) L[48] = 13.0 * Exemptions; else + if (L[19] < 20000.0) L[48] = 8.0 * Exemptions; else + if (L[19] < 22500.0) L[48] = 5.0 * Exemptions; else L[48] = 0.0; + } + showline_wmsg(48,"NY City household credit"); /* NY City household credit, (pg 34). */ + + L[49] = L47a - L[48]; + if (L[49] > 0.0) + showline(49); + else + L[49] = 0.0; + + showline(50); + showline(51); + + L[52] = L[49] + L[50] + L[51]; + showline(52); + showline(53); + + L[54] = L[52] - L[53]; + if (L[54] > 0.0) + showline(54); + else + L[54] = 0.0; + + showline_wlabelnz( "L54a", L54a ); /* MCTMT net earnings base for Zone 1 */ + showline_wlabelnz( "L54b", L54b ); /* MCTMT net earnings base for Zone 2 */ + showline_wlabelnz( "L54c", L54c ); /* MCTMT for Zone 1 */ + showline_wlabelnz( "L54d", L54d ); /* MCTMT for Zone 2 */ + L54e = L54a + L54b + L54c + L54d; + showline_wlabelnz( "L54e", L54e ); + + /* Yonkers case. */ + ShowLineNonZero( 55 ); /* Yonkers resident income tax surcharge */ + ShowLineNonZero( 56 ); /* Yonkers non-resident earnings tax (Form &-203) */ + ShowLineNonZero( 57 ); /* Part-year Yonkers resident income tax surcharge */ + + L[58] = L[54] + L54e + L[55] + L[56] + L[57]; + showline_wmsg(58,"NYC taxes"); + } /*NYC*/ + + GetLine( "L59", &L[59] ); /* Sales or use tax, see pg 29. */ + showline( 59 ); /* Force display even if zero. */ + + GetLineF( "L60", &L[60] ); /* Voluntary Gift contibutions (pgs 30). */ + + L[61] = L[46] + L[58] + L[59] + L[60]; + showline(61); + + L[62] = L[61]; + showline(62); + + GetLineF( "L63", &L[63] ); /* Empire State child credit (attach new Form IT-213) */ + + GetLineF( "L64", &L[64] ); /* NYS/NYC Child care/dependent credit. Form IT-216. */ + + GetLineF( "L65", &L[65] ); /* NYS Earned income credit. Form IT-213. */ + + GetLineF( "L66", &L[66] ); /* NYS State noncustodial parent EIC (attach new Form IT-209) */ + + GetLineF( "L67", &L[67] ); /* Real property credit. Form IT-214. */ + + GetLineF( "L68", &L[68] ); /* College tution credit. Form IT-272. */ + + if (nyc_resident) /* City of NY school taxcredit. (pg 26) */ + { /*NYC*/ + if (Dependent) L[69] = 0.0; + else + if (L[19] < 250000) + { + if ((status==SINGLE) || (status==MARRIED_FILING_SEPARAT) || (status==HEAD_OF_HOUSEHOLD)) L[69] = 63.0; else + if ((status==MARRIED_FILING_JOINTLY) || (status==WIDOW)) L[69] = 125.0; + } + else + L[69] = 0.0; + showline(69); + + if (Dependent) + { + L69a = 0.0; + } + else + if (L[47] > 500000) + { + L69a = 0.0; + } + else + if ((status==SINGLE) || (status==MARRIED_FILING_SEPARAT)) + { + if (L[47] < 12000) + L69a = L[47] * 0.00171; + else + L69a = (L[47] - 12000) * 0.00228 + 21; + } + else + if (status==HEAD_OF_HOUSEHOLD) + { + if (L[47] < 14400) + L69a = L[47] * 0.00171; + else + L69a = (L[47] - 14400) * 0.00228 + 25; + } + else + if ((status==MARRIED_FILING_JOINTLY) || (status==WIDOW)) + { + if (L[47] < 21600) + L69a = L[47] * 0.00171; + else + L69a = (L[47] - 21600) * 0.00228 + 37; + } + else + { + L69a = 0.0; + } + + showline_wlabel( "L69a", L69a ); + + /* L[70] = earned_income_credit; */ + /* showline(70); */ + } /*NYC*/ + + GetLineF( "L71", &L[71] ); /* Other refundable credits, IT-201-ATT line 18) */ + + GetLineF( "L72", &L[72] ); /* Total NY State tax withheld. */ + + GetLineF( "L73", &L[73] ); /* Total City of NY tax withheld. */ + GetLineF( "L74", &L[74] ); /* Yonkers tax withheld. */ + + GetLineF( "L75", &L[75] ); /* Total estimated tax payments (from IT-370)*/ + + for (j = 63; j <= 75; j++) L[76] = L[76] + L[j]; + L[76] += L69a; + + showline(76); + + if (L[76] > L[62]) + { + L[77] = L[76] - L[62]; + fprintf(outfile,"L77 = %6.2f REFUND !!!\n", L[77] ); + L[78] = L[77]; + showline(78); + } + else + { + L[80] = L[62] - L[76]; + fprintf(outfile,"L80 = %6.2f DUE !!!\n", L[80] ); + fprintf(outfile," (Which is %2.1f%% of your total tax.)\n", 100.0 * L[80] / (L[62] + 1e-9) ); + } + + + + + if (Your1stName) + fprintf(outfile,"Your1stName: %s\n", Your1stName ); + if (YourInitial) + fprintf(outfile,"YourInitial: %s\n", YourInitial ); + if (YourLastName) + fprintf(outfile,"YourLastName: %s\n", YourLastName ); + if (YourSocSec) + fprintf(outfile,"YourSocSec#: %s\n", YourSocSec ); + if (Spouse1stName) + fprintf(outfile,"Spouse1stName: %s\n", Spouse1stName ); + if (SpouseInitial) + fprintf(outfile,"SpouseInitial: %s\n", SpouseInitial ); + if (SpouseLastName) + fprintf(outfile,"SpouseLastName: %s\n", SpouseLastName ); + if (SpouseSocSec) + fprintf(outfile,"SpouseSocSec#: %s\n", SpouseSocSec ); + if (MailAddress) + fprintf(outfile,"Number&Street: %s\n", MailAddress ); + if (AptNumber) + fprintf(outfile,"Apt#: %s\n", AptNumber ); + if (Town[0] != '\0') + fprintf(outfile,"Town: %s\n", Town ); + if (StateName[0] != '\0') + fprintf(outfile,"StateName: %s\n", StateName ); + if (Zipcode[0] != '\0') + fprintf(outfile,"Zipcode: %s\n", Zipcode ); + + consume_leading_trailing_whitespace( YourLastName ); + if (strlen( YourLastName ) > 0) + { + strcpy( YourNames, YourLastName ); + strcat( YourNames, ", " ); + strcat( YourNames, Your1stName ); + consume_leading_trailing_whitespace( YourInitial ); + if (YourInitial[0] != '\0') + { + strcat( YourNames, ", " ); + strcat( YourNames, YourInitial ); + } + consume_leading_trailing_whitespace( Spouse1stName ); + if (Spouse1stName[0] != '\0') + { + strcat( YourNames, ", " ); + if ((SpouseLastName[0] != '\0') && (strcmp( YourLastName, SpouseLastName ) != 0)) + { + strcat( YourNames, SpouseLastName ); + strcat( YourNames, ", " ); + } + strcat( YourNames, Spouse1stName ); + if (SpouseInitial[0] != '\0') + { + strcat( YourNames, ", " ); + strcat( YourNames, SpouseInitial ); + } + } + fprintf(outfile,"YourNames: %s\n", YourNames ); + } + + for (j=1; j <= nDeps; j++) + { + fprintf(outfile,"H%d_Name1st: %s\n", j, Dep_info[j].Name1st ); + fprintf(outfile,"H%d_NameLst: %s\n", j, Dep_info[j].NameLst ); + fprintf(outfile,"H%d_SocSec: %s\n", j, Dep_info[j].SocSec ); + fprintf(outfile,"H%d_Relat: %s\n", j, Dep_info[j].Relat ); + } + + fclose(infile); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + printf("\nListing results from file: %s\n\n", outfname); + Display_File( outfname ); + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_OH_IT1040_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_OH_IT1040_2024.c new file mode 100755 index 0000000..5caa147 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_OH_IT1040_2024.c @@ -0,0 +1,458 @@ +/************************************************************************/ +/* TaxSolve_OH_IT1040_2024.c - */ +/* Copyright (C) 2025 - Aston Roberts */ +/* */ +/* Compile: gcc taxsolve_OH_IT1040_2024.c -o taxsolve_OH_IT1040_2024 */ +/* Run: ./taxsolve_OH_IT1040_2024 OH_IT1040_2024.txt */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ +/* */ +/* Aston Roberts 1-2-2025 aston_roberts@yahoo.com */ +/************************************************************************/ + +#include +#include + +#include "taxsolve_routines.c" + +double thisversion=22.01; + +#define SINGLE 1 +#define MARRIED_FILING_JOINTLY 2 +#define MARRIED_FILING_SEPARAT 3 +#define HEAD_OF_HOUSEHOLD 1 + +double TaxRateFunction( double x, int status ) +{ /* Updated for 2024. */ + if (x <= 26050.0) return 0.0; else + if (x <= 100000.0) return 360.69 + (x-26050.0) * 0.0275; + else return 2394.32 + (x-100000.0) * 0.035; +} + + +void Report_bracket_info( double income, double tx, int status ) +{ /* Updated for 2024. */ + double rate; + if (income <= 26050.0) rate = 0.0; else + if (income < 100000.0) rate = 0.0275; + else rate = 0.0350; + printf(" You are in the %2.1f%% marginal tax bracket,\n and you are paying an effective %2.1f%% tax on your total income.\n", + 100.0 * rate, 100.0 * tx / income ); + fprintf(outfile," You are in the %2.1f%% marginal tax bracket,\n and you are paying an effective %2.1f%% tax on your total income.\n", + 100.0 * rate, 100.0 * tx / income ); +} + + +char *pull_initial( char *name ) +{ /* Expect names like: "John, D.", and pull initial out. */ + int j=0; + char midinitial[10]; + while ((name[j] != '\0') && (name[j] != ',')) + j++; + if (name[j] == ',') + { + name[j++] = '\0'; + while ((name[j] != '\0') && (isspace( name[j] ))) + j++; + midinitial[0] = name[j]; + midinitial[1] = '\0'; + } + else + strcpy( midinitial, "" ); + return strdup( midinitial ); +} + + +/*----------------------------------------------------------------------------*/ + +int main( int argc, char *argv[] ) +{ + int j, k, mm; + char word[4000], *infname=0, outfname[4000], label[90], *socsec, *pname, *MidInit; + int status=0, exemptions=0, qualify_jfc=0; + time_t now; + double L2a, L2b, L7a, L8a, L8b, L8c; + double jfc=0.0, exemption_amnt; + double SchedA[MAX_LINES], SchedC[MAX_LINES]; + + /* Intercept any command-line arguments. */ + printf("OH IT1040 2024 - v%3.1f\n", thisversion); + mm = 1; k=1; + while (mm < argc) + { + if (strcmp(argv[mm],"-verbose")==0) verbose = 1; + else + if (k==1) + { + infname = strdup(argv[mm]); + infile = fopen(argv[mm],"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", argv[mm]); exit(1);} + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname,argv[mm]); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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[mm]); exit(1);} + mm++; + } + + if (infile==0) {printf("Error: No input file on command line.\n"); exit(1);} + + /* Pre-initialize all lines to zeros. */ + for (mm=0; mm= L[20]) + { + L[21] = L[13] - L[20]; + L[23] = L[21] + L[22]; /* TOTAL AMOUNT DUE */ + } + else + { + L[24] = L[20] - L[13]; /* Overpayment */ + L[27] = L[24]; + } + + if ((L[1] < 26050.0) && (L[3] < 0.0)) /* Min2File. */ + fprintf(outfile, "You do not need to file Ohio tax return (Fed AGI < minimum).\n"); + + if ((L[1] < 26050.0) && (L[4] >= L[3])) + fprintf(outfile, "You do not need to file Ohio tax return (L[4] >= L[3]).\n"); + + + /* Output the Results. */ + + showline(1); + showline_wlabel( "L2a", L2a ); + showline_wlabel( "L2b", L2b ); + showline(3); + showline(4); + fprintf(outfile," Exemptions = %d\n", exemptions ); + showline(5); + showline(6); + showline(7); + showline_wlabel( "L7a", L[7] ); + showline_wlabel( "L8a", L8a ); + showline_wlabel( "L8b", L8b ); + showline_wlabel( "L8c", L8c ); + for (j = 9; j <= 12; j++) + showline(j); + showline_wmsg( 13, "Total Ohio tax liability" ); + Report_bracket_info( L[7], L[13], status ); + showline_wmsg( 14, "Ohio income tax withheld" ); + for (j = 15; j <= 17; j++) + showline(j); + showline_wmsg( 18, "Total Ohio tax payments" ); + for (j = 19; j <= 20; j++) + showline(j); + if (L[13] >= L[20]) + { + showline(21); + showline(22); + showline_wmsg( 23, "TOTAL AMOUNT DUE !!!" ); + fprintf(outfile," (Which is %2.1f%% of your total tax.)\n", 100.0 * L[23] / (L[13] + 1e-9) ); + } + else + { + showline_wmsg( 24, "Overpayment" ); + showline_wmsg( 27, "YOUR REFUND !!!" ); + } + + fprintf(outfile,"\n-- 2024 Ohio Schedule A --\n"); + for (j = 1; j <= 46; j++) + { + sprintf( label, "SchedA%d", j ); + showline_wlabel( label, SchedA[j] ); + } + + fprintf(outfile,"\n-- 2024 Ohio Schedule of Credits --\n"); + for (j = 1; j <= 11; j++) + { + sprintf( label, "Credits%d", j ); + showline_wlabel( label, SchedC[j] ); + } + if (jfc > 0.0) + fprintf(outfile,"JFC = %d\n", (int)(100.0 * jfc + 0.25) ); + for (j = 12; j <= 46; j++) + { + sprintf( label, "Credits%d", j ); + showline_wlabel( label, SchedC[j] ); + } + + fprintf(outfile,"\n{ --------- }\n"); + pname = GetTextLine( "Your1stName:" ); + MidInit = pull_initial( pname ); + fprintf(outfile,"Your1stName: %s\n", pname ); + fprintf(outfile,"YourMidInit: %s\n", MidInit ); + GetTextLineF( "YourLastName:" ); + writeout_line = 0; + socsec = GetTextLine( "YourSocSec#:" ); + format_socsec( socsec, 0 ); + fprintf(outfile,"YourSocSec#: %s\n", socsec ); + free( socsec ); + writeout_line = 1; + pname = GetTextLine( "Spouse1stName:" ); + MidInit = pull_initial( pname ); + fprintf(outfile,"Spouse1stName: %s\n", pname ); + fprintf(outfile,"SpouseMidInit: %s\n", MidInit ); + GetTextLineF( "SpouseLastName:" ); + writeout_line = 0; + socsec = GetTextLine( "SpouseSocSec#:" ); + format_socsec( socsec, 0 ); + if (status != MARRIED_FILING_SEPARAT) + fprintf(outfile,"SpouseSocSec#: %s\n", socsec ); + else + fprintf(outfile,"SpouseSocSec#Sep: %s\n", socsec ); + free( socsec ); + writeout_line = 1; + GetTextLineF( "Number&Street:" ); + GetTextLineF( "Town:" ); + fprintf(outfile,"State: OH\n"); + GetTextLineF( "Zipcode:" ); + GetTextLineF( "AddressLine2:" ); + GetTextLineF( "OhioCounty:" ); + + fprintf(outfile,"CkFYrRes: X\n"); + if (status == MARRIED_FILING_JOINTLY) + fprintf(outfile,"CkFYrResSp: X\n"); + + fclose(infile); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + Display_File( outfname ); + printf("\nResults written to file: %s\n", outfname); + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_OR_40_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_OR_40_2024.c new file mode 100755 index 0000000..88a6c5c --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_OR_40_2024.c @@ -0,0 +1,1509 @@ +/************************************************************************/ +/* taxsolve_OR_40.c - */ +/* Contributed by Rylan Luke, 3/2025 */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA. */ +/* */ +/************************************************************************/ + +// NOTE: Search for TAXYEAR_DEPENDENT to find likely entries +// which need to be updated for each tax year. + +float thisversion=1.00; + +#include +#include +#include +#include +#include +#include +#include + +#define MIN(i, j) (((i) < (j)) ? (i) : (j)) +#define MAX(i, j) (((i) > (j)) ? (i) : (j)) + +#include "taxsolve_routines.c" + +// Arrays of TAX_TABLE entries are terminated with start = -1. +// Incrementing start values in array are required. +typedef struct TAX_TABLE { + double start; // Start of range definition; end is defined by next 'start' in array. + double rate; // Marginal percentage rate for this interval +} TAX_TABLE, *P_TAX_TABLE; + +// TAXYEAR_DEPENDENT + +// Tax breakpoint table for single or married filing separately. +TAX_TABLE or_40_single_tax_table[] = { + { 0.00, 0.0475 }, + { 4300.00, 0.0675 }, + { 10750.00, 0.0875 }, + { 125000.00, 0.0990 }, + { -1.00, 0.00 }, +}; + +// Tax breakpoint table for married/joint, head of household, surviving spouse +TAX_TABLE or_40_joint_tax_table[] = { + { 0.00, 0.0475 }, + { 8600.00, 0.0675 }, + { 21500.00, 0.0875 }, + { 250000.00, 0.0990 }, + { -1.00, 0.00 }, +}; + +double TaxFunction(double val, P_TAX_TABLE p_tax_table) { + double retval; + retval = 0.0; + while (p_tax_table->start != -1.00) { + // Find row corresponding to the input value + + // Get next start value; -1.00 means end so inhibit upper bound comparison + double next_start = (p_tax_table + 1)->start; + + // At the same time, calculate a cumulative value. Round to nearest whole dollar each time + // Only include from 'start' to the lower of the current value, or the next start + double incr; + double eval; + if (next_start == -1.00) { + eval = val; + } else { + eval = MIN(val, next_start); + } + incr = (eval - p_tax_table->start) * p_tax_table->rate; + + // First round the increment to the nearest cent, and then to the nearest dollar, + // to match method of calculation used in the Oregon tax table generation. + incr = round(100.0 * incr) / 100.0; // to nearest cent + incr = round(incr); // to nearest dollar + + retval += incr; + // printf("TaxFunction: val: %6.2f, incr: %6.2f, retval: %6.4f, next_start: %6.2f, start: %6.2f, rate: %6.2f\n", + // val, incr, retval, next_start, p_tax_table->start, p_tax_table->rate); + + // Check for proper range, and halt if found. If the next_start is -1, don't do the upper bound comparison + if (val >= p_tax_table->start && ((next_start == -1.0) || val < next_start)) + break; + + // Go to next line in tax table + ++p_tax_table; + } + return retval; +} + +// Tax table only spans up to this limit. +const double TAX_TABLE_LIMIT = 50000.00; + +// Primary tax function, which looks up tax from the tax table if appropriate, +// or uses the generalized tax function if over the tax table limit. The table +// quantizes a range of values into a single, midpoint value, and the tax for +// the range is calculated based on the midpoint value. The first three ranges +// are 0 to 20 (mid = 10), 20 to 50 (mid = 35), and 50 to 100 (mid = 75). +// Subsequent values are every 100, with a midpoint of 50 in each span. + +double TaxLookup(double val, P_TAX_TABLE p_tax_table) { + + double table_input_val; + if (val < 20) { + table_input_val = 10; + } else if (val < 50) { + table_input_val = 35; + } else if (val < 100) { + table_input_val = 75; + } else if (val < TAX_TABLE_LIMIT) { + table_input_val = (((int)val / 100) * 100) + 50; + } else { + table_input_val = val; + } + + double tax; + tax = TaxFunction(table_input_val, p_tax_table); + // printf("TaxLookup: val: %6.2f, table_input_val: %6.2f, tax: %6.2f\n", val, table_input_val, tax ); + return tax; +} +// Return the marginal tax rate +double TaxRate(double val, P_TAX_TABLE p_tax_table) { + while (p_tax_table->start != -1.00) { + + // Get next start value; -1.00 means end so inhibit upper bound comparison + double next_start = (p_tax_table + 1)->start; + + if (val >= p_tax_table->start && ((next_start == -1.0) || val < next_start)) + return p_tax_table->rate; + + // Go to next line in tax table + ++p_tax_table; + } + // Shouldn't get here, but return something + return 0.0; +} + +typedef struct LIMIT_TABLE { + double start; // This is the start of the range for the associated limit. End is defined by next 'start' value in array. + double limit; // This sets a maximum limit for some output value +} LIMIT_TABLE, *P_LIMIT_TABLE; + +// TAXYEAR_DEPENDENT + +// Single limit for fed tax subtraction +LIMIT_TABLE or_40_single_fed_sub_table[] = { + { 0, 8250 }, + { 125000, 6600 }, + { 130000, 4950 }, + { 135000, 3300 }, + { 140000, 1650 }, + { 145000, 0 }, + { -1, 0 }, +}; + +// Married/sep limit for fed tax subtraction +LIMIT_TABLE or_40_m_sep_fed_sub_table[] = { + { 0, 4125 }, + { 125000, 3300 }, + { 130000, 2475 }, + { 135000, 1650 }, + { 140000, 825 }, + { 145000, 0 }, + { -1, 0 }, +}; + +// Used for all other cases except single, and married filing separately: +// married/joint, head of household, and widow +LIMIT_TABLE or_40_other_fed_sub_table[] = { + { 0, 8250 }, + { 250000, 6600 }, + { 260000, 4950 }, + { 270000, 3300 }, + { 280000, 1650 }, + { 290000, 0 }, + { -1, 0 }, +}; + + + +// Returns a limit value based on an input variable. How the limit is used is up to the caller. +double GetLimit(double val, P_LIMIT_TABLE p_lim_table) { + + // Find row corresponding to the input val + while (p_lim_table->start != -1.00) { + // Get next start value; -1.00 means end so inhibit upper bound comparison + double next_start = (p_lim_table + 1)->start; + + // printf("GetLimit: val: %6.2f, start: %6.2f, next_start: %6.2f, limit: %6.2f\n", + // val, p_lim_table->start, next_start, p_lim_table->limit); + + // Check for proper range, and halt if found. If the next_start is -1, don't do the upper bound comparison + if (val >= p_lim_table->start && ((next_start == -1.0) || val < next_start)) + break; + + // Go to next line in limit table + ++p_lim_table; + } + + return p_lim_table->limit; +} + +// Associative structure for filing status and various limits and tax tables +typedef struct FILING_STATUS_CFG { + char *status_match_string; + char *status_label; + char *checkbox_name; + P_TAX_TABLE p_tax_table; + P_LIMIT_TABLE p_fed_liability_limit; + double std_deduction; + double extra_std_deduction; + double exemption_credit_limit; + double income_and_property_tax_deduction_limit; +} FILING_STATUS_CFG, *P_FILING_STATUS_CFG; + +// TAXYEAR_DEPENDENT +FILING_STATUS_CFG status_cfg[] = { + { "SINGLE", "Single", "CkSingle", or_40_single_tax_table, or_40_single_fed_sub_table, 2745.00, 1200.00, 100000.00, 10000.0 }, + { "MARRIED/JOINT", "Married/Joint", "CkMFJ", or_40_joint_tax_table, or_40_other_fed_sub_table, 5495.00, 1000.00, 200000.00, 10000.0 }, + { "MARRIED/SEP", "Married/Separate", "CkMFS", or_40_single_tax_table, or_40_m_sep_fed_sub_table, 2745.00, 1000.00, 100000.00, 5000.0 }, + { "HEAD_OF_HOUSE", "Head of Household", "CkHH", or_40_joint_tax_table, or_40_other_fed_sub_table, 4420.00, 1200.00, 200000.00, 10000.0 }, + { "WIDOW", "Surviving Spouse", "CkQW", or_40_joint_tax_table, or_40_other_fed_sub_table, 5495.00, 1000.00, 200000.00, 10000.0 }, + { "", NULL, "", NULL, NULL, 0.00, 0.00, 0.0, 0.0 }, +}; + +// These constants do not vary with filing status +const double EXEMPTION_CREDIT_DISABILITY_LIMIT = 100000.00; +const double EXEMPTION_CREDIT = 249.0; + +//Get status configuration based on filing status match string, as capitalized from the f1040 import, and return it. +P_FILING_STATUS_CFG get_status_cfg(char *status) { + P_FILING_STATUS_CFG p_cfg; + p_cfg = status_cfg; + while (strlen(p_cfg->status_match_string) > 0) { + if (strstr(status, p_cfg->status_match_string) != NULL) + return p_cfg; + ++p_cfg; + } + return NULL; +} + + +//====== Form 1040 Import ====== +// Imported form data; add elements as needed, using the same variable name as in the imported form label for clarity. +// Also update 'f1040_imp_defs' to add mapping. +typedef struct FED_1040_IMP_OR_40 { + double L6b; // Taxable social security benefits + double L11; // AGI (Adjusted gross income) + double L22; // Total tax before "other taxes, including self-employment tax" + double S2_1a; // Excess advance premium tax credit repayment + double S2_8; // Additional tax on IRAs or other tax-favored accounts + double S2_16; // Recapture of low-income housing credit + double S2_10; // Repayment of first-time homebuyer credit + double L29; // American Opportunity credit + char *Status; + char *Your1stName; + char *YourLastName; + char *YourSocSec; + char *Spouse1stName; + char *SpouseLastName; + char *SpouseSocSec; + char *NumberStreet; + char *Apt; + char *City; + char *State; + char *ZipCode; + char *Dep1FirstName; + char *Dep1LastName; + char *Dep1SocSec; + char *Dep2FirstName; + char *Dep2LastName; + char *Dep2SocSec; + char *Dep3FirstName; + char *Dep3LastName; + char *Dep3SocSec; + +} FED_1040_IMP_OR_40, P_FED_1040_IMP_OR_40; + +FED_1040_IMP_OR_40 f1040i; + +// Mapping from label name to address of local data struct element; either double or char* +static FORM_IMPORT_DEF f1040_imp_defs[] = { + { "L6b", &f1040i.L6b, NULL }, + { "L11", &f1040i.L11, NULL }, + { "L22", &f1040i.L22, NULL }, + { "L29", &f1040i.L29, NULL }, + { "S2_1a", &f1040i.S2_1a, NULL }, + { "S2_8", &f1040i.S2_8, NULL }, + { "S2_10", &f1040i.S2_10, NULL }, + { "S2_16", &f1040i.S2_16, NULL }, + { "Status", NULL, &f1040i.Status }, + { "Your1stName:", NULL, &f1040i.Your1stName }, + { "YourLastName:", NULL, &f1040i.YourLastName }, + { "YourSocSec#:", NULL, &f1040i.YourSocSec }, + { "Spouse1stName:", NULL, &f1040i.Spouse1stName }, + { "SpouseLastName:", NULL, &f1040i.SpouseLastName }, + { "SpouseSocSec#:", NULL, &f1040i.SpouseSocSec }, + { "Number&Street:", NULL, &f1040i.NumberStreet }, + { "Apt#:", NULL, &f1040i.Apt }, + { "Town/City:", NULL, &f1040i.City }, + { "State:", NULL, &f1040i.State }, + { "ZipCode:", NULL, &f1040i.ZipCode }, + { "Dep1_FirstName:", NULL, &f1040i.Dep1FirstName }, + { "Dep1_LastName:", NULL, &f1040i.Dep1LastName }, + { "Dep1_SocSec#:", NULL, &f1040i.Dep1SocSec }, + { "Dep2_FirstName:", NULL, &f1040i.Dep2FirstName }, + { "Dep2_LastName:", NULL, &f1040i.Dep2LastName }, + { "Dep2_SocSec#:", NULL, &f1040i.Dep2SocSec }, + { "Dep3_FirstName:", NULL, &f1040i.Dep3FirstName }, + { "Dep3_LastName:", NULL, &f1040i.Dep3LastName }, + { "Dep3_SocSec#:", NULL, &f1040i.Dep3SocSec }, +}; + +int f1040_imp_defs_size = sizeof(f1040_imp_defs)/sizeof(FORM_IMPORT_DEF); + + +/*----------------------------------------------------------------------------*/ + +// For the special formatting reqirements of OR-40, an integer value with +// commas is required. +void showline_wlabel_or_40(char *label, double value) { + char buf[100]; + int cpos; + int c; + int val_int = (int)(value + 0.5); + fprintf(outfile, "%s = ", label); + sprintf(buf, "%d", val_int); + + int buf_len = strlen(buf); + // The starting position is adjusted to allow the space for the minus + // sign if the number is negative. + c = 2 - ((buf_len - ((val_int < 0) ? 1 : 0)) % 3); + + for (cpos = 0; cpos < buf_len; ++cpos) { + fputc(buf[cpos], outfile); + // Only process commas if the current character is not a minus sign. + if (buf[cpos] != '-') { + if (c == 1 && (cpos < buf_len - 1)) { + fputc(',', outfile); + } + c = (c + 1) % 3; + } + } + fputc('\n', outfile); +} + +// Only show number if non-zero +void showline_wlabel_or_40_nz(char *label, double value) { + if (value == 0) { + return; + } else { + showline_wlabel_or_40(label, value); + } +} + +// Show number from 'L' array +void shownum_or_40(int j) { + char buf[100]; + sprintf(buf, "L%d", j); + showline_wlabel_or_40(buf, L[j]); +} + +// Show number from 'L' array, if non-zero +void shownum_or_40_nz(int j) { + if (L[j] == 0.0) + return; + char buf[100]; + sprintf(buf, "L%d", j); + showline_wlabel_or_40(buf, L[j]); +} + + +// Separate the combined first name and initial into separate fields, and print them +// to the output file, using the field labels provided. +void show_fname_init_or_40(char *combined_name, char *first_name_label, char *initial_label) { + + // If combined_name ends in a space followed by a single character, treat it as initial + char *first_name; + char *initial; + + int comb_len = strlen(combined_name); + + first_name = strdup(combined_name); + initial = strdup(combined_name); + + // Look for second to last character is a space, and last character is not a space; + if ((*(combined_name + comb_len - 2) == ' ') && (*(combined_name + comb_len - 1) != ' ')) { + *initial = *(combined_name + comb_len - 1); + *(initial + 1) = '\0'; + // printf("show_fname_init_or_40: '%s'\n", initial); + strncpy(first_name, combined_name, comb_len - 2); + *(first_name + comb_len - 1) = '\0'; + } else { + // No initial found; return full first name, and empty initial + strcpy(first_name, combined_name); + *initial = '\0'; + } + + fprintf(outfile, "%s %s\n", first_name_label, first_name); + if (strlen(initial) > 0) + fprintf(outfile, "%s %s\n", initial_label, initial); +} + +// Format and print a social security number to the output file, inserting +// spaces, and ignoring any input characters (e.g. ' ' or '-') which are not +// numeric digits. +void show_ssn_or_40(char *label, char *ssn) { + fprintf(outfile, "%s ", label); + int cpos; + int digit_pos = 0; // Position counting digits only in input number + for (cpos = 0; cpos < strlen(ssn); ++cpos) { + // Skip over any non-digit characters, and don't count them as + // digit_pos + if (isdigit(*(ssn + cpos))) { + // If we have reached the third or fifth digit (zero-based), + // insert a space beforehand. + if ((digit_pos == 3) || (digit_pos == 5)) + fputc(' ', outfile); + fputc(*(ssn + cpos), outfile); + ++digit_pos; + } + } + fputc('\n', outfile); +} + + +int main( int argc, char *argv[] ) +{ + int i, j, k; + char word[6000], outfname[6000], *infname=0; + time_t now; + // Local line number variables for direct/indirect lines + + printf("Oregon Form OR-40 - 2024 - v%3.2f\n", thisversion); + + /* Decode any command-line arguments. */ + i = 1; k=1; + while (i < argc) + { + if (strcmp(argv[i],"-verbose")==0) { verbose = 1; } + else + if (k==1) + { + infname = strdup(argv[i]); + infile = fopen(infname,"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", infname ); exit(1);} + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname,infname); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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; ip_field_string != NULL ) + // After import, convert strings to upper case, in place. + capitalize( *pdef->p_field_string ); + } + + fprintf( outfile, "INFO: --- Imported 1040 Data from file '%s' ---\n", f1040_filename); + fprintf( outfile, "INFO: --- All strings converted to upper case ---\n"); + fprintf( outfile, "INFO: f1040i.L6b -- %6.2f\n", f1040i.L6b); + fprintf( outfile, "INFO: f1040i.L11 -- %6.2f\n", f1040i.L11); + fprintf( outfile, "INFO: f1040i.L22 -- %6.2f\n", f1040i.L22); + fprintf( outfile, "INFO: f1040i.S2_1a -- %6.2f\n", f1040i.S2_1a); + fprintf( outfile, "INFO: f1040i.S2_8 -- %6.2f\n", f1040i.S2_8); + fprintf( outfile, "INFO: f1040i.S2_10 -- %6.2f\n", f1040i.S2_10); + fprintf( outfile, "INFO: f1040i.S2_16 -- %6.2f\n", f1040i.S2_16); + fprintf( outfile, "INFO: f1040i.L29 -- %6.2f\n", f1040i.L29); + fprintf( outfile, "INFO: f1040i.Status: -- %s\n", f1040i.Status); + fprintf( outfile, "INFO: f1040i.Your1stName: -- %s\n", f1040i.Your1stName); + fprintf( outfile, "INFO: f1040i.YourLastName: -- %s\n", f1040i.YourLastName); + fprintf( outfile, "INFO: f1040i.YourSocSec#: -- %s\n", f1040i.YourSocSec); + fprintf( outfile, "INFO: f1040i.Spouse1stName: -- %s\n", f1040i.Spouse1stName); + fprintf( outfile, "INFO: f1040i.SpouseLastName: -- %s\n", f1040i.SpouseLastName); + fprintf( outfile, "INFO: f1040i.SpouseSocSec#: -- %s\n", f1040i.SpouseSocSec); + fprintf( outfile, "INFO: f1040i.Number&Street: -- %s\n", f1040i.NumberStreet); + fprintf( outfile, "INFO: f1040i.Apt#: -- %s\n", f1040i.Apt); + fprintf( outfile, "INFO: f1040i.Town/City: -- %s\n", f1040i.City); + fprintf( outfile, "INFO: f1040i.State: -- %s\n", f1040i.State); + fprintf( outfile, "INFO: f1040i.ZipCode: -- %s\n", f1040i.ZipCode); + fprintf( outfile, "INFO: f1040i.Dep1FirstName: -- %s\n", f1040i.Dep1FirstName); + fprintf( outfile, "INFO: f1040i.Dep1LastName: -- %s\n", f1040i.Dep1LastName); + fprintf( outfile, "INFO: f1040i.Dep1SocSec: -- %s\n", f1040i.Dep1SocSec); + fprintf( outfile, "INFO: f1040i.Dep2FirstName: -- %s\n", f1040i.Dep2FirstName); + fprintf( outfile, "INFO: f1040i.Dep2LastName: -- %s\n", f1040i.Dep2LastName); + fprintf( outfile, "INFO: f1040i.Dep2SocSec: -- %s\n", f1040i.Dep2SocSec); + fprintf( outfile, "INFO: f1040i.Dep3FirstName: -- %s\n", f1040i.Dep3FirstName); + fprintf( outfile, "INFO: f1040i.Dep3LastName: -- %s\n", f1040i.Dep3LastName); + fprintf( outfile, "INFO: f1040i.Dep3SocSec: -- %s\n", f1040i.Dep3SocSec); + } else { + fprintf( outfile, "ERROR: --- No Imported 1040 Form Data : no filename provided ---\n"); + exit(1); + } + + //====== Page 1 ====== + + //=== Fiscal Year, Amended Return, Special Status === + + GetTextLineF( "FiscalYearEnd:") ; + + check_if_yes("CkAmended"); + + GetTextLineF( "NOLTaxYear:") ; + + check_if_yes("CkCalcAsIfFed"); + check_if_yes("CkShortYear"); + check_if_yes("CkExtFiled"); + check_if_yes("CkFormOR24"); + check_if_yes("CkFormOR243"); + check_if_yes("CkFedForm8379"); + check_if_yes("CkFedForm8886"); + check_if_yes("CkDisasterRelief"); + + //=== Identity-Information === + + fprintf(outfile, "YourLName: %s\n", f1040i.YourLastName); + show_ssn_or_40("YourSSN:", f1040i.YourSocSec); + + + show_fname_init_or_40(f1040i.Your1stName, "YourFName:", "YourInit:"); + + show_fname_init_or_40(f1040i.Spouse1stName, "SpouseFName:", "SpouseInit:"); + fprintf(outfile, "SpouseLName: %s\n", f1040i.SpouseLastName); + show_ssn_or_40("SpouseSSN:", f1040i.SpouseSocSec); + + GetTextLineF( "YourDOB:") ; + + check_if_yes("CkYFirstSSN"); + check_if_yes("CkYAppITIN"); + check_if_yes("CkYDeceased"); + + GetTextLineF( "SpouseDOB:") ; + + check_if_yes("CkSFirstSSN"); + check_if_yes("CkSAppITIN"); + check_if_yes("CkSDeceased"); + + char *apt_prefix = ""; + if (strlen(f1040i.Apt) > 0) + apt_prefix = " #"; + fprintf(outfile, "Address: %s%s%s\n", f1040i.NumberStreet, apt_prefix, f1040i.Apt); + + fprintf(outfile, "City: %s\n", f1040i.City); + fprintf(outfile, "State: %s\n", f1040i.State); + fprintf(outfile, "Zip: %s\n", f1040i.ZipCode); + + GetTextLineF( "Country:"); + GetTextLineF( "Phone:"); + + //=== Filing Status === + // Filing status configuration pointer. + P_FILING_STATUS_CFG p_cfg = get_status_cfg(f1040i.Status); + + if (p_cfg == NULL) { + fprintf(outfile,"Error: unrecognized filing status '%s'. Check form1040 imported info. Exiting.\n", f1040i.Status); + exit(1); + } + + fprintf(outfile, "INFO: filing_status: '%s'\n", p_cfg->status_label); + + // Set the filing status checkbox + fprintf(outfile, "%s X\n", p_cfg->checkbox_name); + + //====== Page 2 ====== + + //=== Exemptions === + + // Your exemptions + int b6aRegular; + int b6aDisabled; + int b6aDependent; + + GetYesNoSL("CkL6aRegular", &b6aRegular); + GetYesNoSL("CkL6aDisabled", &b6aDisabled); + GetYesNoSL("CkL6aDep", &b6aDependent); + + double L6a; + L6a = b6aRegular + b6aDisabled + b6aDependent; + showline_wlabel_or_40("L6a", L6a); + + if (b6aRegular) + fprintf(outfile, "CkL6aRegular X\n"); + if (b6aDisabled) + fprintf(outfile, "CkL6aDisabled X\n"); + if (b6aDependent) + fprintf(outfile, "CkL6aDep X\n"); + + if (b6aRegular && b6aDependent) { + fprintf( outfile, "ERROR: --- Only one of L6a 'Regular' and 'Dependent' checkboxes may be selected ---\n"); + exit(1); + } + + + // Spouse exemptions + int b6bRegular; + int b6bDisabled; + int b6bDependent; + + GetYesNoSL("CkL6bRegular", &b6bRegular); + GetYesNoSL("CkL6bDisabled", &b6bDisabled); + GetYesNoSL("CkL6bDep", &b6bDependent); + + double L6b; + L6b = b6bRegular + b6bDisabled + b6bDependent; + showline_wlabel_or_40_nz("L6b", L6b); + + if (b6bRegular) + fprintf(outfile, "CkL6bRegular X\n"); + if (b6bDisabled) + fprintf(outfile, "CkL6bDisabled X\n"); + if (b6bDependent) + fprintf(outfile, "CkL6bDep X\n"); + + if (b6bRegular && b6bDependent) { + fprintf( outfile, "ERROR: --- Only one of L6b 'Regular' and 'Dependent' checkboxes may be selected ---\n"); + exit(1); + } + + //=== Dependents === + + show_fname_init_or_40(f1040i.Dep1FirstName, "Dep1FirstName:", "Dep1Initial:"); + fprintf(outfile, "Dep1LastName: %s\n", f1040i.Dep1LastName); + show_ssn_or_40("Dep1SSN:", f1040i.Dep1SocSec); + GetTextLineF("Dep1DOB:"); + GetTextLineF("Dep1Code:"); + check_if_yes("CkDep1Dis"); + + show_fname_init_or_40(f1040i.Dep2FirstName, "Dep2FirstName:", "Dep2Initial:"); + fprintf(outfile, "Dep2LastName: %s\n", f1040i.Dep2LastName); + show_ssn_or_40("Dep2SSN:", f1040i.Dep2SocSec); + GetTextLineF("Dep2DOB:"); + GetTextLineF("Dep2Code:"); + check_if_yes("CkDep2Dis"); + + show_fname_init_or_40(f1040i.Dep3FirstName, "Dep3FirstName:", "Dep3Initial:"); + fprintf(outfile, "Dep3LastName: %s\n", f1040i.Dep3LastName); + show_ssn_or_40("Dep3SSN:", f1040i.Dep3SocSec); + GetTextLineF("Dep3DOB:"); + GetTextLineF("Dep3Code:"); + check_if_yes("CkDep3Dis"); + + // Total number of dependents + double L6c; + GetLine("L6c", &L6c); + showline_wlabel_or_40("L6c", L6c); + + // Total number of dependent children with a qualifying disability + double L6d; + GetLine("L6d", &L6d); + showline_wlabel_or_40("L6d", L6d); + + // Total number of exemptions + double L6e; + L6e = L6a + L6b + L6c + L6d; + showline_wlabel_or_40("L6e", L6e); + + // From this point forward, calculations must be deferred until all + // supporting schedule data is available. See template file for ordering + // and field descriptions. + //====== Page 3 ====== + + double L10_worksheet_L4; + double L10_worksheet_L7; + GetLine("L10_worksheet_L4", &L10_worksheet_L4); + GetLine("L10_worksheet_L7", &L10_worksheet_L7); + + + GetLine("L12", &L[12]); + + int bStdDedOverride; + double StdDedOverride; + + GetYesNoSL("CkStdDedOverride", &bStdDedOverride); + GetLine("StdDedOverride", &StdDedOverride); + + int bL17a; + int bL17b; + int bL17c; + int bL17d; + + GetYesNoSL("CkL17a", &bL17a); + GetYesNoSL("CkL17b", &bL17b); + GetYesNoSL("CkL17c", &bL17c); + GetYesNoSL("CkL17d", &bL17d); + + //====== Page 4 ====== + + int b20a; + int b20b; + int b20c; + + GetYesNoSL("CkL20a", &b20a); + GetYesNoSL("CkL20b", &b20b); + GetYesNoSL("CkL20c", &b20c); + + double AltMethodTaxAmt; + GetLine("AltMethodTaxAmt", &AltMethodTaxAmt); + + GetLine("L21", &L[21]); + + GetLine("L26", &L[26]); + + //====== Page 5 ====== + + GetLine("L32", &L[32]); + GetLine("L33", &L[33]); + GetLine("L34", &L[34]); + GetLine("L35", &L[35]); + GetLine("L36", &L[36]); + GetLine("L37", &L[37]); + + GetLine("L43", &L[43]); + GetLine("L44", &L[44]); + + double L44a; + GetLine("L44a", &L44a); + + int bL44b; + GetYesNoSL("CkL44b", &bL44b); + + //====== Page 6 ====== + + GetLine("L48", &L[48]); + GetLine("L49", &L[49]); + GetLine("L50", &L[50]); + + char *L50a; + char *L50b; + L50a = GetTextLine("L50a:"); + L50b = GetTextLine("L50b:"); + + GetLine("L51", &L[51]); + + int bL54DepOutUS; + GetYesNoSL("CkL54DepOutUS", &bL54DepOutUS); + + int bAcctChecking; + GetYesNoSL("CkAcctChecking", &bAcctChecking); + + int bAcctSavings; + GetYesNoSL("CkAcctSavings", &bAcctSavings); + + char *AcctRoutingNumber; + char *AcctNumber; + AcctRoutingNumber = GetTextLine("AcctRoutingNumber:"); + AcctNumber = GetTextLine("AcctNumber:"); + // There may be letters in account number, so convert to upper case. + capitalize(AcctNumber); + + //====== Oregon Schedule OR-A Data ====== + + //====== OR-A Page 1 ====== + + #define SCH_A_LINES 23 + double SchA_L[SCH_A_LINES + 1]; // Allow 1 extra for 1-based counting + char *SchA_L10_Type; + char *SchA_L22_Type; + + GetLine("SchA_L1", &SchA_L[1]); + GetLine("SchA_L5", &SchA_L[5]); + GetLine("SchA_L6", &SchA_L[6]); + GetLine("SchA_L7", &SchA_L[7]); + GetLine("SchA_L10", &SchA_L[10]); + SchA_L10_Type = GetTextLine("SchA_L10_Type:"); + capitalize(SchA_L10_Type); + + //====== OR-A Page 2 ====== + + GetLine("SchA_L12", &SchA_L[12]); + GetLine("SchA_L13", &SchA_L[13]); + GetLine("SchA_L14", &SchA_L[14]); + GetLine("SchA_L16", &SchA_L[16]); + GetLine("SchA_L18", &SchA_L[18]); + GetLine("SchA_L19", &SchA_L[19]); + GetLine("SchA_L20", &SchA_L[20]); + GetLine("SchA_L22", &SchA_L[22]); + SchA_L22_Type = GetTextLine("SchA_L22_Type:"); + capitalize(SchA_L22_Type); + + //====== Oregon Schedule OR-ASC Data ====== + + //====== OR-ASC Page 1 ====== + + // A section + #define SCH_ASC_A_FIELDS 5 + double SchASC_A[SCH_ASC_A_FIELDS + 1]; + char *SchASC_A1; + char *SchASC_A3; + + SchASC_A1 = GetTextLine("SchASC_A1:"); + capitalize(SchASC_A1); + GetLine("SchASC_A2", &SchASC_A[2]); + SchASC_A3 = GetTextLine("SchASC_A3:"); + capitalize(SchASC_A3); + GetLine("SchASC_A4", &SchASC_A[4]); + + // B section + #define SCH_ASC_B_FIELDS 7 + double SchASC_B[SCH_ASC_B_FIELDS + 1]; + char *SchASC_B1; + char *SchASC_B3; + char *SchASC_B5; + + SchASC_B1 = GetTextLine("SchASC_B1:"); + capitalize(SchASC_B1); + GetLine("SchASC_B2", &SchASC_B[2]); + SchASC_B3 = GetTextLine("SchASC_B3:"); + capitalize(SchASC_B3); + GetLine("SchASC_B4", &SchASC_B[4]); + SchASC_B5 = GetTextLine("SchASC_B5:"); + capitalize(SchASC_B5); + GetLine("SchASC_B6", &SchASC_B[6]); + + // C section + #define SCH_ASC_C_FIELDS 5 + double SchASC_C[SCH_ASC_C_FIELDS + 1]; + char *SchASC_C1; + char *SchASC_C3; + + SchASC_C1 = GetTextLine("SchASC_C1:"); + capitalize(SchASC_C1); + GetLine("SchASC_C2", &SchASC_C[2]); + SchASC_C3 = GetTextLine("SchASC_C3:"); + capitalize(SchASC_C3); + GetLine("SchASC_C4", &SchASC_C[4]); + + //====== OR-ASC Page 2 ====== + + // D section + #define SCH_ASC_D_FIELDS 16 + double SchASC_D[SCH_ASC_D_FIELDS + 1]; + char *SchASC_D1; + char *SchASC_D2; + char *SchASC_D4; + char *SchASC_D5; + char *SchASC_D7; + char *SchASC_D8; + char *SchASC_D10; + char *SchASC_D11; + char *SchASC_D13; + char *SchASC_D14; + + SchASC_D1 = GetTextLine("SchASC_D1:"); + capitalize(SchASC_D1); + SchASC_D2 = GetTextLine("SchASC_D2:"); + capitalize(SchASC_D2); + GetLine("SchASC_D3", &SchASC_D[3]); + SchASC_D4 = GetTextLine("SchASC_D4:"); + capitalize(SchASC_D4); + SchASC_D5 = GetTextLine("SchASC_D5:"); + capitalize(SchASC_D5); + GetLine("SchASC_D6", &SchASC_D[6]); + SchASC_D7 = GetTextLine("SchASC_D7:"); + capitalize(SchASC_D7); + SchASC_D8 = GetTextLine("SchASC_D8:"); + capitalize(SchASC_D8); + GetLine("SchASC_D9", &SchASC_D[9]); + SchASC_D10 = GetTextLine("SchASC_D10:"); + capitalize(SchASC_D10); + SchASC_D11 = GetTextLine("SchASC_D11:"); + capitalize(SchASC_D11); + GetLine("SchASC_D12", &SchASC_D[12]); + SchASC_D13 = GetTextLine("SchASC_D13:"); + capitalize(SchASC_D13); + SchASC_D14 = GetTextLine("SchASC_D14:"); + capitalize(SchASC_D14); + GetLine("SchASC_D15", &SchASC_D[15]); + + // E section + #define SCH_ASC_E_FIELDS 9 + double SchASC_E[SCH_ASC_E_FIELDS + 1]; + char *SchASC_E1; + char *SchASC_E5; + + SchASC_E1 = GetTextLine("SchASC_E1:"); + capitalize(SchASC_E1); + GetLine("SchASC_E2", &SchASC_E[2]); + GetLine("SchASC_E3", &SchASC_E[3]); + GetLine("SchASC_E4", &SchASC_E[4]); + SchASC_E5 = GetTextLine("SchASC_E5:"); + capitalize(SchASC_E5); + GetLine("SchASC_E6", &SchASC_E[6]); + GetLine("SchASC_E7", &SchASC_E[7]); + GetLine("SchASC_E8", &SchASC_E[8]); + + //====== OR-ASC Page 3 ====== + + // F section + #define SCH_ASC_F_FIELDS 7 + double SchASC_F[SCH_ASC_F_FIELDS + 1]; + char *SchASC_F1; + char *SchASC_F3; + char *SchASC_F5; + + SchASC_F1 = GetTextLine("SchASC_F1:"); + capitalize(SchASC_F1); + GetLine("SchASC_F2", &SchASC_F[2]); + SchASC_F3 = GetTextLine("SchASC_F3:"); + capitalize(SchASC_F3); + GetLine("SchASC_F4", &SchASC_F[4]); + SchASC_F5 = GetTextLine("SchASC_F5:"); + capitalize(SchASC_F5); + GetLine("SchASC_F6", &SchASC_F[6]); + + //====== End of input file data reads ====== + + // Now that all data has been accumulated, calculations can be begin on OR-40, and schedules. + // First calculated and display OR-A and OR-ASC, as they create values used in the main OR-40 form + // Get fed AGI into OR-40 form array before calculating OR-A + L[7] = round(f1040i.L11); + double fed_agi = L[7]; + + + //====== OR-A Calculations and output ====== + + showline_wlabel_or_40_nz("SchA_L1", SchA_L[1]); + SchA_L[2] = fed_agi; + showline_wlabel_or_40_nz("SchA_L2", SchA_L[2]); + SchA_L[3] = round(SchA_L[2] * 0.075); + showline_wlabel_or_40_nz("SchA_L3", SchA_L[3]); + SchA_L[4] = NotLessThanZero(SchA_L[1]- SchA_L[3]); + showline_wlabel_or_40("SchA_L4", SchA_L[4]); + showline_wlabel_or_40_nz("SchA_L5", SchA_L[5]); + showline_wlabel_or_40_nz("SchA_L6", SchA_L[6]); + showline_wlabel_or_40_nz("SchA_L7", SchA_L[7]); + + // Sum of income and property tax deduction. + double SchA_L9_Sum; + SchA_L9_Sum = SchA_L[5] + SchA_L[6] + SchA_L[7] + SchA_L[8]; + SchA_L[9] = SmallerOf(SchA_L9_Sum, p_cfg->income_and_property_tax_deduction_limit); + showline_wlabel_or_40_nz("SchA_L9", SchA_L[9]); + + // If limited, show info message. + if (SchA_L9_Sum > p_cfg->income_and_property_tax_deduction_limit) { + fprintf(outfile, "INFO: Total income and property taxes on Schedule A = %8.2f has been limited to %8.2f\n", + SchA_L9_Sum, SchA_L[9]); + } + + showline_wlabel_or_40_nz("SchA_L10", SchA_L[10]); + fprintf(outfile, "SchA_L10_Type: %s\n", SchA_L10_Type); + + SchA_L[11] = SchA_L[9] + SchA_L[10]; + showline_wlabel_or_40_nz("SchA_L11", SchA_L[11]); + + showline_wlabel_or_40_nz("SchA_L12", SchA_L[12]); + showline_wlabel_or_40_nz("SchA_L13", SchA_L[13]); + showline_wlabel_or_40_nz("SchA_L14", SchA_L[14]); + showline_wlabel_or_40_nz("SchA_L16", SchA_L[16]); + + SchA_L[17] = SchA_L[12] + SchA_L[13] + SchA_L[14] + SchA_L[16]; + showline_wlabel_or_40_nz("SchA_L17", SchA_L[17]); + + showline_wlabel_or_40_nz("SchA_L18", SchA_L[18]); + showline_wlabel_or_40_nz("SchA_L19", SchA_L[19]); + showline_wlabel_or_40_nz("SchA_L20", SchA_L[20]); + + SchA_L[21] = SchA_L[18] + SchA_L[19] + SchA_L[20]; + showline_wlabel_or_40_nz("SchA_L21", SchA_L[21]); + + showline_wlabel_or_40_nz("SchA_L22", SchA_L[22]); + fprintf(outfile, "SchA_L22_Type: %s\n", SchA_L22_Type); + + // Finally, the sum of all deductions + SchA_L[23] = SchA_L[4] + SchA_L[11] + SchA_L[17] + SchA_L[21] + SchA_L[22]; + showline_wlabel_or_40_nz("SchA_L23", SchA_L[23]); + + //====== OR-ASC Calculations and output ====== + // Section A + fprintf(outfile, "SchASC_A1: %s\n", SchASC_A1); + showline_wlabel_or_40_nz("SchASC_A2", SchASC_A[2]); + + fprintf(outfile, "SchASC_A3: %s\n", SchASC_A3); + showline_wlabel_or_40_nz("SchASC_A4", SchASC_A[4]); + + SchASC_A[5] = SchASC_A[2] + SchASC_A[4]; + showline_wlabel_or_40_nz("SchASC_A5", SchASC_A[5]); + + // Section B + fprintf(outfile, "SchASC_B1: %s\n", SchASC_B1); + showline_wlabel_or_40_nz("SchASC_B2", SchASC_B[2]); + + fprintf(outfile, "SchASC_B3: %s\n", SchASC_B3); + showline_wlabel_or_40_nz("SchASC_B4", SchASC_B[4]); + + fprintf(outfile, "SchASC_B5: %s\n", SchASC_B5); + showline_wlabel_or_40_nz("SchASC_B6", SchASC_B[6]); + + SchASC_B[7] = SchASC_B[2] + SchASC_B[4] + SchASC_B[6]; + showline_wlabel_or_40_nz("SchASC_B7", SchASC_B[7]); + + // Section C + fprintf(outfile, "SchASC_C1: %s\n", SchASC_C1); + showline_wlabel_or_40_nz("SchASC_C2", SchASC_C[2]); + + fprintf(outfile, "SchASC_C3: %s\n", SchASC_C3); + showline_wlabel_or_40_nz("SchASC_C4", SchASC_C[4]); + + SchASC_C[5] = SchASC_C[2] + SchASC_C[4]; + showline_wlabel_or_40_nz("SchASC_C5", SchASC_C[5]); + + // Section D + fprintf(outfile, "SchASC_D1: %s\n", SchASC_D1); + fprintf(outfile, "SchASC_D2: %s\n", SchASC_D2); + showline_wlabel_or_40_nz("SchASC_D3", SchASC_D[3]); + + fprintf(outfile, "SchASC_D4: %s\n", SchASC_D4); + fprintf(outfile, "SchASC_D5: %s\n", SchASC_D5); + showline_wlabel_or_40_nz("SchASC_D6", SchASC_D[6]); + + fprintf(outfile, "SchASC_D7: %s\n", SchASC_D7); + fprintf(outfile, "SchASC_D8: %s\n", SchASC_D8); + showline_wlabel_or_40_nz("SchASC_D9", SchASC_D[9]); + + fprintf(outfile, "SchASC_D10: %s\n", SchASC_D10); + fprintf(outfile, "SchASC_D11: %s\n", SchASC_D11); + showline_wlabel_or_40_nz("SchASC_D12", SchASC_D[12]); + + fprintf(outfile, "SchASC_D13: %s\n", SchASC_D13); + fprintf(outfile, "SchASC_D14: %s\n", SchASC_D14); + showline_wlabel_or_40_nz("SchASC_D15", SchASC_D[15]); + + SchASC_D[16] = SchASC_D[3] + SchASC_D[6] + SchASC_D[9] + SchASC_D[12] + SchASC_D[15]; + showline_wlabel_or_40_nz("SchASC_D16", SchASC_D[16]); + + // Section E + fprintf(outfile, "SchASC_E1: %s\n", SchASC_E1); + showline_wlabel_or_40_nz("SchASC_E2", SchASC_E[2]); + showline_wlabel_or_40_nz("SchASC_E3", SchASC_E[3]); + // Limit the 'Total used this year' to be not more than the sum of prior and this year values + double SchASC_E1_prior_this_sum; + SchASC_E1_prior_this_sum = SchASC_E[2] + SchASC_E[3]; + if (SchASC_E[4] > SchASC_E1_prior_this_sum) { + fprintf(outfile, "Schedule ASC Section E line E4 has been limited to the sum of E2 and E3: %8.2f\n", SchASC_E1_prior_this_sum); + } + SchASC_E[4] = SmallerOf(SchASC_E[4], SchASC_E1_prior_this_sum); + showline_wlabel_or_40_nz("SchASC_E4", SchASC_E[4]); + + fprintf(outfile, "SchASC_E5: %s\n", SchASC_E5); + showline_wlabel_or_40_nz("SchASC_E6", SchASC_E[6]); + showline_wlabel_or_40_nz("SchASC_E7", SchASC_E[7]); + // Limit the 'Total used this year' to be not more than the sum of prior and this year values + double SchASC_E5_prior_this_sum; + SchASC_E5_prior_this_sum = SchASC_E[6] + SchASC_E[7]; + + if (SchASC_E[8] > SchASC_E5_prior_this_sum) { + fprintf(outfile, "Schedule ASC Section E line E8 has been limited to the sum of E6 and E7: %8.2f\n", SchASC_E5_prior_this_sum); + } + SchASC_E[8] = SmallerOf(SchASC_E[8], SchASC_E5_prior_this_sum); + showline_wlabel_or_40_nz("SchASC_E8", SchASC_E[8]); + + SchASC_E[9] = SchASC_E[4] + SchASC_E[8]; + showline_wlabel_or_40_nz("SchASC_E9", SchASC_E[9]); + + // Section F + fprintf(outfile, "SchASC_F1: %s\n", SchASC_F1); + showline_wlabel_or_40_nz("SchASC_F2", SchASC_F[2]); + + fprintf(outfile, "SchASC_F3: %s\n", SchASC_F3); + showline_wlabel_or_40_nz("SchASC_F4", SchASC_F[4]); + + fprintf(outfile, "SchASC_F5: %s\n", SchASC_F5); + showline_wlabel_or_40_nz("SchASC_F6", SchASC_F[6]); + + SchASC_F[7] = SchASC_F[2] + SchASC_F[4] + SchASC_F[6]; + showline_wlabel_or_40_nz("SchASC_F7", SchASC_F[7]); + + //=== End of supporting schedules === + + //====== Finish OR-40 form calculations and display ====== + //=== Taxable Income === + + shownum_or_40(7); + + // Additions from OR-ASC, line A5 + // GetLine("L8", &L[8]); + L[8] = SchASC_A[5]; + shownum_or_40_nz(8); + + L[9] = L[7] + L[8]; + shownum_or_40(9); + + //=== Subtractions from Taxable Income === + + // Federal Tax Worksheet + #define FTW_NUM_LINES 11 + double ftw_L[FTW_NUM_LINES + 1]; // Add one extra to allow 1-based; [0] entry is ignored. + + char *ftw_line_description[FTW_NUM_LINES + 1] = { + "", // Line[0] not used + "Federal tax liability (Form 1040 line 22)", + "Excess advance premium tax credit (Form 1040, Schedule 2, line 1a)", + "Line 1 minus line 2. (If less than 0, enter 0)", + "Other taxes (see instructions)", + "Line 3 plus line 4", + "American Opportunity credit (form 1040, line 29)", + "Premium tax credit (Form 8962, line 24)", + "Line 6 plus line 7", + "Line 5 minus line 8. (If less than 0, enter 0)", + "Maximum subtraction amount from Table 4", + "Smaller of line 9 or line 10. This is your federal tax liability subtraction" + }; + + ftw_L[1] = round(f1040i.L22); + ftw_L[2] = round(f1040i.S2_1a); + ftw_L[3] = NotLessThanZero(ftw_L[1] - ftw_L[2]); + ftw_L[4] = L10_worksheet_L4; + ftw_L[5] = ftw_L[3] + ftw_L[4]; + ftw_L[6] = round(f1040i.L29); + ftw_L[7] = L10_worksheet_L7; + ftw_L[8] = ftw_L[6] + ftw_L[7]; + ftw_L[9] = NotLessThanZero(ftw_L[5] - ftw_L[8]); + ftw_L[10] = GetLimit(fed_agi, p_cfg->p_fed_liability_limit); + ftw_L[11] = SmallerOf(ftw_L[9], ftw_L[10]); + + int line; + fprintf( outfile, "INFO: Federal tax liability subtraction worksheet\n" ); + for (line = 1; line <= FTW_NUM_LINES; ++line) { + fprintf( outfile, "INFO: --- Line %2d: %9.2f : '%s'\n", line, ftw_L[line], ftw_line_description[line]); + } + + // Federal tax liability allowed for subtraction, from line 11 of worksheet. + L[10] = ftw_L[11]; + shownum_or_40(10); + + // Taxable social security amount + L[11] = round(f1040i.L6b); + shownum_or_40_nz(11); + + // Oregon income tax refund + shownum_or_40_nz(12); + + // Subtractions from OR-ASC, line B7 + L[13] = SchASC_B[7]; + shownum_or_40_nz(13); + + // Total subtractions + L[14] = L[10] + L[11] + L[12] + L[13]; + shownum_or_40(14); + + // Income after subtractions + L[15] = L[9] - L[14]; + shownum_or_40(15); + + // Itemized deductions + L[16] = SchA_L[23]; + shownum_or_40(16); + + + + if (bL17a) + fprintf(outfile, "CkL17a X\n"); + if (bL17b) + fprintf(outfile, "CkL17b X\n"); + if (bL17c) + fprintf(outfile, "CkL17c X\n"); + if (bL17d) + fprintf(outfile, "CkL17d X\n"); + + + double std_deduction = 0.0; + // Calculate standard deduction based on filing status and extra checkboxes + if (bStdDedOverride) { + std_deduction = StdDedOverride; + } else { + std_deduction = p_cfg->std_deduction; + + fprintf( outfile, "INFO: Base standard deduction: %6.2f\n", std_deduction); + + // Adjust for extra checkboxes on line 17 + double std_deduction_extra_amt; + std_deduction_extra_amt = p_cfg->extra_std_deduction; + + + double std_deduction_extra; + std_deduction_extra = (bL17a + bL17b + bL17c + bL17d) * std_deduction_extra_amt; + fprintf( outfile, "INFO: Standard deduction extra amount: %6.2f\n", std_deduction_extra); + + std_deduction += std_deduction_extra; + } + fprintf( outfile, "INFO: Total standard deduction: %6.2f\n", std_deduction); + + // Standard deduction + L[17] = std_deduction; + shownum_or_40(17); + + L[18] = LargerOf(L[16], L[17]); + shownum_or_40(18); + + // Oregon taxable income + L[19] = NotLessThanZero(L[15] - L[18]); + shownum_or_40(19); + + + if (b20a) + fprintf(outfile, "CkL20a X\n"); + if (b20b) + fprintf(outfile, "CkL20b X\n"); + if (b20c) + fprintf(outfile, "CkL20c X\n"); + + + double oregon_tax; + + if (b20a || b20b || b20c) + oregon_tax = AltMethodTaxAmt; + else + oregon_tax = TaxLookup(L[19], p_cfg->p_tax_table); + + double marginal_rate; + marginal_rate = TaxRate(L[19], p_cfg->p_tax_table); + + fprintf(outfile,"INFO: You are in the %2.1f%% marginal tax bracket,\n" + "INFO: and you are paying an effective %2.1f%% tax on your income.\n", + 100.0 * marginal_rate, 100.0 * oregon_tax / (L[19] + 1e-9) ); + + L[20] = oregon_tax; + shownum_or_40(20); + + shownum_or_40_nz(21); + + L[22] = SchASC_C[5]; + shownum_or_40_nz(22); + + L[23] = L[21] + L[22]; + shownum_or_40_nz(23); + + L[24] = L[20] + L[23]; + shownum_or_40(24); + + // Exemption credit worksheet + #define ECW_NUM_LINES 5 + + char *ecw_line_description[ECW_NUM_LINES + 1] = { + "", // Line[0] not used + "Regular exemptions, limited by AGI", + "Disability exemptions, limited by AGI", + "Children with disability exemptions, limited by AGI", + "Sum of exemptions", + "Total exemption credit" + }; + + double ecw_L[ECW_NUM_LINES + 1]; // Add one extra to allow 1-based; [0] entry is ignored. + + ecw_L[1] = (fed_agi > p_cfg->exemption_credit_limit) ? 0.0 : (b6aRegular + b6bRegular + L6c); + ecw_L[2] = (fed_agi > EXEMPTION_CREDIT_DISABILITY_LIMIT) ? 0.0 : (b6aDisabled + b6bDisabled); + ecw_L[3] = (fed_agi > EXEMPTION_CREDIT_DISABILITY_LIMIT) ? 0.0 : L6d; + ecw_L[4] = ecw_L[1] + ecw_L[2] + ecw_L[3]; + ecw_L[5] = ecw_L[4] * EXEMPTION_CREDIT; + + fprintf( outfile, "INFO: Exemption credit worksheet\n" ); + fprintf( outfile, "INFO: Fed AGI Regular Exemption Limit: %9.2f, Disabled Exemption Limit: %9.2f\n", p_cfg->exemption_credit_limit, EXEMPTION_CREDIT_DISABILITY_LIMIT); + for (line = 1; line <= ECW_NUM_LINES; ++line) { + fprintf( outfile, "INFO: --- Line %2d: %9.2f : '%s'\n", line, ecw_L[line], ecw_line_description[line]); + } + + L[25] = ecw_L[5]; + shownum_or_40(25); + shownum_or_40_nz(26); + + L[27] = SchASC_D[16]; + shownum_or_40_nz(27); + + L[28] = L[25] + L[26] + L[27]; + shownum_or_40_nz(28); + + L[29] = NotLessThanZero(L[24] - L[28]); + shownum_or_40(29); + + L[30] = SmallerOf(SchASC_E[9], L[29]); + shownum_or_40_nz(30); + + L[31] = NotLessThanZero(L[29] - L[30]); + shownum_or_40(31); + + shownum_or_40_nz(32); + shownum_or_40_nz(33); + shownum_or_40_nz(34); + shownum_or_40_nz(35); + shownum_or_40_nz(36); + shownum_or_40_nz(37); + + L[39] = SchASC_F[7]; + shownum_or_40_nz(39); + + L[40] = L[32] + L[33] + L[34] + L[35] + L[36] + L[37] + L[39]; + shownum_or_40(40); + + // Overpayment + L[41] = NotLessThanZero(L[40] - L[31]); + shownum_or_40_nz(41); + + // Net tax owed + L[42] = NotLessThanZero(L[31] - L[40]); + shownum_or_40_nz(42); + + // Penalties and interest + shownum_or_40_nz(43); + + // Interest on underpayment of tax + shownum_or_40_nz(44); + showline_wlabel_or_40_nz("L44a", L44a); + if (bL44b) + fprintf(outfile, "CkL44b X\n"); + + // Total penalties and interest + L[45] = L[43] + L[44]; + shownum_or_40_nz(45); + + // Amount you owe + // If there is an overpayment, and the overpayment is less than + // the total penalties and interest, use the difference as the amount owed. + // still owed, else use tax owed plus penalties and interest + if (L[41] > 0 && (L[41] < L[45])) { + L[46] = L[45] - L[41]; + } else { + L[46] = L[42] + L[45]; + } + shownum_or_40_nz(46); + + // Refund + // From the form OR-40 instructions: + // "If the total penalty and interest is more than your + // overpayment, see the instructions for line 46." Err, what? + // Paraphrasing: "If L[45] > L[41], see the blah,blah,blah". + // Meaning there will be money owed, so the refund will be zero. + // So we simply need to make sure that the output is zero when + // L[45] > L[41], which is handled by the NotLessThanZero operator without + // any other conditions. + L[47] = NotLessThanZero(L[41] - L[45]); + shownum_or_40_nz(47); + + shownum_or_40_nz(48); + shownum_or_40_nz(49); + shownum_or_40_nz(50); + + fprintf(outfile, "L50a: %s\n", L50a); + fprintf(outfile, "L50b: %s\n", L50b); + + shownum_or_40_nz(51); + + // Total refund checkoff amounts + double L52_pre_sum = L[48] + L[49] + L[50] + L[51]; + L[52] = SmallerOf(L52_pre_sum, L[47]); + if (L52_pre_sum > L[47]) { + fprintf(outfile, "INFO: Refund checkoff amount request in L52 of %8.2f has been limited to refund amount: %8.2f\n", + L52_pre_sum, L[47]); + } + + shownum_or_40_nz(52); + + // Net refund + L[53] = NotLessThanZero(L[47] - L[52]); + shownum_or_40_nz(53); + + if (bL54DepOutUS) + fprintf(outfile, "CkL54DepOutUS X\n"); + + if (bAcctChecking) + fprintf(outfile, "CkAcctChecking X\n"); + + if (bAcctSavings) + fprintf(outfile, "CkAcctSavings X\n"); + + fprintf(outfile, "AcctRoutingNumber: %s\n", AcctRoutingNumber); + fprintf(outfile, "AcctNumber: %s\n", AcctNumber); + +#ifdef SHOWNUM_OR_40_TEST + L[7] = -567891234.0; + shownum_or_40(7); + L[7] = -67891234.0; + shownum_or_40(7); + L[7] = -7891234.0; + shownum_or_40(7); + L[7] = -891234.0; + shownum_or_40(7); + L[7] = -91234.0; + shownum_or_40(7); + L[7] = -1234.0; + shownum_or_40(7); + L[7] = -234.0; + shownum_or_40(7); + L[7] = -34.0; + shownum_or_40(7); + L[7] = -3.0; + shownum_or_40(7); + L[7] = 4.0; + shownum_or_40(7); + L[7] = 34.0; + shownum_or_40(7); + L[7] = 1234.0; + shownum_or_40(7); + L[7] = 91234.0; + shownum_or_40(7); + L[7] = 891234.0; + shownum_or_40(7); + L[7] = 7891234.0; + shownum_or_40(7); + L[7] = 67891234.0; + shownum_or_40(7); + L[7] = 567891234.0; + shownum_or_40(7); +#endif // SHOWNUM_OR_40_TEST + + + + /* ----- .... Until here. ----- */ + + + /*** + Summary of useful functions: + GetLine( "label", &variable ) - Looks for "label" in input file, and places the corresponding sum of + values following that label (until ";") into variable. + GetLineF( "label", &variable ) - Like GetLine() above, but also writes the result to the output file. + GetLineFnz(( "label", &variable ) - Like GetLine(), but only writes non-zero values to the output file. + GetLine1( "label", &variable ) - Like GetLine() above, but expects single value (no sum, no ";" in input file). + + c = SmallerOf( a, b ); - Selects smaller of two values. + c = LargerOf( a, b ); - Selects larger of two values. + c = NotLessThanZero( a ); - Selects positive value or zero. Prevents negative values. + + showline( j ) - Writes currency value of L[j] to output file with label in nice format. + shownum( j ) - Writes integer value of L[j] to output file with label in nice format. + showline_wmsg( j, "msg" ) - Like showline, but adds the provided message to the output line. + ShowLineNonZero( j ) - Like showline, but only writes non-zero values. + ShowLineNonZero_wMsg( j, "msg" ) - Like showline_wmsg, but only writes non-zero values. + showline_wlabel( "label", value ) - For custom line names and variables not in the default L[] array. + showline_wlabelnz( "label", value ) - Like showline_wlabel, but only writes non-zero values. + showline_wlabelmsg( "label", value, "msg" ) - Like showline_wlabel,but adds the provided message to the output line. + + ***/ + + fclose(infile); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + + printf("\nListing results from file: %s\n\n", outfname); + Display_File( outfname ); + + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_PA_40_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_PA_40_2024.c new file mode 100755 index 0000000..27a24bb --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_PA_40_2024.c @@ -0,0 +1,268 @@ +/************************************************************************/ +/* TaxSolve_PA40_2024.c - Pennsylvania 2024 PA-40 State Tax Form. */ +/* Copyright (C) 2025, - Aston Roberts */ +/* */ +/* Compile: gcc taxsolve_PA40_2024.c -o taxsolve_PA40_2024 */ +/* Run: ./taxsolve_PA40_2024 PA40_2024.txt */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ +/* */ +/* Aston Roberts 1-2-2025 aston_roberts@yahoo.com */ +/************************************************************************/ + +#define thisversion 22.00 + +#include "taxsolve_routines.c" + +#define SINGLE 1 +#define MARRIED_FILING_JOINTLY 2 +#define MARRIED_FILING_SEPARAT 3 +#define WIDOW 1 +#define Yes 1 +#define No 0 + +double Tax_Rate = 0.0307; /* Updated for 2024 tax-year. */ + + +double pos( double x ) +{ /* Return only positive amounts, otherwise return zero. */ + if (x > 0.0) + return x; + else + return 0.0; +} + + +int main( int argc, char *argv[] ) +{ + int i, j, k, status=0; + char word[2500], *infname=0, outfname[2500]; + time_t now; + double oneA, oneB; + char *Your1stName=0, *YourLastName=0, *Spouse1stName=0, *SpouseLastName, *YourNames; + + /* Decode any command-line arguments. */ + printf("PA40 - 2024 - v%3.1f\n", thisversion); + i = 1; k=1; + while (i < argc) + { + if (strcmp(argv[i],"-verbose")==0) { verbose = 1; } + else + if (k==1) + { + infname = strdup(argv[i]); + 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]); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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 L[24]) + { + L[26] = L[12] + L[25] - L[24]; + showline_wmsg(26,"TAX DUE"); + showline(27); + L[28] = L[26] + L[27]; + if (L[28] > 0.0) + { + showline_wmsg( 28, "Total Payment Due" ); + fprintf(outfile," (Which is %2.1f%% of your total tax.)\n", 100.0 * L[28] / (L[12] + L[25] + 1e-9) ); + } + } + else + if (L[24] > L[12] + L[25] + L[27]) + { + showline(27); + L[29] = L[24] - (L[12] + L[25] + L[27]); + showline_wmsg(29,"OVERPAYMENT"); + L[30] = L[29]; + showline_wmsg(30,"REFUND"); + } + + fprintf(outfile,"\n{ --------- }\n"); + do_all_caps = 1; + Your1stName = GetTextLineF( "Your1stName:" ); + GetTextLineF( "MidInitial:" ); + YourLastName = GetTextLineF( "YourLastName:" ); + GetTextLineF( "YourSocSec#:" ); + Spouse1stName = GetTextLineF( "Spouse1stName:" ); + GetTextLineF( "SpouseMidInit:" ); + SpouseLastName = GetTextLineF( "SpouseLastName:" ); + GetTextLineF( "SpouseSocSec#:" ); + GetTextLineF( "Number&Street:" ); + GetTextLineF( "Town:" ); + fprintf(outfile,"State: PA\n"); + GetTextLineF( "Zipcode:" ); + GetTextLineF( "Phone:" ); + GetTextLineF( "SchoolCode:" ); + GetTextLineF( "SchooldDist:" ); + GetTextLineF( "YourOccupation:" ); + GetTextLineF( "SpouseOccupat:" ); + if (YourLastName[0] != '\0') + { + if (status == MARRIED_FILING_JOINTLY) + { + YourNames = (char *)malloc( strlen(YourLastName) + strlen( Your1stName ) + + strlen( SpouseLastName ) + strlen( Spouse1stName ) + 20 ); + strcpy( YourNames, Your1stName ); + if (strcmp( YourLastName, SpouseLastName ) == 0) + { /* Common last name */ + strcat( YourNames, " & " ); + strcat( YourNames, Spouse1stName ); + strcat( YourNames, ", " ); + strcat( YourNames, YourLastName); + } + else + { + strcat( YourNames, " " ); + strcat( YourNames, YourLastName); + strcat( YourNames, ", " ); + strcat( YourNames, Spouse1stName ); + strcat( YourNames, " " ); + strcat( YourNames, SpouseLastName); + } + } + else + { + YourNames = (char *)malloc( strlen(YourLastName) + strlen( Your1stName ) + 10 ); + strcpy( YourNames, Your1stName ); + strcat( YourNames, ", " ); + strcat( YourNames, YourLastName ); + } + fprintf(outfile,"YourNames: %s\n", YourNames ); + } + fclose(infile); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + printf("\nListing results from file: %s\n\n", outfname); + Display_File( outfname ); + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_US_1040_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_US_1040_2024.c new file mode 100755 index 0000000..b372500 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_US_1040_2024.c @@ -0,0 +1,2879 @@ +/************************************************************************/ +/* TaxSolve_usa_fed1040_2024.c - OpenTaxSolver for USFed1040 */ +/* Copyright (C) 2025 - Aston Roberts */ +/* */ +/* Tax Solver for US Fedral 1040 Income Tax return for 2024 Tax Year. */ +/* */ +/* OTS Project Home Page and Updates: */ +/* http://opentaxsolver.sourceforge.com/ */ +/* */ +/* Compile: cc taxsolve_US_1040_2024.c -o taxsolve_US_1040_2024 */ +/* Run: ./taxsolve_US_1040_2024 Fed1040_2024.txt */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ +/* */ +/* Aston Roberts 1-5-2025 aston_roberts@yahoo.com */ +/************************************************************************/ + +float thisversion=22.06; + +#include +#include +#include +#include +#include +#include +#include "taxsolve_routines.c" + +#define CAP_GAIN_ADJUSTMENT_CODES "BTNHDQXRWLESCMOZY" /* Form 8949 Instructions */ +#define MAXADJERRCNT 25 /* Max number of adj_code errors to print to terminal */ + +#define SINGLE 1 +#define MARRIED_FILING_JOINTLY 2 +#define MARRIED_FILING_SEPARAT 3 +#define HEAD_OF_HOUSEHOLD 4 +#define WIDOW 5 +#define Yes 1 +#define No 0 + +double SchedA[MAX_LINES], SchedB[MAX_LINES], SchedD[MAX_LINES], amtws[MAX_LINES]; +double Sched1[MAX_LINES], Sched2[MAX_LINES], Sched3[MAX_LINES]; +double Sched3_13a=0.0, Sched3_13b=0.0, Sched3_13c=0.0, Sched3_13d=0.0, + Sched3_13z=0.0, SchedD1ad=0.0, SchedD1ae=0.0, SchedD1ah=0.0, SchedD8ad=0.0, SchedD8ae=0.0, SchedD8ah=0.0; +double L1a=0.0, L1b=0.0, L1c=0.0, L1d=0.0, L1e=0.0, L1f=0.0, L1g=0.0, L1h=0.0, L1i=0.0; +double L2a=0.0; /* Tax-exempt interest (only for SocSec calculations). */ +double L3a=0.0; /* Qualified dividends. */ +double L4a=0.0; /* IRA distributions */ +double L5a=0.0; /* Pensions, and annuities. */ +double L6a=0.0; /* Social security benefits. */ +double L25a=0.0, L25b=0.0, L25c=0.0; +double L27a=0.0, L27b=0.0, L27c=0.0; +double Sched2_1a=0.0, Sched2_1b=0.0, Sched2_1c=0.0, Sched2_1d=0.0, Sched2_1e=0.0, Sched2_1f=0.0, Sched2_1y=0.0, Sched2_1z=0.0; +double S4_60b=0.0; /* First-time homebuyer credit repayment. Form 5405. */ +double qcgws[MAX_LINES]; /* Support for AMT calculation. (qual.div+cap.gain wrksht vals.)*/ +double amtws2c=0.0; /* Investment interest expense (difference between regular tax and AMT) - AMT entry */ +double amtws2g=0.0; /* Specified private activity bond interest exempt from regular tax - AMT entry */ +int Do_SchedD=No, Do_QDCGTW=No, Do_SDTW=No; +int status, under65=Yes, over65=No, dependent=No, force_print_all_pdf_forms=0; +int ForceItemize=0; +double localtax[10], loctaxlimit, homemort[10]; +double collectibles_gains=0.0, ws_sched_D[MAX_LINES]; + +char adj_code_err[MAXADJERRCNT][1024]; +int adjerrcnt=0; + + /* Following values taken from 1040-Instructions pg 110. */ /* Updated for 2024. */ +double brkpt[4][9]={ + { 0.0, 11600.0, 47150.0, 100525.0, 191950.0, 243725.0, 609350.0, 9e19 }, /* Single */ + { 0.0, 23200.0, 94300.0, 201050.0, 383900.0, 487450.0, 731201.0, 9e19 }, /* Married, filing jointly. */ + { 0.0, 11600.0, 47150.0, 100525.0, 191950.0, 243725.0, 365600.0, 9e19 }, /* Married, filing separate. */ + { 0.0, 16550.0, 63100.0, 100500.0, 191950.0, 243700.0, 609350.0, 9e19 }, /* Head of Household. */ + }; + double txrt[4][9] ={ + { 0.1, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37 }, /* Single */ + { 0.1, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37 }, /* Married, filing jointly. */ + { 0.1, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37 }, /* Married, filing separate. */ + { 0.1, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37 }, /* Head of Household. */ + }; + + +double TaxRateFormula( double x, int status ) /* Returns tax due. */ +{ + double sum=0.0; + int bracket=0; + if (status == WIDOW) status = MARRIED_FILING_JOINTLY; /* Handle case of widow(er). */ + status = status - 1; /* Arrays start at zero; not one. */ + while (brkpt[status][bracket+1] < x) + { + sum = sum + (brkpt[status][bracket+1] - brkpt[status][bracket]) * txrt[status][bracket]; + bracket = bracket + 1; + } + return (x - brkpt[status][bracket]) * txrt[status][bracket] + sum; +} + + +void Report_bracket_info( double income, double actual_tax, int status ) +{ + int bracket=0; + if (status == WIDOW) status = MARRIED_FILING_JOINTLY; /* Handle case of widow(er). */ + status = status - 1; /* Arrays start at zero; not one. */ + while (brkpt[status][bracket+1] < income) bracket++; + printf(" You are in the %2.1f%% marginal tax bracket,\n and you are paying an effective %2.1f%% tax on your income.\n", + 100.0 * txrt[status][bracket], 100.0 * (actual_tax) / (income + 1e-9) ); + fprintf(outfile," You are in the %2.1f%% marginal tax bracket,\n and you are paying an effective %2.1f%% tax on your income.\n", + 100.0 * txrt[status][bracket], 100.0 * (actual_tax) / (income + 1e-9) ); +} + + +double TaxRateFunction( double income, int status ) /* Emulates table lookup or function appropriately. */ +{ + double x, dx, tx; + int k; + if (income < 100000.0) /* Quantize to match tax-table exactly. */ + { + if (income < 25.0) x = 5.0; else + if (income < 3000.0) x = 25.0; else x = 50.0; + dx = 0.5 * x; + k = income / x; + x = x * (double)k + dx; + tx = (int)(TaxRateFormula( x, status ) + 0.5); + } + else + tx = TaxRateFormula( income, status ); + return tx; +} + + + +void showschedA( int linenum ) +{ if (SchedA[linenum] > 0.0) fprintf(outfile," A%d = %6.2f\n", linenum, SchedA[linenum] ); } + +void showschedA_wMsg( int linenum, char *msg ) +{ if (SchedA[linenum] > 0.0) fprintf(outfile," A%d = %6.2f %s\n", linenum, SchedA[linenum], msg ); } + +void print2( char *msg ) +{ + printf("%s", msg ); + fprintf(outfile, "%s", msg ); +} + + +/*-----------------------------------------------------------------*/ +/* Qualified Dividends and Capital Gain Tax Worksheet for Line 16. */ +/* From page 36 of main instructions (i1040gi.pdf). */ +/*-----------------------------------------------------------------*/ +void capgains_qualdividends_worksheets( int status ) /* Updated for 2024. */ +{ + int j; + + qcgws[1] = L[15]; + qcgws[2] = L3a; + if (Do_SchedD) + qcgws[3] = NotLessThanZero(smallerof( SchedD[15], SchedD[16] )); + else + qcgws[3] = L[7]; + qcgws[4] = qcgws[2] + qcgws[3]; + qcgws[5] = NotLessThanZero( qcgws[1] - qcgws[4] ); + switch (status) + { + case SINGLE: case MARRIED_FILING_SEPARAT: qcgws[6] = 47025.0; break; + case MARRIED_FILING_JOINTLY: case WIDOW: qcgws[6] = 94050.0; break; + case HEAD_OF_HOUSEHOLD: qcgws[6] = 63000.0; break; + } + qcgws[7] = smallerof( qcgws[1], qcgws[6] ); + qcgws[8] = smallerof( qcgws[5], qcgws[7] ); + qcgws[9] = qcgws[7] - qcgws[8]; // This amount is taxed at 0% + qcgws[10] = smallerof( qcgws[1], qcgws[4] ); + qcgws[11] = qcgws[9]; + qcgws[12] = qcgws[10] - qcgws[11]; + switch (status) + { + case SINGLE: qcgws[13] = 518900.0; break; + case MARRIED_FILING_SEPARAT: qcgws[13] = 291850.0; break; + case MARRIED_FILING_JOINTLY: case WIDOW: qcgws[13] = 583750.0; break; + case HEAD_OF_HOUSEHOLD: qcgws[13] = 551350.0; break; + } + qcgws[14] = smallerof( qcgws[1], qcgws[13] ); + qcgws[15] = qcgws[5] + qcgws[9]; + qcgws[16] = NotLessThanZero( qcgws[14] - qcgws[15] ); + qcgws[17] = smallerof( qcgws[12], qcgws[16] ); + qcgws[18] = 0.15 * qcgws[17]; + qcgws[19] = qcgws[9] + qcgws[17]; + qcgws[20] = qcgws[10] - qcgws[19]; + qcgws[21] = 0.20 * qcgws[20]; + qcgws[22] = TaxRateFunction( qcgws[5], status ); + qcgws[23] = qcgws[18] + qcgws[21] + qcgws[22]; + qcgws[24] = TaxRateFunction( qcgws[1], status ); + qcgws[25] = smallerof( qcgws[23], qcgws[24] ); + for (j = 1; j <= 25; j++) + { + printf(" Qual. Div & Gains WorkSheet %d: %8.2f\n", j, qcgws[j] ); + if (j == 3) { if (Do_SchedD) fprintf(outfile,"\t\t3: Check Yes.\n"); else fprintf(outfile,"\t\t3: Check No.\n"); } + fprintf(outfile," Qual. Div & Gains WorkSheet %d: %8.2f\n", j, qcgws[j] ); + } + L[16] = Conditional_Round( qcgws[25] ); +} + + + + +/*----------------------------------------------------------------------------------------------*/ +/* Form-6251 - Alternative Minimum Tax (AMT) form detailed calculations. */ +/* This routine establishes the framework for the 6251 form, for the limited few who need it. */ +/* Form 6251 asks many highly specialized questions, which are assumed zero for most filers. */ +/* Those who should make the additional entries will no-doubt know who they are, and can */ +/* simply add them to this section. The balance of the routine will be helpful in either case. */ +/* --- Anyone indicated to fill-out Form 6251 should review the 6251 instruction booklet. --- */ +/*----------------------------------------------------------------------------------------------*/ +double form6251_AlternativeMinimumTax( int itemized ) /* Updated for 2024. */ +{ + double thresholdA=0.0, thresholdB=0.0, thresholdC=0.0, amtexmption=0.0; + double offsetA=0.0; + double amtws2a=0.0, amtws2b=0.0, amtws2e=0.0; + int j, file_amt=1; + + printf("Review AMT form6251 routine for your situation.\n"); + fprintf(outfile,"Review AMT form6251 routine for your situation.\n"); + + /* Part I - Alternative Minimum Taxable Income (AMTI) */ + if (L[15] > 0.0) + amtws[1] = L[15]; + else + amtws[1] = L[11] - L[14]; + + if (itemized) + amtws2a = SchedA[7]; + else + amtws2a = L[12]; + + amtws2b = -(Sched1[1] + Sched1[8]); + + /* Following amounts assumed normally zero, but review and adjust if needed. */ + // amtws2c = 0.0; /* Investment interest expense. (Diff between regular tax and AMT). */ + // amtws2d = 0.0; /* Depletion (Diff between regular tax and AMT). */ + amtws2e = absolutev( Sched1[8] ); + // amtws2f = -0.0; /* Alternative tax net operating loss deduction, as negative amount. */ + // amtws2g = 0.0; /* Interest from specified private activity bonds exempt from the regular tax */ + // amtws2h = 0.0; /* Qualified small business stock (7% of gain excluded under section 1202) */ + // amtws2i = 0.0; /* Exercise incentive stock options (excess of AMT income over reg tax income) */ + // amtws2j = 0.0; /* Estates and trusts (amount from Schedule K-1 (Form 1041), box 12, code A) */ + // amtws2k = 0.0; /* Disposition of property (difference between AMT and regular tax gain or loss) */ + // amtws2l = 0.0; /* Deprec assets placed in service after 1986 (diff between regular tax and AMT) */ + // amtws2m = 0.0; /* Passive activities (difference between AMT and regular tax income or loss) */ + // amtws2n = 0.0; /* Loss limitations (difference between AMT and regular tax income or loss) */ + // amtws2o = 0.0; /* Circulation costs (difference between regular tax and AMT) */ + // amtws2p = 0.0; /* Long-term contracts (difference between AMT and regular tax income) */ + // amtws2q = 0.0; /* Mining costs (difference between regular tax and AMT) */ + // amtws2r = 0.0; /* Research and experimental costs (difference between regular tax and AMT) */ + // amtws2s = -0.0; /* Income from certain installment sales before 1/1/87 (As negaitive amount.) */ + // amtws2t = 0.0; /* Intangible drilling costs preference */ + + amtws[2] = amtws2a + amtws2b + amtws2c + amtws2e + amtws2g; + + for (j = 1; j <= 3; j++) + amtws[4] = amtws[4] + amtws[j]; + + if ((status == MARRIED_FILING_SEPARAT) && (amtws[4] > 831150.0)) + { + if (amtws[4] > 1084150.0) + amtws[4] = amtws[4] + 63250.0; + else + amtws[4] = amtws[4] + 0.25 * (amtws[4] - 831150.0); + } + + /* Part II */ + switch (status) + { + case SINGLE: case HEAD_OF_HOUSEHOLD: + thresholdA = 609350.0; + thresholdB = 952150.0; + thresholdC = 232600; + offsetA = 4652.0; + amtexmption = 85700.0; + break; + case MARRIED_FILING_JOINTLY: case WIDOW: + thresholdA = 1218700.0; + thresholdB = 1751900.0; + thresholdC = 232600.0; + offsetA = 4652.0; + amtexmption = 133300.0; + break; + case MARRIED_FILING_SEPARAT: + thresholdA = 609350.0; + thresholdB = 875950.0; + thresholdC = 116300.0; + offsetA = 2326.0; + amtexmption = 66650.0; + break; + default: printf("Status %d not handled.\n", status); exit(1); + } + + if (amtws[4] > thresholdA) + { /* Exemption Worksheet - page 9. */ + double ews[20]; + if (amtws[4] >= thresholdB) + amtexmption = 0.0; + else + { + ews[1] = amtexmption; + ews[2] = amtws[4]; + ews[3] = thresholdA; + ews[4] = NotLessThanZero( ews[2] - ews[3] ); + ews[5] = 0.25 * ews[4]; + ews[6] = NotLessThanZero( ews[1] - ews[5] ); + amtexmption = ews[6]; + /* Does not handle "Certain Children Under Age 24". */ + } + } + + amtws[5] = amtexmption; + amtws[6] = NotLessThanZero( amtws[4] - amtws[5] ); + if (amtws[6] > 0.0) + { /* AMT Lines 7 through 9, */ + + if ((L[7] != 0.0) || (L3a != 0.0) || ((SchedD[15] > 0.0) && (SchedD[16] > 0.0))) + { /* Part III */ + amtws[12] = amtws[6]; + amtws[13] = largerof( qcgws[4], ws_sched_D[13] ); + amtws[14] = SchedD[19]; + if (Do_SDTW) + amtws[15] = smallerof( amtws[13] + amtws[14], ws_sched_D[10] ); + else + amtws[15] = amtws[13]; + amtws[16] = smallerof( amtws[12], amtws[15] ); + amtws[17] = amtws[12] - amtws[16]; + if (amtws[17] <= thresholdC) + amtws[18] = 0.26 * amtws[17]; + else + amtws[18] = 0.28 * amtws[17] - offsetA; + switch (status) + { + case MARRIED_FILING_JOINTLY: case WIDOW: + amtws[19] = 94050.0; + break; + case SINGLE: case MARRIED_FILING_SEPARAT: + amtws[19] = 47025.0; + break; + case HEAD_OF_HOUSEHOLD: + amtws[19] = 63000.0; + } + if (Do_QDCGTW) + amtws[20] = NotLessThanZero( qcgws[5] ); + else + if (Do_SDTW) + amtws[20] = NotLessThanZero( ws_sched_D[14] ); + else + amtws[20] = NotLessThanZero( L[15] ); + amtws[21] = NotLessThanZero( amtws[19] - amtws[20] ); + amtws[22] = smallerof( amtws[12], amtws[13] ); + amtws[23] = smallerof( amtws[21], amtws[22] ); + amtws[24] = amtws[22] - amtws[23]; + switch (status) + { + case SINGLE: amtws[25] = 518900.0; break; + case MARRIED_FILING_SEPARAT: amtws[25] = 291850.0; break; + case MARRIED_FILING_JOINTLY: case WIDOW: amtws[25] = 583750.0; break; + case HEAD_OF_HOUSEHOLD: amtws[25] = 551350.0; break; + default: printf("Status %d not handled.\n", status); exit(1); + } + amtws[26] = amtws[21]; + if (Do_QDCGTW) + amtws[27] = NotLessThanZero( qcgws[5] ); + else + if (Do_SDTW) + amtws[27] = NotLessThanZero( ws_sched_D[21] ); + else + amtws[27] = NotLessThanZero( L[15] ); + amtws[28] = amtws[26] + amtws[27]; + amtws[29] = NotLessThanZero( amtws[25] - amtws[28] ); + amtws[30] = smallerof( amtws[24], amtws[29] ); + amtws[31] = 0.15 * amtws[30]; + amtws[32] = amtws[23] + amtws[30]; + if (absolutev( amtws[12] - amtws[32] ) > 0.005) + { /*lines 33-37*/ + amtws[33] = amtws[22] - amtws[32]; + amtws[34] = 0.20 * amtws[33]; + if (amtws[35] != 0.0) + { /*lines 35-37*/ + amtws[35] = amtws[17] + amtws[32] + amtws[33]; + amtws[36] = amtws[12] - amtws[35]; + amtws[37] = 0.25 * amtws[36]; + } /*lines 35-37*/ + } /*lines 33-37*/ + amtws[38] = amtws[18] + amtws[31] + amtws[34] + amtws[37]; + if (amtws[12] <= thresholdC) + amtws[39] = 0.26 * amtws[12]; + else + amtws[39] = 0.28 * amtws[12] - offsetA; + amtws[40] = smallerof( amtws[38], amtws[39] ); + amtws[7] = amtws[40]; + } /* Part III */ + else + { + if (amtws[6] <= thresholdC) + amtws[7] = 0.26 * amtws[6]; + else + amtws[7] = 0.28 * amtws[6] - offsetA; + } + amtws[9] = amtws[7] - amtws[8]; + } + amtws[10] = L[16] + Sched2_1a - Sched3[1]; + if (amtws[6] > 0.0) + amtws[11] = NotLessThanZero( amtws[9] - amtws[10] ); + printf(" AMTws[11] = Abs( %6.2f - %6.2f ) = Abs( %6.2f )\n", amtws[9], amtws[10], amtws[9] - amtws[10] ); + // Sched2_1a = amtws[11]; /* Redundant. Is assigned by return value below. */ + + /* These rules are stated on Form-6251 Instructions page-1. */ + if (amtws[7] > amtws[10]) + { + file_amt = Yes; + fprintf(outfile,"You MUST file AMT form 6251. (%g > %g)\n", amtws[7], amtws[10] ); + } + else + { + if (amtws2c + amtws2e + amtws2g + amtws[3] < 0.0) + { + file_amt = Yes; + fprintf(outfile,"You may need to file AMT form 6251. (sum(AMTws2c : AMTws3) = %g < 0.\n", + amtws2c + amtws2e + amtws2g + amtws[3] ); + fprintf(outfile," (See \"Who Must File\" on page-1 of Instructions for Form-6251.)\n"); + } + else + file_amt = No; + } + if (force_print_all_pdf_forms) + file_amt = 1; + if (file_amt) + fprintf(outfile,"PDFpage: 15 15\n"); /* Optional PDF Page. */ + for (j=0; j<100; j++) + { + if (j == 2) + { + char tmplabel[1024]; + sprintf( tmplabel, " AMT_Form_6251_L2a"); + showline_wlabelnz( tmplabel, amtws2a ); + sprintf( tmplabel, " AMT_Form_6251_L2b"); + showline_wlabelnz( tmplabel, amtws2b ); + sprintf( tmplabel, " AMT_Form_6251_L2c"); + showline_wlabelnz( tmplabel, amtws2c ); + sprintf( tmplabel, " AMT_Form_6251_L2e"); + showline_wlabelnz( tmplabel, amtws2e ); + sprintf( tmplabel, " AMT_Form_6251_L2g"); + showline_wlabelnz( tmplabel, amtws2g ); + } + if ((j == 11) || (amtws[j] != 0.0)) + { + printf(" AMT Form 6251 L%d = %8.2f\n", j, amtws[j] ); + fprintf(outfile," AMT_Form_6251_L%d = %8.2f\n", j, amtws[j] ); + } + if (file_amt && (j == 11)) + fprintf(outfile,"EndPDFpage.\nPDFpage: 16 16\n"); + } + if (file_amt) + fprintf(outfile,"EndPDFpage.\n"); + fprintf(outfile," AMTws[11] = OnlyIfMoreThanZero( %6.2f - %6.2f ) = %6.2f\n", amtws[9], amtws[10], amtws[11] ); + fprintf(outfile,"Your Alternative Minimum Tax = %8.2f\n", amtws[11] ); + printf("Your Alternative Minimum Tax = %8.2f\n", amtws[11] ); + return amtws[11]; +} + + + + + +struct FedReturnData + { + double fedline[MAX_LINES], schedD[MAX_LINES]; + int Exception, Itemized; + } LastYearsReturn; + + +void convert_slashes( char *fname ) +{ /* Convert slashes in file name based on machine type. */ + char *ptr; + #ifdef __MINGW32__ + char slash_sreach='/', slash_replace='\\'; + #else + char slash_sreach='\\', slash_replace='/'; + #endif + + ptr = strchr( fname, slash_sreach ); + while (ptr) + { + ptr[0] = slash_replace; + ptr = strchr( fname, slash_sreach ); + } +} + + +void ImportFederalReturnData( char *fedlogfile, struct FedReturnData *fed_data ) +{ + FILE *infile; + char fline[1000], word[1000]; + int linenum; + + for (linenum=0; linenumfedline[linenum] = 0.0; fed_data->schedD[linenum] = 0.0; } + convert_slashes( fedlogfile ); + printf("Opening LastYearsFedReturn: '%s'\n", fedlogfile ); + infile = fopen(fedlogfile, "r"); + if (infile==0) + { + printf("Error: Could not open federal return '%s'\n", fedlogfile); + fprintf(outfile,"Error: Could not open federal return '%s'\n", fedlogfile); + exit(1); + } + printf("Importing Last Year's Federal Return Data from file '%s'\n", fedlogfile ); + fed_data->Itemized = 1; /* Set initial default values. */ + read_line(infile,fline); linenum = 0; + while (!feof(infile)) + { + if (strstr(fline,"Use standard deduction.")!=0) fed_data->Itemized = 0; + next_word(fline, word, " \t="); + if ((strstr(word,"L")==word) && (strstr(fline," = ")!=0)) + { + if (sscanf(&word[1],"%d",&linenum)!=1) printf("Error: Reading fed line number '%s%s'\n",word,fline); + next_word(fline, word, " \t="); remove_certain_chars( word, "," ); + if (sscanf(word,"%lf", &fed_data->fedline[linenum])!=1) + printf("Error: Reading fed line %d '%s%s'\n",linenum,word,fline); + if (verbose) printf("FedLin[%d] = %2.2f\n", linenum, fed_data->fedline[linenum]); + } + if ((strstr(word,"D") == word) && (strstr(fline," = ") != 0)) + { + if (sscanf(&word[1],"%d",&linenum)!=1) printf("Error: Reading fed line number '%s%s'\n",word,fline); + next_word(fline, word, " \t="); remove_certain_chars( word, "," ); + if (sscanf(word,"%lf", &fed_data->schedD[linenum]) != 1) + { + if (strcasecmp(word,"yes") == 0) fed_data->schedD[linenum] = 1; + else + if (strcasecmp(word,"no") == 0) fed_data->schedD[linenum] = 0; + else + printf("Error: Reading fed schedD %d '%s%s'\n",linenum,word,fline); + } + if (verbose) printf("FedLin[%d] = %2.2f\n", linenum, fed_data->schedD[linenum]); + } + read_line(infile,fline); + } + fclose(infile); +} + + +void CapitalLossCarryOverWorksheet( char *fedlogfile, struct FedReturnData *LastYearsReturn ) /* Updated for 2024. */ +{ /* From instructions page D-11. */ + double ws[50]; + int k; + + for (k=0; k < 50; k++) /* First, pre-initialize worksheet lines to zero. */ + ws[k] = 0.0; + + ImportFederalReturnData( fedlogfile, LastYearsReturn ); + if (LastYearsReturn->schedD[21] == 0.0) + { + printf(" No carry-over loss.\n"); + fprintf(outfile," No carry-over loss.\n"); + return; /* Use this worksheet only if last year's D[21] was a loss. */ + } + if ((absolutev(LastYearsReturn->schedD[21]) >= absolutev(LastYearsReturn->schedD[16])) && (LastYearsReturn->fedline[15] >= 0.0)) + { + printf(" No carry-over loss.\n"); + fprintf(outfile," No carry-over loss.\n"); + return; + } + + for (k=0; k<50; k++) ws[k] = 0.0; + ws[1] = LastYearsReturn->fedline[15]; + ws[2] = absolutev( LastYearsReturn->schedD[21] ); /* Loss from last year's Sched-D21 as positive amount. */ + ws[3] = NotLessThanZero( ws[1] + ws[2] ); + ws[4] = smallerof( ws[2], ws[3] ); + for (k=1; k<=4; k++) + { + printf("\tCarryOverWs%d = %2.2f\n", k, ws[k] ); + fprintf(outfile,"\tCarryOverWs%d = %2.2f\n", k, ws[k] ); + } + if (LastYearsReturn->schedD[7] < 0.0) + { /*lines5-8*/ + ws[5] = -LastYearsReturn->schedD[7]; + ws[6] = NotLessThanZero( LastYearsReturn->schedD[15] ); + ws[7] = ws[4] + ws[6]; + ws[8] = NotLessThanZero( ws[5] - ws[7] ); + if (ws[8] > 0.0) + SchedD[6] = ws[8]; + for (k=5; k<=8; k++) + { + printf("\tCarryOverWs%d = %2.2f\n", k, ws[k] ); + fprintf(outfile,"\tCarryOverWs%d = %2.2f\n", k, ws[k] ); + } + } /*lines5-8*/ + else + printf("\t(Skip CarryOverWs lines 5-8.)\n"); + + if (LastYearsReturn->schedD[15] < 0.0) + { /*lines9-13*/ + ws[9] = absolutev( LastYearsReturn->schedD[15] ); + ws[10] = NotLessThanZero( LastYearsReturn->schedD[7] ); + ws[11] = NotLessThanZero( ws[4] - ws[5] ); + ws[12] = ws[10] + ws[11]; + ws[13] = NotLessThanZero( ws[9] - ws[12] ); + if (ws[13] > 0.0) + SchedD[14] = ws[13]; + for (k=9; k<=13; k++) + { + printf("\tCarryOverWs%d = %2.2f\n", k, ws[k] ); + fprintf(outfile,"\tCarryOverWs%d = %2.2f\n", k, ws[k] ); + } + } /*lines9-13*/ + else + printf("\t(Skip CarryOverWorkSheet lines 9-13.)\n"); +} + + + +struct capgain_record + { + char *comment, *buy_date, *sell_date, *adj_code; + double buy_amnt, sell_amnt, adj_amnt; + struct capgain_record *nxt; + } *short_trades=0, *long_trades=0; + +double total_sales, total_costs=0.0, total_adjs; + + +void new_capgain( struct capgain_record **list, char *comment, double buy_amnt, + char *buy_date, double sell_amnt, char *sell_date, char *adj_code, double adj_amnt ) +{ /* Add a new entry to a list. */ + struct capgain_record *new_item, *prev; + + new_item = (struct capgain_record *)malloc( sizeof(struct capgain_record) ); + new_item->comment = strdup( comment ); /* Make new list item and fill-in its fields. */ + if (strlen( new_item->comment ) > 31) + new_item->comment[31] = '\0'; /* Limit comment length to avoid over-running column boundary. */ + new_item->buy_amnt = buy_amnt; + new_item->buy_date = strdup( buy_date ); + new_item->sell_amnt = sell_amnt; + new_item->sell_date = strdup( sell_date ); + new_item->adj_code = strdup( adj_code ); + new_item->adj_amnt = adj_amnt; + new_item->nxt = 0; + prev = *list; /* Insert onto end of list. */ + if (prev == 0) + *list = new_item; + else + { + while (prev->nxt != 0) prev = prev->nxt; + prev->nxt = new_item; + } +} + + +void print_capgain_list( struct capgain_record *list, int section, char *message, char *pdfmsg ) +{ + struct capgain_record *item; + char word[4096], row='a'; + char pdf_adj_code[20]; + + /* First write results in easily human-readable format. */ + total_sales = 0.0; + total_costs = 0.0; + total_adjs = 0.0; + fprintf(outfile,"\n%s\n", message ); + fprintf(outfile," %d. (a Description) (b Buy Date) (c Date Sold) (d Sold Price) (e Cost) (f Code) (g Adj) (h Gain)\n", section ); + fprintf(outfile," ------------------------------------------------------------------------------------------------------------------------\n"); + item = list; + while (item != 0) + { + strcpy( word, item->comment ); + if (strlen( word ) > 27) word[30] = '\0'; + if ((strlen(word) > 0) && (word[ strlen(word) - 1 ] == '}')) word[ strlen(word) - 1 ] = '\0'; + while (strlen( word ) < 27) strcat( word, " " ); /* Fields become formatted right-justified. */ + fprintf(outfile," %s %10s %10s %14.2f %14.2f %10s %14.2f %14.2f\n", word, item->buy_date, item->sell_date, item->sell_amnt, + absolutev(item->buy_amnt), item->adj_code, item->adj_amnt, item->sell_amnt + item->buy_amnt + item->adj_amnt ); + total_sales = total_sales + item->sell_amnt; + total_costs = total_costs + item->buy_amnt; + total_adjs = total_adjs + item->adj_amnt; + item = item->nxt; + } + fprintf(outfile," ------------------------------------------------------------------------------------------------------------------------\n"); + fprintf(outfile," %d. Totals: %14.2f %14.2f %14.2f %14.2f\n\n", + section + 1, total_sales, absolutev(total_costs), total_adjs, total_sales + total_costs + total_adjs ); + + /* Now re-list them for update by the PDF-Convertor. */ + fprintf(outfile,"PDFpage: %s\n", pdfmsg ); /* Optional PDF page. */ + item = list; + while (item != 0) + { + if (row > 'n') + { /* All form-entries filled, go to new form-page. */ + fprintf(outfile," F8949_2d = ...\n"); + fprintf(outfile," F8949_2e = ...\n"); + fprintf(outfile," F8949_2h = ...\n"); + fprintf(outfile,"EndPDFpage.\nPDFpage: %s\n", pdfmsg ); /* Overflow page. */ + row = 'a'; + } + fprintf(outfile," F8949_1%ca: %s\n", row, item->comment ); + fprintf(outfile," F8949_1%cb: %s\n", row, item->buy_date ); + fprintf(outfile," F8949_1%cc: %s\n", row, item->sell_date ); + fprintf(outfile," F8949_1%cd = %14.2f\n", row, item->sell_amnt ); + fprintf(outfile," F8949_1%ce = %14.2f\n", row, absolutev(item->buy_amnt) ); + if (strcmp(item->adj_code, "~") == 0 ) /* if match */ + strcpy(pdf_adj_code, " "); /* Convert "~" to " " for PDF form */ + else + { + strcpy(pdf_adj_code, item->adj_code); + } + fprintf(outfile," F8949_1%cf = %3s\n", row, pdf_adj_code ); + if (item->adj_amnt != 0.0) + fprintf(outfile," F8949_1%cg = %14.2f\n", row, item->adj_amnt ); + fprintf(outfile," F8949_1%ch = %14.2f\n", row, item->sell_amnt + item->buy_amnt + item->adj_amnt); + row++; + item = item->nxt; + } + fprintf(outfile," F8949_2d = %14.2f\n", total_sales ); + fprintf(outfile," F8949_2e = %14.2f\n", absolutev(total_costs) ); + fprintf(outfile," F8949_2g = %14.2f\n", total_adjs ); + fprintf(outfile," F8949_2h = %14.2f\n", total_sales + total_costs + total_adjs ); + fprintf(outfile,"EndPDFpage.\n\n"); +} + + +void free_capgain_list( struct capgain_record **list ) +{ + struct capgain_record *olditem; + + while (*list != 0) + { + olditem = *list; + *list = (*list)->nxt; + free( olditem->comment ); + free( olditem ); + } +} + + +int is_date1_beyond_date2 (struct date_rec date1, struct date_rec date2) +{ + if ( (date1.year > date2.year) + || ((date1.year == date2.year) && (date1.month > date2.month)) + || ((date1.year == date2.year) && (date1.month == date2.month) && (date1.day > date2.day)) ) + return (1); /* True - Date1 is beyond Date2 */ + else + return (0); /* False */ +} + +void adj_code_validity_check (char *adj_code, char *errmsg ) +{ + char *okcodes = CAP_GAIN_ADJUSTMENT_CODES; + char up_adj_code; + char lwrcasemsg[1024]; + int j=0, k; /* j is adj_code index, k is okcodes index */ + int errindex; + + if (adjerrcnt < MAXADJERRCNT) /* Capture up to MAXADJERRCNT errors */ + { + if (strcmp(adj_code, "~") != 0) /* check for no-data place holder, leave as is */ + { + while (adj_code[j] != '\0') + { + if ( ! isalpha(adj_code[j])) + { + adjerrcnt++; + errindex = adjerrcnt - 1; + strcpy(adj_code_err[errindex], errmsg); + } + else + { /* is alpha */ + k=0; + up_adj_code = toupper(adj_code[j]); + while ( (okcodes[k] != '\0') && (up_adj_code != okcodes[k]) ) k++; /* Look for uppercased match */ + if (okcodes[k] != '\0') /* Have an uppercased match */ + { + if ( adj_code[j] != up_adj_code) + { + adjerrcnt++; + strcpy (lwrcasemsg, errmsg); + strcat (lwrcasemsg, " * Case Error - Should be Capitalized *"); + errindex = adjerrcnt - 1; + strcpy(adj_code_err[errindex], lwrcasemsg); + } + } + else + { /* No uppercased match */ + adjerrcnt++; + errindex = adjerrcnt - 1; + strcpy(adj_code_err[errindex], errmsg); + } + } /* is alpha */ + j++; + } /* while adj_code */ + } /* strcmp */ + } /* if adjerrcnt < MAXADJERRCNT */ +} + +void Display_adj_code_err() +{ + int i, index; + + printf("\n\n\n***** CAUTION: Possible Invalid Form 8949 Adjustment Code *****\n"); + printf("***** Does NOT affect processing *****\n\n"); + printf("Code Section Description BuyDate DateSold\n"); + for ( i = 1; i <= adjerrcnt; i++) /* adjerrcnt will never exceed MAXADJERRCNT */ + { + index = i - 1; + printf("\n %s \n", adj_code_err[index] ); + } + } + + +/* Grab Spreadsheet for Capital Sales (Gain/Loss) of Form-8949 from a CSV or Tab-delimited file. */ +void get_CSV_8949( char *spreadsheet_name ) +{ + char sline[4096], word[4096], delim=','; + char descrip[512], date_bought[512], date_sold[512], adj_code[512], adjcodeerrmsg[4096]; + double proceeds, cost, adj_amnt; + struct date_rec buydate, selldate, annivdate; + enum {none, short_term, long_term} term_flg=none; + int err=0; + FILE *sfile; /* Spreadsheet-File. */ + + remove_certain_chars( spreadsheet_name, "\"" ); /* Allow spaces in file-paths. */ + printf("Opening Form-849 Spreadsheet: '%s'\n", spreadsheet_name ); + sfile = fopen( spreadsheet_name, "r" ); + if (sfile == 0) + { + printf("ERROR: Could not open f8949 spreadsheet file '%s' for reading.\n", spreadsheet_name ); + fprintf(outfile,"ERROR: Could not open f8949 spreadsheet file '%s' for reading.\n", spreadsheet_name ); + return; + } + Do_SchedD = Yes; + + /* Expect f8949 spreadsheet file name extension to be ".csv", ".tsv", or ".txt". */ + strcpy( word, spreadsheet_name ); + capitalize( word ); + if (strstr( word, ".CSV" )) + delim = ','; + else + if (strstr( word, ".TSV" )) + delim = '\t'; + else + if (strstr( word, ".TXT" )) + { /* Try to determine if file is CSV or TSV. */ + read_line_safe( sfile, sline, 4096 ); + if (strstr( sline, "\t" )) + delim = '\t'; + fclose( sfile ); /* Reload file. */ + sfile = fopen( spreadsheet_name, "r" ); + } + else + { + printf("ERROR: f8949 Spreadsheet file '%s' is not '.csv', '.tsv', or '.txt'.\n", spreadsheet_name ); + fprintf(outfile,"ERROR: f8949 Spreadsheet file '%s' is not '.csv', '.tsv', or '.txt'.\n", spreadsheet_name ); + fclose( sfile ); + return; + } + if (delim == ',') + fprintf(outfile," Reading Comma-delimited spreadsheet file.\n"); + else + fprintf(outfile," Reading Tab-delimited spreadsheet file.\n"); + + /* Expect 1st line of spreadsheet file to be: + Description, Date_Acquired, Date_Sold, Proceeds, Cost, Code, Adjustment + */ + read_line_safe( sfile, sline, 4096 ); + next_csv( sline, word, delim ); capitalize( word ); + if (!strstr( word, "DESCRIP" )) err++; + next_csv( sline, word, delim ); capitalize( word ); + if (!strstr( word, "ACQUIRED" )) err++; + next_csv( sline, word, delim ); capitalize( word ); + if (!strstr( word, "SOLD" )) err++; + next_csv( sline, word, delim ); capitalize( word ); + if (!strstr( word, "PROCEED" )) err++; + next_csv( sline, word, delim ); capitalize( word ); + if (!strstr( word, "COST" )) err++; + if (err) + { + printf("ERROR: f8949 Spreadsheet file '%s' does not have expected header-line.\n", spreadsheet_name ); + fprintf(outfile,"ERROR: f8949 Spreadsheet file '%s' does not have expected header-line.\n", spreadsheet_name ); + fclose( sfile ); + return; + } + + read_line_safe( sfile, sline, 4096 ); + while (!feof( sfile )) + { + consume_leading_trailing_whitespace( sline ); + if (strlen( sline ) > 1) + { /*valid_line*/ + if (verbose) fprintf(outfile,"ReadLine: '%s'\n", sline ); + term_flg = none; /* Initialize */ + next_csv( sline, descrip, delim ); + if (verbose) fprintf(outfile,"Descript = '%s', Line = '%s'\n", descrip, sline ); + next_csv( sline, date_bought, delim ); + if (verbose) fprintf(outfile,"BuyDate = '%s', Line = '%s'\n", date_bought, sline ); + if (mystrcasestr( date_bought, "various-short" ) != 0) + term_flg = short_term; + else + if ((mystrcasestr( date_bought, "various-long" ) != 0) || (mystrcasestr( date_bought, "inherited" ) != 0)) + term_flg = long_term; + else + gen_date_rec( date_bought, descrip, &buydate ); + + next_csv( sline, date_sold, delim ); + if (verbose) fprintf(outfile,"SoldDate = '%s', Line = '%s'\n", date_sold, sline ); + if (term_flg == none) /* Executes if term_flg Not otherwise set in case: 1 */ + { /*term_flg*/ + gen_date_rec( date_sold, descrip, &selldate ); + if (is_date1_beyond_date2( buydate, selldate )) + { + printf("DATA ERROR: Buy-date after sell-date in f8949 spreadsheet. '%s'\n Buy-date '%s' Sell-date '%s'\n", + descrip, date_bought, date_sold ); + fprintf(outfile,"DATA ERROR: Buy-date after sell-date in f8949 spreadsheet. '%s'\n Buy-date '%s' Sell-date '%s'\n", + descrip, date_bought, date_sold ); + exit(1); + } + /* "annivdate" will be the date of the one year holding period relative to the Buy-date */ + annivdate.year = buydate.year + 1; + annivdate.month = buydate.month; + annivdate.day = buydate.day; + if ((annivdate.month == 2) && (annivdate.day == 28) && (isleapyear(annivdate.year))) + annivdate.day=29; + else + if ((annivdate.month == 2) && (annivdate.day == 29) && !(isleapyear(annivdate.year))) + annivdate.day=28; + if (is_date1_beyond_date2(selldate, annivdate)) + term_flg = long_term; /* Holding Period Test */ + else + term_flg = short_term; + } /*term_flg*/ + + next_csv( sline, word, delim ); + if (verbose) fprintf(outfile,"Proceeds = '%s', Line = '%s'\n", word, sline ); + if (sscanf(word,"%lf",&proceeds)!=1) + { printf("ERROR: Bad float '%s', in Proceeds column of f8949 Spreadsheet file '%s'.\n", word, spreadsheet_name ); + fprintf(outfile,"ERROR: Bad float '%s', in Proceeds column of f8949 Spreadsheet file '%s'.\n", word, spreadsheet_name ); + exit(1); + } + + next_csv( sline, word, delim ); + if (verbose) fprintf(outfile,"Cost = '%s', Line = '%s'\n", word, sline ); + if (sscanf(word,"%lf",&cost)!=1) + { printf("ERROR: Bad float '%s', in Cost column of f8949 Spreadsheet file '%s'.\n", word, spreadsheet_name ); + fprintf(outfile,"ERROR: Bad float '%s', in Cost column of f8949 Spreadsheet file '%s'.\n", word, spreadsheet_name ); + exit(1); + } + if (cost > 0.0) cost = -cost; /* Cost/Buy amounts must be negative. (It is a cost.) */ + + next_csv( sline, adj_code, delim ); + if (verbose) fprintf(outfile,"AdjCode = '%s', Line = '%s'\n", adj_code, sline ); + strcpy( adjcodeerrmsg, adj_code ); /* Assemble Error Msg for later use if needed */ + strcat( adjcodeerrmsg, " " ); + strcat( adjcodeerrmsg, descrip ); + strcat( adjcodeerrmsg, " " ); + strcat( adjcodeerrmsg, date_bought ); + strcat( adjcodeerrmsg, " "); + strcat( adjcodeerrmsg, date_sold ); + adj_code_validity_check( adj_code, adjcodeerrmsg ); + + next_csv( sline, word, delim ); + if (verbose) fprintf(outfile,"AdjAmnt= '%s', Line = '%s'\n", word, sline ); + consume_leading_trailing_whitespace( word ); + if (word[0] == '\0') + adj_amnt = 0.0; + else + if (sscanf(word,"%lf",&adj_amnt)!=1) + { printf("ERROR: Bad float '%s', in Ajdustment column of f8949 Spreadsheet file '%s'.\n", word, spreadsheet_name ); + fprintf(outfile,"ERROR: Bad float '%s', in Proceeds column of f8949 Spreadsheet file '%s'.\n", word, spreadsheet_name ); + exit(1); + } + + if (term_flg == long_term) + { /*long-gain/loss*/ + new_capgain( &long_trades, descrip, cost, date_bought, proceeds, date_sold, adj_code, adj_amnt ); + } /*long-gain/loss*/ + else + { /*short-gain/loss*/ + new_capgain( &short_trades, descrip, cost, date_bought, proceeds, date_sold, adj_code, adj_amnt ); + } /*short-gain/loss*/ + + } /*valid_line*/ + read_line_safe( sfile, sline, 4096 ); + } + fclose( sfile ); +} + + +void get_gain_and_losses( char *label ) +{ + char word[4096], date_str1[512], date_str2[512], adj_code[512]; + char comment[4096], comment2[2048], comment3[2048], labelcommentmsg[4096], adjcodeerrmsg[4096]; + double amnt1, amnt2, adj_amnt; + int toggle=0 ; + struct date_rec buydate, selldate, annivdate; + enum {none, short_term, long_term} term_flg=none; + + get_parameter( infile, 'l', word, label ); /* CapGains or f8949_spreadsheet_file. */ + if (strstr( word, "f8949_spreadsheet")) + { + read_comment_filtered_line( infile, word, 4096 ); + if (strlen(word) > 1) + get_CSV_8949( word ); + get_parameter( infile, 's', word, label ); + } + + get_word(infile, word); + while (word[0]!=';') + { /*while_not_end*/ + if (feof(infile)) + {printf("ERROR: Unexpected EOF on '%s'\n", label ); fprintf(outfile,"ERROR: Unexpected EOF on '%s'\n", label ); exit(1);} + if (!Do_SchedD) + { fprintf(outfile,"\nForm(s) 8949:\n"); Do_SchedD = Yes; } + switch (toggle) + { /*switch_toggle*/ + case 0: toggle++; + term_flg = none; /* Initialize */ + if (sscanf(word,"%lf",&amnt1)!=1) + {printf("ERROR: Bad float '%s', reading %s.\n", word, label ); fprintf(outfile,"ERROR: Bad float '%s', reading %s.\n", word, label ); exit(1); } + if (amnt1 > 0.0) amnt1 = -amnt1; /* Buy amounts must be negative. (It is a cost.) */ + break; + case 1: toggle++; + /* Expect stock name in comment after first date (buy-date). */ + get_comment( infile, comment ); /* Get comment for use in DATA ERROR Messages */ + strcpy (labelcommentmsg, label); + if (strlen(label) + strlen(comment) < 4092 ) + { + strcat(labelcommentmsg, ", "); + strcat(labelcommentmsg, comment); + } + strcpy( date_str1, word ); + if (mystrcasestr( date_str1, "various-short" ) != 0) + term_flg = short_term; + else + if ((mystrcasestr( date_str1, "various-long" ) != 0) || (mystrcasestr( date_str1, "inherited" ) != 0)) + term_flg = long_term; + else + gen_date_rec( word, labelcommentmsg, &buydate ); + break; + case 2: toggle++; + if (sscanf(word,"%lf",&amnt2)!=1) + { printf("ERROR: Bad float '%s', reading %s.\n", word, label ); + fprintf(outfile,"ERROR: Bad float '%s', reading %s.\n", word, label ); + exit(1); + } + break; + case 3: toggle++; + strcpy( date_str2, word ); + get_comment( infile, comment2 ); /* Check for and consume any additional comment. */ + strcat( comment, comment2 ); + if (term_flg == none) /* Executes if term_flg Not otherwise set in case: 1 */ + { + gen_date_rec ( word, labelcommentmsg, &selldate ); + if (is_date1_beyond_date2 (buydate, selldate)) + { + printf("DATA ERROR: Buy-date after sell-date. '%s'\n Buy-date '%s' Sell-date '%s'\n", labelcommentmsg, date_str1, date_str2); + fprintf(outfile,"DATA ERROR: Buy-date after sell-date. '%s'\n Buy-date '%s' Sell-date '%s'\n", labelcommentmsg, date_str1, date_str2); + exit(1); + } + /* "annivdate" will be the date of the one year holding period relative to the Buy-date */ + annivdate.year = buydate.year + 1; + annivdate.month = buydate.month; + annivdate.day = buydate.day; + if ((annivdate.month == 2) && (annivdate.day == 28) && (isleapyear(annivdate.year))) + annivdate.day=29; + else + if ((annivdate.month == 2) && (annivdate.day == 29) && !(isleapyear(annivdate.year))) + annivdate.day=28; + if (is_date1_beyond_date2(selldate, annivdate)) + term_flg = long_term; /* Holding Period Test */ + else + term_flg = short_term; + } + break; + case 4: toggle++; + strcpy (adj_code, word); + strcpy (adjcodeerrmsg, adj_code); /* Assemble Error Msg for later use if needed */ + strcat (adjcodeerrmsg, " "); + strcat (adjcodeerrmsg, labelcommentmsg); + strcat (adjcodeerrmsg, " "); + strcat (adjcodeerrmsg, date_str1); + strcat (adjcodeerrmsg, " "); + strcat (adjcodeerrmsg, date_str2); + adj_code_validity_check (adj_code, adjcodeerrmsg); + break; + case 5: toggle = 0; + get_comment(infile, comment3); /* Check for and consume any additional comment. */ + strcat( comment, comment3 ); /* For consistency with Case 3 */ + if (strcmp(word, "~") == 0) adj_amnt = 0.00; + else + { + if (sscanf(word, "%lf", &adj_amnt) != 1 ) + { + printf("ERROR: Adj-Amnt - Bad float '%s', reading %s.\n", word, labelcommentmsg); + fprintf(outfile,"ERROR: Adj-Amnt - Bad float '%s', reading %s.\n", word, labelcommentmsg); + exit(1); + } + } + if (term_flg == long_term) + { /*long-gain/loss*/ + new_capgain( &long_trades, comment, amnt1, date_str1, amnt2, date_str2, adj_code, adj_amnt ); + } /*long-gain/loss*/ + else + { /*short-gain/loss*/ + new_capgain( &short_trades, comment, amnt1, date_str1, amnt2, date_str2, adj_code, adj_amnt ); + } /*short-gain/loss*/ + break; + } /*switch_toggle*/ + get_word(infile, word); + } /*while_not_end*/ + if (toggle!=0) + { + printf("ERROR: Imbalanced cap-gains entry (toggle=%d).\n", toggle); + fprintf(outfile,"ERROR: Imbalanced cap-gains entry (toggle=%d).\n", toggle); + exit(1); + } +} + + +/************************************************************************/ +/* Get_Cap_Gains - Get and calculate gains. Forms 8949 + Sched-D. */ +/* Like "get_params", but must get transaction dates. */ +/* Expect entries in triple pairs. */ +/* buy_amnt date */ +/* sell_amnt date */ +/* adj_code, adj_amnt (Can default to ~ ~.) */ +/* */ +/************************************************************************/ +void get_cap_gains() /* This is Schedule-D. */ /* Updated for 2024. */ +{ + char word[4092], *LastYearsOutFile=0, labelx[1024]=""; + int j, doline22=0, got_collectibles=0; + double stcg=0.0, ltcg=0.0; /* Variables for short and long term gains. */ + double SchedDd[20], SchedDe[20], SchedDg[20]; + + for (j=0; j<20; j++) /* Initialize. */ + { SchedDd[j] = 0.0; SchedDe[j] = 0.0; SchedDg[j] = 0.0; } + + /* Form 8849 - Adjunct form to Schedule-D. */ + get_gain_and_losses( "CapGains-A/D" ); /* (A) Basis Reported to IRS. */ + if (short_trades) + { + print_capgain_list( short_trades, 1, "Form 8949 Part-I, Short-Term Cap Gains+Losses, CHECK (A) Basis Reported to IRS:", "13 13\n F8949_ckA X" ); + SchedDd[1] = total_sales; + SchedDe[1] = total_costs; + SchedDg[1] = total_adjs; + SchedD[1] = SchedDd[1] + SchedDe[1] + SchedDg[1]; + free_capgain_list( &short_trades ); + } + if (long_trades) + { + print_capgain_list( long_trades, 3, "Form 8949 Part-II, Long-Term Cap Gains+Losses, CHECK (D) Basis Reported to IRS:", "14 14\n F8949_ckD X" ); + SchedDd[8] = total_sales; + SchedDe[8] = total_costs; + SchedDg[8] = total_adjs; + SchedD[8] = SchedDd[8] + SchedDe[8] + SchedDg[8]; + free_capgain_list( &long_trades ); + } + + get_gain_and_losses( "CapGains-B/E" ); /* (B) Basis NOT Reported to IRS. */ + if (short_trades) + { + print_capgain_list( short_trades, 1, "Form 8949 Part-I, Short-Term Cap Gains+Losses, CHECK (B) Basis NOT Reported to IRS:", "13 13\n F8949_ckB X" ); + SchedDd[2] = total_sales; + SchedDe[2] = total_costs; + SchedDg[2] = total_adjs; + SchedD[2] = SchedDd[2] + SchedDe[2] +SchedDg[2] ; + free_capgain_list( &short_trades ); + } + if (long_trades) + { + print_capgain_list( long_trades, 3, "Form 8949 Part-II, Long-Term Cap Gains+Losses, CHECK (E) Basis NOT Reported to IRS:", "14 14\n F8949_ckE X" ); + SchedDd[9] = total_sales; + SchedDe[9] = total_costs; + SchedDg[9] = total_adjs; + SchedD[9] = SchedDd[9] + SchedDe[9] + SchedDg[9]; + free_capgain_list( &long_trades ); + } + + get_gain_and_losses( "CapGains-C/F" ); /* (C) Cannot check (A) or (B). */ + if (short_trades) + { + print_capgain_list( short_trades, 1, "Form 8949 Part-I, Short-Term Cap Gains+Losses, CHECK (C) Not reported on Form 1099-B.\n", "13 13\n F8949_ckC X" ); + SchedDd[3] = total_sales; + SchedDe[3] = total_costs; + SchedDg[3] = total_adjs; + SchedD[3] = SchedDd[3] + SchedDe[3] + SchedDg[3]; + free_capgain_list( &short_trades ); + } + if (long_trades) + { + print_capgain_list( long_trades, 3, "Form 8949 Part-II, Long-Term Cap Gains+Losses, CHECK (F) Not reported on Form 1099-B.\n", "14 14\n F8949_ckF X" ); + SchedDd[10] = total_sales; + SchedDe[10] = total_costs; + SchedDg[10] = total_adjs; + SchedD[10] = SchedDd[10] + SchedDe[10] + SchedDg[10]; + free_capgain_list( &long_trades ); + } + + + get_parameter( infile, 'l', labelx, "D1a_d or D4" ); /* Optionally (for 2024) get either D1a or D4 here. */ + if (strcmp( labelx, "D1ad" ) == 0) + { + get_parameters( infile, 'f', &SchedD1ad, "D1ad" ); + showline_wlabelnz( labelx, SchedD1ad ); + GetLine( "D1ae", &SchedD1ae ); + showline_wlabelnz( "D1ae", SchedD1ae ); + SchedD1ah = SchedD1ad - SchedD1ae; + showline_wlabelnz( "D1ah", SchedD1ah ); + GetLine( "D4", &SchedD[4] ); + } + else + if (strcmp( labelx, "D4" ) == 0) + { + get_parameters( infile, 'f', &SchedD[4], "D4" ); + } + else + { + printf("Error: Found '%s' when expecteding D1ad or D4.\n", labelx ); + fprintf(outfile,"Error: Found '%s' when expecteding D1a or D4.\n", labelx ); + exit(1); + } + // GetLine( "D4", &SchedD[4] ); /* Short term gain from 6252 and short-term gain or loss from Forms 4684, 6781, 8824. */ + + GetLine( "D5", &SchedD[5] ); /* Net short-term gain or loss from partnerships, S corps, estates, trusts from K-1. */ + + get_parameter( infile, 's', word, "D6" ); /* Carryover short-term loss from last year. Or, LastYear's Return Output File-name. */ + get_word(infile, word); + if (strcmp(word,";") != 0) + { + if (sscanf(word,"%lf",&SchedD[6]) != 1) LastYearsOutFile = strdup(word); + do + { get_word(infile,word); + if ((strlen(word) > 0) && (strcmp(word,";") != 0)) + fprintf(outfile,"Warning: Unexpected multiple values on line D6. '%s' ignored.\n If multi-part filename, then surround it in quotes (\").", word ); + } while (strcmp(word,";") != 0); + } + + + get_parameter( infile, 'l', labelx, "D8ad or D11" ); /* Optionally (for 2024) get either D8a or D11 here. */ + if (strcmp( labelx, "D8ad" ) == 0) + { + get_parameters( infile, 'f', &SchedD8ad, "D8ad" ); + showline_wlabelnz( labelx, SchedD8ad ); + GetLine( "D8ae", &SchedD8ae ); + showline_wlabelnz( "D8ae", SchedD8ae ); + SchedD8ah = SchedD8ad - SchedD8ae; + showline_wlabelnz( "D8ah", SchedD8ah ); + GetLine( "D11", &SchedD[11] ); + } + else + if (strcmp( labelx, "D11" ) == 0) + { + get_parameters( infile, 'f', &SchedD[11], "D11" ); + } + else + { + printf("Error: Found '%s' when expecteding D8ad or D11.\n", labelx ); + fprintf(outfile,"Error: Found '%s' when expecteding D1a or D4.\n", labelx ); + exit(1); + } + // GetLine( "D11", &SchedD[11] ); /* Gain from Form 4797. */ + + + stcg = SchedD[1] + SchedD[2] + SchedD[3]; + ltcg = SchedD[8] + SchedD[9] + SchedD[10]; + + + GetLine( "D12", &SchedD[12] ); /* Partnership net long-term gain or loss. */ + GetLine( "D13", &SchedD[13] ); /* Cap Gains Distributions - 1099-DIV col. 2a. */ + GetLine( "D14", &SchedD[14] ); /* Carryover long-term loss from last year. Or, leave blank if last year's file entered in line D6. */ + + while (!got_collectibles) + { + get_parameter( infile, 'l', labelx, "D19 or Collectibles" ); + if (strcmp( labelx, "D19" ) == 0) + get_parameters( infile, 'f', &SchedD[19], labelx ); + else + if (strcmp( labelx, "Collectibles" ) == 0) + { + get_parameters( infile, 'f', &collectibles_gains, labelx ); + got_collectibles = 1; + } + else + { + printf("ERROR1: Found '%s' when expecting 'D19 or Collectibles'\n", labelx ); + fprintf(outfile,"ERROR1: Found '%s' when expecting 'D19 or Collectibles'\n", labelx ); + exit(1); + } + } + + // GetLine( "Collectibles", &collectibles_gains ); /* Gains or Losses from Collectibles. (Usually zero.) */ + if (collectibles_gains != 0.0) fprintf(outfile, "Collectibles_Gains = %6.2f\n", collectibles_gains ); + + if (LastYearsOutFile != 0) + CapitalLossCarryOverWorksheet( LastYearsOutFile, &LastYearsReturn ); + + if (SchedD[6] > 0.0) + { + /* fprintf(outfile,"Warning: D6 Carryover Loss must be NEGATIVE.\n"); */ + SchedD[6] = -SchedD[6]; + } + if (SchedD[14] > 0.0) + { + /* fprintf(outfile,"Warning: D14 Carryover Loss must be NEGATIVE.\n"); */ + SchedD[14] = -SchedD[14]; + } + + if ((SchedD[4] != 0.0) || (SchedD[5] != 0.0) || (SchedD[6] != 0.0) || (SchedD[11] != 0.0) || + (SchedD[12] != 0.0) || (SchedD[13] != 0.0) || (SchedD[14] != 0.0)) + { Do_SchedD = Yes; } /* Set Do_SchedD in case it was not already set by Cap-Gain/Loss in rows 1-3, or 8-10. */ + + if (Do_SchedD) + { /*Sched-D*/ + fprintf(outfile," Cap Gains/Losses Schedule-D\n"); + fprintf(outfile,"PDFpage: 11 11\n"); + // Do_QDCGTW = Yes; /* Tentatively set to do: Qualified Dividends and Capital Gain tax Worksheet. */ + fprintf(outfile,"\tNet Forms-8949 Short-term Gains = %10.2f\n", stcg ); + fprintf(outfile,"\tNet Forms-8949 Long-term Gains = %10.2f\n", ltcg); + fprintf(outfile," D1bd = %10.2f\n D1be = %10.2f\n D1bg = %10.2f\n D1bh = %10.2f\n", SchedDd[1], absolutev(SchedDe[1]), SchedDg[1], SchedD[1] ); + fprintf(outfile," D2d = %10.2f\n D2e = %10.2f\n D2g = %10.2f\n D2h = %10.2f\n", SchedDd[2], absolutev(SchedDe[2]), SchedDg[2],SchedD[2] ); + + fprintf(outfile," D3d = %10.2f\n D3e = %10.2f\n D3g = %10.2f\n D3h = %10.2f\n", SchedDd[3], absolutev(SchedDe[3]), SchedDg[3], SchedD[3] ); + + fprintf(outfile," D4 = %6.2f\n", SchedD[4] ); + fprintf(outfile," D5 = %6.2f\n", SchedD[5] ); + fprintf(outfile," D6 = %6.2f (Carry-over Loss)\n", SchedD[6] ); + SchedD[7] = SchedD1ah + SchedD[1] + SchedD[2] + SchedD[3] + SchedD[4] + SchedD[5] + SchedD[6]; + fprintf(outfile," D7 = %6.2f { Net short-term capital gain or loss }\n", SchedD[7] ); + + fprintf(outfile," D8bd = %10.2f\n D8be = %10.2f\n D8bg = %10.2f\n D8bh = %10.2f\n", SchedDd[8], absolutev(SchedDe[8]), SchedDg[8], SchedD[8] ); + + fprintf(outfile," D9d = %10.2f\n D9e = %10.2f\n D9g = %10.2f\n D9h = %10.2f\n", SchedDd[9], absolutev(SchedDe[9]), SchedDg[9], SchedD[9] ); + + fprintf(outfile," D10d = %10.2f\n D10e = %10.2f\n D10g = %10.2f\n D10h = %10.2f\n", SchedDd[10], + absolutev(SchedDe[10]), SchedDg[10], SchedD[10] ); + + fprintf(outfile," D11 = %6.2f\n", SchedD[11] ); + fprintf(outfile," D12 = %6.2f\n", SchedD[12] ); + fprintf(outfile," D13 = %6.2f\n", SchedD[13] ); + fprintf(outfile," D14 = %6.2f (Carry-over Loss)\n", SchedD[14] ); + SchedD[15] = SchedD8ah + SchedD[8] + SchedD[9] + SchedD[10] + SchedD[11] + SchedD[12] + SchedD[13] + SchedD[14]; + fprintf(outfile," D15 = %6.2f { Net long-term capital gain or loss }\n", SchedD[15] ); + fprintf(outfile,"EndPDFpage.\nPDFpage: 12 12\n"); + + /* Part ||| */ + SchedD[16] = SchedD[7] + SchedD[15]; + fprintf(outfile," D16 = %6.2f\n", SchedD[16]); + if (SchedD[16] > 0.0) + { /*gain*/ + L[7] = SchedD[16]; + if ((SchedD[15] > 0.0) && (SchedD[16] > 0.0)) + { /* Lines 17-21 */ + double wsd[50]; + + fprintf(outfile," D17 = yes\n CkD17y X\n"); + + /* '28% Rate Gain Worksheet' on instructions page D-13. */ + wsd[1] = collectibles_gains; /* Gain or losses from "Collectibles" only. Usually zero. */ + wsd[2] = 0.0; /* Any 1202 exclusions, usually 0.0. */ + wsd[3] = 0.0; /* Total collectibles on forms 4684, 6245, 6781, 8824. Usually no. */ + wsd[4] = 0.0; /* Total collectibles 1099-Div box 2d, 2439 box 1d, or K-1's. Usually no. */ + wsd[5] = SchedD[14]; + if (SchedD[7] < 0.0) wsd[6] = SchedD[7]; else wsd[6] = 0.0; + wsd[7] = NotLessThanZero( wsd[1] + wsd[2] + wsd[3] + wsd[4] + wsd[5] + wsd[6] ); + SchedD[18] = wsd[7]; + fprintf(outfile," D18 = %6.2f\n", SchedD[18]); + + /* 'Unrecaptured Section 1250 Gain Worksheet' on page D14, usually 0. */ + fprintf(outfile," D19 = %6.2f\n", SchedD[19]); + + if ((SchedD[18] == 0.0) && (SchedD[19] == 0.0)) + { /*yes*/ + fprintf(outfile," D20 = Yes\n CkD20y X\n"); + // printf("Complete 'Qualified Dividends and Capital Gain tax Worksheet', instructions page 43.\n"); + Do_QDCGTW = Yes; + } /*yes*/ + else + { /*no*/ + fprintf(outfile," D20 = No\n CkD20n X\n"); + // printf("Complete 'Schedule D Tax Worksheet', instructions page D-15.\n"); + Do_SDTW = Yes; + Do_QDCGTW = No; + } /*no*/ + doline22 = 0; + } /* Lines 17-21 */ + else + { + printf(" D17 = no\n CkD17n X\n"); + doline22 = Yes; + } + } /*gain*/ + else + if (SchedD[16] < 0.0) + { /*loss*/ /* Schedule-D line 21. Skip to here from line 16 if a loss. */ + double maxloss; + + if (status == MARRIED_FILING_SEPARAT) maxloss = -1500.0; else maxloss = -3000.0; + if (SchedD[16] < maxloss) SchedD[21] = maxloss; else SchedD[21] = SchedD[16]; + fprintf(outfile," D21 = %6.2f\n", SchedD[21]); + L[7] = SchedD[21]; + doline22 = Yes; + } + else + { /*Zero gain/loss.*/ + L[7] = 0.0; + doline22 = Yes; + } + + if (doline22) + { + if (L3a > 0.0) + { /*yes*/ + fprintf(outfile," D22 = Yes\n CkD22y X\n"); + // printf("Complete 'Qualified Dividends and Capital Gain tax Worksheet', instructions page 44.\n"); + Do_QDCGTW = Yes; + } /*yes*/ + else + { /*no*/ + fprintf(outfile," D22 = No\n CkD22n X\n"); + // Do_QDCGTW = No; + } /*no*/ + } + + fprintf(outfile,"EndPDFpage.\n\n"); + } /*Sched-D*/ +} + + +/*--------------------------------------------------------*/ +/* 'Schedule D Tax Worksheet', instructions page D 16+17. */ +/*--------------------------------------------------------*/ +void sched_D_tax_worksheet( int status ) /* Updated for 2024. */ +{ + double ws[100]; + int k; + + for (k = 0; k < 100; k++) /* Initialize worksheet to zero's. */ + ws[k] = 0.0; + ws[1] = L[15]; + ws[2] = L3a; + ws[3] = 0.0; /* Form 4952, line 4g. Usually 0.0. */ + ws[4] = 0.0; /* Form 4952, line 4e. Usually 0.0. */ + ws[5] = NotLessThanZero( ws[3] - ws[4] ); + ws[6] = NotLessThanZero( ws[2] - ws[5] ); + ws[7] = smallerof( SchedD[15], SchedD[16] ); + ws[8] = smallerof( ws[3], ws[4] ); + ws[9] = NotLessThanZero( ws[7] - ws[8] ); + ws[10] = ws[6] + ws[9]; + ws[11] = SchedD[18] + SchedD[19]; + ws[12] = smallerof( ws[9], ws[11] ); + ws[13] = ws[10] - ws[12]; + ws[14] = NotLessThanZero( ws[1] - ws[13] ); + switch (status) + { case SINGLE: case MARRIED_FILING_SEPARAT: ws[15] = 47025.0; break; + case MARRIED_FILING_JOINTLY: case WIDOW: ws[15] = 94050.0; break; + case HEAD_OF_HOUSEHOLD: ws[15] = 63000.0; break; + } + ws[16] = smallerof( ws[1], ws[15] ); + ws[17] = smallerof( ws[14], ws[16] ); + ws[18] = NotLessThanZero( ws[1] - ws[10] ); + switch (status) + { case SINGLE: case MARRIED_FILING_SEPARAT: ws[19] = smallerof( ws[1], 191950.0 ); break; + case MARRIED_FILING_JOINTLY: case WIDOW: ws[19] = smallerof( ws[1], 383900.0 ); break; + case HEAD_OF_HOUSEHOLD: ws[19] = smallerof( ws[1], 191950.0 ); break; + } + ws[20] = smallerof( ws[14], ws[19] ); + ws[21] = largerof( ws[18], ws[20] ); + ws[22] = ws[16] - ws[17]; /* This amount is taxed at 0%. */ + if (ws[1] != ws[16]) + { /*lines23-43*/ + ws[23] = smallerof( ws[1], ws[13] ); + ws[24] = ws[22]; + ws[25] = NotLessThanZero( ws[23] - ws[24] ); + switch (status) + { case SINGLE: ws[26] = 518900.0; break; + case MARRIED_FILING_SEPARAT: ws[26] = 291850.0; break; + case MARRIED_FILING_JOINTLY: + case WIDOW: ws[26] = 583750.0; break; + case HEAD_OF_HOUSEHOLD: ws[26] = 551350.0; break; + } + ws[27] = smallerof( ws[1], ws[26] ); + ws[28] = ws[21] + ws[22]; + ws[29] = NotLessThanZero( ws[27] - ws[28] ); + ws[30] = smallerof( ws[25], ws[29] ); + ws[31] = 0.15 * ws[30]; + ws[32] = ws[24] + ws[30]; + if (absolutev( ws[1] - ws[32] ) < 0.01) + { /*lines33-43*/ + ws[33] = ws[23] - ws[32]; + ws[34] = 0.20 * ws[33]; + if (SchedD[19] != 0.0) + { /*lines35-40*/ + ws[35] = smallerof( ws[9], SchedD[19] ); + ws[36] = ws[10] + ws[21]; + ws[37] = ws[1]; + ws[38] = NotLessThanZero( ws[36] - ws[37] ); + ws[39] = NotLessThanZero( ws[35] - ws[38] ); + ws[40] = 0.25 * ws[39]; + } /*lines35-40*/ + if (SchedD[18] != 0.0) + { /*lines41-43*/ + ws[41] = ws[21] + ws[22] + ws[30] + ws[33] + ws[39]; + ws[42] = ws[1] - ws[41]; + ws[43] = 0.28 * ws[42]; + } /*lines41-43*/ + } /*lines33-43*/ + } /*lines23-43*/ + ws[44] = TaxRateFunction( ws[21], status ); + ws[45] = ws[31] + ws[34] + ws[40] + ws[43] + ws[44]; + ws[46] = TaxRateFunction( ws[1], status ); + ws[47] = smallerof( ws[45], ws[46] ); + L[16] = Conditional_Round( ws[47] ); + for (k = 0; k < 100; k++) + { + ws_sched_D[k] = ws[k]; /* Save worksheet values for AMT, if needed. */ + if (ws[k] != 0.0) + fprintf(outfile," Sched-D tax Worksheet line %d = %6.2f\n", k, ws[k]); + } +} + + + +/*-------------------------------------------------------------*/ +/* Social Security Worksheet - From main Instructions page 32. */ +/*-------------------------------------------------------------*/ +void SocSec_Worksheet() /* Updated for 2024. */ +{ /* Depends on Sched1, lines 11-25, and 1040 lines 1-8. Sets L[6]. */ + double ws[100], negative_amount_sched1_7=0.0; + int k; + if (L6a == 0.0) return; + for (k = 0; k < 100; k++) /* Initialize worksheet to all zero's. */ + ws[k] = 0.0; + ws[1] = L6a; + ws[2] = 0.5 * ws[1]; + if (Sched1[7] < 0.0) /* Do not include any Unemployment Compensation Exclusion (UCE) in SocSec calculations. */ + negative_amount_sched1_7 = Sched1[7]; /* Remove any UCE from L8 by subtracting it. */ + ws[3] = L[1] + L[2] + L[3] + L[4] + L[5] + L[7] + L[8] - negative_amount_sched1_7; + ws[4] = L2a; + ws[5] = ws[2] + ws[3] + ws[4]; + for (k = 11; k <= 20; k++) + ws[6] = ws[6] + Sched1[k]; + ws[6] = ws[6] + Sched1[23] + Sched1[25]; + for (k = 0; k <= 6; k++) + fprintf(outfile,"\tSocSecWorkSheet[%d] = %6.2f\n", k, ws[k] ); + if (ws[6] >= ws[5]) + { + L[6] = 0.0; /* Which is "L6b". */ + fprintf(outfile,"\tSocSecWorkSheet[7]: Check 'No'\n" ); + printf("None of your social security benefits are taxable.\n"); + fprintf(outfile,"None of your social security benefits are taxable.\n"); + return; + } + ws[7] = ws[5] - ws[6]; + fprintf(outfile,"\tSocSecWorkSheet[7] = %6.2f (Check 'Yes')\n", ws[7] ); + if (status == MARRIED_FILING_JOINTLY) + ws[8] = 32000.0; /* Updated for 2024. */ + else + ws[8] = 25000.0; + fprintf(outfile,"\tSocSecWorkSheet[8] = %6.2f\n", ws[8] ); + if (ws[8] >= ws[7]) + { + L[6] = 0.0; + fprintf(outfile,"\tSocSecWorkSheet[9]: Check 'No'\n" ); + printf("None of your social security benefits are taxable.\n"); + fprintf(outfile,"None of your social security benefits are taxable.\n"); + return; + } + ws[9] = ws[7] - ws[8]; + fprintf(outfile,"\tSocSecWorkSheet[9] = %6.2f (Check 'Yes')\n", ws[9] ); + if (status == MARRIED_FILING_JOINTLY) + ws[10] = 12000.0; /* Updated for 2024. */ + else + ws[10] = 9000.0; + ws[11] = NotLessThanZero( ws[9] - ws[10] ); + ws[12] = smallerof( ws[9], ws[10] ); + ws[13] = Conditional_Round( ws[12] / 2.0 ); + ws[14] = smallerof( ws[2], ws[13] ); + ws[15] = NotLessThanZero( Conditional_Round( 0.85 * ws[11] )); + ws[16] = ws[14] + ws[15]; + ws[17] = Conditional_Round( 0.85 * ws[1]); + ws[18] = smallerof( ws[16], ws[17] ); + for (k = 10; k <= 18; k++) + fprintf(outfile,"\tSocSecWorkSheet[%d] = %6.2f\n", k, ws[k] ); + L[6] = ws[18]; /* Which is "L6b". */ +} + + + +void pull_comment( char *line, char *word ) +{ + int j=0, k=0; + while ((line[j] != '\0') && (line[j] != '{')) j++; + if (line[j] != '\0') + { + j++; + while ((line[j+k] != '\0') && (line[j+k] != '}')) + { + word[k] = line[j+k]; k++; + } + } + word[k] = '\0'; +} + + +void Grab_ScheduleB_Payer_Lines( char *infname, FILE *outfile ) +{ /* Copy Schedule-B Line entries from input file, to output file -- only. Does not process data read. */ + /* Used for PDF form-FILING only. Not used by tax-calculations. */ + int state=0, cnt=0, pg=0, ncnt=15, newentry=0; + double value; + double total=0.0; + char line[2048], word1[1024], word2[1024], pgstr[10]=""; + FILE *infile; + + infile = fopen( infname, "rb" ); + if (infile == 0) + { + printf("Can no longer read '%s'.\n", infname ); + return; + } + fprintf(outfile,"\nSchedules Data:\n"); + fgets( line, 200, infile ); + while (!feof(infile)) + { + next_word( line, word1, " \t\n\r" ); + switch (state) + { + case 0: + if (strcmp( word1, "L2b" ) == 0) + { + state = 8; ncnt = 15; + pg = 0; cnt = 0; newentry = 1; + strcpy( pgstr, "B1_" ); + } + else + if (strcmp( word1, "L3b" ) == 0) + { + if (pg > 0) + { + fprintf(outfile,"EndPDFpage.\n"); + } + state = 9; ncnt = 16; total = 0.0; + pg = 0; cnt = 0; newentry = 1; + strcpy( pgstr, "B5_" ); + } + break; + case 8: + if (word1[0] == ';') + { + state = 0; + if (pg > 0) + { + fprintf(outfile,"Btotal = %8.2f\n", total ); + fprintf(outfile,"EndPDFpage.\n"); + pg = 0; + } + } + else + if ((word1[0] != '\0') && (word1[0] != '{')) + { + pull_comment( line, word2 ); + cnt++; + if (cnt == ncnt) + { + if (pg > 0) + { + fprintf(outfile,"Btotal = %8.2f\n", total ); + fprintf(outfile,"EndPDFpage.\n"); + } + fprintf(outfile,"PDFpage: 10 10\n"); + fprintf(outfile,"SchedB_Additional_form: Schedule B - Additional Interest Income\n"); + strcpy( pgstr, "Baddi_" ); + cnt = 1; ncnt = 30; total = 0.0; + pg++; + } + fprintf(outfile," %s%d_Text: %s\n", pgstr, cnt, word2 ); + remove_certain_chars( word1, "," ); + if (sscanf( word1, "%lf", &value ) != 1) + printf(" Error reading L2b value '%s'\n", word1 ); + else + { + fprintf(outfile," %s%d %8.2f\n", pgstr, cnt, value ); + total = total + value; + } + } + break; + case 9: + if (word1[0] == ';') + { + state = 0; + if (pg > 0) + { + fprintf(outfile,"Btotal = %8.2f\n", total ); + fprintf(outfile,"EndPDFpage.\n"); + pg = 0; + } + } + else + if ((word1[0] != '\0') && (word1[0] != '{')) + { + pull_comment( line, word2 ); + cnt++; + if (cnt == ncnt) + { + if (pg > 0) + { + fprintf(outfile,"Btotal = %8.2f\n", total ); + fprintf(outfile,"EndPDFpage.\n"); + } + fprintf(outfile,"PDFpage: 10 10\n"); + fprintf(outfile,"SchedB_Additional_form: Schedule B - Additional Dividend Income\n"); + strcpy( pgstr, "Baddi_" ); + cnt = 1; ncnt = 30; total = 0.0; + pg++; + } + fprintf(outfile," %s%d_Text: %s\n", pgstr, cnt, word2 ); + remove_certain_chars( word1, "," ); + if (sscanf( word1, "%lf", &value ) != 1) + printf(" Error reading L3b value '%s'\n", word1 ); + else + { + fprintf(outfile," %s%d %8.2f\n", pgstr, cnt, value ); + total = total + value; + } + } + break; + } + if (!newentry) + fgets( line, 200, infile ); + else + newentry = 0; + } + if (pg > 0) + { + printf("Error: Missing ending ';' on L%d\n", state ); + fprintf(outfile,"Btotal = %6.2f\n", total ); + fprintf(outfile,"EndPDFpage.\n"); + } + fclose(infile); +} + + +void Calc_StudentLoan_Sched1L21() /* Instructions page 96 */ +{ /* Depends on Sched1 lines 11-25, and 1040 L[9]. */ + /* Sets Sched1 lines 21, which impacts Sched1 line 26 and 1040 line 10. */ + int j; + if (Sched1[21] != 0.0) + { /* Student loan interest calculation pg 93. */ + double ws[20], sum=0.0; + ws[1] = smallerof( Sched1[21], 2500.0 ); + ws[2] = L[9]; + for (j=11; j <= 20; j++) + sum = sum + Sched1[j]; + sum = sum + Sched1[23] + Sched1[25]; + ws[3] = sum; + ws[4] = ws[2] - ws[3]; + if (status != MARRIED_FILING_JOINTLY) + ws[5] = 80000.0; /* Updated for 2024. */ + else + ws[5] = 165000.0; /*MFJ*/ + if (ws[4] > ws[5]) + { + ws[6] = ws[4] - ws[5]; + if (status == MARRIED_FILING_JOINTLY) + ws[7] = ws[6] / 30000.0; + else + ws[7] = ws[6] / 15000.0; + if (ws[7] >= 1.0) + ws[7] = 1.0; + ws[8] = ws[1] * ws[7]; + } + else + ws[8] = 0.0; + ws[9] = ws[1] - ws[8]; + Sched1[21] = ws[9]; + } +} + + + + +/*----------------------------------------------------------------------*/ +/* Main */ +/*----------------------------------------------------------------------*/ +int main( int argc, char *argv[] ) /* Updated for 2024. */ +{ + int argk, j, k, itemize=0; + char word[2000], outfname[2000], *infname="", labelx[1024]=""; + time_t now; + double exemption_threshold=0.0, tmpval=0.0; + double S_STD_DEDUC, MFS_STD_DEDUC, MFJ_STD_DEDUC, HH_STD_DEDUC, std_deduc; + char *Your1stName, *YourLastName, *Spouse1stName, *SpouseLastName, *socsec, socsectmp[100]; + double NumDependents=0.0; + int StdDedChart_NumBoxesChecked=0, nnn; + int SchedB7a=0, SchedB7aa=-1, SchedB8=0, gotB7a=0; + char SchedB7b[1024]=""; + double ntcpe=0.0, pyei=0.0; + double S1_1099K_err=0.0, Sched2_17[50]; + char *S2_17a_Type, *S2_17z_Type, *S3_6z_Type, *S3_13z_Type; + double charityCC=0.0, charityOT=0.0, charityCO=0.0; + + /* Decode any command-line arguments. */ + printf("US 1040 2024 - v%3.2f\n", thisversion); + argk = 1; k=1; + while (argk < argc) + { + if (strcmp(argv[argk],"-verbose")==0) { verbose = Yes; } + else + if (strcmp(argv[argk],"-allforms")==0) { force_print_all_pdf_forms = 1; } + else + if (strcmp(argv[argk],"-round_to_whole_dollars")==0) { round_to_whole_dollars = 1; } + else + if (k==1) + { + infname = strdup( argv[argk] ); + infile = fopen( infname,"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", infname ); exit(1);} + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname, infname); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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[argk]); exit(1);} + argk = argk + 1; + } + + if (infile==0) {printf("Error: No input file on command line.\n"); exit(1);} + + /* Pre-initialize all lines to zeros. */ + for (j=0; j 0.0) Do_QDCGTW = Yes; + GetLineF( "L3b", &L[3] ); /* Ordinary Dividends. (Sched-B) */ + GetLineF( "L4a", &L4a ); /* IRAs distributions. */ + GetLineF( "L4b", &L[4] ); /* Taxable IRAs distributions. */ + +get_parameter( infile, 'l', labelx, "QCD or L5a" ); /* Get optional line for 2024. */ /* Update in 2026. */ +printf("PARAMETER = '%s'\n", labelx ); +if (strcmp( labelx, "QCD" ) == 0) + { + get_parameter( infile, 'b', &j, "QCD" ); + if (j) + fprintf(outfile,"QCD = QCD\n"); +printf("QCD = %d\n", j ); + GetLineF( "L5a", &L5a ); /* Pensions and annuities. */ + } +else + { + get_parameters( infile, 'f', &L5a, "L5a" ); + showline_wlabel( "L5a", L5a ); + } +// GetLineF( "L5a", &L5a ); /* Pensions and annuities. */ + + GetLineF( "L5b", &L[5] ); /* Taxable pensions, and annuities. */ + GetLineF( "L6a", &L6a ); /* Social Security benefits. Forms SSA-1099 box-5. */ + + GetLine( "L13", &L[13] ); /* Qualified business income deduction. */ + GetLine( "L19", &L[19] ); /* Child tax credit/credit for other dependents. */ + + GetLine( "L25a", &L25a ); /* Federal income tax withheld, Forms W-2, 1099 */ + GetLine( "L25b", &L25b ); /* Federal income tax withheld, Forms W-2, 1099 */ + GetLine( "L25c", &L25c ); /* Federal income tax withheld, Forms W-2, 1099 */ + L[25] = L25a + L25b + L25c; + GetLine( "L26", &L[26] ); /* Estimated tax payments for 2024. */ + GetLine( "L27", &L[27] ); /* Earned Income Credit (EIC). */ + GetLine( "L28", &L[28] ); /* Refundable credit: Sch. 8812 */ + GetLine( "L29", &L[29] ); /* American Opportunity Credit, Form 8863, line 8 */ + + GetLine( "ApplyTo2024", &L[36] ); /* Percent of OverPayment you want applied to your 2024 estimated tax. */ + if ((L[36] < 0.0) || (L[36] > 100.0)) + { + printf("Error: 'ApplyTo2024' value (%g) out-of-range (0-100).\n", L[36] ); + fprintf(outfile,"Error: 'ApplyTo2024' value (%g) out-of-range (0-100).\n", L[36] ); + L[36] = 0.0; + } + + GetLine( "L38", &L[38] ); /* Estimated Tax Under-payment Penalty */ + + get_cap_gains(); /* Capital gains. (Schedule-D). This popuates "schedD[]" and L[7]. */ + + + /* Determine your Std. Deduction value. */ + fprintf(outfile, "StdDedChart_NumBoxesChecked = %d\n", StdDedChart_NumBoxesChecked ); + if (StdDedChart_NumBoxesChecked == 0) + { + S_STD_DEDUC = 14600.0; /* Updated for 2024. */ + MFJ_STD_DEDUC = 29200.0; + MFS_STD_DEDUC = 14600.0; + HH_STD_DEDUC = 21900.0; + } + else + { /* Std. Deduction chart for People who were Born Before January 2, 1960, or Were Blind, pg 34. */ + switch (StdDedChart_NumBoxesChecked) /* Does not handle if someone claims you or joint-spouse as dependent. */ + { /* (Qualifying Widow/er has same amounts as MFJ, so not broken into separate variable.) */ + case 1: + S_STD_DEDUC = 16550.0; /* Updated for 2024. */ + MFJ_STD_DEDUC = 30750.0; + MFS_STD_DEDUC = 16150.0; + HH_STD_DEDUC = 23850.0; + break; + case 2: + S_STD_DEDUC = 18500.0; + MFJ_STD_DEDUC = 32300.0; + MFS_STD_DEDUC = 17700.0; + HH_STD_DEDUC = 25800.0; + break; + case 3: + MFJ_STD_DEDUC = 33850.0; + MFS_STD_DEDUC = 19250.0; + S_STD_DEDUC = 18500.0; /* Cannot happen, but set to appease compiler. */ + HH_STD_DEDUC = 25800.0; /* .. */ + break; + case 4: + MFJ_STD_DEDUC = 35400.0; + MFS_STD_DEDUC = 20800.0; + S_STD_DEDUC = 18500.0; /* Cannot happen, but set to appease compiler. */ + HH_STD_DEDUC = 25800.0; /* .. */ + break; + default: fprintf(outfile,"Error: StdDedChart_NumBoxesChecked (%d) not equal to 1, 2, 3, or 4.\n", StdDedChart_NumBoxesChecked ); + printf("Error: StdDedChart_NumBoxesChecked (%d) not equal to 1, 2, 3, or 4.\n", StdDedChart_NumBoxesChecked ); + exit(1); + } + fprintf(outfile," (Assuming no one is claiming you, or your joint-spouse, as a dependent.)\n"); + } + + switch (status) + { + case SINGLE: + std_deduc = S_STD_DEDUC; break; + case MARRIED_FILING_SEPARAT: + std_deduc = MFS_STD_DEDUC; break; + case WIDOW: + case MARRIED_FILING_JOINTLY: + std_deduc = MFJ_STD_DEDUC; break; + case HEAD_OF_HOUSEHOLD: + std_deduc = HH_STD_DEDUC; break; + default: printf("Case (Line 12) not handled.\n"); fprintf(outfile,"Case (Line 12) not handled.\n"); exit(1); + } + + + + /* -- Schedule-1 -- Additional Income and Adjustments */ + + GetLineF( "S1_1099K_err", &S1_1099K_err ); /* Amounts on 1099-K forms reported in error or for personal loss. */ + GetLineF( "S1_1", &Sched1[1] ); /* Taxable refunds. */ + GetLineF( "S1_2a", &Sched1[2] ); /* Alimony received. */ + GetTextLineF( "S1_2b:" ); /* Date of divorce or separation. */ + + GetLineF( "S1_3", &Sched1[3] ); /* Business income/loss. */ + showline_wlabel( "S1_3", Sched1[3] ); /* This line was set in get_cap_gains() above. */ + + GetLineFnz( "S1_4", &Sched1[4] ); /* Other gains or losses. Form 4794. */ + + GetLineFnz( "S1_5", &Sched1[5] ); /* Rent realestate, royalties, partnerships, S corp. (Sched E)*/ + + GetLineFnz( "S1_6", &Sched1[6] ); /* Farm income/loss. (Sched F) */ + + GetLineFnz( "S1_7", &Sched1[7] ); /* Unemployment compensation */ + + GetLineFnz( "S1_8a", &Sched1[8] ); /* Net operating loss */ + Sched1[9] = -absolutev( Sched1[8] ); + GetLineFnz( "S1_8b", &Sched1[8] ); /* Gambling income */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8c", &Sched1[8] ); /* Cancellation of debt */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8d", &Sched1[8] ); /* Foreign earned income exclusion from Form 2555 */ + Sched1[9] = Sched1[9] - absolutev( Sched1[8] ); + GetLineFnz( "S1_8e", &Sched1[8] ); /* Income from Form 8853 */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8f", &Sched1[8] ); /* Income from Form 8889 */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8g", &Sched1[8] ); /* Alaska Permanent Fund dividends */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8h", &Sched1[8] ); /* Jury duty pay */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8i", &Sched1[8] ); /* Prizes and awards */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8j", &Sched1[8] ); /* Activity not engaged in for profit income */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8k", &Sched1[8] ); /* Stock options */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8l", &Sched1[8] ); /* Income from the rental of personal property if ... */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8m", &Sched1[8] ); /* Olympic and Paralympic medals + prizes */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8n", &Sched1[8] ); /* Section 951(a) inclusion */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8o", &Sched1[8] ); /* Section 951A(a) inclusion */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8p", &Sched1[8] ); /* Section 461(l) excess business loss adjustment */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8q", &Sched1[8] ); /* Taxable distributions from an ABLE account */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8r", &Sched1[8] ); /* Scholarship and fellowship grants not reported on Form W-2 */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8s", &Sched1[8] ); /* Nontaxable Medicaid waiver payments included on line 1a or 1d */ + Sched1[9] = Sched1[9] + -absolutev( Sched1[8] ); + GetLineFnz( "S1_8t", &Sched1[8] ); /* Pension from a nonqualifed deferred compensation plan or section 457 plan */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8u", &Sched1[8] ); /* Wages earned while incarcerated */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8v", &Sched1[8] ); /* Digital assets received as ordinary income */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetLineFnz( "S1_8z", &Sched1[8] ); /* Other income. */ + Sched1[9] = Sched1[9] + Sched1[8]; + GetTextLineF( "S1_8z_Type:" ); + + showline_wlabel( "S1_9", Sched1[9] ); + + for (j=1; j <= 7; j++) + Sched1[10] = Sched1[10] + Sched1[j]; + Sched1[10] = Sched1[10] + Sched1[9]; + showline_wlabel( "S1_10", Sched1[10] ); + L[8] = Sched1[10]; + L[9] = L[1] + L[2] + L[3] + L[4] + L[5] + L[6] + L[7] + L[8]; + + GetLineF( "S1_11", &Sched1[11] ); /* Educator expenses */ + GetLineF( "S1_12", &Sched1[12] ); /* Bus. exp.: reservists, artists, ... Attach Form 2106 */ + GetLineF( "S1_13", &Sched1[13] ); /* Health savings account deduction. Attach Form 8889 */ + GetLineF( "S1_14", &Sched1[14] ); /* Moving expenses. Attach Form 3903 */ + GetLineF( "S1_15", &Sched1[15] ); /* Deductable part of self-employment tax. Attach Schedule SE */ + GetLineF( "S1_16", &Sched1[16] ); /* Self-employed SEP, SIMPS1_E, and qualified plans */ + GetLineF( "S1_17", &Sched1[17] ); /* Self-employed health insurance deduction */ + GetLineF( "S1_18", &Sched1[18] ); /* Penalty on early withdrawal of savings */ + GetLineF( "S1_19a", &Sched1[19] ); /* Alimony paid */ + + GetTextLineF( "AlimRecipSSN:" ); + GetTextLineF( "DivorceDate:" ); + + GetLineF( "S1_20", &Sched1[20] ); /* IRA deduction */ + GetLineF( "S1_21", &Sched1[21] ); /* Student loan interest deduction */ + GetLineF( "S1_23", &Sched1[23] ); /* Archer MSA deduction */ + + GetLineF( "S1_24a", &Sched1[24] ); /* Jury duty pay */ + Sched1[25] = Sched1[24]; + GetLineF( "S1_24b", &Sched1[24] ); /* Deductible expenses of rental of personal property */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24c", &Sched1[24] ); /* Nontaxable Olympic and Paralympic medals & prizes */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24d", &Sched1[24] ); /* Reforestation amortization and expenses */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24e", &Sched1[24] ); /* Repayment of supplemental unemployment benefits */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24f", &Sched1[24] ); /* Contributions to section 501(c)(18)(D) pension plans */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24g", &Sched1[24] ); /* Contributions by certain chaplains to section 403(b) plans */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24h", &Sched1[24] ); /* Attorney fees and court costs for unlawful discrimination claims */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24i", &Sched1[24] ); /* Attorney fees and court costs for award from the IRS */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24j", &Sched1[24] ); /* Housing deduction from Form 2555 */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24k", &Sched1[24] ); /* Excess deductions of section 67(e) expenses from Schedule K-1 */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetLineF( "S1_24z", &Sched1[24] ); /* Other adjustments. */ + Sched1[25] = Sched1[25] + Sched1[24]; + GetTextLineF( "S1_24z_Type:" ); + showline_wlabel( "S1_25", Sched1[25] ); + + SocSec_Worksheet(); /* This calc. depends on line L6a and Sched1[11-25]. Calculates L6b, which is L[6]. */ + L[9] = L[1] + L[2] + L[3] + L[4] + L[5] + L[6] + L[7] + L[8]; + Calc_StudentLoan_Sched1L21(); + + for (j=11; j <= 23; j++) + Sched1[26] = Sched1[26] + Sched1[j]; + Sched1[26] = Sched1[26] + Sched1[25]; + showline_wlabel( "S1_26", Sched1[26] ); + L[10] = Sched1[26]; + + /* -- End of Schedule-1 -- */ + + + /* -- Schedule A - Input -- */ + GetLine( "A1", &SchedA[1] ); /* Unreimbursed medical expenses. */ + for (j=0; j<10; j++) + localtax[j] = 0.0; + if (status != MARRIED_FILING_SEPARAT) + loctaxlimit = 10000.0; + else + loctaxlimit = 5000.0; + GetLine( "A5a", &localtax[1] ); /* State and local income taxes. Or sales taxes. */ + get_parameter( infile, 'l', labelx, "CheckBoxA5a or A5b" ); + if (strcmp( labelx, "CheckBoxA5a" ) == 0) + { + get_parameters( infile, 'b', &j, "CheckBoxA5a" ); + if (j) + fprintf(outfile,"CheckBoxA5a X\n"); + GetLine( "A5b", &localtax[2] ); + } + else + if (strcmp( labelx, "A5b" ) == 0) + { + get_parameters( infile, 'f', &localtax[2], "A5b" ); + } + else + { + printf("Error: Found '%s' when expecteding CheckBoxA5a or A5b,\n", labelx ); + fprintf(outfile,"Error: Found '%s' when expecteding CheckBoxA5a or A5b,\n", labelx ); + exit(1); + } + // GetLine( "A5b", &localtax[2] ); /* State and local real estate taxes. */ /* Optionally read-in just above. */ + GetLine( "A5c", &localtax[3] ); /* State and local personal property (eg. automobile) taxes. */ + GetLine( "A6", &SchedA[6] ); /* Other taxes. */ + GetLine( "A8a", &homemort[0] ); /* Home mortgage interest and points reported to you on Form 1098.*/ + GetLine( "A8b", &homemort[1] ); /* Home mortgage interest not reported to you on Form 1098.*/ + GetLine( "A8c", &homemort[2] ); /* Points not reported to you on Form 1098.*/ + homemort[3] = 0; + // GetLine( "A8d", &homemort[3] ); /* Mortgage insurance premiums. */ + GetOptionalLine( "A8d or A9", labelx, &tmpval ); + if (strcmp( labelx, "A9" ) == 0) + { + homemort[3] = 0.0; + SchedA[9] = tmpval; + } + else + if (strcmp( labelx, "A8d" ) == 0) + { + homemort[3] = tmpval; + GetLine( "A9", &SchedA[9] ); + } + else + { + printf("Error: Found '%s' when expecteding A8d,\n", labelx ); + fprintf(outfile,"Error: Found '%s' when expecteding A8d,\n", labelx ); + exit(1); + } + // GetLine( "A9", &SchedA[9] ); /* Investment interest. Attach Form 4952*/ /* Optionally read-in just above. */ + + GetLine( "A11", &charityCC ); /* Charity Contributions by Cash or Check. */ + SchedA[11] = charityCC; /* Charity contributions by cash or check.*/ + + GetLine( "A12", &charityOT ); /* Charity Contributions Other Than cash or check. */ + SchedA[12] = charityOT; /* Contributions other than cash or check.*/ + + GetLine( "A13", &charityCO ); /* Charity Contributions Carried Over from last year. */ + SchedA[13] = charityCO; /* Carryover from prior year*/ + + + GetLine( "A15", &SchedA[15] ); /* Casualty or theft loss(es).*/ + GetLine( "A16", &SchedA[16] ); /* Other expenses*/ + + /* Look for optional Force-Itemize line. (Remove *optional* logic for 2024, once A18 is on ALL templates.) */ + get_parameter( infile, 'l', labelx, "A18 or B7a"); + if (strcmp( labelx, "A18" ) == 0) + { + // GetYesNo( "A18", &ForceItemize ); + get_parameters( infile, 'b', &ForceItemize, labelx ); + } + else + if (strcmp( labelx, "B7a" ) == 0) + { + // GetYesNo( "B7a", &SchedB7a ); + get_parameters( infile, 'b', &SchedB7a, labelx ); + gotB7a = 1; + } + else + { + printf("Error: Found '%s' when expecteding A18 or B7a.\n", labelx ); + fprintf(outfile,"Error: Found '%s' when expecteding A18 or B7a\n", labelx ); + exit(1); + } + + L[11] = L[9] - L[10]; + + /* -- Calculate Schedule A -- */ + SchedA[2] = L[11]; + SchedA[3] = Conditional_Round( 0.075 * SchedA[2] ); + SchedA[4] = NotLessThanZero( SchedA[1] - SchedA[3] ); + localtax[4] = localtax[1] + localtax[2] + localtax[3]; + localtax[5] = smallerof( localtax[4], loctaxlimit ); + SchedA[7] = localtax[5] + SchedA[6]; + homemort[5] = homemort[0] + homemort[1] + homemort[2] + homemort[3]; + SchedA[10] = homemort[5] + SchedA[9]; + SchedA[14] = SchedA[11] + SchedA[12] + SchedA[13]; + SchedA[17] = SchedA[4] + SchedA[7] + SchedA[10] + SchedA[14] + SchedA[15] + SchedA[16]; + + if ((std_deduc < SchedA[17]) || (ForceItemize)) + { /*Select_to_Itemize*/ + itemize = Yes; + L[12] = SchedA[17]; /* Use itemized value. */ + if (ForceItemize) + { + printf(" You elected to itemize deductions, even though they may be less than your Standard Deduction.\n"); + fprintf(outfile," You elected to itemize deductions, even though they may be less than your Standard Deduction.\n"); + printf(" (Itemizations = %6.2f, Std-Deduction = %6.2f)\n", SchedA[17], std_deduc ); + fprintf(outfile," (Itemizations = %6.2f, Std-Deduction = %6.2f)\n", SchedA[17], std_deduc ); + } + else + { + printf(" (Itemizations > Std-Deduction, %6.2f > %6.2f)\n", SchedA[17], std_deduc ); + fprintf(outfile," (Itemizations > Std-Deduction, %6.2f > %6.2f)\n", SchedA[17], std_deduc ); + } + fprintf(outfile,"Itemizing.\n"); + } /*Select_to_Itemize*/ + else + { /*Select_to_use_StdDeduction*/ + itemize = No; + L[12] = std_deduc; /* Take the Std.Deduction. */ + printf(" (Itemizations < Std-Deduction, %6.2f < %6.2f)\n", SchedA[17], std_deduc ); + fprintf(outfile," (Itemizations < Std-Deduction, %6.2f < %6.2f)\n", SchedA[17], std_deduc ); + fprintf(outfile,"Use standard deduction.\n"); + } /*Select_to_use_StdDeduction*/ + + + /* -- Display Schedule A -- */ + showschedA(1); + showschedA(2); + showschedA(3); + showschedA(4); + showline_wlabel( "A5a", localtax[1] ); + showline_wlabel( "A5b", localtax[2] ); + showline_wlabel( "A5c", localtax[3] ); + showline_wlabel( "A5d", localtax[4] ); + showline_wlabel( "A5e", localtax[5] ); + showschedA(6); + showschedA(7); + showline_wlabel( "A8a", homemort[0] ); + showline_wlabel( "A8b", homemort[1] ); + showline_wlabel( "A8c", homemort[2] ); + showline_wlabel( "A8d", homemort[3] ); + showline_wlabel( "A8e", homemort[5] ); + showschedA(9); + showschedA(10); + showschedA(11); + showschedA(12); + showschedA_wMsg(13, "Carryover from prior year" ); + showschedA(14); + showschedA(15); + showschedA(16); + showschedA(17); + if (ForceItemize) + fprintf(outfile,"CheckBoxA18 = X\n"); + + showline_wlabel( "L6b", L[6] ); + showline( 7 ); + showline( 8 ); + showline( 9 ); + showline_wlabel( "S1_20", Sched1[20] ); + showline_wlabelnz( "S1_21", Sched1[21] ); + showline_wlabel( "S1_22", Sched1[22] ); + showline( 10 ); + showline_wlabelmsg( "L11", L[11], "Adjusted Gross Income (AGI)" ); + + + if ((L[2] != 0.0) || (L[3] != 0.0)) + { + fprintf(outfile," Schedule-B:\n"); + fprintf(outfile," B2 = %6.2f\n", L[2] ); + fprintf(outfile," B4 = %6.2f\n", L[2] ); + fprintf(outfile," B6 = %6.2f\n", L[3] ); + } + + + if (under65 == 0) over65 = 1; + switch (status) /* Check for minimum income to file. (min2file) */ /* Updated for 2024. */ + { /* Listed in Instructions page-9, in Chart A - For Most People. */ + case SINGLE: if (under65) exemption_threshold = 14600.0; + else exemption_threshold = 16550.0; + break; + case MARRIED_FILING_JOINTLY: if (under65==2) exemption_threshold = 29200.0; + else + if (under65==1) exemption_threshold = 30750.0; + else exemption_threshold = 32300.0; + if (under65 != 2) over65 = 1; + break; + case MARRIED_FILING_SEPARAT: exemption_threshold = 5.0; + break; + case HEAD_OF_HOUSEHOLD: if (under65) exemption_threshold = 21900.0; + else exemption_threshold = 23850.0; + break; + case WIDOW: if (under65) exemption_threshold = 29200.0; + else exemption_threshold = 30750.0; + } + if (L[11] < exemption_threshold) + { + printf(" (L11 = %3.2f < Threshold = %3.2f)\n", L[11], exemption_threshold ); + printf("You may not need to file a return, due to your income level.\n\n"); + fprintf(outfile,"You may not need to file a return, due to your income level.\n\n"); + } + + showline( 12 ); + showline( 13 ); /* Qualified business income ded., read-in above. */ + + L[14] = L[12] + L[13]; + showline( 14 ); + + L[15] = NotLessThanZero( L[11] - L[14] ); + showline_wlabelmsg( "L15", L[15], "Taxable Income" ); + + L[16] = TaxRateFunction( L[15], status ); + + if (L[15] <= 0.0) + { /*exception*/ /* See rules on top of "Schedule D Tax Worksheet", pg 16 of Sched-D Instructions. */ + printf(" Exception (Sched-D Instructions page D-16) - Do not use QDCGT or Sched-D Tax Worksheets.\n"); + } /*exception*/ + else + { /*no_exception*/ + if ((!Do_SDTW) && (!Do_QDCGTW) && ((L3a > 0.0) || (Sched1[13] > 0.0) || ((SchedD[15] > 0.0) && (SchedD[16] > 0.0)) )) + Do_QDCGTW = Yes; + if (Do_QDCGTW) + { + fprintf(outfile,"Doing 'Qualified Dividends and Capital Gain tax Worksheet', page 37.\n"); + capgains_qualdividends_worksheets( status ); + } + else + if (Do_SDTW) + { + fprintf(outfile,"Doing 'Schedule D Tax Worksheet', page D16.\n"); + sched_D_tax_worksheet( status ); + } + } /*no_exception*/ + + showline_wlabelmsg( "L16", L[16], "Tax" ); + + if (!gotB7a) + GetYesNo( "B7a", &SchedB7a ); + GetYesNo( "B7aa", &SchedB7aa ); + GetString( "B7b", SchedB7b ); + GetYesNo( "B8", &SchedB8 ); + + if (SchedB7a) + fprintf(outfile,"CkB7a_Y X\n"); + else + fprintf(outfile,"CkB7a_N X\n"); + + if (SchedB7aa == 1) + fprintf(outfile,"CkB7aa_Y X\n"); + else + if (SchedB7aa == 0) + fprintf(outfile,"CkB7aa_N X\n"); + + if (strlen( SchedB7b ) > 0) + fprintf(outfile,"B7b = %s\n", SchedB7b ); + + if (SchedB8) + fprintf(outfile,"CkB8_Y X\n"); + else + fprintf(outfile,"CkB8_N X\n"); + + + /* -- Alternative Minimum Tax (AMT) Entries (if needed) -- */ + GetLine( "AMTws2c", &amtws2c ); + GetLine( "AMTws2g", &amtws2g ); + GetLine( "AMTws3", &amtws[3] ); + GetLine( "AMTws8", &amtws[8] ); + + + /* -- Schedule 2 -- Additional Taxes */ + + GetLine( "S2_1a", &Sched2_1a ); /* Excess advance premium tax credit repayment. Form 8962. */ + /* (Needed by AMT form6251.) */ + GetLine( "S2_1b", &Sched2_1b ); /* Repayment of new clean vehicle credit(s) transferred to dealer. */ + GetLine( "S2_1c", &Sched2_1c ); /* Repayment of previously owned clean vehicle credit(s) transferred to dealer. */ + GetLine( "S2_1d", &Sched2_1d ); /* Recapture of net EPE from Form 4255, line 2a, column (l). */ + GetLine( "S2_1e", &Sched2_1e ); /* Excessive payments (EP) from Form 4255. */ + GetLine( "S2_1f", &Sched2_1f ); /* 20% EP from Form 4255. */ + GetLine( "S2_1y", &Sched2_1y ); /* Other additions to tax (see instructions). */ + + Sched2_1z = Sched2_1a + Sched2_1b + Sched2_1c + Sched2_1d + Sched2_1e + Sched2_1f + Sched2_1y; + Sched2[1] = Sched2_1z; + + GetLine( "S2_4", &Sched2[4] ); /* Self-employment tax. Sched SE. */ + GetLine( "S2_5", &Sched2[5] ); /* Social security and Medicare tax from Form 4137. */ + GetLine( "S2_6", &Sched2[6] ); /* Uncollected Social security and Medicare tax from Form 8919 */ + Sched2[7] = Sched2[5] + Sched2[6]; + GetLine( "S2_8", &Sched2[8] ); /* Additional tax on IRAs or other tax-favored accounts, Form 5329 */ + GetLine( "S2_9", &Sched2[9] ); /* Household employment taxes. Sched H */ + GetLine( "S2_10", &Sched2[10] ); /* First-time homebuyer credit repayment. Form 5405. */ + + GetLine( "S2_11", &Sched2[11] ); /* Additional Medicare Tax. Attach Form 8959 */ + GetLine( "S2_12", &Sched2[12] ); /* Net investment income tax. Attach Form 8960 */ + GetLine( "S2_13", &Sched2[13] ); /* Uncollected social security ... from Form W-2, box 12 */ + GetLine( "S2_14", &Sched2[14] ); /* Interest on tax due on installment income */ + GetLine( "S2_15", &Sched2[15] ); /* Interest on the deferred tax on gain from certain installment sales */ + GetLine( "S2_16", &Sched2[16] ); /* Recapture of low-income housing credit. Attach Form 8611 */ + + for (j=0; j < 50; j++) /* Clear temporary storage variables. */ + Sched2_17[j] = 0.0; + + j = 0; + GetLine( "S2_17a", &Sched2_17[j] ); /* Recapture of other credits. */ + S2_17a_Type = GetTextLine( "S2_17a_Type:" ); + Sched2[18] = Sched2_17[j++]; + GetLine( "S2_17b", &Sched2_17[j] ); /* Recapture of federal mortgage subsidy. */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17c", &Sched2_17[j] ); /* Additional tax on HSA distributions. Attach Form 8889 */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17d", &Sched2_17[j] ); /* Additional tax on an HSA, Attach Form 8889 */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17e", &Sched2_17[j] ); /* Additional tax on Archer MSA distributions. */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17f", &Sched2_17[j] ); /* Additional tax on Medicare Advantage MSA distributions. Form 8853 */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17g", &Sched2_17[j] ); /* Recapture of a charitable contribution deduction */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17h", &Sched2_17[j] ); /* Income you received from a nonqualified deferred compensation */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17i", &Sched2_17[j] ); /* Compensation received from nonqualified deferred compensation plan */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17j", &Sched2_17[j] ); /* Section 72(m)(5) excess benefits tax */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17k", &Sched2_17[j] ); /* Golden parachute payments */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17l", &Sched2_17[j] ); /* Tax on accumulation distribution of trusts */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17m", &Sched2_17[j] ); /* Excise tax on insider stock compensation */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17n", &Sched2_17[j] ); /* Look-back interest under section 167(g) or 460(b) */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17o", &Sched2_17[j] ); /* Tax on non-effectively connected income */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17p", &Sched2_17[j] ); /* Any interest from Form 8621, line 16f */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17q", &Sched2_17[j] ); /* Any interest from Form 8621, line 24 */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + GetLine( "S2_17z", &Sched2_17[j] ); /* Any other taxes. */ + Sched2[18] = Sched2[18] + Sched2_17[j++]; + S2_17z_Type = GetTextLine( "S2_17z_Type:" ); + nnn = j - 1; + GetLine( "S2_19", &Sched2[19] ); /* Additional tax from Schedule 8812. */ + GetLine( "S2_20", &Sched2[20] ); /* Section 965 net tax liability installment from Form 965-A. */ + + + GetLine( "S3_1", &Sched3[1] ); /* Foreign tax credit. Form 1116. (Needed by AMT form6251.) */ + + Sched2[2] = form6251_AlternativeMinimumTax( itemize ); /* (Depends on Sched2_1a & Sched3[1].) */ + if (Sched2[2] == 0.0) + fprintf(outfile," (Not subject to Alternative Minimum Tax.)\n"); + else + fprintf(outfile," (You must pay Alternative Minimum Tax.)\n"); + + showline_wlabelnz( "S2_1a", Sched2_1a ); + showline_wlabelnz( "S2_1b", Sched2_1b ); + showline_wlabelnz( "S2_1c", Sched2_1c ); + showline_wlabelnz( "S2_1d", Sched2_1d ); + showline_wlabelnz( "S2_1e", Sched2_1e ); + showline_wlabelnz( "S2_1f", Sched2_1f ); + showline_wlabelnz( "S2_1y", Sched2_1y ); + showline_wlabelnz( "S2_1z", Sched2_1z ); + showline_wlabelmsg_nz( "S2_2", Sched2[2], " Alternative Minimum Tax" ); + Sched2[3] = Sched2[1] + Sched2[2]; + + for (j=3; j <= 16; j++) + { + sprintf(word,"S2_%d", j ); + showline_wlabelnz( word, Sched2[j] ); + } + showline_wlabelnz( "S2_17a", Sched2_17[0] ); + printf("S2_17a_Type: %s\n", S2_17a_Type ); + fprintf(outfile,"S2_17a_Type: %s\n", S2_17a_Type ); + for (j=2; j <= nnn; j++) + { + sprintf(word,"S2_17%c", 'a' + j - 1 ); + showline_wlabelnz( word, Sched2_17[j] ); + } + fprintf(outfile,"S2_17z_Type: %s\n", S2_17z_Type ); + + Sched2[21] = Sched2[4] + Sched2[18] + Sched2[19]; + for (j=7; j <= 16; j++) + Sched2[21] = Sched2[21] + Sched2[j]; + for (j=18; j <= 21; j++) + { + sprintf(word,"S2_%d", j ); + showline_wlabelnz( word, Sched2[j] ); + } + L[23] = Sched2[21]; + + /* -- End of Schedule 2 */ + + + L[17] = Sched2[3]; + showline( 17 ); + + L[18] = L[16] + L[17]; + showline( 18 ); + + showline( 19 ); + + + /* -- Schedule 3 -- Part I - Nonrefundable Credits */ + showline_wlabel( "S3_1", Sched3[1] ); + + GetLine( "S3_2", &Sched3[2] ); /* Child / dependent care expense credits. Form 2441. */ + showline_wlabel( "S3_2", Sched3[2] ); + + GetLine( "S3_3", &Sched3[3] ); /* Education credits. Form 8863. */ + showline_wlabel( "S3_3", Sched3[3] ); + + GetLine( "S3_4", &Sched3[4] ); /* Retirement savings contributions credit. Form 8880. */ + showline_wlabel( "S3_4", Sched3[4] ); + + GetLine( "S3_5a", &Sched3[5] ); /* Residential energy credits. Form 5695. */ + showline_wlabel( "S3_5a", Sched3[5] ); + Sched3[8] = Sched3[8] + Sched3[5]; + + GetLine( "S3_5b", &Sched3[5] ); /* Residential energy credits. Form 5695. */ + showline_wlabel( "S3_5b", Sched3[5] ); + Sched3[8] = Sched3[8] + Sched3[5]; + + GetLineFnz( "S3_6a", &Sched3[6] ); /* General business credit. Form 3800. */ + showline_wlabel( "S3_6a", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6b", &Sched3[6] ); /* Credit for prior year minimum tax. Form 8801. */ + showline_wlabel( "S3_6b", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6c", &Sched3[6] ); /* Adoption credit. Attach Form 8839 */ + showline_wlabel( "S3_6c", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6d", &Sched3[6] ); /* Credit for the elderly or disabled. Attach Schedule R */ + showline_wlabel( "S3_6d", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6e", &Sched3[6] ); /* Alternative motor vehicle credit. Attach Form 8910 */ + showline_wlabel( "S3_6e", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6f", &Sched3[6] ); /* Qualified plug-in motor vehicle credit. Attach Form 8936 */ + showline_wlabel( "S3_6e", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6g", &Sched3[6] ); /* Mortgage interest credit. Attach Form 8396 */ + showline_wlabel( "S3_6g", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6h", &Sched3[6] ); /* District of Columbia first-time homebuyer credit. Attach Form 8859 */ + showline_wlabel( "S3_6h", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6i", &Sched3[6] ); /* Qualified electric vehicle credit. Attach Form 8834 */ + showline_wlabel( "S3_6i", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6j", &Sched3[6] ); /* Alternative fuel vehicle refueling property credit. Attach Form 8911 */ + showline_wlabel( "S3_6j", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6k", &Sched3[6] ); /* Credit to holders of tax credit bonds. Attach Form 8912 */ + showline_wlabel( "S3_6j", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6l", &Sched3[6] ); /* Amount on Form 8978, line 14. */ + showline_wlabel( "S3_6l", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6m", &Sched3[6] ); /* Credit for previously owned clean vehicles. Form 8936. */ + showline_wlabel( "S3_6m", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + GetLineFnz( "S3_6z", &Sched3[6] ); /* Other nonrefundable credits. */ + showline_wlabel( "S3_6z", Sched3[6] ); + Sched3[7] = Sched3[7] + Sched3[6]; + + S3_6z_Type = GetTextLine( "S3_6z_Type:" ); + printf("S3_6z_Type: %s\n", S3_6z_Type ); + fprintf(outfile,"S3_6z_Type: %s\n", S3_6z_Type ); + + showline_wlabel( "S3_7", Sched3[7] ); + + for (j=1; j <= 4; j++) + Sched3[8] = Sched3[8] + Sched3[j]; + Sched3[8] = Sched3[8] + Sched3[7]; + showline_wlabelnz( "S3_8", Sched3[8] ); + L[20] = Sched3[8]; + showline( 20 ); + + GetLine( "S3_9", &Sched3[9] ); /* Net premium tax credit. Form 8962. */ + showline_wlabelnz( "S3_9", Sched3[9] ); + + GetLine( "S3_10", &Sched3[10] ); /* Amnt paid in filing extension req. */ + showline_wlabelnz( "S3_10", Sched3[10] ); + + GetLine( "S3_11", &Sched3[11] ); /* Excess Soc. Sec. + tier 1 RRTA tax withheld */ + showline_wlabelnz( "S3_11", Sched3[11] ); + + GetLine( "S3_12", &Sched3[12] ); /* Credits for federal tax on fuels. Attach form 4136. */ + showline_wlabelnz( "S3_12", Sched3[12] ); + + GetLine( "S3_13a", &Sched3_13a ); /* Credits from Form 2439 */ + showline_wlabelnz( "S3_13a", Sched3_13a ); + + GetLine( "S3_13b", &Sched3_13b ); /* Credit for repayment of amounts included in income from prior years. */ + showline_wlabelnz( "S3_13b", Sched3_13b ); + + GetLine( "S3_13c", &Sched3_13c ); /* Elective payment amount. Form 3800, Part III, line 6, column (i). */ + showline_wlabelnz( "S3_13c", Sched3_13c ); + + GetLine( "S3_13d", &Sched3_13d ); /* Deferred amount of net 965 tax liability */ + showline_wlabelnz( "S3_13d", Sched3_13d ); + + GetLine( "S3_13z", &Sched3_13z ); /* Credits from Other */ + showline_wlabelnz( "S3_13z", Sched3_13z ); + + S3_13z_Type = GetTextLine( "S3_13z_Type:" ); + printf("S3_13z_Type: %s\n", S3_13z_Type ); + fprintf(outfile,"S3_13z_Type: %s\n", S3_13z_Type ); + + Sched3[14] = Sched3_13a + Sched3_13b + Sched3_13c + Sched3_13d; + showline_wlabelnz( "S3_14", Sched3[14] ); + + for (j = 9; j <= 12; j++) + Sched3[15] = Sched3[15] + Sched3[j]; + Sched3[15] = Sched3[15] + Sched3[14]; + showline_wlabel( "S3_15", Sched3[15] ); + L[31] = Sched3[15]; + + /* -- End of Schedule 3 -- */ + + + + L[21] = L[19] + L[20]; + showline( 21 ); + + L[22] = NotLessThanZero( L[18] - L[21] ); + showline( 22 ); + + L[23] = Sched2[21]; /* Also set above. */ + showline( 23 ); + + L[24] = L[22] + L[23]; + showline_wmsg( 24, "Total Tax" ); + + Report_bracket_info( L[15], L[24], status ); + + showline_wlabelnz( "L25a", L25a ); + showline_wlabelnz( "L25b", L25b ); + showline_wlabelnz( "L25c", L25c ); + showline_wlabelnz( "L25d", L[25] ); + showline( 26 ); + showline_wlabelnz( "L27a", L[27] ); + showline_wlabelnz( "L27b", ntcpe ); + showline_wlabelnz( "L27c", pyei ); + showline( 28 ); + showline( 29 ); + showline( 30 ); + showline( 31 ); + for (j=27; j<=31; j++) + L[32] = L[32] + L[j]; + showline_wmsg( 32, "Total other payments and refundable credits" ); + L[33] = L[25] + L[26] + L[32]; + showline_wmsg( 33, "Total Payments" ); + + /* Refund or Owe sections. */ + if (L[33] > L[24]) + { /* Refund */ + L[34] = L[33] - L[24]; + fprintf(outfile,"L34 = %6.2f Amount you Overpaid!!!\n", L[34] ); + L[35] = (1.0 - L[36]/100.0) * L[34]; + fprintf(outfile,"L35a = %6.2f Amount of overpayment you want refunded to you.\n", L[35] ); + L[36] = L[34] - L[35]; + if (L[36] > 0.0) + showline_wmsg( 36, "Amount of overpayment you want applied to next year's estimated taxes." ); + } + else + { /* Tax-Due */ + L[37] = L[24] - L[33]; + fprintf(outfile,"L37 = %6.2f DUE !!!\n", L[37] ); + fprintf(outfile," (Which is %2.1f%% of your Total Federal Tax.)\n", 100.0 * L[37] / (L[16] + 1e-9) ); + } + ShowLineNonZero( 38 ); + fprintf(outfile,"------------------------------\n"); + + + fprintf(outfile,"\n{ --------- Identity-Information: --------- }\n"); + Your1stName = GetTextLineF( "Your1stName:" ); + YourLastName = GetTextLineF( "YourLastName:" ); + writeout_line = 0; + socsec = GetTextLineF( "YourSocSec#:" ); + strcpy( socsectmp, socsec ); /* Copy to buffer, since formatting could add 2-chars. */ + format_socsec( socsectmp, 0 ); + fprintf(outfile,"YourSocSec#: %s\n", socsectmp ); + free( socsec ); + writeout_line = 1; + Spouse1stName = GetTextLineF( "Spouse1stName:" ); + SpouseLastName = GetTextLineF( "SpouseLastName:" ); + writeout_line = 0; + socsec = GetTextLineF( "SpouseSocSec#:" ); + strcpy( socsectmp, socsec ); /* Copy to buffer, since formatting could add 2-chars. */ + format_socsec( socsectmp, 0 ); + fprintf(outfile,"SpouseSocSec#: %s\n", socsectmp ); + free( socsec ); + writeout_line = 1; + if (strlen( YourLastName ) > 0) + { + if (strcmp( YourLastName, SpouseLastName ) == 0) + fprintf(outfile,"YourNames: %s & %s, %s\n", Your1stName, Spouse1stName, YourLastName ); + else + if (strlen( SpouseLastName ) > 0) + fprintf(outfile,"YourNames: %s %s & %s %s\n", Your1stName, YourLastName, Spouse1stName, SpouseLastName ); + else + fprintf(outfile,"YourNames: %s %s\n", Your1stName, YourLastName ); + } + GetTextLineF( "Number&Street:" ); + GetTextLineF( "Apt#:" ); + + // GetTextLineF( "TownStateZip:" ); + GetTextLineF( "Town/City:" ); + GetTextLineF( "State:" ); + GetTextLineF( "ZipCode:" ); + + GetTextLineF( "YourOccupat:" ); + GetTextLineF( "SpouseOccupat:" ); + + get_word(infile, labelx ); /* Look for optional Dependent fields. */ + while (!feof(infile)) + { /*OptionalLine*/ + read_comment_filtered_line( infile, word, 512 ); + // printf("\nLine '%s' = '%s'\n", labelx, word ); + if (word[0] != '\0') + { /*valid_entry*/ + if (strncmp( labelx,"Dep", 3 ) == 0) + { + if (strstr( labelx,"SocSec" ) != 0) + format_socsec( word, 1 ); + fprintf(outfile, "%s %s\n", labelx, word ); + } + else + if (strncmp( labelx,"CkDep", 5 ) == 0) + { + if (toupper(word[0]) == 'Y') + fprintf(outfile, "%s X\n", labelx ); + } + else + if ((strncmp( labelx,"L35b", 4 ) == 0) || (strncmp( labelx,"L35d", 4 ) == 0)) + { + fprintf(outfile, "%s %s\n", labelx, word ); + } + else + if (strncmp( labelx,"L35c", 4 ) == 0) + { + if (strcasecmp( word, "Savings" ) == 0) + fprintf(outfile, "CkL35cSavings X\n"); + if (strcasecmp( word, "Checking" ) == 0) + fprintf(outfile, "CkL35cChecking X\n"); + } + else + if (strncmp( labelx,"PIN_", 4 ) == 0) + { + fprintf(outfile, "%s %s\n", labelx, word ); + } + } /*valid_entry*/ + get_word(infile, labelx ); + } /*OptionalLine*/ + + fclose(infile); + Grab_ScheduleB_Payer_Lines( infname, outfile ); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + + printf("\nListing results from file: %s\n\n", outfname); + Display_File( outfname ); + + if (adjerrcnt != 0 ) Display_adj_code_err(); + + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_US_1040_Sched_C_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_US_1040_Sched_C_2024.c new file mode 100755 index 0000000..12c41a1 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_US_1040_Sched_C_2024.c @@ -0,0 +1,479 @@ +/************************************************************************/ +/* TaxSolve_US1040_Sched_C.c - */ +/* Copyright (C) 2025 - S.Jenkins */ +/* */ +/* Compile: */ +/* cc taxsolve_US1040_Sched_C.c -o taxsolve_US1040_Sched_C */ +/* */ +/* Documentation & Updates: */ +/* http://opentaxsolver.sourceforge.net/ */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ +/* */ +/* Updated for 2024 tax year: */ +/* S.Jenkins 1-2-2025 */ +/* Earlier Updates Robert Heller heller@deepsoft.com */ +/************************************************************************/ + +float thisversion=22.02; + +#include +#include +#include +#include +#include + +#include "taxsolve_routines.c" +#define Yes 1 +#define No 0 + +/*----------------------------------------------------------------------------*/ + +int main( int argc, char *argv[] ) +{ + int i, j, k; + char word[4000], outfname[4000], *EIN=0, *answ, *infname=0; + time_t now; + double L16b=0.0, L20b=0.0, L24b=0.0, L44a=0.0, L44b=0.0, L44c=0.0; + int L32=0; + char veh_mm[1024]="", veh_dd[1024]="", veh_yy[1024]=""; + char Ck45[1024]="", L46answ[1024]="", L47a_answ[1024]="", L47b_answ[1024]=""; + char *L48a_descr="", *L48b_descr="", *L48c_descr="", *L48d_descr="", *L48e_descr="", + *L48f_descr="", *L48g_descr="", *L48h_descr="", *L48i_descr=""; + double L48a_amnt=0.0, L48b_amnt=0.0, L48c_amnt=0.0, L48d_amnt=0.0, L48e_amnt=0.0, + L48f_amnt=0.0, L48g_amnt=0.0, L48h_amnt=0.0, L48i_amnt=0.0; + + printf("US 1040 Schedule C, 2024 - v%3.2f\n", thisversion); + + /* Decode any command-line arguments. */ + i = 1; k=1; + while (i < argc) + { + if (strcmp(argv[i],"-verbose")==0) { verbose = 1; } + else + if (strcmp(argv[i],"-round_to_whole_dollars")==0) { round_to_whole_dollars = 1; } + else + if (k==1) + { + infname = strdup(argv[i]); + infile = fopen(infname,"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", infname ); exit(1);} + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname,infname); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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= 0.0) || L32 == Yes) + { + { + fprintf(outfile,"Enter %2.2f on Form 1040 line S1_3. Sched-SE line 2.\n", L[31] ); + fprintf(outfile," Estates and trusts, enter on Form 1041, line 3.\n"); + } + } + + showline(35); + showline(36); + showline(37); + showline(38); + showline(39); + showline(40); + showline(41); + showline_wmsg(42,"Cost of goods sold"); + + + fprintf(outfile,"L43mm: %s\n", veh_mm ); + fprintf(outfile,"L43dd: %s\n", veh_dd ); + fprintf(outfile,"L43yy: %s\n", veh_yy ); + + showline_wlabelnz( "L44a", L44a ); + showline_wlabelnz( "L44b", L44b ); + showline_wlabelnz( "L44c", L44c ); + + if (toupper( Ck45[0] ) == 'Y') + fprintf(outfile,"Ck45Yes: X\n"); + else + if (strcasecmp( Ck45, "No") == 0) + fprintf(outfile,"Ck45No: X\n"); + + if (toupper( L46answ[0] ) == 'Y') + fprintf(outfile,"Ck46Yes: X\n"); + else + if (strcasecmp( L46answ, "No") == 0) + fprintf(outfile,"Ck46No: X\n"); + + if (toupper( L47a_answ[0] ) == 'Y') + fprintf(outfile,"Ck47aYes: X\n"); + else + if (strcasecmp( L47a_answ, "No") == 0) + fprintf(outfile,"Ck47aNo: X\n"); + + if (toupper( L47b_answ[0] ) == 'Y') + fprintf(outfile,"Ck47bYes: X\n"); + else + if (strcasecmp( L47b_answ, "No") == 0) + fprintf(outfile,"Ck47bNo: X\n"); + + if (strlen( L48a_descr ) > 0) + fprintf(outfile,"L48a_descr: %s\n", L48a_descr ); + showline_wlabelnz( "L48a_amnt", L48a_amnt ); + if (strlen( L48b_descr ) > 0) + fprintf(outfile,"L48b_descr: %s\n", L48b_descr ); + showline_wlabelnz( "L48b_amnt", L48b_amnt ); + if (strlen( L48c_descr ) > 0) + fprintf(outfile,"L48c_descr: %s\n", L48c_descr ); + showline_wlabelnz( "L48c_amnt", L48c_amnt ); + if (strlen( L48d_descr ) > 0) + fprintf(outfile,"L48d_descr: %s\n", L48d_descr ); + showline_wlabelnz( "L48d_amnt", L48d_amnt ); + if (strlen( L48e_descr ) > 0) + fprintf(outfile,"L48e_descr: %s\n", L48e_descr ); + showline_wlabelnz( "L48e_amnt", L48e_amnt ); + if (strlen( L48f_descr ) > 0) + fprintf(outfile,"L48f_descr: %s\n", L48f_descr ); + showline_wlabelnz( "L48f_amnt", L48f_amnt ); + if (strlen( L48g_descr ) > 0) + fprintf(outfile,"L48g_descr: %s\n", L48g_descr ); + showline_wlabelnz( "L48g_amnt", L48g_amnt ); + if (strlen( L48h_descr ) > 0) + fprintf(outfile,"L48h_descr: %s\n", L48h_descr ); + showline_wlabelnz( "L48h_amnt", L48h_amnt ); + if (strlen( L48i_descr ) > 0) + fprintf(outfile,"L48i_descr: %s\n", L48i_descr ); + showline_wlabelnz( "L48i_amnt", L48i_amnt ); + + showline_wmsg( 48, "Total other expenses" ); + + fclose(infile); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + + printf("\nListing results from file: %s\n\n", outfname); + Display_File( outfname ); + + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_US_1040_Sched_E_brokerage_royalties_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_US_1040_Sched_E_brokerage_royalties_2024.c new file mode 100755 index 0000000..7c7ad12 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_US_1040_Sched_E_brokerage_royalties_2024.c @@ -0,0 +1,261 @@ +/************************************************************************ +* TaxSolve_US_1040_Sched_E_brokerage_royalties_2024.c - +* +* E. Strnod 9/12/2024 +*************************************************************************/ +/* + * This version handles Schedule E for reporting brokerage royalty income + * only. It may be used as a starting point for the full Schedule E + * (which would be used for real estate rental income, etc.) For ease + * of use for brokerage royalty income only, a full version should be + * implemented in an alternative, separate program. This program makes + * assumptions about some responses in the form when handling brokerage + * royalty income. + */ +float thisversion=2.00; + +#include +#include +#include +#include +#include + +#include "taxsolve_routines.c" +#define Yes 1 +#define No 0 + +/*----------------------------------------------------------------------------*/ + +int main( int argc, char *argv[] ) +{ + int i, j, k; + char word[4000], outfname[4000], *infname=0; + time_t now; + + printf("Schedule E, 2024 - v%3.2f\n", thisversion); + + +add_pdf_markup( "NotReady", 1, 240, 40, 17, 1, 1.0, 0, 0, "\"This program is NOT ready for 2024.\"" ); +#ifdef microsoft + system( "start bin\\notify_popup -delay 3 -expire 10 \"Warning: This program is NOT ready for 2024.\"" ); +#else + system( "bin/notify_popup -delay 3 -expire 10 \"Warning: This program is NOT ready for 2024.\" &" ); +#endif + + + + /* Decode any command-line arguments. */ + i = 1; k=1; + while (i < argc) + { + if (strcmp(argv[i],"-verbose")==0) { verbose = 1; } + else + if (k==1) + { + infname = strdup(argv[i]); + infile = fopen(infname,"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", infname ); exit(1);} + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname,infname); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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 0) + totIncome += propIncAndExp[propertyIndex][INC_MINUS_EXP]; + } + + // DED_RE_LOSS_AFTER_LIMIT (line 22) values are shown in parentheses, indicating negative, so they will + // NOT be negative in the variable. Subtract them rather than adding. + for (propertyIndex = 0; propertyIndex < 3; propertyIndex++) { + // add negative amounts only here + if (propIncAndExp[propertyIndex][INC_MINUS_EXP] < 0) + totLosses += propIncAndExp[propertyIndex][INC_MINUS_EXP]; + } + + for (propertyIndex = 0; propertyIndex < 3; propertyIndex++) { + totLosses -= propIncAndExp[propertyIndex][DED_RE_LOSS_AFTER_LIMIT]; + } + totIncomeOrLosses = totIncome + totLosses; + + // total royalties across all properties + fprintf(outfile, "23b: %2.2f\n", totRoyaltiesRecd); + + // total depreciation expense or depletion across all properties + fprintf(outfile, "23d: %2.2f\n", totDepreciationDepletionExp); + + // total expenses across all properties + fprintf(outfile, "23e: %2.2f\n", totExpenses); + + // total income across all properties + fprintf(outfile, "24: %2.2f\n", totIncome); + + // total losses across all properties + fprintf(outfile, "25: %2.2f\n", totLosses * -1); + + // total rental real estate and royalty income or (loss) across all properties + fprintf(outfile, "26: %2.2f\n", totIncomeOrLosses); + + /* ----- .... Until here. ----- */ + + + /*** + Summary of useful functions: + GetLine( "label", &variable ) - Looks for "label" in input file, and places the corresponding sum of + values following that label (until ";") into variable. + GetLineF( "label", &variable ) - Like GetLine() above, but also writes the result to the output file. + GetLineFnz(( "label", &variable ) - Like GetLine(), but only writes non-zero values to the output file. + GetLine1( "label", &variable ) - Like GetLine() above, but expects single value (no sum, no ";" in input file). + + c = SmallerOf( a, b ); - Selects smaller of two values. + c = LargerOf( a, b ); - Selects larger of two values. + c = NotLessThanZero( a ); - Selects positive value or zero. Prevents negative values. + + showline( j ) - Writes currency value of L[j] to output file with label in nice format. + shownum( j ) - Writes integer value of L[j] to output file with label in nice format. + showline_wmsg( j, "msg" ) - Like showline, but adds the provided message to the output line. + ShowLineNonZero( j ) - Like showline, but only writes non-zero values. + ShowLineNonZero_wMsg( j, "msg" ) - Like showline_wmsg, but only writes non-zero values. + showline_wlabel( "label", value ) - For custom line names and variables not in the default L[] array. + showline_wlabelnz( "label", value ) - Like showline_wlabel, but only writes non-zero values. + showline_wlabelmsg( "label", value, "msg" ) - Like showline_wlabel,but adds the provided message to the output line. + + ***/ + + fclose(infile); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + + printf("\nListing results from file: %s\n\n", outfname); + Display_File( outfname ); + + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_US_1040_Sched_SE_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_US_1040_Sched_SE_2024.c new file mode 100755 index 0000000..eef6622 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_US_1040_Sched_SE_2024.c @@ -0,0 +1,202 @@ +/************************************************************************ + TaxSolve_Form_US_1040_Sched_SE.c - Self Employment Tax Form + + NOTE: Only Part-I is implemented. + Parts II and III are NOT presently implemented. + + Documentation & Updates: + http://opentaxsolver.sourceforge.net/ + + GNU Public License - GPL: + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA + + Originally Provided by Steve Wiswell, March 16, 2023. + Updated 1/2024. + + ************************************************************************/ + +float thisversion=5.01; + +#include +#include +#include +#include +#include + +#include "taxsolve_routines.c" +#define Yes 1 +#define No 0 + +double L4a=0.0, L4c=0.0; +double L5a=0.0, L5b=0.0; /* Church employee income */ +double L8a=0.0, L8b=0.0, L8c=0.0, L8d=0.0; /* Wages & Tips */ + +/*----------------------------------------------------------------------------*/ + +int main( int argc, char *argv[] ) +{ + int i, j, k, stop=0, CkMinister=0; + char word[8000], outfname[8000], *infname=0; + double L1a=0.0, L1b=0.0; + time_t now; + + printf("US 1040 Schedule SE, 2024 - v%1.0f\n", thisversion); + + /* Decode any command-line arguments. */ + i = 1; k=1; + while (i < argc) + { + if (strcmp(argv[i],"-verbose")==0) { verbose = 1; } + else + if (k==1) + { + infname = strdup(argv[i]); + infile = fopen(infname,"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", infname ); exit(1);} + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname,infname); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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 0.0) + L4a = L[3] * 0.9235; /* Updated for 2024. */ + else + L4a = L[3]; + showline_wlabel( "L4a", L4a ); + L4c = NotLessThanZero( L4a ); + if (L4c < 400.0) + { + if (L5a > 0.0) + L4c = 0.0; + else + { + fprintf(outfile,"\nStop. You do NOT owe self-employment tax.\n\n"); + printf("\nStop. You do NOT owe self-employment tax.\n\n"); + stop = 1; + } + } + if (!stop) + { /*!stop*/ + showline_wlabel( "L4c", L4c ); + showline_wlabel( "L5a", L5a ); + L5b = NotLessThanZero( L5a * 0.9235 ); + showline_wlabel( "L5b", L5b ); + L[6] = L4c + L5b; + showline(6); + showline_wlabel("L8a", L8a); + showline_wlabel("L8b", L8b); + showline_wlabel("L8c", L8c); + L8d = L8a + L8b + L8c; + showline_wlabel("L8d", L8d); + L[9] = NotLessThanZero( L[7] - L8d ); + showline(9); + L[10] = 0.124 * SmallerOf( L[6], L[9] ); + showline(10); + L[11] = L[6] * 0.029; /* Updated for 2024. */ + showline(11); + L[12] = L[10] + L[11]; + showline_wmsg( 12, "Also enter this number on Schedule-2, line 4." ); + L[13] = L[12] * 0.5; + showline_wmsg( 13, "Also enter this number on Schedule-1, line 15." ); + } /*!stop*/ + + /* ----- .... Until here. ----- */ + + /*** + Summary of useful functions: + GetLine( "label", &variable ) - Looks for "label" in input file, and places the corresponding sum of + values following that label (until ";") into variable. + GetLineF( "label", &variable ) - Like GetLine() above, but also writes the result to the output file. + GetLineFnz(( "label", &variable ) - Like GetLine(), but only writes non-zero values to the output file. + GetLine1( "label", &variable ) - Like GetLine() above, but expects single value (no sum, no ";" in input file). + + c = SmallerOf( a, b ); - Selects smaller of two values. + c = LargerOf( a, b ); - Selects larger of two values. + c = NotLessThanZero( a ); - Selects positive value or zero. Prevents negative values. + + showline( j ) - Writes currency value of L[j] to output file with label in nice format. + shownum( j ) - Writes integer value of L[j] to output file with label in nice format. + showline_wmsg( j, "msg" ) - Like showline, but adds the provided message to the output line. + ShowLineNonZero( j ) - Like showline, but only writes non-zero values. + ShowLineNonZero_wMsg( j, "msg" ) - Like showline_wmsg, but only writes non-zero values. + showline_wlabel( "label", value ) - For custom line names and variables not in the default L[] array. + showline_wlabelnz( "label", value ) - Like showline_wlabel, but only writes non-zero values. + showline_wlabelmsg( "label", value, "msg" ) - Like showline_wlabel,but adds the provided message to the output line. + ***/ + + fclose(infile); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + + printf("\nListing results from file: %s\n\n", outfname); + Display_File( outfname ); + + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_VA_760_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_VA_760_2024.c new file mode 100755 index 0000000..99c6d21 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_VA_760_2024.c @@ -0,0 +1,411 @@ +/************************************************************************/ +/* TaxSolve_VA760_2024.c - */ +/* Copyright (C) 2025 - Aston Roberts */ +/* */ +/* Compile: gcc taxsolve_VA760_2024.c -o taxsolve_VA760_2024 */ +/* Run: ./taxsolve_VA760_2024 VA_760_2024.txt */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ +/* */ +/* Aston Roberts 1-2-2025 aston_roberts@yahoo.com */ +/************************************************************************/ + +#include +#include + +#include "taxsolve_routines.c" + +float thisversion=22.01; + +#define SINGLE 1 +#define MARRIED_FILING_JOINTLY 2 +#define MARRIED_FILING_SEPARAT 3 +#define HEAD_OF_HOUSEHOLD 4 +#define WIDOW 5 + +double TaxRateFunction( double income, int status ) +{ + if (income < 3000.0) return income * 0.02; else + if (income < 5000.0) return 60.0 + (income - 3000.0) * 0.03; else + if (income < 17000.0) return 120.0 + (income - 5000.0) * 0.05; else + return 720.0 + (income - 17000.0) * 0.0575; +} + + +void Report_bracket_info( double income, double tx, int status ) +{ + double rate; + if (income < 3000.0) rate = 0.02; else + if (income < 5000.0) rate = 0.03; else + if (income < 17000.0) rate = 0.05; else rate = 0.0575; + printf(" You are in the %2.1f%% marginal tax bracket,\n and you are paying an effective %2.1f%% tax on your total income.\n", + 100.0 * rate, 100.0 * tx / income ); + fprintf(outfile," You are in the %2.1f%% marginal tax bracket,\n and you are paying an effective %2.1f%% tax on your total income.\n", + 100.0 * rate, 100.0 * tx / income ); +} + + +struct date_record yourDOB, spouseDOB, DL; + + +/*----------------------------------------------------------------------------*/ + +int main( int argc, char *argv[] ) +{ + int i, j, k; + char word[1000], outfname[4000], *lnameptr, lastname[1024], *socsec, *datestr, *twrd, *infname=0; + int status=0, exemptionsA=0, exemptionsB=0, youBlind=0, spouseBlind=0; + time_t now; + double L19b=0.0, std_ded=0.0, min2file, STA_VAGI=0.0; + + /* Intercept any command-line arguments. */ + printf("VA-760 2024 - v%3.1f\n", thisversion); + i = 1; k=1; + while (i < argc) + { + if (strcmp(argv[i],"-verbose")==0) verbose = 1; + else + if (k==1) + { + infname = strdup(argv[i]); + 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]); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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 0) + fprintf(outfile,"ExmpDeps: %d\n", exemptionsA ); + if (status == MARRIED_FILING_JOINTLY) + exemptionsA = 2 + exemptionsA; + else + exemptionsA = 1 + exemptionsA; + fprintf(outfile,"NExemptionsA = %d\n", exemptionsA ); + fprintf(outfile,"ExemptionsA = %d\n", 930 * exemptionsA ); + + if (yourDOB.year < 1960) /* Updated for 2024. */ + { + fprintf(outfile,"YouOver65 = 1\n" ); /* You are 65 or over. */ + exemptionsB = 1; + } + else + exemptionsB = 0; + + /* Handle Exemptions for: YouOver65: SpOver65: YouBlind: SpBlind: */ + + get_parameter( infile, 's', word, "YouBlind" ); + get_parameter( infile, 'b', &youBlind, "YouBlind"); + if (youBlind != 0) + { + fprintf(outfile,"YouBlind = 1\n"); + exemptionsB++; + } + + get_parameter( infile, 's', word, "SpouseBlind" ); + get_param_single_line( infile, 'b', &spouseBlind, "SpouseBlind"); + if (status == MARRIED_FILING_JOINTLY) + { + if (spouseDOB.year < 1960) /* Updated for 2024. */ + { + fprintf(outfile,"SpouseOver65 = 1\n" ); /* Spouse is 65 or over. */ + exemptionsB++; + } + if (spouseBlind != 0) + { + fprintf(outfile,"SpouseBlind = 1\n"); + exemptionsB++; + } + } + + fprintf(outfile,"NExemptionsB = %d\n", exemptionsB ); + fprintf(outfile,"ExemptionsB = %d\n", 800 * exemptionsB ); + + if (status == MARRIED_FILING_JOINTLY) + { + fprintf(outfile,"ExmpSpouse: 1\n"); + if (exemptionsA > 2) + fprintf(outfile,"ExmpDeps: %d\n", exemptionsA - 2 ); + } + else + if (exemptionsA > 1) + fprintf(outfile,"ExmpDeps: %d\n", exemptionsA - 1 ); + + GetLineF( "L1", &L[1] ); /* Federal Adjusted Gross Income */ + + GetLineF( "L2", &L[2] ); /* Additions from attached Schedule ADJ, line 3 */ + + L[3] = L[1] + L[2]; + showline(3); + + GetLineF( "L4", &L[4] ); /* Deduction for age on Jan 1, 2024. */ + + GetLineF( "L5", &L[5] ); /* Social Security Act, Tier 1 Railroad Retirement Act benef. */ + + GetLineF( "L6", &L[6] ); /* State Income Tax refund or overpayment credit */ + + GetLineF( "L7", &L[7] ); /* Subtractions from Schedule ADJ, line 7 */ + + L[8] = L[4] + L[5] + L[6] + L[7]; + showline(8); + + L[9] = L[3] - L[8]; + showline(9); /* Virginia Adjusted Gross Income (VAGI) */ + + GetLineF( "L10", &L[10] ); /* Deductions - Std or Itemized minus income taxes */ + + switch (status) + { /* Updated for 2024. */ + case SINGLE: std_ded = 8500.0; min2file = 11950.0; break; + case MARRIED_FILING_JOINTLY: std_ded = 17000.0; min2file = 23900.0; break; + case MARRIED_FILING_SEPARAT: std_ded = 8500.0; min2file = 11950.0; break; + default: printf("Unexpected status.\n"); + fprintf(outfile,"Unexpected status.\n"); + exit(1); + break; + } + + if (L[10] == 0.0) + L[11] = std_ded; + showline(11); + + L[12] = 930.0 * exemptionsA + 800.0 * exemptionsB; + showline(12); + + GetLineF( "L13", &L[13] ); /* Deductions from Virginia Adjusted Gross Income Schedule ADJ, Line 9. */ + + L[14] = L[10] + L[11] + L[12]; + showline(14); + + L[15] = L[9] - L[14]; + showline_wmsg( 15, "Virginia Taxable Income" ); + + L[16] = TaxRateFunction( L[15], status ); + showline(16); + Report_bracket_info( L[15], L[16], status ); + + GetLine( "STA_VAGI", &STA_VAGI ); + showline_wlabelnz( "STA_VAGI", STA_VAGI ); + GetLine( "L17", &L[17] ); /* Spouse Tax Adjustment. */ + showline(17); + + L[18] = L[16] - L[17]; + showline_wmsg( 18, "Net Amount of Tax" ); + + GetLineF( "L19a", &L[19] ); /* Virginia tax withheld for 2024. */ + GetLineF( "L19b", &L19b ); /* Spouse's Virginia tax withheld. */ + + GetLineF( "L20", &L[20] ); /* Estimated tax paid for 2024. (form 760ES) */ + + GetLineF( "L21", &L[21] ); /* Amount of last year's overpayment applied toward 2024 estimated tax. */ + + GetLineF( "L22", &L[22] ); /* Extension payments (form 760E). */ + + GetLine( "L23", &L[23] ); /* Tax Credit, Low Income Individuals (Sch. ADJ, line 17) */ + + if (L[23] > L[18]) + L[23] = L[18]; /* Low-Income Credit cannot exceed tax liability. */ + + if ((L[23] > 0.0) && (exemptionsB > 0.0)) + { + fprintf(outfile," Cannot claim both Low-Income Credit and Age or Blind Exemptions.\n"); + L[23] = 0.0; /* Cannot claim both low-income credit and exemptions. */ + } + showline(23); + + GetLineF( "L24", &L[24] ); /* Credit, Tax Paid to other State (Sched OSC, line 21 ...) */ + GetLineF( "L25", &L[25] ); /* Credits from enclosed Schedule CR, Section 5, Part 1, Line 1A */ + + L[26] = L[19] + L19b + L[20] + L[21] + L[22] + L[23] + L[24] + L[25]; + showline(26); + + if (L[26] < L[18]) + { + L[27] = L[18] - L[26]; + showline_wmsg( 27, "Tax You Owe" ); + } + else + { + L[28] = L[26] - L[18]; + showline_wmsg( 28, "Your Tax OverPayment" ); + } + + GetLineF( "L29", &L[29] ); /* Amount of overpayment you want credited to next year's estimated tax. */ + GetLineF( "L30", &L[30] ); /* Virginia College Savings Plan Contributions from Schedule VAC, Section I, Line 6. */ + GetLineF( "L31", &L[31] ); /* Other voluntary contribitions. */ + GetLineF( "L32", &L[32] ); /* Addition to Tax, Penalty and Interest from attached Schedule ADJ, Line 21 */ + GetLineF( "L33", &L[33] ); /* Consumer's Use Tax. */ + + for (j=29; j < 33; j++) + L[34] = L[34] + L[j]; + showline(34); + + if (L[27] > 0.0) + { + L[35] = L[27] + L[34]; + showline_wmsg( 35, "AMOUNT DUE" ); + fprintf(outfile," (Which is %2.1f%% of your total tax.)\n", 100.0 * L[35] / (L[18] + 1e-9) ); + } + else + if (L[28] < L[34]) + { + L[35] = L[34] - L[28]; + showline_wmsg( 35, "AMOUNT DUE" ); + fprintf(outfile," (Which is %2.1f%% of your total tax.)\n", 100.0 * L[35] / (L[19] + 1e-9) ); + } + else + if (L[28] > L[34]) + { + L[36] = L[28] - L[34]; + showline_wmsg( 36, "YOUR REFUND" ); + } + + if (L[9] < min2file) + { + fprintf(outfile,"\nYour VAGI is less than the minimum required to file a return.\n"); + if (L[19] + L19b + L[20] > 0.0) + fprintf(outfile," But you need to file return to receive refund of withheld taxes.\n"); + else + fprintf(outfile,"You do not need to file return. Your VA Tax is zero.\n"); + } + + fclose(infile); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + Display_File( outfname ); + printf("\nResults written to file: %s\n", outfname); + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_f2210_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_f2210_2024.c new file mode 100755 index 0000000..7e81c2b --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_f2210_2024.c @@ -0,0 +1,680 @@ +/************************************************************************/ +/* TaxSolve_Form_2210.c - 2024 */ +/* User contributed. */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA. */ +/* */ +/************************************************************************/ + +float thisversion=5.01; + +#include +#include +#include +#include +#include + +#include "taxsolve_routines.c" + +#define SINGLE 1 +#define MARRIED_FILING_JOINTLY 2 +#define MARRIED_FILING_SEPARAT 3 +#define HEAD_OF_HOUSEHOLD 4 +#define WIDOW 5 +#define Yes 1 +#define No 0 +#define Neither 0 +#define Short 1 +#define Regular 2 +#define INDIVIDUAL 1 +#define ESTATE 2 + +int BoxA = 0, BoxB = 0, BoxC = 0, BoxD = 0, BoxE = 0, Num_Days = 0; + +/*-----------Tax Routines Copied From taxsolve_US_1040_2024.c----------------*/ + + /* Following values taken from 1040-Instructions pg 110. */ /* Updated for 2024. */ +double brkpt[4][9]={ + { 0.0, 11600.0, 47150.0, 100525.0, 191950.0, 243725.0, 609350.0, 9e19 }, /* Single */ + { 0.0, 23200.0, 94300.0, 201050.0, 383900.0, 487450.0, 731201.0, 9e19 }, /* Married, filing jointly. */ + { 0.0, 11600.0, 47150.0, 100525.0, 191950.0, 243725.0, 365600.0, 9e19 }, /* Married, filing separate. */ + { 0.0, 16550.0, 63100.0, 100500.0, 191150.0, 243700.0, 609350.0, 9e19 }, /* Head of Household. */ + }; + double txrt[4][9] ={ + { 0.1, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37 }, /* Single */ + { 0.1, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37 }, /* Married, filing jointly. */ + { 0.1, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37 }, /* Married, filing separate. */ + { 0.1, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37 }, /* Head of Household. */ + }; + + +double TaxRateFormula( double x, int status ) /* Returns tax due. */ +{ + double sum=0.0; + int bracket=0; + if (status == WIDOW) status = MARRIED_FILING_JOINTLY; /* Handle case of widow(er). */ + status = status - 1; /* Arrays start at zero; not one. */ + while (brkpt[status][bracket+1] < x) + { + sum = sum + (brkpt[status][bracket+1] - brkpt[status][bracket]) * txrt[status][bracket]; + bracket = bracket + 1; + } + return (x - brkpt[status][bracket]) * txrt[status][bracket] + sum; +} + +double TaxRateFunction( double income, int status ) /* Emulates table lookup or function appropriately. */ +{ + double x, dx, tx; + int k; + if (income < 100000.0) /* Quantize to match tax-table exactly. */ + { + if (income < 25.0) x = 5.0; else + if (income < 3000.0) x = 25.0; else x = 50.0; + dx = 0.5 * x; + k = income / x; + x = x * (double)k + dx; + tx = (int)(TaxRateFormula( x, status ) + 0.5); + } + else + tx = TaxRateFormula( income, status ); + return tx; +} + +/* 2024 Tax Rate Schedule for Estates/Trusts - From 2024 Form 1041 Instructions, page 30 */ + +double Estate_Trust_TaxRateFunction( double income ) +{ + if (income < 2650.0) return income * 0.10; else + if (income < 9550.0) return 265.0 + (income - 2650.0) * 0.24; else + if (income < 13050.0) return 1921.0 + (income - 9550.0) * 0.35; else + return 3146.0 + (income - 13050.0) * 0.37; +} + +/*----------------------------------------------------------------------------*/ + +int main( int argc, char *argv[] ) +{ + int i, j, k, status, entity=INDIVIDUAL; + char word[4000], outfname[4000], *infname=0; + time_t now; + + /* line entry variables L[n] are declared in taxsolve_routines.c */ + + double A[19], B[19], C[19], D[19]; /* cells in grid of Part III, Section A, comprised of lines 10 through 18 */ + /* e.g., cell 18(a) will be be variable A[18] */ + + double a[37], b[37], c[37], d[37]; /* cells in grid of Schedule AI comprised of lines 1 through 36 */ + /* e.g., cell 1(a) will be in variable a[1] */ + + printf("Form 2210, 2024 - v%3.2f\n", thisversion); + + /* Decode any command-line arguments. */ + i = 1; k=1; + while (i < argc) + { + if (strcmp(argv[i],"-verbose")==0) { verbose = 1; } + else + if (k==1) + { + infname = strdup(argv[i]); + infile = fopen(infname,"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", infname ); exit(1);} + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname,infname); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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 L[6]) + fprintf(outfile, "CkL9Yes X\n"); /* Yes, may owe penalty */ + else + fprintf(outfile, "CkL9No X\n"); /* No, don't owe penalty */ + + get_parameter( infile, 's', word, "BoxA" ); + get_parameter( infile, 'w', word, "BoxA?"); + if (strncasecmp(word,"Yes",1)==0){ + BoxA = Yes; + fprintf(outfile,"CkBoxA X\n"); +} + +get_parameter( infile, 's', word, "BoxB" ); +get_parameter( infile, 'w', word, "BoxB?"); + if (strncasecmp(word,"Yes",1)==0){ + BoxB = Yes; + fprintf(outfile,"CkBoxB X\n"); +} + + get_parameter( infile, 's', word, "BoxC" ); + get_parameter( infile, 'w', word, "BoxC?"); + if (strncasecmp(word,"Yes",1)==0){ + BoxC = Yes; + fprintf(outfile,"CkBoxC X\n"); +} + +get_parameter( infile, 's', word, "BoxD" ); + get_parameter( infile, 'w', word, "BoxD?"); + if (strncasecmp(word,"Yes",1)==0){ + BoxD = Yes; + fprintf(outfile,"CkBoxD X\n"); +} + +get_parameter( infile, 's', word, "BoxE" ); + get_parameter( infile, 'w', word, "BoxE?"); + if (strncasecmp(word,"Yes",1)==0){ + BoxE = Yes; + fprintf(outfile,"CkBoxE X\n"); +} + +if((L[4] < 1000) || (L[7] < 1000)) + fprintf(outfile, "Line 4 or Line 7 less than $1,000. Don't file Form 2210. You don't owe a penalty.\n"); + +else if(L[6] >= L[9]){ + fprintf(outfile, "Line 6 is equal to or more than Line 9.\n"); + if(BoxE == Yes){ + + fprintf(outfile, "You don't owe a penalty. Because Box E in Part II applies, file page 1 of Form 2210.\n"); + } + else{ + fprintf(outfile, "You don't owe a penalty. Don't file Form 2210.\n"); + } +} +else if((BoxA == Yes) || (BoxB == Yes) || (BoxC == Yes) || (BoxD == Yes) || (BoxE == Yes)){ + fprintf(outfile, "You MUST file Form 2210.\n"); + if((BoxB == Yes) || (BoxC == Yes) || (BoxD == Yes)) + fprintf(outfile, "You must figure your penalty.\n"); + else + fprintf(outfile, "%s", "You aren't required to figure your penalty because the IRS\nwill figure it and send you a bill for any unpaid amount.\nIf you want to figure it, you may use Part III as a\nworksheet and enter your penalty amount on your tax return,\nbut FILE ONLY PAGE 1 OF FORM 2210.\n"); +} +else + fprintf(outfile, "%s", "Don't file Form 2210. You aren't required to figure\nyour penalty because the IRS will figure it and send\nyou a bill for any unpaid amount. If you want to figure\nit, you may use Part III as a worksheet and\nenter your penalty amount on your tax return, but\ndon't file Form 2210.\n"); + + + /* Inputs must be read; */ + /* otherwise, error message re: unexpected input is thrown */ + + GetLine( "SecA_11a", &A[11] ); + GetLine( "SecA_11b", &B[11] ); + GetLine( "SecA_11c", &C[11] ); + GetLine( "SecA_11d", &D[11] ); + + GetLine( "SchdAI_1a", &a[1] ); + GetLine( "SchdAI_1b", &b[1] ); + GetLine( "SchdAI_1c", &c[1] ); + GetLine( "SchdAI_1d", &d[1] ); + + GetLine( "SchdAI_4a", &a[4] ); + GetLine( "SchdAI_4b", &b[4] ); + GetLine( "SchdAI_4c", &c[4] ); + GetLine( "SchdAI_4d", &d[4] ); + + GetLine( "SchdAI_7a", &a[7] ); + b[7] = a[7]; + c[7] = a[7]; + d[7] = a[7]; + + GetLine( "SchdAI_9a", &a[9] ); + GetLine( "SchdAI_9b", &b[9] ); + GetLine( "SchdAI_9c", &c[9] ); + GetLine( "SchdAI_9d", &d[9] ); + + GetLine( "SchdAI_12a", &a[12] ); + b[12] = a[12]; + c[12] = a[12]; + d[12] = a[12]; + + GetLine( "SchdAI_14a", &a[14] ); + GetLine( "SchdAI_14b", &b[14] ); + GetLine( "SchdAI_14c", &c[14] ); + GetLine( "SchdAI_14d", &d[14] ); + + GetLine( "SchdAI_16a", &a[16] ); + GetLine( "SchdAI_16b", &b[16] ); + GetLine( "SchdAI_16c", &c[16] ); + GetLine( "SchdAI_16d", &d[16] ); + + GetLine( "SchdAI_18a", &a[18] ); + GetLine( "SchdAI_18b", &b[18] ); + GetLine( "SchdAI_18c", &c[18] ); + GetLine( "SchdAI_18d", &d[18] ); + + GetLine( "SchdAI_28a", &a[28] ); + GetLine( "SchdAI_28b", &b[28] ); + GetLine( "SchdAI_28c", &c[28] ); + GetLine( "SchdAI_28d", &d[28] ); + + GetLine( "SchdAI_30a", &a[30] ); + GetLine( "SchdAI_30b", &b[30] ); + GetLine( "SchdAI_30c", &c[30] ); + GetLine( "SchdAI_30d", &d[30] ); + + GetLine( "SchdAI_32a", &a[32] ); + GetLine( "SchdAI_32b", &b[32] ); + GetLine( "SchdAI_32c", &c[32] ); + GetLine( "SchdAI_32d", &d[32] ); + + GetLine( "L19", &L[19] ); + + /* Schedule AI - PART 1 */ + + if(BoxC == Yes){ + + if(entity == ESTATE){ + + a[2] = 6.0; + b[2] = 3.0; + c[2] = 1.71429; + d[2] = 1.09091; + + a[3] = a[1] * a[2]; + b[3] = b[1] * b[2]; + c[3] = c[1] * c[2]; + d[3] = d[1] * d[2]; + + for(i = 4; i <= 8; i++){ + + a[i] = 0; + b[i] = 0; + c[i] = 0; + d[i] = 0; + } + + a[10] = 0; + b[10] = 0; + c[10] = 0; + d[10] = 0; + + a[11] = a[3] - a[9]; + b[11] = b[3] - b[9]; + c[11] = c[3] - c[9]; + d[11] = d[3] - d[9]; + + a[13] = NotLessThanZero(a[11] - a[12]); + b[13] = NotLessThanZero(b[11] - b[12]); + c[13] = NotLessThanZero(c[11] - c[12]); + d[13] = NotLessThanZero(d[11] - d[12]); + + if(a[14] < 0) + a[14] = Estate_Trust_TaxRateFunction(a[13]); /* else defaults to the entered value */ + if(b[14] < 0) + b[14] = Estate_Trust_TaxRateFunction(b[13]); + if(c[14] < 0) + c[14] = Estate_Trust_TaxRateFunction(c[13]); + if(d[14] < 0) + d[14] = Estate_Trust_TaxRateFunction(d[13]); + } + else{ + a[2] = 4.0; + b[2] = 2.4; + c[2] = 1.5; + d[2] = 1.0; + + a[3] = a[1] * a[2]; + b[3] = b[1] * b[2]; + c[3] = c[1] * c[2]; + d[3] = d[1] * d[2]; + + a[5] = a[2]; + b[5] = b[2]; + c[5] = c[2]; + d[5] = d[2]; + + a[6] = a[4] * a[5]; + b[6] = b[4] * b[5]; + c[6] = c[4] * c[5]; + d[6] = d[4] * d[5]; + + a[8] = LargerOf(a[6], a[7]); + b[8] = LargerOf(b[6], b[7]); + c[8] = LargerOf(c[6], c[7]); + d[8] = LargerOf(d[6], d[7]); + + a[10] = a[8] + a[9]; + b[10] = b[8] + b[9]; + c[10] = c[8] + c[9]; + d[10] = d[8] + d[9]; + + a[11] = a[3] - a[10]; + b[11] = b[3] - b[10]; + c[11] = c[3] - c[10]; + d[11] = d[3] - d[10]; + + a[13] = NotLessThanZero(a[11] - a[12]); + b[13] = NotLessThanZero(b[11] - b[12]); + c[13] = NotLessThanZero(c[11] - c[12]); + d[13] = NotLessThanZero(d[11] - d[12]); + + if(a[14] < 0) + a[14] = TaxRateFunction(a[13], status); + if(b[14] < 0) + b[14] = TaxRateFunction(b[13], status); + if(c[14] < 0) + c[14] = TaxRateFunction(c[13], status); + if(d[14] < 0) + d[14] = TaxRateFunction(d[13], status); + } + + /* Interrupt Part I to Calculate Line 15 */ + + /* Schedule AI - Part II - Annualized Self-Employment Tax */ + + a[29] = 42150; /* Updated for 2024 */ + b[29] = 70250; + c[29] = 112400; + d[29] = 168600; + + a[31] = NotLessThanZero(a[29] - a[30]); + b[31] = NotLessThanZero(b[29] - b[30]); + c[31] = NotLessThanZero(c[29] - c[30]); + d[31] = NotLessThanZero(d[29] - d[30]); + + a[32] = 0.496; + b[32] = 0.2976; + c[32] = 0.186; + d[32] = 0.124; + + a[33] = a[32] * SmallerOf(a[28], a[31]); + b[33] = b[32] * SmallerOf(b[28], b[31]); + c[33] = c[32] * SmallerOf(c[28], c[31]); + d[33] = d[32] * SmallerOf(d[28], d[31]); + + a[34] = 0.116; + b[34] = 0.0696; + c[34] = 0.0435; + d[34] = 0.029; + + a[35] = Round(a[28] * a[34]); + b[35] = Round(b[28] * b[34]); + c[35] = Round(c[28] * c[34]); + d[35] = Round(d[28] * d[34]); + + a[36] = a[33] + a[35]; + b[36] = b[33] + b[35]; + c[36] = c[33] + c[35]; + d[36] = d[33] + d[35]; + + /* End Part II Annualized Self-Employment Tax */ + /* Continue Part I */ + + a[15] = a[36]; + b[15] = b[36]; + c[15] = c[36]; + d[15] = d[36]; + + a[17] = a[14] + a[15] + a[16]; + b[17] = b[14] + b[15] + b[16]; + c[17] = c[14] + c[15] + c[16]; + d[17] = d[14] + d[15] + d[16]; + + a[19] = NotLessThanZero(a[17] - a[18]); + b[19] = NotLessThanZero(b[17] - b[18]); + c[19] = NotLessThanZero(c[17] - c[18]); + d[19] = NotLessThanZero(d[17] - d[18]); + + a[20] = 0.225; + b[20] = 0.45; + c[20] = 0.675; + d[20] = 0.90; + + a[21] = Round(a[19] * a[20]); + b[21] = Round(b[19] * b[20]); + c[21] = Round(c[19] * c[20]); + d[21] = Round(d[19] * d[20]); + + a[23] = NotLessThanZero(a[21]); + a[24] = Round(L[9] * 0.25); + a[26] = a[24]; + a[27] = SmallerOf(a[23], a[26]); + A[10] = a[27]; + + b[22] = a[27]; + b[23] = NotLessThanZero(b[21] - b[22]); + b[24] = Round(L[9] * 0.25); + b[25] = a[26] - a[27]; + b[26] = b[24] + b[25]; + b[27] = SmallerOf(b[23], b[26]); + B[10] = b[27]; + + c[22] = a[27] + b[27]; + c[23] = NotLessThanZero(c[21] - c[22]); + c[24] = Round(L[9] * 0.25); + c[25] = b[26] - b[27]; + c[26] = c[24] + c[25]; + c[27] = SmallerOf(c[23], c[26]); + C[10] = c[27]; + + d[22] = a[27] + b[27] + c[27]; + d[23] = NotLessThanZero(d[21] - d[22]); + d[24] = Round(L[9] * 0.25); + d[25] = c[26] - c[27]; + d[26] = d[24] + d[25]; + d[27] = SmallerOf(d[23], d[26]); + D[10] = d[27]; + } + /* Penalty Computation - PART III */ + + else if(BoxC == No){ + + A[10] = Round(L[9] * 0.25); + B[10] = Round(L[9] * 0.25); + C[10] = Round(L[9] * 0.25); + D[10] = Round(L[9] * 0.25); + } + + A[15] = A[11]; + if(A[10] >= A[15]) + A[17] = A[10] - A[15]; + else + A[18] = A[15] - A[10]; + + B[12] = A[18]; + B[13] = B[11] + B[12]; + B[14] = A[16] + A[17]; + B[15] = NotLessThanZero(B[13] - B[14]); + if(B[15] == 0) + B[16] = B[14] - B[13]; + else + B[16] = 0; + if(B[10] >= B[15]) + B[17] = B[10] - B[15]; + else + B[18] = B[15] - B[10]; + + C[12] = B[18]; + C[13] = C[11] + C[12]; + C[14] = B[16] + B[17]; + C[15] = NotLessThanZero(C[13] - C[14]); + if(C[15] == 0) + C[16] = C[14] - C[13]; + else + C[16] = 0; + if(C[10] >= C[15]) + C[17] = C[10] - C[15]; + else + C[18] = C[15] - C[10]; + + D[12] = C[18]; + D[13] = D[11] + D[12]; + D[14] = C[16] + C[17]; + D[15] = NotLessThanZero(D[13] - D[14]); + if(D[10] >= D[15]) + D[17] = D[10] - D[15]; + else + D[18] = D[15] - D[10]; + + for(i = 10; i <= 18; i++){ + fprintf(outfile, "SecA_%d%s %0.2lf\n", i, "a", A[i]); + fprintf(outfile, "SecA_%d%s %0.2lf\n", i, "b", B[i]); + fprintf(outfile, "SecA_%d%s %0.2lf\n", i, "c", C[i]); + fprintf(outfile, "SecA_%d%s %0.2lf\n", i, "d", D[i]); + } + + if((A[17] == 0) && (B[17] == 0) && (C[17] == 0) && (D[17] == 0)){ + fprintf(outfile, "\n%s\n", "If line 17 on page 2 is zero for all payment periods, you don't owe a penalty.\nBut if you checked box C or D in Part II, you must file Form 2210 with your return.\nIf you checked box E, you must file page 1 of Form 2210 with your return.\nIn certain circumstances, the IRS will waive all or part of the underpayment\npenalty. See Waiver of Penalty in the instructions.\n"); + + fprintf(outfile, "L19 %0.2lf\n", 0.0); + } + else{ + fprintf(outfile, "\n%s\n", "There is an underpayment for one or more periods.\nIf you are required to calculate the penalty, or choose to do so, use the\nWorksheet for Form 2210, Part III, Section B-Figure the Penalty\n(Penalty Worksheet), in the instructions to figure your penalty.\nEnter the penalty amount in the OTS GUI for Form 2210 (last line).\n"); + + fprintf(outfile, "L19 %0.2lf %s\n", L[19], "This is the penalty amount YOU have entered from the Penalty Worksheet.\nIt defaults to zero until YOU enter your penalty.\nDO NOT INTERPRET THE DEFAULT ZERO VALUE TO INDICATE YOU DO NOT OWE\nA PENALTY.\nSee above instructions and the form 2210 instructions to determine if you need\nto calculate a penalty."); + + fprintf(outfile, "%s\n", "In certain circumstances, the IRS will waive all or part of the underpayment\npenalty. See Waiver of Penalty in the form 2210 instructions.\n"); + } + + if(BoxC == Yes){ + for(i = 1; i <= 27; i++){ + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "a", a[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "b", b[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "c", c[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "d", d[i]); + } + + if((a[28] > 0.0) || (b[28] > 0.0) || (c[28] > 0.0) || (d[28] > 0.0)){ + for(i = 18; i <= 31; i++){ + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "a", a[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "b", b[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "c", c[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "d", d[i]); + } + + for(i = 33; i <= 36; i++){ + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "a", a[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "b", b[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "c", c[i]); + fprintf(outfile, "SchdAI_%d%s %0.2lf\n", i, "d", d[i]); + } + } + } + + fclose(infile); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + + printf("\nListing results from file: %s\n\n", outfname); + Display_File( outfname ); + + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_f8606.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_f8606.c new file mode 100755 index 0000000..25492a1 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_f8606.c @@ -0,0 +1,291 @@ +/************************************************************************/ +/* TaxSolve_Form_8606.c - */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ +/* */ +/* Provided by Fred Robinson - 2024-7-8. */ +/* Updated 1-15-2025. */ +/************************************************************************/ + +float thisversion = 3.00; + +#include +#include +#include +#include +#include +#include + +#include "taxsolve_routines.c" +#define Yes 1 +#define No 0 + +/*----------------------------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int i, j, k; + int complete_part_one, complete_part_two, complete_part_three, dist_or_conv; + char word[4000], outfname[4000], *infname = 0; + time_t now; + double L15a = 0.0, L15b = 0.0, L15c = 0.0; + double L25a = 0.0, L25b = 0.0, L25c = 0.0; + + printf("Form 8606, 2024 - v%3.2f\n", thisversion); + + /* Decode any command-line arguments. */ + i = 1; + k = 1; + while (i < argc) { + if (strcmp(argv[i], "-verbose") == 0) { + verbose = 1; + } else if (k == 1) { + infname = strdup(argv[i]); + infile = fopen(infname, "r"); + if (infile == 0) { + printf("ERROR: Parameter file '%s' could not be opened.\n", infname); + exit(1); + } + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname, infname); + j = strlen(outfname) - 1; + while ((j >= 0) && (outfname[j] != '.')) + j--; + if (j < 0) + strcat(outfname, "_out.txt"); + else + strcpy(&(outfname[j]), "_out.txt"); + 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 lines, something like: + Title: Form XXXX Return + L2 {Returns and Allowances} + . . . + */ + + /* Accept Form's "Title" line, and put out with date-stamp for your records. + */ + read_line(infile, word); + now = time(0); + fprintf(outfile, "\n%s, v%2.2f, %s\n", word, thisversion, ctime(&now)); + check_form_version( word, "Title: Form 8606 for tax-year 2024" ); + + // Begin form-specific code + + // Part I + + /* Are you completing Part I of this form? (Y/N) */ + get_parameter(infile, 's', word, "Complete_Part_One?"); + get_param_single_line(infile, 'b', &complete_part_one, "Complete_Part_One?"); + + GetLine("L1", &L[1]); + GetLine("L2", &L[2]); + + /* Did you take a distribution or make a conversion? (Y/N) */ + get_parameter(infile, 's', word, "Dist_or_Conv?"); + get_param_single_line(infile, 'b', &dist_or_conv, "Dist_or_Conv?"); + + GetLine("L4", &L[4]); + GetLine("L6", &L[6]); + GetLine("L7", &L[7]); + GetLine("L8", &L[8]); + GetLine("L15b", &L15b); + + // All inputs are read, now produce output for Part I + if (complete_part_one) { + showline(1); + showline(2); + L[3] = L[1] + L[2]; + showline(3); + + if (!dist_or_conv) { + L[14] = L[3]; + showline(14); + } else { + + showline(4); + L[5] = L[3] - L[4]; + showline(5); + showline(6); + showline(7); + showline(8); + L[9] = L[6] + L[7] + L[8]; + showline(9); + + L[10] = L[5] / L[9]; + if (L[10] > 1.00) { + L[10] = 1.0; + } + + double integral; + double fractional = modf(L[10], &integral); + int integral_int, fractional_int; + integral_int = integral; + fractional_int = abs( (int)(1000.0 * fractional) ); + fprintf(outfile, "L10intpart %d\n", integral_int); + fprintf(outfile, "L10rest %03d\n", fractional_int); + + L[11] = L[8] * L[10]; + showline(11); + + L[12] = L[7] * L[10]; + showline(12); + + L[13] = L[11] + L[12]; + showline(13); + + L[14] = L[3] - L[13]; + showline(14); + + L15a = L[7] - L[12]; + showline_wlabel("L15a", L15a); + + showline_wlabel("L15b", L15b); + + L15c = L15a - L15b; + if (L15c > 0.0) { + showline_wlabelmsg( + "L15c", L15c, + "Taxable Amount: include this amount on 2024 Form 1040 or 1040-SR, " + "line 4b; or 2024 Form 1040-NR, line 16b" ); + } else { + showline_wlabel("L15c", L15c); + } + } + } + + // Part II + + /* Are you completing Part II of this form? (Y/N) */ + get_parameter(infile, 's', word, "Complete_Part_Two?"); + get_param_single_line(infile, 'b', &complete_part_two, "Complete_Part_Two?"); + + GetLine("L16", &L[16]); + GetLine("L17", &L[17]); + + if (complete_part_two) { + if (complete_part_one && dist_or_conv) { + L[16] = L[8]; + L[17] = L[11]; + } + + showline(16); + showline(17); + L[18] = L[16] - L[17]; + showline(18); + } + + // Part III + + /* Are you completing Part III of this form? (Y/N) */ + get_parameter(infile, 's', word, "Complete_Part_Three?"); + get_param_single_line(infile, 'b', &complete_part_three, "Complete_Part_Three?"); + GetLine("L19", &L[19]); + GetLine("L20", &L[20]); + GetLine("L22", &L[22]); + GetLine("L24", &L[24]); + GetLine("L25b", &L25b); + + if (complete_part_three) { + showline(19); + showline(20); + + L[21] = NotLessThanZero(L[19] - L[20]); + showline(21); + + showline(22); + + if (L[21] > 0.0) { + L[23] = NotLessThanZero(L[21] - L[22]); + + if (L[23] == 0) { + showline(23); + } else { + showline_wmsg( + 23, "you may be subject to an additional tax (see instructions)"); + } + } + + if (L[21] > 0 && L[23] > 0) { + showline(24); + + L25a = NotLessThanZero(L[23] - L[24]); + showline_wlabel("L25a", L25a); + + if (L25a > 0) { + showline_wlabelmsg("L25b", L25b, + "Also, enter this amount on 2024 Form 8915-C, line " + "23, or 2024 Form 8915-D, line 14, as applicable"); + + L25c = L25a - L25b; + if (L25c > 0) { + showline_wlabelmsg( + "L25c", L25c, + "Also include this amount on 2024 Form 1040 or 1040-SR, line 4b; " + "or 2024 Form 1040-NR, line 16b."); + + } else { + showline_wlabel("L25c", L25c); + } + } + } + } + + fprintf(outfile, "------------------------------\n"); + fprintf(outfile, "\n{ --------- Identity-Information: --------- }\n"); + GetTextLineF("Name:"); + GetTextLineF("SocSec#:"); + GetTextLineF("Number&Street:"); + GetTextLineF("Apt#:"); + GetTextLineF("TownStateZip:"); + GetTextLineF("ForeignCountry:"); + GetTextLineF("ForeignState:"); + GetTextLineF("ForeignPostcode:"); + + // End form-specific code + + fclose(infile); + grab_any_pdf_markups(infname, outfile); + fclose(outfile); + + printf("\nListing results from file: %s\n\n", outfname); + Display_File(outfname); + + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_f8812_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_f8812_2024.c new file mode 100755 index 0000000..1c79a67 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_f8812_2024.c @@ -0,0 +1,317 @@ +/************************************************************************/ +/* taxsolve_f8812.c - */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA. */ +/* */ +/************************************************************************/ + +float thisversion=2.00; + +#include +#include +#include +#include +#include + +#include "taxsolve_routines.c" + +#define SINGLE 1 +#define MARRIED_FILING_JOINTLY 2 +#define MARRIED_FILING_SEPARAT 3 +#define HEAD_OF_HOUSEHOLD 4 +#define WIDOW 5 +#define Yes 1 +#define No 0 +int status; + + +/*----------------------------------------------------------------------------*/ + +int main( int argc, char *argv[] ) +{ + int i, j, k; + char word[6000], outfname[6000], *infname=0; + time_t now; + char *name=0, *socsec; + double L2a=0.0, L2b=0.0, L2c=0.0, L2d=0.0, L16a=0.0, L16b=0.0, L18a=0.0, L18b=0.0; + + printf("Form 8812, 2024 - v%3.2f\n", thisversion ); + + /* Decode any command-line arguments. */ + i = 1; k=1; + while (i < argc) + { + if (strcmp(argv[i],"-verbose")==0) { verbose = 1; } + else + if (k==1) + { + infname = strdup(argv[i]); + infile = fopen(infname,"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", infname ); exit(1);} + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname,infname); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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 (j=0; j 0.0) + L[10] = (double)((int)((L[10]-0.01) / 1000.0) + 1) * 1000.0; + showline( 10 ); + + L[11] = L[10] * 0.05; // Checked for tax-year 2024. + showline( 11 ); + + GetLine( "L13", &L[13] ); // Amount from Credit Limit Worksheet A + + GetLine( "Amnt19", &L[19] ); // Amount on Form 1040, line 19. + + GetLine( "L18a", &L18a ); // Earned income (see instructions) } + GetLine( "L18b", &L18b ); // Nontaxable combat pay (see instructions) } + + GetLine( "L21", &L[21] ); // Withheld Soc.Sec., Medicare, & Additional Medicare taxes + GetLine( "L22", &L[22] ); // Total of amounts from Sched-1 (Form 1040), line 15; Sched-2 lines 5+6, 13+22 + + GetLine( "L24", &L[24] ); // Total of amounts from Form 1040, line 27, and Sched-3 line 11. } + + + if (L[8] <= L[11]) + { + fprintf(outfile," Since, L8 is not more than L11 (%6.2f < %6.2f)\n", L[8], L[11] ); + fprintf(outfile," You cannot take the child tax credit, credit for other dependents, or additional child tax credit.\n"); + // Skip to L28 + } + else + { /*A*/ + L[12] = L[8] - L[11]; + showline( 12 ); + showline( 13 ); + + L[14] = SmallerOf( L[12], L[13] ); + showline( 14 ); + + if (L[12] > L[14]) + { + fprintf(outfile,"Since L12 > L14,\n"); + fprintf(outfile,"You may be able to take the additional child tax credit on Form 1040, , line 28.\n"); + } + + // Part II-A Additional Child Tax Credit for All Filers + // Caution: If you file Form 2555, you cannot claim the additional child tax credit. + + L16a = L[12] - L[14]; + showline_wlabel( "L16a", L16a ); + + if ((L16a <= 0.0) || (L[4] == 0.0)) + { /*B*/ + fprintf(outfile,"Since L16a is less-than or equal 0, or L4 is zero,\n"); + fprintf(outfile,"You cannot take the additional child tax credit.\n"); + L[27] = 0.0; + } /*B*/ + else + { /*C*/ + L16b = 1700.0 * L[4]; // Checked/updated for tax-year 2024. + showline_wlabel( "L16b", L16b ); + + if (L16b > 0.0) + { /*D*/ + L[17] = SmallerOf( L16a, L16b ); + showline( 17 ); + + showline_wlabel( "L18a", L18a ); + showline_wlabel( "L18b", L18b ); + + if (L18a > 2500.0) + { /*E*/ + L[19] = L18a - 2500.0; // Checked/updated for tax-year 2024. + showline( 19 ); + L[20] = L[19] * 0.15; + showline( 20 ); + + if (L16b <= 5100.0) // Checked/updated for tax-year 2024. + { /*F*/ + L[27] = SmallerOf( L[17], L[20] ); + } /*F*/ + else + { /*G*/ + if (L[20] >= L[17]) + { /*H*/ + L[27] = L[17]; + } /*H*/ + else + { /*i*/ + showline( 21 ); + showline( 22 ); + L[23] = L[21] + L[22]; + showline( 23 ); + showline( 24 ); + L[25] = NotLessThanZero( L[23] - L[24] ); + showline( 25 ); + L[26] = LargerOf( L[20], L[25] ); + showline( 26 ); + L[27] = SmallerOf( L[17], L[26] ); + } /*i*/ + } /*G*/ + } /*E*/ + else + { + fprintf(outfile,"Note that L18a <= 2,500/\n"); + L[20] = 0.0; + showline( 20 ); + } + } /*D*/ + } /*C*/ + } /*A*/ + + + // Part II-C Additional Child Tax Credit + if (L[27] > 0.0) // Checked for tax-year 2024. + showline_wmsg( 27, "This is your additional child tax credit. Enter this amount on Form 1040, line 28." ); + + + name = GetTextLine( "YourName:" ); + if (name != 0) + fprintf( outfile, "YourName: %s\n", name ); + + socsec = GetTextLine( "SocSec:" ); + if (socsec!= 0) + fprintf( outfile, "SocSec#: %s\n", socsec ); + + + /* ----- .... Until here. ----- */ + + + /*** + Summary of useful functions: + GetLine( "label", &variable ) - Looks for "label" in input file, and places the corresponding sum of + values following that label (until ";") into variable. + GetLineF( "label", &variable ) - Like GetLine() above, but also writes the result to the output file. + GetLineFnz(( "label", &variable ) - Like GetLine(), but only writes non-zero values to the output file. + GetLine1( "label", &variable ) - Like GetLine() above, but expects single value (no sum, no ";" in input file). + + c = SmallerOf( a, b ); - Selects smaller of two values. + c = LargerOf( a, b ); - Selects larger of two values. + c = NotLessThanZero( a ); - Selects positive value or zero. Prevents negative values. + + showline( j ) - Writes currency value of L[j] to output file with label in nice format. + shownum( j ) - Writes integer value of L[j] to output file with label in nice format. + showline_wmsg( j, "msg" ) - Like showline, but adds the provided message to the output line. + ShowLineNonZero( j ) - Like showline, but only writes non-zero values. + ShowLineNonZero_wMsg( j, "msg" ) - Like showline_wmsg, but only writes non-zero values. + showline_wlabel( "label", value ) - For custom line names and variables not in the default L[] array. + showline_wlabelnz( "label", value ) - Like showline_wlabel, but only writes non-zero values. + showline_wlabelmsg( "label", value, "msg" ) - Like showline_wlabel,but adds the provided message to the output line. + + ***/ + + fclose(infile); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + + printf("\nListing results from file: %s\n\n", outfname); + Display_File( outfname ); + + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_f8829_2024.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_f8829_2024.c new file mode 100755 index 0000000..788a90a --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_f8829_2024.c @@ -0,0 +1,371 @@ +/************************************************************************/ +/* taxsolve_f8829.c - */ +/* Contributed by Rylan Luke, 1/2024 */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA. */ +/* */ +/************************************************************************/ + +float thisversion=2.00; + +#include +#include +#include +#include +#include + +#include "taxsolve_routines.c" + +#define FIRST_DIRECT_INDIRECT_LINE 9 +#define LAST_DIRECT_INDIRECT_LINE 23 + +/*----------------------------------------------------------------------------*/ + +//====== Schedule C Import ====== +typedef struct FED_SCH_C_IMP_F8995_T { + double L29; + char *YourName; + char *YourSocSec; +} FED_SCH_C_IMP_F8995_T, *P_FED_SCH_C_IMP_F8995; + +FED_SCH_C_IMP_F8995_T f_sch_c; + +// Mapping from label name to address of local data struct element; either double or char* +static FORM_IMPORT_DEF f_sch_c_imp_defs[] = { + { "L29", &f_sch_c.L29, NULL }, + { "YourName:", NULL, &f_sch_c.YourName }, + { "YourSocSec#:", NULL, &f_sch_c.YourSocSec } +}; + +int f_sch_c_imp_defs_size = sizeof(f_sch_c_imp_defs)/sizeof(FORM_IMPORT_DEF); + +int main( int argc, char *argv[] ) +{ + int i, j, k; + char word[6000], outfname[6000], *infname=0; + time_t now; + // Local line number variables for direct/indirect lines + double La[LAST_DIRECT_INDIRECT_LINE+2]={0}; + double Lb[LAST_DIRECT_INDIRECT_LINE+2]={0}; + + printf("Form 8829, 2024 - v%3.2f\n", thisversion); + + /* Decode any command-line arguments. */ + i = 1; k=1; + while (i < argc) + { + if (strcmp(argv[i],"-verbose")==0) { verbose = 1; } + else + if (k==1) + { + infname = strdup(argv[i]); + infile = fopen(infname,"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", infname ); exit(1);} + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname,infname); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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 +#include +#include +#include +#include +#include "taxsolve_routines.c" + +#define SINGLE 1 +#define MARRIED_FILING_JOINTLY 2 +#define MARRIED_FILING_SEPARAT 3 +#define HEAD_OF_HOUSEHOLD 4 +#define WIDOW 5 +#define Yes 1 +#define No 0 + +int status; + +/*----------------------------------------------------------------------------*/ + +int main( int argc, char *argv[] ) +{ + int i, j, k; + char word[6000], outfname[6000], *infname=0; + time_t now; +/* + double L[25]; +*/ + printf("Form 8959, 2024 - v%3.2f\n", thisversion); + + /* Decode any command-line arguments. */ + i = 1; k=1; + while (i < argc) + { + if (strcmp(argv[i],"-verbose")==0) { verbose = 1; } + else + if (k==1) + { + infname = strdup(argv[i]); + infile = fopen(infname,"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", infname ); exit(1);} + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname,infname); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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 +#include +#include +#include +#include +#include "taxsolve_routines.c" + +#define SINGLE 1 +#define MARRIED_FILING_JOINTLY 2 +#define MARRIED_FILING_SEPARAT 3 +#define HEAD_OF_HOUSEHOLD 4 +#define WIDOW 5 +#define Yes 1 +#define No 0 + +/*----------------------------------------------------------------------------*/ + +int main( int argc, char *argv[] ) +{ + int i, j, k; + char word[6000], outfname[4000], *infname=0; + time_t now; + + double L4a = 0.0, L4b = 0.0, L4c = 0.0; + double L5a = 0.0, L5b = 0.0, L5c = 0.0, L5d = 0.0; + double L9a = 0.0, L9b = 0.0, L9c = 0.0, L9d = 0.0; + double L18a = 0.0, L18b = 0.0, L18c = 0.0; + double L19a = 0.0, L19b = 0.0, L19c = 0.0; + + int status, individual = No; + + printf("Form 8960, 2024 - v%3.2f\n", thisversion); + + /* Decode any command-line arguments. */ + i = 1; k=1; + while (i < argc) + { + if (strcmp(argv[i],"-verbose")==0) { verbose = 1; } + else + if (k==1) + { + infname = strdup(argv[i]); + infile = fopen(infname,"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", infname ); exit(1);} + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname,infname); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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 +#include +#include +#include +#include + +#include "taxsolve_routines.c" + +//====== Form 1040 Import ====== +// Imported form data; add elements as needed, using the same variable name as in the imported form label for clarity. +// Also update 'f1040_imp_defs' to add mapping. +typedef struct FED_1040_IMP_F8995_T { + double L11; + double L12; + double S1_3; + double S1_15; + double S1_16; + double S1_17; + char *Your1stName; + char *YourLastName; + char *YourSocSec; +} FED_1040_IMP_F8995, P_FED_1040_IMP_F8995; + +FED_1040_IMP_F8995 f1040i; + +// Mapping from label name to address of local data struct element; either double or char* +static FORM_IMPORT_DEF f1040_imp_defs[] = { + { "L11", &f1040i.L11, NULL }, + { "L12", &f1040i.L12, NULL }, + { "S1_3", &f1040i.S1_3, NULL }, + { "S1_15", &f1040i.S1_15, NULL }, + { "S1_16", &f1040i.S1_16, NULL }, + { "S1_17", &f1040i.S1_17, NULL }, + { "Your1stName:", NULL, &f1040i.Your1stName }, + { "YourLastName:", NULL, &f1040i.YourLastName }, + { "YourSocSec#:", NULL, &f1040i.YourSocSec } +}; + +int f1040_imp_defs_size = sizeof(f1040_imp_defs)/sizeof(FORM_IMPORT_DEF); + +//====== Schedule C Import ====== +typedef struct FED_SCH_C_IMP_F8995_T { + double L7; + double L31; +} FED_SCH_C_IMP_F8995_T, *P_FED_SCH_C_IMP_F8995; + +FED_SCH_C_IMP_F8995_T f_sch_c; + +// Mapping from label name to address of local data struct element; either double or char* +static FORM_IMPORT_DEF f_sch_c_imp_defs[] = { + { "L7", &f_sch_c.L7, NULL }, + { "L31", &f_sch_c.L31, NULL }, +}; + +int f_sch_c_imp_defs_size = sizeof(f_sch_c_imp_defs)/sizeof(FORM_IMPORT_DEF); + +/*----------------------------------------------------------------------------*/ + +int main( int argc, char *argv[] ) +{ + int i, j, k; + char word[6000], outfname[6000], *infname=0; + time_t now; + // Local line number variables for direct/indirect lines + + printf("Form 8995, 2024 - v%3.2f\n", thisversion); + + /* Decode any command-line arguments. */ + i = 1; k=1; + while (i < argc) + { + if (strcmp(argv[i],"-verbose")==0) { verbose = 1; } + else + if (k==1) + { + infname = strdup(argv[i]); + infile = fopen(infname,"r"); + if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", infname ); exit(1);} + k = 2; + /* Base name of output file on input file. */ + strcpy(outfname,infname); + j = strlen(outfname)-1; + while ((j>=0) && (outfname[j]!='.')) j--; + if (j<0) strcat(outfname,"_out.txt"); else strcpy(&(outfname[j]),"_out.txt"); + 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-c)", f1040i.S1_3 - f1040i.S1_26); + // showline_wlabel( "INFO: Form 1040 Line 11", f1040i.L11); + // showline_wlabel( "INFO: Form 1040 Line 12c", f1040i.L12); + // showline_wlabel( "INFO: Taxable Income Before QBI Deduction (this form L11)", f1040i.L11 - f1040i.L12); + + char * L1_row_names[] = { "i", "ii", "iii", "iv", "v" }; + char * L1_col_names[] = { "a", "b", "c" }; + + double L1[sizeof(L1_row_names)/sizeof(char *)][sizeof(L1_col_names)/sizeof(char *)]; + char L1_name[sizeof(L1_row_names)/sizeof(char *)][sizeof(L1_col_names)/sizeof(char *)][100]; + int row, col; + + // Set total income value to 0 + L[2] = 0.0; + for (row = 0; row < sizeof(L1_row_names)/sizeof(char *); ++row) { + double row_val; + char *row_name=""; + for (col = 0; col < sizeof(L1_col_names)/sizeof(char *); ++col) { + sprintf(L1_name[row][col], "L1_%s_%s%s", L1_row_names[row], L1_col_names[col], (col == 2) ? "" : ":"); + if (col == 0) { // Name business + row_name = GetTextLineF(L1_name[row][col]) ; + } else if (col == 1) { + GetTextLineF(L1_name[row][col]) ; + } else if (col == 2) { // qualified business income (loss) + GetLine(L1_name[row][col], &row_val ); + // If zero value was entered, and this row has a non-blank name, + // and both a 1040 and schedule C filename have been provided (auto_calc), calculate the total + if ((row_val == 0.0) && (strlen(row_name) > 0) && auto_calc) { + fprintf(outfile, "INFO: Auto calculating QBI profit/loss for L1_%s_%s\n", L1_row_names[row], L1_col_names[col]); + L1[row][2] = f_sch_c.L31 - (f1040i.S1_15 + f1040i.S1_16 + f1040i.S1_17); + fprintf(outfile, "INFO: L1_%s_%s = %6.2f = f_sch_c.L31 - (f1040i.S1_15 + f1040i.S1_16 + f1040i.S1_17) = " + "%6.2f - (%6.2f + %6.2f + %6.2f)\n", + L1_row_names[row], L1_col_names[col], + L1[row][2], f_sch_c.L31, f1040i.S1_15, f1040i.S1_16, f1040i.S1_17); + } else { + L1[row][2] = row_val; + } + showline_wlabelnz( L1_name[row][col], L1[row][2] ); + } + } + // Add to total income + L[2] += L1[row][2]; + } + + GetLine( "L3", &L[3] ); + GetLine( "L6", &L[6] ); + GetLine( "L7", &L[7] ); + + + // double L11_prelim; + // GetLine( "L11", &L11_prelim ); + // + // if ((L11_prelim == 0.0) && auto_calc) { + // fprintf(outfile, "INFO: Auto calculating QBI L11\n"); + // L[11] = f1040i.L11 - f1040i.L12; + // fprintf(outfile, "INFO: %6.2f = f1040i.L11 - f1040i.L12 = %6.2f - %6.2f\n", L[11], f1040i.L11, f1040i.L12); + // } else { + // L[11] = L11_prelim; + // } + + // Calculate line 11 from 1040 line 11 and line 12 values + L[11] = f1040i.L11 - f1040i.L12; + fprintf(outfile, "INFO: Line 11 = %6.2f = f1040i.L11 - f1040i.L12 = %6.2f - %6.2f\n", L[11], f1040i.L11, f1040i.L12); + + GetLine( "L12", &L[12] ); + + + double qbi_percentage = 0.20; // 20% /* Updated/checked for tax-year 2024. */ + + // Total qualified business income + L[4] = NotLessThanZero(L[2] + L[3]); + // Qualified business income component; mult by 20% + L[5] = L[4] * qbi_percentage; + // Total qualified REIT dividends and PTP income + L[8] = NotLessThanZero(L[6] + L[7]); + // REIT and PTP component + L[9] = L[8] * qbi_percentage; + + L[10] = L[5] + L[9]; + L[13] = NotLessThanZero( L[11] - L[12] ); + L[14] = L[13] * qbi_percentage; + L[15] = SmallerOf( L[10], L[14] ); + + L[16] = L[2] + L[3]; + if (L[16] > 0.0) + L[16] = 0.0; + + L[17] = L[6] + L[7]; + if (L[17] > 0.0) + L[17] = 0.0; + + showline( 2 ); + ShowLineNonZero( 3 ); + showline( 4 ); + showline( 5 ); + + ShowLineNonZero( 6 ); + ShowLineNonZero( 7 ); + showline ( 8 ); + showline ( 9 ); + + showline( 10 ); + showline( 11 ); + ShowLineNonZero( 12 ); + showline( 13 ); + showline( 14 ); + showline( 15 ); + ShowLineNonZero( 16 ); + ShowLineNonZero( 17 ); + + + + /* ----- .... Until here. ----- */ + + + /*** + Summary of useful functions: + GetLine( "label", &variable ) - Looks for "label" in input file, and places the corresponding sum of + values following that label (until ";") into variable. + GetLineF( "label", &variable ) - Like GetLine() above, but also writes the result to the output file. + GetLineFnz(( "label", &variable ) - Like GetLine(), but only writes non-zero values to the output file. + GetLine1( "label", &variable ) - Like GetLine() above, but expects single value (no sum, no ";" in input file). + + c = SmallerOf( a, b ); - Selects smaller of two values. + c = LargerOf( a, b ); - Selects larger of two values. + c = NotLessThanZero( a ); - Selects positive value or zero. Prevents negative values. + + showline( j ) - Writes currency value of L[j] to output file with label in nice format. + shownum( j ) - Writes integer value of L[j] to output file with label in nice format. + showline_wmsg( j, "msg" ) - Like showline, but adds the provided message to the output line. + ShowLineNonZero( j ) - Like showline, but only writes non-zero values. + ShowLineNonZero_wMsg( j, "msg" ) - Like showline_wmsg, but only writes non-zero values. + showline_wlabel( "label", value ) - For custom line names and variables not in the default L[] array. + showline_wlabelnz( "label", value ) - Like showline_wlabel, but only writes non-zero values. + showline_wlabelmsg( "label", value, "msg" ) - Like showline_wlabel,but adds the provided message to the output line. + + ***/ + + fclose(infile); + grab_any_pdf_markups( infname, outfile ); + fclose(outfile); + + printf("\nListing results from file: %s\n\n", outfname); + Display_File( outfname ); + + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_get_fed_return_data.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_get_fed_return_data.c new file mode 100755 index 0000000..aa06d81 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_get_fed_return_data.c @@ -0,0 +1,553 @@ +/************************************************************************/ +/* taxsolve_get_fed_return_data.c */ +/* Copyright (C) 2023 - Aston Roberts */ +/* */ +/* (Abstracted from taxsolve_CA_540_2023.c by E. Strnod for */ +/* use in AZ and potentially other State tax solvers. */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ +/* */ +/* Aston Roberts 1-2-2024 aston_roberts@yahoo.com */ +/* Ellen Strnod 9/14/2024 */ +/************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include "taxsolve_routines.c" + +#define SINGLE 1 +#define MARRIED_FILING_JOINTLY 2 +#define MARRIED_FILING_SEPARAT 3 +#define HEAD_OF_HOUSEHOLD 4 +#define WIDOW 5 + +int status=0; /* Value for filing status. */ +char *Your1stName="", *YourLastName="", *your_socsec="", + *Spouse1stName="", *SpouseLastName="", *spouse_socsec="", + *street_address="", *apartment="", *town="", *state="", *zipcode=""; + +struct FedReturnData + { + double fedline[MAX_LINES], schedA[MAX_LINES], + fed_L1a, fed_L1b, fed_L1c, fed_L1d, fed_L1e, fed_L1f, fed_L1g, fed_L1h, fed_L1z, + fed_L2a, fed_L3a, + fed_L4a, fed_L4b, fed_L5a, fed_L5b, fed_L6a, fed_L6b, + schedA5a, schedA5b, schedA5c, schedA5, + schedA8a, schedA8b, schedA8c, schedA8d, + sched1[MAX_LINES], s1_8[30], s1_24[30], s2_17[30], s3_6[30], s3_13[30], + fedl8b, fedl9b, fedl15a, fedl16a, fedl20a; + int Exception, Itemized, Over65, SpouseOver65, Blind, SpouseBlind; + char AlimRecipSSN[512], *AlimRecipName, OtherIncomeType[512], + OtherAdjustmentsType[512], OtherTaxesType[512], + Dep1stName[10][512], DepLastName[10][512], + DepSocSec[10][512], DepRelation[10][512]; + } PrelimFedReturn; + + void convert_slashes( char *fname ) + { /* Convert slashes in file name based on machine type. */ + char *ptr; + #ifdef __MINGW32__ + char slash_sreach='/', slash_replace='\\'; + #else + char slash_sreach='\\', slash_replace='/'; + #endif + ptr = strchr( fname, slash_sreach ); + while (ptr) + { + ptr[0] = slash_replace; + ptr = strchr( fname, slash_sreach ); + } + } + + void grab_line_value( char *label, char *fline, double *value ) + { + char twrd[2048]; + next_word(fline, twrd, " \t=;"); + if ((twrd[0] != '\0') && (sscanf(twrd,"%lf", value) != 1)) + { + printf("Error: Reading Fed %s '%s%s'\n", label, twrd, fline); + fprintf(outfile,"Error: Reading Fed %s '%s%s'\n", label, twrd, fline); + } + } + + void grab_line_string( char *fline, char *strng ) + { /* Grab a string and copy it into pre-allocated character array. */ + char twrd[2048]; + strng[0] = '\0'; + do + { + next_word(fline, twrd, " \t=" ); + if (twrd[0] != ';') + { strcat( strng, twrd ); strcat( strng, " " ); } + } + while ((fline[0] != '\0') && (strstr( twrd, ";" ) == 0)); + } + + + void grab_line_alloc( char *fline, char **strng ) + { /* Grab a string and allocate space for it. */ + char twrd[4096]; + grab_line_string( fline, twrd ); + if (twrd[0] != '\0') + *strng = strdup( twrd ); + } + + int ImportFederalReturnData( char *fedlogfile, struct FedReturnData *fed_data ) + { + FILE *infile; + char fline[2000], word[2000], tword[2000]; + int linenum, j; + + for (linenum=0; linenumfedline[linenum] = 0.0; + fed_data->schedA[linenum] = 0.0; + fed_data->sched1[linenum] = 0.0; + } + fed_data->fed_L1a = 0; + fed_data->fed_L1b = 0; + fed_data->fed_L1c = 0; + fed_data->fed_L1d = 0; + fed_data->fed_L1e = 0; + fed_data->fed_L1f = 0; + fed_data->fed_L1g = 0; + fed_data->fed_L1h = 0; + fed_data->fed_L1z = 0; + fed_data->fed_L2a = 0; + fed_data->fed_L3a = 0; + fed_data->fed_L4a = 0; + fed_data->fed_L4b = 0; + fed_data->fed_L5a = 0; + fed_data->fed_L5b = 0; + fed_data->fed_L6a = 0; + fed_data->fed_L6b = 0; + fed_data->schedA5a = 0.0; + fed_data->schedA5b = 0.0; + fed_data->schedA5c = 0.0; + fed_data->schedA8a = 0.0; + fed_data->schedA8b = 0.0; + fed_data->schedA8c = 0.0; + fed_data->schedA8d = 0.0; + + fed_data->fedl8b = 0.0; + fed_data->fedl9b = 0.0; + fed_data->fedl15a = 0.0; + fed_data->fedl16a = 0.0; + fed_data->fedl20a = 0.0; + for (j=0; j < 30; j++) + { + fed_data->s1_8[j] = 0.0; + fed_data->s1_24[j] = 0.0; + fed_data->s2_17[j] = 0.0; + fed_data->s3_6[j] = 0.0; + fed_data->s3_13[j] = 0.0; + } + strcpy( fed_data->AlimRecipSSN, "" ); + fed_data->AlimRecipName = strdup( "" ); + strcpy( fed_data->OtherIncomeType, "" ); + strcpy( fed_data->OtherAdjustmentsType, "" ); + strcpy( fed_data->OtherTaxesType, "" ); + for (j=0; j < 5; j++) + { + strcpy( fed_data->Dep1stName[j], "" ); + strcpy( fed_data->DepLastName[j], "" ); + strcpy( fed_data->DepSocSec[j], "" ); + strcpy( fed_data->DepRelation[j], "" ); + } + convert_slashes( fedlogfile ); + infile = fopen(fedlogfile, "r"); + if (infile==0) + { + printf("Error: Could not open Federal return '%s'\n", fedlogfile); + fprintf(outfile,"Error: Could not open Federal return '%s'\n", fedlogfile); + exit( 1 ); + } + fed_data->Itemized = 1; /* Set initial default values. */ + read_line(infile,fline); linenum = 0; + while (!feof(infile)) + { + if (strstr(fline, "CkYouOver65")!=0) fed_data->Over65 = 1; + if (strstr(fline, "CkSpouseOver65")!=0) fed_data->SpouseOver65 = 1; + if (strstr(fline, "CkYouBlind")!=0) fed_data->Blind = 1; + if (strstr(fline, "CkSpouseBlind")!=0) fed_data->SpouseBlind = 1; + if (strstr(fline,"Use standard deduction.")!=0) fed_data->Itemized = 0; + next_word(fline, word, " \t="); + if ((word[0] == 'L') && (strstr(fline," = ")!=0)) + { /*L*/ + if (strcmp(word,"L1a") == 0) + grab_line_value( word, fline, &(fed_data->fed_L1a) ); + else + if (strcmp(word,"L1b") == 0) + grab_line_value( word, fline, &(fed_data->fed_L1b) ); + else + if (strcmp(word,"L1c") == 0) + grab_line_value( word, fline, &(fed_data->fed_L1c) ); + else + if (strcmp(word,"L1d") == 0) + grab_line_value( word, fline, &(fed_data->fed_L1d) ); + else + if (strcmp(word,"L1e") == 0) + grab_line_value( word, fline, &(fed_data->fed_L1e) ); + else + if (strcmp(word,"L1f") == 0) + grab_line_value( word, fline, &(fed_data->fed_L1f) ); + else + if (strcmp(word,"L1g") == 0) + grab_line_value( word, fline, &(fed_data->fed_L1g) ); + else + if (strcmp(word,"L1h") == 0) + grab_line_value( word, fline, &(fed_data->fed_L1h) ); + else + if (strcmp(word,"L1z") == 0) + grab_line_value( word, fline, &(fed_data->fed_L1z) ); + else + if (strcmp(word,"L2a") == 0) + grab_line_value( word, fline, &(fed_data->fed_L2a) ); + else + if (strcmp(word,"L3a") == 0) + grab_line_value( word, fline, &(fed_data->fed_L3a) ); + else + if (strcmp(word,"L4a") == 0) + grab_line_value( word, fline, &(fed_data->fed_L4a) ); + else + if (strcmp(word,"L4b") == 0) + grab_line_value( word, fline, &(fed_data->fed_L4b) ); + else + if (strcmp(word,"L5a") == 0) + grab_line_value( word, fline, &(fed_data->fed_L5a) ); + else + if (strcmp(word,"L5b") == 0) + grab_line_value( word, fline, &(fed_data->fed_L5b) ); + else + if (strcmp(word,"L6a") == 0) + grab_line_value( word, fline, &(fed_data->fed_L6a) ); + else + if (strcmp(word,"L6b") == 0) + grab_line_value( word, fline, &(fed_data->fed_L6b) ); + else + if (strcmp(word,"L8a") == 0) + grab_line_value( word, fline, &(fed_data->fedline[8]) ); + else + if (strcmp(word,"L8b") == 0) + grab_line_value( word, fline, &(fed_data->fedl8b) ); + else + if (strcmp(word,"L9a") == 0) + grab_line_value( word, fline, &(fed_data->fedline[9]) ); + else + if (strcmp(word,"L9b") == 0) + grab_line_value( word, fline, &(fed_data->fedl9b) ); + else + if (strcmp(word,"L15a") == 0) + grab_line_value( word, fline, &(fed_data->fedl15a) ); + else + if (strcmp(word,"L15b") == 0) + grab_line_value( word, fline, &(fed_data->fedline[15]) ); + else + if (strcmp(word,"L16a") == 0) + grab_line_value( word, fline, &(fed_data->fedl16a) ); + else + if (strcmp(word,"L16b") == 0) + grab_line_value( word, fline, &(fed_data->fedline[16]) ); + else + if (strcmp(word,"L20a") == 0) + grab_line_value( word, fline, &(fed_data->fedl20a) ); + else + if (strcmp(word,"L20b") == 0) + grab_line_value( word, fline, &(fed_data->fedline[20]) ); + else + { + if (sscanf(&word[1],"%d",&linenum)!=1) + { + printf("Error: Reading Fed line number '%s%s'\n",word,fline); + fprintf(outfile,"Error: Reading Fed line number '%s%s'\n",word,fline); + } + next_word(fline, word, " \t="); + if (sscanf(word,"%lf", &fed_data->fedline[linenum])!=1) + { + printf("Error: Reading Fed line %d '%s%s'\n",linenum,word,fline); + fprintf(outfile,"Error: Reading Fed line %d '%s%s'\n",linenum,word,fline); + } + if (verbose) printf("FedLin[%d] = %2.2f\n", linenum, fed_data->fedline[linenum]); + } + } /*L*/ + else + + if (strcmp(word, "Your1stName:" ) == 0) + grab_line_alloc( fline, &Your1stName ); + else + if (strcmp(word, "YourLastName:" ) == 0) + grab_line_alloc( fline, &YourLastName ); + else + if (strcmp(word, "YourSocSec#:" ) == 0) + grab_line_alloc( fline, &your_socsec ); + else + if (strcmp(word, "Spouse1stName:" ) == 0) + grab_line_alloc( fline, &Spouse1stName ); + else + if (strcmp(word, "SpouseLastName:" ) == 0) + grab_line_alloc( fline, &SpouseLastName ); + else + if (strcmp(word, "SpouseSocSec#:" ) == 0) + grab_line_alloc( fline, &spouse_socsec ); + else + if (strcmp(word, "Number&Street:" ) == 0) + grab_line_alloc( fline, &street_address ); + else + if (strcmp(word, "Apt#:" ) == 0) + grab_line_alloc( fline, &apartment ); + else + if (strcmp(word, "Town/City:" ) == 0) + grab_line_alloc( fline, &town ); + else + if (strcmp(word, "State:" ) == 0) + grab_line_alloc( fline, &state ); + else + if (strcmp(word, "ZipCode:" ) == 0) + grab_line_alloc( fline, &zipcode ); + else + + if (strncmp(word, "AlimRecipSSN", 12) == 0) + grab_line_string( fline, fed_data->AlimRecipSSN ); + else + if (strcmp( word, "S1_8z_Type:" ) == 0) + grab_line_string( fline, fed_data->OtherIncomeType ); + else + if (strcmp( word, "S1_24z_Type:" ) == 0) + grab_line_string( fline, fed_data->OtherAdjustmentsType ); + else + if (strcmp( word, "S2_17z_Type:" ) == 0) + grab_line_string( fline, fed_data->OtherTaxesType ); + else + + if (strcmp(word, "Dep1_FirstName:") == 0) + grab_line_string( fline, fed_data->Dep1stName[1] ); + else + if (strcmp(word, "Dep1_LastName:") == 0) + grab_line_string( fline, fed_data->DepLastName[1] ); + else + if (strcmp(word, "Dep1_SocSec#:") == 0) + grab_line_string( fline, fed_data->DepSocSec[1] ); + else + if (strcmp(word, "Dep1_Relation:") == 0) + grab_line_string( fline, fed_data->DepRelation[1] ); + else + + if (strcmp(word, "Dep2_FirstName:") == 0) + grab_line_string( fline, fed_data->Dep1stName[2] ); + else + if (strcmp(word, "Dep2_LastName:") == 0) + grab_line_string( fline, fed_data->DepLastName[2] ); + else + if (strcmp(word, "Dep2_SocSec#:") == 0) + grab_line_string( fline, fed_data->DepSocSec[2] ); + else + if (strcmp(word, "Dep2_Relation:") == 0) + grab_line_string( fline, fed_data->DepRelation[2] ); + else + + if (strcmp(word, "Dep3_FirstName:") == 0) + grab_line_string( fline, fed_data->Dep1stName[3] ); + else + if (strcmp(word, "Dep3_LastName:") == 0) + grab_line_string( fline, fed_data->DepLastName[3] ); + else + if (strcmp(word, "Dep3_SocSec#:") == 0) + grab_line_string( fline, fed_data->DepSocSec[3] ); + else + if (strcmp(word, "Dep3_Relation:") == 0) + grab_line_string( fline, fed_data->DepRelation[3] ); + else + + if ((word[0] == 'A') && (strstr(word,"AMT")!=word) && (strstr(fline," = ")!=0)) + { + if (strcmp(word,"A5a") == 0) + grab_line_value( word, fline, &(fed_data->schedA5a) ); + else + if (strcmp(word,"A5b") == 0) + grab_line_value( word, fline, &(fed_data->schedA5b) ); + else + if (strcmp(word,"A5c") == 0) + grab_line_value( word, fline, &(fed_data->schedA5c) ); + else + if (strcmp(word,"A8a") == 0) + grab_line_value( word, fline, &(fed_data->schedA8a) ); + else + if (strcmp(word,"A8b") == 0) + grab_line_value( word, fline, &(fed_data->schedA8b) ); + else + if (strcmp(word,"A8c") == 0) + grab_line_value( word, fline, &(fed_data->schedA8c) ); + else + if (strcmp(word,"A8d") == 0) + grab_line_value( word, fline, &(fed_data->schedA8d) ); + else + { + if (sscanf(&word[1],"%d",&linenum)!=1) + { + printf("Error: Reading Fed line number '%s%s'\n",word,fline); + fprintf(outfile,"Error: Reading Fed line number '%s%s'\n",word,fline); + } + next_word(fline, word, " \t="); + if (sscanf(word,"%lf", &fed_data->schedA[linenum])!=1) + { + printf("Error: Reading Fed schedA %d '%s%s'\n",linenum,word,fline); + fprintf(outfile, "Error: Reading Fed schedA %d '%s%s'\n",linenum,word,fline); + } + if (verbose) printf("FedLin.A[%d] = %2.2f\n", linenum, fed_data->schedA[linenum]); + } + } + else + if ((strncmp( word, "S1_", 3 ) == 0) && (strstr(fline," = ")!=0)) + { + next_word( &(word[3]), tword, " \t: =" ); + if ((tword[0] == '8') && (tword[1] >= 'a') && (tword[1] <= 'z')) + { int j; + if ((tword[1] >= 'a') && (tword[1] <= 'z')) + { + j = tword[1] - 'a'; + next_word(fline, word, " \t="); + if (sscanf( word, "%lf", &fed_data->s1_8[j] ) != 1) + { + printf("Error: Reading Fed s1_8%c '%s%s'\n", 'a' + j, word, fline); + fprintf(outfile, "Error: Reading Fed s1_8%c '%s%s'\n", 'a' + j, word, fline); + } + if (verbose) printf("FedLin.S1_8%c] = %2.2f\n", 'a' + j, fed_data->s1_8[j] ); + } + else + printf("Error: Unexpected line '%s'\n", word ); + } + else + if ((strncmp( tword, "24", 2 ) == 0) && (tword[2] >= 'a') && (tword[2] <= 'z')) + { int j; + if ((tword[2] >= 'a') && (tword[2] <= 'z')) + { + j = tword[2] - 'a'; + next_word(fline, word, " \t="); + if (sscanf( word, "%lf", &fed_data->s1_24[j] ) != 1) + { + printf("Error: Reading Fed s1_24%c '%s%s'\n", 'a' + j, word, fline); + fprintf(outfile, "Error: Reading Fed s1_24%c '%s%s'\n", 'a' + j, word, fline); + } + if (verbose) printf("FedLin.S1_24%c = %2.2f\n", 'a' + j, fed_data->s1_24[j] ); + } + else + printf("Error: Unexpected line '%s'\n", word ); + } + else + { + if (sscanf( tword, "%d", &linenum ) != 1) + { + printf("Error: Reading Fed line number 'S1_%s %s'\n", tword, fline); + fprintf(outfile,"Error: Reading Fed line number 'S1_%s %s'\n", tword, fline); + } + next_word(fline, word, " \t="); + if (sscanf(word,"%lf", &fed_data->sched1[linenum])!=1) + { + printf("Error: Reading Fed sched1 %d '%s%s'\n", linenum, word, fline); + fprintf(outfile, "Error: Reading Fed sched1 %d '%s%s'\n", linenum, word, fline); + } + if (verbose) printf("FedLin.S1[%d] = %2.2f\n", linenum, fed_data->sched1[linenum]); + } + } + else + + if ((strncmp( word, "S2_", 3 ) == 0) && (strstr(fline," = ")!=0)) + { + next_word( &(word[3]), tword, " \t: =" ); + if ((strncmp( tword, "17", 2 ) == 0) && (tword[2] >= 'a') && (tword[2] <= 'z')) + { int j; + if ((tword[2] >= 'a') && (tword[2] <= 'z')) + { + j = tword[2] - 'a'; + next_word(fline, word, " \t="); + if (sscanf( word, "%lf", &fed_data->s2_17[j] ) != 1) + { + printf("Error: Reading Fed s2_17%c '%s%s'\n", 'a' + j, word, fline); + fprintf(outfile, "Error: Reading Fed s2_17%c '%s%s'\n", 'a' + j, word, fline); + } + if (verbose) printf("FedLin.S2_17%c = %2.2f\n", 'a' + j, fed_data->s2_17[j] ); + } + else + printf("Error: Unexpected line '%s'\n", word ); + } + } + else + + if ((strncmp( word, "S3_", 3 ) == 0) && (strstr(fline," = ")!=0)) + { + next_word( &(word[3]), tword, " \t: =" ); + if ((strncmp( tword, "6", 1 ) == 0) && (tword[1] >= 'a') && (tword[1] <= 'z')) + { int j; + if ((tword[1] >= 'a') && (tword[1] <= 'z')) + { + j = tword[1] - 'a'; + next_word(fline, word, " \t="); + if (sscanf( word, "%lf", &fed_data->s3_6[j] ) != 1) + { + printf("Error: Reading Fed s3_6%c '%s%s'\n", 'a' + j, word, fline); + fprintf(outfile, "Error: Reading Fed s3_6%c '%s%s'\n", 'a' + j, word, fline); + } + if (verbose) printf("FedLin.S3_6%c = %2.2f\n", 'a' + j, fed_data->s3_6[j] ); + } + else + printf("Error: Unexpected line '%s'\n", word ); + } + else + if ((strncmp( tword, "13", 2 ) == 0) && (tword[2] >= 'a') && (tword[2] <= 'z')) + { int j; + if ((tword[2] >= 'a') && (tword[2] <= 'z')) + { + j = tword[2] - 'a'; + next_word(fline, word, " \t="); + if (sscanf( word, "%lf", &fed_data->s3_13[j] ) != 1) + { + printf("Error: Reading Fed s3_13%c '%s%s'\n", 'a' + j, word, fline); + fprintf(outfile, "Error: Reading Fed s3_13%c '%s%s'\n", 'a' + j, word, fline); + } + if (verbose) printf("FedLin.S3_13%c = %2.2f\n", 'a' + j, fed_data->s3_13[j] ); + } + else + printf("Error: Unexpected line '%s'\n", word ); + } + } + + else + if (strcmp(word,"Status") == 0) + { + next_word(fline, word, " \t="); + if (strncasecmp(word,"Single",4)==0) status = SINGLE; else + if (strncasecmp(word,"Married/Joint",13)==0) status = MARRIED_FILING_JOINTLY; else + if (strncasecmp(word,"Married/Sep",11)==0) status = MARRIED_FILING_SEPARAT; else + if (strncasecmp(word,"Head_of_House",4)==0) status = HEAD_OF_HOUSEHOLD; else + if (strncasecmp(word,"Widow",4)==0) status = WIDOW; + else + { + printf("Error: unrecognized status '%s'. Exiting.\n", word); + fprintf(outfile,"Error: unrecognized status '%s'. Exiting.\n", word); + return 0; + } + } + read_line(infile,fline); + } + fclose(infile); + return 1; + } diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_routines.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_routines.c new file mode 100755 index 0000000..acd896f --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/taxsolve_routines.c @@ -0,0 +1,1418 @@ +/************************************************************************/ +/* TaxSolve_Routines.c - General purpose reusable routines for making */ +/* tax programs. These routines are not specific to any particular */ +/* tax form or country. This file is usually compiled-with, linked- */ +/* with, or included-in a form-specific program. */ +/* */ +/* Copyright (C) 2003-2024 - Aston Roberts */ +/* */ +/* GNU Public License - GPL: */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU General Public License as */ +/* published by the Free Software Foundation; either version 2 of the */ +/* License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ +/* */ +/* Aston Roberts 1-1-2024 aston_roberts@yahoo.com */ +/************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#define MAX_LINES 1000 + +double L[MAX_LINES]; /* Declare the Line entry variables. */ +char errmsg[15000]; + +FILE *infile=0, /* Main input file to be used for reading tax input data. */ + *outfile=0; /* Main output file. */ +int verbose=0; /* Declare and set the "verbosity" flag. */ +int notappvalue=0; +int single_line_entry=0; +int whole_line_entry=0; +int round_to_whole_dollars=0; /* Option to use whole-dollars. */ +int value_was_detected=0; + +struct date_rec /* Used by get_gain_and_losses and gen_date_rec */ +{ + int month; + int day; + int year; +}; + + +/********************************************************************************/ +/* Input routines. */ +/********************************************************************************/ + +void show_errmsg( char *emsg ) +{ + printf("%s\n", emsg ); + if (outfile != 0) + fprintf(outfile,"%s\n", emsg ); +} + +int Round( double x ) +{ int y; if (x<0.0) y = x - 0.5; else y = x + 0.5; return y; } + + +double Conditional_Round( double x ) +{ /* Round only if round_to_whole_dollars flag is set. */ + if (!round_to_whole_dollars) + return x; + else + return Round( x ); +} + + +void intercept_any_pragmas( FILE *infile, char *word ); /* Prototype. */ +void consume_leading_trailing_whitespace( char *line ); + + +/*------------------------------------------------------------------------------*/ +/* Get_Word - Read next word from input file, while ignoring any comments. */ +/*------------------------------------------------------------------------------*/ +void get_word( FILE *infile, char *word ) /* Absorb comments. */ +{ + int j=0; + char ltc='\n'; /* Line termination character. */ + char spc=' '; + + if (single_line_entry) + ltc = ' '; + if (whole_line_entry) + spc='\n'; + do + { /*Absorb any leading white-space.*/ + word[j]=getc(infile); + if (word[j]=='{') + { + do word[j]=getc(infile); while ((word[j]!='}') && (!feof(infile))); + word[j]=getc(infile); + } + } + while ((!feof(infile)) && ((word[j]==' ') || (word[j]=='\t') || (word[j]==ltc) || (word[j]=='\r'))); + if (word[j]=='$') + word[j] = getc(infile); + if (word[j]==';') + j++; + else + if (word[j]=='\n') + word[j] = '\0'; /* Terminate empty single-line entries. */ + else + if (word[j]=='"') + { /* Get quoted string. */ + j = 0; + do + word[j++] = getc(infile); + while ((word[j-1] != '"') && (!feof(infile))); + if (word[j-1] == '"') j--; /* Remove trailing quote. */ + } + else + { /* Normal case. */ + do { /*Get word until white-space or ;.*/ + j++; word[j] = getc(infile); + if (word[j]=='{') + { + do { word[j] = getc(infile); } + while ((!feof(infile)) && (word[j] != '}')); + word[j] = ' '; + } + if (word[j]==',') word[j] = getc(infile); + } + while ((!feof(infile)) && ((word[j]!=spc) && (word[j]!='\t') && (word[j]!='\n') && (word[j] !='\r') && (word[j]!=';'))); + if (word[j]==';') ungetc(word[j],infile); + } + word[j] = '\0'; /* Add termination character. */ + if (verbose) printf("Read: '%s'\n", word); + intercept_any_pragmas( infile, word ); /* Intercept any pragmas. */ +} + + +#ifdef microsoft /* Apparently Microsoft doesn't know of strcasecmp(), define one. */ +int strcasecmp( char *str1, char *str2 ) +{ + char *tstr1, *tstr2; int i=0; + tstr1 = (char *)malloc(strlen(str1+1)*sizeof(char)); + do { tstr1[i] = toupper(str1[i]); i++; } while (str1[i-1]!='\0'); + tstr2 = (char *)malloc(strlen(str2+1)*sizeof(char)); + i = 0; + do { tstr2[i] = toupper(str2[i]); i++; } while (str2[i-1]!='\0'); + i = strcmp(tstr1,tstr2); + free(tstr1); free(tstr2); + return i; +} +int strncasecmp( char *str1, char *str2, int len ) +{ + char *tstr1, *tstr2; int i=0; + tstr1 = (char *)malloc(strlen(str1+1)*sizeof(char)); + do { tstr1[i] = toupper(str1[i]); i++; } while ((str1[i-1]!='\0') && (i= '0') && (word[j] <= '9')) + state = 2; + else + return 0; + break; + case 1: if ((word[j] >= '0') && (word[j] <= '9')) + state = 2; + else + return 0; + break; + case 2: if ((word[j] >= '0') && (word[j] <= '9')) + state = 2; + else + if (word[j] == '.') + state = 3; + else + return 0; + break; + case 3: return 0; + break; + default: return 0; + } + j++; + } + if (j != 0) + return 1; + else + return 0; +} + + +int valid_float( char *word ) /* Check for a valid decimal value in string, and nothing else following it. */ +{ /* Returns 1 if valid, 0 if invalid. */ + int j=0, state=0; + while (word[j] != '\0') + { + switch( state ) + { + case 0: if ((word[j] == '-') || (word[j] == '+')) + state = 1; + else + if ((word[j] >= '0') && (word[j] <= '9')) + state = 2; + else + if (word[j] == '.') + state = 3; + else + return 0; + break; + case 1: if ((word[j] >= '0') && (word[j] <= '9')) + state = 2; + else + return 0; + break; + case 2: if ((word[j] >= '0') && (word[j] <= '9')) + state = 2; + else + if (word[j] == '.') + state = 3; + else + if ((word[j] == 'e') || (word[j] == 'E')) + state = 4; + else + return 0; + break; + case 3: if ((word[j] >= '0') && (word[j] <= '9')) + state = 3; + else + if ((word[j] == 'e') || (word[j] == 'E')) + state = 4; + else + return 0; + break; + case 4: if ((word[j] >= '0') && (word[j] <= '9')) + state = 5; + else + if ((word[j] == '-') || (word[j] == '+')) + state = 5; + else + return 0; + break; + case 5: if ((word[j] >= '0') && (word[j] <= '9')) + state = 5; + else + return 0; + break; + default: return 0; + } + j++; + } + if (j != 0) + return 1; + else + return 0; +} + + +/*------------------------------------------------------------------------------*/ +/* Get Parameter - Get a single value. */ +/* Expect value kinds: 'i'=integer, 'f'=float, 's'=string, 'b'=boolean. */ +/*------------------------------------------------------------------------------*/ +void get_parameter( FILE *infile, char kind, void *x, char *emssg ) +{ + char word[4096], *owrd; + int i, *ii; + double y, *yy; + + if (kind=='w') + { single_line_entry = 1; whole_line_entry = 1; } + value_was_detected = 0; + + get_word(infile, word); + + if (feof(infile)) + { + printf("ERROR: Unexpected EOF on '%s'\n",emssg); + if (outfile) fprintf(outfile,"ERROR: Unexpected EOF on '%s'\n",emssg); + exit(1); + } + if (word[0] != '\0') + value_was_detected = 1; + if (kind=='i') + { + if ((!valid_int(word)) || (sscanf(word,"%d",&i)!=1)) + {printf("ERROR: Bad integer '%s', reading %s.\n", word, emssg); fprintf(outfile,"ERROR: Bad integer '%s', reading %s.\n", word, emssg); exit(1); } + ii = (int *)x; + *ii = i; + } + else + if (kind=='f') + { + if ((!valid_float(word)) || (sscanf(word,"%lf",&y)!=1)) + {printf("ERROR: Bad float '%s', reading %s.\n", word, emssg); fprintf(outfile,"ERROR: Bad float '%s', reading %s.\n", word, emssg); exit(1); } + if (round_to_whole_dollars) + y = Round( y ); + yy = (double *)x; + *yy = y; + } + else + if (kind=='s') + { + owrd = (char *)x; + strcpy( owrd, word ); + if (emssg[0]!='\0') + { if (strcmp(word,emssg)!=0) + {printf("ERROR1: Found '%s' when expecting '%s'\n", word, emssg); fprintf(outfile,"ERROR1: Found '%s' when expecting '%s'\n", word, emssg); exit(1); } + } + } + else + if (kind=='w') + { + owrd = (char *)x; + owrd[0] = '\0'; + strcat( owrd, word ); + strcat( owrd, " " ); + single_line_entry = 0; + whole_line_entry = 0; + } + else + if (kind=='l') /* Literal string. Do not check for match. */ + { + owrd = (char *)x; + strcpy( owrd, word ); + } + else + if (kind=='b') + { + if (strcasecmp(word,"y") == 0) i = 1; else if (strcasecmp(word,"n") == 0) i = 0; + else + if ((strcasecmp(word,"TRUE")==0) || (strcasecmp(word,"YES")==0) || (strcasecmp(word,"Y")==0) || (strcmp(word,"1")==0)) + i = 1; + else + if ((strcasecmp(word,"FALSE")==0) || (strcasecmp(word,"NO")==0) || (strcasecmp(word,"N")==0) || (strcmp(word,"0")==0)) + i = 0; + else if (strcasecmp(word,"N/A")==0) i = notappvalue; + else if ((single_line_entry) && (strlen( word ) == 0)) i = notappvalue; + else {printf("ERROR1: Bad boolean '%s', reading %s.\n", word, emssg); fprintf(outfile,"ERROR: Bad boolean '%s', reading %s.\n", word, emssg); exit(1);} + ii = (int *)x; + *ii = i; + } + else + {printf("ERROR: Unknown type '%c'\n", kind); fprintf(outfile,"ERROR: Unknown type '%c'\n", kind); exit(1);} +} + + +void get_param_single_line( FILE *infile, char kind, void *x, char *emssg ) +{ + single_line_entry = 1; + get_parameter( infile, kind, x, emssg ); + single_line_entry = 0; +} + + + +/*------------------------------------------------------------------------------*/ +/* Get Parameters - Get sum of list of values terminated by ";". */ +/* Expect value kinds: 'i'=integer, 'f'=float, 's'=string, 'b'=boolean. */ +/*------------------------------------------------------------------------------*/ +void get_parameters( FILE *infile, char kind, void *x, char *emssg ) +{ + char word[2048], *owrd=0; + int j, *ii; + double y, *yy; + + if (kind == 'f') { yy = (double *)x; *yy = 0.0; } + else + if (kind == 'w') { owrd = (char *)x; owrd[0] = '\0'; } + value_was_detected = 0; + + get_word(infile,word); + while (word[0] != ';') + { + if (feof(infile)) + {printf("ERROR: Unexpected EOF on '%s'\n",emssg); fprintf(outfile,"ERROR: Unexpected EOF on '%s'\n",emssg); exit(1);} + if (kind=='i') + { + if ((!valid_int(word)) || (sscanf(word,"%d",&j)!=1)) + {printf("ERROR: Bad integer '%s', reading %s.\n", word, emssg); fprintf(outfile,"ERROR: Bad integer '%s', reading %s.\n", word, emssg); exit(1); } + ii = (int *)x; + *ii = j; + } + else + if (kind=='f') + { + if ((!valid_float(word)) || ((sscanf(word,"%lf",&y))!=1)) + {printf("ERROR: Bad float '%s', reading %s.\n", word, emssg); fprintf(outfile,"ERROR: Bad float '%s', reading %s.\n", word, emssg); exit(1); } + if (round_to_whole_dollars) + y = Round( y ); + yy = (double *)x; + *yy = *yy + y; + /* printf(" + %f = %f\n", y, *yy); */ + } + else + if (kind=='s') + { + owrd = (char *)x; + strcpy( owrd, word ); + if (emssg[0]!='\0') + { if (strcmp(word,emssg)!=0) + {printf("ERROR2: Found '%s' when expecting '%s'\n", word, emssg); fprintf(outfile,"ERROR2: Found '%s' when expecting '%s'\n", word, emssg); exit(1); } + } + } + else + if (kind=='w') + { + strcat( owrd, word ); + strcat( owrd, " " ); + } + else + if (kind=='b') + { + if ((strcasecmp(word,"TRUE")==0) || (strcasecmp(word,"YES")==0) || (strcasecmp(word,"Y")==0) || (strcmp(word,"1")==0)) + j = 1; + else + if ((strcasecmp(word,"FALSE")==0) || (strcasecmp(word,"NO")==0) || (strcasecmp(word,"N")==0) || (strcmp(word,"0")==0)) + j = 0; + else + if (strcasecmp(word,"n/a")==0) + { + get_word(infile,word); + ii = (int *)x; + *ii = notappvalue; + return; + } + else + {printf("ERROR2: Bad boolean '%s', reading %s.\n", word, emssg); + fprintf(outfile,"ERROR: Bad boolean '%s', reading %s.\n", word, emssg); + exit(1); + } + ii = (int *)x; + *ii = j; + } + else + {printf("ERROR: Unknown type '%c'\n", kind); fprintf(outfile,"ERROR: Unknown type '%c'\n", kind); exit(1);} + value_was_detected++; + get_word(infile,word); + } +} + + + + +/*....................................................................... + . NEXT_WORD - accepts a line of text, and returns with the . + . next word in that text in the third parameter, the original line . + . is shortened from the beginning so that the word is removed. . + . If the line encountered is empty, then the word returned will be . + . empty. . + . NEXTWORD can parse on an arbitrary number of delimiters, and it . + . returns everthing that was cut away in the second parameter. . + . Parameters: . + . line - input character string, on output shortened by word. . + . word - output of this routine, single word, without delimiters. . + . delim - list of delimiters, whitepace chars, etc.. . + .......................................................................*/ +void next_word( char *line, char *word, char *delim ) +{ + int i=0, j=0, m=0, flag=1; + + /* Eat away preceding garbage */ + while ((line[i] !='\0') && (flag)) + { + j = 0; + while ((delim[j] != '\0') && (line[i] != delim[j])) j = j + 1; + if (line[i] == delim[j]) i++; + else flag = 0; + } + while ((line[i] != '\0') && (!flag)) + { + word[m++] = line[i++]; + if (line[i] != '\0') + { + j = 0; + while ((delim[j] != '\0') && (line[i] != delim[j])) j = j + 1; + if (line[i] == delim[j]) flag = 1; + } + } + /* Shorten line. */ + j = 0; + while (line[i]!='\0') { line[j++] = line[i++]; } + /* Terminate the char-strings. */ + line[j] = '\0'; + word[m] = '\0'; +} + + +/***************************************************************************/ +/* Next_CSV - */ +/* Parse a line of text which is either comma-delimited, or tab-delimited. */ +/* Return the next item, and remove the item to shorten the string. */ +/***************************************************************************/ +void next_csv( char *line, char *word, char delim ) +{ /* Expect delim to be either ',' (comma) for CSV, or '\t' (tab) for Tab-Delimited. */ + int j=0, k=0, m=0; + + /* Consume any preceding white-space */ + while ((line[j] !='\0') && ((line[j] == ' ') || (line[j] == '\t') || (line[j] == '\n') || (line[j] == '\r'))) + j++; + /* Grab the next item until delimiter. */ + while ((line[j] != '\0') && (line[j] != delim)) + { + if (line[j] == '"') /* Accept a double-quoted phrase. */ + { + do { j++; word[m++] = line[j]; } + while ((line[j] != '\0') && (line[j] != '"')); + if (line[j] == '"') { j++; m--; } + } + else + if (line[j] == '\'') /* Accept a single-quoted phrase. */ + { + do { j++; word[m++] = line[j]; } + while ((line[j] != '\0') && (line[j] != '\'')); + if (line[j] == '\'') { j++; m--; } + } + else + word[m++] = line[j++]; + } + if (line[j] == delim) + j++; /* Advance past next delimiter. */ + /* Shorten line. */ + k = 0; + while (line[j] != '\0') { line[k++] = line[j++]; } + /* Terminate the char-strings. */ + line[k] = '\0'; + word[m] = '\0'; +} + + +struct date_record + { + int month, day, year; + } yourDOB, spouseDOB, DL; + + +char *format_mmddyyyy( int month, int day, int year ) +{ + char datestr[100], dd[20], yy[20]; + if (month < 10) sprintf(datestr, "0%d", month ); else sprintf(datestr, "%d", month ); + if (day < 10) sprintf(dd, "0%d", day ); else sprintf(dd, "%d", day ); + strcat( datestr, dd ); + sprintf( yy, "%d", year ); + strcat( datestr, yy ); + return strdup( datestr ); +} + + +int isleapyear (int year) /* Used by interpret_date and get_gain_and_losses */ +{ /* Returns 1 on TRUE. 0 on false. */ + if (((year % 4 == 0) && (year % 100!= 0)) || (year%400 == 0) ) + return 1; + else + return 0; +} + + +/* Handy routine for interpreting dates in various formats. */ +int interpret_date( char *datestr, int *month, int *day, int *year, char *emssg ) +{ /* Returns 1 on success. 0 on failure. */ + char word1[500], *owrd; + int monthdays; + int std_days[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; /* Array of Days in each month */ + /* Expect month-day-year as in: 3-3-01, Feb 3, 2024, or 3/3/2024, etc. */ + owrd = strdup( datestr); + next_word( owrd, word1, " /,-\t\n\r" ); + if (strncasecmp( word1, "Jan", 3 ) == 0) *month = 1; else + if (strncasecmp( word1, "Feb", 3 ) == 0) *month = 2; else + if (strncasecmp( word1, "Mar", 3 ) == 0) *month = 3; else + if (strncasecmp( word1, "Apr", 3 ) == 0) *month = 4; else + if (strncasecmp( word1, "May", 3 ) == 0) *month = 5; else + if (strncasecmp( word1, "Jun", 3 ) == 0) *month = 6; else + if (strncasecmp( word1, "Jul", 3 ) == 0) *month = 7; else + if (strncasecmp( word1, "Aug", 3 ) == 0) *month = 8; else + if (strncasecmp( word1, "Sep", 3 ) == 0) *month = 9; else + if (strncasecmp( word1, "Oct", 3 ) == 0) *month = 10; else + if (strncasecmp( word1, "Nov", 3 ) == 0) *month = 11; else + if (strncasecmp( word1, "Dec", 3 ) == 0) *month = 12; else + if ((sscanf( word1, "%d", month) != 1) || (*month < 1) || (*month > 12)) + {printf("DATA ERROR: Bad month '%s' in '%s' at '%s'\n", word1, datestr, emssg ); + fprintf(outfile,"DATA ERROR: Bad month '%s' in '%s' at '%s'\n", word1, datestr, emssg ); + return 0; + } + next_word( owrd, word1, " /,-\t\n\r" ); + if ((sscanf( word1, "%d", day) != 1) || (*day < 1) ) + {printf("DATA ERROR: Bad day '%s' in '%s' at '%s'\n", word1, datestr, emssg ); + fprintf(outfile,"DATA ERROR: Bad day '%s' in '%s' at '%s'\n", word1, datestr, emssg ); + return 0; + } + next_word( owrd, word1, " /,-\t\n\r" ); + if ((sscanf( word1, "%d", year) != 1) || (*year < 0) || (*year > 3000)) + {printf("DATA ERROR: Bad year '%s' in '%s' at '%s'\n", word1, datestr, emssg ); + fprintf(outfile,"DATA ERROR: Bad year '%s' in '%s' at '%s'\n", word1, datestr, emssg ); + return 0; + } + free( owrd ); + if (*year < 40) /* Convert any 2-digit year to four digits. */ + *year = *year + 2000; /* Assumes any 2-digit years are after 1940. */ + else + if (*year < 1900) + *year = *year + 1900; + /* Enhanced Day Validity Check, Check for February in a Leap Year */ + if ((*month == 2) && (isleapyear ( *year)) ) monthdays=29; + else monthdays=std_days[*month]; + if (*day > monthdays) + {printf("DATA ERROR: Invalid day '%d' in '%s' at '%s'\n", *day, datestr, emssg ); + fprintf(outfile,"DATA ERROR: Invalid day '%d' in '%s' at '%s'\n", *day, datestr, emssg ); + return 0; + } + return 1; +} + + +/**********************************************************************************************/ +/* gen_date_rec - Input is "datestr". Generates a record (structure variable) */ +/* "date_rec" with numerical (integer) month, day, year. */ +/* Date Record used in get_gain_and_losses function to determine if holding period is greater */ +/* than one Calendar Year and for sell-before-buy check. */ +/**********************************************************************************************/ +void gen_date_rec(char *datestr, char *emssg, struct date_rec *date ) +{ + int month, day, year, result ; + /* Expect month-day-year, 3-3-01 */ + result = interpret_date( datestr, &month, &day, &year, emssg ); + if (result != 1) + exit(1); + if ((year<1980) || (year>2050)) + printf("Warning: Unusual year in '%s' . Use mm-dd-yy date like 5-23-02. '%s'\n", datestr, emssg ); + /* Put the results in the "date_rec" record via pointer */ + date->month = month; + date->day=day; + date->year=year; +} + + +void read_line( FILE *infile, char *line ) +{ + int j=0; + do line[j++] = getc(infile); while ((!feof(infile)) && (line[j-1] != '\n')); + if ((j > 1) && (line[j-2] == '\r')) j--; + line[j-1] = '\0'; +} + + +void read_line_safe( FILE *infile, char *line, int maxlen ) +{ + char ch; + int j=0; + do + { + ch = getc(infile); + if (j < maxlen - 1) + line[j++] = ch; + } + while ((!feof(infile)) && (ch != '\n')); + if ((j > 1) && (line[j-2] == '\r')) j--; + line[j-1] = '\0'; +} + + +void read_comment_filtered_line( FILE *infile, char *line, int maxlen ) +{ /* Read next line, while filtering-out any comments. */ + int j=0; + do + { + line[j] = getc(infile); + if (line[j]=='{') + { + do line[j] = getc(infile); + while ((line[j] != '}') && (!feof(infile))); + line[j] = ' '; + } + j++; + } + while ((!feof(infile)) && (line[j-1] != '\n') && (j < maxlen-2)); + j--; + line[j] = '\0'; + consume_leading_trailing_whitespace( line ); +} + + +/* Show a line-number and it's value. */ +void showline( int j ) +{ fprintf(outfile, "L%d = %6.2f\n", j, L[j]); } + +/* Show an integer valued line. */ +void shownum( int j ) +{ fprintf(outfile, "L%d = %d\n", j, (int)L[j]); } + +/* Show line only if non-zero. */ /* Depricated in favor of ShowLineNonZero (clearer name). */ +void ShowLine( int j ) +{ if (L[j]!=0) showline( j ); } + +/* Show line only if non-zero. */ +void ShowLineNonZero( int j ) +{ if (L[j]!=0) showline( j ); } + +/* Show-Line with a message. */ +void showline_wmsg( int j, char *msg ) +{ fprintf(outfile,"L%d = %6.2f\t\t%s\n", j, L[j], msg); } + +/* Show line with a message, only if non-zero. */ +void ShowLineNonZero_wMsg( int j, char *msg ) +{ if (L[j]!=0) showline_wmsg( j, msg ); } + +/* For worksheet calculations, indent and show special line character. */ +void showline_wrksht( char wrksht, int j, double *x ) +{ fprintf(outfile," %c%d = %6.2f\n", wrksht, j, x[j]); } + +/* For worksheet calculations, indent and show special line character, if not zero. */ +void showline_wrksht_nz( char *wrksht, int j, double *x ) +{ if (x[j] != 0.0) fprintf(outfile," %s%d = %6.2f\n", wrksht, j, x[j] ); } + +/* Show-line with specified label and value. */ +void showline_wlabel( char *label, double value ) +{ fprintf(outfile, "%s = %6.2f\n", label, value ); } + +/* Show-line with specified label and value. */ +void showline_wlabelnz( char *label, double value ) +{ + if (value != 0.0) + fprintf(outfile, "%s = %6.2f\n", label, value ); +} + +/* Show-line with specified label, value, and message. */ +void showline_wlabelmsg( char *label, double value, char *msg ) +{ fprintf(outfile, "%s = %6.2f\t\t%s\n", label, value, msg ); } + +/* Show-line with specified label, value, and message, iff not zero. */ +void showline_wlabelmsg_nz( char *label, double value, char *msg ) +{ + if (value != 0.0) + fprintf(outfile, "%s = %6.2f\t\t%s\n", label, value, msg ); +} + +/* Show a character-string line with specified label, if string is not empty. */ +void Show_String_wLabel( char *label, char *msg ) +{ + if ((msg != 0) && (msg[0] != '\0')) + fprintf(outfile, "%s %s\n", label, msg ); +} + + +/* Get a line value, or sum. Must be terminated by ";". */ +void GetLine( char *linename, double *value ) +{ + char word[2048]; + get_parameter( infile, 's', word, linename ); + get_parameters( infile, 'f', value, linename ); +} + +/* Get a single line value. (No ";") */ +void GetLine1( char *linename, double *value ) +{ + char word[2048]; + get_parameter( infile, 's', word, linename ); + get_parameter( infile, 'f', value, linename ); +} + +/* Get a line value, or sum, and print it to file. */ +void GetLineF( char *linename, double *value ) +{ + GetLine( linename, value ); + fprintf(outfile, "%s = %6.2f\n", linename, *value ); +} + +/* Get a line value, and print it to file if not zero. */ +void GetLineFnz( char *linename, double *value ) +{ + GetLine( linename, value ); + if (*value != 0.0) fprintf(outfile, "%s = %6.2f\n", linename, *value ); +} + +/* Get optional line with label. */ +void GetOptionalLine( char *linename, char *label, double *value ) +{ + get_parameter( infile, 'l', label, linename ); + get_parameters( infile, 'f', value, linename ); +} + +void GetYesNo( char *linename, int *answer ) /* Get a boolean Yes/No, or True/False value, followed by ';'. */ +{ + char word[1024]; + get_parameter( infile, 's', word, linename); + get_parameters( infile, 'b', answer, linename ); +} + +void GetYesNo1( char *linename, int *answer ) /* Get a boolean Yes/No, or True/False value. */ +{ + char word[1024]; + get_parameter( infile, 's', word, linename); + get_parameter( infile, 'b', answer, linename ); +} + +void GetYesNoSL( char *linename, int *answer ) /* Get a boolean Yes/No, or True/False value. */ +{ + char word[1024]; + get_parameter( infile, 's', word, linename); + get_param_single_line( infile, 'b', answer, linename ); +} + +void GetInteger( char *linename, int *answer ) /* Get an integer number value. (Must end with ";".) */ +{ + char word[1024]; + get_parameter( infile, 's', word, linename); + get_parameters( infile, 'i', answer, linename ); +} + +void GetString( char *linename, char *chstr ) /* Get a character-string value. */ +{ + char word[1024]; + get_parameter( infile, 's', word, linename); + get_parameters( infile, 'w', chstr, linename ); +} + +void GetLineString( char *linename, char *chstr ) /* Get a character-string value. */ +{ + char word[1024]; + get_parameter( infile, 's', word, linename); + get_parameter( infile, 'w', chstr, linename ); + consume_leading_trailing_whitespace( chstr ); +} + + +double smallerof( double a, double b ) { if (ab) return a; else return b; } +double LargerOf( double a, double b ) { if (a>b) return a; else return b; } +double NotLessThanZero( double a ) { if (a<0.0) return 0.0; else return a; } + +double absolutev( double val ) { if (val >= 0.0) return val; else return -val; } + /* Convenience function - avoids needing to link with math-lib merely to get fabs(). */ + + +void Display_File( char *filename ) +{ + FILE *infile; + char line[500]; + + infile = fopen(filename,"r"); + if (infile==0) {printf("Could not open %s\n", filename); return;} + fgets(line, 500, infile); + while (!feof(infile)) + { + printf("%s", line); + fgets(line, 500, infile); + } + fclose(infile); +} + + + + +/*------------------------------------------------------------------------------*/ +/* Get_Comment - Read next Comment, if any, from input file. */ +/*------------------------------------------------------------------------------*/ +void get_comment( FILE *infile, char *word ) +{ + int j=0; + + do /*Absorb any leading white-space.*/ + word[j] = getc(infile); + while ((!feof(infile)) && ((word[j]==' ') || (word[j]=='\t') || (word[j]=='\n') || (word[j]=='\r'))); + if (word[j] == '{') + { + do /*Get words until end of comment.*/ + word[j++] = getc(infile); + while ((!feof(infile)) && (word[j-1] != '}')); + if (word[j-1] == '}') + word[j-1] = '\0'; + else + word[j] = '\0'; + } + else + { + ungetc(word[j], infile); + word[0] = '\0'; + } + if (verbose) printf("Read Coment: {%s}\n", word); +} + + +void consume_leading_trailing_whitespace( char *line ) +{ int j, k; + while (isspace( line[0] )) + { + j = 0; + do { line[j] = line[j+1]; j++; } + while (line[j-1] != '\0'); + } + k = strlen( line ) - 1; + while ((k >= 0) && (isspace( line[k] ))) + { + line[k] = '\0'; + k--; + } +} + + +int do_all_caps=0; +int writeout_line=1; + +void capitalize( char *word ) +{ + int k=0; + while (word[k] != '\0') + { + word[k] = toupper( word[k] ); + k++; + } +} + +/*------------------------------------------------------------------------------*/ +/* GetTextLineF - Read line with specified label name, and put the contents */ +/* of the remainder of the line to the output file. */ +/*------------------------------------------------------------------------------*/ +char *GetTextLineF( char *linename ) +{ + int k=0; + char line[5000]; + get_parameter( infile, 's', line, linename ); + line[k] = getc(infile); + while ((!feof(infile)) && (line[k] != '\n')) + { + if (line[k] == '{') + { + do line[k] = getc(infile); while ((!feof(infile)) && (line[k] != '}')); + if (line[k] == '}') line[k] = getc(infile); + } + else + { + k++; + if (k >= 5000) + { + line[k-1] = '\0'; + while ((!feof(infile)) && (getc(infile) != '\n')); + consume_leading_trailing_whitespace( line ); + fprintf(outfile, "%s %s\n", linename, line ); + return strdup( line ); + } + line[k] = getc(infile); + } + } + line[k] = '\0'; + consume_leading_trailing_whitespace( line ); + if (do_all_caps) + capitalize( line ); + if (writeout_line) + fprintf(outfile, "%s %s\n", linename, line ); + return strdup( line ); +} + + +char *GetTextLine( char *linename ) +{ + int priorstate; + char *chstr; + priorstate = writeout_line; + writeout_line = 0; + chstr = GetTextLineF( linename ); + writeout_line = priorstate; + return chstr; +} + + +void format_socsec( char *line, int kind ) +{ /* Expect 3+2+4=9 digits. Kind = 0 places space after 3rd+5th chars. */ + char buf[20]=""; /* Kind = 1 forces 9-consecutive digits w/no spaces. */ + int j=0, k=0; + while ((line[j] != '\0') && (k < 11)) + { + if (isdigit( line[j] )) + { + buf[k++] = line[j]; + if ((kind == 0) && ((k == 3) || (k == 6))) + buf[k++] = ' '; + } + j++; + } + strcpy( line, buf ); +} + + +void remove_certain_chars( char *line, char *badchars ) +{ /* Removes any specified characters from a string, so as to uniformly format dates, ID numbers, etc.. */ + int j=0, k, m=0; + while (line[j] != '\0') + { + k = 0; + while ((badchars[k] != '\0') && (line[j] != badchars[k])) + k++; + if (badchars[k] == '\0') + line[m++] = line[j]; + j++; + } + line[m] = '\0'; +} + + +void substitute_chars( char *line, char *badchars, char replace_char ) +{ /* Replaces any specified characters from a string, so as to uniformly format dates, ID numbers, etc.. */ + int j=0, k; + while (line[j] != '\0') + { + k = 0; + while ((badchars[k] != '\0') && (line[j] != badchars[k])) + k++; + if (badchars[k] != '\0') + line[j] = replace_char; + j++; + } +} + + +int whitespace_invariant_strstr( char *haystack, char *needle ) /* Return 1 if match, otherwise 0 if mismatch. */ +{ + int ret; + char *hay, *ne, *wrd1, *wrd2; + hay = strdup( haystack ); + wrd1 = (char *)malloc( strlen( haystack ) + 1 ); + ne = strdup( needle ); + wrd2 = (char *)malloc( strlen( needle ) + 1 ); + do + { + next_word( hay, wrd1, " \t\n\r" ); + next_word( ne, wrd2, " \t\n\r" ); + // printf("Comparing '%s' to '%s'\n", wrd1, wrd2 ); + } + while ((wrd2[0] != '\0') && (strcmp(wrd1,wrd2) == 0)); + if (wrd2[0] != '\0') + ret = 0; /* Mismatch. */ + else + ret = 1; /* Matched. */ + free( hay ); + free( ne ); + free( wrd1 ); + free( wrd2 ); + return ret; +} + + +int check_form_version( char *title_as_read_in, char *expected_title ) +{ /* Check that Form input file matched intended Program. Return 1 if good. Or 0 if not-match. */ + if (whitespace_invariant_strstr( title_as_read_in, expected_title ) == 0) + { + printf("\nWarning: Looks like wrong Program for this Form-file.\n"); + printf(" Expecting: '%s'\n", expected_title ); + printf(" But found: '%s'.\n\n", title_as_read_in ); + fprintf(outfile,"\nWarning: Looks like wrong Program for this Form-file.\n"); + fprintf(outfile," Expecting: '%s'\n", expected_title ); + fprintf(outfile," But found: '%s'.\n\n\n", title_as_read_in ); + #ifdef microsoft + system( "start bin\\notify_popup -delay 3 -expire 20 \"Warning: Warning: Looks like wrong Program for this Form-file.\"" ); + #else + system( "bin/notify_popup -delay 3 -expire 20 \"Warning: Warning: Looks like wrong Program for this Form-file.\" &" ); + #endif + return 0; + } + else + return 1; +} + + +void check_if_yes( char *label ) /* Check box 'Y' or "N'. */ +{ + char word[999]; + int flag; + get_parameter( infile, 's', word, label ); + get_param_single_line( infile, 'b', &flag, label ); + if (flag) + fprintf(outfile,"%s X\n", label ); +} + + +//================================================== +//====== Import Return Data Support Functions ====== +//================================================== + +void GrabLineValue( char *label, char *fline, double *value ) +{ + char twrd[2048]; + next_word(fline, twrd, " \t=;"); + if ((twrd[0] != '\0') && (sscanf(twrd,"%lf", value) != 1)) + { + printf("Error: Reading Fed %s '%s%s'\n", label, twrd, fline); + fprintf(outfile,"Error: Reading Fed %s '%s%s'\n", label, twrd, fline); + } +} + + +void GrabLineString( char *fline, char *strng ) +{ /* Grab a string and copy it into pre-allocated character array. */ + char twrd[2048]; + strng[0] = '\0'; + do + { + next_word(fline, twrd, " \t=" ); + if (twrd[0] != ';') + { strcat( strng, twrd ); strcat( strng, " " ); } + } + while ((fline[0] != '\0') && (strstr( twrd, ";" ) == 0)); +} + + +void GrabLineAlloc( char *fline, char **strng ) +{ /* Grab a string and allocate space for it. */ + char twrd[4096]; + GrabLineString( fline, twrd ); + if (twrd[0] != '\0') { + // Trim trailing spaces from output string + int cpos = strlen(twrd) - 1; + while (twrd[cpos] == ' ') { + --cpos; + } + twrd[cpos + 1] = '\0'; + *strng = strdup( twrd ); + } +} + +void ConvertSlashes( char *fname ) +{ /* Convert slashes in file name based on machine type. */ + char *ptr; + #ifdef __MINGW32__ + char slash_sreach='/', slash_replace='\\'; + #else + char slash_sreach='\\', slash_replace='/'; + #endif + ptr = strchr( fname, slash_sreach ); + while (ptr) + { + ptr[0] = slash_replace; + ptr = strchr( fname, slash_sreach ); + } +} + +//================================================== +//====== Import Return Data Definition Struct ====== +//================================================== + +typedef struct FORM_IMPORT_DEF_T { + char *field_name; + double *p_field_val; // Pointer to location for numeric value found in return + char **p_field_string; // Pointer to string value pointer +} FORM_IMPORT_DEF, *P_FORM_IMPORT_DEF; + + +//================================ +//====== Import Return Data ====== +//================================ + +// Returns 0 for success, 1 for error +int ImportReturnData(char *return_filename, P_FORM_IMPORT_DEF p_form_imp_def, int num_imp_defs) +{ + char word[6000], fline[2000]; + int d; + FILE *infile; + // Zero all values, and set all strings to "". This ensures reasonable + // values, whether or not the file exists, and whether or not the fields exist. + for (d = 0; d < num_imp_defs; ++d) { + if ( (p_form_imp_def + d)->p_field_val != NULL ) + *(p_form_imp_def + d)->p_field_val = 0.0; + if ( (p_form_imp_def + d)->p_field_string != NULL ) + *(p_form_imp_def + d)->p_field_string = ""; + } + + ConvertSlashes( return_filename ); + infile = fopen(return_filename, "r"); + if (infile==0) { + printf("Error: Could not open return '%s'\n", return_filename); + fprintf(outfile,"Error: Could not open return '%s'\n", return_filename); + return( 1 ); + } + read_line(infile,fline); + while (!feof(infile)) { + next_word(fline, word, " \t="); + // Search through the table for field name + for (d = 0; d < num_imp_defs; ++d) { + if (strcmp(word, (p_form_imp_def + d)->field_name) == 0) { + // Found a matching field; run the call the correct function + P_FORM_IMPORT_DEF pd = p_form_imp_def + d; + if (pd->p_field_val != NULL) + GrabLineValue( word, fline, pd->p_field_val); + if (pd->p_field_string != NULL) + GrabLineAlloc( fline, pd->p_field_string) ; + // Match was found; stop searching and go to next line + break; + } + } + read_line(infile,fline); + } + + fclose( infile ); + return( 0 ); +} + + +/* --- PDF Markup Support --- */ +/* This class supports the ability to intercept "MarkupPDF" commands in a Tax Input File, + and to forward them to the Tax Output File, where they can be interpretted by the + universal_pdf_file_modifer to place the desired markups onto the resulting PDF form pages. + It gives users the ability to add and maintain their own markups in their tax-input files, + which then show up on their printed tax-forms. + For example, you could use this feature to fill-in answers on the forms that are not + provided by the default OTS programs. You could also use it to re-position or + override the values provided by the default programs. + Example Usage - Syntax of line(s) you would add to your tax input file(s): + 1. To specify a value for an existing PDF-tag-name (whose page and position is already + defined in the default src/forms metadata.dat file): + MarkupPDF tag_name = value + Example: + MarkupPDF L22 = 567.12 + 2. To specify a new mark-up (or to re-position an existing one): + MarkupPDF( page_number, xpos, ypos ) tag_name = value + Example: + MarkupPDF( 5, 344, 800 ) CountyName = Warthberry + Note that the page-number refers to the page generated, starting from page 1. + The xpos and ypos are the positions from the top-left of the page, + assuming 110 units per inch. + You can add such markup commands to your saved tax file. +*/ +struct pdf_markup_record + { + char *tagname, *value; + int page, fontsz, setcol; + float xpos, ypos, txtred, txtgrn, txtblu; + struct pdf_markup_record *next; + } *pdf_markup_list=0; + +void add_pdf_markup( char *tagname, int page, float xpos, float ypos, + int fontsz, int setcol, float txtred, float txtgrn, float txtblu, char *value ) +{ + struct pdf_markup_record *new; + new = (struct pdf_markup_record *)calloc( 1, sizeof( struct pdf_markup_record ) ); + new->next = pdf_markup_list; + pdf_markup_list = new; + new->tagname = strdup( tagname ); + new->value = strdup( value ); + new->page = page; + new->xpos = xpos; + new->ypos = ypos; + new->fontsz = fontsz; + new->setcol = setcol; + new->txtred = txtred; + new->txtgrn = txtgrn; + new->txtblu = txtblu; +} + +void process_pdf_markup_command( char *line ) +{ + char word[4096], word2[4096], tagname[4096], value[4096]; + int pgnum=-1, fsz=10, setcol=0; + float xpos=0.0, ypos=0.0, txtred=0.0, txtgrn=0.0, txtblu=0.0; + if (mystrcasestr( line, "MarkupPDF" ) == 0) return; + if (mystrcasestr( line, "MarkupPDF(" ) != 0) + { + next_word( line, word2, "(" ); + next_word( line, word2, "()" ); + next_word( word2, word, " \t(," ); + if (sscanf( word, "%d", &pgnum ) != 1) + { printf("Error reading MarkupPDF page-num '%s'\n", word ); + fprintf(outfile,"Error reading MarkupPDF page-num '%s'\n", word ); + return; + } + next_word( word2, word, " \t," ); + if (sscanf( word, "%f", &xpos ) != 1) + { printf("Error reading MarkupPDF Xposition '%s'\n", word ); + fprintf(outfile,"Error reading MarkupPDF Xposition '%s'\n", word ); + return; + } + next_word( word2, word, " \t,)" ); + if (sscanf( word, "%f", &ypos ) != 1) + { printf("Error reading MarkupPDF Yposition '%s'\n", word ); + fprintf(outfile,"Error reading MarkupPDF Yposition '%s'\n", word ); + return; + } + next_word( word2, word, " \t,)" ); + if ((word[0] != '\0') && (sscanf( word, "%d", &fsz ) != 1)) + { printf("Error reading MarkupPDF fontsz '%s'\n", word ); + fprintf(outfile,"Error reading MarkupPDF fontsz '%s'\n", word ); + } + next_word( word2, word, " \t,)" ); + if ((word[0] != '\0') && (sscanf( word, "%g", &txtred ) != 1)) + { printf("Error reading MarkupPDF txtred '%s'\n", word ); + fprintf(outfile,"Error reading MarkupPDF textred '%s'\n", word ); + } + else + setcol = 1; + next_word( word2, word, " \t,)" ); + if ((word[0] != '\0') && (sscanf( word, "%g", &txtgrn ) != 1)) + { printf("Error reading MarkupPDF txtgrn '%s'\n", word ); + fprintf(outfile,"Error reading MarkupPDF txtgrn '%s'\n", word ); + } + next_word( word2, word, " \t,)" ); + if ((word[0] != '\0') && (sscanf( word, "%g", &txtblu ) != 1)) + { printf("Error reading MarkupPDF txtblue '%s'\n", word ); + fprintf(outfile,"Error reading MarkupPDF txtblue '%s'\n", word ); + } + next_word( line, word, " \t,)=" ); + } + else + { + next_word( line, word, " \t" ); + next_word( line, word, " \t=" ); + } + strcpy( tagname, word ); /* Grab tag-name. */ + next_word( line, value, " \t=" ); /* Grab 1st word of value after '=', if any. */ + // strcat( value, " " ); /* Add white-space in case other words on line. */ + strcat( value, line ); /* Add any following words on the remainder of the line. */ + add_pdf_markup( tagname, pgnum, xpos, ypos, fsz, setcol, txtred, txtgrn, txtblu, value ); +} + +void intercept_any_pdf_markups( FILE *infile ) +{ + char line[8192]; + if (!outfile) return; + read_comment_filtered_line( infile, line, 8192 ); + while (!feof(infile)) + { + if (strstr( line, "MarkupPDF" ) != 0) + process_pdf_markup_command( line ); + read_comment_filtered_line( infile, line, 8192 ); + } +} + +void exude_pdf_markups( FILE *outfile ) +{ /* Add any intercepted PDF-markups to the tax-output file. */ + struct pdf_markup_record *old; + if (!outfile) return; + while (pdf_markup_list) + { + if (pdf_markup_list->page > 0) + { + if ((pdf_markup_list->fontsz == 10) && (pdf_markup_list->setcol == 0)) + fprintf(outfile,"NewPDFMarkup( %d, %g, %g ) %s\n", pdf_markup_list->page, + pdf_markup_list->xpos, pdf_markup_list->ypos, pdf_markup_list->tagname ); + else + fprintf(outfile,"NewPDFMarkup( %d, %g, %g, %d, %d, %g, %g, %g ) %s\n", + pdf_markup_list->page, + pdf_markup_list->xpos, pdf_markup_list->ypos, + pdf_markup_list->fontsz, pdf_markup_list->setcol, + pdf_markup_list->txtred, pdf_markup_list->txtgrn, pdf_markup_list->txtblu, + pdf_markup_list->tagname ); + } + if (strstr( pdf_markup_list->tagname, ":" ) == 0) + fprintf(outfile,"%s = %s\n", pdf_markup_list->tagname, pdf_markup_list->value ); + else + fprintf(outfile,"%s \t%s\n", pdf_markup_list->tagname, pdf_markup_list->value ); + old = pdf_markup_list; + pdf_markup_list = pdf_markup_list->next; + free( old->tagname ); + free( old->value ); + free( old ); + } +} + +void grab_any_pdf_markups( char *infname, FILE *outfile ) +{ + FILE *infile; + infile = fopen( infname, "rb" ); + if (infile == 0) { printf("GAPM: Cannot open '%s' for reading.\n", infname ); return; } + intercept_any_pdf_markups( infile ); + fclose( infile ); + exude_pdf_markups( outfile ); +} + +/* --- End PDF Markup Support --- */ diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/universal_pdf_file_modifier.c b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/universal_pdf_file_modifier.c new file mode 100755 index 0000000..fe356c2 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/src/universal_pdf_file_modifier.c @@ -0,0 +1,1375 @@ +/*********************************************************************************** + Universal_PDF_File_Modifier.c - Pulls together a multi-page PDF-file based on + background image data files, with arbitrary text overlays. + + Provided under LGPL license (v2) by the Behemoth-Software Co.. + Copyright (C) 2023. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. + + Compile: + cc -O universal_pdf_file_modifier.c -o universal_pdf_file_modifier + + Run: + universal_pdf_file_modifier metadata.txt example_out.txt formpages.data + + For more information, see: + https://behemoth-software.com/Products/uPDF-Modifier-Doc.html + and + https://behemoth-software.com/Products/uPdfMaker.html + + ***********************************************************************************/ +#include +#include +#include +#include + +#define MaxPages 400 +#define MAXLINE 2048 + +float version=1.15; +int verbose=0; +int testmode=0; +int no_zero_entries=0; +int FontSz=10, round_to_whole_numbers=0, add_commas=1, rjustify=0; +char Typeface[256] = "Helvetica"; +int txtcolor=0, current_page=-1; +float txtred=0.0, txtgrn=0.0, txtblu=0.0; +int num_defined_pages=0, num_pages_to_print=0, num_main_pages=0; +int ck_sz_w=0, ck_sz_h=0, ckfntsz=16; +char cksymb[99]="*"; +int showdpt=1; /* Controls whether to show decimals in space-stretched numbers. */ +int enter00afterdecimals=0; /* Controls whether to force ".00" after rounded values. */ + + +void next_word( char *line, char *word, char *delim ) +{ + int j=0, k=0, m=0, flag=1; + while ((line[k]!='\0') && (flag)) + { /* Consume any preceding delimiters. */ + j = 0; + while ((delim[j] != '\0') && (line[k] != delim[j])) j++; + if (line[k] != delim[j]) flag = 0; else { k++; } + } + while ((line[k] != '\0') && (!flag)) + { /* Copy word until next delimiter. */ + word[m++] = line[k++]; + if (line[k] != '\0') + { + j = 0; + while ((delim[j] != '\0') && (line[k] != delim[j])) j++; + if (line[k] == delim[j]) flag = 1; + } + } + j = 0; /* Shorten line. */ + while (line[k] != '\0') line[j++] = line[k++]; + line[j] = '\0'; /* Terminate the char-strings. */ + word[m] = '\0'; +} + + +/* ------------------------------------------------------------ */ + +struct nvpair + { + char *label, *value; + int used, special, pagenumber; + struct nvpair *nxt; + } *results_list=0, *special_list=0; + + +struct special_format_rec + { + char *label; + int showifzero, check_display_without_sign; + struct special_format_rec *nxt; + } *special_formats_list=0; + + +/* Check for partial match of strings ending in wildcard '*'. */ +int checkwildcard( char *needle, char *haystack ) +{ char *twrd; int sl, ret; + sl = strlen( needle ); + if ((sl < 2) || (strstr( needle, "*" ) == 0)) + return 0; + twrd = strdup( needle ); + twrd[ sl - 1 ] = '\0'; + if (strstr( haystack, twrd ) != 0) + ret = 1; + else + ret = 0; + free( twrd ); + return ret; +} + + +struct special_format_rec *get_label_special_format_entry( char *label ) +{ + struct special_format_rec *item; + item = special_formats_list; + while (item && ((strcmp( item->label, label ) != 0) && (checkwildcard( item->label, label ) == 0))) + item = item->nxt; + if (item == 0) + { + item = (struct special_format_rec *)calloc( 1, sizeof( struct special_format_rec ) ); + item->label = strdup( label ); + } + return item; +} + +void add_showifzero( char *label ) +{ + struct special_format_rec *new; + new = get_label_special_format_entry( label ); + new->showifzero = 1; + new->nxt = special_formats_list; + special_formats_list = new; +} + + +int checknzoveride( char *label ) +{ /* Return 0 if label is to display even if zero. Else return 1. */ + struct special_format_rec *item; + item = special_formats_list; + while (item && ((strcmp( item->label, label ) != 0) && (checkwildcard( item->label, label ) == 0))) + item = item->nxt; + if ((item) && (item->showifzero)) + return 0; + else + return 1; +} + + +void add_display_without_sign( char *label ) +{ + struct special_format_rec *new; + new = get_label_special_format_entry( label ); + new->check_display_without_sign = 1; + new->nxt = special_formats_list; + special_formats_list = new; +} + + +void check_display_without_sign( char *label, char *value ) +{ + struct special_format_rec *item; + item = special_formats_list; + while (item && ((strcmp( item->label, label ) != 0) && (checkwildcard( item->label, label ) == 0))) + item = item->nxt; + if ((item) && (item->check_display_without_sign)) + { + if (value[0] == '-') + value[0] = ' '; + } +} + + + +struct nvpair *new_item( char *label, char *value ) +{ + struct nvpair *item; + item = (struct nvpair *)calloc( 1, sizeof( struct nvpair ) ); + item->label = strdup( label ); + item->value = strdup( value ); + item->used = 0; + item->pagenumber = current_page; + return item; +} + + +void add_entry( char *label, char *value ) /* Builds list of result items (tax-return line answer values). */ +{ /* Example: name="L7" value="23,456.00" */ + struct nvpair *item; + if (verbose) printf("Adding entry: label='%s', value='%s'\n", label, value ); + if ((no_zero_entries) && ((strcmp( value, "0.00" ) == 0) || (strcmp( value, "0" ) == 0) + || (strcmp( value, "0.0" ) == 0) || (strcmp( value, "-0.00") == 0)) && (checknzoveride(label))) + return; + check_display_without_sign( label, value ); + item = new_item( label, value ); + item->nxt = results_list; + results_list = item; +} + + +void add_special_rule( char *label, char *rule ) /* Builds list of special rules for lines that are to be handled differently. */ +{ /* Example: Special_Rule L1a_A: full-line */ + struct nvpair *item; + item = new_item( label, rule ); + if (verbose) printf("Adding Special Rule '%s' = '%s'\n", label, rule ); + item->nxt = special_list; + special_list = item; +} + + +void filter_text( char *line ) /* Prevent disallowed characters. */ +{ + int j=0; + while (line[j] != '\0') + { + if (line[j] == '(') line[j] = '['; + if (line[j] == ')') line[j] = ']'; + j++; + } +} + + +void prepad_with_whitespace( char *wrd, int len, int nspc ) +{ int j, k=0, p=0; + char newword[1000]=""; + j = strlen( wrd ); + while (k < len - j) { newword[p++] = ' '; if (nspc>1) newword[p++] = ' '; k++; } + newword[p] = '\0'; + strcat( newword, wrd ); + strcpy( wrd, newword ); +} + + +int m_round( double x ) +{ + if (x >= 0.0) return (int)(x + 0.5); + else return (int)(x - 0.5); +} + + +void consume_leading_trailing_whitespace( char *line ) +{ int j, k; + while (isspace( line[0] )) /* Consume any leading white-spaces. */ + { + j = 0; + do { line[j] = line[j+1]; j++; } + while (line[j-1] != '\0'); + } + k = strlen( line ) - 1; /* Consume any trailing white-spaces. */ + while ((k >= 0) && (isspace( line[k] ))) + { + line[k] = '\0'; + k--; + } +} + + +void right_justify( char *wrd, int k ) +{ + int j; + char twrd[1024]; + twrd[k--] = '\0'; + j = strlen(wrd) - 1; + while ((j > 0) && (wrd[j] == ' ')) j--; + while ((j >= 0) && (k >= 0)) + { + twrd[k--] = wrd[j--]; + } + while (k >= 0) twrd[k--] = ' '; + strcpy( wrd, twrd ); +} + + +struct optional_print_rec + { + int form_page, priority; /* Priority value is really an "order". So 2 will print before 5. */ + struct nvpair *results; + struct optional_print_rec *nxt; + } *optional_print_list=0, *optional_print_page=0; + + +void queue_optional_page( int form_page, int page_order ) +{ /* Queue an optional page for printing. */ + struct optional_print_rec *prv=0, *ptr, *new; + + num_pages_to_print++; + new = (struct optional_print_rec *)calloc( 1, sizeof(struct optional_print_rec) ); + new->form_page = form_page; + new->priority = page_order; + optional_print_page = new; + if (verbose) printf("Queuing Optional Page %d\n", form_page ); + + ptr = optional_print_list; + while ((ptr != 0) && (ptr->priority <= page_order)) + { + prv = ptr; + ptr = ptr->nxt; + } + new->nxt = ptr; + if (prv == 0) + optional_print_list = new; + else + prv->nxt = new; +} + + +void append_global_results_to_optional_pages() +{ + struct optional_print_rec *optlist; + struct nvpair *item, *last=0; + optlist = optional_print_list; + while (optlist != 0) + { /*optlist*/ + if (verbose) printf("Adding list ..\n"); + item = optlist->results; + while (item != 0) /* Find last item in list. */ + { + // printf(" item %s = %s\n", item->label, item->value ); + last = item; + item = item->nxt; + } + if (last == 0) + optlist->results = results_list; + else + last->nxt = results_list; + +#if (0) + printf("\nNow list is:\n"); + item = optlist->results; + while (item != 0) + { + printf(" item %s = %s\n", item->label, item->value ); + item = item->nxt; + } + printf("\n"); +#endif + + optlist = optlist->nxt; + } /*optlist*/ +} + + +/* Prototype. */ +void new_metadata_item( int pg, char *label, int xpos, int ypos, int FontSz, int txtcolor, + float txtred, float txtgrn, float txtblu, int add_commas, int padlen, float dx ); + + +void get_remainder_of_quoted_string( char *line, char *word ) +{ + int j=0, k=0; + if (word[0] == '"') + { + j = 1; + while ((word[j] != '"') && (word[j] != '\0')) j++; + if (word[j] == '\0') /* Check for end-quote in the first first word. */ + { /* No end-quote in first word, so append from remainder of line until end-quote. */ + do word[j++] = line[k++]; + while ((line[k-1] != '"') && (line[k-1] != '\0')); + word[j] = '\0'; + } + } +} + + +void read_replacement_text( char *fname ) +{ + int idinfo, pageorder; + char line[MAXLINE], word1[MAXLINE], word2[MAXLINE]; + double x; + struct nvpair *orig_results_list=0; + FILE *infile; + + infile = fopen( fname, "rb" ); + if (infile == 0) { printf("Cannot open '%s'\n", fname ); exit(1); } + fgets( line, MAXLINE, infile ); + while (!feof(infile)) + { /*not_eof*/ + idinfo = 0; + next_word( line, word1, " \t=\n\r" ); + if (strcmp( word1, "PDFpage:" ) == 0) + { + next_word( line, word1, " \t=\n\r" ); + if (sscanf( word1, "%d", ¤t_page) != 1) + printf("Error reading PDFpage: current_page '%s'\n", word1 ); + next_word( line, word1, " \t=\n\r" ); + if (sscanf( word1, "%d", &pageorder) != 1) + printf("Error reading PDFpage: page-order '%s'\n", word1 ); + queue_optional_page( current_page, pageorder ); + orig_results_list = results_list; + results_list = 0; + } + else + if (strcmp( word1, "EndPDFpage." ) == 0) + { + current_page = -1; /* Set back to global. */ + if (optional_print_page == 0) + { + printf("Error: Missing optional_print_page at 'EndPDFpage'\n"); + exit(1); + } + optional_print_page->results = results_list; + results_list = orig_results_list; + } + else + if (strcmp( word1, "FillOutForm_wRoundedNumbers_wZerosAfterDecPt" ) == 0) + { + enter00afterdecimals = 1; + } + else + if (strstr( word1, ":" ) != 0) + { + consume_leading_trailing_whitespace( line ); + strcpy( word2, line ); + idinfo = 1; + } + else + if (strcmp( word1, "NewPDFMarkup(" ) == 0) /* Expect: NewPDFMarkup( pg, x, y ) label_name */ + { int pg=0, txtcol=0, font=FontSz; + float xpos, ypos, tred=txtred, tgrn=txtgrn, tblu=txtblu; + next_word( line, word1, ")" ); /* Or: NewPDFMarkup( pg, x, y, fontsz, r, g, b ) label_name */ + next_word( word1, word2, " \t,(" ); + if (sscanf( word2, "%d", &pg ) != 1) + printf("Error reading PDFMarkup page '%s'\n", word2 ); + next_word( word1, word2, " \t," ); + if (sscanf( word2, "%f", &xpos ) != 1) + printf("Error reading PDFMarkup Xpos '%s'\n", word2 ); + next_word( word1, word2, " \t,)" ); + if (sscanf( word2, "%f", &ypos ) != 1) + printf("Error reading PDFMarkup Ypos '%s'\n", word2 ); + next_word( word1, word2, " \t,)" ); + if ((word2[0] != '\0') && (sscanf( word2, "%d", &font ) != 1)) + printf("Error reading PDFMarkup FontSz '%s'\n", word2 ); + next_word( word1, word2, " \t,)" ); + if ((word2[0] != '\0') && (sscanf( word2, "%d", &txtcol ) != 1)) + printf("Error reading PDFMarkup setcol '%s'\n", word2 ); + next_word( word1, word2, " \t,)" ); + if ((word2[0] != '\0') && (sscanf( word2, "%g", &tred ) != 1)) + printf("Error reading PDFMarkup TxtRed '%s'\n", word2 ); + else + txtcol = 1; + next_word( word1, word2, " \t,)" ); + if ((word2[0] != '\0') && (sscanf( word2, "%g", &tgrn ) != 1)) + printf("Error reading PDFMarkup TxtGreen '%s'\n", word2 ); + next_word( word1, word2, " \t,)" ); + if ((word2[0] != '\0') && (sscanf( word2, "%g", &tblu ) != 1)) + printf("Error reading PDFMarkup TxtBlue '%s'\n", word2 ); + next_word( line, word2, " \t)\r\n" ); + new_metadata_item( pg - 1, word2, xpos, ypos, font, txtcol, tred, tgrn, tblu, add_commas, 0, 0.0 ); + word2[0] = '\0'; + } + else + { + if (word2[0] == '!') /* Comment character. Lines beginning with '!" are ignored. */ + word2[0] = '\0'; + else + next_word( line, word2, " \t=\n\r" ); + } + if (word2[0] != '\0') + { + if (strcmp( word1, "Status" ) == 0) + { + if (strcmp( word2, "Single" ) == 0) + add_entry( "Check_single", "X"); + else + if (strcmp( word2, "Married/Joint" ) == 0) + { + add_entry( "Check_mfj", "X"); + add_entry( "Check_Spouse", "X"); + } + else + if (strcmp( word2, "Married/Sep" ) == 0) + add_entry( "Check_sep", "X"); + else + if (strncmp( word2, "Head_of_Household", 12 ) == 0) + add_entry( "Check_hh", "X"); + else + if (strncmp( word2, "Widow(er)", 5 ) == 0) + add_entry( "Check_widow", "X"); + } + else + { + filter_text( word2 ); + if (word2[0] == '"') + { /* Quoted string */ + get_remainder_of_quoted_string( line, word2 ); + } + else + if ( (!idinfo) && round_to_whole_numbers && ( isdigit(word2[0]) || ( (word2[0] == '-') && isdigit(word2[1]) ) ) ) + { /* Numeric or word. */ + if (sscanf( word2, "%lf", &x) != 1) + printf("Error reading number '%s'\n", word2 ); + else + if (x >= 0) + sprintf( word2, "%d", (int)(x + 0.5) ); + else + sprintf( word2, "%d", (int)(x - 0.5) ); + if (enter00afterdecimals) + strcat( word2, ".00" ); + } + add_entry( word1, word2 ); + } + } + fgets( line, MAXLINE, infile ); + } /*not_eof*/ + fclose(infile); + append_global_results_to_optional_pages(); +} + + +void lookup_label( char *label, char *rplcstr, int len, int nspc ) +{ + struct nvpair *item; + item = results_list; + // if (verbose) printf("Looking up label: '%s'\n", label ); + while ((item != 0) && (strcmp( item->label, label ) != 0)) item = item->nxt; + if (item != 0) + { + strcpy( rplcstr, item->value ); + if (strlen( rplcstr ) < len ) prepad_with_whitespace( rplcstr, len, nspc ); + } + else + rplcstr[0] = '\0'; /* Not found. */ + if (verbose) printf("Replacing '%s' with '%s'\n", label, rplcstr ); +} + + +/* ------------------------------------------------------------ */ + + +struct metadata_rec + { + char *label; + int x, y, fsz, padlen, + txtcolor, // 0=B&W, 1=color as defined by txtred, ... below. + add_commas; + float txtred, txtgrn, txtblu; + float dx; + struct metadata_rec *nxt; + }; + +struct metapage_rec + { + int optional; + struct metadata_rec *fields; + } *metadata[MaxPages]; + + +int pixCoords=0, custom_mediabox=0, mediabox_x=612, mediabox_y=792; +float refptX0, refptY0, refpixX0, refpixY0; +float refptX1, refptY1, refpixX1, refpixY1; + +void transform_coords( int xpix, int ypix, int *xpt, int *ypt ) +{ + *xpt = (int)((float)refptX0 + (float)(xpix - refpixX0) * (float)(refptX1 - refptX0) / (float)(refpixX1 - refpixX0)); + *ypt = (int)((float)refptY0 + (float)(ypix - refpixY0) * (float)(refptY1 - refptY0) / (float)(refpixY1 - refpixY0)); +} + + +void new_metadata_item( int pg, char *label, int xpos, int ypos, int FontSz, int txtcolor, + float txtred, float txtgrn, float txtblu, int add_commas, int padlen, float dx ) +{ + struct metadata_rec *newitem; + newitem = (struct metadata_rec *)calloc( 1, sizeof(struct metadata_rec) ); + if (pg >= MaxPages) + { + printf("Error: Page %d is greater than maximum pages (%d).\n", pg + 1, MaxPages ); + return; + } + newitem->nxt = metadata[pg]->fields; + metadata[pg]->fields = newitem; + newitem->label = strdup( label ); + newitem->fsz = FontSz; + newitem->txtcolor = txtcolor; + newitem->txtred = txtred; + newitem->txtgrn = txtgrn; + newitem->txtblu = txtblu; + newitem->add_commas = add_commas; + newitem->x = xpos; + newitem->y = ypos; + if (pixCoords) + transform_coords( newitem->x, newitem->y, &(newitem->x), &(newitem->y) ); + newitem->padlen = padlen; + newitem->dx = dx; +} + + + +/* ----------------- + Metadata entry tags will be of the form: + TagName xPos yPos RightPaddingSpaces CharSpacing + + ------------------ */ +void read_metadata( char *fname ) +{ + int pg=-1, k, nparamsrd; + char line[MAXLINE], wrd[MAXLINE], wrd2[MAXLINE]; + FILE *infile; + infile = fopen( fname, "rb" ); + if (infile == 0) { printf("Could not open '%s'\n", fname ); exit(1); } + fgets( line, 1024, infile ); + while (!feof(infile)) + { + next_word( line, wrd, " \t\n\r" ); + if ((wrd[0] != '\0') && (wrd[0] != '!')) /* Comment lines begin with "!" to be ignored. */ + { + if (strcmp( wrd, "Page" ) == 0) + { + pg++; num_defined_pages++; num_main_pages++; num_pages_to_print++; + // printf("READING INTO metadata[%d] from '%s'\n", pg, fname ); + metadata[pg] = (struct metapage_rec *)calloc( 1, sizeof(struct metapage_rec) ); + next_word( line, wrd, " \t\n\r" ); + nparamsrd = sscanf( wrd, "%d", &k ); + // printf("Reading Form Page %d, as %d, num_defined_pages = %d\n", pg + 1, k, num_defined_pages ); + // printf("Reading Form Page %d\n", pg + 1 ); + // printf(" nparamsrd = %d, k = %d, pg = %d\n", nparamsrd, k, pg ); + if ((nparamsrd != 1) || (k != pg + 1)) + printf("Error: Page bad number '%s' in file %s\n", wrd, fname ); + } + else + if (strcmp( wrd, "Optional_Page" ) == 0) + { + pg++; num_defined_pages++; + // printf("READING OPTIONAL INTO metadata[%d] from '%s'\n", pg, fname ); + metadata[pg] = (struct metapage_rec *)calloc( 1, sizeof(struct metapage_rec) ); + metadata[pg]->optional = 1; + next_word( line, wrd, " \t\n\r" ); + nparamsrd = sscanf( wrd, "%d", &k ); + // printf("Reading OPTIONAL Form Page %d, as %d, num_defined_pages = %d\n", pg + 1, k, num_defined_pages ); + // printf("Reading Optional Form Page %d\n", pg + 1 ); + // printf(" nparamsrd = %d, k = %d, pg = %d\n", nparamsrd, k, pg ); + if ((nparamsrd != 1) || (k != pg + 1)) + printf("Error: Optional_Page bad number '%s' in file %s\n", wrd, fname ); + } + else + if (strcmp( wrd, "FontSz" ) == 0) + { + next_word( line, wrd, " \t\n\r" ); + sscanf( wrd, "%d", &FontSz ); + } + else + if (strcmp( wrd, "Typeface" ) == 0) + { + next_word( line, wrd, " \t\n\r" ); + strcpy(Typeface, wrd); + } + else + if (strcmp( wrd, "no_zero_entries") == 0) + { + no_zero_entries = 1; + } + else + if (strcmp( wrd, "allow_zero_entries") == 0) + { + no_zero_entries = 0; + } + else + if (strcmp( wrd, "round_to_whole_numbers") == 0) + { + round_to_whole_numbers = 1; + } + else + if (strcmp( wrd, "show_cents") == 0) + { + round_to_whole_numbers = 0; + } + else + if (strcmp( wrd, "showevenifzero" ) == 0) + { + next_word( line, wrd, " \t\n\r" ); + add_showifzero( wrd ); + } + else + if (strcmp( wrd, "display_without_sign" ) == 0) + { + next_word( line, wrd, " \t\n\r" ); + add_display_without_sign( wrd ); + } + else + if (strcmp( wrd, "no_commas") == 0) + { + add_commas = 0; + } + else + if (strcmp( wrd, "use_commas") == 0) + { + add_commas = 1; + } + else + if (strcmp( wrd, "no_show_decimal_pt") == 0) + { + showdpt = 0; + } + else + if (strcmp( wrd, "show_decimal_pt") == 0) + { + showdpt = 1; + } + else + if (strcmp( wrd, "DoNotEnter00afterDecimals") == 0) + { + enter00afterdecimals = 0; + } + else + if (strcmp( wrd, "Enter00afterDecimals") == 0) + { + enter00afterdecimals = 1; + } + else + if (strcmp( wrd, "right_justify") == 0) + { + next_word( line, wrd, " \t\n\r" ); + sscanf( wrd, "%d", &rjustify ); + } + else + if (strcmp( wrd, "solid_status_check") == 0) + { + next_word( line, wrd, " \t\n\r" ); + sscanf( wrd, "%d", &ck_sz_w ); + next_word( line, wrd, " \t\n\r" ); + sscanf( wrd, "%d", &ck_sz_h ); + next_word( line, wrd, " \t\n\r" ); + sscanf( wrd, "%d", &ckfntsz ); + next_word( line, cksymb, " \t\n\r" ); + } + else + if (strcmp( wrd, "TxtColor:") == 0) /* Set Text-color in R, G, B. */ + { + next_word( line, wrd, " \t,\n\r" ); + sscanf( wrd, "%f", &txtred ); + next_word( line, wrd, " \t,\n\r" ); + sscanf( wrd, "%f", &txtgrn ); + next_word( line, wrd, " \t,\n\r" ); + sscanf( wrd, "%f", &txtblu ); + txtcolor = 1; + } + else + if (strcmp( wrd, "CoordReference:") == 0) /* Changes coordinates from 1/72-Pts to Pixels. */ + { + next_word( line, wrd, " \t,\n\r" ); + sscanf( wrd, "%f", &refptX0 ); + next_word( line, wrd, " \t,\n\r" ); + sscanf( wrd, "%f", &refptY0 ); + next_word( line, wrd, " \t,\n\r" ); + sscanf( wrd, "%f", &refpixX0 ); + next_word( line, wrd, " \t,\n\r" ); + sscanf( wrd, "%f", &refpixY0 ); + fgets( line, 1024, infile ); + next_word( line, wrd, " \t,\n\r" ); + sscanf( wrd, "%f", &refptX1 ); + next_word( line, wrd, " \t,\n\r" ); + sscanf( wrd, "%f", &refptY1 ); + next_word( line, wrd, " \t,\n\r" ); + sscanf( wrd, "%f", &refpixX1 ); + next_word( line, wrd, " \t,\n\r" ); + if (sscanf( wrd, "%f", &refpixY1 ) != 1) printf("Error reading CoordReference: '%s'\n", wrd ); + pixCoords = 1; + } + else + if (strcmp( wrd, "PtCoords") == 0) + { + pixCoords = 0; + } + else + if (strcmp( wrd, "MediaBox") == 0) + { float fval; + next_word( line, wrd, " \t,\n\r" ); + if (sscanf( wrd, "%f", &fval ) != 1) + printf("Error reading MediaBox x '%s'\n", wrd ); + mediabox_x = (int)(fval + 0.5); + next_word( line, wrd, " \t,\n\r" ); + if (sscanf( wrd, "%f", &fval ) != 1) + printf("Error reading MediaBox y '%s'\n", wrd ); + mediabox_y = (int)(fval + 0.5); + custom_mediabox = 1; + } + else + if (strcmp( wrd, "END_OF_INPUT") == 0) + { /* This enables putting junk in file after this tag -- for whatever reason, comments, notes, etc... */ + fclose(infile); + return; + } + else + { + int xpos, ypos, padlen=0; + float dx=0.0; + if (pg < 0) { printf("Error: Missing 'Page' tag before field tag.\n"); exit(1); } + next_word( line, wrd2, " \t\n\r," ); + sscanf( wrd2, "%d", &xpos ); + next_word( line, wrd2, " \t\n\r," ); + sscanf( wrd2, "%d", &ypos ); + next_word( line, wrd2, " \t\n\r," ); + if (wrd2[0] != '\0') + sscanf( wrd2, "%d", &padlen ); + next_word( line, wrd2, " \t\n\r," ); + if (wrd2[0] != '\0') + sscanf( wrd2, "%f", &dx ); + new_metadata_item( pg, wrd, xpos, ypos, FontSz, txtcolor, txtred, txtgrn, txtblu, + add_commas, padlen, dx ); + } + } + fgets( line, 1024, infile ); + } + fclose(infile); +} + + +void check_color( struct metadata_rec *item ) +{ + if (item->txtcolor) + { + txtred = item->txtred; + txtgrn = item->txtgrn; + txtblu = item->txtblu; + } +} + +/* ------------------------------------------------------------ */ + +char streambuf[40000]; + + +void comma_format( char *word ) /* For decimal numeric values, add commas at thousandth positions. */ +{ + int j=0, k, mm=0, pp=0, nn=0; + char *twrd; + while ((word[j] == ' ') || (word[j] == '\t')) j++; + if (word[j] == '-') j++; + nn = j; + while ((word[j] >= '0') && (word[j] <= '9')) j++; /* Find decimal point, if any. */ + /* j should now at decimal point or end of number (which is where the decimal-point would be). */ + if ((word[j] != '\0') && (word[j] != '.')) { return; } /* Return if not a normal numeric value. */ + j--; /* Places j on last whole number. */ + if (j - nn < 3) { return; } + k = j; + if (word[k+1] == '.') { k = k + 2; } + while ((word[k] >= '0') && (word[k] <= '9')) k++; + if (word[k] != '\0') { return; } /* Return if not a normal numeric value. */ + /* k is at the end of the word (at the '\0'), while j is at the last whole-digit in word. */ + + /* Count backward by three characters, and add comma(s). */ + twrd = (char *)malloc( k + 100 ); + while (k > j) + twrd[mm++] = word[k--]; + while (k >= 0) + { + twrd[mm++] = word[k--]; + pp++; + if ((pp == 3) && (k >= 0) && (word[k] != '-') && (word[k] != ' ')) + { twrd[mm++] = ','; pp = 0; } + } + twrd[mm--] = '\0'; + // printf("The reversed string is '%s'. mm = %d\n", &(twrd[1]), mm ); + + /* Now reverse the character order. */ + j = 0; + do { word[j++] = twrd[mm--]; } while (mm >= 0); + word[j] = '\0'; + free( twrd ); +} + + + +void zeroprepad( char *wrd ) +{ + int j=0; + while (wrd[j] == ' ') + wrd[j++] = '0'; +} + + +void spew_sumline( FILE *outfile, char *line, int *cnt ) +{ + fprintf(outfile, "%s", line ); + *cnt = *cnt + strlen(line); +} + + +void append_buf( char *streambuf, int fontsz, int xpos, int ypos, char *txt ) +{ + char tline[2048]; + if (txtcolor) + { + sprintf( tline, "BT %g %g %g rg\n/F1 ", txtred, txtgrn, txtblu ); + strcat( streambuf, tline ); + } + else + strcat( streambuf, "BT\n/F1 " ); + sprintf(tline,"%d Tf %d %d Td (", fontsz, xpos, ypos ); + strcat( streambuf, tline ); + strcat( streambuf, txt ); + strcat( streambuf, ") Tj\nET\n"); +} + + +void spew_from_file( FILE *outfile, FILE *infile, int n1, int *cnt ) +{ + int j; + for (j=0; j < n1; j++) + { + fprintf(outfile,"%c", getc(infile) ); + } + *cnt = *cnt + n1; +} + + +void consume_from_file( FILE *infile, int n1 ) +{ + int j; + for (j=0; j < n1; j++) + getc(infile); +} + + +int adjust_xpos_for_commas( char *txt ) +{ + int j=0, cnt=0; + while (txt[j]!= '\0') + { + if (txt[j] == ',') cnt++; + j++; + } + return 2 * cnt; +} + + +float leading_sign( char *value ) +{ /* Adjusts for slight contraction in pdf display of string, due to '-' being smaller than digits. */ + int j=0; + while (isspace(value[j])) + j++; + if (value[j] == '-') + return -2.0; + else + return 0.0; +} + + +void filter_quotes( char *value ) +{ + int j=0; + if (value[0] == '"') + { + do + { + value[j] = value[j+1]; + j++; + } + while ((value[j-1] != '"') && (value[j-1] != '\0')); + if (value[j-1] == '"') value[j-1] = '\0'; + } +} + + +void place_overlay_text( char *streambuf, int page ) +{ + int j, nspc; + float x; + char wrd[100], value[MAXLINE]; + struct metadata_rec *item; + streambuf[0] = '\0'; + printf("WRITING from metadata[ Pg %d ]\n", page - 1 ); + item = metadata[ page - 1 ]->fields; + while (item) + { + check_color( item ); + if (item->dx > 0.0) nspc = 1; else nspc = 2; + add_commas = item->add_commas; + lookup_label( item->label, value, item->padlen, nspc ); + if (value[0] != '\0') + { /*valid*/ + if (item->dx > 0.0) + { /* Separated characters. */ + if (value[0] == '"') filter_quotes( value ); + j=0; + x = item->x; + while (value[j] != '\0') + { + if ((showdpt) || (value[j] != '.')) + { + sprintf( wrd, "%c", value[j] ); + append_buf( streambuf, item->fsz, (int)(x + 0.5), item->y, wrd ); + x = x + item->dx; + } + j++; + } + } + else + { /*normal*/ + float xadj=0.0; + if (add_commas && (strstr( item->label, "SocSec" ) == 0) && (strstr( item->label, "SSN:" ) == 0) && + (strstr( item->label, "Zipcode" ) == 0) && (strstr( item->label, "ZipCode" ) == 0) && + (strstr( item->label, "Street" ) == 0) && (strstr( item->label, "Birth" ) == 0) && + (strstr( item->label, "Check_") == 0) && (value[0] != '"')) + { /*number*/ + xadj = leading_sign( value ); + comma_format( value ); + if (rjustify) + right_justify( value, rjustify ); + xadj = xadj + adjust_xpos_for_commas( value ); + } /*number*/ + if (value[0] == '"') filter_quotes( value ); + if (verbose) printf("Placing '%s' to '%s'\n", item->label, value ); + if ((ck_sz_w == 0) || (strstr( item->label, "Check_") == 0)) + append_buf( streambuf, item->fsz, item->x - xadj, item->y, value ); + else + { int x, y; + y = ck_sz_h; + while (y != 0) + { + x = ck_sz_w; + while (x != 0) + { + append_buf( streambuf, ckfntsz, item->x - xadj + x, item->y + y, cksymb ); + x = x - 1; + } + y = y - 1; + } + } + } + } /*valid*/ + item = item->nxt; + } + if (streambuf[0] == '\0') /* Avoid empty output buffer. */ + append_buf( streambuf, 8, 1, 1, " " ); +} + + +void write_test_pattern( char *streambuf, int page ) +{ /*testmode*/ /* Writes labels into their spots. */ + struct metadata_rec *item; + streambuf[0] = '\0'; + item = metadata[ page - 1 ]->fields;; + while (item) + { + append_buf( streambuf, item->fsz, item->x, item->y, item->label ); + item = item->nxt; + } + if (streambuf[0] == '\0') /* Avoid empty output buffer. */ + append_buf( streambuf, 8, 1, 1, " " ); +} /*testmode*/ + + +void old_write_test_pattern( char *streambuf ) +{ /*oldtestmode*/ /* Write test-calibration patterns. */ + int x, y=50, dx=50, dy=25; + char wrd1[1024]; + streambuf[0] = '\0'; + while (y < 750) + { + x = 50; + while (x < 600) + { + sprintf( wrd1, "[%d,%d]", x, y ); + append_buf( streambuf, 10, x, y, wrd1 ); + x = x + dx; + } + y = y + dy; + } + y = 691; + x = 60; + while (x < 600) + { + sprintf( wrd1, "%d", x ); + append_buf( streambuf, 8, x, y, wrd1 ); + x = x + 20; + } + y = 683; + x = 70; + while (x < 600) + { + sprintf( wrd1, "%d", x ); + append_buf( streambuf, 8, x, y, wrd1 ); + x = x + 20; + } +} /*oldtestmode*/ + + + + +void page_collector( char *rawpdfname, char *outfname ) +{ /* Reads raw-pdf file, and overlays text fields, to produce output pdf-file. */ + int npages, page=0, nobjs=0, obj, address[4096], xrefcnt, cnt=0, streamlen; + int k, n1, n2, form_page, last_form_page=-1; + char wrd1[4096], line[4096]; + struct nvpair *saved_results=0; + FILE *infile, *outfile; + + infile = fopen( rawpdfname, "rb" ); + if (infile == 0) { printf("Cannot open '%s'\n", rawpdfname ); exit(1); } + if ((fscanf( infile, "%d", &npages) != 1) || (npages < 1) || (npages > 999)) + { printf("Error reading npages in '%s'\n", rawpdfname ); exit(1); } + if (npages != num_defined_pages) + printf("Assertion Violation: npages (%d in RawPDF file) != num_defined_pages (%d in MetaData file)\n", + npages, num_defined_pages ); + fscanf( infile, "%s", wrd1 ); /* Consume "Pages" */ + + outfile = fopen( outfname, "wb" ); + sprintf(line,"%%PDF-1.5\n%%%c%c%c%c\n", 0xfe, 0xfe, 0xfe, 0xfe ); + spew_sumline( outfile, line, &cnt ); + address[nobjs++] = cnt; + sprintf(line,"%d 0 obj\n<< /Type /Catalog\n", nobjs ); + spew_sumline( outfile, line, &cnt ); + sprintf(line,"/Pages 2 0 R\n>>\nendobj\n"); + spew_sumline( outfile, line, &cnt ); + + address[nobjs++] = cnt; + sprintf(line,"%d 0 obj\n<< /Type /Pages\n", nobjs ); + spew_sumline( outfile, line, &cnt ); + sprintf(line,"/Kids ["); + spew_sumline( outfile, line, &cnt ); + for (page=1; page <= num_pages_to_print; page++) + { + sprintf(line,"%d 0 R", 4 * page ); + spew_sumline( outfile, line, &cnt ); + if (page < num_pages_to_print) { fprintf(outfile," "); cnt++; } + } + sprintf(line,"]\n"); + spew_sumline( outfile, line, &cnt ); + sprintf(line,"/Count %d\n>>\nendobj\n", num_pages_to_print ); + spew_sumline( outfile, line, &cnt ); + + address[nobjs++] = cnt; + sprintf(line,"%d 0 obj\n<< /Type /Outlines /Count 0 >>\n", nobjs ); + spew_sumline( outfile, line, &cnt ); + sprintf(line,"endobj\n"); + spew_sumline( outfile, line, &cnt ); + + if (verbose) printf("num_defined_pages = %d\n", num_defined_pages ); + if (verbose) printf("num_pages_to_print = %d\n", num_pages_to_print ); + if (verbose) printf("num_main_pages = %d\n", num_main_pages ); + + for (page=1; page <= num_pages_to_print; page++) + { /*PageOut*/ + if (verbose) printf("Printing Page %d\n", page ); + + if (page <= num_main_pages) + { + form_page = page; + } + else + { + if (optional_print_list == 0) { printf("Unexpected error 7\n"); exit(1); } + saved_results = results_list; + results_list = optional_print_list->results; + form_page = optional_print_list->form_page; + optional_print_list = optional_print_list->nxt; + if (verbose) printf("Printing Optional Form page: %d\n", form_page ); + if (last_form_page != form_page - 1) + { /*Re-position raw_pdf file read-pt.*/ + // printf(" ... Re-Syncing Form-Data file\n"); + if (last_form_page >= form_page) + { + fclose( infile ); + infile = fopen( rawpdfname, "rb" ); + fscanf( infile, "%d", &npages); + fscanf( infile, "%s", wrd1 ); /* Consume "Pages" */ + } + do + { + fscanf( infile, "%s", wrd1 ); /* "Page" */ + fscanf( infile, "%d", &k ); /* pg_num */ + // printf(" Scanning past pg %d\n", k ); + fscanf( infile, "%d", &n1 ); + fscanf( infile, "%d", &n2 ); + fgets( wrd1, 1024, infile ); + fgets( wrd1, 1024, infile ); + consume_from_file( infile, n1 - strlen(wrd1) - 1 ); + fgets( wrd1, 1024, infile ); /* "2 0 obj\n" */ + consume_from_file( infile, n2 - strlen(wrd1) - n1 ); + fgets( wrd1, 1024, infile ); /* "EndPage\n" */ + } + while (k < form_page - 1); + } + } + if (verbose) printf(" ... from Form %d\n", form_page ); + + address[nobjs++] = cnt; + sprintf(line,"%d 0 obj\n", nobjs ); + spew_sumline( outfile, line, &cnt ); + sprintf(line,"<< /Type /Page\n/Parent 2 0 R\n"); + spew_sumline( outfile, line, &cnt ); + if (!custom_mediabox) + sprintf(line,"/MediaBox [0 0 612 792]\n"); + else + sprintf(line,"/MediaBox [0 0 %3d %3d]\n", mediabox_x, mediabox_y ); + spew_sumline( outfile, line, &cnt ); + sprintf(line,"/Contents [ %d 0 R %d 0 R ]\n", nobjs + 2, nobjs + 1 ); + spew_sumline( outfile, line, &cnt ); + sprintf(line,"/Resources << /ProcSet [/PDF /Text] /Font << /F1 << /Type /Font /Subtype /Type1 /Name "); + spew_sumline( outfile, line, &cnt ); + sprintf(line,"/F1 /BaseFont /%s /Encoding /MacRomanEncoding >>\n>>\n", Typeface); + spew_sumline( outfile, line, &cnt ); + sprintf(line,"/XObject << /x5 %d 0 R>>\n", nobjs + 3 ); + spew_sumline( outfile, line, &cnt ); + sprintf(line,"/ProcSet[/PDF /Text /ImageB /ImageC /ImageI]\n"); + spew_sumline( outfile, line, &cnt ); + sprintf(line,">>\n>>\nendobj\n"); + spew_sumline( outfile, line, &cnt ); + + /* Place all the text items for the present page. */ + address[nobjs++] = cnt; + sprintf(line,"%d 0 obj\n", nobjs ); + spew_sumline( outfile, line, &cnt ); + streambuf[0] = '\0'; + + if (!testmode) + { /*normalmode*/ + place_overlay_text( streambuf, form_page ); + } /*normalmode*/ + else + { /*testmode*/ + write_test_pattern( streambuf, form_page ); + } /*testmode*/ + + streamlen = strlen( streambuf ); + sprintf(line,"<< /Length %d >>\nstream\n", streamlen - 1 ); + spew_sumline( outfile, line, &cnt ); + spew_sumline( outfile, streambuf, &cnt ); + sprintf(line,"endstream\nendobj\n"); + spew_sumline( outfile, line, &cnt ); + + address[nobjs++] = cnt; + sprintf(line,"%d 0 obj\n", nobjs ); + spew_sumline( outfile, line, &cnt ); + + fscanf( infile, "%s", wrd1 ); + if (feof(infile)) + { printf("Premature end of infile\n"); exit(1); } + if (strcmp(wrd1, "Page" ) != 0) + { printf("Problem reading infile, expected 'Page' but found '%s'\n", wrd1 ); exit(1); } + fscanf( infile, "%d", &k ); + if (k != form_page) + { printf("Problem reading infile, expected 'Page %d' but found '%d'\n", form_page, k ); exit(1); } + fscanf( infile, "%d", &n1 ); + fscanf( infile, "%d", &n2 ); + fgets( wrd1, 1024, infile ); + fgets( wrd1, 1024, infile ); + if (strcmp( wrd1, "1 0 obj\n" ) != 0) + { printf("Problem reading infile, expected '1 0 obj' but found '%s'\n", wrd1 ); exit(1); } + spew_from_file( outfile, infile, n1 - strlen(wrd1) - 1, &cnt ); + + address[nobjs++] = cnt; + sprintf(line,"%d 0 obj\n", nobjs ); + spew_sumline( outfile, line, &cnt ); + fgets( wrd1, 1024, infile ); + if (strcmp( wrd1, "2 0 obj\n" ) != 0) + { printf("Problem reading infile, expected '2 0 obj' but found '%s'\n", wrd1 ); exit(1); } + spew_from_file( outfile, infile, n2 - strlen(wrd1) - n1, &cnt ); + fgets( wrd1, 1024, infile ); + if (strcmp( wrd1, "EndPage\n" ) != 0) + { printf("Problem reading infile, expected 'EndPage' but found '%s'\n", wrd1 ); exit(1); } + + if (saved_results != 0) + { + results_list = saved_results; + saved_results = 0; + } + last_form_page = form_page; + } /*PageOut*/ + fclose( infile ); + xrefcnt = cnt; + fprintf(outfile,"xref\n0 %d\n", nobjs + 1 ); + fprintf(outfile,"0000000000 65535 f\n"); + for (obj=0; obj < nobjs; obj++) + { + sprintf(wrd1,"%10d", address[obj] ); + zeroprepad( wrd1 ); + fprintf(outfile,"%s 00000 n\n", wrd1 ); + } + fprintf(outfile,"trailer\n<< /Size %d\n/Root 1 0 R\n>>\n", nobjs ); + fprintf(outfile,"startxref\n%d\n%%%%EOF\n", xrefcnt ); + fclose( outfile ); +} + + +void show_help() +{ + printf("Options:\n"); + printf(" -testmode - Place labels in their locations on pages.\n"); + printf(" -v - Set to verbose mode.\n"); + printf(" -o outfile - Name the output file.\n"); + printf(" -help - List these options.\n\n"); + printf("Usage:\n"); + printf(" universal_pdf_file_modifier metadata results.txt pdf_objects\n\n"); +} + + +/* ----------------------------------------------------------------------------------- */ +int main( int argc, char *argv[] ) +{ + int k=1, p=0; + char *outfname="new.pdf"; + + printf("Universal_PDF_File_Modifier version %3.2f.\n", version ); + /* Expect: metadata.txt example_out.txt formpages.data */ + /* First pre-scan command-line to get any options. */ + while (k < argc) + { /*k-loop*/ + if (argv[k][0] == '-') + { + if (strncmp( argv[k], "-testmode", 5 ) == 0) + testmode = 1; + else + if (strncmp( argv[k], "-v", 2 ) == 0) + verbose = 1; + else + if (strcmp( argv[k], "-o" ) == 0) + { + k++; + if (k == argc) + { printf("Missing file-name after '-o'\n"); exit(1); } + else + outfname = strdup( argv[k] ); + } + else + if (strncmp( argv[k], "-round_to_whole_numbers", 15 ) == 0) + { + round_to_whole_numbers = 1; + } + else + if (strncmp( argv[k], "-help", 2 ) == 0) + { + show_help(); + exit(0); + } + else + { + printf("Unknown option '%s'\n", argv[k] ); + exit(1); + } + } + k++; + } /*k-loop*/ + + /* Now re-scan to get the files. */ + k = 1; + while (k < argc) + { /*k-loop*/ + if (argv[k][0] == '-') + { + if (strcmp( argv[k], "-o" ) == 0) + { + k++; + } + } + else + { + switch (p) + { + case 0: read_metadata( argv[k] ); /* metadata.txt */ + break; + case 1: if (strcmp( argv[k], "no_file_test" ) != 0) + read_replacement_text( argv[k] ); /* example_out.txt */ + else + testmode = 1; + break; + case 2: page_collector( argv[k], outfname ); /* formpages.data */ + break; + default: printf("Unexpected command line argument to %s of %s\n", argv[0], argv[k] ); + exit(1); + } + p++; + } + k++; + } /*k-loop*/ + + printf(" Wrote: '%s'\n", outfname ); + return 0; +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/AZ_140/AZ_140_2022_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/AZ_140/AZ_140_2022_example.txt new file mode 100755 index 0000000..1373259 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/AZ_140/AZ_140_2022_example.txt @@ -0,0 +1,301 @@ +Title: AZ State Tax Form 140 - 2023 - EXAMPLE + +FileName1040: tax_form_files/US_1040/US_1040_example_with_f8949_spreadsheet_out.txt { File-name of Federal Return output file. } + { Data is collected by scanning Federal return to avoid re-entering it. } + { - - - - - - - - -- - - - - - - - - } +DaytimePhone#: 928-123-4567 { Daytime Phone Number. } +PriorLastNames: Nee { Last Names used in last 4 prior years, if different. } + { --- Filing Status --- } +L4a_InjuredSpouse: No {Injured Spouse Protection of Joint Overpayment? -- married joint filers only (answer: Yes, No) } + { --- Exemptions --- } +L8 2 { Number of filers age 65+ - you and/or spouse } + ; +L9 1 { Number of filers blind - you and/or spouse } + ; +L10a 1 { Number of Dependents under age of 17 - NOTE: some info must be added manually to form for dependents, if any} + ; +L10b 1 { Number of Dependents age 17 and over - NOTE: some info must be added manually to form for dependents, if any} + ; +L11a 2 { Number of Qualifying parents and grandparents } + ; + { --- Qualifying Parent/Grandparent Exemption Information --- } +L11_NeedMoreSpace: Yes { Need more space to list? Complete page 4 part 2. (answer: Yes, No) } + { --- } +L11b_PG1_FirstName: Mom { First Parent/Grandparent Exemption's first-name. } +L11b_PG1_LastName: Mine { First Parent/Grandparent Exemption's last-name. } +L11b_PG1_SocSec#: 123456789 { First Parent/Grandparent Exemption's Social Security number. } +L11b_PG1_Relation: mother { First Parent/Grandparent Exemption's relationship. } +L11b_PG1_Months: 10 { First Parent/Grandparent Exemption's Months lived in home in tax year. } +L11b_PG1_65Over: Yes { Age 65 or over? (answer: Yes, No) } +L11b_PG1_DiedTaxYr: No { Died during tax year? (answer: Yes, No) } + { --- } +L11c_PG2_FirstName: Dad { Second Parent/Grandparent Exemption's first-name. } +L11c_PG2_LastName: Mine { Second Parent/Grandparent Exemption's last-name. } +L11c_PG2_SocSec#: 098765432 { Second Parent/Grandparent Exemption's Social Security number. } +L11c_PG2_Relation: father { Second Parent/Grandparent Exemption's relationship. } +L11c_PG2_Months: 1 { Second Parent/Grandparent Exemption's Months lived in home in tax year. } +L11c_PG2_65Over: Yes { Age 65 or over? (answer: Yes, No) } +L11c_PG2_DiedTaxYr: No { Died during tax year? (answer: Yes, No) } + { --- Additions --- } +L13_Filing140SBI: Yes { Are you filing AZ Form 140-SBI? (answer: Yes, No) } +L13 13 {Small Business Income} + ; +L15 15 {Non-Arizona municipal interest} + ; +L16 16 {Partnership Income adjustment} + ; +L17 17 {Total amount of depreciation deducted on your federal return. } + ; + { L18: Other Additions to Income: Review Other Additions to AZ Gross Income schedule, below } + { + -------------------------- Other Additions to Arizona Gross Income -------------------------- + Schedule + Complete and include with your AZ tax return ONLY if you are making any adjustments INCREASING + your AZ Gross Income. See instructions for more information. + +} +OA_A 1 {Married Persons Filing Separate Returns} + ; +OA_B 1 {Arizona Form 141AZ Sched K-1 Fiduciary Adjustment} + ; +OA_C 2 {Ordinary Income Portion of Lump-Sum Distributions Excluded on Your Federal Return} + ; +OA_D 3 {Items Previously Deducted for Arizona Purposes} + ; +OA_E 4 {Claim of Right Adjustment for Amounts Repaid in Tax Year} + ; +OA_Fa 5 {Claim of Right Adjustment for Amounts Repaid in Prior Taxable years} + ; +OA_Fb 6 {Adjustment for Net Operating Loss due to Claim of Right} + ; +OA_Ga 7 {Addition for Expenses Due to Claiming Credit 312. See instructions.} + ; +OA_Gb 8 {Addition to S Corp Income for Expenses Due to Claiming Pass-Through + Credit on Form 312. See Instructions.} + ; +OA_Ha 9 {Adjusted Basis in Property for Which You Have Claimed a Credit for Investment + in Qualified Small Businesses (Form 338) that was sold or otherwise disposed + of during the tax year. See instructions.} + ; +OA_Hb 10 {Adjusted Basis in Property for Which You Have Claimed a Credit for Agricultural + Pollution Control Equipment (Form 325) that was sold or otherwise disposed + of during the tax year. See instructions.} + ; +OA_Hc 11 {Adjusted Basis in Property for Which You Claimed a Credit for Pollution Control + Equipment (Form 315) Before this Taxable Year that was sold or otherwise disposed + of during the tax year. See Instructions.} + ; +OA_I 12 {Nonqualified Withdrawals from 529 College Savings Plans.} + ; +OA_J 13 {Sole Proprietorship Loss of an Arizona Nonprofit Medical Marijuana Dispensary + Included in Federal Adjusted Gross Income. Sole Proprietorship loss of an AZ + dual licensee that has not elected to operate on a for-profit basis must also add + back the portion of their loss that is from the medical marijuana portion of the + business that is included in their federal adjusted gross income.} + ; +OA_K 14 {Federal Net Operating Loss (NOL) Carryforward from Non-AZ Sources Accrued While + a Nonresident.} + ; +OA_L 15 {Federal Capital Loss Carryforward Deduction Incurred from Non-AZ Sources prior to + AZ Residency.} + ; +OA_M 16 {Americans with Disabilities Act - Access Expenditures.} + ; +OA_N 17 {Amortization or Depreciation for Child Care Facility before 1990.} + ; +OA_O 18 {Net Capital Loss Derived From the Exchange of One Kind of Legal Tender for Another + Kind of Legal Tender: See instructions.} + ; +OA_P 19 {Entity-level Income Tax Payment. See instructions.} + ; +OA_Q 20 {Motion Picture Production Costs. See instructions.} + ; +OA_R 21 {Other Adjustments Related to Tax Credits. See instructions.} + ; +OA_S 22 {Other Adjustments. See instructions.} + ; + { --- Subtractions --- +See instructions for more information. +} +L20 20 {Total Net Capital Gain/Loss from federal return} + ; +L21 21 {Total Net Short-Term Capital Gain/Loss from federal Schedule D} + ; +L22 22 {Total Net Long-Term Capital Gain/Loss from federal Schedule D} + ; +L23 23 {Net Long-Term Capital Gain from Assets Acquired After Dec. 31, 2011 (acq. date must be verifiable)} + ; +L25 25 {Net Capital Gain from Investment in an Arizona Qualified Small Business} + ; +L26 26 {Recalculated Arizona Depreciation} + ; +L27 27 {Partnership Income Adjustment. See instructions.} + ; +L28 28 {Interest on U.S. Obligations} + ; +L29a 291 {Exclusion for U.S. Gov't, AZ State or Local Gov't Pensions} + ; +L29b 292 {Exclusion for Ret'd or Retainer Pay of the Uniformed Services of the U.S.} + ; +L30 30 {U.S. Social Security Benefits or Railroad Retirement Benefits (federally taxable amt only)} + ; +L31 31 {Certain Wages of American Indians} + ; +L32 32 {Pay Rec'd for Active Service as a Mbr. of the Reserves, Nat'l Guard or the U.S. Armed Forces} + ; +L33 33 {Net Operating Loss Adjustment. See instructions.} + ; +L34a 341 {Contributions to 529 College Savings Plans} + ; +L34b 342 {Contributions to 529A (ABLE Accounts)} + ; + { --- Exemptions --- } + {L36: Other Subtractions from Income: Review Other Subtraction from AZ Gross Income schedule, below } + { + -------------------------- Other Subtractions to Arizona Gross Income -------------------------- + Schedule + Complete and include with your AZ tax return ONLY if you are making any adjustments DECREASING + your AZ Gross Income. See instructions for more information. + +} +OS_A 1 {Married Persons Filing Separate Returns} + ; +OS_B 1 {Arizona Form 141AZ Sched K-1 Fiduciary Adjustment} + ; +OS_C 2 {Federally Taxable Arizona Municipal Interest as Evidenced by Bonds.} + ; +OS_D 3 {Adoption Expense.} + ; +OS_E 4 {Qualified Wood Stove, Wood Fireplace or Gas-Fired Fireplace.} + ; +OS_F 5 {Claim of Right Adjustment for Amounts Repaid in Taxable Years} + ; +OS_G 6 {Certain Expenses Not Allowed for Federal Purposes (due to claiming federal tax credits).} + ; +OS_H 7 {Qualified State Tuition Distributions.} + ; +OS_I 8 {Installment Sale Income from Another State Taxed by the Other State in a Prior Taxable Year.} + ; +OS_J 9 {Agricultural Crops Given to Arizona Charitable Organizations.} + ; +OS_K 10 {Basis Adjustment for Property Sold or Otherwise Displosed of During the Taxable Year.} + ; +OS_L 11 {Sole Proprietorship Income of an Arizona Nonprofit Medical Marijuana Dispensary Included in + Federal Adjusted Gross Income. In addition, Sole Proprietorship income of an Arizona + dual licensee that has NOT ELECTED to operate on a for-profit basis may subtract the + portion of their federal taxable income that is from the medical marijuana portion of + the business.} + ; +OS_M 12 {Long-Term Care Insurance Premiums.} + ; +OS_N 13 {Americans with Disabilities Act - Access Expenditures.} + ; +OS_O 14 {Exploration Expensis Deferred before January 1, 1990.} + ; +OS_P 15 {Sole Proprietorship of an Arizona Marijuana Establishment, Marijuana Testing Facilities and + dual licensees that operate on a for-profit basis: enter the total amount of ordinary and + necessary expenses related to the sales of recreational use products reported on Schedule DFE + (line 16). An LLC that has elected to be treated as a disregarded entity for federal purposes, + and also elected to operate on a for-profit basis may subtract the total amount of ordinary + and necessary expenses related to the sales of recreational use products reported on Schedule + DFE (line 16).} + ; +OS_Q 16 {S Corporation shareholders of an Arizona Marijuana Establishment, Marijuana Testing Facilities and + dual licensees that operate on a for-profit basis: enter the amount of your pro-rata share of + ordinary and necessary expenses related to the sales of recreational use products as shown on + your 120S Schedule K-1, line 7.} + ; +OS_R 17 {Net Capital Gain Derived From the Exchange of One Kind of Legal Tender for Another Kind of Legal + Tender: See instructions.} + ; +OS_S 18 {Value of Virtual Currency and Non-Fingible Tokens Receieved at Time of Airdrop.} ; +OS_T 19 {Gas Fees not included in Virtual Currency and Non-Fingible Tokens Basis.} ; +OS_U 20 {Arizona Families Tax Rebate.} ; +OS_V 21 {Other Adjustments - see instructions.} ; + + + { --- Other Exemptions: Complete Dependent and Other Exemption Information, Part 3 ---} +L40e 1 {Total number of qualifying individuals} + ; + { --- Balance of Tax } +L43_Deductions: Standard {Deductions to use? (answer: Itemized, Standard) } +L43 {Deductions Amount - this will be calculated if 'Standard' is selected} + ; + { + -------------- Standard Deductions Increase for Charitable Contributions -------------- + Worksheet + Complete and include with return, to determine your allowable increased standard deduction + for charitable contributions. This worksheet may be skipped if itemizing deductions. +} +SD1C 1 {Tax Year gifts by cash or check} + ; +SD2C 2 {Tax Year gifts other than by cash or check} + ; +SD3C 3 {Carryover from prior year} + ; +SD5C 4 {Total charitable contributions made in Tax Year for which you + are claiming a credit under AZ law for the current or prior + tax year} + ; + { --- end of Charitable Contributions Worksheet for Standard Deductions --- } +L47 47 {Tax from Recapture of Credits (from Arizona Form 301, Part 2, line 32)} + ; +L49 49 {Dependent Tax Credit -- see instructions} + ; +L50 50 {Family income tax credit -- see instructions} + ; +L51 51 {Nonrefundable Credits (from Arizona Form 301, Part 2, line 64)} + ; + { --- Total Payments and Refundable Credits --- } +L53 53 {Tax Year AZ Income Tax Withheld} + ; +L54a 541 {Tax Year AZ estimated tax payments} + ; +L54b 542 {Tax Year AZ Claim of Right: Complete & include AZ Claim of Right-Individual form(s)} + ; +L55 55 {Tax Year AZ extension payment (AZ Form 204) } + ; +L56 56 {Increased Excise Tax Credit} + ; +L57 57 {Property Tax Credit (from AZ Form 140PTC, Page 1, line 15)} + ; +L58_Filing308I: Yes { Are you filing AZ Form 308-I? (answer: Yes, No) } +L58_Filing334: Yes { Are you filing AZ Form 334? (answer: Yes, No) } +L58_Filing349: Yes { Are you filing AZ Form 349? (answer: Yes, No) } +L58 58 {Other Refundable Credits (from AZ forms 308-I and/or 349)} + ; + { --- Tax Due or Overpayment --- } +L62 62 {Amount of overpayment (if any) to be applied to next year's estimated taxes} + ; + { --- Voluntary Gifts --- } +L64 64 {Solutions Teams Assigned to Schools Fund} + ; +L65 65 {Arizona Wildlife Fund} + ; +L66 66 {Child Abuse Prevention Fund} + ; +L67 67 {Domestic Violence Services Fund} + ; +L68 68 {Political Gift (Democratic/Libertarian/Republican only)} + ; +L69 69 {Neighbors Helping Neighbors Fund} + ; +L70 70 {Special Olympics Fund} + ; +L71 71 {Veterans' Donations Fund} + ; +L72 1072 {I Didn't Pay Enough Fund} + ; +L73 73 {Sustainable State Parks and Roads Fund} + ; +L74 74 {Spaying and Neutering of Animals Fund} + ; +L75_PoliticalParty Libertarian {Political Party receiving gift? (answer: none, Democratic, Libertarian, Republican) } + { --- Penalty --- } +L76 76 {Estimated Payment Penalty} + ; +L77_1AnnualizedOther: Yes { Annualized/Other? (answer: Yes, No) } +L77_2FarmerFisherman: Yes { Farmer or Fisherman? (answer: Yes, No) } +L77_Filing221: Yes { Are you filing AZ Form 221? (answer: Yes, No) } + { --- Refund or Amount Owed ---} +L79_ForeignAcct: Yes { Will your deposit be ultimately placed in a foreign account? (answer: Yes, No) } diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/AZ_140/AZ_140_2022_example_minimal.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/AZ_140/AZ_140_2022_example_minimal.txt new file mode 100755 index 0000000..7e12c67 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/AZ_140/AZ_140_2022_example_minimal.txt @@ -0,0 +1,296 @@ +Title: AZ State Tax Form 140 - 2023 + +FileName1040: tax_form_files/US_1040/US_1040_example_out.txt { File-name of Federal Return output file. } + { Data is collected by scanning Federal return to avoid re-entering it. } + { - - - - - - - - -- - - - - - - - - } +DaytimePhone#: 928-123-4567 { Daytime Phone Number. } +PriorLastNames: Nee { Last Names used in last 4 prior years, if different. } + { --- Filing Status --- } +L4a_InjuredSpouse: No {Injured Spouse Protection of Joint Overpayment? -- married joint filers only (answer: Yes, No) } + { --- Exemptions --- } +L8 { Number of filers age 65+ - you and/or spouse } + ; +L9 { Number of filers blind - you and/or spouse } + ; +L10a { Number of Dependents under age of 17 - NOTE: some info must be added manually to form for dependents, if any} + ; +L10b { Number of Dependents age 17 and over - NOTE: some info must be added manually to form for dependents, if any} + ; +L11a { Number of Qualifying parents and grandparents } + ; + { --- Qualifying Parent/Grandparent Exemption Information --- } +L11_NeedMoreSpace: No { Need more space to list? Complete page 4 part 2. (answer: Yes, No) } + { --- } +L11b_PG1_FirstName: { First Parent/Grandparent Exemption's first-name. } +L11b_PG1_LastName: { First Parent/Grandparent Exemption's last-name. } +L11b_PG1_SocSec#: { First Parent/Grandparent Exemption's Social Security number. } +L11b_PG1_Relation: { First Parent/Grandparent Exemption's relationship. } +L11b_PG1_Months: { First Parent/Grandparent Exemption's Months lived in home in tax year. } +L11b_PG1_65Over: No { Age 65 or over? (answer: Yes, No) } +L11b_PG1_DiedTaxYr: No { Died during tax year? (answer: Yes, No) } + { --- } +L11c_PG2_FirstName: { Second Parent/Grandparent Exemption's first-name. } +L11c_PG2_LastName: { Second Parent/Grandparent Exemption's last-name. } +L11c_PG2_SocSec#: { Second Parent/Grandparent Exemption's Social Security number. } +L11c_PG2_Relation: { Second Parent/Grandparent Exemption's relationship. } +L11c_PG2_Months: { Second Parent/Grandparent Exemption's Months lived in home in tax year. } +L11c_PG2_65Over: No { Age 65 or over? (answer: Yes, No) } +L11c_PG2_DiedTaxYr: No { Died during tax year? (answer: Yes, No) } + { --- Additions --- } +L13_Filing140SBI: No { Are you filing AZ Form 140-SBI? (answer: Yes, No) } +L13 {Small Business Income} + ; +L15 {Non-Arizona municipal interest} + ; +L16 {Partnership Income adjustment} + ; +L17 {Total amount of depreciation deducted on your federal return. } ; + { L18: Other Additions to Income: Review Other Additions to AZ Gross Income schedule, below } + { + -------------------------- Other Additions to Arizona Gross Income -------------------------- + Schedule + Complete and include with your AZ tax return ONLY if you are making any adjustments INCREASING + your AZ Gross Income. See instructions for more information. + +} +OA_A {Married Persons Filing Separate Returns} + ; +OA_B {Arizona Form 141AZ Sched K-1 Fiduciary Adjustment} + ; +OA_C {Ordinary Income Portion of Lump-Sum Distributions Excluded on Your Federal Return} + ; +OA_D {Items Previously Deducted for Arizona Purposes} + ; +OA_E {Claim of Right Adjustment for Amounts Repaid in Tax Year} + ; +OA_Fa {Claim of Right Adjustment for Amounts Repaid in Prior Taxable years} + ; +OA_Fb {Adjustment for Net Operating Loss due to Claim of Right} + ; +OA_Ga {Addition for Expenses Due to Claiming Credit 312. See instructions.} + ; +OA_Gb {Addition to S Corp Income for Expenses Due to Claiming Pass-Through + Credit on Form 312. See Instructions.} + ; +OA_Ha {Adjusted Basis in Property for Which You Have Claimed a Credit for Investment + in Qualified Small Businesses (Form 338) that was sold or otherwise disposed + of during the tax year. See instructions.} + ; +OA_Hb {Adjusted Basis in Property for Which You Have Claimed a Credit for Agricultural + Pollution Control Equipment (Form 325) that was sold or otherwise disposed + of during the tax year. See instructions.} + ; +OA_Hc {Adjusted Basis in Property for Which You Claimed a Credit for Pollution Control + Equipment (Form 315) Before this Taxable Year that was sold or otherwise disposed + of during the tax year. See Instructions.} + ; +OA_I {Nonqualified Withdrawals from 529 College Savings Plans.} + ; +OA_J {Sole Proprietorship Loss of an Arizona Nonprofit Medical Marijuana Dispensary + Included in Federal Adjusted Gross Income. Sole Proprietorship loss of an AZ + dual licensee that has not elected to operate on a for-profit basis must also add + back the portion of their loss that is from the medical marijuana portion of the + business that is included in their federal adjusted gross income.} + ; +OA_K {Federal Net Operating Loss (NOL) Carryforward from Non-AZ Sources Accrued While + a Nonresident.} + ; +OA_L {Federal Capital Loss Carryforward Deduction Incurred from Non-AZ Sources prior to + AZ Residency.} + ; +OA_M {Americans with Disabilities Act - Access Expenditures.} + ; +OA_N {Amortization or Depreciation for Child Care Facility before 1990.} + ; +OA_O {Net Capital Loss Derived From the Exchange of One Kind of Legal Tender for Another + Kind of Legal Tender: See instructions.} + ; +OA_P {Entity-level Income Tax Payment. See instructions.} + ; +OA_Q {Motion Picture Production Costs. See instructions.} + ; +OA_R {Other Adjustments Related to Tax Credits. See instructions.} + ; +OA_S {Other Adjustments. See instructions.} + ; +{ --- Subtractions --- + See instructions for more information. +} +L20 0 {Total Net Capital Gain/Loss from federal return} ; +L21 0 {Total Net Short-Term Capital Gain/Loss from federal Schedule D} ; +L22 0 {Total Net Long-Term Capital Gain/Loss from federal Schedule D} ; +L23 0 {Net Long-Term Capital Gain from Assets Acquired After Dec. 31, 2011 (acq. date must be verifiable)} + ; +L25 {Net Capital Gain from Investment in an Arizona Qualified Small Business} + ; +L26 {Recalculated Arizona Depreciation} + ; +L27 {Partnership Income Adjustment. See instructions.} + ; +L28 {Interest on U.S. Obligations} + ; +L29a {Exclusion for U.S. Gov't, AZ State or Local Gov't Pensions} + ; +L29b {Exclusion for Ret'd or Retainer Pay of the Uniformed Services of the U.S.} + ; +L30 {U.S. Social Security Benefits or Railroad Retirement Benefits (federally taxable amt only)} + ; +L31 {Certain Wages of American Indians} + ; +L32 {Pay Rec'd for Active Service as a Mbr. of the Reserves, Nat'l Guard or the U.S. Armed Forces} + ; +L33 {Net Operating Loss Adjustment. See instructions.} + ; +L34a {Contributions to 529 College Savings Plans} + ; +L34b {Contributions to 529A (ABLE Accounts)} + ; + { --- Exemptions --- } + {L36: Other Subtractions from Income: Review Other Subtraction from AZ Gross Income schedule, below } + { + -------------------------- Other Subtractions to Arizona Gross Income -------------------------- + Schedule + Complete and include with your AZ tax return ONLY if you are making any adjustments DECREASING + your AZ Gross Income. See instructions for more information. + +} +OS_A {Married Persons Filing Separate Returns} + ; +OS_B {Arizona Form 141AZ Sched K-1 Fiduciary Adjustment} + ; +OS_C {Federally Taxable Arizona Municipal Interest as Evidenced by Bonds.} + ; +OS_D {Adoption Expense.} + ; +OS_E {Qualified Wood Stove, Wood Fireplace or Gas-Fired Fireplace.} + ; +OS_F {Claim of Right Adjustment for Amounts Repaid in Taxable Years} + ; +OS_G {Certain Expenses Not Allowed for Federal Purposes (due to claiming federal tax credits).} + ; +OS_H {Qualified State Tuition Distributions.} + ; +OS_I {Installment Sale Income from Another State Taxed by the Other State in a Prior Taxable Year.} + ; +OS_J {Agricultural Crops Given to Arizona Charitable Organizations.} + ; +OS_K {Basis Adjustment for Property Sold or Otherwise Displosed of During the Taxable Year.} + ; +OS_L {Sole Proprietorship Income of an Arizona Nonprofit Medical Marijuana Dispensary Included in + Federal Adjusted Gross Income. In addition, Sole Proprietorship income of an Arizona + dual licensee that has NOT ELECTED to operate on a for-profit basis may subtract the + portion of their federal taxable income that is from the medical marijuana portion of + the business.} + ; +OS_M {Long-Term Care Insurance Premiums.} + ; +OS_N {Americans with Disabilities Act - Access Expenditures.} + ; +OS_O {Exploration Expensis Deferred before January 1, 1990.} + ; +OS_P {Sole Proprietorship of an Arizona Marijuana Establishment, Marijuana Testing Facilities and + dual licensees that operate on a for-profit basis: enter the total amount of ordinary and + necessary expenses related to the sales of recreational use products reported on Schedule DFE + (line 16). An LLC that has elected to be treated as a disregarded entity for federal purposes, + and also elected to operate on a for-profit basis may subtract the total amount of ordinary + and necessary expenses related to the sales of recreational use products reported on Schedule + DFE (line 16).} + ; +OS_Q {S Corporation shareholders of an Arizona Marijuana Establishment, Marijuana Testing Facilities and + dual licensees that operate on a for-profit basis: enter the amount of your pro-rata share of + ordinary and necessary expenses related to the sales of recreational use products as shown on + your 120S Schedule K-1, line 7.} + ; +OS_R {Net Capital Gain Derived From the Exchange of One Kind of Legal Tender for Another Kind of Legal + Tender: See instructions.} + ; +OS_S {Value of Virtual Currency and Non-Fingible Tokens Receieved at Time of Airdrop.} ; +OS_T {Gas Fees not included in Virtual Currency and Non-Fingible Tokens Basis.} ; +OS_U {Arizona Families Tax Rebate.} ; +OS_V {Other Adjustments - see instructions.} ; + + { --- Other Exemptions: Complete Dependent and Other Exemption Information, Part 3 ---} +L40e {Total number of qualifying individuals} + ; + { --- Balance of Tax } +L43_Deductions: Standard {Deductions to use? (answer: Itemized, Standard) } +L43 {Deductions Amount - this will be calculated if 'Standard' is selected} + ; + { + -------------- Standard Deductions Increase for Charitable Contributions -------------- + Worksheet + Complete and include with return, to determine your allowable increased standard deduction + for charitable contributions. This worksheet may be skipped if itemizing deductions. +} +SD1C {Tax Year gifts by cash or check} + ; +SD2C {Tax Year gifts other than by cash or check} + ; +SD3C {Carryover from prior year} + ; +SD5C {Total charitable contributions made in Tax Year for which you + are claiming a credit under AZ law for the current or prior + tax year} + ; + { --- end of Charitable Contributions Worksheet for Standard Deductions --- } +L47 {Tax from Recapture of Credits (from Arizona Form 301, Part 2, line 32)} + ; +L49 {Dependent Tax Credit -- see instructions} + ; +L50 {Family income tax credit -- see instructions} + ; +L51 {Nonrefundable Credits (from Arizona Form 301, Part 2, line 64)} + ; + { --- Total Payments and Refundable Credits --- } +L53 {Tax Year AZ Income Tax Withheld} + ; +L54a {Tax Year AZ estimated tax payments} + ; +L54b {Tax Year AZ Claim of Right: Complete & include AZ Claim of Right-Individual form(s)} + ; +L55 {Tax Year AZ extension payment (AZ Form 204) } + ; +L56 {Increased Excise Tax Credit. See instructions.} + ; +L57 {Property Tax Credit (from AZ Form 140PTC, Page 1, line 15)} + ; +L58_Filing308I: No { Are you filing AZ Form 308-I? (answer: Yes, No) } +L58_Filing334: No { Are you filing AZ Form 334? (answer: Yes, No) } +L58_Filing349: No { Are you filing AZ Form 349? (answer: Yes, No) } +L58 {Other Refundable Credits (from AZ forms 308-I and/or 349)} + ; + { --- Tax Due or Overpayment --- } +L62 {Amount of overpayment (if any) to be applied to next year's estimated taxes} + ; + { --- Voluntary Gifts --- } +L64 {Solutions Teams Assigned to Schools Fund} + ; +L65 {Arizona Wildlife Fund} + ; +L66 {Child Abuse Prevention Fund} + ; +L67 {Domestic Violence Services Fund} + ; +L68 {Political Gift (Democratic/Libertarian/Republican only)} + ; +L69 {Neighbors Helping Neighbors Fund} + ; +L70 {Special Olympics Fund} + ; +L71 {Veterans' Donations Fund} + ; +L72 {I Didn't Pay Enough Fund} + ; +L73 {Sustainable State Parks and Roads Fund} + ; +L74 {Spaying and Neutering of Animals Fund} + ; +L75_PoliticalParty none {Political Party receiving gift? (answer: none, Democratic, Libertarian, Republican) } + { --- Penalty --- } +L76 {Estimated Payment Penalty} + ; +L77_1AnnualizedOther: No { Annualized/Other? (answer: Yes, No) } +L77_2FarmerFisherman: No { Farmer or Fisherman? (answer: Yes, No) } +L77_Filing221: No { Are you filing AZ Form 221? (answer: Yes, No) } + { --- Refund or Amount Owed ---} +L79_ForeignAcct: No { Will your deposit be ultimately placed in a foreign account? (answer: Yes, No) } diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/AZ_140/AZ_140_2022_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/AZ_140/AZ_140_2022_template.txt new file mode 100755 index 0000000..a27ebaa --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/AZ_140/AZ_140_2022_template.txt @@ -0,0 +1,246 @@ +Title: AZ State Tax Form 140 - 2023 + +FileName1040: tax_form_files/US_1040/US_1040_example_out.txt { File-name of Federal Return output file. } + { Data is collected by scanning Federal return to avoid re-entering it. } + +{ - - - - - - - - -- - - - - - - - - } + +DaytimePhone#: { Daytime Phone Number. } + +PriorLastNames: { Last Names used in last 4 prior years, if different. } + +{ --- Filing Status --- } +L4a_InjuredSpouse: No {Injured Spouse Protection of Joint Overpayment? -- married joint filers only (answer: Yes, No) } + +{ --- Exemptions --- } +L8 { Number of filers age 65+ - you and/or spouse } ; +L9 { Number of filers blind - you and/or spouse } ; +L10a { Number of Dependents under age of 17 - NOTE: some info must be added manually to form for dependents, if any} ; +L10b { Number of Dependents age 17 and over - NOTE: some info must be added manually to form for dependents, if any} ; +L11a { Number of Qualifying parents and grandparents } ; + +{ --- Qualifying Parent/Grandparent Exemption Information --- } +L11_NeedMoreSpace: No { Need more space to list? Complete page 4 part 2. (answer: Yes, No) } +{ --- } + +L11b_PG1_FirstName: { First Parent/Grandparent Exemption's first-name. } +L11b_PG1_LastName: { First Parent/Grandparent Exemption's last-name. } +L11b_PG1_SocSec#: { First Parent/Grandparent Exemption's Social Security number. } +L11b_PG1_Relation: { First Parent/Grandparent Exemption's relationship. } +L11b_PG1_Months: { First Parent/Grandparent Exemption's Months lived in home in tax year. } +L11b_PG1_65Over: No { Age 65 or over? (answer: Yes, No) } +L11b_PG1_DiedTaxYr: No { Died during tax year? (answer: Yes, No) } + +{ --- } + +L11c_PG2_FirstName: { Second Parent/Grandparent Exemption's first-name. } +L11c_PG2_LastName: { Second Parent/Grandparent Exemption's last-name. } +L11c_PG2_SocSec#: { Second Parent/Grandparent Exemption's Social Security number. } +L11c_PG2_Relation: { Second Parent/Grandparent Exemption's relationship. } +L11c_PG2_Months: { Second Parent/Grandparent Exemption's Months lived in home in tax year. } +L11c_PG2_65Over: No { Age 65 or over? (answer: Yes, No) } +L11c_PG2_DiedTaxYr: No { Died during tax year? (answer: Yes, No) } + +{ --- Additions --- } + +L13_Filing140SBI: No { Are you filing AZ Form 140-SBI? (answer: Yes, No) } +L13 {Small Business Income} ; +L15 {Non-Arizona municipal interest} ; +L16 {Partnership Income adjustment} ; +L17 {Total amount of depreciation deducted on your federal return. } ; +{ L18: Other Additions to Income: Review Other Additions to AZ Gross Income schedule, below } + +{ + -------------------------- Other Additions to Arizona Gross Income -------------------------- + Schedule + Complete and include with your AZ tax return ONLY if you are making any adjustments INCREASING + your AZ Gross Income. See instructions for more information. + +} + +OA_A {Married Persons Filing Separate Returns} ; +OA_B {Arizona Form 141AZ Sched K-1 Fiduciary Adjustment} ; +OA_C {Ordinary Income Portion of Lump-Sum Distributions Excluded on Your Federal Return} ; +OA_D {Items Previously Deducted for Arizona Purposes} ; +OA_E {Claim of Right Adjustment for Amounts Repaid in Tax Year} ; +OA_Fa {Claim of Right Adjustment for Amounts Repaid in Prior Taxable years} ; +OA_Fb {Adjustment for Net Operating Loss due to Claim of Right} ; +OA_Ga {Addition for Expenses Due to Claiming Credit 312. See instructions.} ; +OA_Gb {Addition to S Corp Income for Expenses Due to Claiming Pass-Through + Credit on Form 312. See Instructions.} ; +OA_Ha {Adjusted Basis in Property for Which You Have Claimed a Credit for Investment + in Qualified Small Businesses (Form 338) that was sold or otherwise disposed + of during the tax year. See instructions.} ; +OA_Hb {Adjusted Basis in Property for Which You Have Claimed a Credit for Agricultural + Pollution Control Equipment (Form 325) that was sold or otherwise disposed + of during the tax year. See instructions.} ; +OA_Hc {Adjusted Basis in Property for Which You Claimed a Credit for Pollution Control + Equipment (Form 315) Before this Taxable Year that was sold or otherwise disposed + of during the tax year. See Instructions.} ; +OA_I {Nonqualified Withdrawals from 529 College Savings Plans.} ; +OA_J {Sole Proprietorship Loss of an Arizona Nonprofit Medical Marijuana Dispensary + Included in Federal Adjusted Gross Income. Sole Proprietorship loss of an AZ + dual licensee that has not elected to operate on a for-profit basis must also add + back the portion of their loss that is from the medical marijuana portion of the + business that is included in their federal adjusted gross income.} ; +OA_K {Federal Net Operating Loss (NOL) Carryforward from Non-AZ Sources Accrued While + a Nonresident.} ; +OA_L {Federal Capital Loss Carryforward Deduction Incurred from Non-AZ Sources prior to + AZ Residency.} ; +OA_M {Americans with Disabilities Act - Access Expenditures.} ; +OA_N {Amortization or Depreciation for Child Care Facility before 1990.} ; +OA_O {Net Capital Loss Derived From the Exchange of One Kind of Legal Tender for Another + Kind of Legal Tender: See instructions.} ; +OA_P {Entity-level Income Tax Payment. See instructions.} ; +OA_Q {Motion Picture Production Costs. See instructions.} ; +OA_R {Other Adjustments Related to Tax Credits. See instructions.} ; +OA_S {Other Adjustments. See instructions.} ; + + +{ --- Subtractions --- +See instructions for more information. +} + +L20 0 {Total Net Capital Gain/Loss from federal return} ; +L21 0 {Total Net Short-Term Capital Gain/Loss from federal Schedule D} ; +L22 0 {Total Net Long-Term Capital Gain/Loss from federal Schedule D} ; +L23 0 {Net Long-Term Capital Gain from Assets Acquired After Dec. 31, 2011 (acq. date must be verifiable)} ; +L25 {Net Capital Gain from Investment in an Arizona Qualified Small Business} ; +L26 {Recalculated Arizona Depreciation} ; +L27 {Partnership Income Adjustment. See instructions.} ; +L28 {Interest on U.S. Obligations} ; +L29a {Exclusion for U.S. Gov't, AZ State or Local Gov't Pensions} ; +L29b {Exclusion for Ret'd or Retainer Pay of the Uniformed Services of the U.S.} ; +L30 {U.S. Social Security Benefits or Railroad Retirement Benefits (federally taxable amt only)} ; +L31 {Certain Wages of American Indians} ; +L32 {Pay Rec'd for Active Service as a Mbr. of the Reserves, Nat'l Guard or the U.S. Armed Forces} ; +L33 {Net Operating Loss Adjustment. See instructions.} ; +L34a {Contributions to 529 College Savings Plans} ; +L34b {Contributions to 529A (ABLE Accounts)} ; + +{ --- Exemptions --- } + +{L36: Other Subtractions from Income: Review Other Subtraction from AZ Gross Income schedule, below } + +{ + -------------------------- Other Subtractions to Arizona Gross Income -------------------------- + Schedule + Complete and include with your AZ tax return ONLY if you are making any adjustments DECREASING + your AZ Gross Income. See instructions for more information. + +} + +OS_A {Married Persons Filing Separate Returns} ; +OS_B {Arizona Form 141AZ Sched K-1 Fiduciary Adjustment} ; +OS_C {Federally Taxable Arizona Municipal Interest as Evidenced by Bonds.} ; +OS_D {Adoption Expense.} ; +OS_E {Qualified Wood Stove, Wood Fireplace or Gas-Fired Fireplace.} ; +OS_F {Claim of Right Adjustment for Amounts Repaid in Taxable Years} ; +OS_G {Certain Expenses Not Allowed for Federal Purposes (due to claiming federal tax credits).} ; +OS_H {Qualified State Tuition Distributions.} ; +OS_I {Installment Sale Income from Another State Taxed by the Other State in a Prior Taxable Year.} ; +OS_J {Agricultural Crops Given to Arizona Charitable Organizations.} ; +OS_K {Basis Adjustment for Property Sold or Otherwise Displosed of During the Taxable Year.} ; +OS_L {Sole Proprietorship Income of an Arizona Nonprofit Medical Marijuana Dispensary Included in + Federal Adjusted Gross Income. In addition, Sole Proprietorship income of an Arizona + dual licensee that has NOT ELECTED to operate on a for-profit basis may subtract the + portion of their federal taxable income that is from the medical marijuana portion of + the business.} ; +OS_M {Long-Term Care Insurance Premiums.} ; +OS_N {Americans with Disabilities Act - Access Expenditures.} ; +OS_O {Exploration Expensis Deferred before January 1, 1990.} ; +OS_P {Sole Proprietorship of an Arizona Marijuana Establishment, Marijuana Testing Facilities and + dual licensees that operate on a for-profit basis: enter the total amount of ordinary and + necessary expenses related to the sales of recreational use products reported on Schedule DFE + (line 16). An LLC that has elected to be treated as a disregarded entity for federal purposes, + and also elected to operate on a for-profit basis may subtract the total amount of ordinary + and necessary expenses related to the sales of recreational use products reported on Schedule + DFE (line 16).} ; +OS_Q {S Corporation shareholders of an Arizona Marijuana Establishment, Marijuana Testing Facilities and + dual licensees that operate on a for-profit basis: enter the amount of your pro-rata share of + ordinary and necessary expenses related to the sales of recreational use products as shown on + your 120S Schedule K-1, line 7.} ; +OS_R {Net Capital Gain Derived From the Exchange of One Kind of Legal Tender for Another Kind of Legal + Tender: See instructions.} ; +OS_S {Value of Virtual Currency and Non-Fingible Tokens Receieved at Time of Airdrop.} ; +OS_T {Gas Fees not included in Virtual Currency and Non-Fingible Tokens Basis.} ; +OS_U {Arizona Families Tax Rebate.} ; +OS_V {Other Adjustments - see instructions.} ; + +{ --- Other Exemptions: Complete Dependent and Other Exemption Information, Part 3 ---} +L40e {Total number of qualifying individuals} ; + +{ --- Balance of Tax } + +L43_Deductions: Standard {Deductions to use? (answer: Itemized, Standard) } +L43 {Deductions Amount - this will be calculated if 'Standard' is selected} ; + +{ + -------------- Standard Deductions Increase for Charitable Contributions -------------- + Worksheet + Complete and include with return, to determine your allowable increased standard deduction + for charitable contributions. This worksheet may be skipped if itemizing deductions. +} + +SD1C {Tax Year gifts by cash or check} ; +SD2C {Tax Year gifts other than by cash or check} ; +SD3C {Carryover from prior year} ; + +SD5C {Total charitable contributions made in Tax Year for which you + are claiming a credit under AZ law for the current or prior + tax year} ; + +{ --- end of Charitable Contributions Worksheet for Standard Deductions --- } + +L47 {Tax from Recapture of Credits (from Arizona Form 301, Part 2, line 32)} ; +L49 {Dependent Tax Credit -- see instructions} ; +L50 {Family income tax credit -- see instructions} ; +L51 {Nonrefundable Credits (from Arizona Form 301, Part 2, line 64)} ; + +{ --- Total Payments and Refundable Credits --- } + +L53 {Tax Year AZ Income Tax Withheld} ; +L54a {Tax Year AZ estimated tax payments} ; +L54b {Tax Year AZ Claim of Right: Complete & include AZ Claim of Right-Individual form(s)} ; +L55 {Tax Year AZ extension payment (AZ Form 204) } ; +L56 {Increased Excise Tax Credit. See instructions.} ; +L57 {Property Tax Credit (from AZ Form 140PTC, Page 1, line 15)} ; +L58_Filing308I: No { Are you filing AZ Form 308-I? (answer: Yes, No) } +L58_Filing334: No { Are you filing AZ Form 334? (answer: Yes, No) } +L58_Filing349: No { Are you filing AZ Form 349? (answer: Yes, No) } +L58 {Other Refundable Credits (from AZ forms 308-I and/or 349)} ; + +{ --- Tax Due or Overpayment --- } + +L62 {Amount of overpayment (if any) to be applied to next year's estimated taxes} ; + +{ --- Voluntary Gifts --- } + +L64 {Solutions Teams Assigned to Schools Fund} ; +L65 {Arizona Wildlife Fund} ; +L66 {Child Abuse Prevention Fund} ; +L67 {Domestic Violence Services Fund} ; +L68 {Political Gift (Democratic/Libertarian/Republican only)} ; +L69 {Neighbors Helping Neighbors Fund} ; +L70 {Special Olympics Fund} ; +L71 {Veterans' Donations Fund} ; +L72 {I Didn't Pay Enough Fund} ; +L73 {Sustainable State Parks and Roads Fund} ; +L74 {Spaying and Neutering of Animals Fund} ; +L75_PoliticalParty none {Political Party receiving gift? (answer: none, Democratic, Libertarian, Republican) } + +{ --- Penalty --- } + +L76 {Estimated Payment Penalty} ; +L77_1AnnualizedOther: No { Annualized/Other? (answer: Yes, No) } +L77_2FarmerFisherman: No { Farmer or Fisherman? (answer: Yes, No) } +L77_Filing221: No { Are you filing AZ Form 221? (answer: Yes, No) } + +{ --- Refund or Amount Owed ---} + +L79_ForeignAcct: No { Will your deposit be ultimately placed in a foreign account? (answer: Yes, No) } + + + + + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/AZ_140/README_AZ_140.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/AZ_140/README_AZ_140.txt new file mode 100755 index 0000000..df9721f --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/AZ_140/README_AZ_140.txt @@ -0,0 +1,22 @@ +Open Tax Solver - AZ Form 140 - Resident Personal Income Tax Return +------------------------------------------------------------------- + +Included here is a program, template, and example for +AZ Form 140. + +The example*.txt file is included for testing. +The template*.txt file is a blank starting form for entering +your tax data. Copy template to a new name, +such as "AZ_140_2023.txt" and fill-in the lines. + +Run (substituting your new file name for "AZ_140.txt"): + ../../bin/taxsolve_AZ_1040 AZ_140.txt + + +For updates and further information, see: + http://sourceforge.net/projects/opentaxsolver/ +Documentation: + http://opentaxsolver.sourceforge.net/ + + +Contributed by E. Strnod diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/CA_540/CA_540_2024_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/CA_540/CA_540_2024_example.txt new file mode 100755 index 0000000..304314d --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/CA_540/CA_540_2024_example.txt @@ -0,0 +1,180 @@ +Title: CA State Tax Form 540 - 2024 -- Example + +{ --- Example --- } + +FileName tax_form_files/US_1040/US_1040_example_out.txt { File-name of Federal Return output file. } + { Data is collected by scanning Federal return to avoid re-entering it. } + +CountyName: San Bernardino { Name of your County at time of filing. } +CkSameAddress: Yes { Same residence address at time of filing ? (answer: Yes, No ) } + +{--Exemptions--} +L6 no { Are you a dependent? (answer: Yes, No) } +L8 0 { Blind? (answer: 0, 1, 2) - Enter 0 if not blind, 1 if you or spouse, 2 if both. } +L9 1 { Over 65? (answer: 0, 1, 2) - Enter 1 if you or spouse over 65, 2 if both over 65, + 0 if neither} +L10 1 { Number or dependents - (answer: 0, 1, 2, 3, 4, ...). + (Do not include yourself or spouse)} + +{--Taxable Income--} +L12 29,812.34 { State Wages (List all W2's box 16). } + 21,609.09 ; + +{--California Adjustments--} + { - Section A - } +CA540_Subtr_A1a 1 ; { Subtractions for W-2 box 1 Wages } +CA540_Addit_A1a 2 ; { Additions for W-2 box 1 Wages } + +CA540_Subtr_A1b 3 ; { Subtractions for household employee Wages, not on W-2 } +CA540_Addit_A1b 4 ; { Additions for household employee Wages, not on W-2 } + +CA540_Subtr_A1c 5 ; { Subtractions for Tip income not reported on A1a above } +CA540_Addit_A1c 6 ; { Additions for Tip income not reported on A1a above } + +CA540_Subtr_A1d 7 ; { Subtractions Medicaid waiver payments not on W-2 } +CA540_Addit_A1d 8 ; { Additions for Medicaid waiver payments not on W-2 } + +CA540_Subtr_A1e 9 ; { Subtractions Taxable dependent care benefits } +CA540_Addit_A1e 10 ; { Additions for Taxable dependent care benefits } + +CA540_Subtr_A1f 11 ; { Subtractions Employer-provided adoption benefits } +CA540_Addit_A1f 12 ; { Additions for Employer-provided adoption benefits } + +CA540_Subtr_A1g 13 ; { Subtractions Wages from Fed Form 8919 line 6 } +CA540_Addit_A1g 14 ; { Additions for Wages from Fed Form 8919 line 6 } + +CA540_Subtr_A1h 15 ; { Subtractions Other earned income } +CA540_Addit_A1h 16 ; { Additions for Other earned income } + +CA540_Addit_A1i 17 ; { Additions for Nontaxable combat pay election } + +CA540_Subtr_A2 22 ; { Subtractions for Taxable interest } +CA540_Addit_A2 2 ; { Additions for Taxable interest } +CA540_Subtr_A3 33 ; { Subtractions for Ordinary dividends. } +CA540_Addit_A3 3 ; { Additions for Ordinary dividends. } +CA540_Subtr_A4 44 ; { Subtractions for IRAs. } +CA540_Addit_A4 4 ; { Additions for IRAs. } +CA540_Subtr_A5 55 ; { Subtractions for pensions and annuities. } +CA540_Addit_A5 5 ; { Additions for pensions and annuities. } +CA540_Subtr_A7 77 ; { Subtractions for Capital gain or loss. } +CA540_Addit_A7 7 ; { Additions for Capital gain or loss. } + { - Section B - } +CA540_Subtr_B1 1 ; { Subtractions for Taxable refunds, credits, ... } +CA540_Addit_B2 2 ; { Additions for Alimony received } +CA540_Subtr_B3 2300 ; { Subtractions for Business income or loss } +CA540_Addit_B3 3 ; { Additions for Business income or loss } +CA540_Subtr_B4 4 ; { Subtractions for Other gains or losses } +CA540_Addit_B4 5 ; { Additions for Other gains } +CA540_Subtr_B5 6 ; { Subtractions for Rental real estate, royalties, partnerships} +CA540_Addit_B5 7 ; { Additions for Rental real estate, royalties, partnerships } +CA540_Subtr_B6 8 ; { Subtractions for Farm income } +CA540_Addit_B6 9 ; { Additions for Farm income } +CA540_Subtr_B7 10 ; { Subtractions for Unemployment compensation } +CA540_Addit_B8a 11 ; { Additions for Federal net operating loss } +CA540_Subtr_B8b 12 ; { Subtractions for Gambling income } +CA540_Subtr_B8c 31 ; { Subtractions for Cancellation of debt } +CA540_Addit_B8c 13 ; { Additions for Cancellation of debt } +CA540_Addit_B8d 14 ; { Additions for Foreign earned income exclusion } +CA540_Addit_B8e 15 ; { Additions for Taxable Health Savings Account distribution } +CA540_Subtr_B8f 51 ; { Subtractions for Income from Form 8889 } +CA540_Addit_B8k 52 ; { Additions for stock options } +CA540_Subtr_B8n 16 ; { Subtractions for IRC Section 951(a) inclusion } +CA540_Subtr_B8o 17 ; { Subtractions for IRC Section 951A(a) inclusion } +CA540_Subtr_B8p 18 ; { Subtractins for RC Section 461(l) excess business loss adjustment } +CA540_Addit_B8p 180 ; { Additions for RC Section 461(l) excess business loss adjustment } +CA540_Subtr_B8v 19 ; { Subtractions for Digital assets received as ordinary income } +CA540_Addit_B8v 20 ; { Additions for Digital assets received as ordinary income } +CA540_Subtr_B8z 21 ; { Subtractions for Other income. } +CA540_Addit_B8z 22 ; { Additions for Other income. } + + { - Section C - } +CA540_Subtr_C11 19 ; { Subtractions for Educator expenses } +CA540_Subtr_C12 20 ; { Subtractions for Certain business expenses } +CA540_Addit_C12 21 ; { Additions for Certain business expenses } +CA540_Subtr_C13 21 ; { Subtractions for Health savings account } +CA540_Addit_C14 23 ; { Additions for Moving Expenses } +CA540_Subtr_C15 3.33 ; { Subtractions for Deductible part of self-employment tax. } +CA540_Subtr_C17 2.22 ; { Subtractions for Self-employed health insurance deduction. } +CA540_Addit_C19 24 ; { Additions for Alimony paid } +CA540_AlimonyRecipName: Morgan { Alimony Receipient's Last name } +CA540_Subtr_C20 25 ; { Subtractions for IRA deduction } +CA540_Addit_C20 25 ; { Additions for IRA deduction } +CA540_Addit_C21 26 ; { Additions for Student loan interest } +CA540_Subtr_C24b 27 ; { Subtractions for Deductible expenses from rental personal property } +CA540_Addit_C24b 28 ; { Additions for Deductible expenses from the rental of personal property } +CA540_Subtr_C24c 29 ; { Subtractions for Nontaxable Olympic, Paralympic medals & USOC prize money } +CA540_Subtr_C24d 30 ; { Subtractions for Reforestation amortization and expenses } +CA540_Subtr_C24f 31 ; { Subtractions for Contributions to IRC 501(c)(18)(D) pension plans } +CA540_Addit_C24f 32 ; { Additions for Contributions to IRC 501(c)(18)(D) pension plans } +CA540_Subtr_C24g 33 ; { Subtractions for Contributions by certain chaplains to IRC 403(b) plans } +CA540_Addit_C24g 34 ; { Additions for Contributions by certain chaplains to IRC 403(b) plans } +CA540_Subtr_C24i 35 ; { Subtractions for fees paid for information to detect tax violations } +CA540_Subtr_C24j 36 ; { Subtractions for Housing deduction from federal Form 2555 } +CA540_Subtr_C24k 37 ; { Subtractions for Excess deductions IRC Section 67(e) expenses } +CA540_Subtr_C24z 38 ; { Subtractions for Other adjustments. } +CA540_Addit_C24z 39 ; { Additions for Other adjustments. } + + +{--Part-II of California Adjustments--} +CA540_P2_Add_4 4 ; { Subtractions for Medical and Dental Expenses } +CA540_P2_Sub_5a 27 ; { Subtractions for State and local income tax or general sales taxes } +CA540_P2_Sub_6 28 ; { Subtractions for Other taxes } +CA540_P2_Add_6 29 ; { Additions for Other taxes } +CA540_P2_Add_8a 30 ; { Additions for home mortgage interest & points reported on Form 1098 } +CA540_P2_Add_8b 31 ; { Additions for home mortgage interest not reported on Form 1098 } +CA540_P2_Add_8c 32 ; { Additions for points not reported on Form 1098 } +CA540_P2_Sub_9 34 ; { Subtractions for investment interest } +CA540_P2_Add_9 35 ; { Additions for investment interest } +CA540_P2_Sub_11 36 ; { Subtractions for Gifts by cash or check } +CA540_P2_Add_11 37 ; { Additions for Gifts by cash or check } +CA540_P2_Sub_12 38 ; { Subtractions for Gifts other than by cash or check } +CA540_P2_Add_12 39 ; { Additions for Gifts other than by cash or check } +CA540_P2_Sub_13 40 ; { Subtractions for Carryover from prior year } +CA540_P2_Add_13 41 ; { Additions for Carryover from prior year } +CA540_P2_Sub_15 42 ; { Subtractions for Casualty or theft loss(es) } +CA540_P2_Add_15 43 ; { Additions for Casualty or theft loss(es) } +CA540_P2_Sub_16 44 ; { Subtractions for Other-from list in federal instructions } +CA540_P2_Add_16 45 ; { Additions for Other-from list in federal instructions } +CA540_P2_19 46 ; { Unreimbursed employee expenses } +CA540_P2_20 47 ; { Tax preparation fees } +CA540_P2_21 48 ; { Other expenses - investment, safe deposit box, etc. } + +{--Tax Section--} + L34 49 ; { Taxes on distributions (sched G-1 or form FTB 5870A), else 0. } + +{--Special Credits--} + L40 50 ; { Nonrefundable Child + Dependent Care Expenses Credit (pg 11). } + L43 51 ; { Special credit, else enter 0 } + L44 52 ; { Special credit, else enter 0 } + L45 53 ; { More then two credits (pg 12), else enter 0 } + L46 54 ; { Nonrefundable renter's credit (pg 12), else 0 } + +{--Other Taxes--} + L61 55 ; { Alternative minimum tax Sched P (540), else 0 } + L62 56 ; { Mental Health Services Tax. (Instructions pg 13) } + L63 57 ; { Other taxes/credit recapture (pg 13), else 0 } + +{--Payments--} + L71 1,119.20 ; { CA state income tax withheld. } + L72 67.21 ; { Estimated tax paid (pg 13). } + L73 59 ; { Realestate withholing (forms 592-B, 594, 597) (see pg 13). } + L75 61 ; { Earned Income Tax Credit (EITC). } + L76 62 ; { Young Child Tax Credit (YCTC). } + L77 32.10 ; { Net Premium Assistance Subsidy (PAS). } + + L91 50.00 ; { Use Tax. } + CkPayedUseTaxCDTFA ; { Answer Yes if Use Tax was paid directly to CDTFA. (answer: Yes, No) } + CkFYHealthCoverage ; { You and your household had full-year health care coverage. (answer: Yes, No) } + L92 40.00 ; { Individual Shared Responsibility (ISR) Penalty. } + L98 63 ; { Amount of refund you want applied to 2024 estimated teaxes. } + + L112 64 ; { Interest, late penalties. } + L113 65 ; { Underpayment of estimated tax penalty. (FTB 5805) } + +{ -------------------------------------------- } +{ --- Optional info for Auto-Fillout only. --- } + YourDOB: 11/3/1978 + SpouseDOB: 2/8/1975 + + WantHealthInfo No { Do you want information about low-cost health coverage ? (answer: Yes, No) } + Discuss No { Do you want to allow another person to discuss this return ? (answer: Yes, No) } diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/CA_540/CA_540_2024_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/CA_540/CA_540_2024_template.txt new file mode 100755 index 0000000..3a93378 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/CA_540/CA_540_2024_template.txt @@ -0,0 +1,182 @@ +Title: CA State Tax Form 540 - 2024 + + { Data is collected by scanning Federal Return results to avoid re-entering data. } + +FileName tax_form_files/US_1040/fed_out.txt { File-name of Federal Return output file. } + +CountyName: { Name of your County at time of filing. } +CkSameAddress: Yes { Same residence address at time of filing ? (answer: Yes, No ) } + + +{--Exemptions--} +L6 no { Are you a dependent? (answer: Yes, No) } +L8 0 { Blind? (answer: 0, 1, 2) - Enter 0 if not blind, 1 if you or spouse, 2 if both. } +L9 0 { Over 65? (answer: 0, 1, 2) - Enter 1 if you or spouse over 65, 2 if both over 65, + 0 if neither} +L10 0 { Number or dependents - (answer: 0, 1, 2, 3, 4, ...). + (Do not include yourself or spouse) } + +{--Taxable Income--} +L12 { State Wages (List all W2's box 16). } + ; +{--Part-I of California Adjustments--} + { - Section A - } +CA540_Subtr_A1a ; { Subtractions for W-2 box 1 Wages } +CA540_Addit_A1a ; { Additions for W-2 box 1 Wages } + +CA540_Subtr_A1b ; { Subtractions for household employee Wages, not on W-2 } +CA540_Addit_A1b ; { Additions for household employee Wages, not on W-2 } + +CA540_Subtr_A1c ; { Subtractions for Tip income not reported on A1a above } +CA540_Addit_A1c ; { Additions for Tip income not reported on A1a above } + +CA540_Subtr_A1d ; { Subtractions Medicaid waiver payments not on W-2 } +CA540_Addit_A1d ; { Additions for Medicaid waiver payments not on W-2 } + +CA540_Subtr_A1e ; { Subtractions Taxable dependent care benefits } +CA540_Addit_A1e ; { Additions for Taxable dependent care benefits } + +CA540_Subtr_A1f ; { Subtractions Employer-provided adoption benefits } +CA540_Addit_A1f ; { Additions for Employer-provided adoption benefits } + +CA540_Subtr_A1g ; { Subtractions Wages from Fed Form 8919 line 6 } +CA540_Addit_A1g ; { Additions for Wages from Fed Form 8919 line 6 } + +CA540_Subtr_A1h ; { Subtractions Other earned income } +CA540_Addit_A1h ; { Additions for Other earned income } + +CA540_Addit_A1i ; { Additions for Nontaxable combat pay election } + +CA540_Subtr_A2 ; { Subtractions for Taxable interest } +CA540_Addit_A2 ; { Additions for Taxable interest } +CA540_Subtr_A3 ; { Subtractions for Ordinary dividends. } +CA540_Addit_A3 ; { Additions for Ordinary dividends. } +CA540_Subtr_A4 ; { Subtractions for IRAs. } +CA540_Addit_A4 ; { Additions for IRAs. } +CA540_Subtr_A5 ; { Subtractions for pensions and annuities. } +CA540_Addit_A5 ; { Additions for pensions and annuities. } +CA540_Subtr_A7 ; { Subtractions for Capital gain or loss. } +CA540_Addit_A7 ; { Additions for Capital gain or loss. } + { - Section B - } +CA540_Subtr_B1 ; { Subtractions for Taxable refunds, credits, ... } +CA540_Addit_B2 ; { Additions for Alimony received } +CA540_Subtr_B3 ; { Subtractions for Business income or loss } +CA540_Addit_B3 ; { Additions for Business income or loss } +CA540_Subtr_B4 ; { Subtractions for Other gains or losses } +CA540_Addit_B4 ; { Additions for Other gains } +CA540_Subtr_B5 ; { Subtractions for Rental real estate, royalties, partnerships} +CA540_Addit_B5 ; { Additions for Rental real estate, royalties, partnerships } +CA540_Subtr_B6 ; { Subtractions for Farm income } +CA540_Addit_B6 ; { Additions for Farm income } +CA540_Subtr_B7 ; { Subtractions for Unemployment compensation } +CA540_Addit_B8a ; { Additions for Federal net operating loss } +CA540_Subtr_B8b ; { Subtractions for Gambling income } +CA540_Subtr_B8c ; { Subtractions for Cancellation of debt } +CA540_Addit_B8c ; { Additions for Cancellation of debt } +CA540_Addit_B8d ; { Additions for Foreign earned income exclusion } +CA540_Addit_B8e ; { Additions for Taxable Health Savings Account distribution } +CA540_Subtr_B8f ; { Subtractions for Income from Form 8889 } +CA540_Addit_B8k ; { Additions for stock options } +CA540_Subtr_B8n ; { Subtractions for IRC Section 951(a) inclusion } +CA540_Subtr_B8o ; { Subtractions for IRC Section 951A(a) inclusion } +CA540_Subtr_B8p ; { Subtractins for RC Section 461(l) excess business loss adjustment } +CA540_Addit_B8p ; { Additions for RC Section 461(l) excess business loss adjustment } +CA540_Subtr_B8v ; { Subtractions for Digital assets received as ordinary income } +CA540_Addit_B8v ; { Additions for Digital assets received as ordinary income } +CA540_Subtr_B8z ; { Subtractions for Other income. } +CA540_Addit_B8z ; { Additions for Other income. } + + { - Section C - } +CA540_Subtr_C11 ; { Subtractions for Educator expenses } +CA540_Subtr_C12 ; { Subtractions for Certain business expenses } +CA540_Addit_C12 ; { Additions for Certain business expenses } +CA540_Subtr_C13 ; { Subtractions for Health savings account } +CA540_Addit_C14 ; { Additions for Moving Expenses } +CA540_Subtr_C15 ; { Subtractions for Deductible part of self-employment tax. } +CA540_Subtr_C17 ; { Subtractions for Self-employed health insurance deduction. } +CA540_Addit_C19 ; { Additions for Alimony paid } +CA540_AlimonyRecipName: { Alimony Receipient's Last name } +CA540_Subtr_C20 ; { Subtractions for IRA deduction } +CA540_Addit_C20 ; { Additions for IRA deduction } +CA540_Addit_C21 ; { Additions for Student loan interest } +CA540_Subtr_C24b ; { Subtractions for Deductible expenses from rental personal property } +CA540_Addit_C24b ; { Additions for Deductible expenses from the rental of personal property } +CA540_Subtr_C24c ; { Subtractions for Nontaxable Olympic, Paralympic medals & USOC prize money } +CA540_Subtr_C24d ; { Subtractions for Reforestation amortization and expenses } +CA540_Subtr_C24f ; { Subtractions for Contributions to IRC 501(c)(18)(D) pension plans } +CA540_Addit_C24f ; { Additions for Contributions to IRC 501(c)(18)(D) pension plans } +CA540_Subtr_C24g ; { Subtractions for Contributions by certain chaplains to IRC 403(b) plans } +CA540_Addit_C24g ; { Additions for Contributions by certain chaplains to IRC 403(b) plans } +CA540_Subtr_C24i ; { Subtractions for fees paid for information to detect tax violations } +CA540_Subtr_C24j ; { Subtractions for Housing deduction from federal Form 2555 } +CA540_Subtr_C24k ; { Subtractions for Excess deductions IRC Section 67(e) expenses } +CA540_Subtr_C24z ; { Subtractions for Other adjustments. } +CA540_Addit_C24z ; { Additions for Other adjustments. } + +{--Part-II of California Adjustments--} +CA540_P2_Add_4 ; { Subtractions for Medical and Dental Expenses } +CA540_P2_Sub_5a ; { Subtractions for State and local income tax or general sales taxes } +CA540_P2_Sub_6 ; { Subtractions for Other taxes } +CA540_P2_Add_6 ; { Additions for Other taxes } +CA540_P2_Add_8a ; { Additions for home mortgage interest & points reported on Form 1098 } +CA540_P2_Add_8b ; { Additions for home mortgage interest not reported on Form 1098 } +CA540_P2_Add_8c ; { Additions for points not reported on Form 1098 } +CA540_P2_Sub_9 ; { Subtractions for investment interest } +CA540_P2_Add_9 ; { Additions for investment interest } +CA540_P2_Sub_11 ; { Subtractions for Gifts by cash or check } +CA540_P2_Add_11 ; { Additions for Gifts by cash or check } +CA540_P2_Sub_12 ; { Subtractions for Gifts other than by cash or check } +CA540_P2_Add_12 ; { Additions for Gifts other than by cash or check } +CA540_P2_Sub_13 ; { Subtractions for Carryover from prior year } +CA540_P2_Add_13 ; { Additions for Carryover from prior year } +CA540_P2_Sub_15 ; { Subtractions for Casualty or theft loss(es) } +CA540_P2_Add_15 ; { Additions for Casualty or theft loss(es) } +CA540_P2_Sub_16 ; { Subtractions for Other-from list in federal instructions } +CA540_P2_Add_16 ; { Additions for Other-from list in federal instructions } +CA540_P2_19 ; { Unreimbursed employee expenses } +CA540_P2_20 ; { Tax preparation fees } +CA540_P2_21 ; { Other expenses - investment, safe deposit box, etc. } + +{--Tax Section--} + L34 ; { Taxes on distributions (sched G-1 or form FTB 5870A), else 0. } + +{--Special Credits--} + L40 ; { Nonrefundable Child + Dependent Care Expenses Credit (pg 11). } + L43 ; { Special credit, else enter 0 } + L44 ; { Special credit, else enter 0 } + L45 ; { More then two credits (pg 12), else enter 0 } + L46 ; { Nonrefundable renter's credit (pg 12), else 0 } + +{--Other Taxes--} + L61 ; { Alternative minimum tax Sched P (540), else 0 } + L62 ; { Mental Health Services Tax. (Instructions pg 13) } + L63 ; { Other taxes/credit recapture (pg 13), else 0 } + +{--Payments--} + L71 ; { CA state income tax withheld. } + L72 ; { Estimated tax paid (pg 13). } + L73 ; { Realestate withholing (forms 592-B, 594, 597) (see pg 13). } + L75 ; { Earned Income Tax Credit (EITC). } + L76 ; { Young Child Tax Credit (YCTC). } + L77 ; { Net Premium Assistance Subsidy (PAS). } + + L91 ; { Use Tax. } + CkPayedUseTaxCDTFA ; { Answer Yes if Use Tax was paid directly to CDTFA. (answer: Yes, No) } + CkFYHealthCoverage ; { You and your household had full-year health care coverage. (answer: Yes, No) } + L92 ; { Individual Shared Responsibility (ISR) Penalty. } + L98 ; { Amount of refund you want applied to 2024 estimated teaxes. } + + L112 ; { Interest, late penalties. } + L113 ; { Underpayment of estimated tax penalty. (FTB 5805) } + +{ -------------------------------------------- } +{ --- Optional info for Auto-Fillout only. --- } + YourDOB: + SpouseDOB: + + WantHealthInfo No { Do you want information about low-cost health coverage ? (answer: Yes, No) } + Discuss No { Do you want to allow another person to discuss this return ? (answer: Yes, No) } + +{ + --------------------------------------------- +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/CA_540/README_CA_540.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/CA_540/README_CA_540.txt new file mode 100755 index 0000000..c8e7837 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/CA_540/README_CA_540.txt @@ -0,0 +1,30 @@ +Open Tax Solver - California State Tax Return 540 for 2024 +---------------------------------------------------------- + +Included here is a program, template, and example for +California State tax form CA-540 for tax-year 2024. + +The example*.txt file is included for testing. +The template*.txt file is a blank starting form for entering +your tax data. For each filer, copy template file to a new name, +such as "CA_540_2024.txt" or "CA_540_2024_aunt_sally.txt, and +fill-in the lines. + +The program consist of two files: + taxsolve_CA_540_2024.c - main, customized for CA 540. + taxsolve_routines.c - general purpose base routines. + +Compile: + cc taxsolve_CA_540_2024.c -o taxsolve_CA_540_2024 + +Run: + ./taxsolve_CA_540_2024 CA_540_2024.txt + + +For updates and further information, see: + http://sourceforge.net/projects/opentaxsolver/ +Documentation: + http://opentaxsolver.sourceforge.net/ + + +Aston Roberts (aston_roberts@yahoo.com) diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_2210/Form_2210_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_2210/Form_2210_example.txt new file mode 100755 index 0000000..4ccc163 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_2210/Form_2210_example.txt @@ -0,0 +1,224 @@ +Title: Form 2210 for Tax Year 2024 + + {--- Your Identity --- } +YourName: Alexander Hamilton +YourSocSec#: 123-45-6789 +Entity Individual { Filing For? (answer: Individual, Estate/Trust) } +Status Married/Joint { Single, Married/Joint, Head_of_House, Married/Sep, Widow(er) } + {--- Part I Required Annual Payment --- } +L1 150000 ; { Enter your 2024 tax after credits from Form 1040, + 1040-SR, or 1040-NR, line 22. Estates or trusts, enter the + amount from Form 1041, Schedule G, line 3. See + instructions.} +L2 50000 ; { Other taxes, including self-employment tax and, if applicable, Additional Medicare Tax and/or + Net Investment Income Tax (see instructions)} +L3 1000 ; { Other payments and refundable credits + (see instructions)} +L6 40000 ; { Withholding taxes. Don't include estimated tax payments. + See instructions)} +L8 110000 ; { Maximum required annual payment based on prior year's + tax (see instructions)} + {--- Part II Reasons for Filing. If none apply, don't file Form 2210. ---} + { You request a waiver (see instructions) of your entire penalty. You must + check this box and file page 1 of Form 2210, but you aren't required to + figure your penalty. } +BoxA No { (answer: Yes, No) } + { You request a waiver (see instructions) of part of your penalty. You must + figure your penalty and waiver amount and file Form 2210.} +BoxB No { (answer: Yes, No) } + { Your income varied during the year and your penalty is reduced or + eliminated when figured using the annualized income installment method. + You must figure the penalty using Schedule Al and file Form 2210.} +BoxC Yes { (answer: Yes, No) } + { Your penalty is lower when figured by treating the federal income tax + withheld from your income as paid on the dates it was actually withheld, + instead of in equal amounts on the payment due dates. You must figure your + penalty and file Form 2210.} +BoxD No { (answer: Yes, No) } + { You filed or are filing a joint return for either 2023 or 2024, but not + for both years, and line 8 above is smaller than line 5 above. You must + file page 1 of Form 2210, but you aren't required to figure your penalty + (unless box B, C, or D applies).} +BoxE No { (answer: Yes, No) } + { Click "Save" to save this form and then click + "Compute Tax" to determine if you need to file Form 2210. If so, +return to this input form and continue.} + {--- Part III Section A ---} + { IMPORTANT: Note carefully the starting and ending dates for each period. + The periods all begin January 1. They are not calendar quarters!} +SecA_11a 16000 ; { Estimated tax paid and tax withheld for the period + 1/1/2024-3/31/2024, due 4/15/2024 (Estates and trusts: for the period + 1/1/2024-2/29/2024). See instructions.} +SecA_11b 30000 ; { Estimated tax paid and tax withheld for the period + 1/1/2024-5/31/2024, due 6/15/2024 (Estates and trusts: for the period + 1/1/2024-4/30/2024). See instructions.} +SecA_11c 8000 ; { Estimated tax paid and tax withheld for the period + 1/1/2024-8/31/2024, due 9/15/2024 (Estates and trusts: for the period + 1/1/2024-7/31/2024). See instructions.} +SecA_11d 25000 ; { Estimated tax paid and tax withheld for the period + 1/1/2024-12/31/2024, due 1/15/22 (Estates and trusts: for the period + 1/1/2024-11/30/2024). See instructions.} + {--- Schedule AI-Annualized Income Installment Method (See the instructions.) ---} + {--- Part I Annualized Income Installments ---} +SchdAI_1a 100000 ; { Enter your adjusted gross income for the period + 1/1/2024-3/31/2024. (Estates and trusts: enter your taxable + income without your exemption for the period + 1/1/2024-2/28/2024)} +SchdAI_1b 150000 ; { Enter your adjusted gross income for the period + 1/1/2024-5/31/2024. (Estates and trusts: enter your taxable + income without your exemption for the period + 1/1/2024-4/30/2024)} +SchdAI_1c 400000 ; { Enter your adjusted gross income for the period + 1/1/2024-8/31/2024. (Estates and trusts: enter your taxable + income without your exemption for the period + 1/1/2024-7/31/2024)} +SchdAI_1d 800000 ; { Enter your adjusted gross income for the period + 1/1/2024-12/31/2024. (Estates and trusts: enter your taxable + income without your exemption for the period + 1/1/2024-11/30/2024)} +SchdAI_4a ; { If you itemize, enter itemized deductions for the period + 1/1/2024-3/31/2024; otherwise, enter -0-. Estates and trusts: + enter "0". } +SchdAI_4b ; { If you itemize, enter itemized deductions for the period + 1/1/2024-5/31/2024; otherwise, enter -0-. Estates and trusts: + enter "0". } +SchdAI_4c ; { If you itemize, enter itemized deductions for the period + 1/1/2024-8/31/2024; otherwise, enter -0-. Estates and trusts: + enter "0". } +SchdAI_4d ; { If you itemize, enter itemized deductions for the period + 1/1/2024-12/31/2024; otherwise, enter -0-. Estates and + trusts: enter "0". } +SchdAI_7a 14350 ; { Enter the SUM of your standard deduction and line 12b from + Form 1040 or 1040-SR. (Form 1040- NR filers, enter + -0-. If you're a resident of India and a student or + business apprentice, enter your standard deduction from + Form 1040-NR, line 12.} +SchdAI_9a ; { Deduction for qualified business income for the period + 1/1/2024-3/31/2024. Estates and trusts: for the period + 1/1/2024-2/28/2024.} +SchdAI_9b ; { Deduction for qualified business income for the period + 1/1/2024-5/31/2024. Estates and trusts: for the period + 1/1/2024-4/30/2024.} +SchdAI_9c ; { Deduction for qualified business income for the period + 1/1/2024-8/31/2024. Estates and trusts: for the period + 1/1/2024-7/31/2024.} +SchdAI_9d 250 ; { Deduction for qualified business income for the period + 1/1/2024-12/31/2024. Estates and trusts: for the period + 1/1/2024-11/30/2024. } +SchdAI_12a 0 ; { Form 1040, 1040-SR, or 1040-NR filers, enter -0-. + Estates and trusts, use the exemption amount shown on your + return.} + { The following four fields are for entry of the tax due on the annualized + income extrapolated from the income and deductions during the respective + period. If you are able to use the tax tables or tax rate schedules, make + no entries in these fields, and the program will calculate the tax. This + will simplify your calculations; however, you may pay more estimated tax + than necessary.} + { If you have tax preference items, such as capital gains and/or qualified + dividends, you can reduce your estimated tax by using the Qualified + Dividends and Capital Gains Tax Worksheet or other appropriate worksheet to + calculate the annualized tax due each period. To do this, multiply each + item of income and each deduction that varies by period by the + annualization factor for that period to estimate your taxable income for + the year.} + { Period 1: 4 + Period 2: 2.4 + Period 3; 1.5 + Period 4: 1 } + { You may also have, and/or be eligible for, certain credits---some of + which may be based upon your estimated taxable income for the year. You + may be able to reduce one or more of your estimated tax payments by + including these credits in your tax calculation. You can use the 2024 + estimated tax version of OTS to calculate the tax due on your estimated + income for the year that was extrapolated from the information for the + relevant period. See instructions for form 2210 and IRS publication 505. +} +SchdAI_14a ; { Total tax for the year extrapolated from the period + 1/1/2024-3/31/2024. Estates and trusts: for the period + 1/1/2024-2/28/2024.} +SchdAI_14b ; { Total tax for the year extrapolated from the period + 1/1/2024-5/31/2024. Estates and trusts: for the period + 1/1/2024-4/30/2024.} +SchdAI_14c ; { Total tax for the year extrapolated from the period + 1/1/2024-8/31/2024. Estates and trusts: for the period + 1/1/2024-7/31/2024.} +SchdAI_14d ; { Total tax for the year extrapolated from the period + 1/1/2024-12/31/2024. Estates and trusts: for the period + 1/1/2024-11/30/2024.} +SchdAI_16a ; { Enter other taxes extrapolated from the period + 1/1/2024-3/31/2024 (Estates and trusts: for the period + 1/1/2024-2/28/2024), including, if applicable, Alternative + Minimum Tax, Additional Medicare Tax and/or Net Investment + Income Tax} +SchdAI_16b ; { Enter other taxes extrapolated from the period + 1/1/2024-5/31/2024. (Estates and trusts: for the period + 1/1/2024-4/30/2024), including, if applicable, Alternative + Minimum Tax, Additional Medicare Tax and/or Net Investment + Income Tax} +SchdAI_16c ; { Enter other taxes extrapolated from the period + 1/1/2024-8/31/2024. (Estates and trusts: for the period + 1/1/2024-7/31/2024), including, if applicable, Alternative + Minimum Tax, Additional Medicare Tax and/or Net Investment + Income Tax} +SchdAI_16d ; { Enter other taxes extrapolated from the period + 1/1/2024-12/31/2024. (Estates and trusts: for the period + 1/1/2024-11/30/2024), including, if applicable, Alternative + Minimum Tax, Additional Medicare Tax and/or Net Investment + Income Tax} +SchdAI_18a ; { Enter the same type of credits as allowed on Form 2210, + Part I, lines 1 and 3, extrapolated from the period + 1/1/2024-3/31/2024 (Estates and trusts: for the period + 1/1/2024-2/28/2024). See instructions.} +SchdAI_18b ; { Enter the same type of credits as allowed on Form 2210, + Part I, lines 1 and 3, extrapolated from the period + 1/1/2024-5/31/2024. (Estates and trusts: for the period + 1/1/2024-4/30/2024). See instructions.} +SchdAI_18c ; { Enter the same type of credits as allowed on Form 2210, + Part I, lines 1 and 3, extrapolated from the period + 1/1/2024-8/31/2024. (Estates and trusts: for the period + 1/1/2024-7/31/2024),. See instructions.} +SchdAI_18d ; { Enter the same type of credits as allowed on Form 2210, + Part I, lines 1 and 3, extrapolated from the period + 1/1/2024-12/31/2024. (Estates and trusts: for the period + 1/1/2024-11/30/2024). See instructions.} + {--- Part II Annualized Self-Employment Tax (Form 1040, 1040-SR, or 1040-NR filers only) ---} +SchdAI_28a 10000 ; { Net earnings from self-employment for the period + 1/1/2024-3/31/2024. See instructions.} +SchdAI_28b 15000 ; { Net earnings from self-employment for the period + 1/1/2024-5/31/2024. See instructions.} +SchdAI_28c 20000 ; { Net earnings from self-employment for the period + 1/1/2024-8/31/2024. See instructions.} +SchdAI_28d 150000 ; { Net earnings from self-employment for the period + 1/1/2024-12/31/2024. See instructions.} +SchdAI_30a 45000 ; { Actual wages for the period 1/1/2024-3/31/2024 subject to + social security tax or the 6.2% portion of the 7.65% + railroad retirement (tier 1) tax. Exception: If you filed + Form 4137 or Form 8919, see instructions} +SchdAI_30b 67000 ; { Actual wages for the period 1/1/2024-5/31/2024 subject to + social security tax or the 6.2% portion of the 7.65% + railroad retirement (tier 1) tax. Exception: If you filed + Form 4137 or Form 8919, see instructions} +SchdAI_30c 79000 ; { Actual wages for the period 1/1/2024-8/31/2024 subject to + social security tax or the 6.2% portion of the 7.65% + railroad retirement (tier 1) tax. Exception: If you filed + Form 4137 or Form 8919, see instructions} +SchdAI_30d 126000 ; { Actual wages for the period 1/1/2024-12/31/2024 subject to + social security tax or the 6.2% portion of the 7.65% + railroad retirement (tier 1) tax. Exception: If you filed + Form 4137 or Form 8919, see instructions} +SchdAI_32a ; { Annualization amounts (see instructions).} +SchdAI_32b ; { Annualization amounts (see instructions).} +SchdAI_32c ; { Annualization amounts (see instructions).} +SchdAI_32d ; { Annualization amounts (see instructions).} + {After you have filled out all of the applicable fields above, click + "Save" to save this form and then click "Compute Tax" to see if you owe a + penalty. } +L19 ; { Penalty. Enter the total penalty from line 14 of the + Worksheet for Form 2210, Part III, Section B-Figure the + Penalty. Also include this amount on Form 1040, 1040-SR, or + 1040-NR, line 38; or Form 1041, line 27. Don't file Form + 2210 unless you checked a box in Part II.} + + {-------------------------------------------- } + Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } + {-------------------------------------------- } diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_2210/Form_2210_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_2210/Form_2210_template.txt new file mode 100755 index 0000000..32d67c8 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_2210/Form_2210_template.txt @@ -0,0 +1,261 @@ +Title: Form 2210 for Tax Year 2024 + +{--- Your Identity --- } + +YourName: +YourSocSec#: + +Entity { Filing For? (answer: Individual, Estate/Trust) } + +Status { Single, Married/Joint, Head_of_House, Married/Sep, Widow(er) + (Estates/Trusts: Choose Single) } + +{--- Part I Required Annual Payment --- } + +L1 ; { Enter your 2024 tax after credits from Form 1040, + 1040-SR, or 1040-NR, line 22. Estates or trusts, enter the + amount from Form 1041, Schedule G, line 3. See + instructions.} +L2 ; { Other taxes, including self-employment tax and, if applicable, Additional Medicare Tax and/or + Net Investment Income Tax (see instructions)} +L3 ; { Other payments and refundable credits + (see instructions)} +L6 ; { Withholding taxes. Don't include estimated tax payments. + See instructions)} +L8 ; { Maximum required annual payment based on prior year's + tax (see instructions)} + +{--- Part II Reasons for Filing. If none apply, don't file Form 2210. ---} + +{ You request a waiver (see instructions) of your entire penalty. You must + check this box and file page 1 of Form 2210, but you aren't required to + figure your penalty. } +BoxA { (answer: Yes, No) } +{ You request a waiver (see instructions) of part of your penalty. You must + figure your penalty and waiver amount and file Form 2210.} +BoxB { (answer: Yes, No) } +{ Your income varied during the year and your penalty is reduced or + eliminated when figured using the annualized income installment method. + You must figure the penalty using Schedule Al and file Form 2210.} +BoxC { (answer: Yes, No) } +{ Your penalty is lower when figured by treating the federal income tax + withheld from your income as paid on the dates it was actually withheld, + instead of in equal amounts on the payment due dates. You must figure your + penalty and file Form 2210.} +BoxD { (answer: Yes, No) } +{ You filed or are filing a joint return for either 2023 or 2024, but not + for both years, and line 8 above is smaller than line 5 above. You must + file page 1 of Form 2210, but you aren't required to figure your penalty + (unless box B, C, or D applies).} +BoxE { (answer: Yes, No) } + +{ Click "Save" to save this form and then click "Compute Tax" to determine +if you need to file Form 2210 by reading the FIRST MESSAGE after results +for line 9 and before results for SecA. Ignore any later messages in the +results file at this time. If you need to file form 2210, or its first +page, return to this input form and continue.} + +{--- Part III Section A ---} + +{ IMPORTANT: Note carefully the starting and ending dates for each period. + The periods all begin January 1. They are not calendar quarters!} + +SecA_11a ;{ Estimated tax paid and tax withheld for the period + 1/1/2024-3/31/2024, due 4/15/2024 (Estates and trusts: for the period + 1/12024-2/292024). See instructions.} +SecA_11b ;{ Estimated tax paid and tax withheld for the period + 1/1/2024-5/31/2024, due 6/15/2024 (Estates and trusts: for the period + 1/1/2024-4/30/2024). See instructions.} +SecA_11c ;{ Estimated tax paid and tax withheld for the period + 1/1/2024-8/31/2024, due 9/15/2024 (Estates and trusts: for the period + 1/1/2024-7/31/2024). See instructions.} +SecA_11d ;{ Estimated tax paid and tax withheld for the period + 1/1/2024-12/31/2024, due 1/15/2024 (Estates and trusts: for the period + 1/1/2024-11/30/2024). See instructions.} + +{--- Schedule AI-Annualized Income Installment Method (See the instructions.) ---} + +{--- Part I Annualized Income Installments ---} + +SchdAI_1a ;{ Enter your adjusted gross income for the period + 1/1/2024-3/31/2024. (Estates and trusts: enter your taxable + income without your exemption for the period + 1/1/2024-2/28/2024)} +SchdAI_1b ;{ Enter your adjusted gross income for the period + 1/1/2024-5/31/2024. (Estates and trusts: enter your taxable + income without your exemption for the period + 1/1/2024-4/30/2024)} +SchdAI_1c ;{ Enter your adjusted gross income for the period + 1/1/2024-8/31/2024. (Estates and trusts: enter your taxable + income without your exemption for the period + 1/1/2024-7/31/2024)} +SchdAI_1d ;{ Enter your adjusted gross income for the period + 1/1/2024-12/31/2024. (Estates and trusts: enter your taxable + income without your exemption for the period + 1/1/2024-11/30/2024)} + +SchdAI_4a ;{ If you itemize, enter itemized deductions for the period + 1/1/2024-3/31/2024; otherwise, enter -0-. Estates and trusts: + enter "0". } +SchdAI_4b ;{ If you itemize, enter itemized deductions for the period + 1/1/2024-5/31/2024; otherwise, enter -0-. Estates and trusts: + enter "0". } +SchdAI_4c ;{ If you itemize, enter itemized deductions for the period + 1/1/2024-8/31/2024; otherwise, enter -0-. Estates and trusts: + enter "0". } +SchdAI_4d ;{ If you itemize, enter itemized deductions for the period + 1/1/2024-12/31/2024; otherwise, enter -0-. Estates and + trusts: enter "0". } + +SchdAI_7a ;{ Enter the SUM of your standard deduction and line 12b from + Form 1040 or 1040-SR. Estates and trusts: enter "0". (Form 1040- NR filers, enter -0-. + If you're a resident of India and a student or business apprentice, enter your standard + deduction from Form 1040-NR, line 12.} + +SchdAI_9a ;{ Deduction for qualified business income for the period + 1/1/2024-3/31/2024. Estates and trusts: for the period + 1/1/2024-2/28/2024.} +SchdAI_9b ;{ Deduction for qualified business income for the period + 1/1/2024-5/31/2024. Estates and trusts: for the period + 1/1/2024-4/30/2024.} +SchdAI_9c ;{ Deduction for qualified business income for the period + 1/1/2024-8/31/2024. Estates and trusts: for the period + 1/1/2024-7/31/2024.} +SchdAI_9d ;{ Deduction for qualified business income for the period + 1/1/2024-12/31/2024. Estates and trusts: for the period + 1/1/2024-11/30/2024. } + +SchdAI_12a ;{ Form 1040, 1040-SR, or 1040-NR filers, enter -0-. + Estates and trusts, use the exemption amount shown on your + return.} + +{ The following four fields are for entry of the tax due on the annualized + income extrapolated from the income and deductions during the respective + period. The tax can be calculated using the tax tables or tax rate + schedules; however, you may pay more estimated tax than necessary.} + +{ If you have tax preference items, such as capital gains and/or qualified + dividends, you can reduce your estimated tax by using the Qualified + Dividends and Capital Gains Tax Worksheet or other appropriate worksheet to + calculate the annualized tax due each period. To do this, multiply each + item of income and each deduction by the annualization factor for that + period to estimate your taxable income for the year and then calculate the + tax on that income using the chosen method.} + +{ Period 1: 4 (Estates/Trusts: 6 ) + Period 2: 2.4 (Estates/Trusts: 3 ) + Period 3; 1.5 (Estates/Trusts: 1.71429 ) + Period 4: 1 (Estates/Trusts: 1.09091 ) } + +{ You may also have, and/or be eligible for, certain credits---some of + which may be based upon your estimated taxable income for the year. You + may be able to reduce one or more of your estimated tax payments by + including these credits in your tax calculation. You can use the 2024 + estimated tax version of OTS to calculate the tax due on your estimated + income for the year that was extrapolated from the information for the + relevant period. See instructions for form 2210 and IRS publication 505.} + +{ To use your own tax calculation, simply enter it into the box for the + relevant period. If you want this program to calculate the tax using + the tax tables or tax rate schedules (including Form 1041, Schedule + G for estates/trusts), place a negative value (e.g., -1) into the field. + This tells the program that you want it to calculate the tax for that + period.} + +SchdAI_14a ;{ Total tax for the year extrapolated from the period + 1/1/2024-3/31/2024. Estates and trusts: for the period + 1/1/2024-2/28/2024.} +SchdAI_14b ;{ Total tax for the year extrapolated from the period + 1/1/2024-5/31/2024. Estates and trusts: for the period + 1/1/2024-4/30/2024.} +SchdAI_14c ;{ Total tax for the year extrapolated from the period + 1/1/2024-8/31/2024. Estates and trusts: for the period + 1/1/2024-7/31/2024.} +SchdAI_14d ;{ Total tax for the year extrapolated from the period + 1/1/2024-12/31/2024. Estates and trusts: for the period + 1/1/2024-11/30/2024.} + +SchdAI_16a ;{ Enter other taxes extrapolated from the period + 1/1/2024-3/31/2024 (Estates and trusts: for the period + 1/1/2024-2/28/2024), including, if applicable, Alternative + Minimum Tax, Additional Medicare Tax and/or Net Investment + Income Tax} +SchdAI_16b ;{ Enter other taxes extrapolated from the period + 1/1/2024-5/31/2024. (Estates and trusts: for the period + 1/1/2024-4/30/2024), including, if applicable, Alternative + Minimum Tax, Additional Medicare Tax and/or Net Investment + Income Tax} +SchdAI_16c ;{ Enter other taxes extrapolated from the period + 1/1/2024-8/31/2024. (Estates and trusts: for the period + 1/1/2024-7/31/2024), including, if applicable, Alternative + Minimum Tax, Additional Medicare Tax and/or Net Investment + Income Tax} +SchdAI_16d ;{ Enter other taxes extrapolated from the period + 1/1/2024-12/31/2024. (Estates and trusts: for the period + 1/1/2024-11/30/2024), including, if applicable, Alternative + Minimum Tax, Additional Medicare Tax and/or Net Investment + Income Tax} + +SchdAI_18a ;{ Enter the same type of credits as allowed on Form 2210, + Part I, lines 1 and 3, extrapolated from the period + 1/1/2024-3/31/2024 (Estates and trusts: for the period + 1/1/2024-2/28/2024). See instructions.} +SchdAI_18b ;{ Enter the same type of credits as allowed on Form 2210, + Part I, lines 1 and 3, extrapolated from the period + 1/1/2024-5/31/2024. (Estates and trusts: for the period + 1/1/2024-4/30/2024). See instructions.} +SchdAI_18c ;{ Enter the same type of credits as allowed on Form 2210, + Part I, lines 1 and 3, extrapolated from the period + 1/1/2024-8/31/2024. (Estates and trusts: for the period + 1/1/2024-7/31/2024),. See instructions.} +SchdAI_18d ;{ Enter the same type of credits as allowed on Form 2210, + Part I, lines 1 and 3, extrapolated from the period + 1/1/2024-12/31/2024. (Estates and trusts: for the period + 1/1/2024-11/30/2024). See instructions.} + +{--- Part II Annualized Self-Employment Tax (Form 1040, 1040-SR, or 1040-NR filers only) ---} + +SchdAI_28a ;{ Net earnings from self-employment for the period + 1/1/2024-3/31/2024. See instructions.} +SchdAI_28b ;{ Net earnings from self-employment for the period + 1/1/2024-5/31/2024. See instructions.} +SchdAI_28c ;{ Net earnings from self-employment for the period + 1/1/2024-8/31/2024. See instructions.} +SchdAI_28d ;{ Net earnings from self-employment for the period + 1/1/2024-12/31/2024. See instructions.} + +SchdAI_30a ;{ Actual wages for the period 1/1/2024-3/31/2024 subject to + social security tax or the 6.2% portion of the 7.65% + railroad retirement (tier 1) tax. Exception: If you filed + Form 4137 or Form 8919, see instructions} +SchdAI_30b ;{ Actual wages for the period 1/1/2024-5/31/2024 subject to + social security tax or the 6.2% portion of the 7.65% + railroad retirement (tier 1) tax. Exception: If you filed + Form 4137 or Form 8919, see instructions} +SchdAI_30c ;{ Actual wages for the period 1/1/2024-8/31/2024 subject to + social security tax or the 6.2% portion of the 7.65% + railroad retirement (tier 1) tax. Exception: If you filed + Form 4137 or Form 8919, see instructions} +SchdAI_30d ;{ Actual wages for the period 1/1/2024-12/31/2024 subject to + social security tax or the 6.2% portion of the 7.65% + railroad retirement (tier 1) tax. Exception: If you filed + Form 4137 or Form 8919, see instructions} + +SchdAI_32a ;{ Annualization amounts (see instructions).} +SchdAI_32b ;{ Annualization amounts (see instructions).} +SchdAI_32c ;{ Annualization amounts (see instructions).} +SchdAI_32d ;{ Annualization amounts (see instructions).} + +{After you have filled out all of the applicable fields above, click + "Save" to save this form and then click "Compute Tax" to see if you owe a + penalty. } + +L19 ;{ Penalty. Enter the total penalty from line 14 of the + Worksheet for Form 2210, Part III, Section B-Figure the + Penalty. Also include this amount on Form 1040, 1040-SR, or + 1040-NR, line 38; or Form 1041, line 27. Don't file Form + 2210 unless you checked a box in Part II.} + +{-------------------------------------------- } +Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } +{-------------------------------------------- } diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8606/Form_8606_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8606/Form_8606_example.txt new file mode 100755 index 0000000..e507f88 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8606/Form_8606_example.txt @@ -0,0 +1,39 @@ +Title: Form 8606 for tax-year 2024 + +Complete_Part_One? Y {Are you completing Part I of this form? (answer: Y, N)} + +L1 123 ; { Nondeductible contributions } +L2 423 ; { Total basis in Trad IRAs } + +Dist_or_Conv? Y { Did you take a distribution or make a Roth conversion ? (answer: Y, N) } + +L4 21 ; { Contributions from the beginning of 2024 } +L6 3 ; +L7 1 ; +L8 0 ; +L15b 3 ; + +Complete_Part_Two? Y {Are you completing Part II of this form? (answer: Y, N)} + +L16 234 ; +L17 08 ; + +Complete_Part_Three? Y {Are you completing Part III of this form? (answer: Y, N)} + +L19 97 ; +L20 10 ; +L22 8 ; +L24 10 ; +L25b 23 ; + +Name: Bill +SocSec#: 123-45-6789 +Number&Street: 123 Oak Ln +Apt#: Apt 15 +TownStateZip: Tax City, KS 12345 +ForeignCountry: 23 +ForeignState: 123 +ForeignPostcode: 453 827 + +Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8606/Form_8606_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8606/Form_8606_template.txt new file mode 100755 index 0000000..977d4e9 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8606/Form_8606_template.txt @@ -0,0 +1,41 @@ +Title: Form 8606 for tax-year 2024 + +Complete_Part_One? {Are you completing Part I of this form? (answer: Y, N)} + +L1 ; { Nondeductible contributions } +L2 ; { Total basis in Trad IRAs } + +Dist_or_Conv? { Did you take a distribution or make a Roth conversion ? (answer: Y, N) } + +L4 ; { Contributions from the beginning of 2024 } +L6 ; +L7 ; +L8 ; +L15b ; + +Complete_Part_Two? {Are you completing Part II of this form? (answer: Y, N)} + +L16 ; +L17 ; + +Complete_Part_Three? {Are you completing Part III of this form? (answer: Y, N)} + +L19 ; +L20 ; +L22 ; +L24 ; +L25b ; + + + +Name: +SocSec#: +Number&Street: +Apt#: +TownStateZip: +ForeignCountry: +ForeignState: +ForeignPostcode: + +Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8812/Form_8812_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8812/Form_8812_example.txt new file mode 100755 index 0000000..a56c93b --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8812/Form_8812_example.txt @@ -0,0 +1,39 @@ +Title: Form 8812 - 2024 + +{ --- Your Filing Status & Exemptions --- } + +Status Single { Single, Married/Joint, Head_of_House, Married/Sep, Widow(er) } + +L1 240,100 ; { Amount from line 11 of your Form 1040 } + +L2a ; { Income from Puerto Rico that you excluded } +L2b 754 ; { Amounts from lines 45 and 50 of your Form 2555 } +L2c 200 ; { Amount from line 15 of your Form 4563 } + +L4 2 ; { Number of qualifying children under age 17, who have Soc.Sec. numbers. } + +L6 1 ; { Number of other dependents, including any qualifying children who are not under age + 17 or who do not have the required social security number } + { Caution: Do not include yourself, your spouse, or anyone not U.S. citizen } + { Also, do not include anyone you included on L4.} + +L13 100 ; { Amount from Credit Limit Worksheet A } + + +Amnt19 3456 ; { Amount on Form 1040, line 19. } + +L18a 64,650 ; { Earned income (see instructions) } +L18b 5018 ; { Nontaxable combat pay (see instructions) } + +L21 80 ; { Withheld Soc.Sec., Medicare, & Additional Medicare taxes from Forms W-2, boxes 4 and 6 } + +L22 22 ; { Total of amounts from Sched-1 (Form 1040), line 15; Sched-2 lines 5+6, 13+22 } + +L24 24 ; { Total of amounts from Form 1040, line 27, and Sched-3 line 11. } + +YourName: Ronald, Smith + +SocSec: 123-45-6789 + +Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8812/Form_8812_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8812/Form_8812_template.txt new file mode 100755 index 0000000..1503d3d --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8812/Form_8812_template.txt @@ -0,0 +1,39 @@ +Title: Form 8812 - 2024 + +{ --- Your Filing Status & Exemptions --- } + +Status Single { Single, Married/Joint, Head_of_House, Married/Sep, Widow(er) } + +L1 ; { Amount from line 11 of your Form 1040 } + +L2a ; { Income from Puerto Rico that you excluded } +L2b ; { Amounts from lines 45 and 50 of your Form 2555 } +L2c ; { Amount from line 15 of your Form 4563 } + +L4 ; { Number of qualifying children under age 17, who have Soc.Sec. numbers. } + +L6 ; { Number of other dependents, including any qualifying children who are not under age + 17 or who do not have the required social security number } + { Caution: Do not include yourself, your spouse, or anyone not U.S. citizen } + { Also, do not include anyone you included on L4.} + +L13 ; { Amount from Credit Limit Worksheet A } + + +Amnt19 ; { Amount on Form 1040, line 19. } + +L18a ; { Earned income (see instructions) } +L18b ; { Nontaxable combat pay (see instructions) } + +L21 ; { Withheld Soc.Sec., Medicare, & Additional Medicare taxes from Forms W-2, boxes 4 and 6} + +L22 ; { Total of amounts from Sched-1 (Form 1040), line 15; Sched-2 lines 5+6, 13+22 } + +L24 ; { Total of amounts from Form 1040, line 27, and Sched-3 line 11. } + +YourName: + +SocSec: + +Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8829/Form_8829_example_1.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8829/Form_8829_example_1.txt new file mode 100755 index 0000000..eb095dc --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8829/Form_8829_example_1.txt @@ -0,0 +1,56 @@ +Title: 2024 Form 8829 Expenses for Business Use of Your Home - EXAMPLE 1 + + { Provide a Schedule C filename for autofill of YourName, YourSocSec#, and L8. } +FileNameSchC tax_form_files/US_1040_Sched_C/US_1040Sched_C_2024_example_out.txt { File-name of Federal Schedule C output file. Optional. } + {--- Your Identity --- } +YourName: Herman J Snodgrass { Leave blank and provide a Schedule C filename for autofill } +YourSocSec#: 111-2222-333 { Leave blank and provide a Schedule C filename for autofill } + {--- Part I Part of Your Home Used for Business --- } +L1 400 ; { Area used regularly and exclusively for business, regularly for daycare, or for storage of inventory +or product samples (see instructions)} +L2 2,650 ; { Total area of home} + {-- For daycare facilities not used exclusively for business, go to line 4. All others, go to line 7 --} +L4 ; { Multiply days used for daycare during year by hours used per day. + Leave blank or 0.00 for non-daycare business, or daycare area used exclusively for business } +L5 8,784 ; { If you started or stopped using your home for daycare during the year + see instructions; otherwise, enter 8784 } + {--- Part II Figure Your Allowable Deduction ---} +L8 0 ; { Enter the amount from Schedule C, line 29, plus any gain derived from the business use of your + home, minus any loss from the trade or business no derived from the business use of your home. + Enter 0 and provide a Schedule C filename for autofill } + {-- Direct expenses --} +L9a 10 ; { Casualty losses } +L10a 20 ; { Deductible mortgage interest } +L11a 30 ; { Real Estate Taxes } +L16a 40 ; { Excess mortgage interest } +L17a 50 ; { Excess real estate taxes } +L18a 60 ; { Insurance } +L19a 70 ; { Rent } +L20a 80 ; { Repairs and maintenance } +L21a 90 ; { Utilities } +L22a 100 ; { Other expenses } + {-- Indirect expenses --} +L9b 200 ; { Casualty losses } +L10b 210 ; { Deductible mortgage interest } +L11b 220 ; { Real Estate Taxes } +L16b 230 ; { Excess mortgage interest } +L17b 240 ; { Excess real estate taxes } +L18b 250 ; { Insurance } +L19b 260 ; { Rent } +L20b 270 ; { Repairs and maintenance } +L21b 280 ; { Utilities } +L22b 290 ; { Other expenses } + {-- Allowable Deductions --} +L25 1000 ; { Carryover of prior year operating expenses } +L29 17 ; { Excess casualty losses } +L31 ; {Carryover of prior year excess casualty loss and depreciation } +L35 ; {Casualty loss portion, if any, from lines 14 and 33. Carry amount to Form 4684 } + {--- Part III Depreciation of Your Home --- } +L37 250,000 ; {Enter the smaller of your home's adjusted basis or its fair market value.} +L38 75,000 ; {Value of land included on line 37} +L41 2.651 ; {Depreciation percentage (see instructions) } + {--- Part IV Carryover of Unallowed Expenses to Next Year --- } + + {--------------------------------------------- } +Round_PDF_to_Whole_Dollars n { Controls format of PDF form. (answer: Yes, No) } + {--------------------------------------------- } diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8829/Form_8829_example_2.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8829/Form_8829_example_2.txt new file mode 100755 index 0000000..98e4737 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8829/Form_8829_example_2.txt @@ -0,0 +1,56 @@ +Title: 2024 Form 8829 Expenses for Business Use of Your Home - EXAMPLE 2 + + { Provide a Schedule C filename for autofill of YourName, YourSocSec#, and L8. } +FileNameSchC { File-name of Federal Schedule C output file. Optional. } + {--- Your Identity --- } +YourName: Mary Mary { Leave blank and provide a Schedule C filename for autofill } +YourSocSec#: 333-2222-111 { Leave blank and provide a Schedule C filename for autofill } + {--- Part I Part of Your Home Used for Business --- } +L1 1000 ; { Area used regularly and exclusively for business, regularly for daycare, or for storage of inventory +or product samples (see instructions)} +L2 3000 ; { Total area of home} + {-- For daycare facilities not used exclusively for business, go to line 4. All others, go to line 7 --} +L4 4000 ; { Multiply days used for daycare during year by hours used per day. + Leave blank or 0.00 for non-daycare business, or daycare area used exclusively for business } +L5 8760 ; { If you started or stopped using your home for daycare during the year + see instructions; otherwise, enter 8,784 } + {--- Part II Figure Your Allowable Deduction ---} +L8 75000 ; { Enter the amount from Schedule C, line 29, plus any gain derived from the business use of your + home, minus any loss from the trade or business no derived from the business use of your home. + Enter 0 and provide a Schedule C filename for autofill } + {-- Direct expenses --} +L9a 10 ; { Casualty losses } +L10a 20 ; { Deductible mortgage interest } +L11a 30 ; { Real Estate Taxes } +L16a 40 ; { Excess mortgage interest } +L17a 50 ; { Excess real estate taxes } +L18a 60 ; { Insurance } +L19a 70 ; { Rent } +L20a 80 ; { Repairs and maintenance } +L21a 90 ; { Utilities } +L22a 100 ; { Other expenses } + {-- Indirect expenses --} +L9b 500 ; { Casualty losses } +L10b 510 ; { Deductible mortgage interest } +L11b 520 ; { Real Estate Taxes } +L16b 530 ; { Excess mortgage interest } +L17b 540 ; { Excess real estate taxes } +L18b 550 ; { Insurance } +L19b 560 ; { Rent } +L20b 570 ; { Repairs and maintenance } +L21b 580 ; { Utilities } +L22b 590 ; { Other expenses } + {-- Allowable Deductions --} +L25 37 ; { Carryover of prior year operating expenses } +L29 175 ; { Excess casualty losses } +L31 300 ; {Carryover of prior year excess casualty loss and depreciation } +L35 87 ; {Casualty loss portion, if any, from lines 14 and 33. Carry amount to Form 4684 } + {--- Part III Depreciation of Your Home --- } +L37 250000 ; {Enter the smaller of your home's adjusted basis or its fair market value.} +L38 100000 ; {Value of land included on line 37} +L41 2.461 ; {Depreciation percentage (see instructions) } + {--- Part IV Carryover of Unallowed Expenses to Next Year --- } + {--------------------------------------------- } +Round_PDF_to_Whole_Dollars n { Controls format of PDF form. (answer: Yes, No) } + {--------------------------------------------- } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8829/Form_8829_example_3.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8829/Form_8829_example_3.txt new file mode 100755 index 0000000..fd1f602 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8829/Form_8829_example_3.txt @@ -0,0 +1,56 @@ +Title: 2024 Form 8829 Expenses for Business Use of Your Home - EXAMPLE 3 + + { Provide a Schedule C filename for autofill of YourName, YourSocSec#, and L8. } +FileNameSchC tax_form_files/US_1040_Sched_C/US_1040Sched_C_2024_example_out.txt { File-name of Federal Schedule C output file. Optional. } + {--- Your Identity --- } +YourName: { Leave blank and provide a Schedule C filename for autofill } +YourSocSec#: { Leave blank and provide a Schedule C filename for autofill } + {--- Part I Part of Your Home Used for Business --- } +L1 1000 ; { Area used regularly and exclusively for business, regularly for daycare, or for storage of inventory +or product samples (see instructions)} +L2 3000 ; { Total area of home} + {-- For daycare facilities not used exclusively for business, go to line 4. All others, go to line 7 --} +L4 4000 ; { Multiply days used for daycare during year by hours used per day. + Leave blank or 0.00 for non-daycare business, or daycare area used exclusively for business } +L5 8760 ; { If you started or stopped using your home for daycare during the year + see instructions; otherwise, enter 8,784 } + {--- Part II Figure Your Allowable Deduction ---} +L8 ; { Enter the amount from Schedule C, line 29, plus any gain derived from the business use of your + home, minus any loss from the trade or business no derived from the business use of your home. + Enter 0 and provide a Schedule C filename for autofill } + {-- Direct expenses --} +L9a 10 ; { Casualty losses } +L10a 20 ; { Deductible mortgage interest } +L11a 30 ; { Real Estate Taxes } +L16a 40 ; { Excess mortgage interest } +L17a 50 ; { Excess real estate taxes } +L18a 60 ; { Insurance } +L19a 70 ; { Rent } +L20a 80 ; { Repairs and maintenance } +L21a 90 ; { Utilities } +L22a 100 ; { Other expenses } + {-- Indirect expenses --} +L9b 500 ; { Casualty losses } +L10b 510 ; { Deductible mortgage interest } +L11b 520 ; { Real Estate Taxes } +L16b 530 ; { Excess mortgage interest } +L17b 540 ; { Excess real estate taxes } +L18b 550 ; { Insurance } +L19b 560 ; { Rent } +L20b 570 ; { Repairs and maintenance } +L21b 580 ; { Utilities } +L22b 590 ; { Other expenses } + {-- Allowable Deductions --} +L25 37 ; { Carryover of prior year operating expenses } +L29 4200 ; { Excess casualty losses } +L31 300 ; {Carryover of prior year excess casualty loss and depreciation } +L35 87 ; {Casualty loss portion, if any, from lines 14 and 33. Carry amount to Form 4684 } + {--- Part III Depreciation of Your Home --- } +L37 250000 ; {Enter the smaller of your home's adjusted basis or its fair market value.} +L38 100000 ; {Value of land included on line 37} +L41 2.461 ; {Depreciation percentage (see instructions) } + {--- Part IV Carryover of Unallowed Expenses to Next Year --- } + {--------------------------------------------- } +Round_PDF_to_Whole_Dollars n { Controls format of PDF form. (answer: Yes, No) } + {--------------------------------------------- } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8829/Form_8829_example_4.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8829/Form_8829_example_4.txt new file mode 100755 index 0000000..e759e4a --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8829/Form_8829_example_4.txt @@ -0,0 +1,56 @@ +Title: 2024 Form 8829 Expenses for Business Use of Your Home - EXAMPLE 4 + + { Provide a Schedule C filename for autofill of YourName, YourSocSec#, and L8. } +FileNameSchC tax_form_files/US_1040_Sched_C/US_1040Sched_C_2024_example_out.txt { File-name of Federal Schedule C output file. Optional. } + {--- Your Identity --- } +YourName: { Leave blank and provide a Schedule C filename for autofill } +YourSocSec#: { Leave blank and provide a Schedule C filename for autofill } + {--- Part I Part of Your Home Used for Business --- } +L1 400 ; { Area used regularly and exclusively for business, regularly for daycare, or for storage of inventory +or product samples (see instructions)} +L2 2650 ; { Total area of home} + {-- For daycare facilities not used exclusively for business, go to line 4. All others, go to line 7 --} +L4 ; { Multiply days used for daycare during year by hours used per day. + Leave blank or 0.00 for non-daycare business, or daycare area used exclusively for business } +L5 8,784 ; { If you started or stopped using your home for daycare during the year + see instructions; otherwise, enter 8,784 } + {--- Part II Figure Your Allowable Deduction ---} +L8 ; { Enter the amount from Schedule C, line 29, plus any gain derived from the business use of your + home, minus any loss from the trade or business no derived from the business use of your home. + Enter 0 and provide a Schedule C filename for autofill } + {-- Direct expenses --} +L9a 10 ; { Casualty losses } +L10a 20 ; { Deductible mortgage interest } +L11a 30 ; { Real Estate Taxes } +L16a 40 ; { Excess mortgage interest } +L17a 50 ; { Excess real estate taxes } +L18a 60 ; { Insurance } +L19a 70 ; { Rent } +L20a 80 ; { Repairs and maintenance } +L21a 90 ; { Utilities } +L22a 100 ; { Other expenses } + {-- Indirect expenses --} +L9b 200 ; { Casualty losses } +L10b 210 ; { Deductible mortgage interest } +L11b 220 ; { Real Estate Taxes } +L16b 230 ; { Excess mortgage interest } +L17b 240 ; { Excess real estate taxes } +L18b 250 ; { Insurance } +L19b 260 ; { Rent } +L20b 270 ; { Repairs and maintenance } +L21b 280 ; { Utilities } +L22b 290 ; { Other expenses } + {-- Allowable Deductions --} +L25 1000 ; { Carryover of prior year operating expenses } +L29 17 ; { Excess casualty losses } +L31 ; {Carryover of prior year excess casualty loss and depreciation } +L35 ; {Casualty loss portion, if any, from lines 14 and 33. Carry amount to Form 4684 } + {--- Part III Depreciation of Your Home --- } +L37 250000 ; {Enter the smaller of your home's adjusted basis or its fair market value.} +L38 75000 ; {Value of land included on line 37} +L41 2.651 ; {Depreciation percentage (see instructions) } + {--- Part IV Carryover of Unallowed Expenses to Next Year --- } + {--------------------------------------------- } +Round_PDF_to_Whole_Dollars n { Controls format of PDF form. (answer: Yes, No) } + {--------------------------------------------- } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8829/Form_8829_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8829/Form_8829_template.txt new file mode 100755 index 0000000..9651e4a --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8829/Form_8829_template.txt @@ -0,0 +1,71 @@ +Title: 2024 Form 8829 Expenses for Business Use of Your Home + { Provide a Schedule C filename for autofill of YourName, YourSocSec#, and L8. } +FileNameSchC { File-name of Federal Schedule C output file. Optional. } +{--- Your Identity --- } + +YourName: { Leave blank and provide a Schedule C filename for autofill } +YourSocSec#: { Leave blank and provide a Schedule C filename for autofill } + +{--- Part I Part of Your Home Used for Business --- } + +L1 ; { Area used regularly and exclusively for business, regularly for daycare, or for storage of inventory + or product samples} + +L2 ; { Total area of home} + +{-- For daycare facilities not used exclusively for business, go to line 4. All others, go to line 7 --} + +L4 ; { Multiply days used for daycare during year by hours used per day. + Leave blank or 0.00 for non-daycare business, or daycare area used exclusively for business } +L5 8,784 ; { If you started or stopped using your home for daycare during the year + see instructions; otherwise, enter 8784 } + + +{--- Part II Figure Your Allowable Deduction ---} + +L8 ; { Enter the amount from Schedule C, line 29, plus any gain derived from the business use of your + home, minus any loss from the trade or business no derived from the business use of your home. + Enter 0 and provide a Schedule C filename for autofill } + +{-- Direct expenses --} +L9a ; { Casualty losses } +L10a ; { Deductible mortgage interest } +L11a ; { Real Estate Taxes } +L16a ; { Excess mortgage interest } +L17a ; { Excess real estate taxes } +L18a ; { Insurance } +L19a ; { Rent } +L20a ; { Repairs and maintenance } +L21a ; { Utilities } +L22a ; { Other expenses } + +{-- Indirect expenses --} +L9b ; { Casualty losses } +L10b ; { Deductible mortgage interest } +L11b ; { Real Estate Taxes } +L16b ; { Excess mortgage interest } +L17b ; { Excess real estate taxes } +L18b ; { Insurance } +L19b ; { Rent } +L20b ; { Repairs and maintenance } +L21b ; { Utilities } +L22b ; { Other expenses } + +{-- Allowable Deductions --} +L25 ; { Carryover of prior year operating expenses } +L29 ; { Excess casualty losses } +L31 ; { Carryover of prior year excess casualty loss and depreciation } +L35 ; { Casualty loss portion, if any, from lines 14 and 33. Carry amount to Form 4684 } + + +{--- Part III Depreciation of Your Home --- } +L37 ; {Enter the smaller of your home's adjusted basis or its fair market value.} +L38 ; {Value of land included on line 37} +L41 ; {Depreciation percentage (see instructions) } + +{--- Part IV Carryover of Unallowed Expenses to Next Year --- } + + +{--------------------------------------------- } +Round_PDF_to_Whole_Dollars n { Controls format of PDF form. (answer: Yes, No) } +{--------------------------------------------- } diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8959/Form_8959_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8959/Form_8959_example.txt new file mode 100755 index 0000000..6f4034f --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8959/Form_8959_example.txt @@ -0,0 +1,30 @@ +Title: 2024 Form 8959 Additional Medicare Tax + + {--- Your Identity --- } +YourName: George Washington +YourSocSec#: 123-45-6789 + {--- Filing Status ---} +Status Married/Joint { Single, Married/Joint, Head_of_House, Married/Sep, Widow(er) } + {--- Part I Additional Medicare Tax on Medicare Wages --- } +L1 450000 ; { Medicare wages and tips from Form W-2, box 5. If you + have more than one Form W-2, enter the total of the amounts + from box 5} +L2 0 ; { Unreported tips from Form 4137, line 6} +L3 0 ; { Wages from Form 8919, line 6} + {--- Part II Additional Medicare Tax on Self-Employment Income ---} +L8 100000 ; { Self-employment income from Schedule SE (Form 1040), + Part I, line 6. If you had a loss, enter -0- (Form 1040-PR + or 1040-SS filers, see instructions.)} + {--- Part III Additional Medicare Tax on Railroad Retirement Tax Act (RRTA) Compensation --- } +L14 50000 ; { Railroad retirement (RRTA) compensation and tips from + Form(s) W-2, box 14 (see instructions)} + {--- Part V Withholding Reconciliation --- } +L19 25 ; { Medicare tax withheld from Form W-2, box 6. If you have + more than one Form W-2, enter the total of the amounts from + box 6} +L23 45 ; { Additional Medicare Tax withholding on railroad + retirement (RRTA) compensation from Form W-2, box 14 (see + instructions)} + {--------------------------------------------- } +Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8959/Form_8959_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8959/Form_8959_template.txt new file mode 100755 index 0000000..3d0473f --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8959/Form_8959_template.txt @@ -0,0 +1,45 @@ +Title: 2024 Form 8959 Additional Medicare Tax + +{--- Your Identity --- } + +YourName: +YourSocSec#: + +{--- Filing Status ---} + +Status { Single, Married/Joint, Head_of_House, Married/Sep, Widow(er) } + +{--- Part I Additional Medicare Tax on Medicare Wages --- } + +L1 ;{ Medicare wages and tips from Form W-2, box 5. If you + have more than one Form W-2, enter the total of the amounts + from box 5} + +L2 ;{ Unreported tips from Form 4137, line 6} + +L3 ;{ Wages from Form 8919, line 6} + +{--- Part II Additional Medicare Tax on Self-Employment Income ---} + +L8 ;{ Self-employment income from Schedule SE (Form 1040), + Part I, line 6. If you had a loss, enter -0- (Form 1040-PR + or 1040-SS filers, see instructions.)} + +{--- Part III Additional Medicare Tax on Railroad Retirement Tax Act (RRTA) Compensation --- } + +L14 ;{ Railroad retirement (RRTA) compensation and tips from + Form(s) W-2, box 14 (see instructions)} + +{--- Part V Withholding Reconciliation --- } + +L19 ;{ Medicare tax withheld from Form W-2, box 6. If you have + more than one Form W-2, enter the total of the amounts from + box 6} + +L23 ;{ Additional Medicare Tax withholding on railroad + retirement (RRTA) compensation from Form W-2, box 14 (see + instructions)} + +{--------------------------------------------- } +Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8960/Form_8960_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8960/Form_8960_example.txt new file mode 100755 index 0000000..9f1c70f --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8960/Form_8960_example.txt @@ -0,0 +1,48 @@ +Title: 2024 Form 8960 Net Investment Income Tax-Individuals, Estates, and Trusts + + {--- Your Identity --- } +YourName: Thomas Jefferson +YourSocSec#: 987-65-4321 + {--- Filing Status ---} +Status Single { Single, Married/Joint, Head_of_House, Married/Sep, Widow(er) } +Entity Individual { Filing For? (answer: Individual, Estate/Trust) } + {--- Part I Investment Income --- } +Sec6013g No { Section 6013(g) election (see instructions) (answer: Yes No ) } +Sec6013h No { Section 6013(h) election (see instructions) (answer: Yes No ) } +Sec1141_10g No { Regulations section 1.1411-10(g) election (see instructions) + (answer: Yes No ) } +L1 100000 ; { Taxable interest (see instructions)} +L2 200000 ; { Ordinary dividends (see instructions)} +L3 50000 ; { Annuities (see instructions)} +L4a 150000 ; { Rental real estate, royalties, partnerships, S + corporations, trusts, etc. (see instructions))} +L4b 0 ; { Adjustment for net income or loss derived in the + ordinary course of a non- section 1411 trade or business + (see instructions)} +L5a 250000 ; { Net gain or loss from disposition of property (see + instructions)} +L5b 300000 ; { Net gain or loss from disposition of property that is + not subject to net investment income tax (see instructions)} +L5c 20000 ; { Adjustment from disposition of partnership interest or S + corporation stock (see instructions)} +L6 10000 ; { Adjustments to investment income for certain CFCs and + PFICs (see instructions)} +L7 40000 ; { Other modifications to investment income (see + instructions)} + {--- Part II Investment Expenses Allocable to Investment Income and Modifications ---} +L9a 100000 ; { Investment interest expenses (see instructions)} +L9b 250000 ; { State, local, and foreign income tax (see instructions)} +L9c 2500 ; { Miscellaneous investment expenses (see instructions)} +L10 5000 ; { Additional modifications (see instructions)} + {--- Part III Tax Computation --- } + { --- Individuals ---} +L13 ; { Modified adjusted gross income (see instructions)} + { --- Estates and Trusts ---} +L18b ; { Deductions for distributions of net investment income + and deductions under section 642(c) (see instructions)} +L19a ; { Adjusted Gross Income (see instructions)} +L19b ; { Highest tax bracket for estates and trusts for the year + (see instructions)} + {--------------------------------------------- } +Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8960/Form_8960_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8960/Form_8960_template.txt new file mode 100755 index 0000000..6624f19 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8960/Form_8960_template.txt @@ -0,0 +1,79 @@ +Title: 2024 Form 8960 Net Investment Income Tax-Individuals, Estates, and Trusts + +{--- Your Identity --- } + +YourName: +YourSocSec#: + +{--- Filing Status ---} + +Status { Single, Married/Joint, Head_of_House, Married/Sep, Widow(er) } + +Entity { Filing For? (answer: Individual, Estate/Trust) } + +{--- Part I Investment Income --- } + +Sec6013g { Section 6013(g) election (see instructions) (answer: Yes No ) } + +Sec6013h { Section 6013(h) election (see instructions) (answer: Yes No ) } + +Sec1141_10g { Regulations section 1.1411-10(g) election (see instructions) + (answer: Yes No ) } + +L1 ;{ Taxable interest (see instructions)} + +L2 ;{ Ordinary dividends (see instructions)} + +L3 ;{ Annuities (see instructions)} + +L4a ;{ Rental real estate, royalties, partnerships, S + corporations, trusts, etc. (see instructions))} + +L4b ;{ Adjustment for net income or loss derived in the + ordinary course of a non- section 1411 trade or business + (see instructions)} + +L5a ;{ Net gain or loss from disposition of property (see + instructions)} + +L5b ;{ Net gain or loss from disposition of property that is + not subject to net investment income tax (see instructions)} + +L5c ;{ Adjustment from disposition of partnership interest or S + corporation stock (see instructions)} + +L6 ;{ Adjustments to investment income for certain CFCs and + PFICs (see instructions)} + +L7 ;{ Other modifications to investment income (see + instructions)} + +{--- Part II Investment Expenses Allocable to Investment Income and Modifications ---} + +L9a ;{ Investment interest expenses (see instructions)} + +L9b ;{ State, local, and foreign income tax (see instructions)} + +L9c ;{ Miscellaneous investment expenses (see instructions)} + +L10 ;{ Additional modifications (see instructions)} + +{--- Part III Tax Computation --- } + +{ --- Individuals ---} + +L13 ;{ Modified adjusted gross income (see instructions)} + +{ --- Estates and Trusts ---} + +L18b ;{ Deductions for distributions of net investment income + and deductions under section 642(c) (see instructions)} + +L19a ;{ Adjusted Gross Income (see instructions)} + +L19b ;{ Highest tax bracket for estates and trusts for the year + (see instructions)} + +{--------------------------------------------- } +Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8995/Form_8995_example_1.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8995/Form_8995_example_1.txt new file mode 100755 index 0000000..e98c82e --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8995/Form_8995_example_1.txt @@ -0,0 +1,32 @@ +Title: 2024 Form 8995 Qualified Business Income Deduction Simplified Computation - EXAMPLE 1 + { For filers with a single schedule C, entering '0' in L1_i_c, and + providing both a 1040 and Schedule C filename, will cause auto calculation. } +FileName1040 tax_form_files/US_1040/US_1040_example_out.txt { File-name of Federal Return output file. Required. } +FileNameSchC tax_form_files/US_1040_Sched_C/US_1040Sched_C_2024_example_out.txt { File-name of Federal Schedule C output file. Optional. } + {-- Row "i" --} +L1_i_a: Tweeter { (a) Trade, business, or aggregation name } +L1_i_b: YYY-YYYY-YYY { (b) Taxpayer identification number } +L1_i_c 130805 ; { (c) Qualified business income or (loss) } + {-- Row "ii" --} +L1_ii_a: GetRichQuick LLC { (a) Trade, business, or aggregation name } +L1_ii_b: ZZZ-ZZZZ-ZZZ { (b) Taxpayer identification number } +L1_ii_c -10,456 ; { (c) Qualified business income or (loss) } + {-- Row "iii" --} +L1_iii_a: LoseItAll { (a) Trade, business, or aggregation name } +L1_iii_b: 111-1111-1111 { (b) Taxpayer identification number } +L1_iii_c 24566 ; { (c) Qualified business income or (loss) } + {-- Row "iv" --} +L1_iv_a: AnotherDamnSocialMediaCompany { (a) Trade, business, or aggregation name } +L1_iv_b: 222-2222-222 { (b) Taxpayer identification number } +L1_iv_c 4567 ; { (c) Qualified business income or (loss) } + {-- Row "v" --} +L1_v_a: MyFolly { (a) Trade, business, or aggregation name } +L1_v_b: 333-3333-333 { (b) Taxpayer identification number } +L1_v_c -35000 ; { (c) Qualified business income or (loss) } +L3 -5 ; { Qualified business net (loss) carryforward from the prior year. Enter negative value for loss. } +L6 2222 ; { Qualified REIT dividends and publicly traded partnership (PTP) income or (loss) } +L7 -3456 ; { Qualified REIT dividends and qualified PTP (loss) carryforward from the prior year. Enter negative value for loss. } +L12 2 ; { Net capital gain } + {--------------------------------------------- } +Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8995/Form_8995_example_2.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8995/Form_8995_example_2.txt new file mode 100755 index 0000000..8da7a0b --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8995/Form_8995_example_2.txt @@ -0,0 +1,33 @@ +Title: 2024 Form 8995 Qualified Business Income Deduction Simplified Computation - EXAMPLE 2 + { For filers with a single schedule C, entering '0' in L1_i_c, and + providing both a 1040 and Schedule C filename, will cause auto calculation. } +FileName1040 tax_form_files/US_1040/US_1040_example_out.txt { File-name of Federal Return output file. Required. } +FileNameSchC tax_form_files/US_1040_Sched_C/US_1040Sched_C_2024_example_out.txt { File-name of Federal Schedule C output file. Optional. } + {-- Row "i" --} +L1_i_a: Flutter { (a) Trade, business, or aggregation name } +L1_i_b: YYY-YYYY-YYY { (b) Taxpayer identification number } +L1_i_c 0 ; { (c) Qualified business income or (loss) } + {-- Row "ii" --} +L1_ii_a: Havaparty LLC { (a) Trade, business, or aggregation name } +L1_ii_b: ZZZ-ZZZZ-ZZZ { (b) Taxpayer identification number } +L1_ii_c 10,456 ; { (c) Qualified business income or (loss) } + {-- Row "iii" --} +L1_iii_a: WinitAll Inc { (a) Trade, business, or aggregation name } +L1_iii_b: 111-1111-1111 { (b) Taxpayer identification number } +L1_iii_c 32768 ; { (c) Qualified business income or (loss) } + {-- Row "iv" --} +L1_iv_a: CryptoScammers Co { (a) Trade, business, or aggregation name } +L1_iv_b: 222-2222-222 { (b) Taxpayer identification number } +L1_iv_c 7895 ; { (c) Qualified business income or (loss) } + {-- Row "v" --} +L1_v_a: ThisOneIsASureThing LLC { (a) Trade, business, or aggregation name } +L1_v_b: 444-4444-444 { (b) Taxpayer identification number } +L1_v_c -65356 ; { (c) Qualified business income or (loss) } +L3 -350000 ; { Qualified business net (loss) carryforward from the prior year. Enter negative value for loss } +L6 4444 ; { Qualified REIT dividends and publicly traded partnership (PTP) income or (loss) } +L7 -3456 ; { Qualified REIT dividends and qualified PTP (loss) carryforward from the prior year. Enter negative value for loss } +L12 2 ; { Net capital gain } + {--------------------------------------------- } + +Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8995/Form_8995_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8995/Form_8995_template.txt new file mode 100755 index 0000000..9ce1c71 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_8995/Form_8995_template.txt @@ -0,0 +1,42 @@ +Title: 2024 Form 8995 Qualified Business Income Deduction Simplified Computation + + { For filers with a single schedule C, entering '0' in L1_i_c, and + providing both a 1040 and Schedule C filename, will cause auto calculation. } +FileName1040 { File-name of Federal Return output file. Required. } +FileNameSchC { File-name of Federal Schedule C output file. Optional. } + +{-- Row "i" --} +L1_i_a: { (a) Trade, business, or aggregation name } +L1_i_b: { (b) Taxpayer identification number } +L1_i_c ; { (c) Qualified business income or (loss); enter 0 and provide both 1040 and schedule C filenames for auto calculation } + +{-- Row "ii" --} +L1_ii_a: { (a) Trade, business, or aggregation name } +L1_ii_b: { (b) Taxpayer identification number } +L1_ii_c ; { (c) Qualified business income or (loss) } + +{-- Row "iii" --} +L1_iii_a: ; { (a) Trade, business, or aggregation name } +L1_iii_b: { (b) Taxpayer identification number } +L1_iii_c ; { (c) Qualified business income or (loss) } + +{-- Row "iv" --} +L1_iv_a: { (a) Trade, business, or aggregation name } +L1_iv_b: { (b) Taxpayer identification number } +L1_iv_c ; { (c) Qualified business income or (loss) } + +{-- Row "v" --} +L1_v_a: { (a) Trade, business, or aggregation name } +L1_v_b: { (b) Taxpayer identification number } +L1_v_c ; { (c) Qualified business income or (loss) } + +{-- Calculations --} +L3 ; { Qualified business net (loss) carryforward from the prior year. Enter negative value for loss } +L6 ; { Qualified REIT dividends and publicly traded partnership (PTP) income or (loss) } +L7 ; { Qualified REIT dividends and qualified PTP (loss) carryforward from the prior year. Enter negative value for loss } +L12 ; { Net capital gain } + +{--------------------------------------------- } + +Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_CA_5805/Form_5805_example1.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_CA_5805/Form_5805_example1.txt new file mode 100755 index 0000000..b543487 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_CA_5805/Form_5805_example1.txt @@ -0,0 +1,265 @@ +Title: Form 5805 for Tax Year 2024 + + {--- Your Identity ---} +YourName: Thomas Paine +YourSocSec#: 111-11-1111 + {--- Filing Status ---} +Entity Individual { Filing For? (answer: Individual, Estate/Trust) } +Status Single { Single, Married/Joint, Head_of_House, Married/Sep, Widow(er) + Estates/Trusts MUST choose \"Single\" } + {Are you requesting a waiver of the penalty? } +Quest1 No { (answer: Yes, No) } + {Did you use the annualized income installment method? } +Quest2 Yes { (answer: Yes, No) } + {Was your California withholding not withheld in equal installments and + are you able to show the actual amounts withheld per period and the actual + dates withheld?} +Quest3 N/A { (answer: Yes, No, N/A) } + {If "Yes," enter the actual uneven amounts withheld on the spaces provided + below. The total of the four amounts must equal the total withholding + reported on Form 540, line 71 and line 73; Form 540NR, line 81 and line 83; + or Form 541, line 29 and line 31. } +Wthd_Per_1 ; { Amount Withheld for period with estimated tax due date + 4/15/23 } +Wthd_Per_2 ; { Amount Withheld for period with estimated tax due date + 6/15/23 } +Wthd_Per_3 ; { Amount Withheld for period with estimated tax due date + 9/15/23 } +Wthd_Per_4 ; { Amount Withheld for period with estimated tax due date + 1/15/24 } + {For estates and trusts: Was the date of death less than two years from + the end of the taxable year? Estates and grantor trusts, which receive + the residue of the decedent’s estate, are required to make estimated + income tax payments for any year ending two or more years after the date + of the decedent’s death. If you answer “Yes” this question, click "Save" + and "Compute Tax" to complete Part I only and attach form FTB 5805 to the + back of your tax return. } +Quest4 { (answer: Yes, No) } + {--- Part II Required Annual Payment. All filers must complete this part. ---} +L1 75000 ; { Current year tax. Enter your 2024 tax after credits. See + instructions.} +L3 3000 ; { Withholding taxes. Do not include any estimated tax + payments on this line. See instructions.} +L5 72000 ; { Enter the tax shown on your 2023 tax return. See + instructions. (110% (1.10) of that amount if the adjusted + gross income shown on that return is more than $150,000, or + if married/RDP filing a separate return for 2024, more than + $75,000} +CA_AGI 480000 ; { Enter your California Adusted Gross Income (AGI) } + {--- Short Method - Skip this part if using the Annualized Income Installment Method ---} + {Caution: See the instructions to find out if you can use the short method. + If you answered "Yes'' to Question 2 in Part I, skip this part and go to + Part III. If you answered "No'' to Question 2 in Part I and you cannot use + the short method, see page 4 of the instructions and go to Worksheet II + below. } +L8 ; { Enter the total amount, if any, of estimated tax + payments you made } + {Click "Save" to save this form and then click "Compute Tax". Look for + the amount on line 10. If zero or less, stop. You do not owe the penalty. + Do not file form FTB 5805. Otherwise, return to the form and complete the + next entry (Num_Days). Again click "Save" amd "Compute Tax" to calculate your + penalty. } + {If the amount on line 10 was paid ON OR AFTER 4/15/24, enter -0-. + Otherwise, enter number of days the amount on line 10 was paid BEFORE + 4/15/24. } +Num_Days ; { Number of days } + {--- Part III Annualized Income Installment Method Schedule. ---} + {Use this schedule ONLY if you earned taxable income at an UNEVEN RATE + during 2024. If you earned your income at approximately the same rate each + month, then you should not complete this schedule. If you choose to figure + the penalty, see Worksheet II, Regular Method to Figure Your Underpayment + and Penalty, on page 4 of the instructions. Worksheet II is available + below. } + {IMPORTANT: NOTE CAREFULLY THE STARTING AND ENDING DATES FOR EACH PERIOD. + THE PERIODS ALL BEGIN JANUARY 1. THEY ARE NOT CALENDAR QUARTERS! Fiscal + year filers must adjust dates accordingly.} +SchdAI_1a 50000 ; { Enter your California adjusted gross income (AGI) for + the period 1/1/23-3/31/23. Form 540NR filers, see + instructions. Estates or Trusts, enter the amount from Form + 541, line 20 attributable to the period 1/1/23-2/28/23).} +SchdAI_1b 80000 ; { Enter your California adjusted gross income (AGI) for + the period 1/1/23-5/31/23. Form 540NR filers, see + instructions. Estates or Trusts, enter the amount from Form + 541, line 20 attributable to the period 1/1/23-4/30/23)} +SchdAI_1c 90000 ; { Enter your California adjusted gross income (AGI) for + the period 1/1/23-8/31/23. Form 540NR filers, see + instructions. Estates or Trusts, enter the amount from Form + 541, line 20 attributable to the period 1/1/23-7/31/23)} +SchdAI_1d 480000 ; { Enter your California adjusted gross income (AGI) for + the period 1/1/23-12/31/23. Form 540NR filers, see + instructions. Estates or Trusts, enter the amount from Form + 541, line 20 attributable to the period 1/1/23-11/30/23)} +SchdAI_4a 7000 ; { If you itemize, enter itemized deductions for the period + 1/1/23-3/31/23; otherwise, enter -0-. Estates and trusts: + enter "0". } +SchdAI_4b 9000 ; { If you itemize, enter itemized deductions for the period + 1/1/23-5/31/23; otherwise, enter -0-. Estates and trusts: + enter "0". } +SchdAI_4c 10000 ; { If you itemize, enter itemized deductions for the period + 1/1/23-8/31/23; otherwise, enter -0-. Estates and trusts: + enter "0". } +SchdAI_4d 20000 ; { If you itemize, enter itemized deductions for the period + 1/1/23-12/31/23; otherwise, enter -0-. Estates and + trusts: enter "0". } +SchdAI_7a 12550 ; { Enter the full amount of your standard deduction from + your 2024 Form 540 or Form 540NR,, line 18, even if you itemized. See + instructions. Estates and trusts: enter "0".} +SchdAI_10a_add ; { For individuals, and for estates/trusts, this program will automatically + calculate the estimated tax due on the amount on line 9. Enter certain + additional taxes for the period here, such as tax from form FTB 3803 + (see instructions). NOTE: AMT and mental health services tax are entered + below on line 14b. Estates or Trusts, see form 541 instructions for + information about additional taxes you may need to add here. +} +SchdAI_10b_add ; { For individuals, and for estates/trusts, this program will automatically + calculate the estimated tax due on the amount on line 9. Enter certain + additional taxes for the period here, such as tax from form FTB 3803 + (see instructions). NOTE: AMT and mental health services tax are entered + below on line 14b. Estates or Trusts, see form 541 instructions for + information about additional taxes you may need to add here. +} +SchdAI_10c_add ; { For individuals, and for estates/trusts, this program will automatically + calculate the estimated tax due on the amount on line 9. Enter certain + additional taxes for the period here, such as tax from form FTB 3803 + (see instructions). NOTE: AMT and mental health services tax are entered + below on line 14b. Estates or Trusts, see form 541 instructions for + information about additional taxes you may need to add here. +} +SchdAI_10d_add ; { For individuals, and for estates/trusts, this program will automatically + calculate the estimated tax due on the amount on line 9. Enter certain + additional taxes for the period here, such as tax from form FTB 3803 + (see instructions). NOTE: AMT and mental health services tax are entered + below on line 14b. Estates or Trusts, see form 541 instructions for + information about additional taxes you may need to add here. +} +SchdAI_11a 280 ; { Enter the total amount of exemption credits from your + 2024 Form 540, line 32 or Form 541, line 22. See + instructions. If you filed a Form 540NR, see instructions.} +SchdAI_11b 280 ; { Enter the total amount of exemption credits from your + 2024 Form 540, line 32 or Form 541, line 22. See + instructions. If you filed a Form 540NR, see instructions.} +SchdAI_11c 280 ; { Enter the total amount of exemption credits from your + 2024 Form 540, line 32 or Form 541, line 22. See + instructions. If you filed a Form 540NR, see instructions.} +SchdAI_11d 280 ; { Enter the total amount of exemption credits from your + 2024 Form 540, line 32 or Form 541, line 22. See + instructions. If you filed a Form 540NR, see instructions.} +SchdAI_13a 3000 ; { Enter the total credit amount from your 2024 Form 540, + line 47; or Form 541, line 23. Form 540NR filers, see + instructions.} +SchdAI_13b 4000 ; { Enter the total credit amount from your 2024 Form 540, + line 47; or Form 541, line 23. Form 540NR filers, see + instructions.} +SchdAI_13c 6000 ; { Enter the total credit amount from your 2024 Form 540, + line 47; or Form 541, line 23. Form 540NR filers, see + instructions.} +SchdAI_13d 10000 ; { Enter the total credit amount from your 2024 Form 540, + line 47; or Form 541, line 23. Form 540NR filers, see + instructions.} +SchdAI_14ba 0 ; { Enter the alternative minimum tax and mental health tax + for the period 1/1/23-3/31/23. Estates and trusts: for the + period 1/1/23-2/28/23. Figure the alternative minimum tax + and mental health services tax you owe based on income + earned during the period. } +SchdAI_14bb 0 ; { Enter the alternative minimum tax and mental health tax + for the period 1/1/23-5/31/23. Estates and trusts: for the + period 1/1/23-4/30/23. Figure the alternative minimum tax + and mental health services tax you owe based on income + earned during the period. } +SchdAI_14bc 0 ; { Enter the alternative minimum tax and mental health tax + for the period 1/1/23-8/31/23. Estates and trusts: for the + period 1/1/23-7/31/23. Figure the alternative minimum tax + and mental health services tax you owe based on income + earned during the period. } +SchdAI_14bd ; { Enter the amounts from your 2024 Form 540, line 61 and + line 62; 2023 Form 540NR, line 71 and line 72; or 2023 Form + 541, line 26 and line 27.} +SchdAI_14da 0 ; { Enter the excess SDI from Form 540, line 74 or Form + 540NR, line 84. } +SchdAI_14db 0 ; { Enter the excess SDI from Form 540, line 74 or Form + 540NR, line 84.} +SchdAI_14dc 0 ; { Enter the excess SDI from Form 540, line 74 or Form + 540NR, line 84.} +SchdAI_14dd 0 ; { Enter the excess SDI from Form 540, line 74 or Form + 540NR, line 84.} + {--- Federal Annualized Income Worksheet ---} + {NOTE: If you are a nonresident military servicemember domiciled outside + of California, subtract your military pay from your federal AGI. } +FAIWS_1a 50000 ; { Enter your federal adjusted gross income for the period + 1/1/23-3/31/23. See instructions for federal Form 2210, + Schedule AI, Part I, line 1. (Estates and trusts: enter + your taxable income without your exemption for the period + 1/1/23-2/28/23),} +FAIWS_1b 80000 ; { Enter your federal adjusted gross income for the period + 1/1/23-5/31/23. See instructions for federal Form 2210, + Schedule AI, Part I, line 1. (Estates and trusts: enter + your taxable income without your exemption for the period + 1/1/23-4/30/23),} +FAIWS_1c 100000 ; { Enter your federal adjusted gross income for the period + 1/1/23-8/31/23. See instructions for federal Form 2210, + Schedule AI, Part I, line 1. (Estates and trusts: enter + your taxable income without your exemption for the period + 1/1/23-7/31/23),} +FAIWS_1d 500000 ; { Enter your federal adjusted gross income for the period + 1/1/23-12/31/23. See instructions for federal Form 2210, + Schedule AI, Part I, line 1. (Estates and trusts: enter + your taxable income without your exemption for the period + 1/1/23-11/30/23),} + {--- Line 6 Worksheet (for high-income filers who itemize deductions) ---} +L6WS_2a 0 ; { Enter the sum of the amounts on federal Schedule A (Form + 1040), line 4, line 9, and line 15 plus any gambling losses + included on line 16 for the period 1/1/23-3/31/23 (Estates + and trusts: for the period 1/1/23-2/28/23). } +L6WS_2b 0 ; { Enter the sum of the amounts on federal Schedule A (Form + 1040), line 4, line 9, and line 15 plus any gambling losses + included on line 16 for the period 1/1/23-5/31/23. + (Estates and trusts: for the period 1/1/23-4/30/23)..} +L6WS_2c 0 ; { Enter the sum of the amounts on federal Schedule A (Form + 1040), line 4, line 9, and line 15 plus any gambling losses + included on line 16 for the period 1/1/23-8/31/23. + (Estates and trusts: for the period 1/1/23-7/31/23),} +L6WS_2d 0 ; { Enter the sum of the amounts on federal Schedule A (Form + 1040), line 4, line 9, and line 15 plus any gambling losses + included on line 16 for the period 1/1/23-12/31/23. + (Estates and trusts: for the period 1/1/23-11/30/23).} + {--- Worksheet II - Regular Method to Figure Your Underpayment and Penalty ---} + {NOTE: The entries below are NOT CUMULATIVE. Enter the amount that was + paid each period by that period's due date. } +WSII_2a ; { Enter the estimated tax payments for the period + 1/1/23-3/31/23 that were made by 4/15/23, including any + overpayment of tax from your 2022 tax return that you + elected to apply to the 2023 estimated tax.} +WSII_2b ; { Enter the estimated tax payments for the period + 1/1/23-5/31/23 that were made by 6/15/23.} +WSII_2c ; { Enter the estimated tax payments for the period + 1/1/23-8/31/23 that were made by 9/15/23.} +WSII_2d 20000 ; { Enter the estimated tax payments for the period + 1/1/23-12/31/23 that were made by 1/15/24} + {After you make the above entries, click "Save" and then click "Calculate + Tex" to see if you have an underpayment for any period. If so, you may owe + a penalty. Read the instructions for how to calculate the penalty, make + the following entires, and again click "Save" and "Calculate Tax". Because + calculating the penalty can be complex, carefully check the results to + ensure that they are correct for your particular tax situation.} +WSII_10a 261 ; { Number of days from 4/15/24 to the date the amount on + line 8 was paid or 12/31/24, whichever is earlier (see + instructions).} +WSII_10b 200 ; { Number of days from 6/15/24 to the date the amount on + line 8 was paid or 12/31/24, whichever is earlier (see + instructions).} +WSII_12a 105 ; { Number of days from 1/1/24 to the date the amount on + line 8 was paid or 4/15/24, whichever is earlier (see + instructions).} +WSII_12b 105 ; { Number of days from 1/1/24 to the date the amount on + line 8 was paid or 4/15/24, whichever is earlier (see + instructions).} +WSII_12c 105 ; { Number of days from 1/1/24 to the date the amount on + line 8 was paid or 4/15/24, whichever is earlier (see + instructions).} +WSII_12d 90 ; { Number of days from 1/15/24 to the date the amount on + line 8 was paid or 4/15/24, whichever is earlier (see + instructions).} + {After you have filled out all of the applicable fields above, click + "Save" to save this form and then click "Compute Tax" to see if you owe a + penalty. } + {--------------------------------------------} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_CA_5805/Form_5805_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_CA_5805/Form_5805_template.txt new file mode 100755 index 0000000..e3e0e72 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/Form_CA_5805/Form_5805_template.txt @@ -0,0 +1,302 @@ +Title: Form 5805 for Tax Year 2024 + +{--- Your Identity ---} + +YourName: +YourSocSec#: + +{--- Filing Status ---} + +Entity { Filing For? (answer: Individual, Estate/Trust) } + +Status { Single, Married/Joint, Head_of_House, Married/Sep, Widow(er) + Estates/Trusts MUST choose "Single" } +{Are you requesting a waiver of the penalty? } +Quest1 { (answer: Yes, No) } +{Did you use the annualized income installment method? } +Quest2 { (answer: Yes, No) } +{Was your California withholding not withheld in equal installments and + are you able to show the actual amounts withheld per period and the actual + dates withheld?} +Quest3 { (answer: Yes, No, N/A) } +{If "Yes," enter the actual uneven amounts withheld on the spaces provided + below. The total of the four amounts must equal the total withholding + reported on Form 540, line 71 and line 73; Form 540NR, line 81 and line 83; + or Form 541, line 29 and line 31. } + +Wthd_Per_1 ;{ Amount Withheld for period with estimated tax due date + 4/15/23 } +Wthd_Per_2 ;{ Amount Withheld for period with estimated tax due date + 6/15/23 } +Wthd_Per_3 ;{ Amount Withheld for period with estimated tax due date + 9/15/23 } +Wthd_Per_4 ;{ Amount Withheld for period with estimated tax due date + 1/15/24 } + +{For estates and trusts: Was the date of death less than two years from + the end of the taxable year? Estates and grantor trusts, which receive + the residue of the decedent’s estate, are required to make estimated + income tax payments for any year ending two or more years after the date + of the decedent’s death. If you answer “Yes” this question, click "Save" + and "Compute Tax" to complete Part I only and attach form FTB 5805 to the + back of your tax return. +} +Quest4 { (answer: Yes, No) } + +{--- Part II Required Annual Payment. All filers must complete this part. ---} + +L1 ;{ Current year tax. Enter your 2024 tax after credits. See + instructions.} +L3 ;{ Withholding taxes. Do not include any estimated tax + payments on this line. See instructions.} +L5 ;{ Enter the tax shown on your 2023 tax return. See + instructions. (110% (1.10) of that amount if the adjusted + gross income shown on that return is more than $150,000, or + if married/RDP filing a separate return for 2023, more than + $75,000} + +CA_AGI ;{ Enter your California Adusted Gross Income (AGI) } + +{--- Short Method - Skip this part if using the Annualized Income Installment Method ---} +{Caution: See the instructions to find out if you can use the short method. + If you answered "Yes'' to Question 2 in Part I, skip this part and go to + Part III. If you answered "No'' to Question 2 in Part I and you cannot use + the short method, see page 4 of the instructions and go to Worksheet II + below. } + +L8 ;{ Enter the total amount, if any, of estimated tax + payments you made } + +{Click "Save" to save this form and then click "Compute Tax". Look for + the amount on line 10. If zero or less, stop. You do not owe the penalty. + Do not file form FTB 5805. Otherwise, return to the form and complete the + next entry (Num_Days). Again click "Save" amd "Compute Tax" to calculate your + penalty. } + +{If the amount on line 10 was paid ON OR AFTER 4/15/24, enter -0-. + Otherwise, enter number of days the amount on line 10 was paid BEFORE + 4/15/24. } + +Num_Days ;{ Number of days } + +{--- Part III Annualized Income Installment Method Schedule. ---} + +{Use this schedule ONLY if you earned taxable income at an UNEVEN RATE + during 2024. If you earned your income at approximately the same rate each + month, then you should not complete this schedule. If you choose to figure + the penalty, see Worksheet II, Regular Method to Figure Your Underpayment + and Penalty, on page 4 of the instructions. Worksheet II is available + below. } + +{IMPORTANT: NOTE CAREFULLY THE STARTING AND ENDING DATES FOR EACH PERIOD. + THE PERIODS ALL BEGIN JANUARY 1. THEY ARE NOT CALENDAR QUARTERS! Fiscal + year filers must adjust dates accordingly.} + +SchdAI_1a ;{ Enter your California adjusted gross income (AGI) for + the period 1/1/23-3/31/23. Form 540NR filers, see + instructions. Estates or Trusts, enter the amount from Form + 541, line 20 attributable to the period 1/1/23-2/28/23).} +SchdAI_1b ;{ Enter your California adjusted gross income (AGI) for + the period 1/1/23-5/31/23. Form 540NR filers, see + instructions. Estates or Trusts, enter the amount from Form + 541, line 20 attributable to the period 1/1/23-4/30/23)} +SchdAI_1c ;{ Enter your California adjusted gross income (AGI) for + the period 1/1/23-8/31/23. Form 540NR filers, see + instructions. Estates or Trusts, enter the amount from Form + 541, line 20 attributable to the period 1/1/23-7/31/23)} +SchdAI_1d ;{ Enter your California adjusted gross income (AGI) for + the period 1/1/23-12/31/23. Form 540NR filers, see + instructions. Estates or Trusts, enter the amount from Form + 541, line 20 attributable to the period 1/1/23-11/30/23)} + +SchdAI_4a ;{ If you itemize, enter itemized deductions for the period + 1/1/23-3/31/23; otherwise, enter -0-. Estates and trusts: + enter "0". } +SchdAI_4b ;{ If you itemize, enter itemized deductions for the period + 1/1/23-5/31/23; otherwise, enter -0-. Estates and trusts: + enter "0". } +SchdAI_4c ;{ If you itemize, enter itemized deductions for the period + 1/1/23-8/31/23; otherwise, enter -0-. Estates and trusts: + enter "0". } +SchdAI_4d ;{ If you itemize, enter itemized deductions for the period + 1/1/23-12/31/23; otherwise, enter -0-. Estates and + trusts: enter "0". } + +SchdAI_7a ;{ Enter the full amount of your standard deduction from + your 2024 Form 540 or Form 540NR,, line 18, even if you itemized. See + instructions. Estates and trusts: enter "0".} + +SchdAI_10a_add ;{ For individuals, and for estates/trusts, this program will automatically + calculate the estimated tax due on the amount on line 9. Enter certain + additional taxes for the period here, such as tax from form FTB 3803 + (see instructions). NOTE: AMT and mental health services tax are entered + below on line 14b. Estates or Trusts, see form 541 instructions for + information about additional taxes you may need to add here. +} +SchdAI_10b_add ;{ For individuals, and for estates/trusts, this program will automatically + calculate the estimated tax due on the amount on line 9. Enter certain + additional taxes for the period here, such as tax from form FTB 3803 + (see instructions). NOTE: AMT and mental health services tax are entered + below on line 14b. Estates or Trusts, see form 541 instructions for + information about additional taxes you may need to add here. +} +SchdAI_10c_add ;{ For individuals, and for estates/trusts, this program will automatically + calculate the estimated tax due on the amount on line 9. Enter certain + additional taxes for the period here, such as tax from form FTB 3803 + (see instructions). NOTE: AMT and mental health services tax are entered + below on line 14b. Estates or Trusts, see form 541 instructions for + information about additional taxes you may need to add here. +} +SchdAI_10d_add ;{ For individuals, and for estates/trusts, this program will automatically + calculate the estimated tax due on the amount on line 9. Enter certain + additional taxes for the period here, such as tax from form FTB 3803 + (see instructions). NOTE: AMT and mental health services tax are entered + below on line 14b. Estates or Trusts, see form 541 instructions for + information about additional taxes you may need to add here. +} + +SchdAI_11a ;{ Enter the total amount of exemption credits from your + 2024 Form 540, line 32 or Form 541, line 22. See + instructions. If you filed a Form 540NR, see instructions.} +SchdAI_11b ;{ Enter the total amount of exemption credits from your + 2024 Form 540, line 32 or Form 541, line 22. See + instructions. If you filed a Form 540NR, see instructions.} +SchdAI_11c ;{ Enter the total amount of exemption credits from your + 2024 Form 540, line 32 or Form 541, line 22. See + instructions. If you filed a Form 540NR, see instructions.} +SchdAI_11d ;{ Enter the total amount of exemption credits from your + 2024 Form 540, line 32 or Form 541, line 22. See + instructions. If you filed a Form 540NR, see instructions.} + +SchdAI_13a ;{ Enter the total credit amount from your 2024 Form 540, + line 47; or Form 541, line 23. Form 540NR filers, see + instructions.} +SchdAI_13b ;{ Enter the total credit amount from your 2024 Form 540, + line 47; or Form 541, line 23. Form 540NR filers, see + instructions.} +SchdAI_13c ;{ Enter the total credit amount from your 2024 Form 540, + line 47; or Form 541, line 23. Form 540NR filers, see + instructions.} +SchdAI_13d ;{ Enter the total credit amount from your 2024 Form 540, + line 47; or Form 541, line 23. Form 540NR filers, see + instructions.} + +SchdAI_14ba ;{ Enter the alternative minimum tax and mental health tax + for the period 1/1/23-3/31/23. Estates and trusts: for the + period 1/1/23-2/28/23. Figure the alternative minimum tax + and mental health services tax you owe based on income + earned during the period. } +SchdAI_14bb ;{ Enter the alternative minimum tax and mental health tax + for the period 1/1/23-5/31/23. Estates and trusts: for the + period 1/1/23-4/30/23. Figure the alternative minimum tax + and mental health services tax you owe based on income + earned during the period. } +SchdAI_14bc ;{ Enter the alternative minimum tax and mental health tax + for the period 1/1/23-8/31/23. Estates and trusts: for the + period 1/1/23-7/31/23. Figure the alternative minimum tax + and mental health services tax you owe based on income + earned during the period. } +SchdAI_14bd ;{ Enter the amounts from your 2024 Form 540, line 61 and + line 62; 2024 Form 540NR, line 71 and line 72; or 2024 Form + 541, line 26 and line 27. } +SchdAI_14da ;{ Enter the excess SDI from Form 540, line 74 or Form + 540NR, line 84. } +SchdAI_14db ;{ Enter the excess SDI from Form 540, line 74 or Form + 540NR, line 84.} +SchdAI_14dc ;{ Enter the excess SDI from Form 540, line 74 or Form + 540NR, line 84.} +SchdAI_14dd ;{ Enter the excess SDI from Form 540, line 74 or Form + 540NR, line 84.} + +{--- Federal Annualized Income Worksheet ---} + +{NOTE: If you are a nonresident military servicemember domiciled outside + of California, subtract your military pay from your federal AGI. } + +FAIWS_1a ;{ Enter your federal adjusted gross income for the period + 1/1/23-3/31/23. See instructions for federal Form 2220, + Schedule AI, Part I, line 1. (Estates and trusts: enter + your taxable income without your exemption for the period + 1/1/23-2/28/23),} +FAIWS_1b ;{ Enter your federal adjusted gross income for the period + 1/1/23-5/31/23. See instructions for federal Form 2220, + Schedule AI, Part I, line 1. (Estates and trusts: enter + your taxable income without your exemption for the period + 1/1/23-4/30/23),} +FAIWS_1c ;{ Enter your federal adjusted gross income for the period + 1/1/23-8/31/23. See instructions for federal Form 2220, + Schedule AI, Part I, line 1. (Estates and trusts: enter + your taxable income without your exemption for the period + 1/1/23-7/31/23),} +FAIWS_1d ;{ Enter your federal adjusted gross income for the period + 1/1/23-12/31/23. See instructions for federal Form 2220, + Schedule AI, Part I, line 1. (Estates and trusts: enter + your taxable income without your exemption for the period + 1/1/23-11/30/23),} + +{--- Line 6 Worksheet (for high-income filers who itemize deductions) ---} + +L6WS_2a ;{ Enter the sum of the amounts on federal Schedule A (Form + 1040), line 4, line 9, and line 15 plus any gambling losses + included on line 16 for the period 1/1/23-3/31/23 (Estates + and trusts: for the period 1/1/23-2/28/23). } +L6WS_2b ;{ Enter the sum of the amounts on federal Schedule A (Form + 1040), line 4, line 9, and line 15 plus any gambling losses + included on line 16 for the period 1/1/23-5/31/23. + (Estates and trusts: for the period 1/1/23-4/30/23)..} +L6WS_2c ;{ Enter the sum of the amounts on federal Schedule A (Form + 1040), line 4, line 9, and line 15 plus any gambling losses + included on line 16 for the period 1/1/23-8/31/23. + (Estates and trusts: for the period 1/1/23-7/31/23),} +L6WS_2d ;{ Enter the sum of the amounts on federal Schedule A (Form + 1040), line 4, line 9, and line 15 plus any gambling losses + included on line 16 for the period 1/1/23-12/31/23. + (Estates and trusts: for the period 1/1/23-11/30/23).} + +{--- Worksheet II - Regular Method to Figure Your Underpayment and Penalty ---} + +{NOTE: The entries below are NOT CUMULATIVE. Enter the amount that was + paid each period by that period's due date. } + +WSII_2a ;{ Enter the estimated tax payments for the period + 1/1/23-3/31/23 that were made by 4/15/23, including any + overpayment of tax from your 2023 tax return that you + elected to apply to the 2024 estimated tax.} +WSII_2b ;{ Enter the estimated tax payments for the period + 1/1/23-5/31/23 that were made by 6/15/23.} +WSII_2c ;{ Enter the estimated tax payments for the period + 1/1/23-8/31/23 that were made by 9/15/23.} +WSII_2d ;{ Enter the estimated tax payments for the period + 1/1/23-12/31/23 that were made by 1/15/24} + +{After you make the above entries, click "Save" and then click "Calculate + Tex" to see if you have an underpayment for any period. If so, you may owe + a penalty. Read the instructions for how to calculate the penalty, make + the following entires, and again click "Save" and "Calculate Tax". Because + calculating the penalty can be complex, carefully check the results to + ensure that they are correct for your particular tax situation.} + +WSII_10a ;{ Number of days from 4/15/23 to the date the amount on + line 8 was paid or 12/31/23, whichever is earlier (see + instructions).} +WSII_10b ;{ Number of days from 6/15/23 to the date the amount on + line 8 was paid or 12/31/23, whichever is earlier (see + instructions).} +WSII_12a ;{ Number of days from 1/1/24 to the date the amount on + line 8 was paid or 4/15/24, whichever is earlier (see + instructions).} +WSII_12b ;{ Number of days from 1/1/24 to the date the amount on + line 8 was paid or 4/15/24, whichever is earlier (see + instructions).} +WSII_12c ;{ Number of days from 1/1/24 to the date the amount on + line 8 was paid or 4/15/24, whichever is earlier (see + instructions).} +WSII_12d ;{ Number of days from 1/15/24 to the date the amount on + line 8 was paid or 4/15/24, whichever is earlier (see + instructions).} + +{After you have filled out all of the applicable fields above, click + "Save" to save this form and then click "Compute Tax" to see if you owe a + penalty. } + +{--------------------------------------------} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/HSA_Form_8889/HSA_Form_8889_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/HSA_Form_8889/HSA_Form_8889_example.txt new file mode 100755 index 0000000..7e11e28 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/HSA_Form_8889/HSA_Form_8889_example.txt @@ -0,0 +1,46 @@ +Title: 8889 HSA Form - 2024 --- EXAMPLE --- + +{ --- Your Identity --- } + +YourName: Raplh Emerson +YourSocSec#: 123-45-6789 + +{ --- Part I --- } + +{ Your Coverage } +L1: Family { (answer: Self-Only, Family) } + +L2 5,400 { HSA contributions you made for 2024 } + 1,200 + ; + +L3 4,150 ; { If you were under 55 and eligible every month, enter $4,150 ($8,300 for Family Coverage). Or see instructions. (answer: 4150, 8300)} + +L4 45 ; { Amount you and your employer contributed to your Archer MSAs for 2024 from Form 8853, lines 1 and 2.} + +L6 80 ; { Only enter amount if your spouse has separate HSA and coverage under an HDHP. } + +L7 100 ; { Additional contribution amount. } + +L9 95 ; { Employer contributions made to your HSAs for 2024. } + +L10 500 ; { Qualified HSA funding distributions. } + + +{ --- Part II --- } + +L14a 700 ; { Total distributions you received in 2024 from all HSAs} + +L14b 200 ; { Distributions included in L14a rolled over to another HSA. } + +L15 300 ; { Qualified medical expenses paid using HSA distributions } + +L17a: Y { Do any distributions in L16 meet Exceptions to Addtl 20% tax ? { (answer: Y, N) } + + +{ --- Part III --- } + +L18 400 ; { Last-month rule } + +L19 500 ; { Qualified HSA funding distribution } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/HSA_Form_8889/HSA_Form_8889_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/HSA_Form_8889/HSA_Form_8889_template.txt new file mode 100755 index 0000000..572f486 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/HSA_Form_8889/HSA_Form_8889_template.txt @@ -0,0 +1,44 @@ +Title: 8889 HSA Form - 2024 + +{ --- Your Identity --- } + +YourName: +YourSocSec#: + +{ --- Part I --- } + +{ Your Coverage } +L1: { (answer: Self-Only, Family) } + +L2 { HSA contributions you made for 2024 } + ; + +L3 ; { If you were under 55 and eligible every month, enter $4,150 ($8,300 for Family Coverage). Or see instructions. (answer: 4150, 8300)} + +L4 ; { Amount you and your employer contributed to your Archer MSAs for 2024 from Form 8853, lines 1 and 2.} + +L6 ; { Only enter amount if your spouse has separate HSA and coverage under an HDHP. } + +L7 ; { Additional contribution amount. } + +L9 ; { Employer contributions made to your HSAs for 2024. } + +L10 ; { Qualified HSA funding distributions. } + + +{ --- Part II --- } + +L14a ; { Total distributions you received in 2024 from all HSAs} + +L14b ; { Distributions included in L14a rolled over to another HSA. } + +L15 ; { Qualified medical expenses paid using HSA distributions } + +L17a: N { Do any distributions in L16 meet Exceptions to Addtl 20% tax ? { (answer: Y, N) } + + +{ --- Part III --- } + +L18 ; { Last-month rule } + +L19 ; { Qualified HSA funding distribution } diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/MA_1/README_MA_1.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/MA_1/README_MA_1.txt new file mode 100755 index 0000000..2908b50 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/MA_1/README_MA_1.txt @@ -0,0 +1,33 @@ +Open Tax Solver - Massachusetts State Form 1 - Resident Tax Return +------------------------------------------------------------------ + +Included here is a program, template, and example for +Massachusetts State Form 1 resident income tax form. +Intended for use with the corresponding Instructions Booklet. + +The ma_1_2024_example.txt file is included for testing. +The ma_1_2024_template.txt file is a blank starting form to enter +your tax data. For each filer, copy template to a new name, +such as "Mass1_2024.txt" and then fill-in the lines. + +The program consists of two files: + taxsolve_ma_1_2024.c - main, customized for MA Form-1. + taxsolve_routines.c - general purpose base routines. + +Compile: + cc taxsolve_ma_1_2024.c -o taxsolve_ma_1_2024 */ +Run: + ./taxsolve_ma_1_2024 Mass1_2024.txt + + +For updates and further information, see: + http://sourceforge.net/projects/opentaxsolver/ +Documentation: + http://opentaxsolver.sourceforge.net/ + + +Contributed by Robert Heller 2-10-2004 heller@deepsoft.com +Updated by Robert Heller 1-25-2005 heller@deepsoft.com +Updated by Robert Heller 2-10-2006 heller@deepsoft.com +Updated by Robert Heller 2-1-2007 heller@deepsoft.com +Updated by ARoberts 2008-2024 diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/MA_1/ma_1_2024_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/MA_1/ma_1_2024_example.txt new file mode 100755 index 0000000..d9216e5 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/MA_1/ma_1_2024_example.txt @@ -0,0 +1,120 @@ +Title: Massachusetts Form 1 Tax Form - 2024 -- Example + +{ -- EXAMPLE -- } + +{---- Filing Status ----} + +Status Married/joint {Single, Married/Joint, Married/Sep, Head_of_House.} + +La 57780.76 ; { Total federal income from US 1040 line 9. } +Lb 57730.58 ; { Total federal adjusted gross income from US 1040 line 11. } + +{---- Exemptions ----} + +Dependents 2 {Number of Dependents -- DO NOT include yourself or your spouse!} + +{---- Age 65 or over ----} +Age65You FALSE {Are you 65 or older? (answer: True, False) } +Age65Spouse True {Spouse 65 or older? (answer: True, False, n/a)} + +{---- Blindness ----} +BlindYou True {You blind? (answer: True, False)} +BlindSpouse False {Spouse blind? (answer: True, False, n/a) } + +{---- Other Exemptions ----} +Med/Dental ; { Medical/Dental } +Adoption ; { Adoption } + +{---- Income ----} + +L3 60,000.00 { Wages, salaries, tips (W-2). } + ; +L4 ; { Taxable pensions. } +L5 180.00; { Mass Bank Interest } +L6a 660 ; { Business income/loss. (Sched C) } +L6b 66 ; { Farm income/loss. (Enclose US Sched F) } +L7 45,000.00; { Rental, royality, REMIC., etc. } +L8a ; { Unemployment } +L8b ; { Lottery } +L9 ; { Other income, Alimony received. } + +{---- Deductions ----} + +L11a 2,000.00; { Amount you paid to SS, Medicare, RR, US, or Mass retirement } +L11b 1,200.00; { Amount spouse paid to SS, Medicare, RR, US, or Mass retirement } +L14a 14 ; { Rental Paid } +L15 ; { Other - Sched Y, L19 } + +L20 0 { Interest and Dividends -- Sched B, line 38 } + ; +L23a 123 ; { 8.5% income, from sched B Line 39 } +L23b 23 ; { 12% income, from Certain Capital Gains } +L24 24 ; { Tax on long-term capital gains, Sched D Line 22 } +L25 25 ; { Credit Recapture amount Sch. H-2 } +L26 26 ; { Additional tax on installment sale } + + {---- Credits ----} +L29 29 { Limited Income Credit } +L30 0 { Income tax paid to another state or jurisdiction (from Schedule OJC). } +L31 0 { Other credits from Sch Z, line 14 } + +L33a 0 { Endangered Wildlife } +L33b 0 { Organ Transplant } +L33c 0 { Mass AIDS } +L33d 0 { Mass US Olympic } +L33e 0 { Mass Miltiary Family Relief Fund } +L33f 0 { Homeless Animal Prevention And Care } + +L34 0 { Use tax due on out-of-state purchases } +L35a 0 { Health Care Penalty (you) } +L35b 0 { Health Care Penalty (spouse) } +L36 0 { AMENDED RETURN ONLY. Overpayment from original return. } + +{---- Taxes Paid ----} + +L38a 3,530 ; { Mass income tax withheld, Forms W-2 } +L38b 34 ; { Mass income tax withheld, Forms 1099 } +L38c 38 ; { Mass income tax withheld, Other forms. } +L39 ; { 2023 overpayment applied to 2024 estimated tax } +L40 ; { 2024 estimated tax payments } +L41 ; { Payments made with extension } +L42 ; { Payments with original return. Only if amending return.} +L43a 2 ; { Earned Income Credit: Number of dependent children. } +L43b 34 ; { EIC: amount from US Return } +L44 ; { Senior Circuit Breaker Credit, sched CB } +L46num ; { Number of dependent household members under 13 or over 65. } +L47 ; { Other refundable credits, Sched CMS. } +L49 ; { Excess Paid Family Leave withholding. } +L52 1,000 ; { Overpayment you want applied to next year's estimated tax. } + + +{ -------------------------------------------- } +{ --- Optional info for Auto-Fillout only. --- } + Your1stName: Tessa + YourInitial: A + YourLastName: Cradious + YourSocSec#: 123456789 + Spouse1stName: Raymond { Leave blank if Single, etc. } + SpouseInitial: B + SpouseLastName: Cradious + SpouseSocSec#: 987654321 + Number&Street: 123 South Crumberry St + Town: Worcestor + State: MA + Zipcode: 01605 + + +{ -- Optional -- } + RoutingNum: { Routing Number to receive refund. } + AccntNum: { Account Number to receive refund. } + AccountType: { Account type: (answer: Checking, Savings, N/A) } + Payment_Interest: { Interest due to under-withholding. } + Payment_Penalty: { Payment penalty you calculated. } + M2210_Amount: { M-2210 amount. } + Check_SelfEmployed: { Yes, if Self-Employed. (answer: Yes, No, n/a) } + Check_DORdiscuss: { Yes, if you wish to discuss w/DOR. (answer: Yes, No, n/a) } + Check_DoNotEfile: { Yes, if you do not want preparer to e-file. (answer: Yes, No, n/a) } + +{ + ------------------------------------------ +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/MA_1/ma_1_2024_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/MA_1/ma_1_2024_template.txt new file mode 100755 index 0000000..0d76c90 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/MA_1/ma_1_2024_template.txt @@ -0,0 +1,119 @@ +Title: Massachusetts Form 1 Tax Form - 2024 + +{---- Filing Status ----} + +Status Single {Single, Married/Joint, Married/Sep, Head_of_House.} + +La ; { Total federal income from US 1040 line 9. } +Lb ; { Total federal adjusted gross income from US 1040 line 11. } + +{---- Exemptions ----} + +Dependents 0 {Number of Dependents -- DO NOT include yourself or your spouse!} + +{---- Age 65 or over ----} +Age65You FALSE { Are you 65 or older? (answer: True, False) } +Age65Spouse n/a { Spouse 65 or older? (answer: True, False, n/a) } + +{---- Blindness ----} +BlindYou FALSE { You blind? (answer: True, False) } +BlindSpouse n/a { Spouse blind? (answer: True, False, n/a) } + +{---- Other Exemptions ----} +Med/Dental ; { Medical/Dental } +Adoption ; { Adoption } + +{---- Income ----} + +L3 { Wages, salaries, tips (W-2). } + ; +L4 ; { Taxable pensions. } +L5 ; { Mass Bank Interest } +L6a ; { Business income/loss. (Sched C) } +L6b ; { Farm income/loss. (Enclose US Sched F) } +L7 ; { Rental, royality, REMIC., etc. } +L8a ; { Unemployment } +L8b ; { Lottery } +L9 ; { Other income, Alimony received. } + +{---- Deductions ----} + +L11a ; { Amount you paid to SS, Medicare, RR, US, or Mass retirement } +L11b ; { Amount spouse paid to SS, Medicare, RR, US, or Mass retirement } +L14a ; { Rental Paid } +L15 ; { Other - Sched Y, L19 } + +L20 0 { Interest and Dividends -- Sched B } + ; + +L23a ; { 8.5% income, from sched B Line 39 } +L23b ; { 12% income, from Certain Capital Gains } +L24 ; { Tax on long-term capital gains, Sched D Line 22 } +L25 ; { Credit Recapture amount Sch. H-2 } +L26 ; { Additional tax on installment sale } + + {---- Credits ----} +L29 0 { Limited Income Credit } +L30 0 { Income tax paid to another state or jurisdiction (from Schedule OJC). } +L31 0 { Other credits from Sch Z, line 14 } + +L33a 0 { Endangered Wildlife } +L33b 0 { Organ Transplant } +L33c 0 { Mass AIDS } +L33d 0 { Mass US Olympic } +L33e 0 { Mass Miltiary Family Relief Fund } +L33f 0 { Homeless Animal Prevention And Care } + +L34 0 { Use tax due on out-of-state purchases } +L35a 0 { Health Care Penalty (you) } +L35b 0 { Health Care Penalty (spouse) } +L36 0 { AMENDED RETURN ONLY. Overpayment from original return. } + +{---- Taxes Paid ----} + +L38a ; { Mass income tax withheld, Forms W-2 } +L38b ; { Mass income tax withheld, Forms 1099 } +L38c ; { Mass income tax withheld, Other forms. } +L39 ; { 2023 overpayment applied to 2024 estimated tax } +L40 ; { 2024 estimated tax payments } +L41 ; { Payments made with extension } +L42 ; { Payments with original return. Only if amending return.} +L43a ; { Earned Income Credit: Number of dependent children. } +L43b ; { EIC: amount from US Return } +L44 ; { Senior Circuit Breaker Credit, sched CB } +L46num ; { Number of dependent household members under 13 or over 65. } +L47 ; { Other refundable credits, Sched CMS. } +L49 ; { Excess Paid Family Leave withholding. } +L52 ; { Overpayment you want applied to next year's estimated tax. } + +{ -------------------------------------------- } +{ --- Optional info for Auto-Fillout only. --- } + Your1stName: + YourInitial: + YourLastName: + YourSocSec#: + Spouse1stName: { Leave blank if Single, etc. } + SpouseInitial: + SpouseLastName: + SpouseSocSec#: + Number&Street: + Town: + State: MA + Zipcode: + + +{ -- Optional -- } + RoutingNum: { Routing Number to receive refund. } + AccntNum: { Account Number to receive refund. } + AccountType: { Account type: (answer: Checking, Savings, N/A) } + Payment_Interest: { Interest due to under-withholding. } + Payment_Penalty: { Payment penalty you calculated. } + M2210_Amount: { M-2210 amount. } + Check_SelfEmployed: { Yes, if Self-Employed. (answer: Yes, No, n/a) } + Check_DORdiscuss: { Yes, if you wish to discuss w/DOR. (answer: Yes, No, n/a) } + Check_DoNotEfile: { Yes, if you do not want preparer to e-file. (answer: Yes, No, n/a) } + + +{ + ------------------------------------------ +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/MI_1040/MI_1040_2024_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/MI_1040/MI_1040_2024_example.txt new file mode 100755 index 0000000..57d6f5b --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/MI_1040/MI_1040_2024_example.txt @@ -0,0 +1,68 @@ +Title: MI-1040 State Tax Form EXAMPLE for 2024 + + { EXAMPLE. } +Status Married/Joint { (answer: Single, Married/Joint, Married/Sep) } +CkFarmFish N { If 2/3 income from farming, fishing, seafaring. (answer: Y, N) } +ResidencyStatus Resident { (answer: Resident, Nonresident, PartYear ) } +L9a 1 ; { Number of exemptions. } +L9b 1 ; { Number of special exemptions. } +L9c 1 ; { Number of qualified disabled veterans. } +L9d ; { Number of Certificates of Stillbirth from MDHHS. } +L9e 2 ; { Claimed as dependent, see line 9 NOTE. } +L10 20000 ; { Adjusted Gross Income from your U.S. Fed. Form 1040. } +L11 10 ; { Additions from Schedule 1, line 9. } +L13 20 ; { Subtractions from Schedule 1, line 31. } +L15 30 ; { Exemption allowance. Enter amount from line 9f or Schedule NR, line 19. } + +L18a 18 ; { Amount of Income Tax Imposed by government units outside MI. } +L18b 180 ; { Credit for Income Tax Imposed by government units outside MI. } + +L19a 19 ; { Amount of Michigan Historic Preservation Tax. } +L19b 190 ; { Credit for Michigan Historic Preservation Tax. } + +L21 21 ; { Voluntary Contributions from Form 4642, line 6. } +L22 22 ; { Penalty for nonqualified withdrawal from Form 5792, Michigan 1st-Time Home Buyer Savings Program, line 5 .} +L23 23 ; { USE TAX. Use tax due on Internet, mail order or other out-of-state purchases from Worksheet 1. } + +L25 24 ; { Property Tax Credit. Include MI-1040CR or MI-1040CR-2. } +L26 25 ; { Farmland Preservation Tax Credit. Include MI-1040CR-5. } +L27a 27 ; { Earned Income Tax Credit. } +L28 28 ; { Michigan Historic Preservation Tax Credit (refundable). Include Form 3581. } +L29 29 ; { Credit for allocated share of tax paid by an electing flow-through entity. } +L30 30 ; { Michigan tax withheld from Schedule W, line 6. Include Schedule W. } +L31 31 ; { Estimated tax, extension payments and 2023 credit forward. } + + { -- Line-32 (below) for Amended Returns only -- } +Ck32a Y { You had a refund and/or credit forward on the original return. (answer: Y, N) } +Ck32b Y { You paid with the original return. (answer: Y, N)} +L32c 32 ; { } + +Interest 5 ; { Interest on underpayment. } +Penalty 6 ; { Panalty on underpayment. } +L36 7 ; { Credit Forward. Amount of line 35 to be credited to your 2025 estimated tax. } + + { -------------------------------------------- } + { --- Optional info for Auto-Fillout only. --- } +Your1stName: Mila +YourInitial: T +YourLastName: Stanley +YourSocSec#: 123-45-6789 +Spouse1stName: Harold { Leave blank if Single, etc. } +SpouseInitial: R +SpouseLastName: Polangosh +SpouseSocSec#: 9876-54-321 +Number&Street: 4573 Memory Lane +Town: Saginaw +State: MI +Zipcode: 49301 +SchoolDist: 34567 + +{ Optional Refund Direct Deposit info } +Routing#: 12345678 +Account#: 87654321 +CkChecking { Account type is Checking (answer: Y, N) } +CkSavings Y { Account type is Savings (answer: Y, N) } + +{ + -------------------------------------------- +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/MI_1040/MI_1040_2024_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/MI_1040/MI_1040_2024_template.txt new file mode 100755 index 0000000..38afe86 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/MI_1040/MI_1040_2024_template.txt @@ -0,0 +1,69 @@ +Title: MI-1040 State Tax Form for 2024 + +Status Married/Joint {Single, Married/Joint, Married/Sep } +CkFarmFish { If 2/3 income from farming, fishing, seafaring. (answer: Y, N) } +ResidencyStatus Resident { (answer: Resident, Nonresident, PartYear ) } + +L9a ; { Number of exemptions. } +L9b ; { Number of special exemptions. } +L9c ; { Number of qualified disabled veterans. } +L9d ; { Number of Certificates of Stillbirth from MDHHS. } +L9e ; { Claimed as dependent, see line 9 NOTE. } + +L10 ; { Adjusted Gross Income from your U.S. Fed. Form 1040. } +L11 ; { Additions from Schedule 1, line 9. } +L13 ; { Subtractions from Schedule 1, line 31. } +L15 ; { Exemption allowance. Enter amount from line 9f or Schedule NR, line 19. } + +L18a ; { Amount of Income Tax Imposed by government units outside MI. } +L18b ; { Credit for Income Tax Imposed by government units outside MI. } + +L19a ; { Amount of Michigan Historic Preservation Tax. } +L19b ; { Credit for Michigan Historic Preservation Tax. } + +L21 ; { Voluntary Contributions from Form 4642, line 6. } +L22 ; { Penalty for nonqualified withdrawal from Form 5792, Michigan 1st-Time Home Buyer Savings Program, line 5 .} +L23 ; { USE TAX. Use tax due on Internet, mail order or other out-of-state purchases from Worksheet 1. } + +L25 ; { Property Tax Credit. Include MI-1040CR or MI-1040CR-2. } +L26 ; { Farmland Preservation Tax Credit. Include MI-1040CR-5. } +L27a ; { Earned Income Tax Credit. } +L28 ; { Michigan Historic Preservation Tax Credit (refundable). Include Form 3581. } +L29 ; { Credit for allocated share of tax paid by an electing flow-through entity. } +L30 ; { Michigan tax withheld from Schedule W, line 6. Include Schedule W. } +L31 ; { Estimated tax, extension payments and 2023 credit forward. } + + { -- Line-32 (below) for Amended Returns only -- } +Ck32a { You had a refund and/or credit forward on the original return. (answer: Y, N) } +Ck32b { You paid with the original return. (answer: Y, N)} +L32c ; { } + +Interest ; { Interest on underpayment. } +Penalty ; { Panalty on underpayment. } +L36 ; { Credit Forward. Amount of line 35 to be credited to your 2025 estimated tax. } + +{ -------------------------------------------- } +{ --- Optional info for Auto-Fillout only. --- } + Your1stName: + YourInitial: + YourLastName: + YourSocSec#: + Spouse1stName: { Leave blank if Single, etc. } + SpouseInitial: + SpouseLastName: + SpouseSocSec#: + Number&Street: + Town: + State: MI + Zipcode: + SchoolDist: + +{ Optional Refund Direct Deposit info } + Routing#: + Account#: + CkChecking { Account type is Checking (answer: Y, N) } + CkSavings { Account type is Savings (answer: Y, N) } + +{ + -------------------------------------------- +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/MI_1040/README_MI_1040.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/MI_1040/README_MI_1040.txt new file mode 100755 index 0000000..2f864bf --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/MI_1040/README_MI_1040.txt @@ -0,0 +1,33 @@ +Open Tax Solver - Michigan State MI-1040 Personal Income Tax Return +----------------------------------------------------------------------- + +Included here is a program, template, and example for +Michigan State MI-1040 personal income tax form. +Intended for use with the MI-1040 Instructions Booklet. + +The MI_1040_2024_example.txt files is included for testing. +The MI_1040_2024_template.txt file is a blank starting form for +entering your tax data. For each filer, copy template to a new +name, such as "MI_1040_2024.txt" or "MI_1040_2024_aunt_sally.txt, +and fill-in the lines. + +The program consists of two files: + taxsolve_MI_1040_2024.c - main, customized for MI-1040. + taxsolve_routines.c - general purpose base routines. + +Compile: + cc taxsolve_MI_1040_2024.c -o taxsolve_MI_1040_2024 + +Run: + First, run your Federal 1040 taxes and note the output AGI value. + Then, complete your MI-1040 form input file and run. + ../../bin/taxsolve_MI_1040_2024 MI_1040_2024.txt + + +For updates and further information, see: + http://sourceforge.net/projects/opentaxsolver/ +Documentation: + http://opentaxsolver.sourceforge.net/ + + +Contributed by C. Kindman. diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NC_D400/NC_400_2024_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NC_D400/NC_400_2024_example.txt new file mode 100755 index 0000000..5a3e132 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NC_D400/NC_400_2024_example.txt @@ -0,0 +1,46 @@ +Title: NC State Tax Form 400 for 2024 - EXAMPLE + +{ -- Example Return --- } + +FedReturn tax_form_files/US_1040/US_1040_example_out.txt { File-name of Federal Return output file. } + +Status Married/Joint {Single, Married/Joint, Married/Sep, Head_of_House, Widow(er)} + +L7 0 ; { Additions to Fed AGI - From Sched-S Part A, Line 15. } +L9 0 ; { Deductions from Fed AGI - From Sched-S Part B, Line 38. * } +L10a 0 ; { Number of children qualifying for federal deductions. } +L11 0 ; { Enter 0 to use Std Deduction; Otherwise Itemized Ded. from Sched-S part C, Line 23. } +L13 1 ; { Enter 1 for full-year residents. Otherwise amount from Sched-S part D, Line 26. } +L16 0 ; { Tax credits. (D-400TC part 3 line 20) } +L18 91.23 ; { Consumer Use Tax. (pg 10) } + + { North Carolina Income Tax Withheld } +L20a 1,500.00 ; { Your tax withheld } +L20b 700.00 ; { Spouse's tax withheld } + + + { --- Other tax payments. --- } +L21a 0 ; { 2024 Estimated Tax paid } +L21b 0 ; { Paid with Extension } +L21c 0 ; { Partnership } +L21d 0 ; { S Coroporation } + +{ -------------------------------------------- } +{ --- Optional info for Auto-Fillout only. --- } + Your1stName: Sarah + YourInitial: P + YourLastName: Parks + YourSocSec#: 123456789 + Spouse1stName: Sam { Leave blank if Single, etc. } + SpouseInitial: T + SpouseLastName: Parks + SpouseSocSec#: 987654321 + Number&Street: 321 Calabasas Rd. + Apt#: 34b + Town: Raleigh + State: NC + Zipcode: 27695 + +{ + -------------------------------------------- +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NC_D400/NC_400_2024_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NC_D400/NC_400_2024_template.txt new file mode 100755 index 0000000..0faca03 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NC_D400/NC_400_2024_template.txt @@ -0,0 +1,45 @@ +Title: NC State Tax Form 400 for 2024 + + { Data is collected by scanning Federal Return results to avoid re-entering data. } + +FedReturn tax_form_files/US_1040/fed_out.txt { File-name of Federal Return output file. } + +Status {Single, Married/Joint, Married/Sep, Head_of_House, Widow(er)} + +L7 0 ; { Additions to Fed AGI - From Sched-S Part A, Line 15. } +L9 0 ; { Deductions from Fed AGI - From Sched-S Part B, Line 38. * } +L10a 0 ; { Number of children qualifying for federal deductions. } +L11 0 ; { Enter 0 to use Std Deduction; Otherwise Itemized Ded. from Sched-S part C, Line 23. } +L13 1 ; { Enter 1 for full-year residents. Otherwise amount from Sched-S part D, Line 26. } +L16 0 ; { Tax credits. (D-400TC part 3 line 20) } +L18 0 ; { Consumer Use Tax. (pg 10) } + + { North Carolina Income Tax Withheld } +L20a ; { Your tax withheld } +L20b ; { Spouse's tax withheld } + + { --- Other tax payments. --- } +L21a 0 ; { 2024 Estimated Tax paid } +L21b 0 ; { Paid with Extension } +L21c 0 ; { Partnership } +L21d 0 ; { S Coroporation } + +{ -------------------------------------------- } +{ --- Optional info for Auto-Fillout only. --- } + Your1stName: + YourInitial: + YourLastName: + YourSocSec#: + Spouse1stName: { Leave blank if Single, etc. } + SpouseInitial: + SpouseLastName: + SpouseSocSec#: + Number&Street: + Apt#: + Town: + State: NC + Zipcode: + +{ + -------------------------------------------- +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NC_D400/README_NC_400.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NC_D400/README_NC_400.txt new file mode 100755 index 0000000..fdb272c --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NC_D400/README_NC_400.txt @@ -0,0 +1,36 @@ +Open Tax Solver - North Carolina State D-400 Personal Income Tax Return +----------------------------------------------------------------------- + +Included here is a program, template, and example for +North Carolina State D-400 personal income tax form. +Intended for use with the NC D-401 Instructions Booklet. + +The NC400_2024_example.txt files is included for testing. +The NC400_2024_template.txt file is a blank starting form for +entering your tax data. For each filer, copy template to a new +name, such as "NC400_2024.txt" or "NC400_2024_aunt_sally.txt, +and fill-in the lines. + +The program consists of two files: + taxsolve_NC400_2024.c - main, customized for NC D-400. + taxsolve_routines.c - general purpose base routines. + +Compile: + cc taxsolve_NC400_2024.c -o taxsolve_NC400_2024 + +Run: + First, run your Federal 1040 taxes and note the output file. + ../../bin/taxsolve_fed1040_2024 fed1040_2024.txt + Then, complete your NC400 form input data file and run. + ../../bin/taxsolve_NC400_2024 NC400_2024.txt + + +For updates and further information, see: + http://sourceforge.net/projects/opentaxsolver/ +Documentation: + http://opentaxsolver.sourceforge.net/ + + +Contributed by S. Jenkins +Updated by Lincoln Baxter for 2007 (lab@lincolnbaxter.com) +Updated by ARoberts for 2008-2024 (aston_roberts@yahoo.com) diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NJ_1040/NJ_1040_2024_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NJ_1040/NJ_1040_2024_example.txt new file mode 100755 index 0000000..5259341 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NJ_1040/NJ_1040_2024_example.txt @@ -0,0 +1,102 @@ +Title: NJ-1040 State 2024 Tax Form { EXAMPLE } + + { ---- Example ---- } + +Status Married/joint { Single, Married/joint, Married/separate, Head_of_household } +YouOver65 no { You Over 65? (answer: yes, no) } +SpouseOver65 no { Spouse Over 65? (answer: yes, no) (Ignored if not joint return.) } +YouBlindDisa no { You Blind or Disabled? (answer: yes, no) } +SpouseBlindDisa no { Spouse Blind or Disabled (answer: yes, no) (Ignored if not joint return.) } +YouVeteran no { You Veteran? (answer: yes, no) } +SpouseVeteran no { Spouse Veteran? (answer: yes, no) (Ignored if not joint return.) } + +L10 0 { Number of qualified dependent children. } +L11 0 { Number of other dependents. } +L12 0 { Dependents attending college. } + +L15 30729.66 { Wages (W-2 Box-16) } + 24539.85 + ; +L16a { Taxable Interest } + 17.71 {Bank Savings} + 128.52 {Bond-fund} + ; +L16b ; { Tax-exempt Interest } +L17 0 { Dividends } + 20.90 {Company Dividends} + 112.01 {Mutual fund} + ; +L18 ; { Net Business profits, (Fed Sched C). } +L19 { Net Capital Gains -- (No dates needed) } + -1658.22 { Bought 100 USX 12-5-02 } + 2209.95 { Sold 100 USX 2-15-06 } + -967.33 { Bought 100 MMM 6-5-04 } + 1245.25 { Sold 100 MMM 3-25-06 } + ; +L20a ; { Pensions, Annuities, and IRA Withdrawals (pg 14). } +L20b ; { Excludable Pensions, Annuities, and IRA Withdrawals (pg 17). } +L21 ; { Partnership income. (See pg 24.) } +L22 ; { S Corporation income. (See pg 24.) } +L23 ; { Rent, royalty, patents income. (Sched NJ-BUS-1, Part IV, Line 4.) } +L24 35.00 ; { Net Gambling winnings. } +L25 ; { Alimony and maintenance payments Received. } +L26 ; { Other (See pg 24). } +L28a ; { Pension Exclusion (See pg 26). } +L28b ; { Other Retirement Income Exclusion (See worksheet pg 26). } +F1 ; { Worksheet F - Medical Expenses. For L30 calculation. } +F4 ; { Qualified Archer MSA contribs from Fed form 8853.} +F5 ; { Self-employed health insurance deduction. } +L32 ; { Alimony and maintenance payments Payed. } +L33 ; { Qualified Conservation Contribution. } +L34 ; { Health Enterprise Zone Deduction. } +L35 ; { Alternative Business Calc Adj (Sched NJ-BUS-2, Line 11) } +L36 ; { Organ/Bone Marrow Donation Deduction } +L37a ; { NJBEST Deduction } +L37b ; { NJCLASS Deduction } +L37c ; { NJ Higher Ed Tuition Deduction } + +L40a 1761.05 ; { Property Tax Paid } + HomeOwner: Y { HomeOwner (answer: yes, no) } + Tenant: Y { Tenant (answer: yes, no) } + +COJ1 24539.85 ; { Income basis for any Out of State taxes paid. Sch COJ (Previously Sch A)} +COJ9a 228.35 ; { Out of state taxes paid (ex. City income tax), if any. Sch COJ (Previously Sch A)} + +L46 ; { Sheltered Workshop Tax Credit. } +L47 ; { Gold Star Family Counseling Credit } +L48 ; { Credit for Employer of Organ/Bone Marrow Donor } +L51 39.50 ; { Use Tax Due on Out-of-State Purchases (pg 35). } +L52 ; { Interest on underpayment of estimated tax. } +L53 ; { Shared Responsibility (Med. Insurance) Payment. } +L55 1095.21 { Withheld tax, from W-2's, Box 17 } + ; +L57 ; { NJ Estimated Tax Payments + Credit from last year's return. } +L58 ; { NJ Earned Income Tax Credit. (See Sched pg 38.) } +L59 ; { Excess NJ UI/HC/WD Withheld, (See pg 38.) } +L60 ; { Excess NJ Disability Insurance Withheld, (See pg 38.) } +L61 ; { Excess NJ Family Leave Insurance Withheld, (See pg 38.) } +L62 ; { Wounded Warriors Caregivers Credit } +L63 ; { Pass-Through Business Alternatve Income Tax Credit } +L64 ; { Child and Dependent Care Credit } +L65 ; { NJ Child Tax Credit } + +{ -------------------------------------------- } +{ --- Optional info for Auto-Fillout only. --- } + Your1stName: Barabra + YourInitial: K + YourLastName: Morgan + YourSocSec#: 123456789 + Spouse1stName: Tyler { Leave blank if Single, etc. } + SpouseInitial: R + SpouseLastName: Morgan + SpouseSocSec#: 987654321 + Number&Street: 456 E. Rutherford Rd. + Town: W. Orange + State: NJ + Zipcode: 07543 + + MarkupPDF L39chkG = X + +{ + -------------------------------------------- +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NJ_1040/NJ_1040_2024_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NJ_1040/NJ_1040_2024_template.txt new file mode 100755 index 0000000..38951e2 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NJ_1040/NJ_1040_2024_template.txt @@ -0,0 +1,92 @@ +Title: NJ-1040 State 2024 Tax Form + + { --- Your Filing Status & Exemptions --- } + +Status Single { Single, Married/joint, Married/separate, Head_of_household } +YouOver65 no { You Over 65? (answer: yes, no) } +SpouseOver65 no { Spouse Over 65? (answer: yes, no) (Ignored if not joint return.) } +YouBlindDisa no { You Blind or Disabled? (answer: yes, no) } +SpouseBlindDisa no { Spouse Blind or Disabled (answer: yes, no) (Ignored if not joint return.) } +YouVeteran no { You Veteran? (answer: yes, no) } +SpouseVeteran no { Spouse Veteran? (answer: yes, no) (Ignored if not joint return.) } + +L10 0 { Number of qualified dependent children. } +L11 0 { Number of other dependents. } +L12 0 { Dependents attending college. } + +L15 { Wages (W-2 Box-16) } + ; +L16a { Taxable Interest } + ; +L16b ; { Tax-exempt Interest } +L17 { Dividends } + ; +L18 ; { Net Business profits, (Fed Sched C). } +L19 { Net Capital Gains -- (No dates needed) } + { (Enter buy cost as negative (-), sell price as positive (+).)} + ; +L20a ; { Pensions, Annuities, and IRA Withdrawals (pg 14). } +L20b ; { Excludable Pensions, Annuities, and IRA Withdrawals (pg 17). } +L21 ; { Partnership income. (See pg 18.) } +L22 ; { S Corporation income. (See pg 18.) } +L23 ; { Rent, royalty, patents income. (Sched NJ-BUS-1, Part IV, Line 4.) } +L24 ; { Net Gambling winnings. } +L25 ; { Alimony and maintenance payments Received. } +L26 ; { Other (See pg 20). } +L28a ; { Pension Exclusion (See pg 21). } +L28b ; { Other Retirement Income Exclusion (See worksheet pg 23). } +F1 ; { Worksheet F - Medical Expenses. For L30 calculation. } +F4 ; { Qualified Archer MSA contribs from Fed form 8853.} +F5 ; { Self-employed health insurance deduction. } +L32 ; { Alimony and maintenance payments Payed. } +L33 ; { Qualified Conservation Contribution. } +L34 ; { Health Enterprise Zone Deduction. } +L35 ; { Alternative Business Calc Adj (Sched NJ-BUS-2, Line 11) } +L36 ; { Organ/Bone Marrow Donation Deduction } +L37a ; { NJBEST Deduction } +L37b ; { NJCLASS Deduction } +L37c ; { NJ Higher Ed Tuition Deduction } + +L40a ; { Property Tax Paid } + HomeOwner: { HomeOwner (answer: yes, no) } + Tenant: { Tenant (answer: yes, no) } + +COJ1 ; { Income basis for any Out of State taxes paid. Sch COJ (Previously Sch A)} +COJ9a ; { Out of state taxes paid (ex. City income tax), if any. Sch COJ (Previously Sch A)} + +L46 ; { Sheltered Workshop Tax Credit. } +L47 ; { Gold Star Family Counseling Credit } +L48 ; { Credit for Employer of Organ/Bone Marrow Donor } +L51 ; { Use Tax Due on Out-of-State Purchases (pg 37). } +L52 ; { Interest on underpayment of estimated tax. } +L53 ; { Shared Responsibility (Med. Insurance) Payment. } +L55 { Withheld tax, from W-2's, Box 17 } + ; +L57 ; { NJ Estimated Tax Payments + Credit from last year's return. } +L58 ; { NJ Earned Income Tax Credit. (See Sched pg 39.) } +L59 ; { Excess NJ UI/HC/WD Withheld, (See pg 39.) } +L60 ; { Excess NJ Disability Insurance Withheld, (See pg 39.) } +L61 ; { Excess NJ Family Leave Insurance Withheld, (See pg 39.) } +L62 ; { Wounded Warriors Caregivers Credit, (See pg 40.) } +L63 ; { Pass-Through Business Alternatve Income Tax Credit } +L64 ; { Child and Dependent Care Credit } +L65 ; { NJ Child Tax Credit } + +{ -------------------------------------------- } +{ --- Optional info for Auto-Fillout only. --- } + Your1stName: + YourInitial: + YourLastName: + YourSocSec#: + Spouse1stName: { Leave blank if Single, etc. } + SpouseInitial: + SpouseLastName: + SpouseSocSec#: + Number&Street: + Town: + State: NJ + Zipcode: + +{ + -------------------------------------------- +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NJ_1040/README_NJ_1040.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NJ_1040/README_NJ_1040.txt new file mode 100755 index 0000000..84e6094 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NJ_1040/README_NJ_1040.txt @@ -0,0 +1,15 @@ +Open Tax Solveer - NJ State Tax Returns +--------------------------------------- + +Included here is a program, template, and example for +New Jersey State tax form NJ-1040. + +The example*.txt file is included for testing. +The template*.txt file is a blank starting form for entering +your tax data. + +Compile: + cc taxsolve_NJ_1040_2024.c -o taxsolve_NJ_1040_2024 + +Run: + ./taxsolve_NJ_1040_2024 NJ_1040_2024.txt diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NY_IT201/NY_IT201_2024_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NY_IT201/NY_IT201_2024_example.txt new file mode 100755 index 0000000..da458bc --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NY_IT201/NY_IT201_2024_example.txt @@ -0,0 +1,90 @@ +Title: NY State 2024 Tax Form IT-201 - EXAMPLE + +{ --- EXAMPLE --- } + +Round_to_Whole_Dollars + + { Data for NY Lines 1-19 is collected by scanning Federal return to avoid re-entering it. } +FileName tax_form_files/US_1040/US_1040_example_out.txt { File-name of Federal Return output file. } + +{ --- Your Info --- (fieldsz=12) } + +YourDOB 11/11/1988 { Your Date of Birth (mm/dd/yyyy) } +SpouseDOB 1/2/1991 { Spouse Date of Birth (mm/dd/yyyy) or leave blank. } + +County Putnam { County } +SchooldDist Wilshire { School District (for PDF form). } +SchoolCode R456 { School Code (for PDF form). } + +D1_ForeignAcct n { Did you have a foreign account? (answer: y, n) } +D2_1-YonkRelCred n/a { Yonker resident recv. Prop. relief credit? (answer: y, n, n/a)) } +D2_2-YRCamount { Enter amount of Yonkers Relief Credit (or leave blank). } +D3-NonQualComp n { Required to report NonQualified Deferred Comp? (answer: y, n) } +E1_LivedNYC n { Did you or spouse maintain living quarters in NYC? (answer: y, n) } +E2_DaysNYC { Days NYC? (or leave blank) } +F1_MonthsYouNYC { Months You lived in NYC } +F2_MonthsSpNYC { Months Spouse lived in NYC } +G_SpecCondCode { 2-character special condition code if applicable. } + +Dependent no { Are you a Dependent on another's return? (answer: yes, no) } + + { ----- NY Additions ----- } +L20 20 ; { Interest income from non-NY state or local bonds } +L21 21 ; { Public employee retirement contributions (pg 17) } +L22 22 ; { New York's 529 college savings program distributions (pg 17) } +L23 23 ; { Other (Form IT-225, line 9) } + + { ----- NY Subtractions ----- } +L26 26 ; { Pensions of NYState, local & fed gov'ts (see page 18) } +L28 28 ; { US Gov't Bond Interest } +L29 29 ; { Pension and annuity income exclusion } +L30 30 ; { New York's 529 college savings program deduction/earnings } +L31 31 ; { Other (Form IT-225, line 18) } + +LTcare% 10 ; { Percent of long-term care premiums in Fed-Sched-A line 1, if any. } +AddAdj 20 ; { Any additional itemization adjustments (worksheet line k pg 26) } +CollegeDed 30 ; { College tuition itemized deduction (Form IT-272 ) } +IT196_41 ; { State, local, and foreign income tax subtraction adjustments } +IT196_43 ; { College tuition itemized deduction. } +IT196_44 ; { Addition adjustments (see IT-196 instructions)} +IT196_48 ; { College tuition itemized deduction. } + +L36 1 ; { Number of Dependent Exemptions (Pg 21) } +Exemptions 1 { Number of NY dependent exemptions, Pg 21. } + +L41 41 ; { Resident credit, Form IT-112-R or IT-112-C, pg 23 } +L42 42 ; { Other New York State nonrefundable credits } +L45 45 ; { Net Other New York State taxes, Form IT-201-ATT, line 30 } +NYC_Resident no ; { City of New York Resident (answer: yes, no) } + + { ----- City of New York taxes and credits -- ONLY ----- } + L50 ; { Part-year New York City resident tax } + L51 ; { Other NYC taxes (from IT-201-ATT part III, line 4) } + L53 ; { NYC nonrefundable credits (from IT-201-ATT part IV, line 6-7) } + L54a ; { MCTMT net earnings base for Zone 1 } + L54b ; { MCTMT net earnings base for Zone 2 } + L54c ; { MCTMT for Zone 1 } + L54d ; { MCTMT for Zone 2 } + L55 ; { Yonkers resident income tax surcharge } + L56 ; { Yonkers non-resident earnings tax (Form &-203) } + L57 ; { Part-year Yonkers resident income tax surcharge } + { -- } + +L59 59 ; { Sales or use tax, pg 27. } +L60 60 ; { Voluntary Gift contributions, pg 28. } +L63 63 ; { Empire State child credit (attach new Form IT-213) } +L64 64 ; { NY Child care/dependent credit. Form IT-216. } +L65 65 ; { NY Earned income credit. Form IT-213. } +L66 66 ; { NY State noncustodial parent EIC (attach new Form IT-209) } +L67 67 ; { Real property credit. Form IT-214. } +L68 68 ; { College tuition credit. Form IT-272. } + +L71 71 ; { Other refundable credits, IT-201-ATT line 18)} +L72 1503 ; { Total NY State tax withheld. } + + { ----- NYC Residents ONLY --- City and Yonkers tax withheld ----- } + L73 ; { Total City of NY tax withheld. } + L74 ; { Yonkers tax withheld. } + { -- } + +L75 75 ; { Total estimated tax payments (from IT-370) } diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NY_IT201/NY_IT201_2024_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NY_IT201/NY_IT201_2024_template.txt new file mode 100755 index 0000000..1000162 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NY_IT201/NY_IT201_2024_template.txt @@ -0,0 +1,91 @@ +Title: NY State 2024 Tax Form IT-201 + + { Data is collected by scanning your Federal return to avoid re-entering it. } +FileName tax_form_files/US_1040/your_fed_out.txt { File-name of Federal Return output file. } + +{ --- Your Info --- (fieldsz=12) } + +YourDOB { Your Date of Birth (mm/dd/yyyy) } +SpouseDOB { Spouse Date of Birth (mm/dd/yyyy) or leave blank. } + +County { County (for PDF form). } +SchooldDist { School District (for PDF form). } +SchoolCode { School Code (for PDF form). } + +D1_ForeignAcct n { Did you have a foreign account? (answer: y, n) } +D2_1-YonkRelCred n/a { Yonker resident recv. Prop. relief credit? (answer: y, n, n/a)) } +D2_2-YRCamount { Enter amount of Yonkers Relief Credit (or leave blank). } +D3-NonQualComp n { Required to report NonQualified Deferred Comp? (answer: y, n) } +E1_LivedNYC n { Did you or spouse maintain living quarters in NYC? (answer: y, n) } +E2_DaysNYC { Days NYC? (or leave blank) } +F1_MonthsYouNYC { Months You lived in NYC } +F2_MonthsSpNYC { Months Spouse lived in NYC } +G_SpecCondCode { 2-character special condition code if applicable. } + +Dependent no { Are you a Dependent on another's return? (answer: yes, no) } + + { ----- NY Additions ----- } +L20 ; { Interest income from non-NY state or local bonds } +L21 ; { Public employee retirement contributions (pg 17) } +L22 ; { New York's 529 college savings program distributions (pg 17) } +L23 ; { Other (Form IT-225, line 9) } + + { ----- NY Subtractions ----- } +L26 ; { Pensions of NYState, local & fed gov'ts (see page 18) } +L28 ; { US Gov't Bond Interest } +L29 ; { Pension and annuity income exclusion } +L30 ; { New York's 529 college savings program deduction/earnings } +L31 ; { Other (Form IT-225, line 18) } + + { ----- IT-196 Entries ----- } +LTcare% ; { Percent of long-term care premiums in Fed-Sched-A line 1, if any. } +AddAdj ; { Any additional itemization adjustments (worksheet line k pg 26) } +CollegeDed ; { College tuition itemized deduction (Form IT-272 ) } +IT196_41 ; { State, local, and foreign income tax subtraction adjustments } +IT196_43 ; { College tuition itemized deduction. } +IT196_44 ; { Addition adjustments (see IT-196 instructions)} +IT196_48 ; { College tuition itemized deduction. } + +L36 ; { Number of Dependent Exemptions (Pg 21) } +Exemptions 0 { Number of NY dependent exemptions, Pg 21. } + +L41 ; { Resident credit, Form IT-112-R or IT-112-C, pg 23 } +L42 ; { Other New York State nonrefundable credits } +L45 ; { Net Other New York State taxes, Form IT-201-ATT, line 30 } +NYC_Resident no ; { City of New York Resident (answer: yes, no) } + + { ----- City of New York taxes and credits -- ONLY ----- } + L50 ; { Part-year New York City resident tax } + L51 ; { Other NYC taxes (from IT-201-ATT part III, line 4) } + L53 ; { NYC nonrefundable credits (from IT-201-ATT part IV, line 6-7) } + L54a ; { MCTMT net earnings base for Zone 1 } + L54b ; { MCTMT net earnings base for Zone 2 } + L54c ; { MCTMT for Zone 1 } + L54d ; { MCTMT for Zone 2 } + L55 ; { Yonkers resident income tax surcharge } + L56 ; { Yonkers non-resident earnings tax (Form &-203) } + L57 ; { Part-year Yonkers resident income tax surcharge } + { -- } + +L59 ; { Sales or use tax, pg 27. } +L60 ; { Voluntary Gift contributions, pg 28. } +L63 ; { Empire State child credit (attach new Form IT-213) } +L64 ; { NY Child care/dependent credit. Form IT-216. } +L65 ; { NY Earned income credit. Form IT-213. } +L66 ; { NY State noncustodial parent EIC (attach new Form IT-209) } +L67 ; { Real property credit. Form IT-214. } +L68 ; { College tuition credit. Form IT-272. } + +L71 ; { Other refundable credits, IT-201-ATT line 18)} +L72 ; { Total NY State tax withheld. } + + { ----- NYC Residents ONLY --- City and Yonkers tax withheld ----- } + L73 ; { Total City of NY tax withheld. } + L74 ; { Yonkers tax withheld. } + { -- } + +L75 ; { Total estimated tax payments (from IT-370) } + +{ + ---------------------------- +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NY_IT201/README_NY_IT201.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NY_IT201/README_NY_IT201.txt new file mode 100755 index 0000000..a3201e6 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/NY_IT201/README_NY_IT201.txt @@ -0,0 +1,15 @@ +Open Tax Solveer - NY State Tax Returns +--------------------------------------- + +In here are included programs, templates, and examples for +New York State tax form IT-201. + +The example*.txt file is included for testing. +The template*.txt file is a blank starting form for entering +your tax data. + +Compile: + cc taxsolve_NY_IT201_2024.c -o taxsolve_NY_IT201_2024 + +Run: + ./taxsolve_NY_IT201_2024 NY_IT201_2024_template.txt diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/OH_IT1040/OH_IT1040_2024_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/OH_IT1040/OH_IT1040_2024_example.txt new file mode 100755 index 0000000..65f9904 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/OH_IT1040/OH_IT1040_2024_example.txt @@ -0,0 +1,139 @@ +Title: Ohio IT1040 State 2024 Tax Form -- EXAMPLE + +{ -- EXAMPLE -- } + +Status Single { Single, Married/joint, Married/separate, Head_of_household } + +Exemptions 1 ; { Exemptions, self=1/depend=2,3,... (answer: 1, 2, 3, 4, 5, ...) } + +JointCredit No { Yes if Married-Filing-Jointly & both have AGI >= $500. (answer: Yes, No)} + +L1 33,456.00 ; { Federal Adjusted Gross Income (IRS form 1040, line 11) } +L4 823.45 ; { Personal and dependent exemption deduction, Sched-J } +L6 3,456 ; { Taxable business income (Ohio Schedule IT BUS, line 13) } +L8b 500 ; { Business income tax liability (Schedule IT BUS, line 14) } +L11 ; { Interest penalty on underpayment of estimated tax (Ohio IT/SD 2210) } +L12 78.90 ; { Sales and use tax due } +L14 865.67 ; { Ohio Tax Withheld (box 17 on your W-2) } +L15 ; { Estimated & extension payments made, & credit carryforward from last year } +L17 ; { Amended return only - amount previously paid with original } +L19 ; { Amended return only - overpayment previously received on original } + +{ --- Additions --- (Items not included in line L1 above.) } +SchedA_1 120 ; { Non-Ohio state or local government interest and dividends } +SchedA_2 ; { Ohio pass-through entity and financial institutions taxes paid } +SchedA_3 45 ; { Taxes paid to another state or District of Columbia related to IRS notice 2021-75 } +SchedA_4 ; { 529 plan funds used for non-qualified expenses } +SchedA_5 ; { Losses from sale or disposition of Ohio public obligations } +SchedA_6 ; { Nonmedical withdrawals from medical savings account } +SchedA_7 ; { Reimbursement of expenses previously deducted for Ohio income tax return } +SchedA_8 ; { Ineligible withdrawals from an Ohio Homebuyer Plus account. } +{ - Federal - } +SchedA_9 321.7 ; { Internal Revenue Code sections 168(k) and 179 depreciation expense add-back } +SchedA_10 ; { Exempt federal interest and dividends subject to state taxation } +SchedA_11 ; { Federal conformity additions } + +{ --- Deductions --- } +SchedA_13 99.0 ; { Business income deduction (Ohio Schedule IT BUS, line 13) } +SchedA_14 3,333 ; { Compensation earned in Ohio by residents of neighboring states } +SchedA_15 ; { Taxable refunds, credits, or offsets of state * local income taxes (Fed1040 Sched-1 L1)} +SchedA_16 ; { Taxable Social Security benefits (Fed1040 L6b) } +SchedA_17 ; { Certain railroad retirement benefits } +SchedA_18 78.11 ; { Interest income from Ohio public obligations ... } +SchedA_19 ; { Amounts contributed to Ohio county's individual development account } +SchedA_20 ; { Amounts contributed to a STABLE account: Ohio's ABLE plan. } +SchedA_21 ; { Income earned in Ohio by a qualifying out-of-state business } +SchedA_22 ; { Certain payments related to the East Palestine train derailment. } +SchedA_23 ; { Ohio adoption grant payments received from Ohio Dept of Job & Family Services } +SchedA_24 ; { Amounts contributed to and interest earned on an Ohio Homebuyer Plus account } + +{ - Federal - } +SchedA_25 22.10 ; { Federal interest and dividends exempt from state taxation } +SchedA_26 ; { Deduction of prior year 168(k) and 179 depreciation add-backs } +SchedA_27 ; { Refund or reimbursements shown on IRS 1040, Sched 1, line 21 } +SchedA_28 ; { Repayment of income reported in a prior year } +SchedA_29 88.02 ; { Wage expense not deducted based on Federal work opportunity tax credit } +SchedA_30 ; { Federal conformity deductions } + +{ - Uniformed Services - } +SchedA_31 6,000.0 ; { Military pay for Ohio residents received while stationed outside Ohio } +SchedA_32 ; { Income earned by military nonresidents ... } +SchedA_33 ; { Uniformed services retirement income } +SchedA_34 ; { Military injury relief fund } +SchedA_35 ; { Certain Ohio National Guard reimbursements and benefits } + +{ - Education - } +SchedA_36 500.0 ; { Amounts contributed to 529 Plan. } +SchedA_37 ; { Pell College Opportunity taxable grant amounts used for room and board } +SchedA_38 ; { Ohio educator expenses in excess of federal deduction } +SchedA_39 ; { Income from loan repayments by Ohio DOHE under rural incentive program. } +SchedA_40 ; { Grant payments made by Ohio DOHE on behalf of adopted students. } + +{ - Medical - } +SchedA_41 ; { Disability benefits } +SchedA_42 ; { Survivorship benefits } +SchedA_43 ; { Unreimbursed medical and health care expenses } +SchedA_44 ; { Medical savings account contributions/earnings } +SchedA_45 230.00 ; { Qualified organ donor expenses } + +{ --- Schedule of Credits --- } +Credits_2 ; { Retirement income credit. (include 1099-R forms) } +Credits_3 ; { Lump sum retirement credit (Ohio LS WKS, line 6) } +Credits_4 ; { Senior citizen credit } +Credits_5 ; { Lump sum distribution credit } +Credits_6 ; { Child care and dependent care credit } +Credits_7 20.00 ; { Displaced worker training credit } +Credits_8 4.44 ; { Campaign contribution credit for Ohio General Assembly } + +Credits_13 ; { Earned income credit. } +Credits_14 ; { Home school expenses credit. } +Credits_15 ; { Scholarship donation credit. } +Credits_16 ; { Nonchartered, nonpublic school tuition credit. } +Credits_17 10.00 ; { Credit for work-based learning experiences } +Credits_18 50.00 ; { Ohio adoption credit } +Credits_19 ; { Job retention credit, nonrefundable portion } +Credits_20 ; { Credit for eligible new employees in enterprise zones } +Credits_21 32.31 ; { Credit for the beginning farmers financial management program } +Credits_22 ; { Credit for commercial vehicle operator training expenses } +Credits_23 ; { Welcome Home Ohio credit } +Credits_24 ; { Credit for sale/rental of agricultural assets to beginning farmers } +Credits_25 ; { Grape production credit } +Credits_26 10.00 ; { InvestOhio credit (include a copy of the credit certificate) } +Credits_27 3.50 ; { Lead abatement credit } +Credits_28 22.00 ; { Opportunity zone investment credit } +Credits_29 75.00 ; { Tech investment credit } +Credits_30 ; { Enterprise zone day care and training credits } +Credits_31 50.14 ; { Research and development credit } +Credits_32 ; { Nonrefundable Ohio historic preservation credit } +Credits_33 ; { Ohio low-income housing credit (include a copy of the credit certificate) } +Credits_34 ; { Affordable single-family housing credit (include a copy of the credit certificate) } + +{ - Residency Credits - } +Credits_37 ; { Nonresident credit - Ohio IT NRC, line 20 (include a copy) } +Credits_38 94,242.42 ; { Resident credit - OH IT RC, line 7(include a copy) } + +{ - Refundable Credits - } +Credits_40 9.0 ; { Refundable Historic preservation credit } +Credits_41 ; { Refundable Business jobs credit } +Credits_42 ; { Pass-through entity credit } +Credits_43 20.0 ; { Motion picture production credit } +Credits_44 ; { Film and theater capital improvements credit } +Credits_45 10.0 ; { Venture capital credit } + +{ ------------------------------------------- } +{ --- Optional info for Auto-Fillout only. --- } + Your1stName: Fred, P { First name, Middle Initial } + YourLastName: Symthe + YourSocSec#: 123-45-6789 + Spouse1stName: { First name, Middle Initial (Leave blank if Single, etc.) } + SpouseLastName: + SpouseSocSec#: + Number&Street: 432 Ormo St + Town: Halo Ville + Zipcode: 43004 + AddressLine2: Unit B + OhioCounty: LIMA { 4 letters } + +{ + -------------------------------------------- +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/OH_IT1040/OH_IT1040_2024_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/OH_IT1040/OH_IT1040_2024_template.txt new file mode 100755 index 0000000..5455f8f --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/OH_IT1040/OH_IT1040_2024_template.txt @@ -0,0 +1,138 @@ +Title: Ohio IT1040 State 2024 Tax Form + + { --- Your Filing Status & Exemptions --- } + +Status Single { Single, Married/joint, Married/separate, Head_of_household } + +Exemptions ; { Exemptions, self=1/depend=2,3,... (answer: 1, 2, 3, 4, 5, ...) } + +JointCredit No { Yes if Married-Filing-Jointly & both have AGI >= $500. (answer: Yes, No)} + +L1 ; { Federal Adjusted Gross Income (IRS form 1040, line 11) } +L4 ; { Personal and dependent exemption deduction, Sched-J } +L6 ; { Taxable business income (Ohio Schedule IT BUS, line 13) } +L8b ; { Business income tax liability (Schedule IT BUS, line 14) } +L11 ; { Interest penalty on underpayment of estimated tax (Ohio IT/SD 2210) } +L12 ; { Sales and use tax due } +L14 ; { Ohio Tax Withheld (box 17 on your W-2) } +L15 ; { Estimated & extension payments made, & credit carryforward from last year } +L17 ; { Amended return only - amount previously paid with original } +L19 ; { Amended return only - overpayment previously received on original } + +{ --- Additions --- (Items not included in line L1 above.) } +SchedA_1 ; { Non-Ohio state or local government interest and dividends } +SchedA_2 ; { Ohio pass-through entity and financial institutions taxes paid } +SchedA_3 ; { Taxes paid to another state or District of Columbia related to IRS notice 2021-75 } +SchedA_4 ; { 529 plan funds used for non-qualified expenses } +SchedA_5 ; { Losses from sale or disposition of Ohio public obligations } +SchedA_6 ; { Nonmedical withdrawals from medical savings account } +SchedA_7 ; { Reimbursement of expenses previously deducted for Ohio income tax return } +SchedA_8 ; { Ineligible withdrawals from an Ohio Homebuyer Plus account. } +{ - Federal - } +SchedA_9 ; { Internal Revenue Code sections 168(k) and 179 depreciation expense add-back } +SchedA_10 ; { Exempt federal interest and dividends subject to state taxation } +SchedA_11 ; { Federal conformity additions } + +{ --- Deductions --- } +SchedA_13 ; { Business income deduction (Ohio Schedule IT BUS, line 13) } +SchedA_14 ; { Compensation earned in Ohio by residents of neighboring states } +SchedA_15 ; { Taxable refunds, credits, or offsets of state * local income taxes (Fed1040 Sched-1 L1)} +SchedA_16 ; { Taxable Social Security benefits (Fed1040 L6b) } +SchedA_17 ; { Certain railroad retirement benefits } +SchedA_18 ; { Interest income from Ohio public obligations ... } +SchedA_19 ; { Amounts contributed to Ohio county's individual development account } +SchedA_20 ; { Amounts contributed to a STABLE account: Ohio's ABLE plan. } +SchedA_21 ; { Income earned in Ohio by a qualifying out-of-state business } +SchedA_22 ; { Certain payments related to the East Palestine train derailment. } +SchedA_23 ; { Ohio adoption grant payments received from Ohio Dept of Job & Family Services } +SchedA_24 ; { Amounts contributed to and interest earned on an Ohio Homebuyer Plus account. } + +{ - Federal - } +SchedA_25 ; { Federal interest and dividends exempt from state taxation } +SchedA_26 ; { Deduction of prior year 168(k) and 179 depreciation add-backs } +SchedA_27 ; { Refund or reimbursements shown on IRS 1040, Sched 1, line 21 } +SchedA_28 ; { Repayment of income reported in a prior year } +SchedA_29 ; { Wage expense not deducted based on Federal work opportunity tax credit } +SchedA_30 ; { Federal conformity deductions } + +{ - Uniformed Services - } +SchedA_31 ; { Military pay for Ohio residents received while stationed outside Ohio } +SchedA_32 ; { Income earned by military nonresidents ... } +SchedA_33 ; { Uniformed services retirement income } +SchedA_34 ; { Military injury relief fund } +SchedA_35 ; { Certain Ohio National Guard reimbursements and benefits } + +{ - Education - } +SchedA_36 ; { Amounts contributed to 529 Plan. } +SchedA_37 ; { Pell College Opportunity taxable grant amounts used for room and board } +SchedA_38 ; { Ohio educator expenses in excess of federal deduction } +SchedA_39 ; { Income from loan repayments by Ohio DOHE under rural incentive program. } +SchedA_40 ; { Grant payments made by Ohio DOHE on behalf of adopted students. } + +{ - Medical - } +SchedA_41 ; { Disability benefits } +SchedA_42 ; { Survivorship benefits } +SchedA_43 ; { Unreimbursed medical and health care expenses } +SchedA_44 ; { Medical savings account contributions/earnings } +SchedA_45 ; { Qualified organ donor expenses } + +{ --- Schedule of Credits --- } +Credits_2 ; { Retirement income credit. (include 1099-R forms) } +Credits_3 ; { Lump sum retirement credit (Ohio LS WKS, line 6) } +Credits_4 ; { Senior citizen credit } +Credits_5 ; { Lump sum distribution credit } +Credits_6 ; { Child care and dependent care credit } +Credits_7 ; { Displaced worker training credit } +Credits_8 ; { Campaign contribution credit for Ohio General Assembly } + +Credits_13 ; { Earned income credit. } +Credits_14 ; { Home school expenses credit. } +Credits_15 ; { Scholarship donation credit. } +Credits_16 ; { Nonchartered, nonpublic school tuition credit. } +Credits_17 ; { Credit for work-based learning experiences } +Credits_18 ; { Ohio adoption credit } +Credits_19 ; { Job retention credit, nonrefundable portion } +Credits_20 ; { Credit for eligible new employees in enterprise zones } +Credits_21 ; { Credit for the beginning farmers financial management program } +Credits_22 ; { Credit for commercial vehicle operator training expenses } +Credits_23 ; { Welcome Home Ohio credit } +Credits_24 ; { Credit for sale/rental of agricultural assets to beginning farmers } +Credits_25 ; { Grape production credit } +Credits_26 ; { InvestOhio credit (include a copy of the credit certificate) } +Credits_27 ; { Lead abatement credit } +Credits_28 ; { Opportunity zone investment credit } +Credits_29 ; { Tech investment credit } +Credits_30 ; { Enterprise zone day care and training credits } +Credits_31 ; { Research and development credit } +Credits_32 ; { Nonrefundable Ohio historic preservation credit } +Credits_33 ; { Ohio low-income housing credit (include a copy of the credit certificate) } +Credits_34 ; { Affordable single-family housing credit (include a copy of the credit certificate) } + +{ - Residency Credits - } +Credits_37 ; { Nonresident credit - Ohio IT NRC, line 20 (include a copy) } +Credits_38 ; { Resident credit - OH IT RC, line 7(include a copy) } + +{ - Refundable Credits - } +Credits_40 ; { Refundable Historic preservation credit } +Credits_41 ; { Refundable Business jobs credit } +Credits_42 ; { Pass-through entity credit } +Credits_43 ; { Motion picture production credit } +Credits_44 ; { Film and theater capital improvements credit } +Credits_45 ; { Venture capital credit } + +{ ------------------------------------------- } +{ --- Optional info for Auto-PDF-Fillout. --- } + Your1stName: { First name, Middle Initial } + YourLastName: + YourSocSec#: + Spouse1stName: { First name, Middle Initial (Leave blank if Single, etc.) } + SpouseLastName: + SpouseSocSec#: + Number&Street: + Town: + Zipcode: + AddressLine2: + OhioCounty: { 4 letters } +{ + ------------------------------------------- +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/OH_IT1040/README_OH_IT1040.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/OH_IT1040/README_OH_IT1040.txt new file mode 100755 index 0000000..c18d7a3 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/OH_IT1040/README_OH_IT1040.txt @@ -0,0 +1,18 @@ +Open Tax Solver - Ohio IT-1040 State Tax Return +----------------------------------------------- + +Included here is a program, template, and example for +Ohio State tax form IT-1040. + +The example*.txt file is included for testing. +The template*.txt file is a blank starting form for entering +your tax data. + +Compile: + cc src/taxsolve_OH_IT1040_2024.c -o bin/taxsolve_OH_IT1040_2024 + +Run: + bin/taxsolve_OH_IT1040_2024 OH1040_2024.txt + + Or, from this directory: + ../../bin/taxsolve_OH_IT1040_2024 OH1040_2024.txt diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/OR_40/OR_40_2024_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/OR_40/OR_40_2024_example.txt new file mode 100755 index 0000000..ac524ed --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/OR_40/OR_40_2024_example.txt @@ -0,0 +1,196 @@ +Title: Oregon Form OR-40 - 2024 + + { --- Federal Return --- } +FileName1040: tax_form_files/US_1040/US_1040_example_out.txt {File-name of Form 1040 output file.} + { --- Fiscal Year, Amended Return, Special Status --- } +FiscalYearEnd: { For fiscal year filers, enter fiscal year end as MM/DD/YYYY} +CkAmended No { Is this an amended return ? (answer: Yes, No) } +NOLTaxYear: { If amending for an NOL (Net Operating Loss), enter the tax year the NOL was generated } +CkCalcAsIfFed No { Calculated with "as if" federal return? (answer: Yes, No) } +CkShortYear No { Short-year tax election? (answer: Yes, No) } +CkExtFiled No { Extension Filed? (answer: Yes, No) } +CkFormOR24 No { Form OR-24? (answer: Yes, No) } +CkFormOR243 No { Form OR-243? (answer: Yes, No) } +CkFedForm8379 No { Federal Form 8379? (answer: Yes, No) } +CkFedForm8886 No { Federal Form 8886? (answer: Yes, No) } +CkDisasterRelief No { Disaster relief? (answer: Yes, No) } + { --- Optional info for auto-fillout only --- } + { The federal Form 1040 is used as the primary source for optional personal +info, but Oregon requires the following additional information. } +YourDOB: 01/01/1951 { Enter your date of birth as MM/DD/YYYY } +CkYFirstSSN No { Your first time using this SSN? (answer: Yes, No) } +CkYAppITIN No { You applied for ITIN? (answer: Yes, No) } +CkYDeceased No { Taxpayer is deceased? (answer: Yes, No) } +SpouseDOB: 04/01/1955 { Enter your spouse's date of birth as MM/DD/YYYY } +CkSFirstSSN No { Spouse first time using this SSN? (answer: Yes, No) } +CkSAppITIN No { Spouse applied for ITIN? (answer: Yes, No) } +CkSDeceased No { Spouse is deceased? (answer: Yes, No) } +Country: US { Country } +Phone: 000-111-2222 { Phone number, enter as XXX-XXX-XXXX } + { --- Exemptions --- } +CkL6aRegular Yes { Regular exemption credit for yourself? (answer: Yes, No) } +CkL6aDisabled No { You are severely disabled? (answer: Yes, No) } +CkL6aDep No { Someone else can claim you as a dependent? (answer: Yes, No) } +CkL6bRegular Yes { Spouse regular exemption credit (answer: Yes, No) } +CkL6bDisabled Yes { Spouse is severely disabled? (answer: Yes, No) } +CkL6bDep No { Someone else can claim your spouse as a dependent? (answer: Yes, No) } + { --- Dependents --- } + { --- Optional info for auto-fillout only --- } + { The federal Form 1040 is used as the primary source for dependent info, + but Oregon requires the following additional information. + Enter dependents on Form 1040 in order from youngest to oldest, as required by + Oregon, so that they will match with the DOB values entered here. + } +Dep1DOB: 01/01/2014 { Enter Dependent 1 data of birth as MM/DD/YYYY } +Dep1Code: SD { Enter Dependent 1 code. Click label for code info.} +CkDep1Dis Yes { Dependent 1 has a qualifying disability? (answer: Yes, No) } +Dep2DOB: 02/02/2012 { Enter Dependent 2 data of birth as MM/DD/YYYY } +Dep2Code: SD { Enter Dependent 2 code } +CkDep2Dis No { Dependent 2 has a qualifying disability? (answer: Yes, No) } +Dep3DOB: 03/03/2010 { Enter Dependent 3 data of birth as MM/DD/YYYY } +Dep3Code: SD { Enter Dependent 3 code } +CkDep3Dis No { Dependent 3 has a qualifying disability? (answer: Yes, No) } + { --- Dependent Totals --- } +L6c 3 ; { Total number of dependents } +L6d 1 ; { Total number of dependent children with a qualifying disability (see instructions) } + { --- Taxable Income --- } + { --- Subtractions from Taxable Income --- } +L10_worksheet_L4 4 ; { Federal Tax Worksheet line 4 'Other Taxes'. Form 1040 section 2 line 17 with exceptions. } +L10_worksheet_L7 7 ; { Federal Tax Worksheet line 7 'Premium tax credit (Form 8962, line 24)' } +L12 12 ; { Oregon income tax refund included in federal income } + { --- Deductions --- } +CkStdDedOverride No { Set to 'Yes' to override auto calculation of the standard deduction. Click label for line help. (answer: Yes, No) } +StdDedOverride ; { Enter a manually calculated standard deduction if previous field is set to 'Yes' } +CkL17a Yes { You are 65 or older (answer: Yes, No) } +CkL17b No { You are blind (answer: Yes, No) } +CkL17c Yes { Spouse is 65 or older (answer: Yes, No) } +CkL17d No { Spouse is blind (answer: Yes, No) } + { --- Oregon Tax --- } + { If all three of these checkboxes are set to 'No', the standard tax table is used for auto-calculation } +CkL20a No { Use Schedule OR-FIA-40 for tax? (answer: Yes, No) } +CkL20b No { Use Worksheet FCG for tax? (answer: Yes, No) } +CkL20c No { Use Schedule OR-PTE-FY for tax? (answer: Yes, No) } +AltMethodTaxAmt ; { Enter tax amount if any checkbox is selected, and an alternative method is used } +L21 21 ; { Interest on certain installment sales } + { --- Standard and Carryfoward Credits --- } +L26 26 ; { Political contribution credit. See limits in instructions } + { --- Payments and Refundable Credits --- } +L32 32 ; { Oregon income tax withheld. Include a copy of your Forms W-2 and 1099 } +L33 33 ; { Prior-year refund applied as estimated payment } +L34 2400 ; { Estimated tax payments for 2024. Include all estimated payments, including +any extension payment, that you made by April 15, 2025 } +L35 35 ; { Estimated tax payments from Schedule OR-K-1, line 20 } +L36 36 ; { Earned income credit } +L37 37 ; { Oregon Kids Credit } + { --- Tax to pay or refund --- } +L43 43 ; { Penalty and interest for filing or paying late } +L44 44 ; { Interest on underpayment of estimated tax. Include Form OR-10 } +L44a 1 ; { Exception number from Form OR-10, line 1 } +CkL44b No { Enter Yes if you annualized (answer: Yes, No) } +L48 8 ; { Amount from line 47 you want to apply as a payment of your 2025 +estimated tax } +L49 9 ; { Charitable checkoff donations from Schedule OR-DONATE, line 30 } +L50 6 ; { Political party $3 checkoff } +L50a: 501 { Your party code } +L50b: 501 { Spouse party code } +L51 51 ; { Higher education savings plan deposits from Schedule OR-529, line 5 } + { --- Direct deposit --- } + { --- Optional info for auto-fillout only --- } +CkL54DepOutUS No { Is the final deposit destination outside the United States? (answer: Yes, No) } +CkAcctChecking Yes { Checking account? (answer: Yes, No) } +CkAcctSavings No { Savings account? (answer: Yes, No) } +AcctRoutingNumber: 012345678 { Enter 9 digit ACH routing number } +AcctNumber: ABCD1234EFGH5678 { Enter ACH account number, up to 17 digits } + { --- OR-40 Supporting Schedules --- } + { --- Schedule OR-A --- } + { Medical and dental expenses } +SchA_L1 7431 ; { Medical and dental expenses } + { Taxes you paid } +SchA_L5 5 ; { State and local income taxes. Don't include Oregon income tax, +including Oregon withholding. } +SchA_L6 6 ; { Real estate taxes } +SchA_L7 7 ; { Personal property taxes } +SchA_L10 10 ; { Other taxes } +SchA_L10_Type: Special Tax of some kind { Type of 'Other taxes' on L10 } + { Interest you paid } +SchA_L12 12 ; { Mortgage interest and points reported on federal Form 1098 } +SchA_L13 13 ; { Mortgage interest not reported on federal Form 1098 } +SchA_L14 14 ; { Points not reported on federal Form 1098 } +SchA_L16 16 ; { Investment interest } + { Gifts to charity } +SchA_L18 18 ; { Gifts by cash or check } +SchA_L19 19 ; { Gifts other than by cash or check } +SchA_L20 20 ; { Carryover from prior year } + { Other miscellaneous deductions } +SchA_L22 22 ; { Other deductions. Important! Don't include employee business +expenses, tax preparation fees, or other deductions subject to the +2 percent of AGI limitation } +SchA_L22_Type: Some other deduction { Type of 'Other deduction' on L22 } + { --- Schedule OR-ASC --- } + { Section A: Additions (codes 100-199) } + { First row } +SchASC_A1: 101 { Code } +SchASC_A2 2 ; { Amount } + { Second row } +SchASC_A3: 103 { Code } +SchASC_A4 4 ; { Amount } + { Section B: Subtractions (codes 300-399) } + { First row } +SchASC_B1: 301 { Code } +SchASC_B2 32 ; { Amount } + { Second row } +SchASC_B3: 302 { Code } +SchASC_B4 34 ; { Amount } + { Third row } +SchASC_B5: 305 { Code } +SchASC_B6 36 ; { Amount } + { Section C: Tax recaptures (codes 950-999) } + { First row } +SchASC_C1: 951 { Code } +SchASC_C2 92 ; { Amount } + { Second row } +SchASC_C3: 953 { Code } +SchASC_C4 94 ; { Amount } + { Section D: Standard credits (codes 800-834) } + { First row } +SchASC_D1: 801 { Code } +SchASC_D2: AL { State } +SchASC_D3 83 ; { Amount } + { Second row } +SchASC_D4: 804 { Code } +SchASC_D5: CA { State } +SchASC_D6 86 ; { Amount } + { Third row } +SchASC_D7: 807 { Code } +SchASC_D8: CO { State } +SchASC_D9 89 ; { Amount } + { Fourth row } +SchASC_D10: 810 { Code } +SchASC_D11: DE { State } +SchASC_D12 82 ; { Amount } + { Fifth row } +SchASC_D13: 813 { Code } +SchASC_D14: ME { State } +SchASC_D15 85 ; { Amount } + { Section E: Carryforward credits (codes 835-889) } + { First block } +SchASC_E1: 835 { Code } +SchASC_E2 2 ; { Amount } +SchASC_E3 3 ; { Amount } +SchASC_E4 4 ; { Amount } + { Second block } +SchASC_E5: 836 { Code } +SchASC_E6 10 ; { Amount } +SchASC_E7 20 ; { Amount } +SchASC_E8 42 ; { Amount } + { Section F: Refundable credits (codes 890-949) } + { First row } +SchASC_F1: 890 { Code } +SchASC_F2 2 ; { Amount } + { Second row } +SchASC_F3: 891 { Code } +SchASC_F4 4 ; { Amount } + { Third row } +SchASC_F5: 892 { Code } +SchASC_F6 6 ; { Amount } + {--------------------------------------------- } diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/OR_40/OR_40_2024_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/OR_40/OR_40_2024_template.txt new file mode 100755 index 0000000..8717774 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/OR_40/OR_40_2024_template.txt @@ -0,0 +1,240 @@ +Title: Oregon Form OR-40 - 2024 + +{ --- Federal Return --- } + +FileName1040: { File-name of Form 1040 output file. } + +{ --- Fiscal Year, Amended Return, Special Status --- } +FiscalYearEnd: { For fiscal year filers, enter fiscal year end as MM/DD/YYYY} +CkAmended No { Is this an amended return ? (answer: Yes, No) } +NOLTaxYear: { If amending for an NOL (Net Operating Loss), enter the tax year the NOL was generated } +CkCalcAsIfFed No { Calculated with "as if" federal return? (answer: Yes, No) } +CkShortYear No { Short-year tax election? (answer: Yes, No) } +CkExtFiled No { Extension Filed? (answer: Yes, No) } +CkFormOR24 No { Form OR-24? (answer: Yes, No) } +CkFormOR243 No { Form OR-243? (answer: Yes, No) } +CkFedForm8379 No { Federal Form 8379? (answer: Yes, No) } +CkFedForm8886 No { Federal Form 8886? (answer: Yes, No) } +CkDisasterRelief No { Disaster relief? (answer: Yes, No) } + +{ --- Optional info for auto-fillout only --- } +{ The federal Form 1040 is used as the primary source for optional personal + info, but Oregon requires the following additional information. } + +YourDOB: { Enter your date of birth as MM/DD/YYYY } + +CkYFirstSSN No { Your first time using this SSN? (answer: Yes, No) } +CkYAppITIN No { You applied for ITIN? (answer: Yes, No) } +CkYDeceased No { Taxpayer is deceased? (answer: Yes, No) } + +SpouseDOB: { Enter your spouse's date of birth as MM/DD/YYYY } + +CkSFirstSSN No { Spouse first time using this SSN? (answer: Yes, No) } +CkSAppITIN No { Spouse applied for ITIN? (answer: Yes, No) } +CkSDeceased No { Spouse is deceased? (answer: Yes, No) } + +Country: { Country } +Phone: { Phone number, enter as XXX-XXX-XXXX } + +{ --- Exemptions --- } + +CkL6aRegular Yes { Regular exemption credit for yourself? (answer: Yes, No) } +CkL6aDisabled No { You are severely disabled? (answer: Yes, No) } +CkL6aDep No { Someone else can claim you as a dependent? (answer: Yes, No) } + +CkL6bRegular No { Spouse regular exemption credit (answer: Yes, No) } +CkL6bDisabled No { Spouse is severely disabled? (answer: Yes, No) } +CkL6bDep No { Someone else can claim your spouse as a dependent? (answer: Yes, No) } + +{ --- Dependents --- } +{ --- Optional info for auto-fillout only --- } + +{ The federal Form 1040 is used as the primary source for dependent info, + but Oregon requires the following additional information. + Enter dependents on Form 1040 in order from youngest to oldest, as required by + Oregon, so that they will match with the DOB values entered here. + } + +Dep1DOB: { Enter Dependent 1 data of birth as MM/DD/YYYY } +Dep1Code: { Enter Dependent 1 code. Click label for code info.} +CkDep1Dis No { Dependent 1 has a qualifying disability? (answer: Yes, No) } + +Dep2DOB: { Enter Dependent 2 data of birth as MM/DD/YYYY } +Dep2Code: { Enter Dependent 2 code } +CkDep2Dis No { Dependent 2 has a qualifying disability? (answer: Yes, No) } + +Dep3DOB: { Enter Dependent 3 data of birth as MM/DD/YYYY } +Dep3Code: { Enter Dependent 3 code } +CkDep3Dis No { Dependent 3 has a qualifying disability? (answer: Yes, No) } + +{ --- Dependent Totals --- } +L6c ; { Total number of dependents } +L6d ; { Total number of dependent children with a qualifying disability (see instructions) } + +{ --- Taxable Income --- } + +{ --- Subtractions from Taxable Income --- } +L10_worksheet_L4 ; { Federal Tax Worksheet line 4 'Other Taxes'. Form 1040 section 2 line 17 with exceptions. } +L10_worksheet_L7 ; { Federal Tax Worksheet line 7 'Premium tax credit (Form 8962, line 24)' } + +L12 ; { Oregon income tax refund included in federal income } + +{ --- Deductions --- } +CkStdDedOverride No { Set to 'Yes' to override auto calculation of the standard deduction. Click label for line help. (answer: Yes, No) } + +StdDedOverride ; { Enter a manually calculated standard deduction if previous field is set to 'Yes' } + +CkL17a No { You are 65 or older (answer: Yes, No) } +CkL17b No { You are blind (answer: Yes, No) } +CkL17c No { Spouse is 65 or older (answer: Yes, No) } +CkL17d No { Spouse is blind (answer: Yes, No) } + +{ --- Oregon Tax --- } +{ If all three of these checkboxes are set to 'No', the standard tax table is used for auto-calculation } +CkL20a No { Use Schedule OR-FIA-40 for tax? (answer: Yes, No) } +CkL20b No { Use Worksheet FCG for tax? (answer: Yes, No) } +CkL20c No { Use Schedule OR-PTE-FY for tax? (answer: Yes, No) } +AltMethodTaxAmt ; { Enter tax amount if any checkbox is selected, and an alternative method is used } + +L21 ; { Interest on certain installment sales } + +{ --- Standard and Carryfoward Credits --- } +L26 ; { Political contribution credit. See limits in instructions } + +{ --- Payments and Refundable Credits --- } +L32 ; { Oregon income tax withheld. Include a copy of your Forms W-2 and 1099 } +L33 ; { Prior-year refund applied as estimated payment } +L34 ; { Estimated tax payments for 2024. Include all estimated payments, including +any extension payment, that you made by April 15, 2025 } +L35 ; { Estimated tax payments from Schedule OR-K-1, line 20 } +L36 ; { Earned income credit } +L37 ; { Oregon Kids Credit } + +{ --- Tax to pay or refund --- } +L43 ; { Penalty and interest for filing or paying late } +L44 ; { Interest on underpayment of estimated tax. Include Form OR-10 } +L44a ; { Exception number from Form OR-10, line 1 } +CkL44b No { Enter Yes if you annualized (answer: Yes, No) } +L48 ; { Amount from line 47 you want to apply as a payment of your 2025 +estimated tax } +L49 ; { Charitable checkoff donations from Schedule OR-DONATE, line 30 } +L50 ; { Political party $3 checkoff } +L50a: { Your party code } +L50b: { Spouse party code } +L51 ; { Higher education savings plan deposits from Schedule OR-529, line 5 } + +{ --- Direct deposit --- } +{ --- Optional info for auto-fillout only --- } +CkL54DepOutUS No { Is the final deposit destination outside the United States? (answer: Yes, No) } +CkAcctChecking No { Checking account? (answer: Yes, No) } +CkAcctSavings No { Savings account? (answer: Yes, No) } +AcctRoutingNumber: { Enter 9 digit ACH routing number } +AcctNumber: { Enter ACH account number, up to 17 digits } + +{ --- OR-40 Supporting Schedules --- } + +{ --- Schedule OR-A --- } + +{ Medical and dental expenses } +SchA_L1 ; { Medical and dental expenses } + +{ Taxes you paid } +SchA_L5 ; { State and local income taxes. Don't include Oregon income tax, +including Oregon withholding. } +SchA_L6 ; { Real estate taxes } +SchA_L7 ; { Personal property taxes } +SchA_L10 ; { Other taxes } +SchA_L10_Type: { Type of 'Other taxes' on L10 } + +{ Interest you paid } +SchA_L12 ; { Mortgage interest and points reported on federal Form 1098 } +SchA_L13 ; { Mortgage interest not reported on federal Form 1098 } +SchA_L14 ; { Points not reported on federal Form 1098 } +SchA_L16 ; { Investment interest } + +{ Gifts to charity } +SchA_L18 ; { Gifts by cash or check } +SchA_L19 ; { Gifts other than by cash or check } +SchA_L20 ; { Carryover from prior year } + +{ Other miscellaneous deductions } +SchA_L22 ; { Other deductions. Important! Don't include employee business +expenses, tax preparation fees, or other deductions subject to the +2 percent of AGI limitation } +SchA_L22_Type: { Type of 'Other deduction' on L22 } + +{ --- Schedule OR-ASC --- } +{ Section A: Additions (codes 100-199) } +{ First row } +SchASC_A1: { Code } +SchASC_A2 ; { Amount } +{ Second row } +SchASC_A3: { Code } +SchASC_A4 ; { Amount } + +{ Section B: Subtractions (codes 300-399) } +{ First row } +SchASC_B1: { Code } +SchASC_B2 ; { Amount } +{ Second row } +SchASC_B3: { Code } +SchASC_B4 ; { Amount } +{ Third row } +SchASC_B5: { Code } +SchASC_B6 ; { Amount } + +{ Section C: Tax recaptures (codes 950-999) } +{ First row } +SchASC_C1: { Code } +SchASC_C2 ; { Amount } +{ Second row } +SchASC_C3: { Code } +SchASC_C4 ; { Amount } + +{ Section D: Standard credits (codes 800-834) } +{ First row } +SchASC_D1: { Code } +SchASC_D2: { State } +SchASC_D3 ; { Amount } +{ Second row } +SchASC_D4: { Code } +SchASC_D5: { State } +SchASC_D6 ; { Amount } +{ Third row } +SchASC_D7: { Code } +SchASC_D8: { State } +SchASC_D9 ; { Amount } +{ Fourth row } +SchASC_D10: { Code } +SchASC_D11: { State } +SchASC_D12 ; { Amount } +{ Fifth row } +SchASC_D13: { Code } +SchASC_D14: { State } +SchASC_D15 ; { Amount } + +{ Section E: Carryforward credits (codes 835-889) } +{ First block } +SchASC_E1: { Code } +SchASC_E2 ; { Amount } +SchASC_E3 ; { Amount } +SchASC_E4 ; { Amount } +{ Second block } +SchASC_E5: { Code } +SchASC_E6 ; { Amount } +SchASC_E7 ; { Amount } +SchASC_E8 ; { Amount } + +{ Section F: Refundable credits (codes 890-949) } +{ First row } +SchASC_F1: { Code } +SchASC_F2 ; { Amount } +{ Second row } +SchASC_F3: { Code } +SchASC_F4 ; { Amount } +{ Third row } +SchASC_F5: { Code } +SchASC_F6 ; { Amount } + + +{--------------------------------------------- } diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/OR_40/README_OR_40.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/OR_40/README_OR_40.txt new file mode 100755 index 0000000..3cd586e --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/OR_40/README_OR_40.txt @@ -0,0 +1,108 @@ +Open Tax Solver - Oregon State Tax Forms +---------------------------------------- + +These forms are supported: +Oregon state tax form OR-40, including Schedule OR-A, and Schedule OR-ASC. + +The source file is ../src/taxsolve_OR_40_2024.c. + +The file 'OR_40_2024_example.txt', and an example Form 1040 output file +'US_1040_example_out.txt', are included for testing. + +The OR_40_2024_template.txt file is a blank starting form for entering +your tax data. + +See the Makefile in the src directory for build information. + +Run: + ./taxsolve_OR_40_2024 + +The 'doc' subdirectory contains the following files which document the development process. + +OR40_Tax_Table.xlsx -- Compares the values listed in the Oregon OR-40 +instructions tax tables, which are quantized, with both an Excel model and the +OTS output, to validate the TaxLookup function. Debug code in the source +module, taxsolve_OR_40_2024.c. is enabled through the use of the TAX_TABLE_TEST +macro. + +OR_40_Line_Coordinate_Calculations.xlsx -- Provides a method of defining the PDF +display coordinates for each text field. The contents of the or_40_meta.dat file +can be updated directly from the first columns of the spreadsheet. All +coordinates for each field are the lower left corner of the corresponding +alignment box. + +or40_pdf_test.cmd -- Invokes universal_pdf_file_modifier.exe with the OR_40_test_data.txt file. +OR_40_test_data.txt -- Full set of test data for all fields on the form; used +from the 'or40_pdf_test.cmd' file. + +Place these two files in the top level OpenTaxSolver directory to run the test +and generate a fully populated PDF output test file. + +=== Notes on Source Code and Requirements of the OR-40, OR-A, and OR-ASC Forms === +The Oregon PDF forms require careful alignment of the text fields with the +preformatted boxes, and include a full space for the comma between sets of 3 +digits. Also, the ".00" is preprinted on every line, so it can't be included in +the output values. uPDFModifier doesn't allow the insertion of commas when the +character spacing option is used, so commas have to be inserted in the taxsolver +code. All numeric values in the output file have commas inserted, and no decimal +point or cents. + +A group of functions which support this output formatting are +defined in taxsolve_OR_40_*.c: + +showline_wlabel_or_40 +showline_wlabel_or_40_nz +shownum_or_40 +shownum_or_40_nz + +These behave the same way as the similarly named shared functions. + +A single table named status_cfg[] is used to control the configuration of every +value or function which depends on filing status. This is an array of structs, +typedefed as FILING_STATUS_CFG. + +Oregon uses a tax table with ranges of values for AGI amounts below $50,000. +This quantizes a range of values into a single, midpoint value. In order to +exactly match the values in the tax table in the OR-40 instructions, it is +necessary to first round to the nearest cent, and then the nearest dollar, in 2 +steps. For example, the value $123.499 would be rounded down to $123.00 if +rounded directly to dollars, but would be rounded as +$123.499 -> $123.50 -> $124.00 +if rounded in 2 steps. This double rounding is the method used by the Oregon tax +table. + +Two types of additional structs are defined, TAX_TABLE and LIMIT_TABLE, to +support tax table and tax limit functions. These allow complete separation of +the algorithm used to calculate taxes, and the breakpoints and rates. Different +versions of these tables are selected through the primary status_cfg[] array, +based on filing status. + +Here is an example of the tax table definition for single filers, for 2024. + +// Tax breakpoint table for single or married filing separately. +TAX_TABLE or_40_single_tax_table[] = { + { 0.00, 0.0475 }, + { 4300.00, 0.0675 }, + { 10750.00, 0.0875 }, + { 125000.00, 0.0990 }, + { -1.00, 0.00 }, +}; + +And here is an example of a limit table, used to implement a maximum level of federal tax +subtraction based on AGI: + +// Used for all other cases except single, and married filing separately: +// married/joint, head of household, and widow +LIMIT_TABLE or_40_other_fed_sub_table[] = { + { 0, 8250 }, + { 250000, 6600 }, + { 260000, 4950 }, + { 270000, 3300 }, + { 280000, 1650 }, + { 290000, 0 }, + { -1, 0 }, +}; + +For annual updates, search for the comment string 'TAXYEAR_DEPENDENT'. This is +placed before each table or value which is likely to change in future tax years. + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/PA_40/PA_40_2024_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/PA_40/PA_40_2024_example.txt new file mode 100755 index 0000000..a2ecb4d --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/PA_40/PA_40_2024_example.txt @@ -0,0 +1,62 @@ +Title: PA State Tax Form PA-40 for 2024 EXAMPLE + +{ EXAMPLE } + +Status Married/Joint { Single, Married/Joint, Married/Sep, Widow(er) } + +L1a 29812.34 {Gross compensation.} + 21609.09 {spouse} + ; +L1b 0 { Unreimbursed employee business expenses.} + 0 {spouse} + ; +L2 34.56 { Interest Income. } + 17.83 + ; +L3 143.65 { Dividend and Capital Gains Distributions Income. } + 29.32 + ; +L4 -345 ; { Net Income or Loss for Business Operations. } +L5 23 ; { Net Gain or Loss from Sale, Exchange or Disposition of Property. } +L6 -1092 ; { Net Income or Loss from Rents, Royalties, Patents, or Copyrights. } +L7 0 ; { Estate or Trust Income. } +L8 0 ; { Gambling or lottery winnings. } +L10 0 ; { Other Deductions. } + +{ -- Withholdings -- } +L13 813.67 { Total PA Tax withheld. } + 724.12 {spouse} + ; +{ -- Credits & Deductions -- } +L14 0 ; { Credit from 2023 PA income tax return. } +L15 0 ; { 2024 Estimated Installment payments. } +L16 0 ; { 2024 Extension payment. } +L17 0 ; { Non-resident tax withheld. } +L21 0 ; { Tax Back/Tax Forgiveness Credit (Part D line 16 Sched SP). } +L22 0 ; { Resident credit (Scheds G/RK-1). } +L23 0 ; { Other credits (Sched OC). } +L25 0 ; { Use Tax } +L27 0 ; { Penalties and underpayment interest. } + +{ -------------------------------------------- } +{ --- Optional info for Auto-Fillout only. --- } + Your1stName: Samual + MidInitial: M + YourLastName: Watson + YourSocSec#: 123-45-6789 + Spouse1stName: Maria { Leave blank if Single, etc. } + SpouseMidInit: B + SpouseLastName: Watson + SpouseSocSec#: 987-65-4321 + Number&Street: 123 Homestead Lane + Town: Wilksberry Acers + Zipcode: 19207 + Phone: 215-171-7171 + SchoolCode: J347 + SchooldDist: Millwood + YourOccupation: Waitor + SpouseOccupat: Welder + +{ + -------------------------------------------- +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/PA_40/PA_40_2024_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/PA_40/PA_40_2024_template.txt new file mode 100755 index 0000000..218900a --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/PA_40/PA_40_2024_template.txt @@ -0,0 +1,64 @@ +Title: PA State Tax Form PA-40 for 2024 + +{ -- Your Filing Status -- } + +Status {Single, Married/Joint, Married/Sep, Widow(er)} + +{ -- Income -- } + +L1a {Gross compensation.} + {spouse} + ; +L1b ; { Unreimbursed employee business expenses.} +L2 { Interest Income. } + ; +L3 { Dividend and Capital Gains Distributions Income. } + ; +L4 ; { Net Income or Loss for Business Operations. } +L5 ; { Net Gain or Loss from Sale, Exchange or Disposition of Property. } +L6 ; { Net Income or Loss from Rents, Royalties, Patents, or Copyrights. } +L7 ; { Estate or Trust Income. } +L8 ; { Gambling or lottery winnings. } +L10 ; { Other Deductions. } + + +{ -- Withholdings -- } + +L13 { Total PA Tax withheld. } + {spouse} + ; + +{ -- Credits & Deductions -- } + +L14 0 ; { Credit from 2023 PA income tax return. } +L15 0 ; { 2024 Estimated Installment payments. } +L16 0 ; { 2024 Extension payment. } +L17 0 ; { Non-resident tax withheld. } +L21 0 ; { Tax Back/Tax Forgiveness Credit (Part D line 16 Sched SP). } +L22 0 ; { Resident credit (Scheds G/RK-1). } +L23 0 ; { Other credits (Sched OC). } +L25 0 ; { Use Tax } +L27 0 ; { Penalties and underpayment interest. } + +{ -------------------------------------------- } +{ --- Optional info for Auto-Fillout only. --- } + Your1stName: + MidInitial: + YourLastName: + YourSocSec#: + Spouse1stName: { Leave blank if Single, etc. } + SpouseMidInit: + SpouseLastName: + SpouseSocSec#: + Number&Street: + Town: + Zipcode: + Phone: + SchoolCode: + SchooldDist: + YourOccupation: + SpouseOccupat: + +{ + -------------------------------------------- +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/PA_40/README_PA_40.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/PA_40/README_PA_40.txt new file mode 100755 index 0000000..4387381 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/PA_40/README_PA_40.txt @@ -0,0 +1,30 @@ +Open Tax Solver - Pennsylvania State PA-40 Personal Income Tax Return +--------------------------------------------------------------------- + +Included here is a program, template, and example for +Pennsylvania State PA-40 personal income tax form. + +The PA40_2024_example.txt file is included for testing. +The PA40_2024_template.txt file is a blank starting form for entering +your tax data. For each filer, copy template to a new name, +such as "PA40_2024.txt" or "PA40_2024_aunt_sally.txt, and +fill-in the lines. + +The program consists of two files: + taxsolve_PA40_2024.c - main, customized for PA-40. + taxsolve_routines.c - general purpose base routines. + +Compile: + cc taxsolve_PA40_2024.c -o taxsolve_PA40_2024 + +Run: + ./taxsolve_PA40_2024 PA40_2024.txt + + +For updates and further information, see: + http://sourceforge.net/projects/opentaxsolver/ +Documentation: + http://opentaxsolver.sourceforge.net/ + + +Aston Roberts (aston_roberts@yahoo.com) diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040/README_US_1040.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040/README_US_1040.txt new file mode 100755 index 0000000..79ded12 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040/README_US_1040.txt @@ -0,0 +1,36 @@ +Open Tax Solver - US Federal 1040 Personal Income Tax Return +------------------------------------------------------------ + +Included here is a program, template, and example for +US Federal 1040 personal income tax form. + +The example*.txt file is included for testing. +The template*.txt file is a blank starting form for entering +your tax data. For each filer, copy template to a new name, +such as "fed1040_2024.txt" or "fed1040_2024_aunt_sally.txt, and +fill-in the lines. + +The program consists of two files: + src/taxsolve_US_1040_2024.c - main, customized for US Fed-1040. + src/taxsolve_routines.c - general purpose base routines. + +Compile: + cc src/taxsolve_US_1040_2024.c -o bin/taxsolve_US_1040_2024 + +Run from this directory: + ../../bin/taxsolve_US_1040_2024 Fed1040_2024.txt + +... Where "Fed1040_2024.txt" is the name of -your- tax data file. +(Two tax-data files are included in OTS packages: an *example.txt + and a blank *template.txt. 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.) + +For updates and further information, see: + http://sourceforge.net/projects/opentaxsolver/ +Documentation: + http://opentaxsolver.sourceforge.net/ + + +Aston Roberts (aston_roberts@yahoo.com) diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040/US_1040_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040/US_1040_example.txt new file mode 100755 index 0000000..f441fe5 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040/US_1040_example.txt @@ -0,0 +1,430 @@ +Title: US Federal 1040 Tax Form - 2024 -- EXAMPLE + +{ ------------ Example ------------- } +{ --- Filing Status & Exemptions --- } + +Status Married/Joint { Single, Married/Joint, Head_of_House, Married/Sep, Widow(er) } + +You_65+Over? N { Were you born before January 2, 1960 ? (answer: Yes, No) } +You_Blind? N { Are you blind ? (answer: Yes, No) } +Spouse_65+Over? Y { Was Spouse born before January 2, 1960 ? (answer: Yes, No) } +Spouse_Blind? N { Is Spouse blind ? (answer: Yes, No) } +Dependents 0 { Number of Dependents, (answer: 0, 1, 2, 3, 4, 5, 6, 7, 8, ...) } + +VirtCurr? N { During 2024, did you receive/exchange/sell any Digital Asset? (answer: Yes, No) } + + +{ ---- Income ---- } + +{ -- Wages, salaries, tips (W-2's Box-1). -- } +L1a 20267.70 { Wages, salaries, tips (W-2's Box-1). } + 28188.53 { Spouse's } + ; +L1b 10 ; { Household employee wages not reported on Form(s) W-2. } +L1c 20 ; { Tip income not reported on line 1a. } +L1d 30 ; { Medicaid waiver payments not reported on Form(s) W-2. } +L1e 40 ; { Taxable dependent care benefits from Form 2441, line 26. } +L1f 50 ; { Employer-provided adoption benefits from Form 8839, line 29. } +L1g 60 ; { Wages from Form 8919, line 6. } +L1h 70 ; { Other earned income. } +L1i 80 ; { Nontaxable combat pay election. } + + + { --- Interest --- } + { -- Tax-Exempt Interest. (Only used for SocialSecurity calculations). -- + (Any private activity bond interest exempt from regular tax, is entered under Schedule 2 below.) } +L2a 2 ; + + { -- Taxable Interest -- 1099-INT(s) box 1 } +L2b 37.71 { Bank Savings} + 12.65 { Credit Union} + 16.85 { Savings Bank} + ; + + { --- Dividends --- } + { -- Qualified Dividends 1099-DIV box 1b -- } +L3a + 70.90 {USX Dividends} + 14.36 {Fidelity Mutual Funds} + 0.0 { Growth Fund} + 61.25 {Company Stock Div} + ; + + { -- Ordinary Dividends 1099-DIV box 1a. (Includes Qualified Div's as well.) -- } +L3b + 70.90 {USX Dividends} + 44.36 {Fidelity Mutual Funds} + 64.13 { Growth Fund} + 74.52 {Company Stock Div} + ; + + { --- Other Income & Credits --- } +L4a 41.41 ; { IRA distributions. (1099-R) } +L4b 41.00 ; { Taxable IRA distributions. (1099-R) } + QCD no { Qualified Charitable Distribution ? (answer: yes, no) } + +L5a 43.43 ; { Pensions, Annuities. (1099-R) } +L5b 43.00 ; { Taxable Pensions, Annuities. (1099-R) } + +L6a 6 ; { Social Security benefits. Forms SSA-1099 box-5. } + +L13 13 ; { Qualified business income deduction. } +L19 19 ; { Child tax credit/credit for other dependents. } + +L25a 1765.50 { Federal income tax withheld, from W-2's, box-2. } + 1688.09 + ; +L25b 23 ; { Federal income tax withheld, from 1099's. } +L25c 26 ; { Federal income tax withheld, from other forms. } +L26 { Estimated tax payments made for the year. } + 100 {Q1} + 110 {Q2} + 120 {Q3} + 130 {Q4} + ; + +{ -- Refundable Credits -- } +L27 207 ; { Earned Income Credit (EIC). Attach Sched EIC if you have qualifying child. } +L28 28 ; { Child Tax Credit, Schedule 8812 } +L29 29 ; { American Opportunity Credit, Form 8863, line 8 } + +{ -- Refund Options -- } +ApplyTo2024 33 ; { Percent (%) of OverPayment to apply to your 2024 estimated tax. (0-100) } + +{ -- Penalties -- } +L38 ; { Estimated Tax Under-payment Penalty } + +{ --- Schedule D: Capital Gains/Loses --- } + + { When there are multiple buy-dates, specify "various-short" or "various-long", instead of a specific date. } + { If acquired by inheritance, then specify "inherited" instead of a specific date. } + {Text Editor Note: When adding a security, All values must be present. "~" is a necessary place holder for No Adjustment. } + +f8949_spreadsheet-A/D: { Optional CSV spreadsheet File-name for Cap-Gain/Losses. (Reported to IRS, A/D) } + +CapGains-A/D { Capital Gains/Losses, 1099-B. For Basis Reported to IRS (Form 8949 marks A or D) } + { Enter for each: $BuyAmnt Date, $SellAmnt Date, AdjCode $AdjAmnt ~ ~ } + -800.99 6-20-21 { 40 Shares WMT } + 950.99 10-12-21 + ~ ~ + + -1800.99 6-21-2024 { 40 Shares AAP } + 1950.99 10-2-2024 + ~ ~ + + -3658.22 1-15-19 { 100 Shares XOM } + 4209.95 12-25-21 + B 12.34 + + -4949.98 3-26-17 { 500 Shares NAB } + 6009.01 12-27-2024 + ~ ~ + + -4949.98 3-26-11 { 500 Shares FBK } + 6009.01 12-27-2024 + ~ ~ + ; + + +f8949_spreadsheet-B/E: { Optional CSV spreadsheet File-name for Cap-Gain/Losses. (Unreported to IRS, B/E) } + +CapGains-B/E { Capital Gains/Losses, 1099-B. For Basis NOT Reported to IRS (Form 8949 marks B/E) } + { Enter for each: $BuyAmnt Date, $SellAmnt Date, AdjCode $AdjAmnt ~ ~ } + + 100 1-1-1980 { IBM } + 1000 2-2-2024 + ~ ~ + + 8000 12-24-1980 { SNA } + 1000 12-28-21 + ~ ~ + ; + + +f8949_spreadsheet-C/F: { Optional CSV spreadsheet File-name for Cap-Gain/Losses. (Not above, C/F) } + +CapGains-C/F { Capital Gains/Losses, 1099-B. For when Form 8949 (A,B,D,E) CANNOT be checked. (marks C/F) } + { Enter for each: $BuyAmnt Date, $SellAmnt Date, AdjCode $AdjAmnt ~ ~ } + 900 1-1-1980 { MSFT } + 9000 2-2-2024 + ~ ~ + + 100 1-1-1980 { CLF } + 4000 2-2-2024 + ~ ~ + ; + +D4 ; { Short-term gain from 6252, gain or loss from Forms 4684, 6781, 8824. } +D5 ; { Short-term gain/loss from partnerships, S corps, estates, trusts, K-1. } +D6 ; { Short-term 2023 loss carryover. Or, LastYear's return output File-name. } +D11 ; { Gain from Form 4797. } +D12 ; { Partnership net long-term gains or losses. } +D13 ; { Cap Gains Distributions - 1099-DIV column 2a. } +D14 ; { Long-term 2023 loss carryover. Leave blank if file-name used in line D6. } +D19 ; { Amount, if any, from line 18 of Unrecaptured Section 1250 Gain Worksheet. } +Collectibles ; { Long Term Gain or Loss from Collectibles, Form 8949 Part II. (Usually zero.) } + + { } + +{ --- Schedule 1: Additional Income --- } + +S1_1099K_err ; { Amounts on 1099-K forms reported in error or for personal loss. } +S1_1 20.11 ; { Taxable refunds. } +S1_2a 22 ; { Alimony received. } +S1_2b: 6/7/20 { Date of divorce or separation. } +S1_3 3 ; { Business income/loss. (Sched C) } +S1_4 17.18 ; { Other gains or losses. (form 4797) } +S1_5 5 ; { Rent realestate/royalties/partnerships/S corp. Sched E } +S1_6 6 ; { Farm income/loss. (Sched F) } +S1_7 7 ; { Unemployment compensation } +S1_8a 8.01 ; { Net operating loss } +S1_8b 7.02 ; { Gambling income } +S1_8c 6.03 ; { Cancellation of debt } +S1_8d 8.04 ; { Foreign earned income exclusion from Form 2555 } +S1_8e 9.01 ; { Income from Form 8853 } +S1_8f 9.02 ; { Income from Form 8889 } +S1_8g 9.03 ; { Alaska Permanent Fund dividends } +S1_8h 9.04 ; { Jury duty pay } +S1_8i 9.05 ; { Prizes and awards } +S1_8j 9.10 ; { Activity not engaged in for profit income } +S1_8k 9.11 ; { Stock options } +S1_8l 9.12 ; { Rental of personal property income if for profit but not business. } +S1_8m 9.13 ; { Olympic and Paralympic medals + prizes } +S1_8n 9.14 ; { Section 951(a) inclusion } +S1_8o 9.15 ; { Section 951A(a) inclusion } +S1_8p 9.16 ; { Section 461(l) excess business loss adjustment } +S1_8q 9.17 ; { Taxable distributions from an ABLE account } +S1_8r 9.18 ; { Scholarship and fellowship grants not reported on Form W-2 } +S1_8s 9.19 ; { Nontaxable Medicaid waiver payments included on Form 1040, line 1a or 1d } +S1_8t 9.20 ; { Pension from nonqualifed deferred compensation plan or section 457 plan } +S1_8u 9.21 ; { Wages earned while incarcerated } +S1_8v 10.22 ; { Digital assests received as ordinary income not reported elsewhere } +S1_8z 8.17 ; { Other income. } + S1_8z_Type: uber { Type of Other Income. } + +{ ---- Schedule 1, Part II: Adjustments to Gross Income ---- } +S1_11 6.10 ; { Educator expenses } +S1_12 2 ; { Bus. exp.: reservists, artists, ... Attach Form 2106 } +S1_13 3 ; { Health savings account deduction. Attach Form 8889 } +S1_14 4 ; { Moving expenses. Attach Form 3903 } +S1_15 5 ; { Deductable part of self-employment tax. Attach Schedule SE} +S1_16 6 ; { Self-employed SEP, SIMPS1_E, and qualified plans } +S1_17 7 ; { Self-employed health insurance deduction } +S1_18 8 ; { Penalty on early withdrawal of savings } +S1_19a 19 ; { Alimony paid } + AlimRecipSSN: 123006778 { Alimony recipient's SocSec Number. } + DivorceDate: 11/3/15 { Divorce or Separation Date } +S1_20 10 ; { IRA deduction } +S1_21 44.08 ; { Student loan interest deduction } +S1_23 23 ; { Archer MSA deduction } +S1_24a 24 ; { Jury duty pay } +S1_24b 23 ; { Deductible expenses of rental of personal property } +S1_24c 22 ; { Nontaxable Olympic and Paralympic medals & prizes } +S1_24d 10.01 ; { Reforestation amortization and expenses } +S1_24e 4 ; { Repayment of supplemental unemployment benefits } +S1_24f 5 ; { Contributions to section 501(c)(18)(D) pension plans } +S1_24g 10.02 ; { Contributions by certain chaplains to section 403(b) plans } +S1_24h 6 ; { Attorney fees and court costs for unlawful discrimination claims } +S1_24i 7 ; { Attorney fees and court costs for award from the IRS } +S1_24j 8 ; { Housing deduction from Form 2555 } +S1_24k 9 ; { Excess deductions of section 67(e) expenses from Schedule K-1 } +S1_24z 10.03 ; { Other adjustments. } +S1_24z_Type: Materials { Type of Other adjustments. } + + +{ ---- Tax and Credits ---- } + { -- Schedule A: Itemized deductions -- } + A1 5001 ; { Unreimbursed medical expenses. } + A5a { State and local income taxes. (W-2's boxes 17 + 19.) Or sales taxes. } + 39.88 { State-UI (Unemployment Insurance) } + 1479.21 { State-tax withheld/owed } + 1928.35 { Spouse's local tax (paid) } + ; + CheckBoxA5a N ; { Check (Y) if using sales taxes instead of income taxes. (answer: Yes, No) } + A5b 1,771.05 { Real estate taxes.} + ; + A5c 5 ; { Personal property (eg. automobile) taxes. } + A6 6 ; { Other taxes.} + A8a 7 ; { Home mortgage interest and points reported to you on Form 1098.} + A8b ; { Home mortgage interest not reported to you on Form 1098.} + A8c ; { Points not reported to you on Form 1098.} + A9 9 ; { Investment interest. Attach Form 4952} + + A11 111 ; { Charity contributions by Cash or Check. } + A12 12 ; { Charity contributions Other Than cash or check. } + A13 13 ; { Charity contributions CarryOver from prior year. } + + A15 15 ; { Casualty or theft loss(es).} + A16 16 ; { Other expenses} + A18 N ; { Elect to itemize, even when less than standard deduction. (answer: Yes, No) } + +{ -- Schedule B: Part III -- } + B7a N ; { Financial account in foreign country ? (answer: Yes, No) } + B7aa ; { If yes above, did you file FinCEN Form 114 ? (answer: n/a, Yes, No) } + B7b ; { If yes above, name of country. } + B8 N ; { Did you receive a foreign trust ? (answer: Yes, No) } + + +{ --- Alternative Minimum Tax (AMT) Entries (if needed) --- } + AMTws2c ; { Investment interest expense (difference between regular tax and AMT) (Form 6251 line 2c). } + AMTws2g ; { Private activity bond interest exempt from regular tax (Form 6251 line 2g). } + AMTws3 ; { Other adjustments, including income-based related adjustments. } + AMTws8 ; { Alternative minimum tax foreign tax credit. } + +{ --- Schedule 2: Additional Taxes --- } +S2_1a 10.01 ; { Excess advance premium tax credit repayment. Form 8962. } +S2_1b ; { Repayment of new clean vehicle credit(s) transferred to dealer. } +S2_1c ; { Repayment of previously owned clean vehicle credit(s) transferred to dealer. } +S2_1d ; { Recapture of net EPE from Form 4255, line 2a, column (l). } +S2_1e ; { Excessive payments (EP) from Form 4255. } +S2_1f ; { 20% EP from Form 4255. } +S2_1y ; { Other additions to tax (see instructions). } +S2_4 12.67 ; { Self-employment tax. Sched SE } +S2_5 ; { Social security and Medicare tax from Form 4137. } +S2_6 ; { Uncollected Social security and Medicare tax from Form 8919 } +S2_8 ; { Additional tax on IRAs, other qualified retirement plans, Form 5329 } +S2_9 34.23 ; { Household employment taxes. Sched H } +S2_10 ; { First-time homebuyer credit repayment. Form 5405. } +S2_11 ; { Additional Medicare Tax. Attach Form 8959 } +S2_12 ; { Net investment income tax. Attach Form 8960 } +S2_13 ; { Uncollected social security ... from Form W-2, box 12 } +S2_14 ; { Interest on tax due on installment income } +S2_15 ; { Interest on the deferred tax on gain from certain installment sales } +S2_16 ; { Recapture of low-income housing credit. Attach Form 8611 } + +S2_17a 17.01 ; { Recapture of other credits. } + S2_17a_Type: Rural, 6723 { Type and form number } +S2_17b 16 ; { Recapture of federal mortgage subsidy. } +S2_17c ; { Additional tax on HSA distributions. Attach Form 8889 } +S2_17d ; { Additional tax on an HSA, Attach Form 8889 } +S2_17e ; { Additional tax on Archer MSA distributions. Attach Form 8853 } +S2_17f ; { Additional tax on Medicare Advantage MSA distributions. Form 8853 } +S2_17g ; { Recapture of a charitable contribution deduction } +S2_17h ; { Income you received from a nonqualified deferred compensation } +S2_17i 17.09 ; { Compensation received from nonqualified deferred compensation plan } +S2_17j ; { Section 72(m)(5) excess benefits tax } +S2_17k ; { Golden parachute payments } +S2_17l ; { Tax on accumulation distribution of trusts } +S2_17m ; { Excise tax on insider stock compensation } +S2_17n ; { Look-back interest under section 167(g) or 460(b) } +S2_17o ; { Tax on non-effectively connected income } +S2_17p ; { Any interest from Form 8621, line 16f. } +S2_17q ; { Any interest from Form 8621, line 24 } +S2_17z 17.18 ; { Any other taxes. } + S2_17z_Type: Anom { Type of other taxes. } +S2_19 ; { Additional tax from Schedule 8812 } +S2_20 ; { Section 965 net tax liability installment from Form 965-A } + + +{ --- Schedule 3: Part 1 - Nonrefundable Credits --- } +S3_1 14.15 ; { Foreign tax credit, form 1116 } +S3_2 ; { Child/dependent care expense credits. Form 2441, Line 11. } +S3_3 ; { Education credits. Form 8863, line 19. } +S3_4 31.31 ; { Retirement savings contributions credit. Form 8880. } +S3_5a 51.00 ; { Residential clean energy credits. Form 5695, line 16. } +S3_5b 52.00 ; { Energy efficient home improvement credit. Form 5695, line 32. } + { Other nonrefundable credits. } +S3_6a 6 ; { General business credit. Form 3800. } +S3_6b ; { Credit for prior year minimum tax. Form 8801. } +S3_6c 26.01 ; { Adoption credit. Attach Form 8839 } +S3_6d ; { Credit for the elderly or disabled. Attach Schedule R } +S3_6e ; { Alternative motor vehicle credit. Attach Form 8910 } +S3_6f ; { Qualified plug-in motor vehicle credit. Attach Form 8936 } +S3_6g ; { Mortgage interest credit. Attach Form 8396 } +S3_6h ; { District of Columbia first-time homebuyer credit. Attach Form 8859 } +S3_6i 2.02 ; { Qualified electric vehicle credit. Attach Form 8834 } +S3_6j ; { Alternative fuel vehicle refueling property credit. Attach Form 8911 } +S3_6k ; { Credit to holders of tax credit bonds. Attach Form 8912 } +S3_6l ; { Amount on Form 8978, line 14. } +S3_6m 6.60 ; { Credit for previously owned clean vehicles. Attach Form 8936. } +S3_6z 1.00 ; { Other nonrefundable credits. } +S3_6z_Type: { Type of Other nonrefundable credits. } + +{ --- Schedule 3: Part II - Other Payments and Refundable Credits --- } +S3_9 ; { Net premium tax credit. Form 8962. } +S3_10 8.10 ; { Amnt paid in filing extension req. } +S3_11 ; { Excess Soc. Sec. + tier 1 RRTA tax withheld. } +S3_12 ; { Credits for federal tax on fuels. Attach form 4136. } +S3_13a 13 ; { Credits from Form 2439. } +S3_13b 14 ; { Credit for repayment of amounts included in income from prior years. } +S3_13c 15 ; { Elective payment amount. Form 3800, Part III, line 6, column (i). } +S3_13d 16 ; { Deferred amount of net 965 tax liability } +S3_13z 17 ; { Credits from Other. } + S3_13z_Type: { Type of other payments or refundable credits. } + + + +{ -------------------------------------------- } +{ --- Optional info for Auto-Fillout only. --- } + + { Your 1st-Name, Middle-Initial } + Your1stName: Fred, D. + YourLastName: Smythe + YourSocSec#: 409-31-7804 + + { Spouse 1st-Name, Middle-Initial -- If Married-Filing-Jointly, otherwise leave spouse fields blank. } + Spouse1stName: Sarah, M. { Leave blank if Single, etc. } + SpouseLastName: Smythe + SpouseSocSec#: 409-33-9408 + + { Your Address } + Number&Street: 1567 W. Hamptonshire + Apt#: + Town/City: Springfield + State: IL + ZipCode: 62722 + + { Your Occupation(s) } + YourOccupat: Merchant + SpouseOccupat: Welder + + { - - - - - - - - -- - - - - - - - - } + { Dependent-1 Information (optional) } + Dep1_FirstName: Emma { First Dependent's first-name. } + Dep1_LastName: Anderson { First Dependent's last-name. } + Dep1_SocSec#: 987-65-4321 { First Dependent's Social Security number. } + Dep1_Relation: Stepdaughter { First Dependent's relationship. } + CkDep1_ChildTxCrd: Yes { (answer: Yes, No) } + CkDep1_CrdOtherDep: { (answer: Yes, No) } + + { Dependent-2 Information (optional) } + Dep2_FirstName: + Dep2_LastName: + Dep2_SocSec#: + Dep2_Relation: + CkDep2_ChildTxCrd: { (answer: Yes, No) } + CkDep2_CrdOtherDep: { (answer: Yes, No) } + + { Dependent-3 Information (optional) } + Dep3_FirstName: + Dep3_LastName: + Dep3_SocSec#: + Dep3_Relation: + CkDep3_ChildTxCrd: { (answer: Yes, No) } + CkDep3_CrdOtherDep: { (answer: Yes, No) } + + { Dependent-4 Information (optional) } + Dep4_FirstName: + Dep4_LastName: + Dep4_SocSec#: + Dep4_Relation: + CkDep4_ChildTxCrd: { (answer: Yes, No) } + CkDep4_CrdOtherDep: { (answer: Yes, No) } + + { Other Dependents } + CkMoreThan_4_Dependents: { (answer: Yes, No) } + + { Optional Direct-Deposit info for Refunds } +L35b: 123456789 { Routing Number. } +L35c: Checking { (answer: Checking, Savings) } +L35d: 12345678901234567 { Account Number. } + + { Optional PIN Numbers. } +PIN_3rdParty: 00000 { Third Party Personal Identity PIN. (5-digits.) } +PIN_Your: 123456 { Your Identity Protection PIN. (6-digits from IRS.) } +PIN_Spouse: 222222 { Spouse's Identity Protection PIN. (6-digits from IRS.) } + +Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } +{ + -------------------------------------------- +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040/US_1040_example_with_f8949_spreadsheet.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040/US_1040_example_with_f8949_spreadsheet.txt new file mode 100755 index 0000000..6dc84b9 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040/US_1040_example_with_f8949_spreadsheet.txt @@ -0,0 +1,426 @@ +Title: US Federal 1040 Tax Form - 2024 -- EXAMPLE + +{ ------------ Example ------------- } +{ --- Filing Status & Exemptions --- } + +Status Married/Joint { Single, Married/Joint, Head_of_House, Married/Sep, Widow(er) } + +You_65+Over? N { Were you born before January 2, 1960 ? (answer: Yes, No) } +You_Blind? N { Are you blind ? (answer: Yes, No) } +Spouse_65+Over? Y { Was Spouse born before January 2, 1960 ? (answer: Yes, No) } +Spouse_Blind? N { Is Spouse blind ? (answer: Yes, No) } +Dependents 0 { Number of Dependents, (answer: 0, 1, 2, 3, 4, 5, 6, 7, 8, ...) } + +VirtCurr? N { During 2024, did you receive/exchange/sell any Digital Asset? (answer: Yes, No) } + + +{ ---- Income ---- } + +{ -- Wages, salaries, tips (W-2's Box-1). -- } +L1a 20267.70 { Wages, salaries, tips (W-2's Box-1). } + 28188.53 { Spouse's } + ; +L1b 10 ; { Household employee wages not reported on Form(s) W-2. } +L1c 20 ; { Tip income not reported on line 1a. } +L1d 30 ; { Medicaid waiver payments not reported on Form(s) W-2. } +L1e 40 ; { Taxable dependent care benefits from Form 2441, line 26. } +L1f 50 ; { Employer-provided adoption benefits from Form 8839, line 29. } +L1g 60 ; { Wages from Form 8919, line 6. } +L1h 70 ; { Other earned income. } +L1i 80 ; { Nontaxable combat pay election. } + + + { --- Interest --- } + { -- Tax-Exempt Interest. (Only used for SocialSecurity calculations). -- + (Any private activity bond interest exempt from regular tax, is entered under Schedule 2 below.) } +L2a 2 ; + + { -- Taxable Interest -- 1099-INT(s) box 1 } +L2b 37.71 { Bank Savings} + 12.65 { Credit Union} + 16.85 { Savings Bank} + ; + + { --- Dividends --- } + { -- Qualified Dividends 1099-DIV box 1b -- } +L3a + 70.90 {USX Dividends} + 14.36 {Fidelity Mutual Funds} + 0.0 { Growth Fund} + 61.25 {Company Stock Div} + ; + + { -- Ordinary Dividends 1099-DIV box 1a. -- } +L3b + 70.90 {USX Dividends} + 44.36 {Fidelity Mutual Funds} + 64.13 { Growth Fund} + 74.52 {Company Stock Div} + ; + + { --- Other Income & Credits --- } +L4a 41.41 ; { IRA distributions. (1099-R) } +L4b 41.00 ; { Taxable IRA distributions. (1099-R) } + QCD no { Qualified Charitable Distribution ? (answer: yes, no) } + +L5a 43.43 ; { Pensions, Annuities. (1099-R) } +L5b 43.00 ; { Taxable Pensions, Annuities. (1099-R) } + +L6a 6 ; { Social Security benefits. Forms SSA-1099 box-5. } + +L13 13 ; { Qualified business income deduction. } +L19 19 ; { Child tax credit/credit for other dependents. } + +L25a 1765.50 { Federal income tax withheld, from W-2's, box-2. } + 1688.09 + ; +L25b 23 ; { Federal income tax withheld, from 1099's. } +L25c 26 ; { Federal income tax withheld, from other forms. } +L26 { Estimated tax payments made for the year. } + 100 {Q1} + 110 {Q2} + 120 {Q3} + 130 {Q4} + ; + +{ -- Refundable Credits -- } +L27 207 ; { Earned Income Credit (EIC). Attach Sched EIC if you have qualifying child. } +L28 28 ; { Child Tax Credit, Schedule 8812 } +L29 29 ; { American Opportunity Credit, Form 8863, line 8 } + +{ -- Refund Options -- } +ApplyTo2024 33 ; { Percent (%) of OverPayment to apply to your 2024 estimated tax. (0-100) } + +{ -- Penalties -- } +L38 ; { Estimated Tax Under-payment Penalty } + +{ --- Schedule D: Capital Gains/Loses --- } + + { When there are multiple buy-dates, specify "various-short" or "various-long", instead of a specific date. } + { If acquired by inheritance, then specify "inherited" instead of a specific date. } + { Text Editor Note: When adding a security, All values must be present. "~" is a necessary place holder for No Adjustment. } + +f8949_spreadsheet-A/D: tax_form_files/US_1040/example_f8949_spreadsheet.csv { Optional CSV spreadsheet File-name for Cap-Gain/Losses. (Reported to IRS, A/D) } + +CapGains-A/D { Capital Gains/Losses, 1099-B. For Basis Reported to IRS (Form 8949 check A or D) } + { Enter for each: $BuyAmnt Date, $SellAmnt Date, AdjCode $AdjAmnt ~ ~ } + + -800.99 6-20-21 { 40 Shares WMT } + 950.99 10-12-21 + ~ ~ + + -1800.99 6-21-2024 { 40 Shares AAP } + 1950.99 10-2-2024 + ~ ~ + + -3658.22 1-15-19 { 100 Shares XOM } + 4209.95 12-25-21 + B 12.34 + + -4949.98 3-26-17 { 500 Shares NAB } + 6009.01 12-27-2024 + ~ ~ + + -4949.98 3-26-11 { 500 Shares FBK } + 6009.01 12-27-2024 + ~ ~ + ; + + +f8949_spreadsheet-B/E: { Optional CSV spreadsheet File-name for Cap-Gain/Losses. (Unreported to IRS, B/E) } + +CapGains-B/E { Capital Gains/Losses, 1099-B. For Basis NOT Reported to IRS (Form 8949 check B/E) } + { Enter for each: $BuyAmnt Date, $SellAmnt Date, AdjCode $AdjAmnt ~ ~ } + + 100 1-1-1980 { IBM } + 1000 2-2-2024 + ~ ~ + + 8000 12-24-1980 { SNA } + 1000 12-28-21 + ~ ~ + ; + + +f8949_spreadsheet-C/F: { Optional CSV spreadsheet File-name for Cap-Gain/Losses. (Not above, C/F) } + +CapGains-C/F { Capital Gains/Losses, 1099-B. For when Form 8949 (A,B,D,E) CANNOT be checked. (check C/F) } + { Enter for each: $BuyAmnt Date, $SellAmnt Date, AdjCode $AdjAmnt ~ ~ } + 900 1-1-1980 { MSFT } + 9000 2-2-2024 + ~ ~ + + 100 1-1-1980 { CLF } + 4000 2-2-2024 + ~ ~ + ; + +D4 ; { Short-term gain from 6252, gain or loss from Forms 4684, 6781, 8824. } +D5 ; { Short-term gain/loss from partnerships, S corps, estates, trusts, K-1. } +D6 ; { Short-term 2023 loss carryover. Or, LastYear's return output File-name. } +D11 ; { Gain from Form 4797. } +D12 ; { Partnership net long-term gains or losses. } +D13 ; { Cap Gains Distributions - 1099-DIV column 2a. } +D14 ; { Long-term 2023 loss carryover. Leave blank if file-name used in line D6. } +D19 ; { Amount, if any, from line 18 of Unrecaptured Section 1250 Gain Worksheet. } +Collectibles ; { Long Term Gain or Loss from Collectibles, Form 8949 Part II. (Usually zero.) } + + { } + +{ --- Schedule 1: Additional Income --- } + +S1_1099K_err ; { Amounts on 1099-K forms reported in error or for personal loss. } +S1_1 20.11 ; { Taxable refunds. } +S1_2a 22 ; { Alimony received. } +S1_2b: 6/7/20 { Date of divorce or separation. } +S1_3 3 ; { Business income/loss. (Sched C) } +S1_4 17.18 ; { Other gains or losses. (form 4797) } +S1_5 5 ; { Rent realestate/royalties/partnerships/S corp. Sched E } +S1_6 6 ; { Farm income/loss. (Sched F) } +S1_7 7 ; { Unemployment compensation } +S1_8a 8.01 ; { Net operating loss } +S1_8b 7.02 ; { Gambling income } +S1_8c 6.03 ; { Cancellation of debt } +S1_8d 8.04 ; { Foreign earned income exclusion from Form 2555 } +S1_8e 9.01 ; { Income from Form 8853 } +S1_8f 9.02 ; { Income from Form 8889 } +S1_8g 9.03 ; { Alaska Permanent Fund dividends } +S1_8h 9.04 ; { Jury duty pay } +S1_8i 9.05 ; { Prizes and awards } +S1_8j 9.10 ; { Activity not engaged in for profit income } +S1_8k 9.11 ; { Stock options } +S1_8l 9.12 ; { Rental of personal property income if for profit but not business. } +S1_8m 9.13 ; { Olympic and Paralympic medals + prizes } +S1_8n 9.14 ; { Section 951(a) inclusion } +S1_8o 9.15 ; { Section 951A(a) inclusion } +S1_8p 9.16 ; { Section 461(l) excess business loss adjustment } +S1_8q 9.17 ; { Taxable distributions from an ABLE account } +S1_8r 9.18 ; { Scholarship and fellowship grants not reported on Form W-2 } +S1_8s 9.19 ; { Nontaxable Medicaid waiver payments included on Form 1040, line 1a or 1d } +S1_8t 9.20 ; { Pension from nonqualifed deferred compensation plan or section 457 plan } +S1_8u 9.21 ; { Wages earned while incarcerated } +S1_8v 10.22 ; { Digital assests received as ordinary income not reported elsewhere } +S1_8z 8.17 ; { Other income. } + S1_8z_Type: uber { Type of Other Income. } + +{ ---- Schedule 1, Part II: Adjustments to Gross Income ---- } +S1_11 6.10 ; { Educator expenses } +S1_12 2 ; { Bus. exp.: reservists, artists, ... Attach Form 2106 } +S1_13 3 ; { Health savings account deduction. Attach Form 8889 } +S1_14 4 ; { Moving expenses. Attach Form 3903 } +S1_15 5 ; { Deductable part of self-employment tax. Attach Schedule SE} +S1_16 6 ; { Self-employed SEP, SIMPS1_E, and qualified plans } +S1_17 7 ; { Self-employed health insurance deduction } +S1_18 8 ; { Penalty on early withdrawal of savings } +S1_19a 19 ; { Alimony paid } + AlimRecipSSN: 123006778 { Alimony recipient's SocSec Number. } + DivorceDate: 11/3/15 { Divorce or Separation Date } +S1_20 10 ; { IRA deduction } +S1_21 44.08 ; { Student loan interest deduction } +S1_23 23 ; { Archer MSA deduction } +S1_24a 24 ; { Jury duty pay } +S1_24b 23 ; { Deductible expenses of rental of personal property } +S1_24c 22 ; { Nontaxable Olympic and Paralympic medals & prizes } +S1_24d 10.01 ; { Reforestation amortization and expenses } +S1_24e 4 ; { Repayment of supplemental unemployment benefits } +S1_24f 5 ; { Contributions to section 501(c)(18)(D) pension plans } +S1_24g 10.02 ; { Contributions by certain chaplains to section 403(b) plans } +S1_24h 6 ; { Attorney fees and court costs for unlawful discrimination claims } +S1_24i 7 ; { Attorney fees and court costs for award from the IRS } +S1_24j 8 ; { Housing deduction from Form 2555 } +S1_24k 9 ; { Excess deductions of section 67(e) expenses from Schedule K-1 } +S1_24z 10.03 ; { Other adjustments. } +S1_24z_Type: Materials { Type of Other adjustments. } + + +{ ---- Tax and Credits ---- } + { -- Schedule A: Itemized deductions -- } + A1 5001 ; { Unreimbursed medical expenses. } + A5a { State and local income taxes. (W-2's boxes 17 + 19.) Or sales taxes. } + 39.88 { State-UI (Unemployment Insurance) } + 1479.21 { State-tax withheld/owed } + 1928.35 { Spouse's local tax (paid) } + ; + CheckBoxA5a N ; { Check (Y) if using sales taxes instead of income taxes. (answer: Yes, No) } + A5b 1,771.05 { Real estate taxes.} + ; + A5c 5 ; { Personal property (eg. automobile) taxes. } + A6 6 ; { Other taxes.} + A8a 7 ; { Home mortgage interest and points reported to you on Form 1098.} + A8b ; { Home mortgage interest not reported to you on Form 1098.} + A8c ; { Points not reported to you on Form 1098.} + A9 9 ; { Investment interest. Attach Form 4952} + + A11 111 ; { Charity contributions by Cash or Check. } + A12 12 ; { Charity contributions Other Than cash or check. } + A13 13 ; { Charity contributions CarryOver from prior year. } + + A15 15 ; { Casualty or theft loss(es).} + A16 16 ; { Other expenses} + A18 N ; { Elect to itemize, even when less than standard deduction. (answer: Yes, No) } + +{ -- Schedule B: Part III -- } + B7a N ; { Financial account in foreign country ? (answer: Yes, No) } + B7aa ; { If yes above, did you file FinCEN Form 114 ? (answer: n/a, Yes, No) } + B7b ; { If yes above, name of country. } + B8 N ; { Did you receive a foreign trust ? (answer: Yes, No) } + + +{ --- Alternative Minimum Tax (AMT) Entries (if needed) --- } + AMTws2c ; { Investment interest expense (difference between regular tax and AMT) (Form 6251 line 2c). } + AMTws2g ; { Private activity bond interest exempt from regular tax (Form 6251 line 2g). } + AMTws3 ; { Other adjustments, including income-based related adjustments. } + AMTws8 ; { Alternative minimum tax foreign tax credit. } + +{ --- Schedule 2: Additional Taxes --- } +S2_1a ; { Excess advance premium tax credit repayment. Form 8962. } +S2_1b ; { Repayment of new clean vehicle credit(s) transferred to dealer. } +S2_1c ; { Repayment of previously owned clean vehicle credit(s) transferred to dealer. } +S2_1d ; { Recapture of net EPE from Form 4255, line 2a, column (l). } +S2_1e ; { Excessive payments (EP) from Form 4255. } +S2_1f ; { 20% EP from Form 4255. } +S2_1y ; { Other additions to tax (see instructions). } +S2_4 12.67 ; { Self-employment tax. Sched SE } +S2_5 ; { Social security and Medicare tax from Form 4137. } +S2_6 ; { Uncollected Social security and Medicare tax from Form 8919 } +S2_8 ; { Additional tax on IRAs, other qualified retirement plans, Form 5329 } +S2_9 34.23 ; { Household employment taxes. Sched H } +S2_10 ; { First-time homebuyer credit repayment. Form 5405. } +S2_11 ; { Additional Medicare Tax. Attach Form 8959 } +S2_12 ; { Net investment income tax. Attach Form 8960 } +S2_13 ; { Uncollected social security ... from Form W-2, box 12 } +S2_14 ; { Interest on tax due on installment income } +S2_15 ; { Interest on the deferred tax on gain from certain installment sales } +S2_16 ; { Recapture of low-income housing credit. Attach Form 8611 } + +S2_17a 17.01 ; { Recapture of other credits. } + S2_17a_Type: Rural, 6723 { Type and form number } +S2_17b 16 ; { Recapture of federal mortgage subsidy. } +S2_17c ; { Additional tax on HSA distributions. Attach Form 8889 } +S2_17d ; { Additional tax on an HSA, Attach Form 8889 } +S2_17e ; { Additional tax on Archer MSA distributions. Attach Form 8853 } +S2_17f ; { Additional tax on Medicare Advantage MSA distributions. Form 8853 } +S2_17g ; { Recapture of a charitable contribution deduction } +S2_17h ; { Income you received from a nonqualified deferred compensation } +S2_17i 17.09 ; { Compensation received from nonqualified deferred compensation plan } +S2_17j ; { Section 72(m)(5) excess benefits tax } +S2_17k ; { Golden parachute payments } +S2_17l ; { Tax on accumulation distribution of trusts } +S2_17m ; { Excise tax on insider stock compensation } +S2_17n ; { Look-back interest under section 167(g) or 460(b) } +S2_17o ; { Tax on non-effectively connected income } +S2_17p ; { Any interest from Form 8621, line 16f. } +S2_17q ; { Any interest from Form 8621, line 24 } +S2_17z 17.18 ; { Any other taxes. } + S2_17z_Type: Anom { Type of other taxes. } +S2_19 ; { Additional tax from Schedule 8812 } +S2_20 ; { Section 965 net tax liability installment from Form 965-A } + + +{ --- Schedule 3: Part 1 - Nonrefundable Credits --- } +S3_1 14.15 ; { Foreign tax credit, form 1116 } +S3_2 ; { Child/dependent care expense credits. Form 2441, Line 11. } +S3_3 ; { Education credits. Form 8863, line 19. } +S3_4 31.31 ; { Retirement savings contributions credit. Form 8880. } +S3_5a 51.00 ; { Residential clean energy credits. Form 5695, line 16. } +S3_5b 52.00 ; { Energy efficient home improvement credit. Form 5695, line 32. } + { Other nonrefundable credits. } +S3_6a 6 ; { General business credit. Form 3800. } +S3_6b ; { Credit for prior year minimum tax. Form 8801. } +S3_6c 26.01 ; { Adoption credit. Attach Form 8839 } +S3_6d ; { Credit for the elderly or disabled. Attach Schedule R } +S3_6e ; { Alternative motor vehicle credit. Attach Form 8910 } +S3_6f ; { Qualified plug-in motor vehicle credit. Attach Form 8936 } +S3_6g ; { Mortgage interest credit. Attach Form 8396 } +S3_6h ; { District of Columbia first-time homebuyer credit. Attach Form 8859 } +S3_6i 2.02 ; { Qualified electric vehicle credit. Attach Form 8834 } +S3_6j ; { Alternative fuel vehicle refueling property credit. Attach Form 8911 } +S3_6k ; { Credit to holders of tax credit bonds. Attach Form 8912 } +S3_6l ; { Amount on Form 8978, line 14. } +S3_6m 6.60 ; { Credit for previously owned clean vehicles. Attach Form 8936. } +S3_6z ; { Other nonrefundable credits. } +S3_6z_Type: { Type of Other nonrefundable credits. } + +{ --- Schedule 3: Part II - Other Payments and Refundable Credits --- } +S3_9 ; { Net premium tax credit. Form 8962. } +S3_10 8.10 ; { Amnt paid in filing extension req. } +S3_11 ; { Excess Soc. Sec. + tier 1 RRTA tax withheld. } +S3_12 ; { Credits for federal tax on fuels. Attach form 4136. } +S3_13a 13 ; { Credits from Form 2439. } +S3_13b 14 ; { Credit for repayment of amounts included in income from prior years. } +S3_13c 15 ; { Elective payment amount. Form 3800, Part III, line 6, column (i). } +S3_13d 16 ; { Deferred amount of net 965 tax liability } +S3_13z 17 ; { Credits from Other. } + S3_13z_Type: { Type of other payments or refundable credits. } + + + +{ -------------------------------------------- } +{ --- Optional info for Auto-Fillout only. --- } + + { Your 1st-Name, Middle-Initial } + Your1stName: Fred, D. + YourLastName: Smythe + YourSocSec#: 409-31-7804 + + { Spouse 1st-Name, Middle-Initial -- If Married-Filing-Jointly, otherwise leave spouse fields blank. } + Spouse1stName: Sarah, M. { Leave blank if Single, etc. } + SpouseLastName: Smythe + SpouseSocSec#: 409-33-9408 + + { Your Address } + Number&Street: 1567 W. Hamptonshire + Apt#: + Town/City: Springfield + State: IL + ZipCode: 62722 + + { Your Occupation(s) } + YourOccupat: Merchant + SpouseOccupat: Welder + + { - - - - - - - - -- - - - - - - - - } + { Dependent-1 Information (optional) } + Dep1_FirstName: Emma { First Dependent's first-name. } + Dep1_LastName: Anderson { First Dependent's last-name. } + Dep1_SocSec#: 987-65-4321 { First Dependent's Social Security number. } + Dep1_Relation: Stepdaughter { First Dependent's relationship. } + CkDep1_ChildTxCrd: Yes { (answer: Yes, No) } + CkDep1_CrdOtherDep: { (answer: Yes, No) } + + { Dependent-2 Information (optional) } + Dep2_FirstName: + Dep2_LastName: + Dep2_SocSec#: + Dep2_Relation: + CkDep2_ChildTxCrd: { (answer: Yes, No) } + CkDep2_CrdOtherDep: { (answer: Yes, No) } + + { Dependent-3 Information (optional) } + Dep3_FirstName: + Dep3_LastName: + Dep3_SocSec#: + Dep3_Relation: + CkDep3_ChildTxCrd: { (answer: Yes, No) } + CkDep3_CrdOtherDep: { (answer: Yes, No) } + + { Dependent-4 Information (optional) } + Dep4_FirstName: + Dep4_LastName: + Dep4_SocSec#: + Dep4_Relation: + CkDep4_ChildTxCrd: { (answer: Yes, No) } + CkDep4_CrdOtherDep: { (answer: Yes, No) } + + { Other Dependents } + CkMoreThan_4_Dependents: { (answer: Yes, No) } + + { Optional Direct-Deposit info for Refunds } +L35b: { Routing Number. } +L35c: { (answer: Checking, Savings) } +L35d: { Account Number. } + +Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } +{ + -------------------------------------------- +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040/US_1040_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040/US_1040_template.txt new file mode 100755 index 0000000..a6fee0d --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040/US_1040_template.txt @@ -0,0 +1,371 @@ +Title: US Federal 1040 Tax Form - 2024 + +{ --- Your Filing Status & Exemptions --- } + +Status Single { Single, Married/Joint, Head_of_House, Married/Sep, Widow(er) } + +You_65+Over? N { Were you born before January 2, 1960 ? (answer: Yes, No) } +You_Blind? N { Are you blind ? (answer: Yes, No) } +Spouse_65+Over? N { Was Spouse born before January 2, 1960 ? (answer: Yes, No) } +Spouse_Blind? N { Is Spouse blind ? (answer: Yes, No) } +Dependents 0 { Number of Dependents, (answer: 0, 1, 2, 3, 4, 5, 6, 7, 8, ...) } + +VirtCurr? N { During 2024, did you receive/exchange/sell any Digital Asset? (answer: Yes, No) } + + +{ ---- Income ---- } + +{ -- Wages from W-2 forms Box-1. -- } +L1a + ; + +L1b ; { Household employee wages not reported on Form(s) W-2. } +L1c ; { Tip income not reported on line 1a. } +L1d ; { Medicaid waiver payments not reported on Form(s) W-2. } +L1e ; { Taxable dependent care benefits from Form 2441, line 26. } +L1f ; { Employer-provided adoption benefits from Form 8839, line 29. } +L1g ; { Wages from Form 8919, line 6. } +L1h ; { Other earned income. } +L1i ; { Nontaxable combat pay election. } + + { --- Interest --- } + { -- Tax-Exempt Interest. (Only used for SocialSecurity calculations). -- + (Any private activity bond interest exempt from regular tax, is entered under Schedule 2 below.) } +L2a ; + + { -- Taxable Interest -- 1099-INT(s) box 1 } +L2b + ; + + { --- Dividends --- } + { -- Qualified Dividends 1099-DIV box 1b -- } +L3a + ; + + { -- Ordinary Dividends 1099-DIV box 1a. (Includes Qualified Div's as well.) -- } +L3b + ; + + { --- Other Income & Credits --- } +L4a ; { IRA distributions. (1099-R) } +L4b ; { Taxable IRA distributions. (1099-R) } + QCD no { Qualified Charitable Distribution ? (answer: yes, no) } + +L5a ; { Pensions, Annuites. (1099-R) } +L5b ; { Taxable Pensions, Annuites. (1099-R) } +L6a ; { Social Security benefits. Forms SSA-1099 box-5. } + +L13 ; { Qualified business income deduction. } +L19 ; { Child tax credit/credit for other dependents. } + +L25a ; { Federal income tax withheld, from W-2's, box-2. } +L25b ; { Federal income tax withheld, from 1099's. } +L25c ; { Federal income tax withheld, from other forms. } +L26 ; { Estimated tax payments made for the year. } + +{ -- Refundable Credits -- } +L27 ; { Earned Income Credit (EIC). Attach Sched EIC if you have qualifying child. } +L28 ; { Child Tax Credit, Schedule 8812 } +L29 ; { American Opportunity Credit, Form 8863, line 8 } + +{ -- Refund Options -- } +ApplyTo2024 0 ; { Percent (%) of OverPayment to apply to your 2024 estimated tax. (0-100%) } + +{ -- Penalties -- } +L38 ; { Estimated Tax Under-payment Penalty } + +{ --- Schedule D: Capital Gains/Loses --- } + + { When there are multiple buy-dates, specify "various-short" or "various-long", instead of a specific date. } + { If acquired by inheritance, then specify "inherited" instead of a specific date. } + { Text Editor Note: When adding a security, All values must be present. "~" is a necessary place holder for No Adjustment. } + +f8949_spreadsheet-A/D: { Optional CSV spreadsheet File-name for Cap-Gain/Losses. (Reported to IRS, A/D) } + +CapGains-A/D { Capital Gains/Losses, 1099-B. For Basis Reported to IRS (Form 8949 marks A or D) } + { Enter for each: $BuyAmnt Date, $SellAmnt Date, AdjCode $AdjAmnt ~ ~ } + ; + + +f8949_spreadsheet-B/E: { Optional CSV spreadsheet File-name for Cap-Gain/Losses. (Unreported to IRS, B/E) } + +CapGains-B/E { Capital Gains/Losses, 1099-B. For Basis NOT Reported to IRS (Form 8949 marks B/E) } + { Enter for each: $BuyAmnt Date, $SellAmnt Date, AdjCode $AdjAmnt ~ ~ } + ; + + +f8949_spreadsheet-C/F: { Optional CSV spreadsheet File-name for Cap-Gain/Losses. (Not above, C/F) } + +CapGains-C/F { Capital Gains/Losses, 1099-B. For when Form 8949 (A,B,D,E) CANNOT be checked. (marks C/F) } + { Enter for each: $BuyAmnt Date, $SellAmnt Date, AdjCode $AdjAmnt ~ ~ } + ; + + +D1ad ; { Proceeds of Short-term transactions (Forms 1099-B). } +D1ae ; { Cost of Short-term transactions (Forms 1099-B). } +D4 ; { Short-term gain from 6252, gain or loss from Forms 4684, 6781, 8824. } +D5 ; { Short-term gain/loss from partnerships, S corps, estates, trusts, K-1. } +D6 ; { Short-term 2023 loss carryover. Or, LastYear's return output File-name. } +D8ad ; { Proceeds of Long-term transactions (Forms 1099-B). } +D8ae ; { Cost of Long-term transactions (Forms 1099-B). } +D11 ; { Gain from Form 4797. } +D12 ; { Partnership net long-term gains or losses. } +D13 ; { Cap Gains Distributions - 1099-DIV column 2a. } +D14 ; { Long-term 2023 loss carryover. Leave blank if file-name used in line D6. } +D19 ; { Amount, if any, from line 18 of Unrecaptured Section 1250 Gain Worksheet. } +Collectibles ; { Long Term Gain or Loss from Collectibles, Form 8949 Part II. (Usually zero.) } + +{ --- Schedule 1: Additional Income --- } + +S1_1099K_err ; { Amounts on 1099-K forms reported in error or for personal loss. } +S1_1 ; { Taxable refunds. } +S1_2a ; { Alimony received. } +S1_2b: { Date of divorce or separation. } +S1_3 ; { Business income/loss. (Sched C) } +S1_4 ; { Other gains or losses. (form 4797) } +S1_5 ; { Rent realestate/royalties/partnerships/S corp. Sched E } +S1_6 ; { Farm income/loss. (Sched F) } +S1_7 ; { Unemployment compensation } +S1_8a ; { Net operating loss } +S1_8b ; { Gambling income } +S1_8c ; { Cancellation of debt } +S1_8d ; { Foreign earned income exclusion from Form 2555 } +S1_8e ; { Income from Form 8853 } +S1_8f ; { Income from Form 8889 } +S1_8g ; { Alaska Permanent Fund dividends } +S1_8h ; { Jury duty pay } +S1_8i ; { Prizes and awards } +S1_8j ; { Activity not engaged in for profit income } +S1_8k ; { Stock options } +S1_8l ; { Rental of personal property income if for profit but not business. } +S1_8m ; { Olympic and Paralympic medals + prizes } +S1_8n ; { Section 951(a) inclusion } +S1_8o ; { Section 951A(a) inclusion } +S1_8p ; { Section 461(l) excess business loss adjustment } +S1_8q ; { Taxable distributions from an ABLE account } +S1_8r ; { Scholarship and fellowship grants not reported on Form W-2 } +S1_8s ; { Nontaxable Medicaid waiver payments included on Form 1040, line 1a or 1d } +S1_8t ; { Pension from nonqualifed deferred compensation plan or section 457 plan } +S1_8u ; { Wages earned while incarcerated } +S1_8v ; { Digital assests received as ordinary income not reported elsewhere } +S1_8z ; { Other income. } + S1_8z_Type: { Type of Other Income. } + +{ ---- Schedule 1, Part II: Adjustments to Gross Income ---- } +S1_11 ; { Educator expenses } +S1_12 ; { Bus. exp.: reservists, artists, ... Attach Form 2106 } +S1_13 ; { Health savings account deduction. Attach Form 8889 } +S1_14 ; { Moving expenses. Attach Form 3903 } +S1_15 ; { Deductable part of self-employment tax. Attach Schedule SE} +S1_16 ; { Self-employed SEP, SIMPS1_E, and qualified plans } +S1_17 ; { Self-employed health insurance deduction } +S1_18 ; { Penalty on early withdrawal of savings } +S1_19a ; { Alimony paid } + AlimRecipSSN: { Alimony recipient's SocSec Number. } + DivorceDate: { Divorce or Separation Date } +S1_20 ; { IRA deduction } +S1_21 ; { Student loan interest deduction } +S1_23 ; { Archer MSA deduction } +S1_24a ; { Jury duty pay } +S1_24b ; { Deductible expenses of rental of personal property } +S1_24c ; { Nontaxable Olympic and Paralympic medals & prizes } +S1_24d ; { Reforestation amortization and expenses } +S1_24e ; { Repayment of supplemental unemployment benefits } +S1_24f ; { Contributions to section 501(c)(18)(D) pension plans } +S1_24g ; { Contributions by certain chaplains to section 403(b) plans } +S1_24h ; { Attorney fees and court costs for unlawful discrimination claims } +S1_24i ; { Attorney fees and court costs for award from the IRS } +S1_24j ; { Housing deduction from Form 2555 } +S1_24k ; { Excess deductions of section 67(e) expenses from Schedule K-1 } +S1_24z ; { Other adjustments. } +S1_24z_Type: { Type of Other adjustments. } + + +{ ---- Tax and Credits ---- } + { -- Schedule A: Itemized deductions -- } + A1 ; { Unreimbursed medical expenses. } + A5a ; { State and local income taxes. (W-2's boxes 17 + 19.) Or sales taxes. } + CheckBoxA5a N ; { Check (Y) if using sales taxes instead of income taxes. (answer: Yes, No) } + A5b ; { Real estate taxes.} + A5c ; { Personal property (eg. automobile) taxes. } + A6 ; { Other taxes.} + A8a ; { Home mortgage interest and points reported to you on Form 1098.} + A8b ; { Home mortgage interest not reported to you on Form 1098.} + A8c ; { Points not reported to you on Form 1098.} + A9 ; { Investment interest. Attach Form 4952} + + A11 ; { Charity contributions by Cash or Check. } + A12 ; { Charity contributions Other Than cash or check. } + A13 ; { Charity contributions CarryOver from prior year. } + + A15 ; { Casualty or theft loss(es).} + A16 ; { Other expenses} + A18 N ; { Elect to itemize, even when less than standard deduction. (answer: Yes, No) } + +{ -- Schedule B: Part III -- } + B7a N ; { Financial account in foreign country ? (answer: Yes, No) } + B7aa ; { If yes above, did you file FinCEN Form 114 ? (answer: n/a, Yes, No) } + B7b ; { If yes above, name of country. } + B8 N ; { Did you receive a foreign trust ? (answer: Yes, No) } + + +{ --- Alternative Minimum Tax (AMT) Entries (if needed) --- } + AMTws2c ; { Investment interest expense (difference between regular tax and AMT) (Form 6251 line 2c). } + AMTws2g ; { Private activity bond interest exempt from regular tax (Form 6251 line 2g). } + AMTws3 ; { Other adjustments, including income-based related adjustments. } + AMTws8 ; { Alternative minimum tax foreign tax credit. } + +{ --- Schedule 2: Additional Taxes --- } +S2_1a ; { Excess advance premium tax credit repayment. Form 8962. } +S2_1b ; { Repayment of new clean vehicle credit(s) transferred to dealer. } +S2_1c ; { Repayment of previously owned clean vehicle credit(s) transferred to dealer. } +S2_1d ; { Recapture of net EPE from Form 4255, line 2a, column (l). } +S2_1e ; { Excessive payments (EP) from Form 4255. } +S2_1f ; { 20% EP from Form 4255. } +S2_1y ; { Other additions to tax (see instructions). } +S2_4 ; { Self-employment tax. Sched SE } +S2_5 ; { Social security and Medicare tax from Form 4137. } +S2_6 ; { Uncollected Social security and Medicare tax from Form 8919 } +S2_8 ; { Additional tax on IRAs, other qualified retirement plans, Form 5329 } +S2_9 ; { Household employment taxes. Sched H } +S2_10 ; { First-time homebuyer credit repayment. Form 5405. } +S2_11 ; { Additional Medicare Tax. Attach Form 8959 } +S2_12 ; { Net investment income tax. Attach Form 8960 } +S2_13 ; { Uncollected social security ... from Form W-2, box 12 } +S2_14 ; { Interest on tax due on installment income } +S2_15 ; { Interest on the deferred tax on gain from certain installment sales } +S2_16 ; { Recapture of low-income housing credit. Attach Form 8611 } + +S2_17a ; { Recapture of other credits. } + S2_17a_Type: { Type and form number } +S2_17b ; { Recapture of federal mortgage subsidy. } +S2_17c ; { Additional tax on HSA distributions. Attach Form 8889 } +S2_17d ; { Additional tax on an HSA, Attach Form 8889 } +S2_17e ; { Additional tax on Archer MSA distributions. Attach Form 8853 } +S2_17f ; { Additional tax on Medicare Advantage MSA distributions. Form 8853 } +S2_17g ; { Recapture of a charitable contribution deduction } +S2_17h ; { Income you received from a nonqualified deferred compensation } +S2_17i ; { Compensation received from nonqualified deferred compensation plan } +S2_17j ; { Section 72(m)(5) excess benefits tax } +S2_17k ; { Golden parachute payments } +S2_17l ; { Tax on accumulation distribution of trusts } +S2_17m ; { Excise tax on insider stock compensation } +S2_17n ; { Look-back interest under section 167(g) or 460(b) } +S2_17o ; { Tax on non-effectively connected income } +S2_17p ; { Any interest from Form 8621, line 16f, } +S2_17q ; { Any interest from Form 8621, line 24 } +S2_17z ; { Any other taxes. } + S2_17z_Type: { Type of other taxes. } +S2_19 ; { Additional tax from Schedule 8812 } +S2_20 ; { Section 965 net tax liability installment from Form 965-A } + +{ --- Schedule 3: Part 1 - Nonrefundable Credits --- } +S3_1 ; { Foreign tax credit, form 1116 } +S3_2 ; { Child/dependent care expense credits. Form 2441, Line 11. } +S3_3 ; { Education credits. Form 8863, line 19. } +S3_4 ; { Retirement savings contributions credit. Form 8880. } +S3_5a ; { Residential clean energy credits. Form 5695, line 16. } +S3_5b ; { Energy efficient home improvement credit. Form 5695, line 32. } + { Other nonrefundable credits. } +S3_6a ; { General business credit. Form 3800. } +S3_6b ; { Credit for prior year minimum tax. Form 8801. } +S3_6c ; { Adoption credit. Attach Form 8839 } +S3_6d ; { Credit for the elderly or disabled. Attach Schedule R } +S3_6e ; { Alternative motor vehicle credit. Attach Form 8910 } +S3_6f ; { Qualified plug-in motor vehicle credit. Attach Form 8936 } +S3_6g ; { Mortgage interest credit. Attach Form 8396 } +S3_6h ; { District of Columbia first-time homebuyer credit. Attach Form 8859 } +S3_6i ; { Qualified electric vehicle credit. Attach Form 8834 } +S3_6j ; { Alternative fuel vehicle refueling property credit. Attach Form 8911 } +S3_6k ; { Credit to holders of tax credit bonds. Attach Form 8912 } +S3_6l ; { Amount on Form 8978, line 14. } +S3_6m ; { Credit for previously owned clean vehicles. Attach Form 8936. } +S3_6z ; { Other nonrefundable credits. } +S3_6z_Type: { Type of Other nonrefundable credits. } + +{ --- Schedule 3: Part II - Other Payments and Refundable Credits --- } +S3_9 ; { Net premium tax credit. Form 8962. } +S3_10 ; { Amnt paid in filing extension req. } +S3_11 ; { Excess Soc. Sec. + tier 1 RRTA tax withheld. } +S3_12 ; { Credits for federal tax on fuels. Attach form 4136. } +S3_13a ; { Credits from Form 2439. } +S3_13b ; { Credit for repayment of amounts included in income from prior years. } +S3_13c ; { Elective payment amount. Form 3800, Part III, line 6, column (i). } +S3_13d ; { Deferred amount of net 965 tax liability } +S3_13z ; { Credits from Other. } + S3_13z_Type: { Type of other payments or refundable credits. } + +{ -------------------------------------------- } +{ --- Optional info for Auto-Fillout only. --- } + + { Your 1st-Name, Middle-Initial } + Your1stName: + YourLastName: + YourSocSec#: + + { Spouse 1st-Name, Middle-Initial -- If Married-Filing-Jointly, otherwise leave spouse fields blank. } + Spouse1stName: { Leave blank if Single, etc. } + SpouseLastName: + SpouseSocSec#: + + { Your Address } + Number&Street: + Apt#: + Town/City: + State: + ZipCode: + + { Your Occupation(s) } + YourOccupat: + SpouseOccupat: + + { - - - - - - - - -- - - - - - - - - } + { Dependent-1 Information (optional) } + Dep1_FirstName: { First Dependent's first-name. } + Dep1_LastName: { First Dependent's last-name. } + Dep1_SocSec#: { First Dependent's Social Security number. } + Dep1_Relation: { First Dependent's relationship. } + CkDep1_ChildTxCrd: { (answer: Yes, No) } + CkDep1_CrdOtherDep: { (answer: Yes, No) } + + { Dependent-2 Information (optional) } + Dep2_FirstName: + Dep2_LastName: + Dep2_SocSec#: + Dep2_Relation: + CkDep2_ChildTxCrd: { (answer: Yes, No) } + CkDep2_CrdOtherDep: { (answer: Yes, No) } + + { Dependent-3 Information (optional) } + Dep3_FirstName: + Dep3_LastName: + Dep3_SocSec#: + Dep3_Relation: + CkDep3_ChildTxCrd: { (answer: Yes, No) } + CkDep3_CrdOtherDep: { (answer: Yes, No) } + + { Dependent-4 Information (optional) } + Dep4_FirstName: + Dep4_LastName: + Dep4_SocSec#: + Dep4_Relation: + CkDep4_ChildTxCrd: { (answer: Yes, No) } + CkDep4_CrdOtherDep: { (answer: Yes, No) } + + { Other Dependents } + CkMoreThan_4_Dependents: { (answer: Yes, No) } + + { Optional Direct-Deposit info for Refunds } +L35b: { Routing Number. } +L35c: { (answer: Checking, Savings) } +L35d: { Account Number. } + + { Optional PIN Numbers. } +PIN_3rdParty: { Third Party Personal Identity PIN. (5-digits.) } +PIN_Your: { Your Identity Protection PIN. (6-digits from IRS.) } +PIN_Spouse: { Spouse's Identity Protection PIN. (6-digits from IRS.) } + +Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } +{ + -------------------------------------------- +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040/example_f8949_spreadsheet.csv b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040/example_f8949_spreadsheet.csv new file mode 100755 index 0000000..1419bbb --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040/example_f8949_spreadsheet.csv @@ -0,0 +1,50 @@ +Description, Date_Acquired, Date_Sold, Proceeds, Cost, Code, Adjustment + +50 GME, 1/15/2023, 6/1/2024, 500, 450,, +3 SWK,3/12/2022,3/13/2024,43.40,41.90,, +60 AMZN,3/17/2024,3/18/2024,430.40,401.90 +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 3/1/2024,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, +200 GME, 4/1/22,4/1/2024,89.5,89.52, , +10 AMZN,4/2/22,4/3/2024,2001.53,2000,, + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040_Sched_C/README_US_1040_Sched_C.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040_Sched_C/README_US_1040_Sched_C.txt new file mode 100755 index 0000000..ed475ea --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040_Sched_C/README_US_1040_Sched_C.txt @@ -0,0 +1,26 @@ +Open Tax Solver - 1040 Schedule C - Profit Loss from Business +------------------------------------------------------------- + +Included here is a program, template, and example for +US Fed1040 Schedule-C Profit Loss from Business. + +The example*.txt file is included for testing. +The template*.txt file is a blank starting form for entering +your tax data. For each filer, copy template to a new name, +such as "SchedC_2024.txt" or "SchedC_2024_BakeryCo.txt, and +fill-in the lines. + +Run: + ../../bin/taxsolve_US1040_Sched_C Sched_C.txt + + +For updates and further information, see: + http://sourceforge.net/projects/opentaxsolver/ +Documentation: + http://opentaxsolver.sourceforge.net/ + + +Contributed by S. Jenkins +Minor formatting by Aston Roberts +Updated for 2004 by Robert Heller: +Updated for 2010-2024 by Aston Roberts. diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040_Sched_C/US_1040Sched_C_2024_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040_Sched_C/US_1040Sched_C_2024_example.txt new file mode 100755 index 0000000..b71d165 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040_Sched_C/US_1040Sched_C_2024_example.txt @@ -0,0 +1,192 @@ +Title: 1040 Schedule C - 2024 - EXAMPLE + +{ ---- Your Business Information ---- EXAMPLE ---- } + +YourName: Fred Smythe +YourSocSec#: 409-31-7804 +PrincipalBus: Laundramat & car wash { Description of Business. } +BusinessName: Fred's Washery Co. +Number&Street: 308 Whitney St. +TownStateZip: Houston Tx. 83402 + +{ Activity Code - See Instructions page C17 - C-18. } +ActivityCode: 812320 + +{ Business Tax-ID. } +BusinessEIN: 987-65-4321 + +{ Accounting method: } +Fmethod: Cash { (answer: Cash, Accrual, Other) } + +{ Did you materially participate ? } +GPartic: Yes { (answer: Yes, No) } + +{ Did you acquire this business in 2024 ? } +Hacquired: No { (answer: Yes, No) } + +{ Did you make payments requiring 1099's ? } +Ireq1099s: No { (answer: Yes, No) } + +{ If yes, will you file 1099's ? } +Jfile1099s: n/a { (answer: Yes, No, n/a) } + +{ --- Income & Expenses --- } +L1 45,672.34 { Gross receipts } + 12,894.00 + 5,951.67 + ; + +L2 1,563.15 { Returns and Allowances } + ; + +L6 0 { Other income, fed & state fuel credit } + ; + +L8 456.78 { Advertising } + 198.78 + ; + +L9 1,749.00 { Car & truck expenses (other than mileage entered on Line 44) } + 321.12 + ; + +L10 1,356.87 { Commissions & fees } + 456.32 + ; + +L11 0 { Contract labor } + ; + +L12 0 { Depletion } + ; + +L13 3,195 { Depreciation & Sec 179 expense deduction } + ; + +L14 0 { Employee benefit programs (other than line 19) } + ; + +L15 1,456 { Insurance (other than health) } + ; + +L16a 2,489.45 { Interest (mortgage paid to banks) } + ; + +L16b 0 { Interest (Other) } + ; + +L17 3,220.54 { Legal & professional services } + ; + +L18 1,929.00 { Office expense } + ; + +L19 0 { Pension & profit sharing plans } + ; + +L20a 5,923.99 { Vehicles and equiment Rent or Lease } + ; + +L20b 819.11 { Rent or lease Other business property } + ; + +L21 423.76 { Repairs & maintenance } + ; + +L22 0 { Supplies (not in Part III) } + ; + +L23 45.00 { Taxes & licenses } + ; + +L24a 500.00 { Travel } + ; + +L24b 40.00 { Deductible meals & entertainment } + ; + +L25 787.44 { Utilities } + ; + +L26 11,978.03 { Wages (less employment credits) } + ; + +L30 450.00 { Expenses for business use of home (form 8829) } + ; + +L32a Yes { All investment is at risk ? (answer: Yes, No) } + + + { --- Part III --- } +L33: Cost { Method to value closing inventory: (answer: Cost, Market, Other) } +L34: No { Changed method ? (answer: Yes, No) } +L35 10,000.00 { Inventory at beginning of year } + + ; +L36 2,000.00 { Purchases minus cost of personel items } + -800.00 + + ; +L37 5,500.00 { Cost of labor (not paid to yourself) } + + ; +L38 3,300.00 { Materials & supplies } + + ; +L39 0 { Other costs } + + ; +L41 8,000.00 { Inventory at year end } + ; + + + { --- Part IV - Complete only if claiming business vehicle. --- } +L43: 10-28-2003 { When was vehicle placed in service for business ? mm-dd-yyyy } +L44a { Business Miles. } + 4,903 { Truck } + 1,045 { Car 1 } + 9,808 { Truck } + ; +L44b 3,128 ; { Commuting Miles } +L44c 123 ; { Other Miles } +L45: Yes { Vehicle available off-duty for personal use ? (answer: Yes, No, n/a) } +L46: Yes { Have another personal vehicle ? (answer: Yes, No, n/a) } +L47a: yes { Have evidence to support deduction ? (answer: Yes, No, n/a) } +L47b: No { If so, is evidence written ? (answer: Yes, No, n/a) } + + + + { --- Part V - Other Expenses. List expenses not included on lines 8-26 or 30. --- } +L48a_descr: Cleaning supplies { Description of expense. } +L48a_amnt 380.34 ; { Amount of expense. } + +L48b_descr: Brushes { Description of expense. } +L48b_amnt 90.20 { Amount of expense. } + 80.90 + ; +L48c_descr: { Description of expense. } +L48c_amnt ; { Amount of expense. } + +L48d_descr: { Description of expense. } +L48d_amnt ; { Amount of expense. } + +L48e_descr: { Description of expense. } +L48e_amnt ; { Amount of expense. } + +L48f_descr: { Description of expense. } +L48f_amnt ; { Amount of expense. } + +L48g_descr: { Description of expense. } +L48g_amnt ; { Amount of expense. } + +L48h_descr: { Description of expense. } +L48h_amnt ; { Amount of expense. } + +L48i_descr: { Description of expense. } +L48i_amnt ; { Amount of expense. } + +{ + --------------- +} +Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040_Sched_C/US_1040Sched_C_2024_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040_Sched_C/US_1040Sched_C_2024_template.txt new file mode 100755 index 0000000..1bc1738 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040_Sched_C/US_1040Sched_C_2024_template.txt @@ -0,0 +1,151 @@ +Title: 1040 Schedule C Tax Form - 2024 + +{ ---- Your Business Information ---- } + +YourName: +YourSocSec#: +PrincipalBus: { Description of Business. } +BusinessName: +Number&Street: +TownStateZip: + +{ Activity Code - See Instructions page C17 - C-18. } +ActivityCode: + +{ Business Tax-ID. } +BusinessEIN: + +{ Accounting method: } +Fmethod: { (answer: Cash, Accrual, Other) } + +{ Did you materially participate ? } +GPartic: { (answer: Yes, No) } + +{ Did you acquire this business in 2024 ? } +Hacquired: { (answer: Yes, No) } + +{ Did you make payments requiring 1099's ? } +Ireq1099s: { (answer: Yes, No) } + +{ If yes, will you file 1099's ? } +Jfile1099s: { (answer: Yes, No, n/a) } + + +{ ----- Income & Expenses ---- } + +L1 { Gross receipts } + ; +L2 { Returns and Allowances } + ; +L6 { Other income, fed & state fuel credit } + ; +L8 { Advertising } + ; +L9 { Car & truck expenses (other than mileage entered on Line 44) } + ; +L10 { Commissions & fees } + ; +L11 { Contract labor } + ; +L12 { Depletion } + ; +L13 { Depreciation & Sec 179 expense deduction } + ; +L14 { Employee benefit programs (other than line 19) } + ; +L15 { Insurance (other than health) } + ; +L16a { Interest (mortgage paid to banks) } + ; +L16b { Interest (Other) } + ; +L17 { Legal & professional services } + ; +L18 { Office expense } + ; +L19 { Pension & profit sharing plans } + ; +L20a { Vehicles and equiment Rent or Lease } + ; +L20b { Rent or lease Other business property } + ; +L21 { Repairs & maintenance } + ; +L22 { Supplies (not in Part III) } + ; +L23 { Taxes & licenses } + ; +L24a { Travel } + ; +L24b { Deductible meals & entertainment } + ; +L25 { Utilities } + ; +L26 { Wages (less employment credits) } + ; +L30 { Expenses for business use of home (form 8829) } + ; +L32a { All investment is at risk ? (answer: Yes, No) } + + + { --- Part III --- } +L33: { Method to value closing inventory: (answer: Cost, Market, Other) } +L34: { Changed method ? (answer: Yes, No) } +L35 { Inventory at beginning of year } + ; +L36 { Purchases minus cost of personel items } + ; +L37 { Cost of labor (not paid to yourself) } + ; +L38 { Materials & supplies } + ; +L39 { Other costs } + ; +L41 { Inventory at year end } + ; + + + { --- Part IV - Complete only if claiming business vehicle. --- } +L43: { When was vehicle placed in service for business ? mm-dd-yyyy } +L44a ; { Business Miles } +L44b ; { Commuting Miles } +L44c ; { Other Miles } +L45: { Vehicle available off-duty for personal use ? (answer: Yes, No, n/a) } +L46: { Have another personal vehicle ? (answer: Yes, No, n/a) } +L47a: { Have evidence to support deduction ? (answer: Yes, No, n/a) } +L47b: { If so, is evidence written ? (answer: Yes, No, n/a) } + + + { --- Part V - Other Expenses. List business expenses not included on lines 8-26 or 30. --- } +L48a_descr: { Description of expense. } +L48a_amnt ; { Amount of expense. } + +L48b_descr: { Description of expense. } +L48b_amnt ; { Amount of expense. } + +L48c_descr: { Description of expense. } +L48c_amnt ; { Amount of expense. } + +L48d_descr: { Description of expense. } +L48d_amnt ; { Amount of expense. } + +L48e_descr: { Description of expense. } +L48e_amnt ; { Amount of expense. } + +L48f_descr: { Description of expense. } +L48f_amnt ; { Amount of expense. } + +L48g_descr: { Description of expense. } +L48g_amnt ; { Amount of expense. } + +L48h_descr: { Description of expense. } +L48h_amnt ; { Amount of expense. } + +L48i_descr: { Description of expense. } +L48i_amnt ; { Amount of expense. } + +{ + -------------------------- +} +Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040_Sched_SE/US_1040_Sched_SE_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040_Sched_SE/US_1040_Sched_SE_example.txt new file mode 100755 index 0000000..001bd56 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040_Sched_SE/US_1040_Sched_SE_example.txt @@ -0,0 +1,26 @@ +Title: 1040 Schedule SE - 2024 - EXAMPLE + +{ ---- Your Information ---- EXAMPLE ---- } + +YourName: Fred Smythe +YourSocSec#: 409-31-7804 + +{ --- Self-Employment Tax --- } + +L2 32775 ; { Net Profit/Loss } + +L5a 462.76 ; { Church employee income from Form w-2 } + +L8a 100 ; { Total social security wages and tips and RR retirement compensation } + { - if > $168,600 skip lines 8b and 8c } + +L8b 50 ; { Unreported tips from Form 4137, line 10 } + +L8c 25 ; { Wages from Form 8919, line 10 } + +{ + --------------- +} + +Round_PDF_to_Whole_Dollars Y { Controls format of PDF form. (answer: Yes, No) } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040_Sched_SE/US_1040_Sched_SE_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040_Sched_SE/US_1040_Sched_SE_template.txt new file mode 100755 index 0000000..ebc19c6 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/US_1040_Sched_SE/US_1040_Sched_SE_template.txt @@ -0,0 +1,26 @@ +Title: 1040 Schedule SE - 2024 + +{ ---- Your Information ---- } + +YourName: +YourSocSec#: + +{ --- Self-Employment Tax --- } + +L2 ; { Net Profit/Loss, from Sched-C line-31, etc.. } + +L5a ; { Church employee income from Form w-2 } + +L8a ; { Total social security wages and tips and RR retirement compensation } + { - if > $168,600 skip lines 8b and 8c } + +L8b ; { Unreported tips from Form 4137, line 10 } + +L8c ; { Wages from Form 8919, line 10 } + +{ + --------------- +} + +Round_PDF_to_Whole_Dollars Y { Controls format of PDF output. (answer: Yes, No) } + diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/VA_760/README_VA_760.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/VA_760/README_VA_760.txt new file mode 100755 index 0000000..1da156b --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/VA_760/README_VA_760.txt @@ -0,0 +1,15 @@ +Open Tax Solver - Virginia 760 State Tax Return +----------------------------------------------- + +Included here is a program, template, and example for +Virginia State tax form 760. + +The example*.txt file is included for testing. +The template*.txt file is a blank starting form for entering +your tax data. + +Compile: + cc src/taxsolve_VA760_2024.c -o bin/taxsolve_VA760_2024 + +Run: + bin/taxsolve_VA760_2024 VA760_2024.txt diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/VA_760/VA_760_2024_example.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/VA_760/VA_760_2024_example.txt new file mode 100755 index 0000000..8f302e2 --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/VA_760/VA_760_2024_example.txt @@ -0,0 +1,63 @@ +Title: VA-760 State 2024 Tax Form -- EXAMPLE + +{ ----------- EXAMPLE ONLY ------------- } + +{ -- Filing Status -- } + +Status Married/joint { Single, Married/joint, Married/separate, Head_of_household } + + Your1stName: Maria + YourMI: Q + YourLastName: Roberts + YourSocSec#: 123-45-6789 + YourDOB: 6/3/1970 + YourDrivLic: R92374829 + YourDLdate: 12/7/2023 + + Spouse1stName: Arron { Leave blank if Single, etc. } + SpouseMI: R + SpouseLastName: Roberts + SpouseSocSec#: 876-54-3210 + SpouseDOB: 11/2/1956 + SpouseDrivLic: R82918289 + SpouseDLdate: 2/9/2014 + + Number&Street: 123 St. Bartho St. + Town: Beltsville + Zipcode: 12345 + +{ -- Exemptions -- } + +OtherDependents 1 ; { Number of Dependents, not including you or spouse. (answer: 0, 1, 2, 3, ...) } +YouBlind Y { (answer: Y, N ) } +SpouseBlind N { (answer: Y, N ) } + +{ -- Income & Credits -- } + +L1 73,890.34 ; { Federal Adjusted Gross Income } +L2 20 ; { Additions from attached Schedule ADJ, line 3 } +L4 30 ; { Deduction for age on Jan 1, 2024. } +L5 40 ; { Social Security Act, Tier 1 Railroad Retirement Act benef. } +L6 50 ; { State Income Tax refund or overpayment credit } +L7 60 ; { Subtractions from Schedule ADJ, line 7 } +L10 70.0 ; { Itemized Deductions - Otherwise enter 0.0 for Std. Ded. } +L13 90 ; { Deductions from VAGI Schedule ADJ, Line 9. } +STA_VAGI 13,300 ; { Spouse VAGI for Line 17 STA. } +L17 10 ; { Spouse Tax Adjustment (STA). } +L19a 4,718.00 ; { Virginia tax withheld for 2024. } +L19b 11 ; { Spouse's Virginia tax withheld. } +L20 12 ; { Estimated tax paid for 2024. (form 760ES) } +L21 13 ; { Amount of 2023 overpayment applied toward 2024 estimated tax. } +L22 14 ; { Extension payments (form 760IP). } +L23 15 ; { Tax Credit, Low Income Individuals (Sch. ADJ, line 17) } +L24 16 ; { Credit, Tax Paid to other State (Sch. OSC line 21 ...) } +L25 18 ; { Credits from attached Schedule CR, Section 5, Part 1, Line 1A } +L29 19 ; { Amount of overpayment to credit to next year's estimated tax.} +L30 20 ; { VA College Savings Plan Contributions, Sched-VAC, I-6. } +L31 21 ; { Other voluntary contribitions. } +L32 22 ; { Addition to Tax, Penalty, Interest, Sched-ADJ, Line 21 } +L33 23 ; { Consumer's Use Tax. } + +{ + ----------------------- +} diff --git a/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/VA_760/VA_760_2024_template.txt b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/VA_760/VA_760_2024_template.txt new file mode 100755 index 0000000..a9acd2c --- /dev/null +++ b/TaxSoftware/OpenTaxSolver2024_22.07_mswin/tax_form_files/VA_760/VA_760_2024_template.txt @@ -0,0 +1,61 @@ +Title: VA-760 State 2024 Tax Form + +{ -- Filing Status -- } + +Status Married/joint { Single, Married/joint, Married/separate, Head_of_household } + + Your1stName: + YourMI: + YourLastName: + YourSocSec#: + YourDOB: + YourDrivLic: + YourDLdate: + + Spouse1stName: { Leave blank if Single, etc. } + SpouseMI: + SpouseLastName: + SpouseSocSec#: + SpouseDOB: + SpouseDrivLic: + SpouseDLdate: + + Number&Street: + Town: + Zipcode: + +{ -- Exemptions -- } + +OtherDependents ; { Number of Dependents, not including you or spouse. (answer: 0, 1, 2, 3, ...) } +YouBlind N { (answer: Y, N ) } +SpouseBlind N { (answer: Y, N ) } + +{ -- Income & Credits -- } + +L1 ; { Federal Adjusted Gross Income } +L2 ; { Additions from attached Schedule ADJ, line 3 } +L4 ; { Deduction for age on Jan 1, 2024. } +L5 ; { Social Security Act, Tier 1 Railroad Retirement Act benef. } +L6 ; { State Income Tax refund or overpayment credit } +L7 ; { Subtractions from Schedule ADJ, line 7 } +L10 ; { Itemized Deductions - Otherwise enter 0.0 for Std. Ded. } +L13 ; { Deductions from VAGI Schedule ADJ, Line 9. } +STA_VAGI ; { Spouse VAGI for Line 17 STA. } +L17 ; { Spouse Tax Adjustment (STA). } +L19a ; { Virginia tax withheld for 2024. } +L19b ; { Spouse's Virginia tax withheld. } +L20 ; { Estimated tax paid for 2024. (form 760ES) } +L21 ; { Amount of 2023 overpayment applied toward 2024 estimated tax. } +L22 ; { Extension payments (form 760IP). } +L23 ; { Tax Credit, Low Income Individuals (Sch. ADJ, line 17) } +L24 ; { Credit, Tax Paid to other State (Sch. OSC line 21 ...) } +L25 ; { Credits from attached Schedule CR, Section 5, Part 1, Line 1A } +L29 ; { Amount of overpayment to credit to next year's estimated tax.} +L30 ; { VA College Savings Plan Contributions, Sched-VAC, I-6. } +L31 ; { Other voluntary contribitions. } +L32 ; { Addition to Tax, Penalty, Interest, Sched-ADJ, Line 21 } +L33 ; { Consumer's Use Tax. } + +{ + ------------------------------- +}