Esempio n. 1
0
 public function getDataToAppointmentGraph($date)
 {
     $graphData = $this->reportsRepository->getDatatoDashboard($date);
     $hoursService = new HoursControl();
     $hoursGraph = [];
     $tasksGraph = [];
     $labelsGraph = [];
     $monthHours = [];
     $percentageHours = [];
     $eletronicPointHours = [];
     foreach ($graphData as $data) {
         $dataBase = $data->split_date . '-01';
         $dataBase = Carbon::createFromFormat('Y-m-d', $dataBase);
         $pointHours = $hoursService->getHoursByDate($dataBase->firstOfMonth()->format('Y-m-d'), $dataBase->endOfMonth()->format('Y-m-d'), true);
         $pointHours = str_replace(':', '.', $pointHours);
         $eletronicPointHours[] = substr($pointHours, 0, 5);
         $auxDate = explode('-', $data->split_date);
         $hoursInMonth = $this->getTotalHoursByMonth($auxDate[0], $auxDate[1]);
         $monthHours[] = $hoursInMonth;
         $percentageHours[] = round($data->hours / $hoursInMonth * 100, 2);
         $hoursGraph[] = $data->hours;
         $tasksGraph[] = $data->tasks;
         $labelsGraph[] = Date::$months[$auxDate[1]] . '/' . $auxDate[0];
     }
     return ['eletronicPointHours' => $eletronicPointHours, 'monthGraph' => $monthHours, 'hoursGraph' => $hoursGraph, 'tasksGraph' => $tasksGraph, 'labelsGraph' => $labelsGraph, 'percentageGraph' => $percentageHours];
 }
Esempio n. 2
0
 public function getDataToAppointmentGraph($date)
 {
     $graphData = $this->reportsRepository->getDatatoDashboard($date);
     $hoursGraph = [];
     $tasksGraph = [];
     $labelsGraph = [];
     foreach ($graphData as $data) {
         $auxDate = explode('-', $data->split_date);
         $hoursGraph[] = $data->hours;
         $tasksGraph[] = $data->tasks;
         $labelsGraph[] = Date::$months[$auxDate[1]] . '/' . $auxDate[0];
     }
     return ['hoursGraph' => $hoursGraph, 'tasksGraph' => $tasksGraph, 'labelsGraph' => $labelsGraph];
 }