function getExpandedPayStubEntryAccountIDs($ids) { //Debug::Arr($ids, 'Total Gross ID: '. $this->getPayStubEntryAccountLinkObject()->getTotalGross() .' IDs:', __FILE__, __LINE__, __METHOD__,10); $ids = (array) $ids; $total_gross_key = array_search($this->getPayStubEntryAccountLinkObject()->getTotalGross(), $ids); if ($total_gross_key !== FALSE) { $type_ids[] = 10; $type_ids[] = 60; //Automatically inlcude Advance Earnings here? unset($ids[$total_gross_key]); } unset($total_gross_key); $total_employee_deduction_key = array_search($this->getPayStubEntryAccountLinkObject()->getTotalEmployeeDeduction(), $ids); if ($total_employee_deduction_key !== FALSE) { $type_ids[] = 20; unset($ids[$total_employee_deduction_key]); } unset($total_employee_deduction_key); $total_employer_deduction_key = array_search($this->getPayStubEntryAccountLinkObject()->getTotalEmployerDeduction(), $ids); if ($total_employer_deduction_key !== FALSE) { $type_ids[] = 30; unset($ids[$total_employer_deduction_key]); } unset($total_employer_deduction_key); $psea_ids_from_type_ids = array(); if (isset($type_ids)) { $psealf = new PayStubEntryAccountListFactory(); $psea_ids_from_type_ids = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($this->getCompany(), array(10, 20), $type_ids, FALSE); if (is_array($psea_ids_from_type_ids)) { $psea_ids_from_type_ids = array_keys($psea_ids_from_type_ids); } } $retval = array_unique(array_merge($ids, $psea_ids_from_type_ids)); //Debug::Arr($retval, 'Retval: ', __FILE__, __LINE__, __METHOD__,10); return $retval; }
$otpf->Save(); Redirect::Page(URLBuilder::getURL(NULL, 'OverTimePolicyList.php')); break; } default: if (isset($id)) { BreadCrumb::setCrumb($title); $otplf = new OverTimePolicyListFactory(); $otplf->getByIdAndCompanyID($id, $current_company->getID()); foreach ($otplf as $otp_obj) { //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10); $data = array('id' => $otp_obj->getId(), 'name' => $otp_obj->getName(), 'type_id' => $otp_obj->getType(), 'trigger_time' => $otp_obj->getTriggerTime(), 'rate' => Misc::removeTrailingZeros($otp_obj->getRate()), 'wage_group_id' => $otp_obj->getWageGroup(), 'accrual_rate' => Misc::removeTrailingZeros($otp_obj->getAccrualRate()), 'accrual_policy_id' => $otp_obj->getAccrualPolicyID(), 'pay_stub_entry_account_id' => $otp_obj->getPayStubEntryAccountId(), 'created_date' => $otp_obj->getCreatedDate(), 'created_by' => $otp_obj->getCreatedBy(), 'updated_date' => $otp_obj->getUpdatedDate(), 'updated_by' => $otp_obj->getUpdatedBy(), 'deleted_date' => $otp_obj->getDeletedDate(), 'deleted_by' => $otp_obj->getDeletedBy()); } } elseif ($action != 'submit') { $data = array('trigger_time' => 0, 'rate' => '1.00', 'accrual_rate' => '1.00'); } $aplf = new AccrualPolicyListFactory(); $accrual_options = $aplf->getByCompanyIDArray($current_company->getId(), TRUE); $psealf = new PayStubEntryAccountListFactory(); $pay_stub_entry_options = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 20, 30, 50)); $wglf = new WageGroupListFactory(); $data['wage_group_options'] = $wglf->getArrayByListFactory($wglf->getByCompanyId($current_company->getId()), TRUE); //Select box options; $data['type_options'] = $otpf->getOptions('type'); $data['accrual_options'] = $accrual_options; $data['pay_stub_entry_options'] = $pay_stub_entry_options; $smarty->assign_by_ref('data', $data); break; } $smarty->assign_by_ref('otpf', $otpf); $smarty->display('policy/EditOverTimePolicy.tpl');
$filter_data['selected_branch_options'] = Misc::arrayIntersectByKey((array) $filter_data['branch_ids'], $branch_options); //Get departments $dlf = new DepartmentListFactory(); $dlf->getByCompanyId($current_company->getId()); $department_options = Misc::prependArray($all_array_option, $dlf->getArrayByListFactory($dlf, FALSE, TRUE)); $filter_data['src_department_options'] = Misc::arrayDiffByKey((array) $filter_data['department_ids'], $department_options); $filter_data['selected_department_options'] = Misc::arrayIntersectByKey((array) $filter_data['department_ids'], $department_options); //Get employee titles $utlf = new UserTitleListFactory(); $utlf->getByCompanyId($current_company->getId()); $user_title_options = Misc::prependArray($all_array_option, $utlf->getArrayByListFactory($utlf, FALSE, TRUE)); $filter_data['src_user_title_options'] = Misc::arrayDiffByKey((array) $filter_data['user_title_ids'], $user_title_options); $filter_data['selected_user_title_options'] = Misc::arrayIntersectByKey((array) $filter_data['user_title_ids'], $user_title_options); //Deduction PSEA accounts $psealf = new PayStubEntryAccountListFactory(); $filter_data['deduction_pay_stub_entry_account_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(20, 30, 40), TRUE); $filter_data['earning_pay_stub_entry_account_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 40), TRUE); $filter_data['income_pay_stub_entry_account_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 30, 40), TRUE); //Get employee list //$filter_data['user_options'] = UserListFactory::getByCompanyIdArray( $current_company->getId(), FALSE ); //Quarters $filter_data['year_options'] = $year_options; $setup_data['state_options'] = $state_options; $saved_report_options = $ugdlf->getByUserIdAndScriptArray($current_user->getId(), $_SERVER['SCRIPT_NAME']); $generic_data['saved_report_options'] = $saved_report_options; $smarty->assign_by_ref('generic_data', $generic_data); $smarty->assign_by_ref('filter_data', $filter_data); $smarty->assign_by_ref('setup_data', $setup_data); $smarty->assign_by_ref('ugdf', $ugdf); $smarty->display('report/Form940ez.tpl'); break;
$data['federal_filing_status_options'] = $cdf->getOptions('federal_filing_status'); $data['state_filing_status_options'] = $cdf->getOptions('state_filing_status'); $data['state_ga_filing_status_options'] = $cdf->getOptions('state_ga_filing_status'); $data['state_nj_filing_status_options'] = $cdf->getOptions('state_nj_filing_status'); $data['state_nc_filing_status_options'] = $cdf->getOptions('state_nc_filing_status'); $data['state_ma_filing_status_options'] = $cdf->getOptions('state_ma_filing_status'); $data['state_al_filing_status_options'] = $cdf->getOptions('state_al_filing_status'); $data['state_ct_filing_status_options'] = $cdf->getOptions('state_ct_filing_status'); $data['state_wv_filing_status_options'] = $cdf->getOptions('state_wv_filing_status'); $data['state_me_filing_status_options'] = $cdf->getOptions('state_me_filing_status'); $data['state_de_filing_status_options'] = $cdf->getOptions('state_de_filing_status'); $data['state_dc_filing_status_options'] = $cdf->getOptions('state_dc_filing_status'); $data['calculation_options'] = $cdf->getOptions('calculation'); $data['js_arrays'] = $cdf->getJavaScriptArrays(); $psealf = new PayStubEntryAccountListFactory(); $data['pay_stub_entry_account_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 20, 30, 50), FALSE); //$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, 20, 30, 40, 50), FALSE); 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, 20, 30, 40, 50), FALSE); foreach ($data['include_pay_stub_entry_account_ids'] as $include_psea_id) { if (isset($tmp_psea_options[$include_psea_id])) { $filter_include_options[$include_psea_id] = $tmp_psea_options[$include_psea_id]; } } unset($include_psea_id, $tmp_psea_options); } $smarty->assign_by_ref('filter_include_options', $filter_include_options); $data['exclude_pay_stub_entry_account_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 20, 30, 40, 50), FALSE); if (isset($data['exclude_pay_stub_entry_account_ids']) and is_array($data['exclude_pay_stub_entry_account_ids'])) { $tmp_psea_options = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 20, 30, 40, 50), FALSE);
$filter_data['department_ids'] = array(-1); $filter_data['user_title_ids'] = array(-1); $filter_data['pay_period_ids'] = array('-0000-' . array_shift(array_keys($pay_period_options))); $filter_data['group_ids'] = array(-1); if (!isset($filter_data['column_ids'])) { $filter_data['column_ids'] = array(); } $filter_data['column_ids'] = array_merge($filter_data['column_ids'], array('-1000-full_name', '-1060-total', '-1070-ei_total', '-1080-cpp_total', '-1090-tax_total', '-1100-gross_payroll')); $filter_data['primary_sort'] = '-1000-full_name'; $filter_data['secondary_sort'] = '-1060-total'; } } $filter_data = Misc::preSetArrayValues($filter_data, array('include_user_ids', 'exclude_user_ids', 'user_status_ids', 'group_ids', 'branch_ids', 'department_ids', 'user_title_ids', 'pay_period_ids', 'column_ids'), NULL); //Deduction PSEA accounts $psealf = new PayStubEntryAccountListFactory(); $filter_data['deduction_pay_stub_entry_account_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(20, 30), FALSE); $ulf = new UserListFactory(); $all_array_option = array('-1' => TTi18n::gettext('-- All --')); //Get include employee list. $ulf->getByCompanyId($current_company->getId()); $user_options = $ulf->getArrayByListFactory($ulf, FALSE, TRUE); $filter_data['src_include_user_options'] = Misc::arrayDiffByKey((array) $filter_data['include_user_ids'], $user_options); $filter_data['selected_include_user_options'] = Misc::arrayIntersectByKey((array) $filter_data['include_user_ids'], $user_options); //Get exclude employee list $exclude_user_options = Misc::prependArray($all_array_option, $ulf->getArrayByListFactory($ulf, FALSE, TRUE)); $filter_data['src_exclude_user_options'] = Misc::arrayDiffByKey((array) $filter_data['exclude_user_ids'], $user_options); $filter_data['selected_exclude_user_options'] = Misc::arrayIntersectByKey((array) $filter_data['exclude_user_ids'], $user_options); //Get employee status list. $user_status_options = Misc::prependArray($all_array_option, $ulf->getOptions('status')); $filter_data['src_user_status_options'] = Misc::arrayDiffByKey((array) $filter_data['user_status_ids'], $user_status_options); $filter_data['selected_user_status_options'] = Misc::arrayIntersectByKey((array) $filter_data['user_status_ids'], $user_status_options);
$pseaf->setType($data['type_id']); $pseaf->setName($data['name']); $pseaf->setOrder($data['order']); $pseaf->setAccrual($data['accrual_id']); $pseaf->setDebitAccount($data['debit_account']); $pseaf->setCreditAccount($data['credit_account']); if ($pseaf->isValid()) { $pseaf->Save(); Redirect::Page(URLBuilder::getURL(NULL, 'PayStubEntryAccountList.php')); break; } default: if (isset($id)) { BreadCrumb::setCrumb($title); $psealf = new PayStubEntryAccountListFactory(); $psealf->getById($id); foreach ($psealf as $psea_obj) { //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10); $data = array('id' => $psea_obj->getId(), 'status_id' => $psea_obj->getStatus(), 'type_id' => $psea_obj->getType(), 'name' => $psea_obj->getName(), 'order' => $psea_obj->getOrder(), 'accrual_id' => $psea_obj->getAccrual(), 'debit_account' => $psea_obj->getDebitAccount(), 'credit_account' => $psea_obj->getCreditAccount(), 'accrual_id' => $psea_obj->getAccrual(), 'created_date' => $psea_obj->getCreatedDate(), 'created_by' => $psea_obj->getCreatedBy(), 'updated_date' => $psea_obj->getUpdatedDate(), 'updated_by' => $psea_obj->getUpdatedBy(), 'deleted_date' => $psea_obj->getDeletedDate(), 'deleted_by' => $psea_obj->getDeletedBy()); } } //Select box options; $data['status_options'] = $pseaf->getOptions('status'); $data['type_options'] = $pseaf->getOptions('type'); $psealf = new PayStubEntryAccountListFactory(); $data['accrual_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(50), TRUE); $smarty->assign_by_ref('data', $data); break; } $smarty->assign_by_ref('pseaf', $pseaf); $smarty->display('pay_stub/EditPayStubEntryAccount.tpl');
require_once '../../includes/global.inc.php'; require_once Environment::getBasePath() . 'includes/Interface.inc.php'; if (!$permission->Check('report', 'enabled') or !$permission->Check('report', 'view_pay_stub_summary')) { $permission->Redirect(FALSE); //Redirect } $smarty->assign('title', TTi18n::gettext($title = 'Pay Stub Summary Report')); // See index.php /* * Get FORM variables */ extract(FormVariables::GetVariables(array('action', 'generic_data', 'filter_data'))); URLBuilder::setURL($_SERVER['SCRIPT_NAME'], array('filter_data' => $filter_data)); $static_columns = array('-0900-first_name' => TTi18n::gettext('First Name'), '-0901-middle_name' => TTi18n::gettext('Middle Name'), '-0902-middle_initial' => TTi18n::gettext('Middle Initial'), '-0903-last_name' => TTi18n::gettext('Last Name'), '-1000-full_name' => TTi18n::gettext('Full Name'), '-1002-employee_number' => TTi18n::gettext('Employee #'), '-1010-title' => TTi18n::gettext('Title'), '-1020-province' => TTi18n::gettext('Province/State'), '-1030-country' => TTi18n::gettext('Country'), '-1039-group' => TTi18n::gettext('Group'), '-1040-default_branch' => TTi18n::gettext('Default Branch'), '-1050-default_department' => TTi18n::gettext('Default Department'), '-1060-sin' => TTi18n::gettext('SIN/SSN'), '-1065-birth_date' => TTi18n::gettext('Birth Date'), '-1070-hire_date' => TTi18n::gettext('Hire Date'), '-1080-since_hire_date' => TTi18n::gettext('Since Hired'), '-1085-termination_date' => TTi18n::gettext('Termination Date'), '-1086-institution' => TTi18n::gettext('Bank Institution'), '-1087-transit' => TTi18n::gettext('Bank Transit/Routing'), '-1089-account' => TTi18n::gettext('Bank Account'), '-1090-pay_period' => TTi18n::gettext('Pay Period'), '-1100-pay_stub_start_date' => TTi18n::gettext('Start Date'), '-1110-pay_stub_end_date' => TTi18n::gettext('End Date'), '-1120-pay_stub_transaction_date' => TTi18n::gettext('Transaction Date'), '-1130-currency' => TTi18n::gettext('Currency'), '-1131-current_currency' => TTi18n::gettext('Current Currency')); $psealf = new PayStubEntryAccountListFactory(); $psen_columns = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 20, 30, 40, 50, 60, 65), FALSE); $columns = Misc::prependArray($static_columns, $psen_columns); $default_transaction_start_date = TTDate::getBeginMonthEpoch(time()); $default_transaction_end_date = TTDate::getEndMonthEpoch(time()); //Get all pay periods $pplf = new PayPeriodListFactory(); $pplf->getPayPeriodsWithPayStubsByCompanyId($current_company->getId()); $pay_period_options = array(); if ($pplf->getRecordCount() > 0) { $pp = 0; foreach ($pplf as $pay_period_obj) { $pay_period_ids[] = $pay_period_obj->getId(); $pay_period_end_dates[$pay_period_obj->getId()] = $pay_period_obj->getEndDate(); if ($pp == 0) { $default_transaction_start_date = $pay_period_obj->getEndDate(); $default_transaction_end_date = $pay_period_obj->getTransactionDate() + 86400;
*/ $status_options = Option::getByArray($status_options_filter, $rpsaf->getOptions('status')); $pay_stub_amendment_data['status_options'] = $status_options; $frequency_options = $rpsaf->getOptions('frequency'); $pay_stub_amendment_data['frequency_options'] = $frequency_options; $percent_amount_options = $rpsaf->getOptions('percent_amount'); $pay_stub_amendment_data['percent_amount_options'] = $percent_amount_options; $pay_stub_amendment_data['type_options'] = $rpsaf->getOptions('type'); $pseallf = new PayStubEntryAccountLinkListFactory(); $pseallf->getByCompanyId($current_company->getId()); if ($pseallf->getRecordCount() > 0) { $net_pay_psea_id = $pseal_obj = $pseallf->getCurrent()->getTotalNetPay(); } //$psenlf = new PayStubEntryNameListFactory(); $psealf = new PayStubEntryAccountListFactory(); $pay_stub_amendment_data['pay_stub_entry_name_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 20, 30, 50, 60, 65)); $pay_stub_amendment_data['percent_amount_entry_name_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 20, 30, 40, 50, 60, 65)); if (isset($net_pay_psea_id)) { unset($pay_stub_amendment_data['percent_amount_entry_name_options'][$net_pay_psea_id]); } $smarty->assign_by_ref('pay_stub_amendment_data', $pay_stub_amendment_data); $user_options = UserListFactory::getByCompanyIdArray($current_company->getId(), FALSE); $user_options = Misc::prependArray(array(-1 => TTi18n::gettext('-- ALL --')), $user_options); $pay_stub_amendment_data['user_options'] = $user_options; if (isset($pay_stub_amendment_data['user_ids']) and is_array($pay_stub_amendment_data['user_ids'])) { $tmp_user_options = $user_options; foreach ($pay_stub_amendment_data['user_ids'] as $user_id) { if (isset($tmp_user_options[$user_id])) { $filter_user_options[$user_id] = $tmp_user_options[$user_id]; } }
if ($current_company->getCountry() == 'CA') { $psealf->setEmployeeCPP($data['employee_cpp']); $psealf->setEmployeeEI($data['employee_ei']); } if ($psealf->isValid()) { $psealf->Save(); Redirect::Page(URLBuilder::getURL(array('data_saved' => TRUE), 'EditPayStubEntryAccountLink.php')); break; } default: BreadCrumb::setCrumb($title); $pseallf = new PayStubEntryAccountLinkListFactory(); $pseallf->getByCompanyId($current_company->getId()); if ($pseallf->getRecordCount() > 0) { $pseal_obj = $pseallf->getCurrent(); $data = array('id' => $pseal_obj->getId(), 'total_gross' => $pseal_obj->getTotalGross(), 'total_employee_deduction' => $pseal_obj->getTotalEmployeeDeduction(), 'total_employer_deduction' => $pseal_obj->getTotalEmployerDeduction(), 'total_net_pay' => $pseal_obj->getTotalNetPay(), 'regular_time' => $pseal_obj->getRegularTime(), 'monthly_advance' => $pseal_obj->getMonthlyAdvance(), 'monthly_advance_deduction' => $pseal_obj->getMonthlyAdvanceDeduction(), 'employee_cpp' => $pseal_obj->getEmployeeCPP(), 'employee_ei' => $pseal_obj->getEmployeeEI(), 'created_date' => $pseal_obj->getCreatedDate(), 'created_by' => $pseal_obj->getCreatedBy(), 'updated_date' => $pseal_obj->getUpdatedDate(), 'updated_by' => $pseal_obj->getUpdatedBy(), 'deleted_date' => $pseal_obj->getDeletedDate(), 'deleted_by' => $pseal_obj->getDeletedBy()); } $psealf_tmp = new PayStubEntryAccountListFactory(); $data['earning_account_options'] = $psealf_tmp->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10)); $data['employee_deduction_account_options'] = $psealf_tmp->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(20)); $data['employer_deduction_account_options'] = $psealf_tmp->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(30)); $data['total_account_options'] = $psealf_tmp->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(40)); $data['accrual_account_options'] = $psealf_tmp->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(50)); $data['other_account_options'] = $psealf_tmp->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(60, 65)); //var_dump($data); $smarty->assign_by_ref('data', $data); $smarty->assign_by_ref('data_saved', $data_saved); break; } $smarty->assign_by_ref('psealf', $psealf); $smarty->display('pay_stub/EditPayStubEntryAccountLink.tpl');
$last_date = $punch_obj->getPunchControlObject()->getUserDateObject()->getDateStamp(); } else { $last_date = TTDate::getTime(); } Debug::Text('Last Punch Date: ' . TTDate::getDate('DATE+TIME', $last_date), __FILE__, __LINE__, __METHOD__, 10); //Get pay period of last shift workd $plf = new PayPeriodListFactory(); $pay_period_obj = $plf->getByUserIdAndEndDate($user_id, $last_date)->getCurrent(); $pay_period_type_id = FALSE; if (is_object($pay_period_obj->getPayPeriodScheduleObject())) { $pay_period_type_id = $pay_period_obj->getPayPeriodScheduleObject()->getType(); } $roe_data = array('user_id' => $user_id, 'pay_period_type_id' => $pay_period_type_id, 'first_date' => $first_date, 'last_date' => $last_date, 'pay_period_end_date' => $pay_period_obj->getEndDate()); } //Select box options; $roe_data['code_options'] = $roef->getOptions('code'); $ppsf = new PayPeriodScheduleFactory(); $roe_data['pay_period_type_options'] = $ppsf->getOptions('type'); unset($roe_data['pay_period_type_options'][5]); $user_options = UserListFactory::getByCompanyIdArray($current_company->getId(), FALSE); $smarty->assign_by_ref('user_options', $user_options); //PSEA accounts $psealf = new PayStubEntryAccountListFactory(); $earning_pay_stub_entry_account_options = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 30, 40), TRUE); $smarty->assign_by_ref('earning_pay_stub_entry_account_options', $earning_pay_stub_entry_account_options); $smarty->assign_by_ref('roe_data', $roe_data); $smarty->assign_by_ref('setup_data', $setup_data); break; } $smarty->assign_by_ref('roef', $roef); $smarty->display('roe/EditROE.tpl');