if (isset($filter_data['user_ids']) and isset($filter_data['year'])) { if (isset($filter_data['year'])) { $year_epoch = mktime(0, 0, 0, 1, 1, $filter_data['year']); Debug::Text(' Year: ' . TTDate::getDate('DATE+TIME', $year_epoch), __FILE__, __LINE__, __METHOD__, 10); } $pseallf = new PayStubEntryAccountLinkListFactory(); $pseallf->getByCompanyId($current_company->getId()); if ($pseallf->getRecordCount() > 0) { $pseal_obj = $pseallf->getCurrent(); } // //Get all data for the form. // //Get Pay Periods in date range. $pplf = new PayPeriodListFactory(); $pplf->getByCompanyIdAndTransactionStartDateAndTransactionEndDate($current_company->getId(), TTDate::getBeginYearEpoch($year_epoch), TTDate::getEndYearEpoch($year_epoch)); if ($pplf->getRecordCount() > 0) { foreach ($pplf as $pp_obj) { $pay_period_ids[] = $pp_obj->getID(); } } $report_columns = $static_columns; $pself = new PayStubEntryListFactory(); $pself->getReportByCompanyIdAndUserIdAndPayPeriodId($current_company->getId(), $filter_data['user_ids'], $pay_period_ids); foreach ($pself as $pse_obj) { $user_id = $pse_obj->getColumn('user_id'); $pay_stub_entry_name_id = $pse_obj->getColumn('pay_stub_entry_name_id'); $raw_rows[$user_id][$pay_stub_entry_name_id] = $pse_obj->getColumn('amount'); } //var_dump($raw_rows); //
$filter_data['user_ids'][] = $u_obj->getId(); } if (isset($filter_data['user_ids']) and isset($filter_data['year'])) { $pseallf = new PayStubEntryAccountLinkListFactory(); $pseallf->getByCompanyId($current_company->getId()); if ($pseallf->getRecordCount() > 0) { $pseal_obj = $pseallf->getCurrent(); } // //Get all data for the form. // foreach ($quarter_dates as $quarter_id => $quarter_dates_arr) { //Get Pay Periods in date range. Debug::Text('Start Date: ' . TTDate::getDate('DATE+TIME', $quarter_dates_arr['start']) . ' End Date: ' . TTDate::getDate('DATE+TIME', $quarter_dates_arr['end']), __FILE__, __LINE__, __METHOD__, 10); $pplf = new PayPeriodListFactory(); $pplf->getByCompanyIdAndTransactionStartDateAndTransactionEndDate($current_company->getId(), $quarter_dates_arr['start'], $quarter_dates_arr['end']); if ($pplf->getRecordCount() > 0) { foreach ($pplf as $pp_obj) { $pay_period_ids[] = $pp_obj->getID(); } } if (isset($pay_period_ids)) { $payments_over_cutoff = 7000; //PS Account Amounts... //Get employees who have recieved pay stubs. $pself = new PayStubEntryListFactory(); $pself->getReportByCompanyIdAndUserIdAndPayPeriodId($current_company->getId(), $filter_data['user_ids'], $pay_period_ids); if ($pself->getRecordCount() > 0) { foreach ($pself as $pse_obj) { $user_id = $pse_obj->getColumn('user_id'); //$pay_stub_entry_name_id = $pse_obj->getColumn('pay_stub_entry_name_id');
$tax_withheld_psea_ids = array(); Debug::Text('Found Company Deductions...', __FILE__, __LINE__, __METHOD__, 10); foreach ($cdlf as $cd_obj) { $taxable_wages_psea_ids = array_merge($taxable_wages_psea_ids, (array) $cd_obj->getCombinedIncludeExcludePayStubEntryAccount($cd_obj->getIncludePayStubEntryAccount(), $cd_obj->getExcludePayStubEntryAccount())); $tax_withheld_psea_ids[] = $cd_obj->getPayStubEntryAccount(); } $taxable_wages_psea_ids = array_unique($taxable_wages_psea_ids); $tax_withheld_psea_ids = array_unique($tax_withheld_psea_ids); } //var_dump($taxable_wages_psea_ids); foreach ($ulf as $u_obj) { $filter_data['user_ids'][] = $u_obj->getId(); } //Get all pay periods by transaction start/end date $pplf = new PayPeriodListFactory(); $pplf->getByCompanyIdAndTransactionStartDateAndTransactionEndDate($current_company->getId(), $filter_data['start_date'], $filter_data['end_date']); if ($pplf->getRecordCount() > 0) { foreach ($pplf as $pp_obj) { $pay_period_ids[] = $pp_obj->getId(); } } unset($pplf, $pp_obj); if (isset($pay_period_ids) and isset($filter_data['user_ids'])) { //Get column headers /* $psealf = new PayStubEntryAccountListFactory(); $psealf->getByCompanyId( $current_company->getId() ); foreach($psealf as $psea_obj) { //$report_columns[$psen_obj->getId()] = $psen_obj->getDescription(); $report_columns[$psea_obj->getId()] = $psea_obj->getName(); }