function getPayStubEntryAccountObject() { if (is_object($this->pay_stub_entry_account_obj)) { return $this->pay_stub_entry_account_obj; } else { $psealf = new PayStubEntryAccountListFactory(); $psealf->getByID($this->getPayStubEntryNameID()); if ($psealf->getRecordCount() > 0) { $this->pay_stub_entry_account_obj = $psealf->getCurrent(); return $this->pay_stub_entry_account_obj; } return FALSE; } }
static function getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, $type_id, $name) { $psealf = new PayStubEntryAccountListFactory(); $psealf->getByCompanyIdAndTypeAndFuzzyName($company_id, $type_id, $name); if ($psealf->getRecordCount() > 0) { return $psealf->getCurrent()->getId(); } return FALSE; }
static function releaseAllAccruals($user_id, $effective_date = NULL) { Debug::Text('Release 100% of all accruals!', __FILE__, __LINE__, __METHOD__, 10); if ($user_id == '') { return FALSE; } if ($effective_date == '') { $effective_date = TTDate::getTime(); } Debug::Text('Effective Date: ' . TTDate::getDate('DATE+TIME', $effective_date), __FILE__, __LINE__, __METHOD__, 10); $ulf = new UserListFactory(); $ulf->getById($user_id); if ($ulf->getRecordCount() > 0) { $user_obj = $ulf->getCurrent(); } else { return FALSE; } //Get all PSE acccount accruals $psealf = new PayStubEntryAccountListFactory(); $psealf->getByCompanyIdAndStatusIdAndTypeId($user_obj->getCompany(), 10, 50); if ($psealf->getRecordCount() > 0) { $ulf->StartTransaction(); foreach ($psealf as $psea_obj) { //Get PSE account that affects this accrual. $psealf_tmp = new PayStubEntryAccountListFactory(); $psealf_tmp->getByCompanyIdAndAccrualId($user_obj->getCompany(), $psea_obj->getId()); if ($psealf_tmp->getRecordCount() > 0) { $release_account_id = $psealf_tmp->getCurrent()->getId(); $psaf = new PayStubAmendmentFactory(); $psaf->setStatus(50); //Active $psaf->setType(20); //Percent $psaf->setUser($user_obj->getId()); $psaf->setPayStubEntryNameId($release_account_id); $psaf->setPercentAmount(100); $psaf->setPercentAmountEntryNameId($psea_obj->getId()); $psaf->setEffectiveDate($effective_date); $psaf->setDescription('Release Accrual Balance'); if ($psaf->isValid()) { Debug::Text('Release Accrual Is Valid!!: ', __FILE__, __LINE__, __METHOD__, 10); $psaf->Save(); } } else { Debug::Text('No Release Account for this Accrual!!', __FILE__, __LINE__, __METHOD__, 10); } } //$ulf->FailTransaction(); $ulf->CommitTransaction(); } else { Debug::Text('No Accruals to release...', __FILE__, __LINE__, __METHOD__, 10); } return FALSE; }
function setAccrual($id) { $id = trim($id); Debug::Text('ID: ' . $id, __FILE__, __LINE__, __METHOD__, 10); $psealf = new PayStubEntryAccountListFactory(); $psealf->getByID($id); if ($psealf->getRecordCount() > 0) { if ($psealf->getCurrent()->getType() != 50) { //Reset Result set so an error occurs. $psealf = new PayStubEntryAccountListFactory(); } } if ($id == '' or $id == 0 or $this->Validator->isResultSetWithRows('accrual_pay_stub_entry_account_id', $psealf, TTi18n::gettext('Accrual account is invalid'))) { $this->data['accrual_pay_stub_entry_account_id'] = $id; return TRUE; } return FALSE; }
$ulf->getByUserName($mapped_row['user_name']); } if ($ulf->getRecordCount() == 1) { $u_obj = $ulf->getCurrent(); $psaf->setUser($u_obj->getId()); if (isset($mapped_row['status_id']) and $mapped_row['status_id'] != '') { $psaf->setStatus(Misc::importCallInputParseFunction('status_id', $mapped_row['status_id'], $filtered_import_map['status_id']['default_value'], $filtered_import_map['status_id']['parse_hint'])); } if (isset($mapped_row['type_id']) and $mapped_row['type_id'] != '') { $psaf->setType(Misc::importCallInputParseFunction('type_id', $mapped_row['type_id'], $filtered_import_map['type_id']['default_value'], $filtered_import_map['type_id']['parse_hint'])); } if (isset($mapped_row['pay_stub_account']) and $mapped_row['pay_stub_account'] != '') { $psealf = new PayStubEntryAccountListFactory(); $psealf->getByCompanyIdAndTypeAndFuzzyName($ulf->getCurrent()->getCompany(), array(10, 20, 30, 50, 60, 65), $mapped_row['pay_stub_account']); if ($psealf->getRecordCount() > 0) { $psaf->setPayStubEntryNameId(Misc::importCallInputParseFunction('pay_stub_account', $psealf->getCurrent()->getId(), $filtered_import_map['pay_stub_account']['default_value'], $filtered_import_map['pay_stub_account']['parse_hint'])); } else { $psaf->setPayStubEntryNameId(Misc::importCallInputParseFunction('pay_stub_account', "Invalid Pay Stub Account ", $filtered_import_map['pay_stub_account']['default_value'], $filtered_import_map['pay_stub_account']['parse_hint'])); } } if (isset($mapped_row['units']) and $mapped_row['units'] != '') { $psaf->setUnits(Misc::importCallInputParseFunction('units', $mapped_row['units'], $filtered_import_map['units']['default_value'], $filtered_import_map['units']['parse_hint'])); } if (isset($mapped_row['rate']) and $mapped_row['rate'] != '') { $psaf->setRate(Misc::importCallInputParseFunction('rate', $mapped_row['rate'], $filtered_import_map['rate']['default_value'], $filtered_import_map['rate']['parse_hint'])); } if (isset($mapped_row['amount']) and $mapped_row['amount'] != '') { $psaf->setAmount(Misc::importCallInputParseFunction('amount', $mapped_row['amount'], $filtered_import_map['amount']['default_value'], $filtered_import_map['amount']['parse_hint'])); } if (isset($mapped_row['effective_date']) and $mapped_row['effective_date'] != '') { $psaf->setEffectiveDate(Misc::importCallInputParseFunction('effective_date', $mapped_row['effective_date'], $filtered_import_map['effective_date']['default_value'], $filtered_import_map['effective_date']['parse_hint']));