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)
@@ -167,13 +167,13 @@ event:{keyup:validateNumber}">
- overige omzet (excl btw) + Overige kosten (excl btw)
diff --git a/application/views/modals/partials/_projectdashboard.php b/application/views/modals/partials/_projectdashboard.php index 5998cc4..5fe8200 100644 --- a/application/views/modals/partials/_projectdashboard.php +++ b/application/views/modals/partials/_projectdashboard.php @@ -103,21 +103,21 @@
- +

- +

- +

diff --git a/application/views/pages/authorisation_view.php b/application/views/pages/authorisation_view.php new file mode 100644 index 0000000..9736f85 --- /dev/null +++ b/application/views/pages/authorisation_view.php @@ -0,0 +1,28 @@ +
+
+
+ + + + + + + + + + + + + + + +
rol + +
+ + + +
+
+
+
\ No newline at end of file diff --git a/application/views/pages/projects_view.php b/application/views/pages/projects_view.php index 66f7a17..89a9162 100644 --- a/application/views/pages/projects_view.php +++ b/application/views/pages/projects_view.php @@ -5,9 +5,9 @@ projectleider klant start - eigen omzet - overige omzet - kosten + eigen tarief omzet + overige kosten + Kosten derden totaal   diff --git a/application/views/partials/_js.php b/application/views/partials/_js.php index ba91985..fe0f262 100644 --- a/application/views/partials/_js.php +++ b/application/views/partials/_js.php @@ -29,6 +29,7 @@ + @@ -67,6 +68,7 @@ + diff --git a/application/views/reports/monthlyemployeehours/euro_view.php b/application/views/reports/monthlyemployeehours/euro_view.php index e8e6d9f..f0a38ff 100644 --- a/application/views/reports/monthlyemployeehours/euro_view.php +++ b/application/views/reports/monthlyemployeehours/euro_view.php @@ -7,9 +7,6 @@
instroom
- -
uitstroom
-
naam
@@ -39,18 +36,18 @@
OWP
- -
+
Lopend boekjaar
+ + +
Volgend boekjaar
- - @@ -70,25 +67,20 @@ - - - - - - - - - - - - - - + + + + + + - totaal + totaal @@ -106,39 +98,13 @@ - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + diff --git a/public/css/correction.css b/public/css/correction.css index 33525f3..1da6923 100644 --- a/public/css/correction.css +++ b/public/css/correction.css @@ -1,3 +1,6 @@ +/* @override + http://dbois.local/css/correction.css?* */ + body{ padding-top:0; /*font-size:12px;*/ @@ -58,3 +61,7 @@ body{ color: #000; } +.form-control-xsm { + padding: 0px 3px; +} + diff --git a/public/css/main.css b/public/css/main.css index e946297..f7e66df 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -111,6 +111,10 @@ th.focus-green{ border-bottom: 1px solid red !important; } +.red-border{ + border: 2px solid red !important; +} + /*********SWITCH************/ .onoffswitch { position: relative; diff --git a/public/js/lib/dataservices/authorisationdataService.js b/public/js/lib/dataservices/authorisationdataService.js new file mode 100644 index 0000000..ccf09af --- /dev/null +++ b/public/js/lib/dataservices/authorisationdataService.js @@ -0,0 +1,20 @@ +/** + * Created by Pensare Software. + * User: Theo Weijmer + * Date: 20/06/2018 + * Time: 14:15 + */ + + +dbo.authorisationDataService = { + + getRoleAuthorisations: function ( callback ) { + $.getJSON( 'index.php/beheer/AuthorisationController/getRoleAuthorisations' ) + .done( function ( data ) { + callback( data ); + } ); + } + + +} + diff --git a/public/js/lib/dataservices/employeeTargetDataService.js b/public/js/lib/dataservices/employeeTargetDataService.js index ce8ac73..ae4d5d7 100644 --- a/public/js/lib/dataservices/employeeTargetDataService.js +++ b/public/js/lib/dataservices/employeeTargetDataService.js @@ -8,14 +8,14 @@ dbo.employeeTargetDataService = { getEmployeeTargets: function ( employeeID, callback ) { - $.getJSON( 'index.php/beheer/employeetargetController/getEmployeeTargets/' + employeeID ) + $.getJSON( 'index.php/beheer/employeeTargetController/getEmployeeTargets/' + employeeID ) .done( function ( data ) { callback( data ); } ); }, saveEmployeeTarget: function ( submitDATA, callback ) { - $.post( 'index.php/beheer/employeetargetController/saveEmployeeTarget', submitDATA, function () { + $.post( 'index.php/beheer/employeeTargetController/saveEmployeeTarget', submitDATA, function () { }, 'json' ) .done( function ( data ) { callback( data ); diff --git a/public/js/lib/dataservices/reportsDataService.js b/public/js/lib/dataservices/reportsDataService.js index 417ef57..3702d3f 100644 --- a/public/js/lib/dataservices/reportsDataService.js +++ b/public/js/lib/dataservices/reportsDataService.js @@ -27,6 +27,13 @@ dbo.reportsDataService = { .done( function ( data ) { callback( data ); } ); + }, + + saveCurrentFinnacialYear: function(projectID, amount, callback){ + $.post( 'index.php/reports/reportsController/saveCurrentFinnacialYear/' + projectID, {amount:amount} ) + .done( function ( data ) { + callback( data ); + }, 'json' ); } } \ No newline at end of file diff --git a/public/js/lib/modules/beheer/authorisationModule.js b/public/js/lib/modules/beheer/authorisationModule.js new file mode 100644 index 0000000..c111593 --- /dev/null +++ b/public/js/lib/modules/beheer/authorisationModule.js @@ -0,0 +1,37 @@ +/** + * Created by Pensare Software. + * User: Theo Weijmer + * Date: 20/06/2018 + * Time: 14:11 + */ + +dbo.authorisationInit = function () { + + if ( dbo.authorisationModel !== undefined ) { + + + } else { + dbo.authorisationModel = { + + roles : ko.observableArray([]) , + + init: function () { + var self = dbo.authorisationModel; + + self.refreshPageAuthorisations(); + }, + + refreshPageAuthorisations: function () { + dbo.authorisationDataService.getRoleAuthorisations( function ( data ) { + console.log( data ); + } ); + + } + + }; + + dbo.authorisationModel.init(); + + ko.applyBindings( dbo.authorisationModel, document.getElementById( 'AUTHORISATION' ) ); + } +}; \ No newline at end of file diff --git a/public/js/lib/modules/reports/monthlyEmployeeHoursModule.js b/public/js/lib/modules/reports/monthlyEmployeeHoursModule.js index f7d9a22..4872cfd 100644 --- a/public/js/lib/modules/reports/monthlyEmployeeHoursModule.js +++ b/public/js/lib/modules/reports/monthlyEmployeeHoursModule.js @@ -35,6 +35,8 @@ dbo.monthlyemployeehoursInit = function () { totalSaldo : ko.observable(), totalOwp : ko.observable(), totalWorkInProgress : ko.observable(), + totalCurrentFinancialYear : ko.observable(), + totalNextFinancialYear : ko.observable(), totalInvoicedYear : ko.observableArray( [] ), validYear : ko.observable( true ), @@ -62,6 +64,8 @@ dbo.monthlyemployeehoursInit = function () { vm.totalEmployeeHours( 0 ); vm.totalEmployeeAvailableHours( 0 ); vm.totalOwp( 0 ); + vm.totalCurrentFinancialYear( 0 ); + vm.totalNextFinancialYear( 0 ); vm.totalPerEmployee.removeAll(); vm.totalInvoicedYear.removeAll(); dbo.userDataService.getUniqueProjectEmployees( function ( data ) { @@ -300,6 +304,7 @@ dbo.monthlyemployeehoursInit = function () { var vm = dbo.monthlyEmployeeHoursModel; var self = this; + self.projectID = data.id self.projectnumber = data.projectnumber; self.instroom = data.instroom; self.uitstroom = data.uitstroom; @@ -309,7 +314,14 @@ dbo.monthlyemployeehoursInit = function () { self.hours = data.hours; self.totalEmpoloyeeRevenues = 0; self.availableRevenue = data.own_revenue - data.projectEuros; - self.owp = self.availableRevenue < 0 ? 0 : self.availableRevenue; + self.owpNumber = self.availableRevenue < 0 ? 0 : self.availableRevenue; + self.owp = self.owpNumber; + self.currentFinancialYear = ko.observable( data.current_financial_year ); + self.pristine = ko.observable( true ); + + self.nextFinancialYears = ko.pureComputed( function () { + return dbo.helpers.thousandSeparator( Number( self.owpNumber ) - Number( self.currentFinancialYear() ) ); + } ); self.externCosts = dbo.helpers.thousandSeparator( data.projectcosts ); self.budget = dbo.helpers.thousandSeparator( data.budget ); self.ownRevenue = dbo.helpers.thousandSeparator( data.own_revenue ); @@ -393,11 +405,53 @@ dbo.monthlyemployeehoursInit = function () { this.hours = data.hours; this.budget = data.budget; this.availableHours = data.availableHours; + }, + + saveCurrentFinancialYear: function () { + var self = this; + self.pristine( false ); + + self.currentFinancialYear( dbo.helpers.validateNumber( self.currentFinancialYear() ) ); + + if ( timeout ) { + clearTimeout( timeout ); + timeout = null; + } + timeout = setTimeout( function () { + if ( self.currentFinancialYear().length == 0 ) self.currentFinancialYear( 0 ); + + dbo.reportsDataService.saveCurrentFinnacialYear( + self.projectID, self.currentFinancialYear(), function () { + self.pristine( true ); + } ); + }, 400 ); + } }; dbo.monthlyEmployeeHoursModel.init(); + + dbo.monthlyEmployeeHoursModel.totalCurrentFinancialYear = ko.pureComputed( function () { + var totalCurrentFinancialYear = 0 + var vm = dbo.monthlyEmployeeHoursModel; + _.each( vm.recap(), function ( p ) { + totalCurrentFinancialYear += Number( p.currentFinancialYear() ); + } ); + + return dbo.helpers.thousandSeparator( totalCurrentFinancialYear ); + } ); + + dbo.monthlyEmployeeHoursModel.totalNextFinancialYear = ko.pureComputed( function () { + var totalNextFinancialYear = 0 + var vm = dbo.monthlyEmployeeHoursModel; + _.each( vm.recap(), function ( p ) { + totalNextFinancialYear += Number( p.owpNumber ) - Number( p.currentFinancialYear() ); + } ); + + return dbo.helpers.thousandSeparator( totalNextFinancialYear ); + } ); + ko.applyBindings( dbo.monthlyEmployeeHoursModel, document.getElementById( "MONTHLYEMPLOYEEHOURS" ) ); }