TimeTrex Community Edition v16.2.0

This commit is contained in:
2022-12-13 07:10:06 +01:00
commit 472f000c1b
6810 changed files with 2636142 additions and 0 deletions

View File

@ -0,0 +1,143 @@
<?php
require_once( '../../../../../includes/global.inc.php' );
require_once( '../../../../GovernmentForms/GovernmentForms.class.php' );
$gf = new GovernmentForms();
$f1099nec_obj = $gf->getFormObject( '1099nec', 'US' );
$f1099nec_obj->setType( 'government' );
//$fw2_obj->setType( 'employee' );
$f1099nec_obj->setDebug( true );
$f1099nec_obj->setShowBackground( true );
$f1099nec_obj->year = 2021;
$f1099nec_obj->ein = '12-3456789';
$f1099nec_obj->trade_name = 'ABC Company';
$f1099nec_obj->company_address1 = '#1232 Main St';
$f1099nec_obj->company_address2 = '123 #Suite';
$f1099nec_obj->company_city = 'New York';
$f1099nec_obj->company_state = 'NY';
$f1099nec_obj->company_zip_code = '12345';
$ee_data = [
'ssn' => '123 456 789',
'address1' => '#1232 Main St',
'address2' => 'Suite #123',
'city' => 'New York',
'state' => 'NY',
'zip_code' => '12345',
'first_name' => 'George',
'middle_name' => 'Avery 1',
'last_name' => 'Doe',
'recipient_id' => 123456999,
'payer_id' => 123456888,
'account_number' => 123456,
'l1' => 223456.99,
'l4' => 223456.98,
'l5a' => 223456.97,
'l6a' => 123456789,
'l7a' => 223456.95,
'l5b' => 223456.94,
'l6b' => 1234567899,
'l7b' => 223456.93,
];
$f1099nec_obj->addRecord( $ee_data );
$gf->addForm( $f1099nec_obj );
$ee_data = [
'ssn' => '123 456 999',
'address1' => '#456 Main St',
'address2' => 'Suite #456',
'city' => 'New York',
'state' => 'NY',
'zip_code' => '12345',
'first_name' => 'John',
'middle_name' => 'Avery 2',
'last_name' => 'Doe',
'recipient_id' => 123456999,
'payer_id' => 123456888,
'account_number' => 123456,
'l1' => 223456.99,
'l4' => 223456.98,
'l5a' => 223456.97,
'l6a' => 123456789,
'l7a' => 223456.95,
'l5b' => 223456.94,
'l6b' => 1234567899,
'l7b' => 223456.93,
];
$f1099nec_obj->addRecord( $ee_data );
$gf->addForm( $f1099nec_obj );
$ee_data = [
'ssn' => '123 456 999',
'address1' => '#456 Main St',
'address2' => 'Suite #456',
'city' => 'New York',
'state' => 'NY',
'zip_code' => '12345',
'first_name' => 'Jane',
'middle_name' => 'Avery 3',
'last_name' => 'Doe',
'recipient_id' => 123456999,
'payer_id' => 123456888,
'account_number' => 123456,
'l1' => 223456.99,
'l4' => 223456.98,
'l5a' => 223456.97,
'l6a' => 123456789,
'l7a' => 223456.95,
'l5b' => 223456.94,
'l6b' => 1234567899,
'l7b' => 223456.93,
];
$f1099nec_obj->addRecord( $ee_data );
$gf->addForm( $f1099nec_obj );
$f1096_obj = $gf->getFormObject( '1096', 'US' );
$f1096_obj->setDebug( true );
$f1096_obj->setShowBackground( true );
$f1096_obj->year = $f1099nec_obj->year;
$f1096_obj->ein = $f1099nec_obj->ein;
$f1096_obj->trade_name = $f1099nec_obj->trade_name;
$f1096_obj->company_address1 = $f1099nec_obj->company_address1;
$f1096_obj->company_address2 = $f1099nec_obj->company_address2;
$f1096_obj->company_city = $f1099nec_obj->company_city;
$f1096_obj->company_state = $f1099nec_obj->company_state;
$f1096_obj->company_zip_code = $f1099nec_obj->company_zip_code;
$f1096_obj->contact_name = 'John Doe';
$f1096_obj->contact_phone = '555-555-5555';
$f1096_obj->contact_phone_ext = '555';
$f1096_obj->contact_email = 'john@company.com';
$f1096_obj->l3 = count( $gf->getForms() );
$f1096_obj->l4 = 1.23;
$f1096_obj->l5 = 2.34;
$gf->addForm( $f1096_obj );
//$output = $gf->output( 'xml' );
$output = $gf->output( 'pdf' );
file_put_contents( '/tmp/1099nec.pdf', $output );
//file_put_contents( 'w2.xml', $output );
?>

View File

