Diversen nav opmerkingen
This commit is contained in:
@@ -5,8 +5,8 @@
|
|||||||
* Date: 21/04/2018
|
* Date: 21/04/2018
|
||||||
* Time: 20:08
|
* Time: 20:08
|
||||||
*/
|
*/
|
||||||
//include_once('../application/models/eloquent/Employeetarget.php');
|
|
||||||
|
|
||||||
|
//include_once('../application/models/eloquent/Employeetarget.php');
|
||||||
|
|
||||||
|
|
||||||
class EmployeeTargetController extends MY_Controller {
|
class EmployeeTargetController extends MY_Controller {
|
||||||
@@ -30,5 +30,26 @@ class EmployeeTargetController extends MY_Controller {
|
|||||||
$this->json( $employeeTargets );
|
$this->json( $employeeTargets );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function saveEmployeeTarget()
|
||||||
|
{
|
||||||
|
$employeeTargetValidation = new EmployeeTargetValidation();
|
||||||
|
|
||||||
|
if ( ! $employeeTargetValidation->getValidationResult() )
|
||||||
|
return $this->json( [
|
||||||
|
'success' => FALSE, 'messages' => $employeeTargetValidation->getErrorMessages()] );
|
||||||
|
|
||||||
|
$target = $this->input->post();
|
||||||
|
|
||||||
|
$targetID = $target['id'];
|
||||||
|
unset( $target['id'] );
|
||||||
|
|
||||||
|
$target['endmonth'] = $target['endmonth'] ? $target['endmonth'] : NULL;
|
||||||
|
$target['endyear'] = $target['endyear'] ? $target['endyear'] : NULL;
|
||||||
|
|
||||||
|
$targetID = Employeetarget::saveTarget( $targetID, $target );
|
||||||
|
|
||||||
|
$this->json( ['success' => TRUE, 'targetID' => $targetID] );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -51,6 +51,11 @@ class ReportsController extends MY_Controller {
|
|||||||
|
|
||||||
$result = $query->result();
|
$result = $query->result();
|
||||||
|
|
||||||
|
foreach($result as $user)
|
||||||
|
{
|
||||||
|
$user->targethours = Employeetarget::getTargetHoursPerEmployee( $user->user_id, $year, $month);
|
||||||
|
}
|
||||||
|
|
||||||
$this->json( $result );
|
$this->json( $result );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,22 +27,30 @@ class ReservationsController extends MY_Controller {
|
|||||||
{
|
{
|
||||||
$projects[ $result->projectID ] = [
|
$projects[ $result->projectID ] = [
|
||||||
'projectnumber' => $result->projectnumber,
|
'projectnumber' => $result->projectnumber,
|
||||||
|
'costs' => 0,
|
||||||
'reservation' => 0,
|
'reservation' => 0,
|
||||||
'payed' => 0,
|
'payed' => 0,
|
||||||
'saldo' => 0,
|
'saldo' => 0,
|
||||||
|
'saldoToPay' => 0,
|
||||||
|
'other_revenue' => 0,
|
||||||
'customers' => []
|
'customers' => []
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$projects[ $result->projectID ]['reservation'] += $result->reservation;
|
$projects[ $result->projectID ]['reservation'] += $result->reservation;
|
||||||
|
$projects[ $result->projectID ]['costs'] += $result->costs;
|
||||||
$projects[ $result->projectID ]['payed'] += $result->payed;
|
$projects[ $result->projectID ]['payed'] += $result->payed;
|
||||||
$projects[ $result->projectID ]['saldo'] += $result->saldo;
|
$projects[ $result->projectID ]['saldo'] += $result->saldo;
|
||||||
|
$projects[ $result->projectID ]['saldoToPay'] += $result->saldoToPay;
|
||||||
|
$projects[ $result->projectID ]['other_revenue'] = $result->other_revenue;
|
||||||
|
|
||||||
$projects[ $result->projectID ]['externals'][] = [
|
$projects[ $result->projectID ]['externals'][] = [
|
||||||
'external' => $result->contactperson,
|
'external' => $result->contactperson,
|
||||||
'reservation' => $result->reservation,
|
'reservation' => $result->reservation,
|
||||||
|
'costs' => $result->costs,
|
||||||
'payed' => $result->payed,
|
'payed' => $result->payed,
|
||||||
'saldo' => $result->saldo
|
'saldo' => $result->saldo,
|
||||||
|
'saldoToPay' => $result->saldoToPay
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Pensare Software.
|
||||||
|
* User: Theo Weijmer
|
||||||
|
* Date: 10/07/16
|
||||||
|
* Time: 13:35
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||||
|
|
||||||
|
class EmployeeTargetValidation extends BaseValidation {
|
||||||
|
|
||||||
|
|
||||||
|
protected $validationFields = [
|
||||||
|
'user_id' => [
|
||||||
|
'validations' => 'required|integer',
|
||||||
|
'fieldname' => 'gebruiker'
|
||||||
|
],
|
||||||
|
'startmonth' => [
|
||||||
|
'validations' => 'required|decimal',
|
||||||
|
'fieldname' => 'startmaand'
|
||||||
|
],
|
||||||
|
'startyear' => [
|
||||||
|
'validations' => 'required|integer',
|
||||||
|
'fieldname' => 'startjaar'
|
||||||
|
],
|
||||||
|
'target' =>[
|
||||||
|
'validations' => 'integer',
|
||||||
|
'fieldname' => 'uren target'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
$this->ci =& get_instance();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,4 +15,48 @@ class Employeetarget extends BaseModel {
|
|||||||
return $this->belongsTo( 'User' );
|
return $this->belongsTo( 'User' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function saveTarget( $targetID, $target )
|
||||||
|
{
|
||||||
|
$target = (array) $target;
|
||||||
|
|
||||||
|
if ( $targetID == 0 )
|
||||||
|
{
|
||||||
|
$target = self::create( $target );
|
||||||
|
$targetID = $target['id'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
self::whereId( $targetID )->update( $target );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $targetID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getTargetHoursPerEmployee( $employeeID, $year, $monthID )
|
||||||
|
{
|
||||||
|
$months = $monthID == 0 ? [1,2,3,4,5,6,7,8,9,10,11,12] : [$monthID];
|
||||||
|
|
||||||
|
$targetHours = 0;
|
||||||
|
|
||||||
|
foreach($months as $month)
|
||||||
|
{
|
||||||
|
$targetHours += self::getCurrentMonthTarget( $employeeID, $year, $month);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $targetHours;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCurrentMonthTarget( $employeeID, $year, $month )
|
||||||
|
{
|
||||||
|
$monthTarget = Self::whereUserId($employeeID)
|
||||||
|
->where('startyear', '<=', $year)
|
||||||
|
->where('startmonth', '<=', $month)
|
||||||
|
->orderBy('startyear', 'DESC')
|
||||||
|
->orderBy('startmonth', 'DESC');
|
||||||
|
|
||||||
|
if( $monthTarget->count() == 0 ) return 0;
|
||||||
|
|
||||||
|
return $monthTarget->first()->target;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -14,12 +14,12 @@ class QEmployeeHours {
|
|||||||
SELECT monthID,
|
SELECT monthID,
|
||||||
user_id,
|
user_id,
|
||||||
CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname,
|
CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname,
|
||||||
SUM(projecthours) AS projecthours,
|
ROUND(SUM(projecthours), 0) AS projecthours,
|
||||||
SUM(profitablehours) AS profitablehours,
|
ROUND(SUM(profitablehours), 0) AS profitablehours,
|
||||||
SUM(nonprofitablehours) AS nonprofitablehours,
|
ROUND(SUM(nonprofitablehours), 0) AS nonprofitablehours,
|
||||||
SUM(revenues) AS revenues,
|
ROUND(SUM(revenues), 0) AS revenues,
|
||||||
SUM(nonprojecthours) AS nonprojecthours,
|
ROUND(SUM(nonprojecthours), 0) AS nonprojecthours,
|
||||||
SUM(projecthours + nonprojecthours) AS totalhours,
|
ROUND(SUM(projecthours + nonprojecthours), 0) AS totalhours,
|
||||||
targethours
|
targethours
|
||||||
FROM (
|
FROM (
|
||||||
SELECT employee_id AS user_id,
|
SELECT employee_id AS user_id,
|
||||||
|
|||||||
@@ -10,31 +10,47 @@ class ReservationTotals {
|
|||||||
|
|
||||||
public static function fire()
|
public static function fire()
|
||||||
{
|
{
|
||||||
$sql = "SELECT projectID, externalID, reservation, payed, (reservation - payed) AS saldo, PRJ.projectnumber, EXT.contactperson
|
// UNION ALL wordt gebruikt voor een full outer join
|
||||||
|
$sql = "SELECT Q5.project_id AS projectID, external_id AS externalID,
|
||||||
|
costs, reservation, payed, (reservation - payed) AS saldo,
|
||||||
|
(costs - payed) AS saldoToPay, PRJ.projectnumber, EXT.contactperson,
|
||||||
|
ROUND(( (other_revenue * (100 + (SELECT vatrate from vats where active='T' LIMIT 1))) / 100 ), 0) other_revenue
|
||||||
FROM (
|
FROM (
|
||||||
SELECT COALESCE(RES.project_id, PRC.project_id) AS projectID,
|
SELECT COALESCE(reservation, 0) AS reservation, costs, payed, Q2.external_id, Q2.project_id
|
||||||
COALESCE(RES.external_id, PRC.external_id) AS externalID,
|
FROM (
|
||||||
SUM(COALESCE(reservationamount, 0)) AS reservation,
|
SELECT SUM(reservationamount) AS reservation, external_id, project_id
|
||||||
SUM(COALESCE(payed, 0)) AS payed
|
FROM reservations
|
||||||
FROM reservations RES
|
GROUP BY external_id, project_id
|
||||||
LEFT JOIN projectcosts PRC
|
) Q1
|
||||||
ON RES.project_id = PRC.project_id AND RES.external_id = PRC.external_id
|
RIGHT JOIN
|
||||||
GROUP BY COALESCE(RES.project_id, PRC.project_id), COALESCE(PRC.external_id, PRC.external_id)
|
(
|
||||||
|
SELECT SUM(costs) AS costs, SUM(payed) AS payed, external_id, project_id
|
||||||
|
FROM projectcosts
|
||||||
|
GROUP BY external_id, project_id
|
||||||
|
) Q2
|
||||||
|
ON Q1.external_id = Q2.external_id AND Q1.project_id = Q2.project_id
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT COALESCE(RES.project_id, PRC.project_id) AS projectID,
|
SELECT reservation, COALESCE(costs, 0), COALESCE(payed, 0), Q3.external_id, Q3.project_id
|
||||||
COALESCE(RES.external_id, PRC.external_id) AS externalID,
|
FROM (
|
||||||
SUM(COALESCE(reservationamount, 0)) AS reservation,
|
SELECT SUM(reservationamount) AS reservation, external_id, project_id
|
||||||
SUM(COALESCE(payed, 0)) AS payed
|
FROM reservations
|
||||||
FROM reservations RES
|
GROUP BY external_id, project_id
|
||||||
RIGHT JOIN projectcosts PRC
|
) Q3
|
||||||
ON RES.project_id = PRC.project_id AND RES.external_id = PRC.external_id
|
LEFT JOIN
|
||||||
WHERE RES.id IS NULL
|
(
|
||||||
GROUP BY COALESCE(RES.project_id, PRC.project_id), COALESCE(RES.external_id, PRC.external_id)
|
SELECT SUM(costs) AS costs, SUM(payed) AS payed, external_id, project_id, id
|
||||||
) Q3
|
FROM projectcosts
|
||||||
|
GROUP BY external_id, project_id
|
||||||
|
) Q4
|
||||||
|
ON Q3.external_id = Q4.external_id AND Q3.project_id = Q4.project_id
|
||||||
|
WHERE Q4.id IS NULL
|
||||||
|
) Q5
|
||||||
JOIN projects PRJ
|
JOIN projects PRJ
|
||||||
ON PRJ.id = Q3.projectID
|
ON PRJ.id = Q5.project_id
|
||||||
JOIN externals EXT
|
JOIN externals EXT
|
||||||
ON EXT.id = Q3.externalID ";
|
ON EXT.id = Q5.external_id
|
||||||
|
JOIN offers OFF
|
||||||
|
ON PRJ.id = OFF.project_id ";
|
||||||
|
|
||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
<div class="modal modal-fade-in-scale-up modal-primary" tabindex="-1" id="employee-target-modal">
|
<div class="modal modal-fade-in-scale-up modal-primary" tabindex="-1" id="employee-target-modal">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document" style="width:700px;">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title">toevoegen / wijzigen medewerker uren
|
<h5 class="modal-title">toevoegen / wijzigen medewerker uren
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>
|
</button>
|
||||||
</h5>
|
</h5>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-10 col-md-offset-1">
|
<div class="col-md-12">
|
||||||
<table class="table table-condensed">
|
<table class="table table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -19,60 +19,72 @@
|
|||||||
<th colspan="2"> </th>
|
<th colspan="2"> </th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>maand</th>
|
<th width="25%">maand</th>
|
||||||
<th>jaar</th>
|
<th width="17%">jaar</th>
|
||||||
<th>maand</th>
|
<th width="25%">maand</th>
|
||||||
<th>jaar</th>
|
<th width="17%">jaar</th>
|
||||||
<th>target per maand</th>
|
<th width="16%" title="target per maand">target p/m</th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<!-- ko foreach:employeeTargets -->
|
<!-- ko foreach:employeeTargets -->
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td data-bind="css:{'red-line': ! saved()}">
|
||||||
<select data-bind="options:years,
|
<select data-bind="options:$root.months,
|
||||||
|
optionsText:'month',
|
||||||
|
optionsValue:'monthID',
|
||||||
|
value:startmonth,
|
||||||
|
disable: ! changeable(),
|
||||||
|
event:{change:$root.setUnsaved}"
|
||||||
|
class="form-control">
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
<td data-bind="css:{'red-line': ! saved()}">
|
||||||
|
<select data-bind="options:$root.years,
|
||||||
optionsText:'year',
|
optionsText:'year',
|
||||||
optionsValue:'year',
|
optionsValue:'year',
|
||||||
value:startyear,
|
value:startyear,
|
||||||
disable: ! changeable()"
|
disable: ! changeable(),
|
||||||
|
event:{change:$root.setUnsaved}"
|
||||||
class="form-control">
|
class="form-control">
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td data-bind="css:{'red-line': ! saved()}">
|
||||||
<select data-bind="options:months,
|
<select data-bind="options:$root.months,
|
||||||
optionsText:'month',
|
optionsText:'month',
|
||||||
optionsValue:'month_id',
|
optionsValue:'monthID',
|
||||||
value:startmonth,
|
value:endmonth,
|
||||||
disable: ! changeable()"
|
disable: ! changeable(),
|
||||||
|
optionsCaption:'selecteer...',
|
||||||
|
event:{change:$root.setUnsaved}"
|
||||||
class="form-control">
|
class="form-control">
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td data-bind="css:{'red-line': ! saved()}">
|
||||||
<select data-bind="options:years,
|
<select data-bind="options:$root.years,
|
||||||
optionsText:'year',
|
optionsText:'year',
|
||||||
optionsValue:'year',
|
optionsValue:'year',
|
||||||
value:endyear,
|
value:endyear,
|
||||||
disable: ! changeable()"
|
disable: ! changeable(),
|
||||||
|
optionsCaption:'selecteer...',
|
||||||
|
event:{change:$root.setUnsaved}"
|
||||||
class="form-control">
|
class="form-control">
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td data-bind="css:{'red-line': ! saved()}">
|
||||||
<select data-bind="options:months,
|
|
||||||
optionsText:'month',
|
|
||||||
optionsValue:'month_id',
|
|
||||||
value:endmonth"
|
|
||||||
class="form-control">
|
|
||||||
</select>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input type="text"
|
<input type="text"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
data-bind="textInput:target">
|
data-bind="textInput:target,
|
||||||
|
disable: ! changeable(),
|
||||||
|
event:{keyup:$root.checkNumeric},
|
||||||
|
event:{change:$root.setUnsaved}">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td data-bind="css:{'red-line': ! saved()}">
|
||||||
<button class="btn btn-success"
|
<button class="btn btn-success"
|
||||||
data-bind="disable: ! validTarget()">
|
data-bind="disable: ! validTarget(),
|
||||||
|
click:$root.saveEmployeeTarget,
|
||||||
|
visible: changeable()">
|
||||||
opslaan
|
opslaan
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
@@ -83,7 +95,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th colspan="6">
|
<th colspan="6">
|
||||||
<i class="icon fa-plus-square-o pull-right pointer"
|
<i class="icon fa-plus-square-o pull-right pointer"
|
||||||
data-bind="click:addEmployeeTarget"></i>
|
data-bind="click:addEmployeeTarget, visible:newTarget()"></i>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
|
|||||||
@@ -5,10 +5,8 @@
|
|||||||
<label>jaar</label>
|
<label>jaar</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<div class="col-md-2">
|
<input type="text" class="form-control" data-bind="textInput:selectedYear, event:{keyup:checkYear}">
|
||||||
<input type="text" class="form-control" data-bind="textInput:selectedYear, event:{keyup:checkYear}" >
|
<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>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -24,7 +22,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div class="tab-pane active">
|
<div class="tab-pane active">
|
||||||
<?php $this->load->view('reports/employeehours/employeemonthhours_view'); ?>
|
<?php $this->load->view( 'reports/employeehours/employeemonthhours_view' ); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
<div id="OUTGOINGINVOICES">
|
<div id="OUTGOINGINVOICES">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xl-1">
|
<div class="col-md-1">
|
||||||
<label>jaar</label>
|
<label>jaar</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xl-3">
|
<div class="col-md-2">
|
||||||
<select class="form-control form-control-sm"
|
<input type="text" class="form-control" data-bind="textInput:selectedYear, event:{keyup:checkYear}">
|
||||||
data-bind="options:years,
|
<div class="invalid-feedback" data-bind="visible: ! validYear()">geen geldig jaar</div>
|
||||||
optionsText:'year',
|
|
||||||
optionsValue: 'id',
|
|
||||||
value:selectedYear,
|
|
||||||
event:{change:refreshInvoiceDetails}"></select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
<div id="RESERVATIONS">
|
<div id="RESERVATIONS">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-12">
|
||||||
<table class="table table-condensed">
|
<table class="table table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="5px"> </th>
|
<th width="5px"> </th>
|
||||||
<th>project</th>
|
<th>project</th>
|
||||||
|
<th class="align-right">Budget derden</th>
|
||||||
|
<th class="align-right">gefactureerd</th>
|
||||||
<th class="align-right">gereserveerd</th>
|
<th class="align-right">gereserveerd</th>
|
||||||
<th class="align-right">betaald</th>
|
<th class="align-right">betaald</th>
|
||||||
<th class="align-right">saldo</th>
|
<th class="align-right">saldo te betalen</th>
|
||||||
|
<th class="align-right">saldo reservering</th>
|
||||||
|
<th class="align-right">saldo te factureren</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<!-- ko foreach:projects -->
|
<!-- ko foreach:projects -->
|
||||||
@@ -25,15 +29,27 @@
|
|||||||
<th>
|
<th>
|
||||||
<span data-bind="text:projectnumber"></span>
|
<span data-bind="text:projectnumber"></span>
|
||||||
</th>
|
</th>
|
||||||
|
<th class="align-right" data-bind="visible: ! showExternals()">
|
||||||
|
<span data-bind="text:otherRevenue"></span>
|
||||||
|
</th>
|
||||||
|
<th class="align-right" data-bind="visible: ! showExternals()">
|
||||||
|
<span data-bind="text:costs"></span>
|
||||||
|
</th>
|
||||||
<th class="align-right" data-bind="visible: ! showExternals()">
|
<th class="align-right" data-bind="visible: ! showExternals()">
|
||||||
<span data-bind="text:reservation"></span>
|
<span data-bind="text:reservation"></span>
|
||||||
</th>
|
</th>
|
||||||
<th class="align-right" data-bind="visible: ! showExternals()">
|
<th class="align-right" data-bind="visible: ! showExternals()">
|
||||||
<span data-bind="text:payed"></span>
|
<span data-bind="text:payed"></span>
|
||||||
</th>
|
</th>
|
||||||
|
<th class="align-right" data-bind="visible: ! showExternals()">
|
||||||
|
<span data-bind="text:saldoToPay"></span>
|
||||||
|
</th>
|
||||||
<th class="align-right" data-bind="visible: ! showExternals()">
|
<th class="align-right" data-bind="visible: ! showExternals()">
|
||||||
<span data-bind="text:saldo"></span>
|
<span data-bind="text:saldo"></span>
|
||||||
</th>
|
</th>
|
||||||
|
<th class="align-right" data-bind="visible: ! showExternals()">
|
||||||
|
<span data-bind="text:saldoInvoices"></span>
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- ko if:showExternals() -->
|
<!-- ko if:showExternals() -->
|
||||||
<!-- ko foreach: externals -->
|
<!-- ko foreach: externals -->
|
||||||
@@ -42,30 +58,50 @@
|
|||||||
<td>
|
<td>
|
||||||
<span data-bind="text:externalName"></span>
|
<span data-bind="text:externalName"></span>
|
||||||
</td>
|
</td>
|
||||||
|
<td> </td>
|
||||||
|
<td class="align-right">
|
||||||
|
<span data-bind="text:costs"></span>
|
||||||
|
</td>
|
||||||
<td class="align-right">
|
<td class="align-right">
|
||||||
<span data-bind="text:reservation"></span>
|
<span data-bind="text:reservation"></span>
|
||||||
</td>
|
</td>
|
||||||
<td class="align-right">
|
<td class="align-right">
|
||||||
<span data-bind="text:payed"></span>
|
<span data-bind="text:payed"></span>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="align-right">
|
||||||
|
<span data-bind="text:saldoToPay"></span>
|
||||||
|
</td>
|
||||||
<td class="align-right">
|
<td class="align-right">
|
||||||
<span data-bind="text:saldo"></span>
|
<span data-bind="text:saldo"></span>
|
||||||
</td>
|
</td>
|
||||||
|
<td> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- /ko -->
|
<!-- /ko -->
|
||||||
<!-- /ko -->
|
<!-- /ko -->
|
||||||
<!-- ko if:showExternals() -->
|
<!-- ko if:showExternals() -->
|
||||||
<tr class="subtotal">
|
<tr class="subtotal">
|
||||||
<th colspan="2">Totaal</th>
|
<th colspan="2">Totaal</th>
|
||||||
|
<th class="align-right">
|
||||||
|
<span data-bind="text:otherRevenue"></span>
|
||||||
|
</th>
|
||||||
|
<th class="align-right">
|
||||||
|
<span data-bind="text:costs"></span>
|
||||||
|
</th>
|
||||||
<th class="align-right">
|
<th class="align-right">
|
||||||
<span data-bind="text:reservation"></span>
|
<span data-bind="text:reservation"></span>
|
||||||
</th>
|
</th>
|
||||||
<th class="align-right">
|
<th class="align-right">
|
||||||
<span data-bind="text:payed"></span>
|
<span data-bind="text:payed"></span>
|
||||||
</th>
|
</th>
|
||||||
|
<th class="align-right">
|
||||||
|
<span data-bind="text:saldoToPay"></span>
|
||||||
|
</th>
|
||||||
<th class="align-right">
|
<th class="align-right">
|
||||||
<span data-bind="text:saldo"></span>
|
<span data-bind="text:saldo"></span>
|
||||||
</th>
|
</th>
|
||||||
|
<th class="align-right">
|
||||||
|
<span data-bind="text:saldoInvoices"></span>
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- /ko -->
|
<!-- /ko -->
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -73,9 +109,13 @@
|
|||||||
<tfoot>
|
<tfoot>
|
||||||
<tr class="grandtotal">
|
<tr class="grandtotal">
|
||||||
<th colspan="2">Grand totaal</th>
|
<th colspan="2">Grand totaal</th>
|
||||||
|
<th class="align-right"><span data-bind="text:otherRevenue"></span></th>
|
||||||
|
<th class="align-right"><span data-bind="text:costs"></span></th>
|
||||||
<th class="align-right"><span data-bind="text:reservation"></span></th>
|
<th class="align-right"><span data-bind="text:reservation"></span></th>
|
||||||
<th class="align-right"><span data-bind="text:payed"></span></th>
|
<th class="align-right"><span data-bind="text:payed"></span></th>
|
||||||
|
<th class="align-right"><span data-bind="text:saldoToPay"></span></th>
|
||||||
<th class="align-right"><span data-bind="text:saldo"></span></th>
|
<th class="align-right"><span data-bind="text:saldo"></span></th>
|
||||||
|
<th class="align-right"><span data-bind="text:saldoInvoices"></span></th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<th class="rotate"><div><span>uren niet declarabel</span></div></th>
|
<th class="rotate"><div><span>uren niet declarabel</span></div></th>
|
||||||
<th class="rotate"><div><span>uren indirect</span></div></th>
|
<th class="rotate"><div><span>uren indirect</span></div></th>
|
||||||
<th class="rotate"><div><span>totaal bestede uren</span></div></th>
|
<th class="rotate"><div><span>totaal bestede uren</span></div></th>
|
||||||
<th class="rotate"><div><span>uren target(1.600 jaar)</span></div></th>
|
<th class="rotate"><div><span>uren jaartarget</span></div></th>
|
||||||
<th class="rotate"><div><span>aandeel uren besteed tov target</span></div></th>
|
<th class="rotate"><div><span>aandeel uren besteed tov target</span></div></th>
|
||||||
<th class="rotate"><div><span>bezettingsgraad totaal<br />aantal gewerkte uren</span></div></th>
|
<th class="rotate"><div><span>bezettingsgraad totaal<br />aantal gewerkte uren</span></div></th>
|
||||||
<th class="rotate"><div><span>bezettingsgraad t.o.v. target<br />factureerbare uren</span></div></th>
|
<th class="rotate"><div><span>bezettingsgraad t.o.v. target<br />factureerbare uren</span></div></th>
|
||||||
|
|||||||
@@ -14,8 +14,12 @@ dbo.employeeTargetDataService = {
|
|||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
addEmployeeTarget: function ( employeeID, callback ) {
|
saveEmployeeTarget: function ( submitDATA, callback ) {
|
||||||
$.post()
|
$.post( 'index.php/beheer/employeetargetController/saveEmployeeTarget', submitDATA, function () {
|
||||||
|
}, 'json' )
|
||||||
|
.done( function ( data ) {
|
||||||
|
callback( data );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -91,5 +91,11 @@ dbo.helpers = {
|
|||||||
if ( !myNumber ) return 0;
|
if ( !myNumber ) return 0;
|
||||||
|
|
||||||
return myNumber.toString().replace( /\B(?=(\d{3})+(?!\d))/g, "." );
|
return myNumber.toString().replace( /\B(?=(\d{3})+(?!\d))/g, "." );
|
||||||
|
},
|
||||||
|
|
||||||
|
isNumeric: function ( n ) {
|
||||||
|
return !isNaN( parseFloat( n ) ) && isFinite( n );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -11,12 +11,20 @@ $( function () {
|
|||||||
|
|
||||||
employeeTargets: ko.observableArray( [] ),
|
employeeTargets: ko.observableArray( [] ),
|
||||||
employeeID : null,
|
employeeID : null,
|
||||||
|
months : ko.observableArray( [] ),
|
||||||
|
years : ko.observableArray( [] ),
|
||||||
|
targetLength : [],
|
||||||
|
newTarget : ko.observable( true ),
|
||||||
|
busy : false,
|
||||||
|
|
||||||
init: function ( employeeID ) {
|
init: function ( employeeID ) {
|
||||||
var vm = dbo.employeeTargetModel;
|
var vm = dbo.employeeTargetModel;
|
||||||
|
|
||||||
vm.employeeID = employeeID;
|
vm.employeeID = employeeID;
|
||||||
|
|
||||||
|
vm.months( dbo.monthArray );
|
||||||
|
vm.years( dbo.years );
|
||||||
|
|
||||||
vm.showModal();
|
vm.showModal();
|
||||||
|
|
||||||
vm.refreshEmployeeTargets();
|
vm.refreshEmployeeTargets();
|
||||||
@@ -28,55 +36,104 @@ $( function () {
|
|||||||
|
|
||||||
addEmployeeTarget: function () {
|
addEmployeeTarget: function () {
|
||||||
var vm = dbo.employeeTargetModel;
|
var vm = dbo.employeeTargetModel;
|
||||||
|
var lastYear = dbo.currentYear;
|
||||||
var targetLength = vm.employeeTargets().length;
|
var lastMonth = dbo.currentMonth;
|
||||||
|
|
||||||
var lastDate = null
|
|
||||||
if ( targetLength > 0 )
|
|
||||||
var lastDate = vm.employeeTargets[targetLength - 1].enddate();
|
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
startdate: lastDate,
|
id : 0,
|
||||||
enddate : null,
|
user_id : vm.employeeID,
|
||||||
target : 0
|
startyear : lastYear,
|
||||||
|
startmonth: lastMonth,
|
||||||
|
endyear : null,
|
||||||
|
endmonth : null,
|
||||||
|
target : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.employeeTargets.push( new vm.Employeetarget( data ) );
|
vm.employeeTargets.push( new vm.Employeetarget( data, (vm.targetLength - 1), false ) );
|
||||||
|
},
|
||||||
|
|
||||||
|
checkNumeric: function () {
|
||||||
|
this.target( dbo.helpers.validateNumber( this.target() ) );
|
||||||
},
|
},
|
||||||
|
|
||||||
saveEmployeeTarget: function () {
|
saveEmployeeTarget: function () {
|
||||||
// if
|
var vm = dbo.employeeTargetModel;
|
||||||
|
var self = this;
|
||||||
|
var submitDATA = {
|
||||||
|
id : self.id,
|
||||||
|
user_id : vm.employeeID,
|
||||||
|
startmonth: self.startmonth(),
|
||||||
|
startyear : self.startyear(),
|
||||||
|
endmonth : self.endmonth() || 0,
|
||||||
|
endyear : self.endyear() || 0,
|
||||||
|
target : self.target()
|
||||||
|
}
|
||||||
|
|
||||||
|
dbo.employeeTargetDataService.saveEmployeeTarget( submitDATA, function ( data ) {
|
||||||
|
if ( !data.success ) return self.saved( false );
|
||||||
|
|
||||||
|
self.saved( true );
|
||||||
|
self.id = data.targetID;
|
||||||
|
} );
|
||||||
|
},
|
||||||
|
|
||||||
|
setUnsaved: function () {
|
||||||
|
var vm = dbo.employeeTargetModel;
|
||||||
|
|
||||||
|
if ( vm.busy ) return;
|
||||||
|
|
||||||
|
this.saved( false );
|
||||||
},
|
},
|
||||||
|
|
||||||
refreshEmployeeTargets: function () {
|
refreshEmployeeTargets: function () {
|
||||||
var vm = dbo.employeeTargetModel;
|
var vm = dbo.employeeTargetModel;
|
||||||
|
|
||||||
|
vm.busy = true;
|
||||||
dbo.employeeTargetDataService.getEmployeeTargets( vm.employeeID, function ( data ) {
|
dbo.employeeTargetDataService.getEmployeeTargets( vm.employeeID, function ( data ) {
|
||||||
vm.employeeTargets.removeAll();
|
vm.employeeTargets.removeAll();
|
||||||
|
|
||||||
var targetLength = data.length
|
vm.targetLength = data.length
|
||||||
var i=0;
|
var i = 0;
|
||||||
_.each( data, function ( p ) {
|
_.each( data, function ( p ) {
|
||||||
vm.employeeTargets.push( new vm.Employeetarget( p, targetLength, i ) );
|
vm.employeeTargets.push( new vm.Employeetarget( p, i, true ) );
|
||||||
i++;
|
i++;
|
||||||
} );
|
} );
|
||||||
|
vm.busy = false;
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
Employeetarget: function ( data, targetLength, i ) {
|
|
||||||
|
Employeetarget: function ( data, i, saved ) {
|
||||||
|
var vm = dbo.employeeTargetModel;
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
vm.newTarget( true );
|
||||||
|
|
||||||
self.id = data.id;
|
self.id = data.id;
|
||||||
self.startyear = ko.observable( data.startyear );
|
self.startyear = ko.observable( data.startyear );
|
||||||
self.startmonth = ko.observable( data.startmonth );
|
self.startmonth = ko.observable( data.startmonth );
|
||||||
self.endyear = ko.observable( data.endyear );
|
self.endyear = ko.observable( data.endyear );
|
||||||
self.endmonth = ko.observable( data.endmonth );
|
self.endmonth = ko.observable( data.endmonth );
|
||||||
self.target = ko.observable( data.target );
|
self.target = ko.observable( data.target );
|
||||||
|
self.saved = ko.observable( saved );
|
||||||
|
|
||||||
self.changeAble = ko.pureComputed( function () {
|
self.changeable = ko.pureComputed( function () {
|
||||||
if(i == (targetLength - 1))
|
if ( i == (vm.targetLength - 1) ) return true;
|
||||||
|
|
||||||
return true;
|
return false;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
self.validTarget = ko.pureComputed( function () {
|
||||||
|
if ( !self.endmonth() && !self.endyear() ) return true;
|
||||||
|
if ( !self.endmonth() || !self.endyear() ) return false;
|
||||||
|
if ( self.endyear() == self.startyear() && self.endmonth() > self.startmonth() ) return true;
|
||||||
|
if ( self.endyear() > self.startyear() && self.endmonth() ) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
} );
|
||||||
|
|
||||||
|
if ( ! self.endmonth() ) vm.newTarget( false );
|
||||||
|
if ( ! self.endyear() ) vm.newTarget( false );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -51,19 +51,14 @@ dbo.employeehoursreportInit = function () {
|
|||||||
var vm = dbo.employeeHoursreportModel;
|
var vm = dbo.employeeHoursreportModel;
|
||||||
|
|
||||||
vm.initialize = true;
|
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.selectedYear( (new Date()).getFullYear() );
|
||||||
vm.selectedMonthID( 0 );
|
vm.selectedMonthID( 0 );
|
||||||
|
vm.validYear( true );
|
||||||
|
|
||||||
vm.initialize = false;
|
vm.initialize = false;
|
||||||
|
|
||||||
vm.initModule();
|
vm.initModule();
|
||||||
} );
|
|
||||||
},
|
},
|
||||||
|
|
||||||
initModule: function () {
|
initModule: function () {
|
||||||
@@ -73,18 +68,13 @@ dbo.employeehoursreportInit = function () {
|
|||||||
},
|
},
|
||||||
|
|
||||||
checkYear: function () {
|
checkYear: function () {
|
||||||
var vm = dbo.monthlyEmployeeHoursModel;
|
var vm = dbo.employeeHoursreportModel;
|
||||||
if ( timeout ) {
|
if ( !Number.isInteger( Number( vm.selectedYear() ) ) ) return vm.validYear( false );
|
||||||
clearTimeout( timeout );
|
if ( Number( vm.selectedYear() ) > 2100 ) return vm.validYear( false );
|
||||||
timeout = null;
|
if ( Number( vm.selectedYear() ) < 2000 ) return vm.validYear( false );
|
||||||
}
|
vm.validYear( true );
|
||||||
timeout = setTimeout( function () {
|
|
||||||
vm.validYear( true );
|
vm.initModule();
|
||||||
if ( !Number.isInteger( Number( vm.selectedYear() ) ) ) return vm.validYear( false );
|
|
||||||
if ( Number( vm.selectedYear() ) > 2100 ) return vm.validYear( false );
|
|
||||||
if ( Number( vm.selectedYear() ) < 2000 ) return vm.validYear( false );
|
|
||||||
vm.initModule();
|
|
||||||
}, 700 );
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setActivetab: function ( tab ) {
|
setActivetab: function ( tab ) {
|
||||||
@@ -125,7 +115,7 @@ dbo.employeehoursreportInit = function () {
|
|||||||
vm.nonprofitablehoursTotaal( Math.round( vm.nonprofitablehoursTotaal() + Number( p.nonprofitablehours ) ) );
|
vm.nonprofitablehoursTotaal( Math.round( vm.nonprofitablehoursTotaal() + Number( p.nonprofitablehours ) ) );
|
||||||
vm.nonprojecthoursTotaal( Math.round( vm.nonprojecthoursTotaal() + Number( p.nonprojecthours ) ) );
|
vm.nonprojecthoursTotaal( Math.round( vm.nonprojecthoursTotaal() + Number( p.nonprojecthours ) ) );
|
||||||
vm.totalhoursTotaal( Math.round( vm.totalhoursTotaal() + Number( p.totalhours ) ) );
|
vm.totalhoursTotaal( Math.round( vm.totalhoursTotaal() + Number( p.totalhours ) ) );
|
||||||
vm.targetTotaal( Math.round( vm.targetTotaal() + Number( p.targethours / 12 ) ) );
|
vm.targetTotaal( Math.round( vm.targetTotaal() + Number( p.targethours ) ) );
|
||||||
vm.revenuesTotaal( Number( vm.revenuesTotaal() ) + Number( p.revenues ) );
|
vm.revenuesTotaal( Number( vm.revenuesTotaal() ) + Number( p.revenues ) );
|
||||||
|
|
||||||
chartData.labels.push( p.fullname );
|
chartData.labels.push( p.fullname );
|
||||||
@@ -135,7 +125,7 @@ dbo.employeehoursreportInit = function () {
|
|||||||
} );
|
} );
|
||||||
vm.occupancyRateTotalTotaal( Math.round( (vm.totalhoursTotaal() / vm.targetTotaal()) * 100 ) );
|
vm.occupancyRateTotalTotaal( Math.round( (vm.totalhoursTotaal() / vm.targetTotaal()) * 100 ) );
|
||||||
vm.occupancyRateHoursTotaal( Math.round( (vm.profitablehoursTotaal() / vm.totalhoursTotaal()) * 100 ) );
|
vm.occupancyRateHoursTotaal( Math.round( (vm.profitablehoursTotaal() / vm.totalhoursTotaal()) * 100 ) );
|
||||||
vm.occupancyRateInvoiceTotaal(Math.round( (vm.profitablehoursTotaal() / vm.targetTotaal()) * 100 ));
|
vm.occupancyRateInvoiceTotaal( Math.round( (vm.profitablehoursTotaal() / vm.targetTotaal()) * 100 ) );
|
||||||
vm.averageDayRateTotaal( Math.round( Number( vm.revenuesTotaal() ) / Number( vm.profitablehoursTotaal() ) ) * 8 );
|
vm.averageDayRateTotaal( Math.round( Number( vm.revenuesTotaal() ) / Number( vm.profitablehoursTotaal() ) ) * 8 );
|
||||||
vm.revenuesTotaal( dbo.helpers.thousandSeparator( vm.revenuesTotaal() ) );
|
vm.revenuesTotaal( dbo.helpers.thousandSeparator( vm.revenuesTotaal() ) );
|
||||||
|
|
||||||
@@ -160,10 +150,10 @@ dbo.employeehoursreportInit = function () {
|
|||||||
this.nonprofitablehours = data.nonprofitablehours;
|
this.nonprofitablehours = data.nonprofitablehours;
|
||||||
this.nonprojecthours = data.nonprojecthours;
|
this.nonprojecthours = data.nonprojecthours;
|
||||||
this.totalhours = Math.round( data.totalhours );
|
this.totalhours = Math.round( data.totalhours );
|
||||||
this.target = Math.round( data.targethours / 12 );
|
this.target = dbo.helpers.numberWithPoints( Math.round( data.targethours ) );
|
||||||
this.occupancyRateTotal = Math.round( (data.totalhours / (data.targethours / 12)) * 100 );
|
this.occupancyRateTotal = Math.round( (data.totalhours / data.targethours) * 100 );
|
||||||
this.occupancyRateHours = Math.round( (data.profitablehours / data.totalhours) * 100 );
|
this.occupancyRateHours = Math.round( (data.profitablehours / data.totalhours) * 100 );
|
||||||
this.occupancyRateInvoice = Math.round( (data.profitablehours / (data.targethours / 12)) * 100 );
|
this.occupancyRateInvoice = Math.round( (data.profitablehours / data.targethours) * 100 );
|
||||||
this.revenues = dbo.helpers.thousandSeparator( data.revenues );
|
this.revenues = dbo.helpers.thousandSeparator( data.revenues );
|
||||||
this.averageDayRate = Math.round( (data.revenues / data.profitablehours) * 8 );
|
this.averageDayRate = Math.round( (data.revenues / data.profitablehours) * 8 );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,24 +23,17 @@ dbo.outgoinginvoicesInit = function () {
|
|||||||
months : ko.observableArray( dbo.monthArray ),
|
months : ko.observableArray( dbo.monthArray ),
|
||||||
totalToInvoice : ko.observable(),
|
totalToInvoice : ko.observable(),
|
||||||
totalToInvoiceFuture: ko.observable(),
|
totalToInvoiceFuture: ko.observable(),
|
||||||
|
initialize : null,
|
||||||
|
validYear : ko.observable(),
|
||||||
|
|
||||||
init: function () {
|
init: function () {
|
||||||
var vm = dbo.outgoinginvoicesModel;
|
var vm = dbo.outgoinginvoicesModel;
|
||||||
|
|
||||||
vm.initialize = true;
|
vm.selectedYear( (new Date()).getFullYear() );
|
||||||
dbo.reportsDataService.getUsedYears( function ( data ) {
|
vm.selectedMonthID( 0 );
|
||||||
vm.years.removeAll();
|
vm.validYear(true);
|
||||||
_.each( data, function ( p ) {
|
|
||||||
vm.years.push( {id: p.year, year: p.year} );
|
|
||||||
} );
|
|
||||||
|
|
||||||
vm.selectedYear( (new Date()).getFullYear() );
|
vm.initModule();
|
||||||
vm.selectedMonthID( 0 );
|
|
||||||
|
|
||||||
vm.initialize = false;
|
|
||||||
|
|
||||||
vm.initModule();
|
|
||||||
} );
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setActivetab: function ( tab ) {
|
setActivetab: function ( tab ) {
|
||||||
@@ -55,6 +48,16 @@ dbo.outgoinginvoicesInit = function () {
|
|||||||
vm.refreshInvoiceDetails();
|
vm.refreshInvoiceDetails();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
checkYear: function () {
|
||||||
|
var vm = dbo.outgoinginvoicesModel;
|
||||||
|
if ( !Number.isInteger( Number( vm.selectedYear() ) ) ) return vm.validYear( false );
|
||||||
|
if ( Number( vm.selectedYear() ) > 2100 ) return vm.validYear( false );
|
||||||
|
if ( Number( vm.selectedYear() ) < 2000 ) return vm.validYear( false );
|
||||||
|
vm.validYear( true );
|
||||||
|
|
||||||
|
vm.initModule();
|
||||||
|
},
|
||||||
|
|
||||||
refreshInvoiceDetails: function () {
|
refreshInvoiceDetails: function () {
|
||||||
var vm = dbo.outgoinginvoicesModel;
|
var vm = dbo.outgoinginvoicesModel;
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,14 @@ dbo.reservationsInit = function () {
|
|||||||
} else {
|
} else {
|
||||||
dbo.reservationsModel = {
|
dbo.reservationsModel = {
|
||||||
|
|
||||||
projects : ko.observableArray( [] ),
|
projects : ko.observableArray( [] ),
|
||||||
reservation: ko.observable(),
|
costs : ko.observable(),
|
||||||
payed : ko.observable(),
|
reservation : ko.observable(),
|
||||||
saldo : ko.observable(),
|
payed : ko.observable(),
|
||||||
|
saldo : ko.observable(),
|
||||||
|
saldoToPay : ko.observable(),
|
||||||
|
otherRevenue : ko.observable(),
|
||||||
|
saldoInvoices: ko.observable(),
|
||||||
|
|
||||||
init: function () {
|
init: function () {
|
||||||
var vm = dbo.reservationsModel;
|
var vm = dbo.reservationsModel;
|
||||||
@@ -29,17 +33,25 @@ dbo.reservationsInit = function () {
|
|||||||
dbo.reservationsDataservice.getReservations( function ( data ) {
|
dbo.reservationsDataservice.getReservations( function ( data ) {
|
||||||
vm.projects.removeAll();
|
vm.projects.removeAll();
|
||||||
|
|
||||||
|
vm.costs( 0 );
|
||||||
vm.reservation( 0 );
|
vm.reservation( 0 );
|
||||||
vm.payed( 0 );
|
vm.payed( 0 );
|
||||||
vm.saldo( 0 );
|
vm.saldo( 0 );
|
||||||
|
vm.saldoToPay( 0 );
|
||||||
|
vm.otherRevenue( 0 );
|
||||||
|
vm.saldoInvoices( 0 );
|
||||||
|
|
||||||
_.each( data, function ( p ) {
|
_.each( data, function ( p ) {
|
||||||
vm.projects.push( new vm.Project( p ) );
|
vm.projects.push( new vm.Project( p ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
vm.costs( dbo.helpers.numberWithPoints( vm.costs() ) );
|
||||||
vm.reservation( dbo.helpers.numberWithPoints( vm.reservation() ) );
|
vm.reservation( dbo.helpers.numberWithPoints( vm.reservation() ) );
|
||||||
vm.payed( dbo.helpers.numberWithPoints( vm.payed() ) );
|
vm.payed( dbo.helpers.numberWithPoints( vm.payed() ) );
|
||||||
vm.saldo( dbo.helpers.numberWithPoints( vm.saldo() ) );
|
vm.saldo( dbo.helpers.numberWithPoints( vm.saldo() ) );
|
||||||
|
vm.saldoToPay( dbo.helpers.numberWithPoints( vm.saldoToPay() ) );
|
||||||
|
vm.otherRevenue( dbo.helpers.numberWithPoints( vm.otherRevenue() ) );
|
||||||
|
vm.saldoInvoices( dbo.helpers.numberWithPoints( vm.saldoInvoices() ) );
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -52,14 +64,22 @@ dbo.reservationsInit = function () {
|
|||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.projectnumber = data.projectnumber;
|
self.projectnumber = data.projectnumber;
|
||||||
|
self.costs = dbo.helpers.numberWithPoints( data.costs );
|
||||||
self.reservation = dbo.helpers.numberWithPoints( data.reservation );
|
self.reservation = dbo.helpers.numberWithPoints( data.reservation );
|
||||||
self.payed = dbo.helpers.numberWithPoints( data.payed );
|
self.payed = dbo.helpers.numberWithPoints( data.payed );
|
||||||
self.saldo = dbo.helpers.numberWithPoints( data.saldo );
|
self.saldo = dbo.helpers.numberWithPoints( data.saldo );
|
||||||
|
self.saldoToPay = dbo.helpers.numberWithPoints( data.saldoToPay );
|
||||||
|
self.otherRevenue = dbo.helpers.numberWithPoints( data.other_revenue );
|
||||||
|
self.saldoInvoices = dbo.helpers.numberWithPoints( data.other_revenue - data.costs );
|
||||||
self.showExternals = ko.observable( false );
|
self.showExternals = ko.observable( false );
|
||||||
|
|
||||||
|
vm.costs( Number( vm.costs() ) + Number( data.costs ) );
|
||||||
vm.reservation( Number( vm.reservation() ) + Number( data.reservation ) );
|
vm.reservation( Number( vm.reservation() ) + Number( data.reservation ) );
|
||||||
vm.payed( Number( vm.payed() ) + Number( data.payed ) );
|
vm.payed( Number( vm.payed() ) + Number( data.payed ) );
|
||||||
vm.saldo( Number( vm.saldo() ) + Number( data.saldo ) );
|
vm.saldo( Number( vm.saldo() ) + Number( data.saldo ) );
|
||||||
|
vm.saldoToPay( Number( vm.saldoToPay() ) + Number( data.saldoToPay ) );
|
||||||
|
vm.otherRevenue( Number( vm.otherRevenue() ) + Number( data.other_revenue ) );
|
||||||
|
vm.saldoInvoices( Number( vm.saldoInvoices() ) + Number( data.other_revenue - data.costs ) )
|
||||||
|
|
||||||
self.externals = ko.observableArray( [] );
|
self.externals = ko.observableArray( [] );
|
||||||
_.each( data.externals, function ( p ) {
|
_.each( data.externals, function ( p ) {
|
||||||
@@ -71,9 +91,11 @@ dbo.reservationsInit = function () {
|
|||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.externalName = data.external;
|
self.externalName = data.external;
|
||||||
|
self.costs = dbo.helpers.numberWithPoints( data.costs );
|
||||||
self.reservation = dbo.helpers.numberWithPoints( data.reservation );
|
self.reservation = dbo.helpers.numberWithPoints( data.reservation );
|
||||||
self.payed = dbo.helpers.numberWithPoints( data.payed );
|
self.payed = dbo.helpers.numberWithPoints( data.payed );
|
||||||
self.saldo = dbo.helpers.numberWithPoints( data.saldo );
|
self.saldo = dbo.helpers.numberWithPoints( data.saldo );
|
||||||
|
self.saldoToPay = dbo.helpers.numberWithPoints( data.saldoToPay );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user