//Sum all Worked Hours
 //Sum all Paid Absences
 //Sum all Dock Absences
 //Sum all Regular/OverTime hours
 $udtlf = new UserDateTotalListFactory();
 $worked_total_time = (int) $udtlf->getWorkedTimeSumByUserIDAndPayPeriodId($user_id, $pay_period_id);
 Debug::text('Worked Total Time: ' . $worked_total_time, __FILE__, __LINE__, __METHOD__, 10);
 $paid_absence_total_time = $udtlf->getPaidAbsenceTimeSumByUserIDAndPayPeriodId($user_id, $pay_period_id);
 Debug::text('Paid Absence Total Time: ' . $paid_absence_total_time, __FILE__, __LINE__, __METHOD__, 10);
 $dock_absence_total_time = $udtlf->getDockAbsenceTimeSumByUserIDAndPayPeriodId($user_id, $pay_period_id);
 Debug::text('Dock Absence Total Time: ' . $dock_absence_total_time, __FILE__, __LINE__, __METHOD__, 10);
 $udtlf->getRegularAndOverTimeSumByUserIDAndPayPeriodId($user_id, $pay_period_id);
 if ($udtlf->getRecordCount() > 0) {
     //Get overtime policy names
     $otplf = new OverTimePolicyListFactory();
     $over_time_policy_options = $otplf->getByCompanyIdArray($current_company->getId(), FALSE);
     foreach ($udtlf as $udt_obj) {
         Debug::text('Type ID: ' . $udt_obj->getColumn('type_id') . ' OverTime Policy ID: ' . $udt_obj->getColumn('over_time_policy_id') . ' Total Time: ' . $udt_obj->getColumn('total_time'), __FILE__, __LINE__, __METHOD__, 10);
         if ($udt_obj->getColumn('type_id') == 20) {
             $name = TTi18n::gettext('Regular Time');
         } else {
             if (isset($over_time_policy_options[$udt_obj->getColumn('over_time_policy_id')])) {
                 $name = $over_time_policy_options[$udt_obj->getColumn('over_time_policy_id')];
             } else {
                 $name = TTi18n::gettext('N/A');
             }
         }
         if ($udt_obj->getColumn('type_id') == 20) {
             $total_time = $udt_obj->getColumn('total_time') + $paid_absence_total_time;
         } else {
             $total_time = $udt_obj->getColumn('total_time');
示例#2
0
 if (isset($columns['wage'])) {
     $uwlf = new UserWageListFactory();
     $uwlf->getByUserIdAndCompanyIdAndStartDateAndEndDate($filter_data['user_ids'], $current_company->getId(), $filter_data['start_date'], $filter_data['end_date']);
     if ($uwlf->getRecordCount() > 0) {
         foreach ($uwlf as $uw_obj) {
             $user_wage_rows[$uw_obj->getUser()][] = array('type_id' => $uw_obj->getType(), 'type' => Option::getByKey($uw_obj->getType(), $uw_obj->getOptions('type')), 'wage' => $uw_obj->getWage(), 'currency_symbol' => $uw_obj->getUserObject()->getCurrencyObject()->getSymbol(), 'effective_date' => $uw_obj->getEffectiveDate(), 'effective_date_since' => TTDate::getHumanTimeSince($uw_obj->getEffectiveDate()));
         }
     }
 }
 /*
 	Get Attendance History
 */
 if (isset($columns['attendance'])) {
     //Get policy names.
     $oplf = new OverTimePolicyListFactory();
     $over_time_policy_arr = $oplf->getByCompanyIdArray($current_company->getId(), FALSE);
     $aplf = new AbsencePolicyListFactory();
     $absence_policy_arr = $aplf->getByCompanyIdArray($current_company->getId(), FALSE);
     $pplf = new PremiumPolicyListFactory();
     $premium_policy_arr = $pplf->getByCompanyIdArray($current_company->getId(), FALSE);
     //Get stats on number of days worked per month/week
     $udlf = new UserDateListFactory();
     $udlf->getDaysWorkedByTimePeriodAndUserIdAndCompanyIdAndStartDateAndEndDate('month', $filter_data['user_ids'], $current_company->getId(), $filter_data['start_date'], $filter_data['end_date']);
     if ($udlf->getRecordCount() > 0) {
         foreach ($udlf as $ud_obj) {
             //$user_days_worked[$ud_obj->getUser()]['month']
             $user_attendance_rows[$ud_obj->getUser()]['days_worked']['month'] = array('avg' => round($ud_obj->getColumn('avg'), 2), 'min' => $ud_obj->getColumn('min'), 'max' => $ud_obj->getColumn('max'));
         }
     }
     $udlf->getDaysWorkedByTimePeriodAndUserIdAndCompanyIdAndStartDateAndEndDate('week', $filter_data['user_ids'], $current_company->getId(), $filter_data['start_date'], $filter_data['end_date']);
     if ($udlf->getRecordCount() > 0) {