diversen nav opmerkingen
This commit is contained in:
@@ -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] );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user