NAME
Business::Tax::US::Form_1040::Worksheets - IRS Form 1040 worksheets calculations
SYNOPSIS
use Business::Tax::US::Form_1040::Worksheets qw(
social_security_benefits
social_security_worksheet_data
qualified_dividends_capital_gains_tax
pp_qdcgtw
decimal_lines
);
$benefits = social_security_benefits( $inputs );
$worksheet_data = social_security_worksheet_data( $inputs );
$lines = qualified_dividends_capital_gains_tax( $inputs );
pp_qdcgtw($lines);
DESCRIPTION
This library exports, on demand only, functions which implement calculations used in various worksheets found in U.S. IRS Form 1040 instructions.
Acronyms:
SSBW: Social Security Benefits Worksheet, e.g., as found on page 32 of IRS Form 1040 Instructions for filing year 2023.
QDCGTW: Qualified Dividends and Capital Gain Tax Worksheet, e.g., as found on page 37 of those 2023 Instructions.
The current version of this library supports the SSBW and most of the QDCGTW for filing years 2022 and 2023. Future versions may extend the support of those worksheets forwards and backwords; may offer more complete support for the QDCGTW; and may offer support for other worksheets found within the Form 1040 instructions.
The accuracy of the calculations in these functions has not been reviewed by the Internal Revenue Service, any other tax authority, any accountant or any attorney. Use at your own risk!
SUBROUTINES
social_security_benefits()
Purpose
Calculate taxable social security benefits per the SSBW for the purpose of entering the amount of such taxable benefits on IRS Form 1040. (For filing year 2023, these would be lines 6a and 6b on that form.)
my $benefits = social_security_benefits( $inputs );
Arguments
Single hash reference with the following keys (values are purely for example):
$inputs = { box5 => 30000.00, # Sum of box 5 on all Forms SSA-1099 and RRB-1099 l1z => 0, # Form 1040, line 1z l2b => 350.00, l3b => 6000.00, l4b => 0, l5b => 8000.00, l7 => 1600.00, l8 => 1000.00, l2a => 0, s1l11 => 0, # Schedule 1 (Form 1040), line 11 s1l12 => 0, s1l13 => 0, s1l14 => 0, s1l15 => 0, s1l16 => 0, s1l17 => 0, s1l18 => 0, s1l19 => 0, s1l20 => 0, s1l23 => 0, s1l25 => 0, status => 'single', # Social Security Benefits Worksheet, line 8 filing_year => 2023, };
Appropriate values for elements in
$inputs
:status
: String holding one ofmarried single married_sep
.filing_year
: Filing year (4-digits).All others: Number holding dollar amount (to 2-decimal maximum). If value is
0
, element may be omitted.
Return Value
Scalar holding taxable social security benefits in dollars and two cents, e.g.,
289.73
.
social_security_worksheet_data()
Purpose
Calculate data needed for the purpose of completing all entries (except checkboxes) on the Social Security Benefits Worksheet (For filing year 2023, these would be lines 6a and 6b on that form.)
my $worksheet_data = social_security_worksheet_data( $inputs );
Arguments
The same, single hash reference which is supplied to
social_security_benefits()
(q.v. above).Return Value
Reference to an array holding the data to be entered on lines 1-18 of the SSBW. The indexes to the elements of that array correspond to those line numbers on the SSBW.
pp_ssbw()
Purpose
Pretty-print ('pp' for short) the results of
social_security_worksheet_data()
for easier transcription to printed worksheet.pp_ssbw($results);
Arguments
The array reference which is the return value of
social_security_worksheet_data()
. Required.Return Value
Implicitly returns true value upon success.
Comment
In a future version of this library, this function may take a second argument which presumably will be a string holding the path to an output file. For now, the function simply prints to
STDOUT
.
qualified_dividends_capital_gains_tax()
Purpose
Partial calculation of taxes due per the QDCGTW for the purpose of entering the amount of such taxes due on IRS Form 1040. (For filing year 2023, these would be Form 1040 line 16.)
my $lines = qualified_dividends_capital_gains_tax( $inputs );
Arguments
Reference to a hash with 6 required elements:
l15 l3a sD status1 status2 filing_year
.my $inputs = { l15 => 7000.00, # Form 1040, line 15 l3a => 4900.00, # Form 1040, line 3a sD => 1600.00, # If filing Schedule D, enter smaller # of Schedule D, line 15 o4 16; # if not, enter Form 1040, line 7. status1 => 'single_or_married_sep', # Permissible values: # single_or_married_sep # married # head_of_household status2 => 'single', # Permissible values: # single # married_sep # married # head_of_household filing_year => 2023, };
Return Value
Reference to an array where the indices of the array correspond to the values calculated for the following lines in the Qualified Dividends and Capital Gain Tax Worksheet:
my $lines = [ undef, 7000, # QDCGT Worksheet, line 1 4900, 1600, 6500, 500, 41675, 7000, 500, 6500, 6500, 6500, 0, 459750, 7000, 7000, 0, 0, 0, 6500, 0, 0, # QDCGT Worksheet, line 21 ]
Comment
QDCGT Worksheet lines 22 and 24 require looking up values in the Tax Table or the Tax Computation Worksheet. To access the data those tables is currently beyond the scope of this library. Hence, the return value of this function provides you with those values you need to fill in lines 1 through 21 on the Worksheet. You must then turn to the Tax Table or Tax Computation Worksheet to make entries in lines 22 through 25 of the Worksheet. Once you calculate line 25 of that Worksheet, you will typically enter that on Form 1040 Line 16, your tax due.
pp_qdcgtw()
Purpose
Pretty-print ('pp' for short) the results of
qualified_dividends_capital_gains_tax()
for easier transcription to printed worksheet.pp_qdcgtw($results);
Arguments
The array reference which is the return value of
qualified_dividends_capital_gains_tax()
. Required.Return Value
Implicitly returns true value upon success.
Comment
In a future version of this library, this function may take a second argument which presumably will be a string holding the path to an output file. For now, the function simply prints to
STDOUT
.
decimal_lines()
Purpose
This is a helper subroutine used within both this module and the test suite to ensure that all final monetary data is appropriately reported to two decimal places.
Arguments
my $formatted_lines = decimal_lines($lines);
Single array reference holding a list of the values calculated for the various lines in a worksheet.
Return Value
Single array reference holding a list of values prepared for entry into the worksheets to two decimal places (except for where the value is zero (
0
). Values that are undefined remain so.
AUTHOR
James E Keenan
CPAN ID: JKEENAN
jkeenan@cpan.org
http://thenceforward.net/perl
COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
SEE ALSO
perl(1).