diff --git a/application/config/autoload.php b/application/config/autoload.php index 55220ba..8a7a9e0 100755 --- a/application/config/autoload.php +++ b/application/config/autoload.php @@ -132,4 +132,4 @@ $autoload['language'] = array(); | | $autoload['model'] = array('first_model' => 'first'); */ -$autoload['model'] = ['beheer/User_model']; +$autoload['model'] = ['beheer/User_model', ]; diff --git a/application/controllers/beheer/AuthorisationController.php b/application/controllers/beheer/AuthorisationController.php new file mode 100644 index 0000000..93488d0 --- /dev/null +++ b/application/controllers/beheer/AuthorisationController.php @@ -0,0 +1,36 @@ +load->model( $models ); + $this->load->library( $libraries ); + } + + public function index() + { + + } + + public function getRoleAuthorisations() + { + $roleAuthorisations = Role::getPagesAccessByRole(); + + return $roleAuthorisations; + } + +} \ No newline at end of file diff --git a/application/controllers/reports/ReportsController.php b/application/controllers/reports/ReportsController.php index 2ec3db2..efece4a 100644 --- a/application/controllers/reports/ReportsController.php +++ b/application/controllers/reports/ReportsController.php @@ -81,4 +81,11 @@ class ReportsController extends MY_Controller { $this->json( $result ); } + public function saveCurrentFinnacialYear( $projectID ) + { + $amount = $this->input->post( 'amount' ); + + Project::whereId( $projectID )->update( ['current_financial_year' => $amount] ); + } + } \ No newline at end of file diff --git a/application/libraries/reports/Recapprojects.php b/application/libraries/reports/Recapprojects.php index 1fe139c..f02e711 100644 --- a/application/libraries/reports/Recapprojects.php +++ b/application/libraries/reports/Recapprojects.php @@ -18,6 +18,7 @@ class Recapprojects { private $employeeBudget; private $uniqueEmployee; private $uniqueEmployees; + private $currentFinancialYear; private $projectEmployeeDetail; private $projectEmployeeDetails; @@ -81,6 +82,8 @@ class Recapprojects { $this->setWorkInProgress(); + $this->setCurrentFinancialYear(); + $this->index ++; } } @@ -223,6 +226,11 @@ class Recapprojects { $this->projects[ $this->index ]['workInProgress'] = 0; } + private function setCurrentFinancialYear() + { + $this->currentFinancialYear = $this->project['current_financial_year']; + } + private function setInvoicedYears() { foreach ( $this->projects as $this->project ) diff --git a/application/models/eloquent/Page.php b/application/models/eloquent/Page.php index b86f20d..b57c1cf 100644 --- a/application/models/eloquent/Page.php +++ b/application/models/eloquent/Page.php @@ -44,5 +44,14 @@ class Page extends Eloquent { return $appPages; } + public static function getPageAccessByRoleLevel( $roleLevel ) + { + self::selectRaw( " + IF(id = page_id, 'MAIN', 'SUB') AS typepage, + IF((SELECT {$roleLevel} & pagelevel ) = 0, 'F', 'T') AS pageaccess" ) + ->orderByRaw( "id, IF(id = page_id, 0, 1)" ) + ->get(); + } + } \ No newline at end of file diff --git a/application/models/eloquent/Project.php b/application/models/eloquent/Project.php index 31a3426..2fddfc4 100644 --- a/application/models/eloquent/Project.php +++ b/application/models/eloquent/Project.php @@ -92,7 +92,7 @@ class Project extends BaseModel { public static function getActiveProjects() { - $projects = Project::selectRaw( "projects.id, YEAR(projects.startdate) AS instroom, YEAR(projects.enddate) AS uitstroom, projectnumber, + $projects = Project::selectRaw( "projects.id, YEAR(projects.startdate) AS instroom, YEAR(projects.enddate) AS uitstroom, projectnumber, current_financial_year, projectname, CUS.name, OFF.own_revenue, OFF.other_revenue" ) ->join( 'customers AS CUS', 'CUS.id', '=', 'projects.customer_id' ) ->join( 'offers AS OFF', 'OFF.project_id', '=', 'projects.id' ) diff --git a/application/models/eloquent/Role.php b/application/models/eloquent/Role.php index 06e585a..6dccc68 100644 --- a/application/models/eloquent/Role.php +++ b/application/models/eloquent/Role.php @@ -42,5 +42,19 @@ class Role extends BaseModel { return $roleHierarchy; } + public static function getPagesAccessByRole() + { + $roles = self::all(); + + foreach ( $roles as $role ) + { + $pageroles[ $role->id ]['rolelevel'] = $role->rolelevel; + $pageroles[ $role->id ]['rolename'] = $role->rolename; + + $pageroles[ $role->id ]['pagesAccess'] = + Page::getPageAccessByRoleLevel( $role->rolelevel ); + } + } + } \ No newline at end of file diff --git a/application/views/modals/offer_modal.php b/application/views/modals/offer_modal.php index b95dfbc..892d24a 100644 --- a/application/views/modals/offer_modal.php +++ b/application/views/modals/offer_modal.php @@ -152,7 +152,7 @@ event:{keyup:validateNumber}"> - eigen omzet (excl btw) + Eigen tarief omzet (excl btw)
| rol | + ++ + | + ++ + | + ++ + | + + +
|---|