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.
add a new type of PayStub Entry Account
Re: add a new type of PayStub Entry Account
Unfortunately I don't understand your message.
PayStubEntryFactory.class.php does not have a _getFactoryOptions() method.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.
Re: add a new type of PayStub Entry Account
my mistake, the file is PayStubEntryAccountFactory.class.php
and then in EditCompanyDeduction.php line 342
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
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'),
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
Re: add a new type of PayStub Entry Account
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.
Re: add a new type of PayStub Entry Account
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