diversen nav opmerkingen
This commit is contained in:
@@ -41,6 +41,18 @@ class usersController extends MY_Controller {
|
|||||||
$this->json( $user );
|
$this->json( $user );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCurrentUser()
|
||||||
|
{
|
||||||
|
$this->json( $this->user );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUserWithprojects()
|
||||||
|
{
|
||||||
|
$usersWithProjects = User::getUserWithprojects();
|
||||||
|
|
||||||
|
$this->json( $usersWithProjects );
|
||||||
|
}
|
||||||
|
|
||||||
public function getUniqueprojectEmployees()
|
public function getUniqueprojectEmployees()
|
||||||
{
|
{
|
||||||
$projectEmployees = User::getUniqueProjectUsers();
|
$projectEmployees = User::getUniqueProjectUsers();
|
||||||
|
|||||||
@@ -22,11 +22,15 @@ class EmployeeHoursController extends MY_Controller {
|
|||||||
$this->load->library( $libraries );
|
$this->load->library( $libraries );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEmployeehours( $month, $year )
|
public function getEmployeehours( $month, $year, $employeeID )
|
||||||
{
|
{
|
||||||
$employeehours = Employeehour::getEmployeehours( $month, $year );
|
$sql = EmployeehoursMonthly::fire( $month, $year, $employeeID );
|
||||||
|
|
||||||
$this->json( $employeehours );
|
$query = $this->db->query( $sql );
|
||||||
|
|
||||||
|
$result = $query->result();
|
||||||
|
|
||||||
|
$this->json( $result );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHourtypes()
|
public function getHourtypes()
|
||||||
@@ -42,11 +46,31 @@ class EmployeeHoursController extends MY_Controller {
|
|||||||
$data = $this->input->post();
|
$data = $this->input->post();
|
||||||
|
|
||||||
$employeehourID = $data['id'];
|
$employeehourID = $data['id'];
|
||||||
|
$hourType = $data['hourType'];
|
||||||
|
$projectID = $data['project_id'];
|
||||||
unset( $data['id'] );
|
unset( $data['id'] );
|
||||||
|
unset( $data['hourType'] );
|
||||||
|
unset( $data['project_id'] );
|
||||||
|
|
||||||
$data['hourdate'] = date2mysql( $data['hourdate'] );
|
$data['hourdate'] = date2mysql( $data['hourdate'] );
|
||||||
|
|
||||||
$employeehourID = Employeehour::saveEmployeehour( $employeehourID, $data );
|
if ( $hourType == 'PROJECTS' )
|
||||||
|
{
|
||||||
|
$projectemployee = Projectemployee::select( 'id' )
|
||||||
|
->whereUserId( $data['employee_id'] )
|
||||||
|
->whereprojectId( $projectID )
|
||||||
|
->first();
|
||||||
|
$data['projectemployee_id'] = $projectemployee->id;
|
||||||
|
unset( $data['employee_id'] );
|
||||||
|
|
||||||
|
$data['hourtype_id'] = $data['hourtype_id'] - 8;
|
||||||
|
|
||||||
|
$employeehourID = Projecthour::saveProjecthour( $employeehourID, $data );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$employeehourID = Employeehour::saveEmployeehour( $employeehourID, $data );
|
||||||
|
}
|
||||||
|
|
||||||
$this->json( ['employeehourID' => $employeehourID] );
|
$this->json( ['employeehourID' => $employeehourID] );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class ProjectsController extends MY_Controller {
|
|||||||
|
|
||||||
if ( AUTHENTICATED == FALSE ) die( 'NO ACCESS' );
|
if ( AUTHENTICATED == FALSE ) die( 'NO ACCESS' );
|
||||||
|
|
||||||
$models = [];
|
$models = ['projects/Invoices_model'];
|
||||||
$libraries = [];
|
$libraries = [];
|
||||||
|
|
||||||
$this->load->model( $models );
|
$this->load->model( $models );
|
||||||
@@ -38,6 +38,9 @@ class ProjectsController extends MY_Controller {
|
|||||||
{
|
{
|
||||||
$project = Project::getProject( $projectID );
|
$project = Project::getProject( $projectID );
|
||||||
|
|
||||||
|
$project->outstanding =
|
||||||
|
$this->Invoices_model->getOutstandingPerProject( $project->id );
|
||||||
|
|
||||||
$this->json( $project );
|
$this->json( $project );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,15 +23,22 @@ class Employeehour extends BaseModel {
|
|||||||
|
|
||||||
public static function getEmployeehours( $month, $year )
|
public static function getEmployeehours( $month, $year )
|
||||||
{
|
{
|
||||||
$employeehours = Employeehour::whereRaw( "MONTH(hourdate) ={$month} AND YEAR(hourdate) = {$year}" )
|
$employeehours = Employeehour::whereRaw( "MONTH(hourdate) = " . ( $month + 1 ) . " AND YEAR(hourdate) = {$year}" )
|
||||||
->with( [
|
->with( [
|
||||||
'user' => function ( $q ) {
|
'user' => function ( $q ) {
|
||||||
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
|
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
|
||||||
}] )
|
}] )
|
||||||
->with( 'hourtype' )
|
->with( 'hourtype' );
|
||||||
->get();
|
|
||||||
|
|
||||||
return $employeehours;
|
$projecthours = Employeehour::whereRaw("MONTH(hourdate) = " . ( $month + 1 ) . " AND YEAR(hourdate) = {$year}" )->with( [
|
||||||
|
'user' => function ( $q ) {
|
||||||
|
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
|
||||||
|
}] )
|
||||||
|
->with( 'hourtype' );
|
||||||
|
|
||||||
|
$results = $employeehours->union($projecthours)->get();
|
||||||
|
|
||||||
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function saveEmployeehour( $employeehourID, $data )
|
public static function saveEmployeehour( $employeehourID, $data )
|
||||||
|
|||||||
@@ -45,6 +45,16 @@ class User extends BaseModel {
|
|||||||
return $userrole;
|
return $userrole;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getUserWithprojects()
|
||||||
|
{
|
||||||
|
$usersWithProjects =
|
||||||
|
User::selectRaw( "users.id, CONCAT(users.firstname, ' ', users.middlename, ' ', users.lastname) AS fullname" )
|
||||||
|
->with( 'projectemployees.project' )
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return $usersWithProjects;
|
||||||
|
}
|
||||||
|
|
||||||
public static function checkUsername( $username )
|
public static function checkUsername( $username )
|
||||||
{
|
{
|
||||||
$username = strtoupper( $username );
|
$username = strtoupper( $username );
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by Pensare Software.
|
||||||
|
* User: Theo Weijmer
|
||||||
|
* Date: 15/03/2018
|
||||||
|
* Time: 10:47
|
||||||
|
*/
|
||||||
|
|
||||||
|
class EmployeehoursMonthly {
|
||||||
|
|
||||||
|
public static function fire($month, $year, $employeeID)
|
||||||
|
{
|
||||||
|
$month = $month + 1;
|
||||||
|
$sql = "
|
||||||
|
SELECT *
|
||||||
|
FROM (
|
||||||
|
SELECT CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname,
|
||||||
|
hourtype_id,
|
||||||
|
EMH.id,
|
||||||
|
USR.id AS employee_id,
|
||||||
|
hours,
|
||||||
|
DATE_FORMAT(hourdate, '%d-%m-%Y') AS hourdate,
|
||||||
|
NULL AS project_id
|
||||||
|
FROM employeehours EMH
|
||||||
|
JOIN users USR
|
||||||
|
ON USR.id = EMH.employee_id
|
||||||
|
WHERE MONTH(hourdate) = {$month}
|
||||||
|
AND YEAR(hourdate) = {$year} ";
|
||||||
|
if( $employeeID != 0 ) $sql.="AND USR.id = {$employeeID} ";
|
||||||
|
$sql.="
|
||||||
|
UNION
|
||||||
|
SELECT CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname,
|
||||||
|
(SELECT id FROM hourtypes WHERE `key` = 'PROJECTS' LIMIT 1) AS hourtype_id,
|
||||||
|
PRH.id,
|
||||||
|
USR.id AS employee_id,
|
||||||
|
hours,
|
||||||
|
DATE_FORMAT(hourdate, '%d-%m-%Y') AS hourdate,
|
||||||
|
PEM.project_id
|
||||||
|
FROM projecthours PRH
|
||||||
|
JOIN projectemployees PEM
|
||||||
|
ON PEM.id = PRH.projectemployee_id
|
||||||
|
JOIN users USR
|
||||||
|
ON USR.id = PEM.user_id
|
||||||
|
WHERE MONTH(hourdate) = {$month}
|
||||||
|
AND YEAR(hourdate) = {$year} ";
|
||||||
|
if( $employeeID != 0 ) $sql.="AND USR.id = {$employeeID} ";
|
||||||
|
$sql.="
|
||||||
|
) Q1
|
||||||
|
ORDER BY fullname, hourdate ";
|
||||||
|
|
||||||
|
return $sql;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,4 +23,20 @@ class Invoices_model extends MY_Model {
|
|||||||
|
|
||||||
return $invoiced;
|
return $invoiced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
WHERE PRJ.id = {$projectID} ";
|
||||||
|
|
||||||
|
$invoiced = $this->get_query_row( 'outstanding' );
|
||||||
|
|
||||||
|
return $invoiced;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -168,6 +168,26 @@
|
|||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-xl-3 form-control-label">
|
||||||
|
kosten derden
|
||||||
|
</label>
|
||||||
|
<div class="col-xl-4">
|
||||||
|
<div class="input-group input-group-icon">
|
||||||
|
<span class="input-group-addon">
|
||||||
|
<i class="icon fa-euro"></i>
|
||||||
|
</span>
|
||||||
|
<input type="text"
|
||||||
|
placeholder="eigen omzet"
|
||||||
|
class="form-control align-right"
|
||||||
|
data-bind="textInput:costs,
|
||||||
|
event:{keyup:validateNumber}">
|
||||||
|
</div>
|
||||||
|
<small>
|
||||||
|
kosten derden (incl btw)
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-xl-3 form-control-label">
|
<label class="col-xl-3 form-control-label">
|
||||||
acceptatie datum
|
acceptatie datum
|
||||||
|
|||||||
@@ -72,6 +72,11 @@
|
|||||||
</button>
|
</button>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="4">
|
||||||
|
<b><h5>openstaand: <span data-bind="text:dbo.helpers.numberWithPoints(Math.round(outstanding()))"></span></h5></b>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<h4 class="form-control-label">eigenomzet:
|
<h4 class="form-control-label">eigen omzet:
|
||||||
<i class="icon fa-euro"> </i><span data-bind="text:ownRevenue"></span>
|
<i class="icon fa-euro"> </i><span data-bind="text:ownRevenue"></span>
|
||||||
</h4>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -55,19 +55,19 @@
|
|||||||
<!-- <div class="col-md-5">-->
|
<!-- <div class="col-md-5">-->
|
||||||
<!-- --><?php //$this->load->view( 'modals/partials/_projectoffers' ); ?>
|
<!-- --><?php //$this->load->view( 'modals/partials/_projectoffers' ); ?>
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<div class="col-md-7">
|
<div class="col-md-8">
|
||||||
<?php $this->load->view( 'modals/partials/_projectcosts' ); ?>
|
<?php $this->load->view( 'modals/partials/_projectcosts' ); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-5">
|
<div class="col-md-4">
|
||||||
<?php $this->load->view('modals/partials/_forecasts'); ?>
|
<?php $this->load->view( 'modals/partials/_reservations' ); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-9">
|
<div class="col-md-8">
|
||||||
<?php $this->load->view( 'modals/partials/_invoices' ); ?>
|
<?php $this->load->view( 'modals/partials/_invoices' ); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-4">
|
||||||
<?php $this->load->view( 'modals/partials/_reservations' ); ?>
|
<?php $this->load->view('modals/partials/_forecasts'); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,36 +3,45 @@
|
|||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<select class="form-control form-control-sm"
|
<select class="form-control form-control-sm"
|
||||||
data-bind="options:years,
|
data-bind="options:years,
|
||||||
optionsText:'id',
|
optionsText:'year',
|
||||||
optionsValue:'id',
|
optionsValue:'year',
|
||||||
value:selectedYear,
|
value:selectedYear,
|
||||||
event:{change:refreshEmployeehours}"></select>
|
event:{change:refreshEmployeehours}"></select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<select class="form-control form-control-sm"
|
<select class="form-control form-control-sm"
|
||||||
data-bind="options:months,
|
data-bind="options:months,
|
||||||
optionsText:'monthName',
|
optionsText:'month',
|
||||||
optionsValue:'id',
|
optionsValue:'monthID',
|
||||||
value:selectedMonth,
|
value:selectedMonth,
|
||||||
event:{change:refreshEmployeehours}"></select>
|
event:{change:refreshEmployeehours}"></select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<select class="form-control form-control-sm"
|
||||||
|
data-bind="options:employees,
|
||||||
|
optionsText:'fullname',
|
||||||
|
optionsValue:'id',
|
||||||
|
value:$root.selectedEmployeeID,
|
||||||
|
event:{change:refreshEmployeehours}"></select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xl-8">
|
<div class="col-xl-10">
|
||||||
<table class="table table-sm">
|
<table class="table table-sm">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="table-tealish-header">medewerker</th>
|
<th class="table-tealish-header">medewerker</th>
|
||||||
<th class="table-tealish-header">datum</th>
|
<th class="table-tealish-header">datum</th>
|
||||||
<th class="table-tealish-header">soort uren</th>
|
<th class="table-tealish-header">soort uren</th>
|
||||||
|
<th class="table-tealish-header">project</th>
|
||||||
<th class="table-tealish-header">uren</th>
|
<th class="table-tealish-header">uren</th>
|
||||||
<th class="table-tealish-header" width="40px"> </th>
|
<th class="table-tealish-header" width="40px"> </th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody data-bind="foreach:employeehours">
|
<tbody data-bind="foreach:employeehours">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td data-bind="css:{'red-line': id() == 0}">
|
||||||
<span data-bind="text:dbo.helpers.findArrayElement('id', 'fullname', employee_id(), $root.employees()),
|
<span data-bind="text:dbo.helpers.findArrayElement('id', 'fullname', employee_id(), $root.employees()),
|
||||||
visible: ! inEdit()"></span>
|
visible: ! inEdit()"></span>
|
||||||
<select class="form-control form-control-sm"
|
<select class="form-control form-control-sm"
|
||||||
@@ -42,16 +51,17 @@
|
|||||||
value:employee_id,
|
value:employee_id,
|
||||||
optionsCaption: 'selecteer...',
|
optionsCaption: 'selecteer...',
|
||||||
visible:inEdit(),
|
visible:inEdit(),
|
||||||
event:{change:$root.saveEmployeehours}"></select>
|
enable: ! $root.selectedEmployeeID,
|
||||||
|
event:{change:$root.changeEmployee}"></select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td data-bind="css:{'red-line': id() == 0}">
|
||||||
<span data-bind="text:hourdate, visible:! inEdit()"></span>
|
<span data-bind="text:hourdate, visible:! inEdit()"></span>
|
||||||
<input class="form-control form-control-sm"
|
<input class="form-control form-control-sm"
|
||||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||||
value:hourdate, visible:inEdit(),
|
value:hourdate, visible:inEdit(),
|
||||||
event:{change:$root.saveEmployeehour}"
|
event:{change:$root.saveEmployeehour}"
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td data-bind="css:{'red-line': id() == 0}">
|
||||||
<span data-bind="text:dbo.helpers.findArrayElement('id', 'description', hourtype_id(), $root.hourtypes()),
|
<span data-bind="text:dbo.helpers.findArrayElement('id', 'description', hourtype_id(), $root.hourtypes()),
|
||||||
visible: ! inEdit()"></span>
|
visible: ! inEdit()"></span>
|
||||||
<select class="form-control form-control-sm"
|
<select class="form-control form-control-sm"
|
||||||
@@ -63,7 +73,21 @@
|
|||||||
visible:inEdit(),
|
visible:inEdit(),
|
||||||
event:{change:$root.saveEmployeehours}"></select>
|
event:{change:$root.saveEmployeehours}"></select>
|
||||||
</td>
|
</td>
|
||||||
<td class="align-right">
|
<td data-bind="css:{'red-line': id() == 0}">
|
||||||
|
<!-- ko if: hourType() == 'PROJECTS' -->
|
||||||
|
<span data-bind="text:dbo.helpers.findArrayElement('projectID', 'projectname', projectID(), projects()),
|
||||||
|
visible: ! inEdit()"></span>
|
||||||
|
<select class="form-control form-control-sm"
|
||||||
|
data-bind="options:projects,
|
||||||
|
optionsText:'projectname',
|
||||||
|
optionsValue:'projectID',
|
||||||
|
value:projectID,
|
||||||
|
optionsCaption:'selecteer...',
|
||||||
|
visible:inEdit(),
|
||||||
|
event:{change:$root.saveEmployeehours}"></select>
|
||||||
|
<!-- /ko -->
|
||||||
|
</td>
|
||||||
|
<td class="align-right" data-bind="css:{'red-line': id() == 0}">
|
||||||
<span data-bind=" visible: ! inEdit()">
|
<span data-bind=" visible: ! inEdit()">
|
||||||
<span data-bind="text:hours"></span>
|
<span data-bind="text:hours"></span>
|
||||||
uur
|
uur
|
||||||
@@ -74,7 +98,7 @@
|
|||||||
data-bind="textInput:hours, visible:inEdit,
|
data-bind="textInput:hours, visible:inEdit,
|
||||||
event:{change:$root.saveEmployeehours,keyup:$root.validateNumber.bind($data, 'hours')}"/>
|
event:{change:$root.saveEmployeehours,keyup:$root.validateNumber.bind($data, 'hours')}"/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td data-bind="css:{'red-line': id() == 0}">
|
||||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editEmployeehour"></i>
|
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editEmployeehour"></i>
|
||||||
<i class="icon fa-trash redish pointer" title="verwijder"
|
<i class="icon fa-trash redish pointer" title="verwijder"
|
||||||
data-bind="click:$root.removeEmployeehour"></i>
|
data-bind="click:$root.removeEmployeehour"></i>
|
||||||
@@ -83,7 +107,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3" class="">
|
<td colspan="3">
|
||||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newEmployeehour">
|
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newEmployeehour">
|
||||||
nieuwe uren
|
nieuwe uren
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<select class="form-control form-control-sm"
|
<select class="form-control form-control-sm"
|
||||||
data-bind="options:years,
|
data-bind="options:years,
|
||||||
optionsText:'year',
|
optionsText:'year',
|
||||||
optionsValue: 'id',
|
optionsValue: 'year',
|
||||||
value:selectedYear,
|
value:selectedYear,
|
||||||
event:{change:refreshTab}"></select>
|
event:{change:refreshTab}"></select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -22,17 +22,17 @@
|
|||||||
</th>
|
</th>
|
||||||
<!-- /ko -->
|
<!-- /ko -->
|
||||||
<th class="rotate">
|
<th class="rotate">
|
||||||
<div><span>totaal</span></div>
|
<div><span>eigen budget beschikbaar (ex btw)</span></div>
|
||||||
</th>
|
</th>
|
||||||
<th class="rotate">
|
<th class="rotate">
|
||||||
<div><span>budget (ex btw)</span></div>
|
<div><span>totaal geschreven omzet</span></div>
|
||||||
</th>
|
|
||||||
<th class="rotate">
|
|
||||||
<div><span>derden (ex btw)</span></div>
|
|
||||||
</th>
|
|
||||||
<th class="rotate">
|
|
||||||
<div><span>beschikbaar</span></div>
|
|
||||||
</th>
|
</th>
|
||||||
|
<!-- <th class="rotate">-->
|
||||||
|
<!-- <div><span>derden (ex btw)</span></div>-->
|
||||||
|
<!-- </th>-->
|
||||||
|
<!-- <th class="rotate">-->
|
||||||
|
<!-- <div><span>beschikbaar</span></div>-->
|
||||||
|
<!-- </th>-->
|
||||||
<th class="rotate">
|
<th class="rotate">
|
||||||
<div><span>saldo</span></div>
|
<div><span>saldo</span></div>
|
||||||
</th>
|
</th>
|
||||||
@@ -58,21 +58,21 @@
|
|||||||
<span data-bind="text:revenues"></span>
|
<span data-bind="text:revenues"></span>
|
||||||
</td>
|
</td>
|
||||||
<!-- /ko -->
|
<!-- /ko -->
|
||||||
<th class="align-right">
|
<td class="align-right">
|
||||||
|
<span data-bind="text:ownRevenue"></span>
|
||||||
|
</td>
|
||||||
|
<td class="align-right">
|
||||||
<span data-bind="text:totalEmployeeRevenues"></span>
|
<span data-bind="text:totalEmployeeRevenues"></span>
|
||||||
</th>
|
|
||||||
<td class="align-right">
|
|
||||||
<span data-bind="text:budget"></span>
|
|
||||||
</td>
|
|
||||||
<td class="align-right">
|
|
||||||
<span data-bind="text:externCosts"></span>
|
|
||||||
</td>
|
</td>
|
||||||
<th class="align-right">
|
<th class="align-right">
|
||||||
<span data-bind="text:budgetAvailable"></span>
|
<span data-bind="text:availableRevenue"></span>
|
||||||
</th>
|
|
||||||
<th class="align-right">
|
|
||||||
<span data-bind="text:saldo"></span>
|
|
||||||
</th>
|
</th>
|
||||||
|
<!-- <td class="align-right">-->
|
||||||
|
<!-- <span data-bind="text:externCosts"></span>-->
|
||||||
|
<!-- </td>-->
|
||||||
|
<!-- <th class="align-right">-->
|
||||||
|
<!-- <span data-bind="text:saldo"></span>-->
|
||||||
|
<!-- </th>-->
|
||||||
<th class="align-right">
|
<th class="align-right">
|
||||||
<span data-bind="text:workInProgress"></span>
|
<span data-bind="text:workInProgress"></span>
|
||||||
</th>
|
</th>
|
||||||
@@ -91,21 +91,21 @@
|
|||||||
<span data-bind="text:totalRevenue"></span>
|
<span data-bind="text:totalRevenue"></span>
|
||||||
</th>
|
</th>
|
||||||
<!-- /ko -->
|
<!-- /ko -->
|
||||||
|
<th class="align-right">
|
||||||
|
<span data-bind="text:totalOwnRevenue"></span>
|
||||||
|
</th>
|
||||||
<th class="align-right">
|
<th class="align-right">
|
||||||
<span data-bind="text:totalEmployeeRevenues"></span>
|
<span data-bind="text:totalEmployeeRevenues"></span>
|
||||||
</th>
|
</th>
|
||||||
<th class="align-right">
|
<th class="align-right">
|
||||||
<span data-bind="text:totalBudget"></span>
|
<span data-bind="text:totalAvailableRevenues"></span>
|
||||||
</th>
|
|
||||||
<th class="align-right">
|
|
||||||
<span data-bind="text:totalCosts"></span>
|
|
||||||
</th>
|
|
||||||
<th class="align-right">
|
|
||||||
<span data-bind="text:totalAvailableBudget"></span>
|
|
||||||
</th>
|
|
||||||
<th class="align-right">
|
|
||||||
<span data-bind="text:totalSaldo"></span>
|
|
||||||
</th>
|
</th>
|
||||||
|
<!-- <th class="align-right">-->
|
||||||
|
<!-- <span data-bind="text:totalCosts"></span>-->
|
||||||
|
<!-- </th>-->
|
||||||
|
<!-- <th class="align-right">-->
|
||||||
|
<!-- <span data-bind="text:totalSaldo"></span>-->
|
||||||
|
<!-- </th>-->
|
||||||
<th class="align-right">
|
<th class="align-right">
|
||||||
<span data-bind="text:totalWorkInProgress"></span>
|
<span data-bind="text:totalWorkInProgress"></span>
|
||||||
</th>
|
</th>
|
||||||
|
|||||||
@@ -104,6 +104,9 @@ th.focus-green{
|
|||||||
border:0;
|
border:0;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
.red-line{
|
||||||
|
border-bottom: 1px solid red !important;
|
||||||
|
}
|
||||||
|
|
||||||
/*********SWITCH************/
|
/*********SWITCH************/
|
||||||
.onoffswitch {
|
.onoffswitch {
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
dbo.employeehoursDataService = {
|
dbo.employeehoursDataService = {
|
||||||
|
|
||||||
getEmployeehours: function ( $month, $year, callback ) {
|
getEmployeehours: function ( $month, $year, employeeID, callback ) {
|
||||||
$.getJSON( 'index.php/projects/employeeHoursController/getEmployeehours/' + $month + '/' + $year )
|
$.getJSON( 'index.php/projects/employeeHoursController/getEmployeehours/' + $month + '/' + $year + '/' + employeeID )
|
||||||
.done( function ( data ) {
|
.done( function ( data ) {
|
||||||
callback( data );
|
callback( data );
|
||||||
} );
|
} );
|
||||||
|
|||||||
@@ -21,11 +21,25 @@ dbo.userDataService = {
|
|||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
getUniqueProjectEmployees:function(callback){
|
getCurrentUser: function ( callback ) {
|
||||||
$.post('index.php/beheer/usersController/getUniqueprojectEmployees', 'json')
|
$.getJSON( 'index.php/beheer/usersController/getCurrentUser' )
|
||||||
.done(function(data){
|
.done( function ( data ) {
|
||||||
callback(data);
|
callback( data );
|
||||||
});
|
} );
|
||||||
|
},
|
||||||
|
|
||||||
|
getUserWithprojects: function ( callback ) {
|
||||||
|
$.getJSON( 'index.php/beheer/usersController/getUserWithprojects' )
|
||||||
|
.done( function ( data ) {
|
||||||
|
callback( data );
|
||||||
|
} );
|
||||||
|
},
|
||||||
|
|
||||||
|
getUniqueProjectEmployees: function ( callback ) {
|
||||||
|
$.post( 'index.php/beheer/usersController/getUniqueprojectEmployees', 'json' )
|
||||||
|
.done( function ( data ) {
|
||||||
|
callback( data );
|
||||||
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
checkUsername: function ( username, callback ) {
|
checkUsername: function ( username, callback ) {
|
||||||
@@ -44,11 +58,11 @@ dbo.userDataService = {
|
|||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
archiveUser: function(userID, status, callback){
|
archiveUser: function ( userID, status, callback ) {
|
||||||
$.get('index.php/beheer/usersController/archiveUser/' + userID + '/' + status)
|
$.get( 'index.php/beheer/usersController/archiveUser/' + userID + '/' + status )
|
||||||
.done(function(){
|
.done( function () {
|
||||||
callback();
|
callback();
|
||||||
});
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
removeUser: function ( userID, callback ) {
|
removeUser: function ( userID, callback ) {
|
||||||
@@ -57,6 +71,8 @@ dbo.userDataService = {
|
|||||||
callback( data );
|
callback( data );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dbo.userDataService.getCurrentUser(function(data){
|
||||||
}
|
dbo.currentUser = data;
|
||||||
|
});
|
||||||
@@ -56,7 +56,7 @@ dbo.helpers = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
findArrayElement: function ( toFind, element, value, array ) {
|
findArrayElement: function ( toFind, element, value, array ) {
|
||||||
// console.log( toFind );
|
// 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 );
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ $( function () {
|
|||||||
offerleader_id : ko.observable(),
|
offerleader_id : ko.observable(),
|
||||||
own_revenue : ko.observable(),
|
own_revenue : ko.observable(),
|
||||||
other_revenue : ko.observable(),
|
other_revenue : ko.observable(),
|
||||||
|
costs : ko.observable(),
|
||||||
hasProject : ko.observable(),
|
hasProject : ko.observable(),
|
||||||
|
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -54,6 +55,7 @@ $( function () {
|
|||||||
offernumber : vm.offernumber(),
|
offernumber : vm.offernumber(),
|
||||||
own_revenue : vm.own_revenue(),
|
own_revenue : vm.own_revenue(),
|
||||||
other_revenue : vm.other_revenue(),
|
other_revenue : vm.other_revenue(),
|
||||||
|
costs : vm.costs(),
|
||||||
startdate : vm.startdate(),
|
startdate : vm.startdate(),
|
||||||
acceptance_chance: vm.acceptance_chance(),
|
acceptance_chance: vm.acceptance_chance(),
|
||||||
accepteddate : vm.accepteddate(),
|
accepteddate : vm.accepteddate(),
|
||||||
@@ -64,7 +66,7 @@ $( function () {
|
|||||||
if ( data.createProject ) {
|
if ( data.createProject ) {
|
||||||
tellMe( {
|
tellMe( {
|
||||||
title : 'project aanmaken',
|
title : 'project aanmaken',
|
||||||
message : 'De offerte is goedgekeurt maar nog niet gekoppeld aan een project, wilt u een project aanmaken?',
|
message : 'De offerte is goedgekeurd maar nog niet gekoppeld aan een project, wilt u een project aanmaken?',
|
||||||
notify : true,
|
notify : true,
|
||||||
noText : 'Nee, maak geen project aan',
|
noText : 'Nee, maak geen project aan',
|
||||||
yesText : 'Ja, maak een project aan',
|
yesText : 'Ja, maak een project aan',
|
||||||
@@ -77,7 +79,7 @@ $( function () {
|
|||||||
title : 'project aangemaakt',
|
title : 'project aangemaakt',
|
||||||
message : 'er is een project aangemaakt met nummer: ' + data.projectnumber,
|
message : 'er is een project aangemaakt met nummer: ' + data.projectnumber,
|
||||||
modalClass: 'modal-success'
|
modalClass: 'modal-success'
|
||||||
}, function(){
|
}, function () {
|
||||||
vm.hideOfferModal();
|
vm.hideOfferModal();
|
||||||
vm.callback();
|
vm.callback();
|
||||||
} );
|
} );
|
||||||
@@ -104,7 +106,7 @@ $( function () {
|
|||||||
message : errorMessage,
|
message : errorMessage,
|
||||||
modalClass: 'modal-danger'
|
modalClass: 'modal-danger'
|
||||||
} );
|
} );
|
||||||
}else{
|
} else {
|
||||||
vm.hideOfferModal();
|
vm.hideOfferModal();
|
||||||
vm.callback();
|
vm.callback();
|
||||||
}
|
}
|
||||||
@@ -132,7 +134,8 @@ $( function () {
|
|||||||
vm.accepteddate( offer.accepteddate || null );
|
vm.accepteddate( offer.accepteddate || null );
|
||||||
vm.rejectdate( offer.rejectdate || null );
|
vm.rejectdate( offer.rejectdate || null );
|
||||||
vm.own_revenue( offer.own_revenue || 0 );
|
vm.own_revenue( offer.own_revenue || 0 );
|
||||||
vm.other_revenue( offer.other_revenue || 0 )
|
vm.other_revenue( offer.other_revenue || 0 );
|
||||||
|
vm.costs( offer.costs || 0 );
|
||||||
},
|
},
|
||||||
|
|
||||||
showOfferModal: function () {
|
showOfferModal: function () {
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ $( function () {
|
|||||||
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(),
|
||||||
|
toForecast : ko.observable(),
|
||||||
|
totalForecast : ko.observable(),
|
||||||
|
|
||||||
init: function () {
|
init: function () {
|
||||||
var vm = dbo.editProjectModal;
|
var vm = dbo.editProjectModal;
|
||||||
@@ -700,14 +703,15 @@ $( function () {
|
|||||||
vm.enddate( dbo.helpers.mysql2date( data.enddate ) );
|
vm.enddate( dbo.helpers.mysql2date( data.enddate ) );
|
||||||
vm.projectnumber( data.projectnumber );
|
vm.projectnumber( data.projectnumber );
|
||||||
vm.projectname( data.projectname );
|
vm.projectname( data.projectname );
|
||||||
|
vm.outstanding( data.outstanding );
|
||||||
|
|
||||||
vm.projectEmployees.removeAll();
|
vm.projectEmployees.removeAll();
|
||||||
vm.projecthours.removeAll();
|
vm.projecthours.removeAll();
|
||||||
$.each( data.projectemployees, function ( i, p ) {
|
_.each( data.projectemployees, function ( p ) {
|
||||||
vm.projectEmployees.push( new vm.Projectemployee( p ) );
|
vm.projectEmployees.push( new vm.Projectemployee( p ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
$.each( data.projectemployees, function ( i, p ) {
|
_.each( data.projectemployees, function ( p ) {
|
||||||
var fullname = p.user ? p.user.fullname : '#NB';
|
var fullname = p.user ? p.user.fullname : '#NB';
|
||||||
$.each( p.projecthours, function ( b, q ) {
|
$.each( p.projecthours, function ( b, q ) {
|
||||||
vm.projecthours.push( new vm.Projecthour( q, fullname ) );
|
vm.projecthours.push( new vm.Projecthour( q, fullname ) );
|
||||||
@@ -715,12 +719,12 @@ $( function () {
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
vm.projectcosts.removeAll();
|
vm.projectcosts.removeAll();
|
||||||
$.each( data.projectcosts, function ( i, p ) {
|
_.each( data.projectcosts, function ( p ) {
|
||||||
vm.projectcosts.push( new vm.Projectcost( p ) );
|
vm.projectcosts.push( new vm.Projectcost( p ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
vm.offers.removeAll();
|
vm.offers.removeAll();
|
||||||
$.each( data.offers, function ( i, p ) {
|
_.each( data.offers, function ( p, i ) {
|
||||||
if ( i == 0 ) {
|
if ( i == 0 ) {
|
||||||
vm.ownRevenue( p.own_revenue );
|
vm.ownRevenue( p.own_revenue );
|
||||||
vm.otherRevenue( p.other_revenue );
|
vm.otherRevenue( p.other_revenue );
|
||||||
@@ -729,17 +733,17 @@ $( function () {
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
vm.invoices.removeAll();
|
vm.invoices.removeAll();
|
||||||
$.each( data.invoices, function ( i, p ) {
|
_.each( data.invoices, function ( p ) {
|
||||||
vm.invoices.push( new vm.Invoice( p ) );
|
vm.invoices.push( new vm.Invoice( p ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
vm.forecasts.removeAll();
|
vm.forecasts.removeAll();
|
||||||
$.each( data.forecasts, function ( i, p ) {
|
_.each( data.forecasts, function ( p ) {
|
||||||
vm.forecasts.push( new vm.Forecast( p ) );
|
vm.forecasts.push( new vm.Forecast( p ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
vm.reservations.removeAll();
|
vm.reservations.removeAll();
|
||||||
$.each( data.reservations, function ( i, p ) {
|
_.each( data.reservations, function ( p ) {
|
||||||
vm.reservations.push( new vm.Reservation( p ) );
|
vm.reservations.push( new vm.Reservation( p ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|||||||
@@ -13,30 +13,34 @@ dbo.employeehoursInit = function () {
|
|||||||
} else {
|
} else {
|
||||||
dbo.employeehoursModel = {
|
dbo.employeehoursModel = {
|
||||||
|
|
||||||
employeehours: ko.observableArray( [] ),
|
employeehours : ko.observableArray( [] ),
|
||||||
archive : ko.observable( false ),
|
archive : ko.observable( false ),
|
||||||
months : ko.observableArray( [] ),
|
months : ko.observableArray( [] ),
|
||||||
years : ko.observableArray( [] ),
|
years : ko.observableArray( [] ),
|
||||||
hourtypes : ko.observableArray( [] ),
|
hourtypes : ko.observableArray( [] ),
|
||||||
employees : ko.observableArray( [] ),
|
employees : ko.observableArray( [] ),
|
||||||
selectedYear : ko.observable(),
|
selectedYear : ko.observable(),
|
||||||
selectedMonth: ko.observable(),
|
selectedMonth : ko.observable(),
|
||||||
busy : false,
|
busy : false,
|
||||||
|
selectedEmployeeID: ko.observable(),
|
||||||
|
|
||||||
init: function () {
|
init: function () {
|
||||||
var vm = dbo.employeehoursModel;
|
var vm = dbo.employeehoursModel;
|
||||||
|
|
||||||
vm.createMonths();
|
vm.months( dbo.monthArray );
|
||||||
vm.createYears();
|
vm.years( dbo.years );
|
||||||
|
|
||||||
var d = new Date();
|
vm.selectedMonth( dbo.currentMonth );
|
||||||
vm.selectedMonth( d.getMonth() + 1 );
|
vm.selectedYear( dbo.currentYear );
|
||||||
vm.selectedYear( d.getFullYear() );
|
|
||||||
|
|
||||||
dbo.employeehoursDataService.getHourtypes( function ( data ) {
|
dbo.employeehoursDataService.getHourtypes( function ( data ) {
|
||||||
vm.hourtypes( data );
|
vm.hourtypes( data );
|
||||||
dbo.userDataService.getAllUsers( 'F', function ( data ) {
|
dbo.userDataService.getUserWithprojects( function ( data ) {
|
||||||
vm.employees( data );
|
vm.employees.removeAll();
|
||||||
|
_.each( data, function ( p ) {
|
||||||
|
vm.employees.push( new vm.Employee( p ) );
|
||||||
|
} );
|
||||||
|
vm.selectedEmployeeID( dbo.currentUser.id )
|
||||||
|
|
||||||
vm.refreshEmployeehours();
|
vm.refreshEmployeehours();
|
||||||
} );
|
} );
|
||||||
@@ -46,12 +50,22 @@ dbo.employeehoursInit = function () {
|
|||||||
newEmployeehour: function () {
|
newEmployeehour: function () {
|
||||||
var vm = dbo.employeehoursModel;
|
var vm = dbo.employeehoursModel;
|
||||||
|
|
||||||
|
var employeeHour = vm.employeehours()[vm.employeehours().length - 1];
|
||||||
|
|
||||||
|
var employeeID = null;
|
||||||
|
if ( !vm.selectedEmployeeID ) {
|
||||||
|
employeeID = employeeHour ? employeeHour.employee_id() : null;
|
||||||
|
} else {
|
||||||
|
employeeID = vm.selectedEmployeeID();
|
||||||
|
}
|
||||||
|
|
||||||
var employeehour = {
|
var employeehour = {
|
||||||
id : 0,
|
id : 0,
|
||||||
employee_id: null,
|
employee_id: employeeID,
|
||||||
hourdate : null,
|
hourdate : employeeHour ? employeeHour.hourdate() : null,
|
||||||
hourtype_id: null,
|
hourtype_id: employeeHour ? employeeHour.hourtype_id() : 9,
|
||||||
hours : 0,
|
project_id : employeeHour ? employeeHour.projectID() : null,
|
||||||
|
hours : employeeHour ? employeeHour.hours() : 0,
|
||||||
inEdit : true
|
inEdit : true
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -66,30 +80,43 @@ dbo.employeehoursInit = function () {
|
|||||||
vm.refreshHours();
|
vm.refreshHours();
|
||||||
},
|
},
|
||||||
|
|
||||||
saveEmployeehours: function () {
|
saveEmployeehours: function ( self = false ) {
|
||||||
var self = this;
|
if ( !self ) self = this;
|
||||||
|
|
||||||
if ( !self.employee_id() ) return;
|
if ( !self.employee_id() ) return;
|
||||||
if ( !self.hourtype_id() ) return;
|
if ( !self.hourtype_id() ) return;
|
||||||
if ( !self.hourdate() ) return;
|
if ( !self.hourdate() ) return;
|
||||||
|
if ( self.hourType() == 'PROJECTS' && !self.projectID() ) return;
|
||||||
|
|
||||||
var submitDATA = {
|
var submitDATA = {
|
||||||
id : self.id,
|
id : self.id(),
|
||||||
employee_id: self.employee_id(),
|
employee_id: self.employee_id(),
|
||||||
hourdate : self.hourdate(),
|
hourdate : self.hourdate(),
|
||||||
hourtype_id: self.hourtype_id(),
|
hourtype_id: self.hourtype_id(),
|
||||||
hours : self.hours()
|
hours : self.hours(),
|
||||||
|
hourType : self.hourType(),
|
||||||
|
project_id : self.projectID()
|
||||||
};
|
};
|
||||||
|
|
||||||
dbo.employeehoursDataService.saveEmployeehour( submitDATA, function ( data ) {
|
dbo.employeehoursDataService.saveEmployeehour( submitDATA, function ( data ) {
|
||||||
self.id = data.employeehourID;
|
self.id( data.employeehourID );
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
editEmployeehour: function () {
|
editEmployeehour: function () {
|
||||||
|
dbo.employeehoursModel.saveEmployeehours( this );
|
||||||
this.inEdit( !this.inEdit() );
|
this.inEdit( !this.inEdit() );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
changeEmployee: function () {
|
||||||
|
var vm = dbo.employeehoursModel;
|
||||||
|
this.projects( vm.setEmployeeProjects( this ) );
|
||||||
|
|
||||||
|
this.projectID( null );
|
||||||
|
|
||||||
|
vm.saveEmployeehours( this );
|
||||||
|
},
|
||||||
|
|
||||||
removeEmployeehour: function () {
|
removeEmployeehour: function () {
|
||||||
var vm = dbo.employeehoursModel;
|
var vm = dbo.employeehoursModel;
|
||||||
var self = this;
|
var self = this;
|
||||||
@@ -103,7 +130,7 @@ dbo.employeehoursInit = function () {
|
|||||||
modalClass: 'modal-warning'
|
modalClass: 'modal-warning'
|
||||||
}, function ( response ) {
|
}, function ( response ) {
|
||||||
if ( response ) {
|
if ( response ) {
|
||||||
dbo.employeehoursDataService.removeEmployeehour( self.id, function ( data ) {
|
dbo.employeehoursDataService.removeEmployeehour( self.id(), function ( data ) {
|
||||||
if ( data.result ) {
|
if ( data.result ) {
|
||||||
vm.refreshEmployeehours();
|
vm.refreshEmployeehours();
|
||||||
} else {
|
} else {
|
||||||
@@ -118,58 +145,73 @@ dbo.employeehoursInit = function () {
|
|||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
createMonths: function () {
|
|
||||||
var vm = dbo.employeehoursModel;
|
|
||||||
|
|
||||||
var months = [
|
|
||||||
{id: 1, monthName: 'januari'},
|
|
||||||
{id: 2, monthName: 'februari'},
|
|
||||||
{id: 3, monthName: 'maart'},
|
|
||||||
{id: 4, monthName: 'april'},
|
|
||||||
{id: 5, monthName: 'mei'},
|
|
||||||
{id: 6, monthName: 'juni'},
|
|
||||||
{id: 7, monthName: 'juli'},
|
|
||||||
{id: 8, monthName: 'augustus'},
|
|
||||||
{id: 9, monthName: 'september'},
|
|
||||||
{id: 10, monthName: 'oktober'},
|
|
||||||
{id: 11, monthName: 'november'},
|
|
||||||
{id: 12, monthName: 'december'},
|
|
||||||
]
|
|
||||||
|
|
||||||
vm.months( months );
|
|
||||||
},
|
|
||||||
|
|
||||||
createYears: function () {
|
|
||||||
var vm = dbo.employeehoursModel;
|
|
||||||
var years = [{id: 2015}, {id: 2016}, {id: 2017}, {id: 2018}];
|
|
||||||
|
|
||||||
vm.years( years );
|
|
||||||
},
|
|
||||||
|
|
||||||
refreshEmployeehours: function () {
|
refreshEmployeehours: function () {
|
||||||
var vm = dbo.employeehoursModel;
|
var vm = dbo.employeehoursModel;
|
||||||
|
|
||||||
|
var employeeID = vm.selectedEmployeeID() || 0;
|
||||||
|
|
||||||
vm.employeehours.removeAll();
|
vm.employeehours.removeAll();
|
||||||
dbo.employeehoursDataService.getEmployeehours( vm.selectedMonth(), vm.selectedYear(), function ( data ) {
|
dbo.employeehoursDataService.getEmployeehours(
|
||||||
$.each( data, function ( i, p ) {
|
vm.selectedMonth(), vm.selectedYear(), employeeID, function ( data ) {
|
||||||
vm.employeehours.push( new vm.Employeehour( p ) );
|
$.each( data, function ( i, p ) {
|
||||||
|
vm.employeehours.push( new vm.Employeehour( p ) );
|
||||||
|
} );
|
||||||
} );
|
} );
|
||||||
} );
|
|
||||||
},
|
},
|
||||||
|
|
||||||
validateNumber: function ( field ) {
|
validateNumber: function ( field ) {
|
||||||
this[field]( dbo.helpers.validateNumber( this[field](), true ) );
|
this[field]( dbo.helpers.validateNumber( this[field](), true ) );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Employee: function ( data ) {
|
||||||
|
var vm = dbo.employeehoursModel;
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
self.id = data.id;
|
||||||
|
self.fullname = data.fullname;
|
||||||
|
|
||||||
|
self.projecten = ko.observableArray( [] );
|
||||||
|
_.each( data.projectemployees, function ( p ) {
|
||||||
|
self.projecten.push( new vm.Project( p ) );
|
||||||
|
} );
|
||||||
|
},
|
||||||
|
|
||||||
|
Project: function ( data ) {
|
||||||
|
this.projectEmployeeID = data.id;
|
||||||
|
this.projectID = data.project.id;
|
||||||
|
this.project = data.project.projectnumber + ' - ' + data.project.projectname;
|
||||||
|
},
|
||||||
|
|
||||||
Employeehour: function ( data ) {
|
Employeehour: function ( data ) {
|
||||||
var vm = dbo.employeehoursModel;
|
var vm = dbo.employeehoursModel;
|
||||||
|
var self = this;
|
||||||
|
|
||||||
this.id = data.id;
|
self.id = ko.observable( data.id );
|
||||||
this.employee_id = ko.observable( data.employee_id );
|
self.employee_id = ko.observable( data.employee_id );
|
||||||
this.hourtype_id = ko.observable( data.hourtype_id );
|
self.hourtype_id = ko.observable( data.hourtype_id );
|
||||||
this.hourdate = ko.observable( data.hourdate );
|
self.hourdate = ko.observable( data.hourdate );
|
||||||
this.hours = ko.observable( data.hours );
|
self.hours = ko.observable( data.hours );
|
||||||
this.inEdit = ko.observable( data.inEdit || false );
|
self.inEdit = ko.observable( data.inEdit || false );
|
||||||
|
self.projectID = ko.observable( data.project_id );
|
||||||
|
self.hourType = ko.pureComputed( function () {
|
||||||
|
return dbo.helpers.findArrayElement( 'id', 'key', this.hourtype_id(), vm.hourtypes() );
|
||||||
|
}, this );
|
||||||
|
|
||||||
|
vm.setEmployeeProjects( self );
|
||||||
|
},
|
||||||
|
|
||||||
|
setEmployeeProjects: function ( self ) {
|
||||||
|
var vm = dbo.employeehoursModel;
|
||||||
|
|
||||||
|
var employeeProjects =
|
||||||
|
dbo.helpers.findArrayElement( 'id', 'projecten', self.employee_id(), vm.employees() )();
|
||||||
|
self.projects = ko.observableArray( [] );
|
||||||
|
_.each( employeeProjects, function ( p ) {
|
||||||
|
self.projects.push( {
|
||||||
|
projectID : p.projectID,
|
||||||
|
projectname: p.project
|
||||||
|
} );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,11 @@ dbo.monthlyemployeehoursInit = function () {
|
|||||||
recap : ko.observableArray( [] ),
|
recap : ko.observableArray( [] ),
|
||||||
totalPerEmployee : ko.observableArray( [] ),
|
totalPerEmployee : ko.observableArray( [] ),
|
||||||
totalEmployeeRevenues : ko.observable(),
|
totalEmployeeRevenues : ko.observable(),
|
||||||
|
totalAvailableRevenues : ko.observable(),
|
||||||
totalEmployeeHours : ko.observable(),
|
totalEmployeeHours : ko.observable(),
|
||||||
totalEmployeeAvailableHours: ko.observable(),
|
totalEmployeeAvailableHours: ko.observable(),
|
||||||
totalBudget : ko.observable(),
|
totalBudget : ko.observable(),
|
||||||
|
totalOwnRevenue : ko.observable(),
|
||||||
totalCosts : ko.observable(),
|
totalCosts : ko.observable(),
|
||||||
totalAvailableBudget : ko.observable(),
|
totalAvailableBudget : ko.observable(),
|
||||||
totalSaldo : ko.observable(),
|
totalSaldo : ko.observable(),
|
||||||
@@ -37,12 +39,8 @@ dbo.monthlyemployeehoursInit = function () {
|
|||||||
var vm = dbo.monthlyEmployeeHoursModel;
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
|
|
||||||
dbo.reportsDataService.getUsedYears( function ( data ) {
|
dbo.reportsDataService.getUsedYears( function ( data ) {
|
||||||
vm.years.removeAll();
|
vm.years( dbo.years )
|
||||||
$.each( data, function ( i, p ) {
|
vm.selectedYear( dbo.currentYear );
|
||||||
vm.years.push( {id: p.year, year: p.year} );
|
|
||||||
} );
|
|
||||||
|
|
||||||
vm.selectedYear( (new Date()).getFullYear() );
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
vm.initModule();
|
vm.initModule();
|
||||||
@@ -51,11 +49,13 @@ dbo.monthlyemployeehoursInit = function () {
|
|||||||
initModule: function () {
|
initModule: function () {
|
||||||
var vm = dbo.monthlyEmployeeHoursModel;
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
vm.totalBudget( 0 );
|
vm.totalBudget( 0 );
|
||||||
|
vm.totalOwnRevenue( 0 );
|
||||||
vm.totalCosts( 0 );
|
vm.totalCosts( 0 );
|
||||||
vm.totalAvailableBudget( 0 );
|
vm.totalAvailableBudget( 0 );
|
||||||
vm.totalSaldo( 0 );
|
vm.totalSaldo( 0 );
|
||||||
vm.totalWorkInProgress( 0 );
|
vm.totalWorkInProgress( 0 );
|
||||||
vm.totalEmployeeRevenues( 0 );
|
vm.totalEmployeeRevenues( 0 );
|
||||||
|
vm.totalAvailableRevenues(0)
|
||||||
vm.totalEmployeeHours( 0 );
|
vm.totalEmployeeHours( 0 );
|
||||||
vm.totalEmployeeAvailableHours( 0 );
|
vm.totalEmployeeAvailableHours( 0 );
|
||||||
vm.totalPerEmployee.removeAll();
|
vm.totalPerEmployee.removeAll();
|
||||||
@@ -78,11 +78,13 @@ dbo.monthlyemployeehoursInit = function () {
|
|||||||
vm.recap.push( new vm.Project( p ) )
|
vm.recap.push( new vm.Project( p ) )
|
||||||
} );
|
} );
|
||||||
vm.totalBudget( dbo.helpers.thousandSeparator( vm.totalBudget() ) );
|
vm.totalBudget( dbo.helpers.thousandSeparator( vm.totalBudget() ) );
|
||||||
|
vm.totalOwnRevenue( dbo.helpers.thousandSeparator( vm.totalOwnRevenue() ) );
|
||||||
vm.totalCosts( dbo.helpers.thousandSeparator( vm.totalCosts() ) );
|
vm.totalCosts( dbo.helpers.thousandSeparator( vm.totalCosts() ) );
|
||||||
vm.totalAvailableBudget( dbo.helpers.thousandSeparator( vm.totalAvailableBudget() ) );
|
vm.totalAvailableBudget( dbo.helpers.thousandSeparator( vm.totalAvailableBudget() ) );
|
||||||
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.totalEmployeeHours( dbo.helpers.thousandSeparator( vm.totalEmployeeHours() ) );
|
vm.totalEmployeeHours( dbo.helpers.thousandSeparator( vm.totalEmployeeHours() ) );
|
||||||
_.each( vm.totalPerEmployee(), function ( p ) {
|
_.each( vm.totalPerEmployee(), function ( p ) {
|
||||||
p.totalRevenue( dbo.helpers.thousandSeparator( p.totalRevenue() ) );
|
p.totalRevenue( dbo.helpers.thousandSeparator( p.totalRevenue() ) );
|
||||||
@@ -286,8 +288,10 @@ dbo.monthlyemployeehoursInit = function () {
|
|||||||
self.revenues = dbo.helpers.thousandSeparator( data.budget );
|
self.revenues = dbo.helpers.thousandSeparator( data.budget );
|
||||||
self.hours = data.hours;
|
self.hours = data.hours;
|
||||||
self.totalEmpoloyeeRevenues = 0;
|
self.totalEmpoloyeeRevenues = 0;
|
||||||
|
self.availableRevenue = data.own_revenue - data.projectEuros;
|
||||||
self.externCosts = dbo.helpers.thousandSeparator( data.projectcosts );
|
self.externCosts = dbo.helpers.thousandSeparator( data.projectcosts );
|
||||||
self.budget = dbo.helpers.thousandSeparator( data.budget );
|
self.budget = dbo.helpers.thousandSeparator( data.budget );
|
||||||
|
self.ownRevenue = dbo.helpers.thousandSeparator( data.own_revenue );
|
||||||
self.budgetAvailable = dbo.helpers.thousandSeparator( data.budgetAvailable );
|
self.budgetAvailable = dbo.helpers.thousandSeparator( data.budgetAvailable );
|
||||||
self.saldo = dbo.helpers.thousandSeparator( data.saldo );
|
self.saldo = dbo.helpers.thousandSeparator( data.saldo );
|
||||||
|
|
||||||
@@ -300,10 +304,12 @@ dbo.monthlyemployeehoursInit = function () {
|
|||||||
self.totalEmployeeRevenues = data.projectEuros;
|
self.totalEmployeeRevenues = data.projectEuros;
|
||||||
self.totalEmployeeHours = data.projectHours;
|
self.totalEmployeeHours = data.projectHours;
|
||||||
self.hoursAvailable = data.hoursAvailable;
|
self.hoursAvailable = data.hoursAvailable;
|
||||||
|
vm.totalAvailableRevenues( vm.totalAvailableRevenues() + self.availableRevenue );
|
||||||
vm.totalEmployeeRevenues( vm.totalEmployeeRevenues() + Number( self.totalEmployeeRevenues ) );
|
vm.totalEmployeeRevenues( vm.totalEmployeeRevenues() + Number( self.totalEmployeeRevenues ) );
|
||||||
vm.totalEmployeeHours( vm.totalEmployeeHours() + Number( self.totalEmployeeHours ) );
|
vm.totalEmployeeHours( vm.totalEmployeeHours() + Number( self.totalEmployeeHours ) );
|
||||||
vm.totalEmployeeAvailableHours( vm.totalEmployeeAvailableHours() + Number( self.hoursAvailable ) );
|
vm.totalEmployeeAvailableHours( vm.totalEmployeeAvailableHours() + Number( self.hoursAvailable ) );
|
||||||
self.totalEmployeeRevenues = dbo.helpers.thousandSeparator( self.totalEmployeeRevenues );
|
self.totalEmployeeRevenues = dbo.helpers.thousandSeparator( self.totalEmployeeRevenues );
|
||||||
|
self.availableRevenue = dbo.helpers.thousandSeparator( self.availableRevenue );
|
||||||
self.workInProgress = dbo.helpers.thousandSeparator( data.workInProgress );
|
self.workInProgress = dbo.helpers.thousandSeparator( data.workInProgress );
|
||||||
self.hoursAvailable = data.hoursAvailable;
|
self.hoursAvailable = data.hoursAvailable;
|
||||||
|
|
||||||
@@ -319,8 +325,9 @@ dbo.monthlyemployeehoursInit = function () {
|
|||||||
var vm = dbo.monthlyEmployeeHoursModel;
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
|
|
||||||
vm.totalBudget( vm.totalBudget() + Number( data.budget ) );
|
vm.totalBudget( vm.totalBudget() + Number( data.budget ) );
|
||||||
|
vm.totalOwnRevenue( vm.totalOwnRevenue() + Number( data.own_revenue ) );
|
||||||
vm.totalCosts( vm.totalCosts() + Number( data.projectcosts ) );
|
vm.totalCosts( vm.totalCosts() + Number( data.projectcosts ) );
|
||||||
vm.totalAvailableBudget( vm.totalAvailableBudget() + Number( data.budgetAvailable ) );
|
vm.totalAvailableBudget( vm.totalAvailableBudget() + Number( data.ownRevenueAvailable ) );
|
||||||
vm.totalSaldo( vm.totalSaldo() + Number( data.saldo ) );
|
vm.totalSaldo( vm.totalSaldo() + Number( data.saldo ) );
|
||||||
vm.totalWorkInProgress( vm.totalWorkInProgress() + Number( data.workInProgress ) );
|
vm.totalWorkInProgress( vm.totalWorkInProgress() + Number( data.workInProgress ) );
|
||||||
|
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ dbo.offersService = {
|
|||||||
this.acceptance_chance = data.acceptance_chance ? data.acceptance_chance : 0;
|
this.acceptance_chance = data.acceptance_chance ? data.acceptance_chance : 0;
|
||||||
this.own_revenue = data.own_revenue;
|
this.own_revenue = data.own_revenue;
|
||||||
this.other_revenue = data.other_revenue;
|
this.other_revenue = data.other_revenue;
|
||||||
|
this.costs = data.costs;
|
||||||
this.archive = data.archive;
|
this.archive = data.archive;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user