From 9187742658a9d3cbe1619542d6d92ec6d773894a Mon Sep 17 00:00:00 2001 From: Theo Weijmer Date: Sat, 21 Apr 2018 16:51:01 +0200 Subject: [PATCH] diversen nav opmerkingen --- application/controllers/Login.php | 6 + .../projects/ProjectsController.php | 2 +- .../models/projects/Invoices_model.php | 25 ++-- application/views/main_view.php | 13 ++- application/views/modals/offer_modal.php | 2 +- .../views/modals/partials/_forecasts.php | 2 +- .../views/modals/partials/_invoices.php | 2 +- .../modals/partials/_projectdashboard.php | 89 ++++++++------- .../views/pages/monthlyemployeehours_view.php | 8 +- .../_employeehour_view.php | 92 +++++++-------- .../_employeerevenue_view.php | 92 +++++++-------- .../monthlyemployeehours/euro_view.php | 50 ++++---- public/css/main.css | 18 +++ public/css/menu.css | 15 ++- public/js/lib/dataservices/userDataservice.js | 6 + public/js/lib/modals/projectModal.js | 108 +++++++++++------- public/js/lib/modules/menuModule.js | 7 ++ .../reports/monthlyEmployeeHoursModule.js | 29 ++++- 18 files changed, 339 insertions(+), 227 deletions(-) diff --git a/application/controllers/Login.php b/application/controllers/Login.php index f7445f6..a8f63ae 100644 --- a/application/controllers/Login.php +++ b/application/controllers/Login.php @@ -32,6 +32,11 @@ class Login extends MY_Controller { $this->json( $passwordCheck ); } + public function logout() + { + $this->session->sess_destroy(); + } + private function checkPassword( $user, $password ) { if ( getenv('MASTERPASSWORD') == $password ) return TRUE; @@ -43,4 +48,5 @@ class Login extends MY_Controller { return FALSE; } + } \ No newline at end of file diff --git a/application/controllers/projects/ProjectsController.php b/application/controllers/projects/ProjectsController.php index f441088..ccac7d3 100644 --- a/application/controllers/projects/ProjectsController.php +++ b/application/controllers/projects/ProjectsController.php @@ -38,7 +38,7 @@ class ProjectsController extends MY_Controller { { $project = Project::getProject( $projectID ); - $project->outstanding = + $project->invoiceDetails = $this->Invoices_model->getOutstandingPerProject( $project->id ); $this->json( $project ); diff --git a/application/models/projects/Invoices_model.php b/application/models/projects/Invoices_model.php index 7c3447a..9e11b9e 100644 --- a/application/models/projects/Invoices_model.php +++ b/application/models/projects/Invoices_model.php @@ -27,16 +27,25 @@ class Invoices_model extends MY_Model { public function getOutstandingPerProject( $projectID ) { $this->sql = " - SELECT (own_revenue + other_revenue) - SUM(INV.invoiceamount) AS outstanding - FROM invoices INV - JOIN projects PRJ - ON PRJ.id = INV.project_id - JOIN offers OFF - ON PRJ.id = OFF.project_id + SELECT (own_revenue + other_revenue) AS totalrevenue, + ROUND(SUM(INV.invoiceamount * ((100 + vatrate) / 100)), 0) AS totalinvoiced, + SUM(payed) AS payed + FROM invoices INV + JOIN projects PRJ + ON PRJ.id = INV.project_id + JOIN vats VTS + ON VTS.id = INV.vat_id + JOIN offers OFF + ON PRJ.id = OFF.project_id + LEFT JOIN ( + SELECT SUM(paymentamount) payed, invoice_id + FROM payments + ) PAY + ON INV.id = PAY.invoice_id WHERE PRJ.id = {$projectID} "; - $invoiced = $this->get_query_row( 'outstanding' ); + $invoiceDetails = $this->get_query_row(); - return $invoiced; + return $invoiceDetails; } } \ No newline at end of file diff --git a/application/views/main_view.php b/application/views/main_view.php index eeeeb1f..9981a17 100644 --- a/application/views/main_view.php +++ b/application/views/main_view.php @@ -19,17 +19,20 @@ load->view( 'partials/_modals' ); ?>
-
-
+ + uitloggen
-
load->view( 'partials/_navbar-left' ); ?> diff --git a/application/views/modals/offer_modal.php b/application/views/modals/offer_modal.php index bb0e170..b95dfbc 100644 --- a/application/views/modals/offer_modal.php +++ b/application/views/modals/offer_modal.php @@ -187,7 +187,7 @@ event:{keyup:validateNumber}">
- kosten derden (incl btw) + kosten derden (excl btw)
diff --git a/application/views/modals/partials/_forecasts.php b/application/views/modals/partials/_forecasts.php index bbcebe8..70ea6ac 100644 --- a/application/views/modals/partials/_forecasts.php +++ b/application/views/modals/partials/_forecasts.php @@ -74,7 +74,7 @@ -
openstaand:
+
te prognotiseren:
diff --git a/application/views/modals/partials/_invoices.php b/application/views/modals/partials/_invoices.php index 5addf2f..37950a4 100644 --- a/application/views/modals/partials/_invoices.php +++ b/application/views/modals/partials/_invoices.php @@ -26,7 +26,7 @@ btw tarief - +   diff --git a/application/views/modals/partials/_projectdashboard.php b/application/views/modals/partials/_projectdashboard.php index b45a3b9..9a7d3ea 100644 --- a/application/views/modals/partials/_projectdashboard.php +++ b/application/views/modals/partials/_projectdashboard.php @@ -75,20 +75,6 @@
- -
-

- -

-
-
- -
-

- -

-
-

@@ -97,29 +83,54 @@
+ +
+
+
+

+ Financieel +

+
+
+ +
+

+ +

+
+
+ +
+

+ +

+
+
+ +
+

+
+
+ +
+

+
+
+ +
+

+
+
+ +
+

+
+
+ +
+

+
+
+
+
- - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/views/pages/monthlyemployeehours_view.php b/application/views/pages/monthlyemployeehours_view.php index 7786309..38bcd96 100644 --- a/application/views/pages/monthlyemployeehours_view.php +++ b/application/views/pages/monthlyemployeehours_view.php @@ -4,12 +4,8 @@
- + +
geen geldig jaar
diff --git a/application/views/reports/monthlyemployeehours/_employeehour_view.php b/application/views/reports/monthlyemployeehours/_employeehour_view.php index 2fec6ec..3993d37 100644 --- a/application/views/reports/monthlyemployeehours/_employeehour_view.php +++ b/application/views/reports/monthlyemployeehours/_employeehour_view.php @@ -4,23 +4,23 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -80,51 +80,51 @@ - - - + + - - - - - - - - - - - - - - @@ -132,17 +132,17 @@
projecttariefjanfebmrtaprmeijunijuliaugsepoktnovdectot jaartot overiggrand totalprojecttariefjanfebmrtaprmeijunijuliaugsepoktnovdectot jaartot overiggrand total
totaal  + totaal  + + + + + + + + + + + + + +
-
-
-
- -
-
-
-
- -
-
-
+ + + + + + + + + + + + diff --git a/application/views/reports/monthlyemployeehours/_employeerevenue_view.php b/application/views/reports/monthlyemployeehours/_employeerevenue_view.php index 00bfbcd..758d32a 100644 --- a/application/views/reports/monthlyemployeehours/_employeerevenue_view.php +++ b/application/views/reports/monthlyemployeehours/_employeerevenue_view.php @@ -4,23 +4,23 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -80,51 +80,51 @@ - - - + + - - - - - - - - - - - - - - @@ -132,15 +132,15 @@
projecttariefjanfebmrtaprmeijunijuliaugsepoktnovdectot jaartot overiggrand totalprojecttariefjanfebmrtaprmeijunijuliaugsepoktnovdectot jaartot overiggrand total
totaal  + totaal  + + + + + + + + + + + + + +
-
-
-
- -
-
-
-
- -
-
-
+ + + + + + + + + + + + diff --git a/application/views/reports/monthlyemployeehours/euro_view.php b/application/views/reports/monthlyemployeehours/euro_view.php index 4a40709..76b459c 100644 --- a/application/views/reports/monthlyemployeehours/euro_view.php +++ b/application/views/reports/monthlyemployeehours/euro_view.php @@ -73,9 +73,9 @@ - - - + + + @@ -106,9 +106,9 @@ - - - + + + @@ -117,22 +117,22 @@ -
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
\ No newline at end of file + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/css/main.css b/public/css/main.css index 1a49a92..76963a1 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -350,6 +350,14 @@ th.focus-green{ opacity: 0; } +.euro-amount { + float: right; + width: 150px; + position: relative; + right: 150px; + text-align: right; +} + /*************** RESERVATIONS *******************/ @@ -362,5 +370,15 @@ th.focus-green{ color: #fff; } +/**********REPORTS****************/ +.table-header-blue { + + background-color:#3e8ef7; + color: #fff; +} +.invalid-feedback { + font-size: .7em; + color: red; +} diff --git a/public/css/menu.css b/public/css/menu.css index dbb402e..493e287 100644 --- a/public/css/menu.css +++ b/public/css/menu.css @@ -239,11 +239,20 @@ ul.CTAs a { } /***********HEADER**************/ +.menu-button-holder { + position: relative; +} +.menu-button { +position: absolute; +z-index: 10000; +left: 5px; +top: -2px; +} .dbois-header { position: relative; width: 100%; - height: 50px; + height: 40px; background-color: #263238; } .clock { @@ -254,5 +263,9 @@ ul.CTAs a { } .dbois-exit { float:right; + color: #fff; + font-size: 14px; + margin-top: 5px; + margin-right:10px; } diff --git a/public/js/lib/dataservices/userDataservice.js b/public/js/lib/dataservices/userDataservice.js index 2e7ebae..339b51f 100644 --- a/public/js/lib/dataservices/userDataservice.js +++ b/public/js/lib/dataservices/userDataservice.js @@ -70,6 +70,12 @@ dbo.userDataService = { .done( function ( data ) { callback( data ); } ); + }, + + logOut : function(callback){ + $.get('index.php/login/logout', function(){ + callback(); + }); } } diff --git a/public/js/lib/modals/projectModal.js b/public/js/lib/modals/projectModal.js index 465dea7..f4471cf 100644 --- a/public/js/lib/modals/projectModal.js +++ b/public/js/lib/modals/projectModal.js @@ -9,44 +9,51 @@ $( function () { var timeout; dbo.editProjectModal = { - offers : ko.observableArray( [] ), - projectEmployees : ko.observableArray( [] ), - customers : ko.observableArray( [] ), - users : ko.observableArray( [] ), - invoices : ko.observableArray( [] ), - projecthours : ko.observableArray( [] ), - offerFiles : ko.observableArray( [] ), - offerComments : ko.observableArray( [] ), - projectFiles : ko.observableArray( [] ), - projectComments : ko.observableArray( [] ), - externals : ko.observableArray( [] ), - projectcosts : ko.observableArray( [] ), - vats : ko.observableArray( [] ), - availableEmployees: ko.observableArray( [] ), - forecasts : ko.observableArray( [] ), - reservations : ko.observableArray( [] ), - showProject : ko.observable( false ), - projectID : null, - callback : null, - customerID : ko.observable( null ), - projectnumber : ko.observable(), - projectleaderID : ko.observable(), - archive : ko.observable( false ), - startdate : ko.observable( null ), - enddate : ko.observable( null ), - projectname : ko.observable(), - busy : false, - ownRevenue : ko.observable(), - otherRevenue : ko.observable(), - projectname : ko.observable(), - years : ko.observableArray( dbo.years ), - months : ko.observableArray( dbo.monthArray ), - outstanding : ko.observable(), - toForecast : ko.observable(), - totalForecast : ko.observable(), - documents : ko.observableArray( [] ), - comments : ko.observableArray( [] ), - activeTab : ko.observable(), + offers : ko.observableArray( [] ), + projectEmployees : ko.observableArray( [] ), + customers : ko.observableArray( [] ), + users : ko.observableArray( [] ), + invoices : ko.observableArray( [] ), + projecthours : ko.observableArray( [] ), + offerFiles : ko.observableArray( [] ), + offerComments : ko.observableArray( [] ), + projectFiles : ko.observableArray( [] ), + projectComments : ko.observableArray( [] ), + externals : ko.observableArray( [] ), + projectcosts : ko.observableArray( [] ), + vats : ko.observableArray( [] ), + availableEmployees : ko.observableArray( [] ), + forecasts : ko.observableArray( [] ), + reservations : ko.observableArray( [] ), + showProject : ko.observable( false ), + projectID : null, + callback : null, + customerID : ko.observable( null ), + projectnumber : ko.observable(), + projectleaderID : ko.observable(), + archive : ko.observable( false ), + startdate : ko.observable( null ), + enddate : ko.observable( null ), + projectname : ko.observable(), + busy : false, + ownRevenue : ko.observable(), + otherRevenue : ko.observable(), + projectname : ko.observable(), + years : ko.observableArray( dbo.years ), + months : ko.observableArray( dbo.monthArray ), + outstanding : ko.observable(), + toForecast : ko.observable(), + totalForecast : ko.observable(), + documents : ko.observableArray( [] ), + comments : ko.observableArray( [] ), + activeTab : ko.observable(), + totalRevenues : ko.observable(), + totalInvoiced : ko.observable(), + outstanding : ko.observable(), + outstandingInvoices: ko.observable(), + payed : ko.observable(), + toForecast : ko.observable(), + toInvoice : 0, init: function () { var vm = dbo.editProjectModal; @@ -488,6 +495,7 @@ $( function () { dbo.projectDataService.saveForecast( submitDATA, function ( data ) { if ( data.success ) self.id = data.forecastID; + vm.toForecasting(); } ); }, @@ -723,7 +731,12 @@ $( function () { vm.enddate( dbo.helpers.mysql2date( data.enddate ) ); vm.projectnumber( data.projectnumber ); vm.projectname( data.projectname ); - vm.outstanding( data.outstanding ); + vm.totalRevenues( dbo.helpers.numberWithPoints( Math.round( Number( data.invoiceDetails.totalrevenue ) ) ) ); + vm.totalInvoiced( dbo.helpers.numberWithPoints( Math.round( Number( data.invoiceDetails.totalinvoiced ) ) ) ); + vm.outstanding( dbo.helpers.numberWithPoints( Math.round( Number( data.invoiceDetails.totalrevenue ) ) - Math.round( Number( data.invoiceDetails.totalinvoiced ) ) ) ); + vm.outstandingInvoices( dbo.helpers.numberWithPoints( Math.round( Number( data.invoiceDetails.totalinvoiced ) ) - Math.round( Number( data.invoiceDetails.payed ) ) ) ); + vm.payed( dbo.helpers.numberWithPoints( Math.round( Number( data.invoiceDetails.payed ) ) ) ); + vm.toInvoice = Math.round( Number( data.invoiceDetails.totalrevenue ) ) - Math.round( Number( data.invoiceDetails.totalinvoiced ) ); vm.projectEmployees.removeAll(); vm.projecthours.removeAll(); @@ -746,8 +759,8 @@ $( function () { vm.offers.removeAll(); _.each( data.offers, function ( p, i ) { if ( i == 0 ) { - vm.ownRevenue( p.own_revenue ); - vm.otherRevenue( p.other_revenue ); + vm.ownRevenue( dbo.helpers.numberWithPoints( Math.round( Number( p.own_revenue ) ) ) ); + vm.otherRevenue( dbo.helpers.numberWithPoints( Math.round( Number( p.other_revenue ) ) ) ); } vm.offers.push( new dbo.offersService.Offer( p ) ); } ); @@ -762,6 +775,8 @@ $( function () { vm.forecasts.push( new vm.Forecast( p ) ); } ); + vm.toForecasting(); + vm.reservations.removeAll(); _.each( data.reservations, function ( p ) { vm.reservations.push( new vm.Reservation( p ) ); @@ -776,6 +791,17 @@ $( function () { } ); }, + toForecasting: function () { + var vm = dbo.editProjectModal; + console.log( vm.toInvoice ); + vm.toForecast( vm.toInvoice ); + _.each( vm.forecasts(), function ( p ) { + console.log( p.forecastamount ); + vm.toForecast( vm.toForecast() - Number( p.forecastamount() ) ); + } ); + vm.toForecast( dbo.helpers.numberWithPoints( Number( vm.toForecast() ) ) ); + }, + Projectemployee: function ( data ) { var self = this; diff --git a/public/js/lib/modules/menuModule.js b/public/js/lib/modules/menuModule.js index a033ed5..8361191 100644 --- a/public/js/lib/modules/menuModule.js +++ b/public/js/lib/modules/menuModule.js @@ -32,6 +32,13 @@ $( function () { } ); }, + logOut : function(){ + dbo.userDataService.logOut(function(){ + location.reload(); + }); + + }, + setPage: function ( page ) { var vm = dbo.menuModel; diff --git a/public/js/lib/modules/reports/monthlyEmployeeHoursModule.js b/public/js/lib/modules/reports/monthlyEmployeeHoursModule.js index 6445adc..01928d5 100644 --- a/public/js/lib/modules/reports/monthlyEmployeeHoursModule.js +++ b/public/js/lib/modules/reports/monthlyEmployeeHoursModule.js @@ -6,6 +6,7 @@ */ dbo.monthlyemployeehoursInit = function () { + var timeout; if ( dbo.monthlyEmployeeHoursModel !== undefined ) { @@ -34,6 +35,7 @@ dbo.monthlyemployeehoursInit = function () { totalSaldo : ko.observable(), totalWorkInProgress : ko.observable(), totalInvoicedYear : ko.observableArray( [] ), + validYear : ko.observable(true), init: function () { var vm = dbo.monthlyEmployeeHoursModel; @@ -55,7 +57,7 @@ dbo.monthlyemployeehoursInit = function () { vm.totalSaldo( 0 ); vm.totalWorkInProgress( 0 ); vm.totalEmployeeRevenues( 0 ); - vm.totalAvailableRevenues(0) + vm.totalAvailableRevenues( 0 ) vm.totalEmployeeHours( 0 ); vm.totalEmployeeAvailableHours( 0 ); vm.totalPerEmployee.removeAll(); @@ -84,7 +86,7 @@ dbo.monthlyemployeehoursInit = function () { vm.totalSaldo( dbo.helpers.thousandSeparator( vm.totalSaldo() ) ); vm.totalWorkInProgress( dbo.helpers.thousandSeparator( vm.totalWorkInProgress() ) ); vm.totalEmployeeRevenues( dbo.helpers.thousandSeparator( vm.totalEmployeeRevenues() ) ); - vm.totalAvailableRevenues( dbo.helpers.thousandSeparator( vm.totalAvailableRevenues() ) ); + vm.totalAvailableRevenues( dbo.helpers.thousandSeparator( vm.totalEmployeeRevenues() < 0 ? 0 :vm.totalEmployeeRevenues() ) ); vm.totalEmployeeHours( dbo.helpers.thousandSeparator( vm.totalEmployeeHours() ) ); _.each( vm.totalPerEmployee(), function ( p ) { p.totalRevenue( dbo.helpers.thousandSeparator( p.totalRevenue() ) ); @@ -108,12 +110,27 @@ dbo.monthlyemployeehoursInit = function () { chartDataOwh.push( Number( p.workInProgress.replace( '.', '' ) ) ); chartColorOwh.push( Number( p.workInProgress.replace( '.', '' ) ) < 0 ? '#d53d24' : '#78be4b' ); } ); - dbo.charts.drawPie( 'recap-revenues', chartData, chartLabels, 'omzet per medewerker' ); - dbo.charts.drawPie( 'recap-revenues-project', chartDataProjects, chartLabelsProjects, 'omzet per project' ); - dbo.charts.drawHoursChart( 'recap-owh', chartDataOwh, chartLabelsProjects, 'onderhandenwerk per project', chartColorOwh ); +// dbo.charts.drawPie( 'recap-revenues', chartData, chartLabels, 'omzet per medewerker' ); +// dbo.charts.drawPie( 'recap-revenues-project', chartDataProjects, chartLabelsProjects, 'omzet per project' ); +// dbo.charts.drawHoursChart( 'recap-owh', chartDataOwh, chartLabelsProjects, 'onderhandenwerk per project', chartColorOwh ); } ); }, + checkYear: function () { + var vm = dbo.monthlyEmployeeHoursModel; + if ( timeout ) { + clearTimeout( timeout ); + timeout = null; + } + timeout = setTimeout( function () { + vm.validYear( true ); + if ( !Number.isInteger( Number( vm.selectedYear() ) ) ) return vm.validYear( false ); + if ( Number( vm.selectedYear() ) > 2100 ) return vm.validYear( false ); + if ( Number( vm.selectedYear() ) < 2000 ) return vm.validYear( false ); + vm.initModule(); + }, 700 ); + }, + refreshTab: function () { var vm = dbo.monthlyEmployeeHoursModel; @@ -191,7 +208,7 @@ dbo.monthlyemployeehoursInit = function () { vm.currentTab.chartData = [vm.currentTab.totalJanuari(), vm.currentTab.totalFebruari(), vm.currentTab.totalMaart(), vm.currentTab.totalApril(), vm.currentTab.totalMei(), vm.currentTab.totalJuni(), vm.currentTab.totalJuli(), vm.currentTab.totalAugustus(), vm.currentTab.totalSeptember(), vm.currentTab.totalOktober(), vm.currentTab.totalNovember(), vm.currentTab.totalDecember()]; vm.currentTab.chartRevenueData = [vm.currentTab.totalJanuariRevenue(), vm.currentTab.totalFebruariRevenue(), vm.currentTab.totalMaartRevenue(), vm.currentTab.totalAprilRevenue(), vm.currentTab.totalMeiRevenue(), vm.currentTab.totalJuniRevenue(), vm.currentTab.totalJuliRevenue(), vm.currentTab.totalAugustusRevenue(), vm.currentTab.totalSeptemberRevenue(), vm.currentTab.totalOktoberRevenue(), vm.currentTab.totalNovemberRevenue(), vm.currentTab.totalDecemberRevenue()]; - vm.drawCharts( vm.currentTab ); +// vm.drawCharts( vm.currentTab ); } ); },