@ -0,0 +1,58 @@
<?php
require_once( '../../../../../includes/global.inc.php' );
require_once( '../../../../GovernmentForms/GovernmentForms.class.php' );
$gf = new GovernmentForms();
$return940 = $gf->getFormObject( 'RETURN940', 'US' );
$return940->TaxPeriodEndDate = '1967-08-13';
$return940->ReturnType = '940PR';
$return940->ein = '000000000';
$return940->BusinessName1 = '#';
$return940->BusinessNameControl = '-';
$return940->AddressLine = '-';
$return940->City = 'A';
$return940->State = 'WY';
$return940->ZIPCode = '00000';
$gf->addForm( $return940 );
$f940_obj = $gf->getFormObject( '940', 'US' );
$f940_obj->setDebug( false );
$f940_obj->setShowBackground( true );
$f940_obj->year = 2009;
$f940_obj->return_type = [ 'a', 'b', 'c', 'd' ];
$f940_obj->ein = '12-3456789';
$f940_obj->name = 'John Doe';
$f940_obj->trade_name = 'ABC Company';
$f940_obj->address = '#1232 Main St';
$f940_obj->city = 'New York';
$f940_obj->state = 'NY';
$f940_obj->zip_code = '12345';
$f940_obj->l3 = 223456.99;
$f940_obj->l4 = 567.01;
$f940_obj->l4a = true;
$f940_obj->l4b = true;
$f940_obj->l4c = true;
$f940_obj->l4d = true;
$f940_obj->l4e = true;
$f940_obj->l5 = 123456.99;
$f940_obj->l13 = 0;
$f940_obj->l15a = true;
$f940_obj->l15b = true;
$f940_obj->l16a = 1001.00;
$f940_obj->l16b = 1002.00;
$f940_obj->l16c = 1003.00;
$f940_obj->l16d = 1004.00;
$gf->addForm( $f940_obj );
$output = $gf->output( 'xml' );
file_put_contents( '940.xml', $output );
?>

View File

@ -0,0 +1,104 @@
<?php
require_once( '../../../../../includes/global.inc.php' );
require_once( '../../../../GovernmentForms/GovernmentForms.class.php' );
$gf = new GovernmentForms();
$return941 = $gf->getFormObject( 'RETURN941', 'US' );
$return941->TaxPeriodEndDate = '1967-08-13';
$return941->ReturnType = '941PR';
$return941->ein = '000000000';
$return941->BusinessName1 = '#';
$return941->BusinessNameControl = '-';
$return941->AddressLine = '-';
$return941->City = 'A';
$return941->State = 'WY';
$return941->ZIPCode = '00000';
$gf->addForm( $return941 );
$f941_obj = $gf->getFormObject( '941', 'US' );
$f941_obj->setDebug( true );
$f941_obj->setShowBackground( true );
$f941_obj->year = 2020;
$f941_obj->ein = '12-3456789';
$f941_obj->name = 'John Doe';
$f941_obj->trade_name = 'ABC Company';
$f941_obj->address = '#1232 Main St';
$f941_obj->city = 'New York';
$f941_obj->state = 'NY';
$f941_obj->zip_code = '12345';
$f941_obj->quarter = [ 1, 2, 3, 4 ];
$f941_obj->l1 = 10;
$f941_obj->l2 = 9999.99;
$f941_obj->l3 = 999.99;
$f941_obj->l4 = true;
$f941_obj->l5 = 9999.99;
$f941_obj->l5a = 5999.91;
$f941_obj->l5ai = 1799.92;
$f941_obj->l5aii = 1299.93;
$f941_obj->l5b = 1999.94;
$f941_obj->l5c = 1999.95;
$f941_obj->l5d = 1999.69;
$f941_obj->l5f = 1.59;
$f941_obj->l7z = 570.10;
$f941_obj->l8 = 1.98;
$f941_obj->l9 = 2000.99;
$f941_obj->l11a = 3.96;
$f941_obj->l11b = 3.95;
$f941_obj->l11c = 3.94;
$f941_obj->l11d = 3.93;
$f941_obj->l11e = 3.92;
$f941_obj->l11f = 99;
//$f941_obj->l12 = 1.97;
$f941_obj->l13a = 1000.98;
$f941_obj->l13b = 1000.97;
$f941_obj->l13c = 1000.96;
$f941_obj->l13d = 1000.95;
$f941_obj->l13e = 1000.94;
$f941_obj->l13f = 1000.93;
$f941_obj->l13h = 1.92;
//$f941_obj->l13g = 9000.92;
$f941_obj->l14 = 9999.99;
$f941_obj->l15 = 1.99; //Overpayment
$f941_obj->l15a = true;
$f941_obj->l15b = true;
$f941_obj->l16_month1 = 9999.99;
$f941_obj->l16_month2 = 9999.98;
$f941_obj->l16_month3 = 9999.97;
$f941_obj->l17 = true;
$f941_obj->l18a = true;
$f941_obj->l18b = true;
$f941_obj->l19 = 2000.01;
$f941_obj->l20 = 2000.02;
$f941_obj->l21 = 2000.03;
$f941_obj->l22 = 2000.04;
$f941_obj->l23 = 2000.05;
$f941_obj->l24 = 2000.06;
$f941_obj->l25 = 2000.07;
$f941_obj->l26 = 2000.08;
$f941_obj->l27 = 2000.09;
$f941_obj->l28 = 2000.10;
$gf->addForm( $f941_obj );
//$output = $gf->output( 'xml' );
//file_put_contents( '941.xml', $output );
$output = $gf->output( 'pdf' );
file_put_contents( './941test.pdf', $output );
?>

