employeehours

This commit is contained in:
2018-01-31 21:56:13 +01:00
parent 05c165c9ed
commit b634d0b139
24 changed files with 700 additions and 85 deletions
@@ -0,0 +1,62 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 31/01/2018
* Time: 20:08
*/
class EmployeehoursController extends MY_Controller {
public function __construct()
{
parent::__construct();
if ( AUTHENTICATED == FALSE ) die( 'NO ACCESS' );
$models = [];
$libraries = [];
$this->load->model( $models );
$this->load->library( $libraries );
}
public function getEmployeehours( $month, $year )
{
$employeehours = Employeehour::getEmployeehours( $month, $year );
$this->json( $employeehours );
}
public function getHourtypes()
{
$hourtypes = Hourtype::all();
$this->json( $hourtypes );
}
public function saveEmployeehour()
{
//TODO: validatie inbouwen
$data = $this->input->post();
$employeehourID = $data['id'];
unset( $data['id'] );
$data['hourdate'] = date2mysql( $data['hourdate'] );
$employeehourID = Employeehour::saveEmployeehour( $employeehourID, $data );
$this->json( ['employeehourID' => $employeehourID] );
}
public function removeEmployeehour( $employeehourID )
{
//TODO:check op delete
Employeehour::whereId( $employeehourID )->delete();
$this->json( ['result' => TRUE] );
}
}
@@ -119,8 +119,6 @@ class ProjectsController extends MY_Controller {
$projectemployeeID = $projectemployee['id'];
unset( $projectemployee['id'] );
$projectemployee['startdate'] = date2mysql( $projectemployee['startdate'] );
Projectemployee::saveProjectemployee( $projectemployeeID, $projectemployee );
$this->json( ['success' => TRUE] );
@@ -28,6 +28,10 @@ class ProjectcostValidation extends BaseValidation {
'costs' => [
'validations' => 'number',
'fieldname' => 'kosten'
],
'payed' => [
'validations' => 'number',
'fieldname' => 'betaald'
]
];
@@ -0,0 +1,52 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 21/12/2017
* Time: 18:05
*/
class Employeehour extends BaseModel {
protected $table = "employeehours";
public function user()
{
return $this->belongsTo( 'User', 'employee_id' );
}
public function hourtype()
{
return $this->belongsTo( 'Hourtype' );
}
public static function getEmployeehours( $month, $year )
{
$employeehours = Employeehour::whereRaw( "MONTH(hourdate) ={$month} AND YEAR(hourdate) = {$year}" )
->with( [
'user' => function ( $q ) {
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
}] )
->with( 'hourtype' )
->get();
return $employeehours;
}
public static function saveEmployeehour( $employeehourID, $data )
{
if ( $employeehourID == 0 )
{
$employeehour = Employeehour::create( $data );
$employeehourID = $employeehour->id;
}
else
{
Employeehour::whereId( $employeehourID )->update( $data );
}
return $employeehourID;
}
}
+18
View File
@@ -0,0 +1,18 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 21/12/2017
* Time: 18:05
*/
class Hourtype extends BaseModel {
protected $table = "hourtypes";
public function employeehours()
{
return $this->hasMany( 'Employeehour' );
}
}
@@ -150,6 +150,22 @@
</div>
</div>
</div>
<div class="form-group row">
<label class="col-xl-3 form-control-label">
IBAN
</label>
<div class="col-xl-9">
<div class="input-group input-group-icon">
<span class="input-group-addon">
<i class="icon fa-institution"></i>
</span>
<input type="text"
placeholder="IBAN"
class="form-control"
data-bind="textInput:iban">
</div>
</div>
</div>
<div class="form-group row">
<label class="col-xl-3 form-control-label">
tarief (per uur)
+31 -5
View File
@@ -7,16 +7,22 @@
<div class="panel-body panel-body-project">
<table class="table table-sm">
<thead>
<th class="table-cyanish-header">
<th class="table-cyanish-header" width="35%">
medewerker
</th>
<th class="table-cyanish-header">
<th class="table-cyanish-header" width="15%">
datum
</th>
<th class="table-cyanish-header align-right">
<th class="table-cyanish-header" width="15%">
declarabel
</th>
<th class="table-cyanish-header align-right" width="12%">
uren
</th>
<th class="table-cyanish-header" width="40px">
<th class="table-cyanish-header align-right" width="15%">
omzet
</th>
<th class="table-cyanish-header" width="8%">
&nbsp;
</th>
</thead>
@@ -39,11 +45,15 @@
<span data-bind="text:hourdate, visible:! inEdit()"></span>
<input type="text"
class="form-control form-control-sm"
placeholder="start"
placeholder="datum"
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
value:hourdate, visible:inEdit,
event:{change:$root.saveProjecthour}"/>
</td>
<td class="align-center">
<i class="icon fa-check" data-bind="visible:hourtype_id() == 1, click:$root.setHourtype.bind($data,2)"></i>
<i class="icon fa-square-o" data-bind="visible:hourtype_id() != 1, click:$root.setHourtype.bind($data, 1)"></i>
</td>
<td class="align-right">
<span data-bind=" visible: ! inEdit()">
<span data-bind="text:hours"></span>
@@ -55,6 +65,10 @@
data-bind="textInput:hours, visible:inEdit,
event:{change:$root.saveProjecthour,keyup:$root.validateNumber.bind($data, 'hours')}"/>
</td>
<td class="align-right">
<i class="icon fa-euro"></i>
<span data-bind="text:dbo.helpers.numberWithPoints(revenue())"></span>
</td>
<td>
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editProjecthour"></i>
<i class="icon fa-trash redish pointer" title="verwijder"
@@ -63,6 +77,18 @@
</tr>
</tbody>
<tfoot>
<tr>
<th class="table-cyanish-header" colspan="2">Totaal</th>
<th class="table-cyanish-header">&nbsp;</th>
<th class="table-cyanish-header align-right">
<span data-bind="text:totalHours"></span> uur
</th>
<th class="table-cyanish-header align-right">
<i class="icon fa-euro"></i>
<span data-bind="text:dbo.helpers.numberWithPoints(totalRevenue())"></span>
</th>
<th class="table-cyanish-header">&nbsp;</th>
</tr>
<tr>
<td colspan="5">
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newProjecthour">
+12 -12
View File
@@ -26,10 +26,10 @@
<th class="table-cyanish-header align-right">
prognose(excl)
</th>
<th class="table-cyanish-header">
<th class="table-cyanish-header align-right">
prognose datum
</th>
<th class="table-cyanish-header">
<th class="table-cyanish-header align-right">
btw tarief
</th>
<th class="table-cyanish-header" width="40px">
@@ -54,7 +54,7 @@
<span data-bind="text:invoicedate, visible:! inEdit()"></span>
<input type="text"
class="form-control form-control-sm"
placeholder="start"
placeholder="datum"
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
value:invoicedate, visible:inEdit,
event:{change:$root.saveInvoice}"/>
@@ -62,7 +62,7 @@
<td class="align-right">
<span data-bind=" visible: ! inEdit()">
<i class="icon fa-euro"></i>
<span data-bind="text:invoiceamount"></span>
<span data-bind="text:dbo.helpers.numberWithPoints(invoiceamount())"></span>
</span>
<input type="text"
class="form-control form-control-sm align-right"
@@ -72,16 +72,16 @@
</td>
<td class="align-right">
<i class="icon fa-euro"></i>
<span data-bind="text:inclBtw"></span>
<span data-bind="text:dbo.helpers.numberWithPoints(inclBtw())"></span>
</td>
<td class="align-right">
<i class="icon fa-euro"></i>
<span data-bind="text:outstanding"></span>
<span data-bind="text:dbo.helpers.numberWithPoints(outstanding())"></span>
</td>
<td class="align-right">
<span data-bind=" visible: ! inEdit()">
<i class="icon fa-euro"></i>
<span data-bind="text:forecastamount"></span>
<span data-bind="text:dbo.helpers.numberWithPoints(forecastamount())"></span>
</span>
<input type="text"
class="form-control form-control-sm align-right"
@@ -89,16 +89,16 @@
data-bind="textInput:forecastamount, visible:inEdit,
event:{change:$root.saveInvoice,keyup:$root.validateNumber.bind($data, 'forecastamount')}"/>
</td>
<td>
<td class="align-right">
<span data-bind="text:forecastdate, visible:! inEdit()"></span>
<input type="text"
class="form-control form-control-sm"
placeholder="start"
placeholder="datum"
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
value:forecastdate, visible:inEdit,
event:{change:$root.saveInvoice}"/>
</td>
<td>
<td class="align-right">
<span data-bind="visible:! inEdit()">
<span data-bind="text:dbo.helpers.findArrayElement('id', 'vatrate', vat_id(), $root.vats())"></span>
%
@@ -141,7 +141,7 @@
<span data-bind="text:paymentdate, visible:! inEdit()"></span>
<input type="text"
class="form-control form-control-sm"
placeholder="start"
placeholder="datum"
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
value:paymentdate, visible:inEdit,
event:{change:$root.savePayment}"/>
@@ -149,7 +149,7 @@
<td>
<span data-bind=" visible: ! inEdit()">
<i class="icon fa-euro"></i>
<span data-bind="text:paymentamount"></span>
<span data-bind="text:dbo.helpers.numberWithPoints(paymentamount())"></span>
</span>
<input type="text"
class="form-control form-control-sm align-right"
@@ -16,9 +16,15 @@
<th class="table-cyanish-header">
datum
</th>
<th class="table-cyanish-header">
<th class="table-cyanish-header align-right">
bedrag
</th>
<th class="table-cyanish-header align-right">
betaald
</th>
<th class="table-cyanish-header align-right">
te betalen
</th>
<th class="table-cyanish-header" width="40px">
&nbsp;
</th>
@@ -38,7 +44,7 @@
event:{change:$root.saveProjectcosts}">
</select>
</td>
<td class="align-right">
<td>
<span data-bind=" visible: ! inEdit()">
<span data-bind="text:description"></span>
</span>
@@ -46,7 +52,7 @@
class="form-control form-control-sm align-right"
paceholder="omschrijving"
data-bind="textInput:description, visible:inEdit,
event:{change:$root.saveProjectcosts"/>
event:{change:$root.saveProjectcosts}"/>
</td>
<td>
<span data-bind="text:date, visible:! inEdit()"></span>
@@ -60,7 +66,7 @@
<td class="align-right">
<span data-bind=" visible: ! inEdit()">
<i class="icon fa-euro"></i>
<span data-bind="text:costs"></span>
<span data-bind="text:dbo.helpers.numberWithPoints(costs())"></span>
</span>
<input type="text"
class="form-control form-control-sm align-right"
@@ -68,6 +74,23 @@
data-bind="textInput:costs, visible:inEdit,
event:{change:$root.saveProjectcosts,keyup:$root.validateNumber.bind($data, 'costs')}"/>
</td>
<td class="align-right">
<span data-bind=" visible: ! inEdit()">
<i class="icon fa-euro"></i>
<span data-bind="text:dbo.helpers.numberWithPoints(payed())"></span>
</span>
<input type="text"
class="form-control form-control-sm align-right"
paceholder="bedrag"
data-bind="textInput:payed, visible:inEdit,
event:{change:$root.saveProjectcosts,keyup:$root.validateNumber.bind($data, 'payed')}"/>
</td>
<td class="align-right">
<span>
<i class="icon fa-euro"></i>
<span data-bind="text:dbo.helpers.numberWithPoints(toPay())"></span>
</span>
</td>
<td>
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editProjectcosts"></i>
<i class="icon fa-trash redish pointer" title="verwijder"
@@ -73,6 +73,14 @@
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<h3>te besteden uren :<span data-bind="text:(totalBudget() - totalHours())"></span></h3>
</div>
<div class="col-md-3">
<h3></h3>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="graph-holder">
@@ -10,10 +10,10 @@
<th class="table-cyanish-header">
naam
</th>
<th class="table-cyanish-header">
<th class="table-cyanish-header align-right">
tarief
</th>
<th class="table-cyanish-header">
<th class="table-cyanish-header align-right">
budget
</th>
<th class="table-cyanish-header" width="40px">
@@ -35,18 +35,18 @@
event:{change:$root.saveProjectemployee},
visible:inEdit"></select>
</td>
<td>
<td class="align-right">
<span data-bind=" visible: ! inEdit()">
<i class="icon fa-euro"></i>
<span data-bind="text:tarif"></span>
</span>
</span class="align-right">
<input type="text"
class="form-control form-control-sm"
paceholder="tarief"
data-bind="textInput:tarif, visible:inEdit,
event:{change:$root.saveProjectemployee,keyup:$root.validateNumber.bind($data, 'tarif')}"/>
</td>
<td>
<td class="align-right">
<span data-bind="visible: ! inEdit()"><span data-bind="text:budget"></span> uur</span>
<input type="text"
class="form-control form-control-sm"
@@ -62,6 +62,13 @@
</tr>
</tbody>
<tfoot>
<tr>
<th class="table-cyanish-header align-right" colspan="2">&nbsp;</th>
<th class="table-cyanish-header align-right">
<span data-bind="text:totalBudget"></span> uur
</th>
<th class="table-cyanish-header align-right"></th>
</tr>
<tr>
<td colspan="6">
<button class="btn btn-primary btn-round btn-sm" data-bind="click:addProjectemployee">
@@ -1,7 +1,7 @@
<div class="panel panel-bordered panel-primary panel-line">
<div class="panel-heading panel-heading-project">
<h3 class="">
offertes
offerte
</h3>
</div>
<div class="panel-body panel-body-project">
@@ -13,10 +13,10 @@
<th class="table-cyanish-header">
start
</th>
<th class="table-cyanish-header">
<th class="table-cyanish-header align-right">
eigen omzet
</th>
<th class="table-cyanish-header">
<th class="table-cyanish-header align-right">
overig omzet
</th>
<th class="table-cyanish-header">
@@ -31,11 +31,11 @@
<td>
<span data-bind="text:startdate"></span>
</td>
<td>
<span data-bind="text:own_revenue"></span>
<td class="align-right">
<span data-bind="text:dbo.helpers.numberWithPoints(own_revenue.toFixed(0))"></span>
</td>
<td>
<span data-bind="text:other_revenue"></span>
<td class="align-right">
<span data-bind="text:dbo.helpers.numberWithPoints(other_revenue.toFixed(0))"></span>
</td>
<!-- <td>-->
<!-- <i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editOffer"></i>-->
@@ -44,15 +44,6 @@
<!-- </td>-->
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="5">
<!-- <button class="btn btn-primary btn-round btn-sm" data-bind="click:newOffer">-->
<!-- nieuwe offerte-->
<!-- </button>-->
</td>
</tr>
</tfoot>
</table>
</div>
</div>
+12 -7
View File
@@ -1,7 +1,4 @@
<div class="project-page" id="project-modal" data-bind="fadeVisible:showProject()">
<button class="btn btn-danger" data-bind="click:closeProject" style="position:absolute">
sluit
</button>
<div class="container" style="margin-top:15px;padding-top:15px;">
<div class="nav-tabs-horizontal nav-tabs-animate nav-tab-reverse">
@@ -41,16 +38,24 @@
bestanden en opmerkingen</a>
</li>
</ul>
<div style="position:relative; float:right;">
<h3 style="position:absolute;top:-65px; right:30px; width:350px;">
Projectnummer: <span data-bind="text:projectnumber"></span>
</h3>
<button class="btn btn-danger" data-bind="click:closeProject" style="position:absolute;right:0px;top:-50px">
sluit
</button>
</div>
<div class="tab-content">
<div class="tab-pane animation-slide-top active" id="dashboard">
<?php $this->load->view('modals/partials/_projectdashboard'); ?>
</div>
<div class="tab-pane animation-slide-top" id="financial">
<div class="row" data-bind="fadeVisible:customerID()">
<div class="col-md-6">
<div class="col-md-5">
<?php $this->load->view( 'modals/partials/_projectoffers' ); ?>
</div>
<div class="col-md-6">
<div class="col-md-7">
<?php $this->load->view( 'modals/partials/_projectcosts' ); ?>
</div>
</div>
@@ -62,10 +67,10 @@
</div>
<div class="tab-pane animation-slide-top" id="employees">
<div class="row" data-bind="fadeVisible:customerID()">
<div class="col-md-6" data-bind="fadeVisible:customerID()">
<div class="col-md-5" data-bind="fadeVisible:customerID()">
<?php $this->load->view( 'modals/partials/_projectemployees' ); ?>
</div>
<div class="col-md-6">
<div class="col-md-7">
<?php $this->load->view( 'modals/partials/_hours' ); ?>
</div>
</div>
@@ -0,0 +1,98 @@
<div class="container">
<div class="row">
<div class="col-md-2">
<select class="form-control form-control-sm"
data-bind="options:years,
optionsText:'id',
optionsValue:'id',
value:selectedYear,
event:{change:refreshEmployeehours}"></select>
</div>
<div class="col-md-2">
<select class="form-control form-control-sm"
data-bind="options:months,
optionsText:'monthName',
optionsValue:'id',
value:selectedMonth,
event:{change:refreshEmployeehours}"></select>
</div>
</div>
<br/>
<div class="row">
<div class="col-xl-8">
<table class="table table-sm">
<thead>
<tr>
<th class="table-tealish-header">medewerker</th>
<th class="table-tealish-header">datum</th>
<th class="table-tealish-header">soort uren</th>
<th class="table-tealish-header">uren</th>
<th class="table-tealish-header" width="40px">&nbsp;</th>
</tr>
</thead>
<tbody data-bind="foreach:employeehours">
<tr>
<td>
<span data-bind="text:dbo.helpers.findArrayElement('id', 'fullname', employee_id(), $root.employees()),
visible: ! inEdit()"></span>
<select class="form-control form-control-sm"
data-bind="options:$root.employees,
optionsText:'fullname',
optionsValue:'id',
value:employee_id,
optionsCaption: 'selecteer...',
visible:inEdit(),
event:{change:$root.saveEmployeehours}"></select>
</td>
<td>
<span data-bind="text:hourdate, visible:! inEdit()"></span>
<input class="form-control form-control-sm"
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
value:hourdate, visible:inEdit(),
event:{change:$root.saveEmployeehour}"
</td>
<td>
<span data-bind="text:dbo.helpers.findArrayElement('id', 'description', hourtype_id(), $root.hourtypes()),
visible: ! inEdit()"></span>
<select class="form-control form-control-sm"
data-bind="options:$root.hourtypes,
optionsText:'description',
optionsValue:'id',
value:hourtype_id,
optionsCaptiuon:'selecteer...',
visible:inEdit(),
event:{change:$root.saveEmployeehours}"></select>
</td>
<td class="align-right">
<span data-bind=" visible: ! inEdit()">
<span data-bind="text:hours"></span>
uur
</span>
<input type="text"
class="form-control form-control-sm align-right"
paceholder="uren"
data-bind="textInput:hours, visible:inEdit,
event:{change:$root.saveEmployeehours,keyup:$root.validateNumber.bind($data, 'hours')}"/>
</td>
<td>
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editEmployeehour"></i>
<i class="icon fa-trash redish pointer" title="verwijder"
data-bind="click:$root.removeEmployeehour"></i>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3" class="">
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newEmployeehour">
nieuwe uren
</button>
</td>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
+5 -5
View File
@@ -32,10 +32,10 @@
<span data-bind="text:enddate"></span>
</td>
<td data-bind="click:$root.selectPoject" class="pointer align-right">
<span data-bind="text:totalOwnrevenue.toFixed(0)"></span>
<span data-bind="text:dbo.helpers.numberWithPoints(totalOwnrevenue.toFixed(0))"></span>
</td>
<td data-bind="click:$root.selectPoject" class="pointer align-right">
<span data-bind="text:totalOtherrevenue.toFixed(0)"></span>
<span data-bind="text:dbo.helpers.numberWithPoints(totalOtherrevenue.toFixed(0))"></span>
</td>
<td>
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editProject"></i>
@@ -55,9 +55,9 @@
<tfoot>
<tr>
<td colspan="6" class="">
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newProject">
nieuw project
</button>
<!-- <button class="btn btn-primary btn-round btn-sm" data-bind="click:newProject">-->
<!-- nieuw project-->
<!-- </button>-->
</td>
<td colspan="3" class="">
<div class="row form-horizontal">
+3
View File
@@ -67,8 +67,10 @@
<script src="js/lib/modules/beheer/externalsModule.js?version=<?= $this->version ?>"></script>
<script src="js/lib/modules/projects/offersModule.js?version=<?= $this->version ?>"></script>
<script src="js/lib/modules/projects/projectsModule.js?version=<?= $this->version ?>"></script>
<script src="js/lib/modules/projects/employeehoursModule.js?version=<?= $this->version ?>"></script>
<!-- ***********MODALS************* -->
<script src="js/lib/modals/userModal.js?version=<?= $this->version ?>"></script>
<script src="js/lib/modals/customerModal.js?version=<?= $this->version ?>"></script>
<script src="js/lib/modals/externalModal.js?version=<?= $this->version ?>"></script>
@@ -91,6 +93,7 @@
<script src="js/lib/dataservices/documentsDataservice.js"></script>
<script src="js/lib/dataservices/projectsDataservice.js"></script>
<script src="js/lib/dataservices/vatDataservice.js"></script>
<script src="js/lib/dataservices/employeehoursDataservice.js"></script>
<script src="js/lib/services/chartService.js"></script>