Diverse aanpassing nav mail Peter

This commit is contained in:
2019-02-22 14:19:03 +01:00
parent d71692f320
commit 695f6c6960
23 changed files with 295 additions and 79 deletions
@@ -70,6 +70,7 @@ class EmployeeHoursController extends MY_Controller {
} }
elseif ( $hourType == 'OFFERS' ) elseif ( $hourType == 'OFFERS' )
{ {
$data['projectemployee_id'] = $data['employee_id'];
unset( $data['employee_id'] ); unset( $data['employee_id'] );
$data['hourtype_id'] = $data['hourtype_id'] - 8; $data['hourtype_id'] = $data['hourtype_id'] - 8;
@@ -27,14 +27,14 @@ class ProjectsController extends MY_Controller {
} }
public function getAllProjects( ) public function getAllProjects()
{ {
$archive = $this->clean_input( 'archive' ); $archive = $this->clean_input( 'archive' );
$search = $this->clean_input( 'search' ); $search = $this->clean_input( 'search' );
$order = $this->clean_input( 'order' ); $order = $this->clean_input( 'order' );
$direction = $this->clean_input( 'direction' ); $direction = $this->clean_input( 'direction' );
$projects = Project::getAllProjects( $archive, $search, $order, $direction ); $projects = Project::getAllProjects( $archive, $search, $order, $direction );
$this->json( $projects ); $this->json( $projects );
} }
@@ -46,6 +46,9 @@ class ProjectsController extends MY_Controller {
$project->invoiceDetails = $project->invoiceDetails =
$this->Invoices_model->getOutstandingPerProject( $project->id ); $this->Invoices_model->getOutstandingPerProject( $project->id );
$project->hourTotals =
Projecthour::getTotalHoursPerProject( $project->id );
$this->json( $project ); $this->json( $project );
} }
@@ -27,9 +27,9 @@ class ReportsController extends MY_Controller {
} }
public function recapProjects() public function recapProjects( $archive )
{ {
$recapprojects = new Recapprojects(); $recapprojects = new Recapprojects( $archive );
$projects = $recapprojects->getProjects(); $projects = $recapprojects->getProjects();
@@ -51,17 +51,17 @@ class ReportsController extends MY_Controller {
$result = $query->result(); $result = $query->result();
foreach($result as $user) foreach ( $result as $user )
{ {
$user->targethours = Employeetarget::getTargetHoursPerEmployee( $user->user_id, $year, $month); $user->targethours = Employeetarget::getTargetHoursPerEmployee( $user->user_id, $year, $month );
} }
$this->json( $result ); $this->json( $result );
} }
public function getInvoiceOverview( $year = FALSE ) public function getInvoiceOverview( $year = FALSE, $orderType, $orderDirection, $archive )
{ {
$invoices = new Invoices( $year ); $invoices = new Invoices( $year, $orderType, $orderDirection, $archive );
$invoiceReport = $invoices->getInvoiceReport(); $invoiceReport = $invoices->getInvoiceReport();
@@ -74,7 +74,7 @@ class ReportsController extends MY_Controller {
$invoiceReport = $invoices->getInvoiceReport(); $invoiceReport = $invoices->getInvoiceReport();
new InvoiceSpreadsheet($invoiceReport); new InvoiceSpreadsheet( $invoiceReport );
} }
public function saveCurrentFinnacialYear( $projectID ) public function saveCurrentFinnacialYear( $projectID )
+1 -1
View File
@@ -16,7 +16,7 @@ class MY_Controller extends CI_Controller {
{ {
parent::__construct(); parent::__construct();
$this->version = '1.00.00'; $this->version = '1.00.01';
$this->load->library( 'beheer/session/RetrieveUserSession' ); $this->load->library( 'beheer/session/RetrieveUserSession' );
@@ -10,6 +10,7 @@ class Recapprojects {
private $ci; private $ci;
private $index; private $index;
private $archive;
private $project; private $project;
private $projects; private $projects;
private $employeeHours; private $employeeHours;
@@ -22,10 +23,12 @@ class Recapprojects {
private $projectEmployeeDetail; private $projectEmployeeDetail;
private $projectEmployeeDetails; private $projectEmployeeDetails;
public function __construct() public function __construct( $archive )
{ {
$this->ci =& get_instance(); $this->ci =& get_instance();
$this->archive = $archive;
$this->ci->load->Model( 'projects/Invoices_model' ); $this->ci->load->Model( 'projects/Invoices_model' );
$this->handle(); $this->handle();
@@ -51,7 +54,7 @@ class Recapprojects {
private function setProjects() private function setProjects()
{ {
$this->projects = Project::getActiveProjects()->toArray(); $this->projects = Project::getActiveProjects( $this->archive )->toArray();
} }
private function setUniqueEmployees() private function setUniqueEmployees()
@@ -222,8 +225,8 @@ class Recapprojects {
$this->projects[ $this->index ]['projectcosts'] - $this->projects[ $this->index ]['projectcosts'] -
$this->projects[ $this->index ]['totalInvoiced']; $this->projects[ $this->index ]['totalInvoiced'];
if( $this->projects[ $this->index ]['workInProgress'] < 0 ) if ( $this->projects[ $this->index ]['workInProgress'] < 0 )
$this->projects[ $this->index ]['workInProgress'] = 0; $this->projects[ $this->index ]['workInProgress'] = 0;
} }
private function setCurrentFinancialYear() private function setCurrentFinancialYear()
@@ -19,6 +19,7 @@ class InvoiceOverview {
private $invoicesTotal; private $invoicesTotal;
private $needInvoice; private $needInvoice;
private $projectDetails; private $projectDetails;
private $projectnumber;
public function __construct( $project, $year ) public function __construct( $project, $year )
{ {
@@ -41,6 +42,8 @@ class InvoiceOverview {
private function handle() private function handle()
{ {
$this->setProjectnumber();
$this->setProjectname(); $this->setProjectname();
$this->setCustomer(); $this->setCustomer();
@@ -60,9 +63,14 @@ class InvoiceOverview {
$this->setProjectDetails(); $this->setProjectDetails();
} }
private function setProjectnumber()
{
$this->projectnumber = $this->project->projectnumber;
}
private function setProjectname() private function setProjectname()
{ {
$this->projectname = $this->project->projectname . '(' . $this->project->projectnumber . ')'; $this->projectname = $this->project->projectname;
} }
private function setCustomer() private function setCustomer()
@@ -111,6 +119,7 @@ class InvoiceOverview {
private function setProjectDetails() private function setProjectDetails()
{ {
$this->projectDetails = [ $this->projectDetails = [
'projectnumber' => $this->projectnumber,
'projectname' => $this->projectname, 'projectname' => $this->projectname,
'customer' => $this->customer, 'customer' => $this->customer,
'totalToInvoicingExcl' => number_format( $this->totalToInvoicingExcl, 0, ',', '.' ), 'totalToInvoicingExcl' => number_format( $this->totalToInvoicingExcl, 0, ',', '.' ),
@@ -20,10 +20,16 @@ class Invoices {
private $invoiceForecasts; private $invoiceForecasts;
private $invoiceOverviews = []; private $invoiceOverviews = [];
private $invoiceReport = []; private $invoiceReport = [];
private $orderType;
private $orderDirection;
private $archive;
public function __construct( $year ) public function __construct( $year, $orderType, $orderDirection, $archive )
{ {
$this->year = $year; $this->year = $year;
$this->orderType = $orderType;
$this->orderDirection = $orderDirection;
$this->archive = $archive;
$this->handle(); $this->handle();
} }
@@ -44,7 +50,8 @@ class Invoices {
private function setProjects() private function setProjects()
{ {
$this->projects = Project::getProjectsForReport(); $this->projects =
Project::getProjectsForReport( $this->orderType, $this->orderDirection, $this->archive );
} }
private function loopProjects() private function loopProjects()
+21 -14
View File
@@ -48,7 +48,7 @@ class Project extends BaseModel {
public function vat() public function vat()
{ {
return $this->belongsTo('Vat'); return $this->belongsTo( 'Vat' );
} }
public function projectleader() public function projectleader()
@@ -65,11 +65,11 @@ class Project extends BaseModel {
{ {
$projects = Project::getBaseProject(); $projects = Project::getBaseProject();
$projects = $projects->selectRaw('projects.*') $projects = $projects->selectRaw( 'projects.*' )
->join('customers AS CUS', 'CUS.id', '=', 'projects.customer_id') ->join( 'customers AS CUS', 'CUS.id', '=', 'projects.customer_id' )
->join('users AS USR', 'USR.id', '=', 'projects.projectleader_id') ->join( 'users AS USR', 'USR.id', '=', 'projects.projectleader_id' )
->where('projects.projectnumber', 'LIKE', "%{$search}%") ->where( 'projects.projectnumber', 'LIKE', "%{$search}%" )
->orderBy($order, $direction); ->orderBy( $order, $direction );
if ( $archive == 'F' ) $projects = $projects->where( 'projects.archive', '=', 'F' ); if ( $archive == 'F' ) $projects = $projects->where( 'projects.archive', '=', 'F' );
@@ -96,7 +96,7 @@ class Project extends BaseModel {
Project::whereId( $projectID )->delete(); Project::whereId( $projectID )->delete();
} }
public static function getActiveProjects() public static function getActiveProjects($archive = 'T')
{ {
$projects = Project::selectRaw( "projects.id, YEAR(projects.startdate) AS instroom, YEAR(projects.enddate) AS uitstroom, projectnumber, current_financial_year, $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" ) projectname, CUS.name, OFF.own_revenue, OFF.other_revenue" )
@@ -104,15 +104,22 @@ class Project extends BaseModel {
->join( 'offers AS OFF', 'OFF.project_id', '=', 'projects.id' ) ->join( 'offers AS OFF', 'OFF.project_id', '=', 'projects.id' )
->groupBy( 'projects.id' ) ->groupBy( 'projects.id' )
->groupBy( 'OFF.own_revenue' ) ->groupBy( 'OFF.own_revenue' )
->groupBy( 'OFF.other_revenue' ) ->groupBy( 'OFF.other_revenue' );
->get();
if( $archive == 'F') $projects = $projects->where('projects.archive', '=', 'F');
$projects = $projects->get();
return $projects; return $projects;
} }
public static function getProjectsForReport() public static function getProjectsForReport( $orderType, $orderDirection, $archive = 'F' )
{ {
$projects = self::getBaseProject()->get(); $projects = self::getBaseProject();
if ( $archive == 'F' ) $projects = $projects->whereArchive( 'F' );
$projects = $projects->orderBy( $orderType, $orderDirection )->get();
return $projects; return $projects;
} }
@@ -128,9 +135,9 @@ class Project extends BaseModel {
'projectemployees.user' => function ( $q ) { 'projectemployees.user' => function ( $q ) {
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" ); $q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
}] ) }] )
->with('vat') ->with( 'vat' )
->with(['forecasts']) ->with( ['forecasts'] )
->with(['reservations']) ->with( ['reservations'] )
->with( 'projectemployees.projecthours' ) ->with( 'projectemployees.projecthours' )
->with( 'projectcosts.external' ) ->with( 'projectcosts.external' )
->with( 'invoices.payments' ) ->with( 'invoices.payments' )
+17 -1
View File
@@ -27,7 +27,7 @@ class Projecthour extends BaseModel {
public static function getMonthlyEmployeeHoursPerProject( $employeeID, $year ) public static function getMonthlyEmployeeHoursPerProject( $employeeID, $year )
{ {
$projectHours = ProjecthoursPerEmployeePerMonth::fire($employeeID, $year); $projectHours = ProjecthoursPerEmployeePerMonth::fire( $employeeID, $year );
return $projectHours; return $projectHours;
} }
@@ -61,5 +61,21 @@ class Projecthour extends BaseModel {
Projecthour::whereId( $projecthourID )->delete(); Projecthour::whereId( $projecthourID )->delete();
} }
public static function getTotalHoursPerProject( $projectID )
{
$totalProjecthours =
self::selectRaw( "CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname,
SUM(IF(hourtype_id = 1, hours, 0)) AS declarable,
SUM(IF(hourtype_id = 1, hours * tarif, 0)) AS revenues,
SUM(IF(hourtype_id != 1, hours, 0)) AS nondeclarable" )
->join( 'projectemployees AS PRE', 'PRE.id', '=', 'projecthours.projectemployee_id' )
->join( 'users AS USR', 'USR.id', '=', 'PRE.user_id' )
->groupBy( 'USR.id' )
->where( 'PRE.project_id', '=', $projectID )
->get();
return $totalProjecthours;
}
} }
@@ -49,7 +49,21 @@ class QEmployeeHours {
if( $month != 0 ) $sql .= "AND MONTH(hourdate) = '$month' "; if( $month != 0 ) $sql .= "AND MONTH(hourdate) = '$month' ";
$sql .= " $sql .= "
GROUP BY PEM.user_id, MONTH(hourdate) GROUP BY PEM.user_id, MONTH(hourdate)
UNION
SELECT PH.projectemployee_id AS user_id,
MONTH(hourdate) monthID,
SUM(hours) AS projecthours,
0 AS profitablehours,
SUM(IF(hourtype_id = 3, hours, 0)) AS nonprofitablehours,
0 AS revenues,
0 AS nonprojecthours
FROM projecthours PH
WHERE YEAR(hourdate) = '{$year}' ";
if( $month != 0 ) $sql .= "AND MONTH(hourdate) = '$month' ";
$sql .= "
GROUP BY PH.projectemployee_id, MONTH(hourdate)
) AS Q1 ) AS Q1
JOIN users AS USR JOIN users AS USR
ON USR.id = Q1.user_id ON USR.id = Q1.user_id
GROUP BY user_id "; GROUP BY user_id ";
@@ -0,0 +1,57 @@
<div class="panel panel-bordered panel-primary panel-line">
<div class="panel-heading panel-heading-project">
<h3 class="">
projecturen
</h3>
</div>
<div class="panel-body panel-body-project">
<table class="table table-sm">
<thead>
<th class="table-cyanish-header" width="40%">
medewerker
</th>
<th class="table-cyanish-header align-right" width="20%">
niet declarabel
</th>
<th class="table-cyanish-header align-right" width="20%">
declarabel
</th>
<th class="table-cyanish-header align-right" width="20%">
omzet
</th>
</thead>
<tbody data-bind="foreach:hourTotals">
<tr>
<td>
<span data-bind="text:fullname"></span>
</td>
<td class="align-right">
<span data-bind="text:nondeclarable"></span> uur
</td>
<td class="align-right">
<span data-bind="text:declarable"></span> uur
</td>
<td class="align-right">
<span data-bind="text:revenues"></span>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th class="table-cyanish-header">
totaal
</th>
<th class="align-right table-cyanish-header">
<span data-bind="text:totalNonDeclarable"></span> uur
</th>
<th class="align-right table-cyanish-header">
<span data-bind="text:totalDeclarable"></span> uur
</th>
<th class="align-right table-cyanish-header">
<span data-bind="text:totalRevenueHours"></span>
</th>
</tr>
</tfoot>
</table>
</div>
</div>
+1 -1
View File
@@ -65,7 +65,7 @@
<?php $this->load->view( 'modals/partials/_projectemployees' ); ?> <?php $this->load->view( 'modals/partials/_projectemployees' ); ?>
</div> </div>
<div class="col-md-7"> <div class="col-md-7">
<?php $this->load->view( 'modals/partials/_hours' ); ?> <?php $this->load->view( 'modals/partials/_hourTotals' ); ?>
</div> </div>
</div> </div>
</div> </div>
@@ -12,6 +12,24 @@
maak spreadsheet maak spreadsheet
</button> </button>
</div> </div>
<div class="col-md-3">
<div class="row form-horizontal">
<label class="col-md-4 form-control-label">archief</label>
<div class="col-md-8">
<div class="onoffswitch" data-bind="click:toggleArchive">
<input type="checkbox"
name="onoffswitch"
class="onoffswitch-checkbox"
data-bind="checked:archive"
id="myonoffswitch">
<label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</div>
</div>
</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@@ -8,6 +8,26 @@
<!-- <div class="invalid-feedback" data-bind="visible: ! validYear()">geen geldig jaar</div>--> <!-- <div class="invalid-feedback" data-bind="visible: ! validYear()">geen geldig jaar</div>-->
<!-- </div>--> <!-- </div>-->
<!-- </div>--> <!-- </div>-->
<div class="row">
<div class="col-xs-3">
<div class="row form-horizontal">
<label class="col-md-4 form-control-label">archief</label>
<div class="col-md-8">
<div class="onoffswitch" data-bind="click:toggleArchive">
<input type="checkbox"
name="onoffswitch"
class="onoffswitch-checkbox"
data-bind="checked:archive"
id="myonoffswitch">
<label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</div>
</div>
</div>
</div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="nav-tabs-horizontal"> <div class="nav-tabs-horizontal">
+2 -2
View File
@@ -25,7 +25,7 @@
<th class="table-tealish-header pointer" <th class="table-tealish-header pointer"
data-bind="click:directionOrderProjects.bind($data, 'USR.firstname')">projectleider</th> data-bind="click:directionOrderProjects.bind($data, 'USR.firstname')">projectleider</th>
<th class="table-tealish-header pointer" <th class="table-tealish-header pointer"
data-bind="click:directionOrderProjects.bind($data, 'CUS.name')">klant</th> data-bind="click:directionOrderProjects.bind($data, 'projectname')">projectnaam</th>
<th class="table-tealish-header pointer" <th class="table-tealish-header pointer"
data-bind="click:directionOrderProjects.bind($data, 'startdate')">start</th> data-bind="click:directionOrderProjects.bind($data, 'startdate')">start</th>
<th class="table-tealish-header align-right">eigen tarief omzet</th> <th class="table-tealish-header align-right">eigen tarief omzet</th>
@@ -44,7 +44,7 @@
<span data-bind="text:projectleader"></span> <span data-bind="text:projectleader"></span>
</td> </td>
<td data-bind="click:$root.selectPoject" class="pointer"> <td data-bind="click:$root.selectPoject" class="pointer">
<span data-bind="text:customer"></span> <span data-bind="text:projectname, attr:{title:customer}"></span>
</td> </td>
<td data-bind="click:$root.selectPoject" class="pointer"> <td data-bind="click:$root.selectPoject" class="pointer">
<span data-bind="text:startdate"></span> <span data-bind="text:startdate"></span>
@@ -1,6 +1,13 @@
<table class="table table-condensed" style="font-size:0.8em;"> <table class="table table-condensed" style="font-size:0.8em;">
<thead> <thead>
<tr> <tr>
<th class="rotate">
<div class="pointer">
<span data-bind="click:sortList.bind($data, 'projectnumber')">
projectnummer
</span>
</div>
</th>
<th class="rotate"> <th class="rotate">
<div><span>project</span></div> <div><span>project</span></div>
</th> </th>
@@ -30,6 +37,7 @@
<tbody> <tbody>
<!-- ko foreach: invoiceOverview --> <!-- ko foreach: invoiceOverview -->
<tr> <tr>
<td><span data-bind="text:projectnumber"></span></td>
<td><span data-bind="text:projectname"></span></td> <td><span data-bind="text:projectname"></span></td>
<td><span data-bind="text:customer"></span></td> <td><span data-bind="text:customer"></span></td>
<td class="align-right"><span data-bind="text:totalToInvoicingExcl"></span></td> <td class="align-right"><span data-bind="text:totalToInvoicingExcl"></span></td>
@@ -43,7 +51,7 @@
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<th colspan="2" class="align-right"> <th colspan="3" class="align-right">
totaal totaal
</th> </th>
<th class="align-right"> <th class="align-right">
@@ -8,8 +8,8 @@
dbo.invoiceDataService = { dbo.invoiceDataService = {
getInvoiceOverview: function ( year, callback ) { getInvoiceOverview: function ( year, orderType, orderDirection, archive, callback ) {
$.getJSON( 'index.php/reports/reportsController/getInvoiceOverview/' + year ) $.getJSON( 'index.php/reports/reportsController/getInvoiceOverview/' + year + '/' + orderType + '/' + orderDirection + '/' + archive )
.done( function ( data ) { .done( function ( data ) {
callback( data ); callback( data );
} ); } );
@@ -15,8 +15,8 @@ dbo.reportsDataService = {
} ); } );
}, },
getRecapProjects: function(callback){ getRecapProjects: function(archive, callback){
$.getJSON( 'index.php/reports/reportsController/recapProjects' ) $.getJSON( 'index.php/reports/reportsController/recapProjects/' + archive )
.done( function ( data ) { .done( function ( data ) {
callback( data ); callback( data );
} ); } );
+4 -4
View File
@@ -56,10 +56,10 @@ dbo.helpers = {
}, },
findArrayElement: function ( toFind, element, value, array ) { findArrayElement: function ( toFind, element, value, array ) {
console.log( toFind ); // het element in de array // console.log( toFind ); // het element in de array
console.log( element ); // console.log( element );
console.log( value ); // console.log( value );
console.log( array ); // console.log( array );
if ( !Array.isArray( array ) ) return null; if ( !Array.isArray( array ) ) return null;
var foundValue = null var foundValue = null
+46 -27
View File
@@ -28,34 +28,38 @@ $( function () {
showProject : ko.observable( false ), showProject : ko.observable( false ),
projectID : null, projectID : null,
callback : null, callback : null,
customerID : ko.observable( null ), customerID : ko.observable( null ),
projectnumber : ko.observable(), projectnumber : ko.observable(),
projectleaderID : ko.observable(), projectleaderID : ko.observable(),
archive : ko.observable( false ), archive : ko.observable( false ),
startdate : ko.observable( null ), startdate : ko.observable( null ),
enddate : ko.observable( null ), enddate : ko.observable( null ),
vat_id : ko.observable(), vat_id : ko.observable(),
projectname : ko.observable(), projectname : ko.observable(),
busy : false, busy : false,
ownRevenue : ko.observable(), ownRevenue : ko.observable(),
otherRevenue : ko.observable(), otherRevenue : ko.observable(),
costs : ko.observable(), costs : ko.observable(),
projectname : ko.observable(), projectname : ko.observable(),
years : ko.observableArray( dbo.years ), years : ko.observableArray( dbo.years ),
months : ko.observableArray( dbo.monthArray ), months : ko.observableArray( dbo.monthArray ),
outstanding : ko.observable(), outstanding : ko.observable(),
documents : ko.observableArray( [] ), documents : ko.observableArray( [] ),
comments : ko.observableArray( [] ), comments : ko.observableArray( [] ),
activeTab : ko.observable(), activeTab : ko.observable(),
totalRevenues : ko.observable(), totalRevenues : ko.observable(),
totalInvoiced : ko.observable(), totalInvoiced : ko.observable(),
totalRevenuesIncl: ko.observable(), totalRevenuesIncl : ko.observable(),
outstanding : ko.observable(), outstanding : ko.observable(),
outstandingInvoices: ko.observable(), outstandingInvoices: ko.observable(),
payed : ko.observable(), payed : ko.observable(),
totalForecast : ko.observable(), totalForecast : ko.observable(),
toForecast : ko.observable(), toForecast : ko.observable(),
toInvoice : 0, toInvoice : 0,
hourTotals : ko.observableArray( [] ),
totalNonDeclarable : ko.observable( 0 ),
totalDeclarable : ko.observable( 0 ),
totalRevenueHours : ko.observable( 0 ),
init: function () { init: function () {
var vm = dbo.editProjectModal; var vm = dbo.editProjectModal;
@@ -113,7 +117,7 @@ $( function () {
self.fromReservation( !self.fromReservation() ); self.fromReservation( !self.fromReservation() );
vm.saveProjectCost(self); vm.saveProjectCost( self );
}, },
editProjectemployee: function () { editProjectemployee: function () {
@@ -800,7 +804,7 @@ $( function () {
dbo.projectDataService.getAvailableEmployees( vm.projectID, function ( data ) { dbo.projectDataService.getAvailableEmployees( vm.projectID, function ( data ) {
vm.availableEmployees( data ); vm.availableEmployees( data );
if ( typeof(callback) == 'function' ) callback(); if ( typeof (callback) == 'function' ) callback();
} ); } );
}, },
@@ -809,7 +813,7 @@ $( function () {
vm.busy = true; vm.busy = true;
dbo.projectDataService.getProject( vm.projectID, function ( data ) { dbo.projectDataService.getProject( vm.projectID, function ( data ) {
var revenues = Number(data.offer.own_revenue) + Number(data.offer.other_revenue) + Number(data.offer.costs); var revenues = Number( data.offer.own_revenue ) + Number( data.offer.other_revenue ) + Number( data.offer.costs );
var totalRevenuesIncl = Math.round( (revenues * (Number( data.vat.vatrate ) + 100)) / 100 ); var totalRevenuesIncl = Math.round( (revenues * (Number( data.vat.vatrate ) + 100)) / 100 );
vm.id = data.id vm.id = data.id
@@ -832,9 +836,25 @@ $( function () {
vm.ownRevenue( dbo.helpers.numberWithPoints( Math.round( Number( data.offer.own_revenue ) ) ) ); vm.ownRevenue( dbo.helpers.numberWithPoints( Math.round( Number( data.offer.own_revenue ) ) ) );
vm.otherRevenue( dbo.helpers.numberWithPoints( Math.round( Number( data.offer.other_revenue ) ) ) ); vm.otherRevenue( dbo.helpers.numberWithPoints( Math.round( Number( data.offer.other_revenue ) ) ) );
vm.costs(dbo.helpers.numberWithPoints( Math.round( Number( data.offer.costs ) ) ) ); vm.costs( dbo.helpers.numberWithPoints( Math.round( Number( data.offer.costs ) ) ) );
vm.totalRevenues( dbo.helpers.numberWithPoints( Math.round( revenues ) ) ); vm.totalRevenues( dbo.helpers.numberWithPoints( Math.round( revenues ) ) );
vm.hourTotals.removeAll();
vm.totalNonDeclarable( 0 );
vm.totalDeclarable( 0 );
vm.totalRevenueHours( 0 );
_.each( data.hourTotals, function ( p ) {
vm.hourTotals.push( {
fullname : p.fullname,
nondeclarable: p.nondeclarable,
declarable : p.declarable,
revenues : dbo.helpers.numberWithPoints( Math.round( Number( p.revenues ) ) )
} );
vm.totalNonDeclarable( Number( vm.totalNonDeclarable() ) + Number( p.nondeclarable ) );
vm.totalDeclarable( Number( vm.totalDeclarable() ) + Number( p.declarable ) );
vm.totalRevenueHours( Number( vm.totalRevenueHours() ) + Number( p.revenues ) );
} );
vm.totalRevenueHours( dbo.helpers.numberWithPoints( Math.round( vm.totalRevenueHours() ) ) );
_.each( data.projectemployees, function ( p ) { _.each( data.projectemployees, function ( p ) {
vm.projectEmployees.push( new vm.Projectemployee( p ) ); vm.projectEmployees.push( new vm.Projectemployee( p ) );
@@ -1012,7 +1032,6 @@ $( function () {
}, },
Reservation: function ( data ) { Reservation: function ( data ) {
console.log( data );
this.id = data.id; this.id = data.id;
this.project_id = data.project_id; this.project_id = data.project_id;
this.reservationamount = ko.observable( data.reservationamount ); this.reservationamount = ko.observable( data.reservationamount );
@@ -154,6 +154,7 @@ dbo.projectsInit = function () {
self.id = data.id; self.id = data.id;
self.projectnumber = data.projectnumber; self.projectnumber = data.projectnumber;
self.projectleader = data.projectleader ? data.projectleader.fullname : '#NB'; self.projectleader = data.projectleader ? data.projectleader.fullname : '#NB';
self.projectname = data.projectname;
self.customer = data.customer ? data.customer.name : '#NB'; self.customer = data.customer ? data.customer.name : '#NB';
self.startdate = data.startdate; self.startdate = data.startdate;
self.enddate = data.enddate; self.enddate = data.enddate;
+29 -6
View File
@@ -35,6 +35,9 @@ dbo.invoicereportInit = function () {
forecastOtherYears : ko.observable(), forecastOtherYears : ko.observable(),
forecastRemaining : ko.observable(), forecastRemaining : ko.observable(),
totalProjectPayments : ko.observable(), totalProjectPayments : ko.observable(),
orderType : 'projectnumber',
orderDirection : false,
archive : ko.observable( false ),
init: function () { init: function () {
var vm = dbo.invoicereport; var vm = dbo.invoicereport;
@@ -52,7 +55,10 @@ dbo.invoicereportInit = function () {
vm.resetTotals(); vm.resetTotals();
dbo.invoiceDataService.getInvoiceOverview( vm.selectedYear(), function ( data ) { var orderDirection = vm.orderDirection ? 'ASC' : 'DESC';
var archive = vm.archive() ? 'T' : 'F';
dbo.invoiceDataService.getInvoiceOverview( vm.selectedYear(), vm.orderType, orderDirection, archive, function ( data ) {
vm.invoiceOverview( data.invoiceOverview ); vm.invoiceOverview( data.invoiceOverview );
vm.setInvoiceOverviewTotals( data.invoiceOverview ); vm.setInvoiceOverviewTotals( data.invoiceOverview );
@@ -70,7 +76,7 @@ dbo.invoicereportInit = function () {
vm.monthPayments.removeAll(); vm.monthPayments.removeAll();
_.each( data.monthPayments, function ( p ) { _.each( data.monthPayments, function ( p ) {
vm.monthPayments.push( new vm.Monthpayment( p ) ); vm.monthPayments.push( new vm.Monthpayment( p ) );
vm.totalProjectPayments( Number( vm.totalProjectPayments() ) + Number(p.totalProjectPayments.replace('.', '')) ); vm.totalProjectPayments( Number( vm.totalProjectPayments() ) + Number( p.totalProjectPayments.replace( '.', '' ) ) );
console.log( vm.totalProjectPayments() ); console.log( vm.totalProjectPayments() );
} ); } );
vm.totalProjectPayments( dbo.helpers.thousandSeparator( vm.totalProjectPayments() ) ); vm.totalProjectPayments( dbo.helpers.thousandSeparator( vm.totalProjectPayments() ) );
@@ -81,6 +87,22 @@ dbo.invoicereportInit = function () {
} ); } );
}, },
toggleArchive: function () {
var vm = dbo.invoicereport;
vm.archive( !vm.archive() );
vm.initModule();
},
sortList: function ( orderType ) {
var vm = dbo.invoicereport;
vm.orderType = orderType;
vm.orderDirection = !vm.orderDirection;
vm.initModule();
},
resetTotals: function () { resetTotals: function () {
var vm = dbo.invoicereport; var vm = dbo.invoicereport;
@@ -165,6 +187,7 @@ dbo.invoicereportInit = function () {
Monthforecast: function ( data ) { Monthforecast: function ( data ) {
var vm = dbo.invoicereport; var vm = dbo.invoicereport;
var self = this; var self = this;
self.projectnumber = data.projectnumber;
self.projectname = data.projectname; self.projectname = data.projectname;
self.customer = data.customer; self.customer = data.customer;
self.needInvoice = data.needInvoice; self.needInvoice = data.needInvoice;
@@ -175,7 +198,7 @@ dbo.invoicereportInit = function () {
_.each( data.forecastMonths, function ( p, i ) { _.each( data.forecastMonths, function ( p, i ) {
self.forecastMonths.push( new vm.ForecastMonth( p ) ); self.forecastMonths.push( new vm.ForecastMonth( p ) );
_.each( vm.monthTotals(), function ( q ) { _.each( vm.monthTotals(), function ( q ) {
if ( q.monthID == i ) q.forecastamount( Number( q.forecastamount() ) + Number(p.forecastamount) ); if ( q.monthID == i ) q.forecastamount( Number( q.forecastamount() ) + Number( p.forecastamount ) );
} ); } );
} ); } );
}, },
@@ -195,7 +218,7 @@ dbo.invoicereportInit = function () {
_.each( data.monthPayments, function ( p, i ) { _.each( data.monthPayments, function ( p, i ) {
self.paymentMonths.push( new vm.PaymentMonth( p ) ); self.paymentMonths.push( new vm.PaymentMonth( p ) );
_.each( vm.monthPaymentTotals(), function ( q ) { _.each( vm.monthPaymentTotals(), function ( q ) {
if ( q.monthID == i ) q.paymentamount( Number( q.paymentamount() ) + Number(p.paymentamount) ); if ( q.monthID == i ) q.paymentamount( Number( q.paymentamount() ) + Number( p.paymentamount ) );
} ); } );
} ); } );
}, },
@@ -204,10 +227,10 @@ dbo.invoicereportInit = function () {
this.paymentamount = dbo.helpers.thousandSeparator( data.paymentamount ); this.paymentamount = dbo.helpers.thousandSeparator( data.paymentamount );
}, },
createSpreadsheet:function(){ createSpreadsheet: function () {
var vm = dbo.invoicereport; var vm = dbo.invoicereport;
var url = 'index.php/reports/reportsController/createInvoicesSpreadsheet/' + vm.selectedYear(); var url = 'index.php/reports/reportsController/createInvoicesSpreadsheet/' + vm.selectedYear();
window.open(url, '_blank'); window.open( url, '_blank' );
} }
} }
@@ -39,6 +39,7 @@ dbo.monthlyemployeehoursInit = function () {
totalNextFinancialYear : ko.observable(), totalNextFinancialYear : ko.observable(),
totalInvoicedYear : ko.observableArray( [] ), totalInvoicedYear : ko.observableArray( [] ),
validYear : ko.observable( true ), validYear : ko.observable( true ),
archive : ko.observable(),
init: function () { init: function () {
var vm = dbo.monthlyEmployeeHoursModel; var vm = dbo.monthlyEmployeeHoursModel;
@@ -72,7 +73,9 @@ dbo.monthlyemployeehoursInit = function () {
vm.uniqueEmployees.push( new vm.UniqueEmployee( p ) ) vm.uniqueEmployees.push( new vm.UniqueEmployee( p ) )
} ); } );
} ); } );
dbo.reportsDataService.getRecapProjects( function ( data ) {
var archive = vm.archive() ? 'T' : 'F';
dbo.reportsDataService.getRecapProjects( archive, function ( data ) {
vm.recap.removeAll(); vm.recap.removeAll();
vm.uniqueYears.removeAll(); vm.uniqueYears.removeAll();
$.each( data, function ( i, p ) { $.each( data, function ( i, p ) {
@@ -90,7 +93,7 @@ dbo.monthlyemployeehoursInit = function () {
vm.totalSaldo( dbo.helpers.thousandSeparator( vm.totalSaldo() ) ); vm.totalSaldo( dbo.helpers.thousandSeparator( vm.totalSaldo() ) );
vm.totalWorkInProgress( dbo.helpers.thousandSeparator( vm.totalWorkInProgress() ) ); vm.totalWorkInProgress( dbo.helpers.thousandSeparator( vm.totalWorkInProgress() ) );
vm.totalEmployeeRevenues( dbo.helpers.thousandSeparator( vm.totalEmployeeRevenues() ) ); vm.totalEmployeeRevenues( dbo.helpers.thousandSeparator( vm.totalEmployeeRevenues() ) );
vm.totalAvailableRevenues( dbo.helpers.thousandSeparator( vm.totalAvailableRevenues() )); vm.totalAvailableRevenues( dbo.helpers.thousandSeparator( vm.totalAvailableRevenues() ) );
vm.totalOwp( dbo.helpers.thousandSeparator( vm.totalOwp() ) ); vm.totalOwp( dbo.helpers.thousandSeparator( vm.totalOwp() ) );
vm.totalEmployeeHours( dbo.helpers.thousandSeparator( vm.totalEmployeeHours() ) ); vm.totalEmployeeHours( dbo.helpers.thousandSeparator( vm.totalEmployeeHours() ) );
_.each( vm.totalPerEmployee(), function ( p ) { _.each( vm.totalPerEmployee(), function ( p ) {
@@ -121,6 +124,13 @@ dbo.monthlyemployeehoursInit = function () {
} ); } );
}, },
toggleArchive: function () {
var vm = dbo.monthlyEmployeeHoursModel;
vm.archive( !vm.archive() );
vm.initModule();
},
checkYear: function () { checkYear: function () {
var vm = dbo.monthlyEmployeeHoursModel; var vm = dbo.monthlyEmployeeHoursModel;
if ( timeout ) { if ( timeout ) {