diversen nav opmerkingen

This commit is contained in:
2018-03-21 17:23:58 +01:00
parent 3241cc0c67
commit e89dc41e18
23 changed files with 404 additions and 154 deletions
@@ -22,11 +22,15 @@ class EmployeeHoursController extends MY_Controller {
$this->load->library( $libraries );
}
public function getEmployeehours( $month, $year )
public function getEmployeehours( $month, $year, $employeeID )
{
$employeehours = Employeehour::getEmployeehours( $month, $year );
$sql = EmployeehoursMonthly::fire( $month, $year, $employeeID );
$this->json( $employeehours );
$query = $this->db->query( $sql );
$result = $query->result();
$this->json( $result );
}
public function getHourtypes()
@@ -42,11 +46,31 @@ class EmployeeHoursController extends MY_Controller {
$data = $this->input->post();
$employeehourID = $data['id'];
$hourType = $data['hourType'];
$projectID = $data['project_id'];
unset( $data['id'] );
unset( $data['hourType'] );
unset( $data['project_id'] );
$data['hourdate'] = date2mysql( $data['hourdate'] );
$employeehourID = Employeehour::saveEmployeehour( $employeehourID, $data );
if ( $hourType == 'PROJECTS' )
{
$projectemployee = Projectemployee::select( 'id' )
->whereUserId( $data['employee_id'] )
->whereprojectId( $projectID )
->first();
$data['projectemployee_id'] = $projectemployee->id;
unset( $data['employee_id'] );
$data['hourtype_id'] = $data['hourtype_id'] - 8;
$employeehourID = Projecthour::saveProjecthour( $employeehourID, $data );
}
else
{
$employeehourID = Employeehour::saveEmployeehour( $employeehourID, $data );
}
$this->json( ['employeehourID' => $employeehourID] );
}