View File

@ -0,0 +1,68 @@
<?php
require_once( '../../../../../includes/global.inc.php' );
/*
* Import the PDF into the desktop Scribus application, then save as a PDF to make the form fillable in PHP. This still requires some changes though, such as text alignment in form fields, and checkboxes.
* Scribus can also show exact coordinates in the PDF, so that might make the overlay PDF option easier to deal with.
* Filling out large forms is quite slow.
*
* Dump PDF form field names: pdftk classes/GovernmentForms/country/us/templates/941.orig.pdf dump_data_fields
*
* If an error of: "Fast Web View mode is not supported" is returned, use: cpdf in.pdf -o out.pdf
* https://stackoverflow.com/questions/18741208/disable-fast-web-view-on-a-pdf-file
*
*
* ***NOTE*** This only works with AcroForms and not XFA forms which the IRS primarily uses.
* pdftk f941.pdf output f941_dropped_xfa.pdf drop_xfa
* pdftk f941_dropped_xfa.pdf output f941_dropped_xfa_uncompressed.pdf uncompress
*
*/
//require_once( '../../../../other/forge_fdf.php' );
//$ffdf = new ForgeFDF();
//
////Dump PDF form field names: pdftk classes/GovernmentForms/country/us/templates/941.orig.pdf dump_data_fields
//
//$pdf_form_url = "http://demo.timetrex.com/classes/GovernmentForms/country/us/941.pdf";
//$fdf_data_strings = [ 'topmostSubform[0].Page1[0].Header[0].EntityArea[0].f1_01[0]' => 'z2z' ];
//
////var_dump( $ffdf->forge_fdf( $pdf_form_url, $fdf_data_strings, $fdf_data_names, $fields_hidden, $fields_readonly ) );
//file_put_contents( '941.fdf', $ffdf->forge_fdf( $pdf_form_url, $fdf_data_strings, [], [], [] ) );
//Alternative method, but still doesn't work with IRS PDFs.
require_once( '../../../../fpdm/fpdm.php' );
$fields = array(
'f1_1[0]' => '12',
'f1_2[0]' => '34567',
//'f1_3[0]' => '3',
//'f1_4[0]' => '4',
//'f1_5[0]' => 'f1_5',
//'f1_6[0]' => 'f1_6',
//'f1_7[0]' => 'f1_7',
//'f1_8[0]' => 'f1_8',
//'f1_9[0]' => 'f1_9',
//'f1_10[0]' => 'f1_10',
//'april_cb' => true,
'c1_1[1]' => true,
'c1_1[2]' => true,
//'f1_13[0]' => '1234',
//'f1_14[0]' => '99',
);
$pdf = new FPDM('f941b.pdf');
$pdf->useCheckboxParser = true; //IMPORTANT: This must be enabled.
//$pdf->verbose = true;
//$pdf->verbose_level = 1;
$pdf->Load($fields, false); // second parameter: false if field values are in ISO-8859-1, true if UTF-8
$pdf->Merge();
//$data = $pdf->Output( '/tmp/', 'test.pdf' );
$data = $pdf->Output( 'S' );
file_put_contents('test.pdf', $data );
?>

View File

