From 3f2fffd1d4e0eae3ac4357eed63f48b4108a5f76 Mon Sep 17 00:00:00 2001 From: Theo Weijmer Date: Sun, 18 Feb 2018 21:00:07 +0100 Subject: [PATCH] rapport 1 --- application/models/eloquent/Projecthour.php | 15 ++ .../views/pages/monthlyemployeehours_view.php | 22 ++- ...ployee_view.php => _employeehour_view.php} | 10 +- .../_employeerevenue_view.php | 146 ++++++++++++++++++ public/css/main.css | 15 ++ .../reports/monthlyEmployeeHoursModule.js | 83 +++++++++- 6 files changed, 279 insertions(+), 12 deletions(-) rename application/views/reports/monthlyemployeehours/{employee_view.php => _employeehour_view.php} (95%) create mode 100644 application/views/reports/monthlyemployeehours/_employeerevenue_view.php diff --git a/application/models/eloquent/Projecthour.php b/application/models/eloquent/Projecthour.php index 153cf76..33dc5d4 100644 --- a/application/models/eloquent/Projecthour.php +++ b/application/models/eloquent/Projecthour.php @@ -40,9 +40,24 @@ class Projecthour extends BaseModel { SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-10', projecthours.hours, 0)) AS oktober, SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-11', projecthours.hours, 0)) AS november, SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-12', projecthours.hours, 0)) AS december, + SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-1', projecthours.hours * tarif, 0)) AS januariRevenue, + SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-2', projecthours.hours * tarif, 0)) AS februariRevenue, + SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-3', projecthours.hours * tarif, 0)) AS maartRevenue, + SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-4', projecthours.hours * tarif, 0)) AS aprilRevenue, + SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-5', projecthours.hours * tarif, 0)) AS meiRevenue, + SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-6', projecthours.hours * tarif, 0)) AS juniRevenue, + SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-7', projecthours.hours * tarif, 0)) AS juliRevenue, + SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-8', projecthours.hours * tarif, 0)) AS augustusRevenue, + SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-9', projecthours.hours * tarif, 0)) AS septemberRevenue, + SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-10', projecthours.hours * tarif, 0)) AS oktoberRevenue, + SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-11', projecthours.hours * tarif, 0)) AS novemberRevenue, + SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-12', projecthours.hours * tarif, 0)) AS decemberRevenue, SUM(IF(YEAR(hourdate) = {$year},projecthours.hours, 0)) AS totalyear, SUM(IF(YEAR(hourdate) != {$year},projecthours.hours, 0)) AS totalotheryears, + SUM(IF(YEAR(hourdate) = {$year},projecthours.hours * tarif, 0)) AS totalyearRevenue, + SUM(IF(YEAR(hourdate) != {$year},projecthours.hours * tarif, 0)) AS totalotheryearsRevenue, SUM(projecthours.hours) AS totalhours, + SUM(projecthours.hours * tarif) AS totalhoursRevenue, PEM.tarif, PRJ.projectname" ) ->join( 'projectemployees AS PEM', 'PEM.id', '=', 'projecthours.projectemployee_id' ) diff --git a/application/views/pages/monthlyemployeehours_view.php b/application/views/pages/monthlyemployeehours_view.php index 615ce33..711a5ad 100644 --- a/application/views/pages/monthlyemployeehours_view.php +++ b/application/views/pages/monthlyemployeehours_view.php @@ -41,7 +41,27 @@
- load->view('reports/monthlyemployeehours/employee_view'); ?> +
+
+
+ + +
+
+
+ + load->view('reports/monthlyemployeehours/_employeehour_view'); ?> + + + load->view('reports/monthlyemployeehours/_employeerevenue_view'); ?> +
diff --git a/application/views/reports/monthlyemployeehours/employee_view.php b/application/views/reports/monthlyemployeehours/_employeehour_view.php similarity index 95% rename from application/views/reports/monthlyemployeehours/employee_view.php rename to application/views/reports/monthlyemployeehours/_employeehour_view.php index 948646e..2fec6ec 100644 --- a/application/views/reports/monthlyemployeehours/employee_view.php +++ b/application/views/reports/monthlyemployeehours/_employeehour_view.php @@ -1,6 +1,6 @@
-

