Deductions Sort Order

Discussion for TimeTrex open source community developers.
Locked
Yajasi
Posts: 108
Joined: Wed Oct 17, 2012 4:48 pm

Deductions Sort Order

Post by Yajasi »

Hello, I hope this is helpful to others. Our setup is: Ubuntu 12.04 LAMP, TimeTrex 5.0.x.

The deductions are being sorted on the Pay Stub in reverse order. Items that were listed first in the Pay Stub Account List were listed last in the Deductions section of the Pay Stub. Our company prefers to have them sorted in the order they are listed in the Account List.

To reverse the sort order, edit the file /classes/modules/pay_stub/PayStubFactory.class.php. The Deductions section is approximately line 2957. Scroll down to about line 2993 and you will see a comment stating "Start with the right side." Change the values for $tmp_adjust_x to the following.

Code: Select all

//Start with the right side.  No, no - start with the LEFT.
if ( $x < floor($max_deductions / 2) ) {
	$tmp_adjust_x = 0;
} else {
	if ( $tmp_block_adjust_y != 0 ) {
		$block_adjust_y = $tmp_block_adjust_y;
		$tmp_block_adjust_y = 0;
	}
	$tmp_adjust_x = 90;
}
Note that the first instance of $tmp_adjust_x was changed to 0 and the second instance changed to 90.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: Deductions Sort Order

Post by shaunw »

I wouldn't recommend this, if you start with the left side it makes the pay stubs look funny when there are only a few deductions, as they won't be lined up anymore.
Yajasi
Posts: 108
Joined: Wed Oct 17, 2012 4:48 pm

Re: Deductions Sort Order

Post by Yajasi »

Thanks for the caution. We always have 3 or more deductions, so it works really nice for us.
Locked