@ -0,0 +1,122 @@
<?php
require_once( '../../../../../includes/global.inc.php' );
require_once( '../../../../GovernmentForms/GovernmentForms.class.php' );
$gf = new GovernmentForms();
$f941sb_obj = $gf->getFormObject( '941sb', 'US' );
$f941sb_obj->setDebug(FALSE);
$f941sb_obj->setShowBackground(TRUE);
$f941sb_obj->year = 2009;
$f941sb_obj->ein = '12-3456789';
$f941sb_obj->name = 'John Doe';
$f941sb_obj->trade_name = 'ABC Company';
$f941sb_obj->address = '#1232 Main St';
$f941sb_obj->city = 'New York';
$f941sb_obj->state = 'NY';
$f941sb_obj->zip_code = '12345';
$f941sb_obj->quarter = array(1,2,3,4);
$f941sb_obj->month1 = array(
1 => 9999.99,
2 => 9999.99,
3 => 9999.99,
4 => 9999.99,
5 => 9999.99,
6 => 9999.99,
7 => 9999.99,
8 => 9999.99,
9 => 9999.99,
10 => 9999.99,
11 => 9999.99,
12 => 9999.99,
13 => 9999.99,
14 => 9999.99,
15 => 9999.99,
16 => 9999.99,
17 => 9999.99,
18 => 9999.99,
19 => 9999.99,
20 => 9999.99,
21 => 9999.99,
22 => 9999.99,
23 => 9999.99,
24 => 9999.99,
25 => 9999.99,
26 => 9999.99,
27 => 9999.99,
28 => 9999.99,
29 => 9999.99,
30 => 9999.99,
31 => 9999.99,
);
$f941sb_obj->month2 = array(
1 => 9999.99,
2 => 9999.99,
3 => 9999.99,
4 => 9999.99,
5 => 9999.99,
6 => 9999.99,
7 => 9999.99,
8 => 9999.99,
9 => 9999.99,
10 => 9999.99,
11 => 9999.99,
12 => 9999.99,
13 => 9999.99,
14 => 9999.99,
15 => 9999.99,
16 => 9999.99,
17 => 9999.99,
18 => 9999.99,
19 => 9999.99,
20 => 9999.99,
21 => 9999.99,
22 => 9999.99,
23 => 9999.99,
24 => 9999.99,
25 => 9999.99,
26 => 9999.99,
27 => 9999.99,
28 => 9999.99,
29 => 9999.99,
30 => 9999.99,
31 => 9999.99,
);
$f941sb_obj->month3 = array(
1 => 9999.99,
2 => 9999.99,
3 => 9999.99,
4 => 9999.99,
5 => 9999.99,
6 => 9999.99,
7 => 9999.99,
8 => 9999.99,
9 => 9999.99,
10 => 9999.99,
11 => 9999.99,
12 => 9999.99,
13 => 9999.99,
14 => 9999.99,
15 => 9999.99,
16 => 9999.99,
17 => 9999.99,
18 => 9999.99,
19 => 9999.99,
20 => 9999.99,
21 => 9999.99,
22 => 9999.99,
23 => 9999.99,
24 => 9999.99,
25 => 9999.99,
26 => 9999.99,
27 => 9999.99,
28 => 9999.99,
29 => 9999.99,
30 => 9999.99,
31 => 9999.99,
);
$gf->addForm( $f941sb_obj );
$output = $gf->output( 'PDF' );
file_put_contents( '941sb.pdf', $output );
?>

View File

@ -0,0 +1,34 @@
<?php
require_once( '../../../../../includes/global.inc.php' );
require_once( '../../../../GovernmentForms/GovernmentForms.class.php' );
$gf = new GovernmentForms();
$f941worksheet1_obj = $gf->getFormObject( '941worksheet1', 'US' );
$f941worksheet1_obj->setDebug( TRUE);
$f941worksheet1_obj->setShowBackground( TRUE);
$f941worksheet1_obj->year = 2021;
$f941worksheet1_obj->l1a = 9999.99;
$f941worksheet1_obj->l1b = 9999.98;
$f941worksheet1_obj->l1e = 1999.97;
$f941worksheet1_obj->l1g = 2999.96;
$f941worksheet1_obj->l1i = 1999.95;
$f941worksheet1_obj->l1j = 2999.94;
$f941worksheet1_obj->l1ji = 1999.93;
$f941worksheet1_obj->l2a = 9999.92;
$f941worksheet1_obj->l2ai = 9999.91;
$f941worksheet1_obj->l2aiii = 9999.89;
$f941worksheet1_obj->l2b = 9999.88;
$f941worksheet1_obj->l2e = 9999.87;
$f941worksheet1_obj->l2ei = 9999.86;
$f941worksheet1_obj->l2eiii = 9999.85;
$f941worksheet1_obj->l2f = 9999.84;
$gf->addForm( $f941worksheet1_obj );
$output = $gf->output( 'PDF' );
file_put_contents( '941worksheet1.pdf', $output );
?>

View File

@ -0,0 +1,31 @@
<?php
require_once( '../../../../../includes/global.inc.php' );
require_once( '../../../../GovernmentForms/GovernmentForms.class.php' );
$gf = new GovernmentForms();
$f941worksheet2_obj = $gf->getFormObject( '941worksheet2', 'US' );
$f941worksheet2_obj->setDebug( TRUE);
$f941worksheet2_obj->setShowBackground( TRUE);
$f941worksheet2_obj->year = 2021;
$f941worksheet2_obj->l1a = 9999.99;
$f941worksheet2_obj->l1b = 9999.98;
$f941worksheet2_obj->l1c = 9999.97;
$f941worksheet2_obj->l1f = 9999.96;
$f941worksheet2_obj->l1h = 9999.95;
$f941worksheet2_obj->l1j = 9999.94;
$f941worksheet2_obj->l1k = 9999.93;
$f941worksheet2_obj->l1l = 9999.92;
$f941worksheet2_obj->l2a = 9999.91;
$f941worksheet2_obj->l2b = 9999.89;
$f941worksheet2_obj->l2e = 9999.88;
$f941worksheet2_obj->l2f = 9999.87;
$gf->addForm( $f941worksheet2_obj );
$output = $gf->output( 'PDF' );
file_put_contents( '941worksheet2.pdf', $output );
?>