uren per project

+

uren per project

@@ -119,13 +119,13 @@ @@ -144,3 +144,5 @@ + + diff --git a/application/views/reports/monthlyemployeehours/_employeerevenue_view.php b/application/views/reports/monthlyemployeehours/_employeerevenue_view.php new file mode 100644 index 0000000..00bfbcd --- /dev/null +++ b/application/views/reports/monthlyemployeehours/_employeerevenue_view.php @@ -0,0 +1,146 @@ +
+
+

omzet per project

+
- + - + - +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
projecttariefjanfebmrtaprmeijunijuliaugsepoktnovdectot jaartot overiggrand total
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
totaal  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+ +
+
+
+
+ +
+
+
diff --git a/public/css/main.css b/public/css/main.css index 712efc5..e176322 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -121,6 +121,13 @@ color: #FFFFFF; } +.onoffswitch-inner-euro:before { + content: "u"; + padding-left: 10px; + background-color: #63BE62; + color: #FFFFFF; +} + .onoffswitch-inner:after { content: "nee"; padding-right: 10px; @@ -129,6 +136,14 @@ text-align: right; } +.onoffswitch-inner-euro:after { + content: "€"; + padding-right: 10px; + background-color: #EEEEEE; + color: #999999; + text-align: right; +} + .onoffswitch-switch { display: block; width: 25px; diff --git a/public/js/lib/modules/reports/monthlyEmployeeHoursModule.js b/public/js/lib/modules/reports/monthlyEmployeeHoursModule.js index d631cb1..24cbf66 100644 --- a/public/js/lib/modules/reports/monthlyEmployeeHoursModule.js +++ b/public/js/lib/modules/reports/monthlyEmployeeHoursModule.js @@ -69,8 +69,23 @@ dbo.monthlyemployeehoursInit = function () { vm.currentTab.totalDecember( 0 ); vm.currentTab.totalTotal( 0 ); vm.currentTab.totalTotalOtheryears( 0 ); - var totalHoursChart = []; - var projectChart = []; + vm.currentTab.totalJanuariRevenue( 0 ); + vm.currentTab.totalFebruariRevenue( 0 ); + vm.currentTab.totalMaartRevenue( 0 ); + vm.currentTab.totalAprilRevenue( 0 ); + vm.currentTab.totalMeiRevenue( 0 ); + vm.currentTab.totalJuniRevenue( 0 ); + vm.currentTab.totalJuliRevenue( 0 ); + vm.currentTab.totalAugustusRevenue( 0 ); + vm.currentTab.totalSeptemberRevenue( 0 ); + vm.currentTab.totalOktoberRevenue( 0 ); + vm.currentTab.totalNovemberRevenue( 0 ); + vm.currentTab.totalDecemberRevenue( 0 ); + vm.currentTab.totalTotalRevenue( 0 ); + vm.currentTab.totalTotalOtheryearsRevenue( 0 ); + vm.currentTab.totalHoursChart = []; + vm.currentTab.totalHoursRevenueChart = []; + vm.currentTab.projectChart = []; $.each( vm.currentTab.myData(), function ( i, q ) { vm.currentTab.tarif( q.tarif ); vm.currentTab.totalJanuari( vm.currentTab.totalJanuari() + q.januari ); @@ -87,15 +102,50 @@ dbo.monthlyemployeehoursInit = function () { vm.currentTab.totalDecember( vm.currentTab.totalDecember() + q.december ); vm.currentTab.totalTotal( vm.currentTab.totalTotal() + q.totalyear ); vm.currentTab.totalTotalOtheryears( vm.currentTab.totalTotalOtheryears() + q.totalotheryears ); - totalHoursChart.push(q.totalhours); - projectChart.push(q.projectname) + + + vm.currentTab.totalJanuariRevenue( vm.currentTab.totalJanuariRevenue() + q.januariRevenue ); + vm.currentTab.totalFebruariRevenue( vm.currentTab.totalFebruariRevenue() + q.februariRevenue ); + vm.currentTab.totalMaartRevenue( vm.currentTab.totalMaartRevenue() + q.maartRevenue ); + vm.currentTab.totalAprilRevenue( vm.currentTab.totalAprilRevenue() + q.aprilRevenue ); + vm.currentTab.totalMeiRevenue( vm.currentTab.totalMeiRevenue() + q.meiRevenue ); + vm.currentTab.totalJuniRevenue( vm.currentTab.totalJuniRevenue() + q.juniRevenue ); + vm.currentTab.totalJuliRevenue( vm.currentTab.totalJuliRevenue() + q.juliRevenue ); + vm.currentTab.totalAugustusRevenue( vm.currentTab.totalAugustusRevenue() + q.augustusRevenue ); + vm.currentTab.totalSeptemberRevenue( vm.currentTab.totalSeptemberRevenue() + q.septemberRevenue ); + vm.currentTab.totalOktoberRevenue( vm.currentTab.totalOktoberRevenue() + q.oktoberRevenue ); + vm.currentTab.totalNovemberRevenue( vm.currentTab.totalNovemberRevenue() + q.novemberRevenue ); + vm.currentTab.totalDecemberRevenue( vm.currentTab.totalDecemberRevenue() + q.decemberRevenue ); + vm.currentTab.totalTotalRevenue( vm.currentTab.totalTotalRevenue() + q.totalyearRevenue ); + vm.currentTab.totalTotalOtheryearsRevenue( vm.currentTab.totalTotalOtheryearsRevenue() + q.totalotheryearsRevenue ); + + vm.currentTab.projectChart.push( q.projectname ); + vm.currentTab.totalHoursChart.push( q.totalhours ); + vm.currentTab.totalHoursRevenueChart.push( q.totalhoursRevenue ); } ); - var 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()] - dbo.charts.drawHoursChart( 'hours-per-month-' + vm.currentTab.slug, chartData, dbo.charts.monthLabels, 'uren per maand', '#f28f25' ); - dbo.charts.drawHoursChart( 'hours-per-project-' + vm.currentTab.slug, totalHoursChart, projectChart, 'uren per project', '#0daef0' ); + 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 ); } ); }, + drawCharts: function ( self ) { + if ( self.hourView() ) { + dbo.charts.drawHoursChart( 'hours-per-month-' + self.slug, self.chartData, dbo.charts.monthLabels, 'uren per maand', '#f28f25' ); + dbo.charts.drawHoursChart( 'hours-per-project-' + self.slug, self.totalHoursChart, self.projectChart, 'uren per project', '#0daef0' ); + } else { + dbo.charts.drawHoursChart( 'revenue-per-month-' + self.slug, self.chartRevenueData, dbo.charts.monthLabels, 'omzet per maand', '#f28f25' ); + dbo.charts.drawHoursChart( 'revenue-per-project-' + self.slug, self.totalHoursRevenueChart, self.projectChart, 'omzet per project', '#0daef0' ); + } + }, + + toggleHourView: function () { + this.hourView( !this.hourView() ); + + dbo.monthlyEmployeeHoursModel.drawCharts( this ); + }, + setActivetab: function ( tab ) { var vm = dbo.monthlyEmployeeHoursModel; @@ -136,6 +186,25 @@ dbo.monthlyemployeehoursInit = function () { self.totalOtheryears = ko.observable( 0 ); self.totalTotalOtheryears = ko.observable( 0 ); + + self.totalJanuariRevenue = ko.observable( 0 ); + self.totalFebruariRevenue = ko.observable( 0 ); + self.totalMaartRevenue = ko.observable( 0 ); + self.totalAprilRevenue = ko.observable( 0 ); + self.totalMeiRevenue = ko.observable( 0 ); + self.totalJuniRevenue = ko.observable( 0 ); + self.totalJuliRevenue = ko.observable( 0 ); + self.totalAugustusRevenue = ko.observable( 0 ); + self.totalSeptemberRevenue = ko.observable( 0 ); + self.totalOktoberRevenue = ko.observable( 0 ); + self.totalNovemberRevenue = ko.observable( 0 ); + self.totalDecemberRevenue = ko.observable( 0 ); + self.totalTotalRevenue = ko.observable( 0 ); + self.totalOtheryearsRevenue = ko.observable( 0 ); + self.totalTotalOtheryearsRevenue = ko.observable( 0 ); + + self.hourView = ko.observable( true ); + self.myData = ko.observableArray( [] ); },