request->getPost('field'); $direction = $this->request->getPost('direction'); $recapprojects = new \Recapprojects($archive, $field, $direction); $projects = $recapprojects->getProjects(); return $this->json($projects); } public function getMonthlyEmployeeHoursPerProject(int $employeeID, int $year): ResponseInterface { $monthlyhours = \Projecthour::getMonthlyEmployeeHoursPerProject($employeeID, $year); return $this->json($monthlyhours); } public function getMonthlyEmployeehours(int $month, int $year): ResponseInterface { $sql = \QEmployeeHours::fire($month, $year); $db = \Config\Database::connect(); $query = $db->query($sql); $result = $query->getResult(); foreach ($result as $user) { $user->targethours = \Employeetarget::getTargetHoursPerEmployee($user->user_id, $year, $month); } return $this->json($result); } public function getInvoiceOverview(int $year, string $orderType, string $orderDirection, string $archive): ResponseInterface { $invoices = new \Invoices($year, $orderType, $orderDirection, $archive); $invoiceReport = $invoices->getInvoiceReport(); return $this->json($invoiceReport); } public function createInvoicesSpreadsheet(int $year, string $orderType, string $orderDirection, string $archive): ResponseInterface { $invoices = new \Invoices($year, $orderType, $orderDirection, $archive); $invoiceReport = $invoices->getInvoiceReport(); new \InvoiceSpreadsheet($invoiceReport); return $this->json(['success' => true]); } public function saveCurrentFinnacialYear(int $projectID): ResponseInterface { $amount = $this->request->getPost('amount'); \Project::whereId($projectID)->update(['current_financial_year' => $amount]); return $this->json(['success' => true]); } }