How to add the employee id number to the pdf paystub

Discussion for TimeTrex open source community developers.
Locked
sgrizzard
Posts: 3
Joined: Thu Nov 29, 2007 5:11 pm
Location: Los Angeles, CA
Contact:

How to add the employee id number to the pdf paystub

Post by sgrizzard »

I had to add the employee id number (the one assigned by the hr department) to the pdf paystub. I hope this helps if you need to do it.

Edition: Standard Edition
Version: 2.2.8

The goal is to put the employee number on the pay stub below the Net Pay, and above the Identification #, in the same font as the Identification #.

edit the file /classes/modules/pay_stub/PayStubFactory.class.php

Head to the bottom of the getPayStub function. On or about line 2925, you should see:

Code: Select all

$pdf->SetFont('','',8);
$pdf->setXY( Misc::AdjustXY(125, $adjust_x), Misc::AdjustXY($block_adjust_y+30, $adjust_y) );
$pdf->Cell(50, 5, TTi18n::gettext('Identification #:').' '. str_pad($pay_stub_obj->getId(),12,0, STR_PAD_LEFT).$tainted_flag, $border, 1, 'L', 0);
unset($net_pay_amount, $tainted_flag);
This code adds the Identification Number to the paystub. Change to the following:

Code: Select all

$pdf->SetFont('','',8);
$pdf->setXY( Misc::AdjustXY(125, $adjust_x), Misc::AdjustXY($block_adjust_y+27, $adjust_y) );
$pdf->Cell(50, 5, TTi18n::gettext('Employee ID') . ': ' . $user_obj->getEmployeeNumber(), $border, 1, 'L', 0);
$pdf->setXY( Misc::AdjustXY(125, $adjust_x), Misc::AdjustXY($block_adjust_y+30, $adjust_y) );
$pdf->Cell(50, 5, TTi18n::gettext('Identification #:').' '. str_pad($pay_stub_obj->getId(),12,0, STR_PAD_LEFT).$tainted_flag, $border, 1, 'L', 0);
unset($net_pay_amount, $tainted_flag);
The two additional lines add a cell at the specified location above the Identification #, and insert the Employee ID.
Locked