function getPunchDataArray($start_date, $end_date) { $plf = new PunchListFactory(); $plf->getByCompanyIDAndUserIdAndStartDateAndEndDate($this->company_id, $this->user_id, $start_date, $end_date); if ($plf->getRecordCount() > 0) { //Only return punch_control data for now $i = 0; $prev_punch_control_id = NULL; foreach ($plf as $p_obj) { if ($prev_punch_control_id == NULL or $prev_punch_control_id != $p_obj->getPunchControlID()) { $date_stamp = $p_obj->getPunchControlObject()->getUserDateObject()->getDateStamp(); $p_obj->setUser($this->user_id); $p_obj->getPunchControlObject()->setPunchObject($p_obj); $retarr[$date_stamp][$i] = array('id' => $p_obj->getPunchControlObject()->getID(), 'date_stamp' => $date_stamp, 'user_date_id' => $p_obj->getPunchControlObject()->getUserDateID(), 'shift_data' => $p_obj->getPunchControlObject()->getShiftData()); $prev_punch_control_id = $p_obj->getPunchControlID(); $i++; } } if (isset($retarr)) { return $retarr; } } return FALSE; }
case 'recalculate employee': Debug::Text('Recalculating employee timesheet!', __FILE__, __LINE__, __METHOD__, 10); Redirect::Page(URLBuilder::getURL(array('action' => 'recalculate_employee', 'pay_period_ids' => $pay_period_id, 'filter_user_id' => $filter_data['user_id'], 'next_page' => urlencode(URLBuilder::getURL(NULL, '../timesheet/ViewUserTimeSheet.php'))), '../progress_bar/ProgressBarControl.php'), FALSE); break; case 'submit': default: BreadCrumb::setCrumb($title); Debug::Text('Default Action: ' . $action, __FILE__, __LINE__, __METHOD__, 10); $start_date = TTDate::getBeginWeekEpoch($filter_data['date'], $current_user_prefs->getStartWeekDay()); $end_date = TTDate::getEndWeekEpoch($filter_data['date'], $current_user_prefs->getStartWeekDay()); Debug::Text('Start Date: ' . TTDate::getDate('DATE+TIME', $start_date) . ' End Date: ' . TTDate::getDate('DATE+TIME', $end_date), __FILE__, __LINE__, __METHOD__, 10); $calendar_array = TTDate::getCalendarArray($start_date, $end_date, $current_user_prefs->getStartWeekDay()); //var_dump($calendar_array); //Get all punches, put in array by date epoch. $plf = new PunchListFactory(); $plf->getByCompanyIDAndUserIdAndStartDateAndEndDate($current_company->getId(), $user_id, $start_date, $end_date); if ($plf->getRecordCount() > 0) { foreach ($plf as $punch_obj) { $user_date_stamp = TTDate::strtotime($punch_obj->getColumn('user_date_stamp')); if ($punch_obj->getColumn('note') != '') { $has_note = TRUE; } else { $has_note = FALSE; } $punches[$user_date_stamp][] = array('date_stamp' => $punch_obj->getColumn('user_date_stamp'), 'id' => $punch_obj->getId(), 'punch_control_id' => $punch_obj->getPunchControlId(), 'time_stamp' => $punch_obj->getTimeStamp(), 'status_id' => $punch_obj->getStatus(), 'type_id' => $punch_obj->getType(), 'type_code' => $punch_obj->getTypeCode(), 'has_note' => $has_note); //Total up meal and break total time for each day. if ($punch_obj->getType() != 10) { if ($punch_obj->getStatus() == 20) { $tmp_date_break_totals[$user_date_stamp][$punch_obj->getType()]['prev'] = $punch_obj->getTimeStamp(); } elseif (isset($tmp_date_break_totals[$user_date_stamp][$punch_obj->getType()]['prev'])) { if (!isset($tmp_date_break_totals[$user_date_stamp][$punch_obj->getType()]['total_time'])) {