Beispiel #1
0
 /**
  * @param $startDateAppointmentCheck
  * @param $endDateAppointmentCheck
  * @return array|mixed
  */
 public function getDaysWithPendingAppointmentHours($startDateAppointmentCheck, $endDateAppointmentCheck)
 {
     $datesWithPendingAppointment = $this->reportsRepository->getDaysWithoutFullHours($startDateAppointmentCheck);
     $period = Date::getDatesFromRange($startDateAppointmentCheck, $endDateAppointmentCheck);
     $return = [];
     foreach ($period as $date) {
         if (Date::isWeekend($date)) {
             continue;
         }
         if (Date::isHoliday($date)) {
             continue;
         }
         foreach ($datesWithPendingAppointment as $key => $pendingDay) {
             if ($date == $pendingDay->date) {
                 if ($pendingDay->hours < 8) {
                     $return[] = $pendingDay;
                     continue 2;
                 }
                 continue 2;
             }
         }
         $newDate = new \stdClass();
         $newDate->hours = 0;
         $newDate->hoursPending = 8;
         $newDate->date = $date;
         $return[] = $newDate;
     }
     $this->sortByArrayObjectDate($return);
     return $this->transformDataToGraph($return);
 }
Beispiel #2
0
 /**
  * @param $period
  * @return int
  */
 protected function getWorkingHoursByPeriod($period)
 {
     $hours = 0;
     foreach ($period as $date) {
         if (Date::isWeekend($date)) {
             continue;
         }
         if (Date::isHoliday($date)) {
             continue;
         }
         $hours += 8;
     }
     return $hours;
 }