diff --git a/application/controllers/reports/EmployeeHoursController.php b/application/controllers/reports/EmployeeHoursController.php
index df900cb..0bbf2b3 100644
--- a/application/controllers/reports/EmployeeHoursController.php
+++ b/application/controllers/reports/EmployeeHoursController.php
@@ -54,4 +54,15 @@ class EmployeeHoursController extends MY_Controller {
$this->json( $result );
}
+ public function getInvoiceOverview( $year )
+ {
+ $sql = Qinvoiceoverview::fire( $year );
+
+ $query = $this->db->query( $sql );
+
+ $result = $query->result();
+
+ $this->json( $result );
+ }
+
}
\ No newline at end of file
diff --git a/application/models/eloquent/queries/QEmployeeHours.php b/application/models/eloquent/queries/QEmployeeHours.php
index 4c3a046..93691f0 100644
--- a/application/models/eloquent/queries/QEmployeeHours.php
+++ b/application/models/eloquent/queries/QEmployeeHours.php
@@ -30,8 +30,9 @@ class QEmployeeHours {
0 AS revenues,
SUM(hours) AS nonprojecthours
FROM employeehours
- WHERE YEAR(hourdate) = '{$year}'
- AND MONTH(hourdate) = '$month'
+ WHERE YEAR(hourdate) = '{$year}' ";
+ if( $month != 0 ) $sql .= "AND MONTH(hourdate) = '$month' ";
+ $sql .= "
GROUP BY employee_id, MONTH(hourdate)
UNION
SELECT PEM.user_id,
@@ -44,13 +45,14 @@ class QEmployeeHours {
FROM projecthours PH
JOIN projectemployees PEM
ON PEM.id = PH.projectemployee_id
- WHERE YEAR(hourdate) = '{$year}'
- AND MONTH(hourdate) = '$month'
+ WHERE YEAR(hourdate) = '{$year}' ";
+ if( $month != 0 ) $sql .= "AND MONTH(hourdate) = '$month' ";
+ $sql .= "
GROUP BY PEM.user_id, MONTH(hourdate)
) AS Q1
JOIN users AS USR
ON USR.id = Q1.user_id
- GROUP BY monthID, user_id ";
+ GROUP BY user_id ";
return $sql;
}
diff --git a/application/models/eloquent/queries/Qinvoiceoverview.php b/application/models/eloquent/queries/Qinvoiceoverview.php
new file mode 100644
index 0000000..8dd541c
--- /dev/null
+++ b/application/models/eloquent/queries/Qinvoiceoverview.php
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+ |
+ project
+ |
+
+ klant
+ |
+
+ status afgehandeld
+ |
+
+ projectleider
+ |
+
+ te factureren(excl btw)
+ |
+
+ te factureren(incl btw)
+ |
+
+ gefactureerd voorgaande jaren(incl btw)
+ |
+
+ gefactureerd lopend jaar(incl btw)
+ |
+
+ totaal gefactureerd(incl btw)
+ |
+
+ betaald voorgaande jaren
+ |
+
+ betaald lopend jaar
+ |
+
+ totaal betaald
+ |
+
+
+
+
+
+ |
+ |
+ |
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/partials/_js.php b/application/views/partials/_js.php
index 74cae20..d83c700 100644
--- a/application/views/partials/_js.php
+++ b/application/views/partials/_js.php
@@ -71,6 +71,7 @@
+
@@ -98,6 +99,7 @@
+
diff --git a/public/js/lib/dataservices/invoiceDataService.js b/public/js/lib/dataservices/invoiceDataService.js
new file mode 100644
index 0000000..16b553a
--- /dev/null
+++ b/public/js/lib/dataservices/invoiceDataService.js
@@ -0,0 +1,18 @@
+/**
+ * Created by Pensare Software.
+ * User: Theo Weijmer
+ * Date: 02/03/2018
+ * Time: 16:00
+ */
+
+
+dbo.invoiceDataService = {
+
+ getInvoiceOverview: function ( year, callback ) {
+ $.getJSON( 'index.php/reports/employeeHoursController/getInvoiceOverview/' + year )
+ .done( function ( data ) {
+ callback( data );
+ } );
+ }
+
+}
\ No newline at end of file
diff --git a/public/js/lib/modules/reports/employeeHours.js b/public/js/lib/modules/reports/employeeHours.js
index b8ffd68..6b9c3b0 100644
--- a/public/js/lib/modules/reports/employeeHours.js
+++ b/public/js/lib/modules/reports/employeeHours.js
@@ -14,6 +14,7 @@ dbo.employeehoursreportInit = function () {
dbo.employeeHoursreportModel = {
months : ko.observableArray( [
+ {monthID: 0, monthName : 'totaal'},
{monthID: 1, monthName: 'jan'},
{monthID: 2, monthName: 'febr'},
{monthID: 3, monthName: 'mrt'},
@@ -55,7 +56,7 @@ dbo.employeehoursreportInit = function () {
} );
vm.selectedYear( (new Date()).getFullYear() );
- vm.selectedMonthID( 1 );
+ vm.selectedMonthID( 0 );
vm.initialize = false;
@@ -103,10 +104,10 @@ dbo.employeehoursreportInit = function () {
_.each( data, function ( p ) {
vm.employees.push( new vm.Employee( p ) );
- vm.profitablehoursTotaal( vm.profitablehoursTotaal() + Number( p.profitablehours ) );
- vm.nonprofitablehoursTotaal( vm.nonprofitablehoursTotaal() + Number( p.nonprofitablehours ) );
- vm.nonprojecthoursTotaal( vm.nonprojecthoursTotaal() + Number( p.nonprojecthours ) );
- vm.totalhoursTotaal( vm.totalhoursTotaal() + Number( p.totalhours ) );
+ vm.profitablehoursTotaal( Math.round(vm.profitablehoursTotaal() + Number( p.profitablehours )) );
+ vm.nonprofitablehoursTotaal( Math.round(vm.nonprofitablehoursTotaal() + Number( p.nonprofitablehours ) ));
+ vm.nonprojecthoursTotaal( Math.round(vm.nonprojecthoursTotaal() + Number( p.nonprojecthours ) ));
+ vm.totalhoursTotaal( Math.round(vm.totalhoursTotaal() + Number( p.totalhours )) );
vm.targetTotaal( Math.round( vm.targetTotaal() + Number( p.targethours / 12 ) ) );
vm.revenuesTotaal( Number( vm.revenuesTotaal() ) + Number( p.revenues ) );
@@ -141,7 +142,7 @@ dbo.employeehoursreportInit = function () {
this.profitablehours = data.profitablehours;
this.nonprofitablehours = data.nonprofitablehours;
this.nonprojecthours = data.nonprojecthours;
- this.totalhours = data.totalhours;
+ this.totalhours = Math.round(data.totalhours);
this.target = Math.round( data.targethours / 12 );
this.occupancyRateTotal = Math.round( (data.totalhours / (data.targethours / 12)) * 100 );
this.occupancyRateHours = Math.round( (data.profitablehours / data.totalhours ) * 100 );
diff --git a/public/js/lib/modules/reports/outgoingInvoices.js b/public/js/lib/modules/reports/outgoingInvoices.js
new file mode 100644
index 0000000..0a47668
--- /dev/null
+++ b/public/js/lib/modules/reports/outgoingInvoices.js
@@ -0,0 +1,91 @@
+/**
+ * Created by Pensare Software.
+ * User: Theo Weijmer
+ * Date: 02/03/2018
+ * Time: 11:43
+ */
+
+
+dbo.outgoinginvoicesInit = function () {
+
+ if ( dbo.outgoinginvoicesModel !== undefined ) {
+
+
+ } else {
+ dbo.outgoinginvoicesModel = {
+
+ initialize : null,
+ years : ko.observableArray( [] ),
+ selectedYear : ko.observable(),
+ selectedMonthID: ko.observable(),
+ projects : ko.observableArray( [] ),
+
+ init: function () {
+ var vm = dbo.outgoinginvoicesModel;
+
+ vm.initialize = true;
+ dbo.reportsDataService.getUsedYears( function ( data ) {
+ vm.years.removeAll();
+ _.each( data, function ( p ) {
+ vm.years.push( {id: p.year, year: p.year} );
+ } );
+
+ vm.selectedYear( (new Date()).getFullYear() );
+ vm.selectedMonthID( 0 );
+
+ vm.initialize = false;
+
+ vm.initModule();
+ } );
+ },
+
+ initModule: function () {
+ var vm = dbo.outgoinginvoicesModel;
+
+ vm.refreshInvoiceDetails();
+
+ },
+
+ refreshInvoiceDetails: function () {
+ var vm = dbo.outgoinginvoicesModel;
+
+ if ( vm.initialize ) return;
+
+ dbo.invoiceDataService.getInvoiceOverview( vm.selectedYear(), function ( data ) {
+ vm.projects.removeAll();
+ _.each( data, function ( p ) {
+ vm.projects.push( new vm.Project( p ) );
+ } );
+
+ } );
+ },
+
+ Project: function ( data ) {
+ var openstaand = data.revenues - (Number( data.currentyear ) + Number( data.otheryear ));
+ this.projectnumber = data.projectnumber;
+ this.customername = data.customername;
+ this.statusProject = Math.abs( openstaand ) > 2 ? 'OPEN' : 'CLOSED';
+ this.fullname = data.fullname;
+ this.openstaand = dbo.helpers.numberWithPoints(Math.round(openstaand));
+ this.openstaandIncl = dbo.helpers.numberWithPoints(Math.round(openstaand * 1.21));
+ this.invoicedOtherYears = dbo.helpers.numberWithPoints(Math.round(data.otheryear));
+ this.invoicedCurentYear = dbo.helpers.numberWithPoints(Math.round(data.currentyear));
+ this.totalInvoiced = dbo.helpers.numberWithPoints(Math.round(data.currentyear) + Math.round(data.otheryear));
+ this.invoicedOtherYearsPayed = dbo.helpers.numberWithPoints(Math.round(data.otheryearpayed));
+ this.invoicedCurentYearPayed = dbo.helpers.numberWithPoints(Math.round(data.currentyearpayed));
+ this.totalInvoicedPayed = dbo.helpers.numberWithPoints(Math.round(data.currentyearpayed) + Math.round(data.otheryearpayed));
+ }
+
+
+ }
+
+ dbo.outgoinginvoicesModel.init();
+
+ ko.applyBindings(
+ dbo.outgoinginvoicesModel, document.getElementById( "OUTGOINGINVOICES" ) );
+
+
+ }
+
+
+}
\ No newline at end of file