add a new type of PayStub Entry Account

Discussion for TimeTrex open source community developers.
Locked
Soujiro
Posts: 8
Joined: Fri Dec 30, 2011 8:05 am

add a new type of PayStub Entry Account

Post by Soujiro »

I need to add a new type of paystub entry account only for record pourposes, thats because in my country when a employe has a variable month wage (salary and comissions) the last 3 "imponible wage" are used as base to calculate the social discount when he has injury time, this "imponible wage" need to be calculated every month because has a max amount that varies every month.

Example:

1st month
Salary: 400.000
Comission: 0
Imponible Wage: 400.000

2nd month
Salary: 400.000
Comission: 1.000.000
Imponible Wage: 1.254.346 (limit)

3nd month
Salary: 400.000
Comission: 1.500.000
Imponible Wage: 1.312.214 (limit)


4 month (injury time)
Imponible wage = (400.000+1.254.346+1.312.214)/3 = 988.853

The imponible wage is not a discount or earning but is the base to calculate the legal discounts.

I already found that the types of entry are defined in PayStubEntryFactory.class.php in the _getFactoryOptions method, my questions is what other files are needed to modify to add the new type of entry and how type_calculation_order array works.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: add a new type of PayStub Entry Account

Post by shaunw »

Unfortunately I don't understand your message.
I already found that the types of entry are defined in PayStubEntryFactory.class.php in the _getFactoryOptions method, my questions is what other files are needed to modify to add the new type of entry and how type_calculation_order array works.
PayStubEntryFactory.class.php does not have a _getFactoryOptions() method.
Soujiro
Posts: 8
Joined: Fri Dec 30, 2011 8:05 am

Re: add a new type of PayStub Entry Account

Post by Soujiro »

my mistake, the file is PayStubEntryAccountFactory.class.php

Code: Select all

case 'type':
	$retval = array(
				10 => TTi18n::gettext('Earning'),
				15 => TTi18n::gettext('Imponible'),   // i added this
				20 => TTi18n::gettext('Employee Deduction'),
				30 => TTi18n::gettext('Employer Deduction'),
				40 => TTi18n::gettext('Total'),
				50 => TTi18n::gettext('Accrual'),
and then in EditCompanyDeduction.php line 342

Code: Select all

		$data['pay_stub_entry_account_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray( $current_company->getId(), 10, array(10,15,20,30,50), FALSE );   //i edited the array
		//$data['pay_stub_entry_account_options'] = PayStubEntryAccountListFactory::getByCompanyIdAndStatusIdAndTypeIdArray( $current_company->getId(), 10, array(20,30), FALSE );

		$data['include_pay_stub_entry_account_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray( $current_company->getId(), 10, array(10,15,20,30,40,50), FALSE ); //i edited the array
		if ( isset($data['include_pay_stub_entry_account_ids']) AND is_array($data['include_pay_stub_entry_account_ids']) ) {
			$tmp_psea_options = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray( $current_company->getId(), 10, array(10,15,20,30,40,50), FALSE );//i edited the array
Then i added the pay stub account "imponible" of type "imponible", after the total gross acount and before the first employe discount. Make a "other" deduction based on the total gross wage and then a discount based on imponible. The systems seems to be working fine and the "imponible" is stored in the database with no problems
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: add a new type of PayStub Entry Account

Post by shaunw »

I don't understand why a new pay stub account type is needed, the Employer Deduction type would typically be used for this, then you would just create a "Employer Deduction - Imponible" pay stub account to track same information.
Soujiro
Posts: 8
Joined: Fri Dec 30, 2011 8:05 am

Re: add a new type of PayStub Entry Account

Post by Soujiro »

it's because technically it's not a employer deduction but it seems better to modify the paystub pdf than add a new type of account
Locked