View File

@ -0,0 +1,35 @@
<?php
require_once( '../../../../../includes/global.inc.php' );
require_once( '../../../../GovernmentForms/GovernmentForms.class.php' );
$gf = new GovernmentForms();
$f941worksheet3_obj = $gf->getFormObject( '941worksheet3', 'US' );
$f941worksheet3_obj->setDebug( TRUE);
$f941worksheet3_obj->setShowBackground( TRUE);
$f941worksheet3_obj->year = 2021;
$f941worksheet3_obj->l1a = 90000.01;
$f941worksheet3_obj->l1c = 500.02;
$f941worksheet3_obj->l1e = 50.03;
$f941worksheet3_obj->l2a = 9999.99;
$f941worksheet3_obj->l2ai = 9999.89;
$f941worksheet3_obj->l2aiii = 9999.79;
$f941worksheet3_obj->l2b = 9999.98;
$f941worksheet3_obj->l2c = 9999.97;
$f941worksheet3_obj->l2g = 9999.96;
$f941worksheet3_obj->l2gi = 9999.86;
$f941worksheet3_obj->l2giii = 9999.76;
$f941worksheet3_obj->l2h = 9999.95;
$f941worksheet3_obj->l2i = 9999.94;
$f941worksheet3_obj->l2n = 9999.93;
$f941worksheet3_obj->l2o = 9999.92;
$gf->addForm( $f941worksheet3_obj );
$output = $gf->output( 'PDF' );
file_put_contents( '941worksheet3.pdf', $output );
?>

View File

@ -0,0 +1,25 @@
<?php
require_once( '../../../../../includes/global.inc.php' );
require_once( '../../../../GovernmentForms/GovernmentForms.class.php' );
$gf = new GovernmentForms();
$f941worksheet4_obj = $gf->getFormObject( '941worksheet4', 'US' );
$f941worksheet4_obj->setDebug( TRUE);
$f941worksheet4_obj->setShowBackground( TRUE);
$f941worksheet4_obj->year = 2021;
$f941worksheet4_obj->l1a = 9999.99;
$f941worksheet4_obj->l1b = 9999.98;
$f941worksheet4_obj->l1d = 9999.97;
$f941worksheet4_obj->l1f = 9999.96;
$f941worksheet4_obj->l2a = 9999.95;
$f941worksheet4_obj->l2b = 9999.94;
$f941worksheet4_obj->l2f = 9999.93;
$gf->addForm( $f941worksheet4_obj );
$output = $gf->output( 'PDF' );
file_put_contents( '941worksheet4.pdf', $output );
?>

View File

@ -0,0 +1,25 @@
<?php
require_once( '../../../../../includes/global.inc.php' );
require_once( '../../../../GovernmentForms/GovernmentForms.class.php' );
$gf = new GovernmentForms();
$f941worksheet5_obj = $gf->getFormObject( '941worksheet5', 'US' );
$f941worksheet5_obj->setDebug( TRUE);
$f941worksheet5_obj->setShowBackground( TRUE);
$f941worksheet5_obj->year = 2021;
$f941worksheet5_obj->l1a = 9999.99;
$f941worksheet5_obj->l1b = 9999.98;
$f941worksheet5_obj->l1d = 2999.97;
$f941worksheet5_obj->l1f = 9999.96;
$f941worksheet5_obj->l2a = 9999.95;
$f941worksheet5_obj->l2c = 1999.94;
$f941worksheet5_obj->l2d = 2999.93;
$gf->addForm( $f941worksheet5_obj );
$output = $gf->output( 'PDF' );
file_put_contents( '941worksheet5.pdf', $output );
?>

View File

@ -0,0 +1,249 @@
<?php
require_once( '../../../../../includes/global.inc.php' );
require_once( '../../../../GovernmentForms/GovernmentForms.class.php' );
$gf = new GovernmentForms();
$return1040 = $gf->getFormObject( 'RETURN1040', 'US' );
$return1040->return_created_timestamp = '2001-12-17T09:30:47Z';
$return1040->year = '1000';
$return1040->tax_period_begin_date = '1967-08-13';
$return1040->tax_period_end_date = '1967-08-13';
$return1040->software_id = '00000000';
$return1040->originator_efin = '000000';
$return1040->originator_type_code = 'FinancialAgent';
$return1040->pin_type_code = 'Practitioner';
$return1040->jurat_disclosure_code = 'Practitioner PIN';
$return1040->pin_entered_by = 'Taxpayer';
$return1040->signature_date = '1967-08-13';
$return1040->return_type = '1040A';
$return1040->ssn = '000000000';
$return1040->name = 'A#';
$return1040->name_control = 'A';
$return1040->address1 = '0';
$return1040->city = 'A';
$return1040->state = 'SC';
$return1040->zip_code = '00000';
$return1040->ip_address = '0.0.0.0';
$return1040->ip_date = '1967-08-13';
$return1040->ip_time = '00:00:00';
$return1040->timezone = 'HS';
$gf->addForm( $return1040 );
$fw2_obj = $gf->getFormObject( 'w2', 'US' );
$fw2_obj->setType( 'government' );
//$fw2_obj->setType( 'employee' );
$fw2_obj->setDebug( false );
$fw2_obj->setShowBackground( true );
$fw2_obj->year = 2011;
$fw2_obj->ein = '12-3456789';
$fw2_obj->trade_name = 'ABC Company';
$fw2_obj->company_address1 = '#1232 Main St';
$fw2_obj->company_address2 = '123 #Suite';
$fw2_obj->company_city = 'New York';
$fw2_obj->company_state = 'NY';
$fw2_obj->company_zip_code = '12345';
/*
$ee_data = array(
'ssn' => '123 456 789',
'address1' => '#1232 Main St',
'address2' => 'Suite 123',
'city' => 'New York',
'state' => 'NY',
'zip_code' => '12345',
//'control_number' => '0001',
'first_name' => 'john',
'middle_name' => 'george',
'last_name' => 'doe',
'l1' => 223456.99,
'l2' => 223456.99,
'l3' => 223456.99,
'l4' => 223456.99,
'l5' => 223456.99,
'l6' => 223456.99,
'l7' => 223456.99,
'l8' => 223456.99,
'l10' => 223456.99,
'l11' => 223456.99,
'l12a_code' => 1,
'l12a' => 223456.99,
'l12b_code' => 2,
'l12b' => 223456.99,
'l12c_code' => 3,
'l12c' => 223456.99,
'l12d_code' => 4,
'l12d' => 223456.99,
'l13a' => TRUE,
'l13b' => TRUE,
'l13c' => TRUE,
'l14a_name' => 'Test1',
'l14a' => 23.55,
'l14b_name' => 'Test2',
'l14b' => 34.56,
'l14c_name' => 'Test3',
'l14c' => 23.57,
'l14d_name' => 'Test4',
'l14d' => 67.58,
'l15a_state' => 'NY',
'l15a_state_id' => '987654321',
'l16a' => '123456789.99',
'l17a' => '123456789.99',
'l18a' => '123456789.99',
'l19a' => '123456789.99',
'l20a' => '123456789.99',
'l15b_state' => 'NY',
'l15b_state_id' => '987654321',
'l16b' => '123456789.99',
'l17b' => '123456789.99',
'l18b' => '123456789.99',
'l19b' => '123456789.99',
'l20b' => '123456789.99',
);
$fw2_obj->addRecord( $ee_data );
$ee_data = array(
'ssn' => '123 456 789',
'address1' => '#1232 Main St',
'address2' => 'Suite 123',
'city' => 'New York',
'state' => 'NY',
'zip_code' => '12345',
//'control_number' => '0001',
'first_name' => 'jane',
'middle_name' => 'george',
'last_name' => 'doe',
'l1' => 223456.99,
'l2' => 223456.99,
'l3' => 223456.99,
'l4' => 223456.99,
'l5' => 223456.99,
'l6' => 223456.99,
'l7' => 223456.99,
'l8' => 223456.99,
'l10' => 223456.99,
'l11' => 223456.99,
'l12a_code' => 1,
'l12a' => 223456.99,
'l12b_code' => 2,
'l12b' => 223456.99,
'l12c_code' => 3,
'l12c' => 223456.99,
'l12d_code' => 4,
'l12d' => 223456.99,
'l13a' => TRUE,
'l13b' => TRUE,
'l13c' => TRUE,
'l14a_name' => 'Test1',
'l14a' => 12345.55,
'l14b_name' => 'Test2',
'l14b' => 12345.56,
'l14c_name' => 'Test3',
'l14c' => 12345.57,
'l14d_name' => 'Test4',
'l14d' => 12345.58,
'l15a_state' => 'NY',
'l15a_state_id' => '987654321',
'l16a' => '123456789.99',
'l17a' => '123456789.99',
'l18a' => '123456789.99',
'l19a' => '123456789.99',
'l20a' => '123456789.99',
'l15b_state' => 'NY',
'l15b_state_id' => '987654321',
'l16b' => '123456789.99',
'l17b' => '123456789.99',
'l18b' => '123456789.99',
'l19b' => '123456789.99',
'l20b' => '123456789.99',
);
$fw2_obj->addRecord( $ee_data );
*/
$ee_data = [
'ssn' => '123 456 789',
'address1' => '#1232 Main St',
'address2' => 'Suite #123',
'city' => 'New York',
'state' => 'NY',
'zip_code' => '12345',
//'control_number' => '0001',
'first_name' => 'George',
'middle_name' => 'george',
'last_name' => 'doe',
//'l1' => -223456.123213,
//'l2' => -223456,
//'l3' => 223456.99,
'l4' => 223456.99,
'l5' => 223456.99,
'l6' => 223456.99,
'l7' => 223456.99,
'l8' => 223456.99,
'l10' => 223456.99,
'l11' => 223456.99,
'l12a_code' => 'A',
'l12a' => 223456.99,
'l12b_code' => 'B',
'l12b' => 223456.99,
'l12c_code' => 'C',
'l12c' => 223456.99,
'l12d_code' => 'D',
'l12d' => 223456.99,
'l13a' => true,
'l13b' => true,
'l13c' => true,
'l14a_name' => 'Test1',
'l14a' => 3.55,
'l14b_name' => 'Test2',
'l14b' => 55.56,
'l14c_name' => 'Test3',
'l14c' => 1253345.57,
'l14d_name' => 'Test4',
'l14d' => 13.58,
'l15a_state' => 'NY',
'l15a_state_id' => '987654321',
'l16a' => '123456789.99',
'l17a' => '123456789.99',
'l18a' => '123456789.99',
'l19a' => '123456789.99',
'l20a' => '123456789.99',
'l15b_state' => 'NY',
'l15b_state_id' => '435',
'l16b' => '45',
'l17b' => '435.99',
'l18b' => '345.99',
'l19b' => '123434556789.99',
'l20b' => '12334456789.99',
];
$fw2_obj->addRecord( $ee_data );
$gf->addForm( $fw2_obj );
$output = $gf->output( 'xml' );
//file_put_contents( '/tmp/w2.pdf', $output );
file_put_contents( 'w2.xml', $output );
?>

View File

@ -0,0 +1,232 @@
<?php
require_once( '../../../../../includes/global.inc.php' );
require_once( '../../../../GovernmentForms/GovernmentForms.class.php' );
$gf = new GovernmentForms();
$gf->tcpdf_dir = '../tcpdf';
$gf->fpdi_dir = '../fpdi';
//$return1040 = $gf->getFormObject( 'RETURN1040', 'US' );
//$return1040->return_created_timestamp = '2001-12-17T09:30:47Z';
//$return1040->year = '1000';
//$return1040->tax_period_begin_date = '1967-08-13';
//$return1040->tax_period_end_date = '1967-08-13';
//$return1040->software_id = '00000000';
//$return1040->originator_efin = '000000';
//$return1040->originator_type_code = 'FinancialAgent';
//$return1040->pin_type_code = 'Practitioner';
//$return1040->jurat_disclosure_code = 'Practitioner PIN';
//$return1040->pin_entered_by = 'Taxpayer';
//$return1040->signature_date = '1967-08-13';
//$return1040->return_type = '1040A';
//$return1040->ssn = '000000000';
//$return1040->name = 'A#';
//$return1040->name_control = 'A';
//$return1040->address1 = '0';
//$return1040->city = 'A';
//$return1040->state = 'SC';
//$return1040->zip_code = '00000';
//$return1040->ip_address = '0.0.0.0';
//$return1040->ip_date = '1967-08-13';
//$return1040->ip_time = '00:00:00';
//$return1040->timezone = 'HS';
//
//$gf->addForm( $return1040 );
$fw2c_obj = $gf->getFormObject( 'w2c', 'US' );
$fw2c_obj->setDebug( true );
$fw2c_obj->setShowBackground( true );
$fw2c_obj->setType( 'government' );
$fw2c_obj->year = 2011;
$fw2c_obj->ein = '123456789';
$fw2c_obj->trade_name = 'ABC Company';
$fw2c_obj->company_address1 = '#1232 Main St';
$fw2c_obj->company_address2 = '123 #Suite';
$fw2c_obj->company_city = 'New York';
$fw2c_obj->company_state = 'NY';
$fw2c_obj->company_zip_code = '12345';
$fw2_obj = $gf->getFormObject( 'w2', 'US' );
$fw2_obj->setType( 'government' );
//$fw2_obj->setType( 'employee' );
$fw2_obj->setDebug( true );
$fw2_obj->setShowBackground( true );
$fw2_obj->year = 2011;
$fw2_obj->ein = '123456789';
$fw2_obj->trade_name = 'ABC Company';
$fw2_obj->company_address1 = '#1232 Main St';
$fw2_obj->company_address2 = '123 #Suite';
$fw2_obj->company_city = 'New York';
$fw2_obj->company_state = 'NY';
$fw2_obj->company_zip_code = '12345';
$ee_data = [
'user_id' => '12345', //Used to match other records on, UUID that will never change?
'ssn' => '287654321',
//'ssn' => '187654321',
'address1' => '#1232 Main St',
'address2' => 'Suite #123',
'city' => 'New York',
'state' => 'NY',
'zip_code' => '12345',
'first_name' => 'John',
'middle_name' => 'Middle',
'last_name' => 'Doe',
'l1' => 223457.00,
'l2' => 223456.99,
'l3' => 2234.98,
'l4' => 2234.97,
'l5' => 223456.96,
'l6' => 2234.95,
'l7' => 223456.94,
'l8' => 223456.93,
'l10' => 223456.92,
'l11' => 223456.91,
'l12a_code' => 'A2',
'l12a' => 223456.90,
'l12b_code' => 'B2',
'l12b' => 223456.89,
'l12c_code' => 'C2',
'l12c' => 223456.88,
'l12d_code' => 'D2',
'l12d' => 223456.87,
'l13a' => false,
'l13b' => true,
'l13c' => false,
'l14a_name' => 'Test1b',
'l14a' => 23.55,
'l14b_name' => 'Test2b',
'l14b' => 255.56,
'l14c_name' => 'Test3b',
'l14c' => 2253345.57,
'l14d_name' => 'Test4b',
'l14d' => 213.58,
'l15a_state' => 'NYa',
'l15a_state_id' => '287654321',
'l16a' => '223456789.99',
'l17a' => '223456789.99',
'l18a' => '223456789.99',
'l19a' => '223456789.99',
'l20a' => '223456789.99',
'l20a_district' => 'YONKERSb',
'l15b_state' => 'NYb',
'l15b_state_id' => '2435',
'l16b' => '245',
'l17b' => '2435.99',
'l18b' => '2345.99',
'l19b' => '223434556789.99',
'l20b' => '22334456789.99',
'l20b_district' => 'YONKERSb',
];
$fw2_obj->addRecord( $ee_data );
$fw2_prev_obj = $gf->getFormObject( 'w2', 'US' );
$fw2_prev_obj->setType( 'government' );
//$fw2_obj->setType( 'employee' );
$fw2_prev_obj->setDebug( true );
$fw2_prev_obj->setShowBackground( true );
$fw2_prev_obj->year = 2011;
$fw2_prev_obj->ein = '123456789';
$fw2_prev_obj->trade_name = 'ABC Company';
$fw2_prev_obj->company_address1 = '#1232 Main St';
$fw2_prev_obj->company_address2 = '123 #Suite';
$fw2_prev_obj->company_city = 'New York';
$fw2_prev_obj->company_state = 'NY';
$fw2_prev_obj->company_zip_code = '12345';
$ee_data = [
'user_id' => '12345', //Used to match other records on, UUID that will never change?
'ssn' => '187654321',
'address1' => '#1232 Main St',
'address2' => 'Suite #123',
'city' => 'New York',
'state' => 'NY',
'zip_code' => '12345',
'first_name' => 'John',
'middle_name' => 'Middle',
'last_name' => 'Doe',
'first_name' => 'Prev John',
'middle_name' => 'Prev Mid',
'last_name' => 'Prev Doe',
'l1' => 123457.00,
'l2' => 123456.99,
'l3' => 1234.98,
'l4' => 1234.97,
'l5' => 123456.96,
'l6' => 1234.95,
'l7' => 123456.94,
'l8' => 123456.93,
'l10' => 123456.92,
'l11' => 123456.91,
'l12a_code' => 'A1',
'l12a' => 123456.90,
'l12b_code' => 'B1',
'l12b' => 123456.89,
'l12c_code' => 'C1',
'l12c' => 123456.88,
'l12d_code' => 'D1',
'l12d' => 123456.87,
'l13a' => true,
'l13b' => false,
'l13c' => true,
'l14a_name' => 'Test1a',
'l14a' => 13.55,
'l14b_name' => 'Test2a',
'l14b' => 155.56,
'l14c_name' => 'Test3a',
'l14c' => 1253345.57,
'l14d_name' => 'Test4a',
'l14d' => 113.58,
'l15a_state' => 'NY',
'l15a_state_id' => '187654321',
'l16a' => '123456789.99',
'l17a' => '123456789.99',
'l18a' => '123456789.99',
'l19a' => '123456789.99',
'l20a' => '123456789.99',
'l20a_district' => 'YONKERSa',
'l15b_state' => 'NY',
'l15b_state_id' => '1435',
'l16b' => '145',
'l17b' => '1435.99',
'l18b' => '1345.99',
'l19b' => '123434556789.99',
'l20b' => '12334456789.99',
'l20b_district' => 'YONKERSa',
];
$fw2_prev_obj->addRecord( $ee_data );
//Consider two objects, $fw2_obj and $fw2_prev_obj, that each have 10 employee records.
//They then need to be merged with renamed keys, and converted into w2c records.
// Standard line numbers and such will always be the "Correct" version of the W2.
$fw2c_obj->mergeCorrectAndPreviousW2Objects( $fw2_obj, $fw2_prev_obj );
$gf->addForm( $fw2c_obj );
$output = $gf->output( 'pdf' );
file_put_contents( '/tmp/w2.pdf', $output );
//file_put_contents( 'w2.xml', $output );
?>