Wijzigingen nav opmerking Peter 24-12-2018

This commit is contained in:
2019-01-02 16:57:41 +01:00
parent 9569522c83
commit efcd9f2c09
19 changed files with 201 additions and 44 deletions
@@ -68,11 +68,19 @@ class EmployeeHoursController extends MY_Controller {
$employeehourID = Projecthour::saveProjecthour( $employeehourID, $data );
}
elseif ( $hourType == 'OFFERS' )
{
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] );
}
@@ -27,9 +27,15 @@ class OffersController extends MY_Controller {
}
public function getAllOffers( $projectID, $archive = 'F' )
public function getAllOffers()
{
$offers = Offer::getAllOffers( $projectID, $archive );
$projectID = $this->clean_input( 'projectID' );
$archive = $this->clean_input( 'archive' );
$search = $this->clean_input( 'search' );
$order = $this->clean_input( 'order' );
$direction = $this->clean_input( 'direction' );
$offers = Offer::getAllOffers( $projectID, $archive, $search, $order, $direction );
$this->json( $offers );
}
@@ -27,9 +27,14 @@ class ProjectsController extends MY_Controller {
}
public function getAllProjects( $archive = 'F' )
public function getAllProjects( )
{
$projects = Project::getAllProjects( $archive );
$archive = $this->clean_input( 'archive' );
$search = $this->clean_input( 'search' );
$order = $this->clean_input( 'order' );
$direction = $this->clean_input( 'direction' );
$projects = Project::getAllProjects( $archive, $search, $order, $direction );
$this->json( $projects );
}
@@ -359,4 +364,6 @@ class ProjectsController extends MY_Controller {
$this->json( ['result' => TRUE] );
}
}
}
+1 -1
View File
@@ -16,7 +16,7 @@ class MY_Controller extends CI_Controller {
{
parent::__construct();
$this->version = '0.02.01';
$this->version = '1.00.00';
$this->load->library( 'beheer/session/RetrieveUserSession' );
@@ -56,7 +56,7 @@ class MonthForecast {
private function setInitialsForecastMonths()
{
for ( $i = 1; $i <= 12; $i ++ )
for ( $i = 0; $i <= 12; $i ++ )
{
$this->forecastMonths[ $i ] = ['forecastamount' => 0];
}
+7 -4
View File
@@ -26,15 +26,18 @@ class Offer extends BaseModel {
return $this->belongsTo( 'Customer' );
}
public static function getAllOffers( $projectID, $archive = 'F' )
public static function getAllOffers( $projectID, $archive = 'F', $search, $order, $direction )
{
$offers = Offer::orderBy( 'startdate' )
$offers = Offer::selectRAW('offers.*')
->join('customers AS CUS', 'CUS.id', '=', 'offers.customer_id')
->with( 'customer' )
->with( 'project' );
->with( 'project' )
->where('offernumber', 'LIKE', "%{$search}%")
->orderBy($order, $direction);
if ( $projectID ) $offers = $offers->whereProjectId( $projectID );
if ( $archive == 'F' ) $offers = $offers->whereArchive( 'F' );
if ( $archive == 'F' ) $offers = $offers->where( 'offers.archive', '=', 'F' );
$offers = $offers->get();
+8 -2
View File
@@ -61,11 +61,17 @@ class Project extends BaseModel {
return $this->belongsTo( 'Customer' );
}
public static function getAllProjects( $archive = 'F' )
public static function getAllProjects( $archive, $search, $order, $direction )
{
$projects = Project::getBaseProject();
if ( $archive == 'F' ) $projects = $projects->whereArchive( 'F' );
$projects = $projects->selectRaw('projects.*')
->join('customers AS CUS', 'CUS.id', '=', 'projects.customer_id')
->join('users AS USR', 'USR.id', '=', 'projects.projectleader_id')
->where('projects.projectnumber', 'LIKE', "%{$search}%")
->orderBy($order, $direction);
if ( $archive == 'F' ) $projects = $projects->where( 'projects.archive', '=', 'F' );
$projects = $projects->get();
+4 -1
View File
@@ -54,7 +54,10 @@ class User extends BaseModel {
{
$usersWithProjects =
User::selectRaw( "users.id, CONCAT(users.firstname, ' ', users.middlename, ' ', users.lastname) AS fullname" )
->with( 'projectemployees.project' )
->with( [
'projectemployees.project' => function ( $q ) {
$q->whereArchive( 'F' );
}] )
->get();
return $usersWithProjects;
@@ -35,7 +35,10 @@ class EmployeehoursMonthly {
USR.id AS employee_id,
hours,
DATE_FORMAT(hourdate, '%d-%m-%Y') AS hourdate,
PEM.project_id
CASE
WHEN hourtype_id = 3 THEN offer_id
ELSE PEM.project_id
END AS project_id
FROM projecthours PRH
JOIN projectemployees PEM
ON PEM.id = PRH.projectemployee_id
@@ -84,7 +84,7 @@
event:{change:$root.saveEmployeehours}"></select>
<!-- /ko -->
<!-- ko if: hourType() == 'OFFERS' -->
<span data-bind="text:dbo.helpers.findArrayElement('projectID', 'projectname', projectID(), projects()),
<span data-bind="text:dbo.helpers.findArrayElement('id', 'offername', projectID(), $root.offersWithoutProject()),
visible: ! inEdit()"></span>
<select class="form-control form-control-sm"
data-bind="options:$root.offersWithoutProject,
+28 -9
View File
@@ -1,14 +1,33 @@
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<div class="input-group">
<input type="text"
data-bind="textInput:search,event:{keyup:searchOffers}"
class="form-control"
name=""
placeholder="Zoek...">
<span class="input-group-btn">
<button type="text"
class="btn btn-primary">
<i class="icon wb-search" aria-hidden="true"></i>
</button>
</span>
</div>
</div>
</div>
</div>
<table class="table table-sm">
<thead>
<tr>
<th class="table-tealish-header">nummer</th>
<th class="table-tealish-header">klant</th>
<th class="table-tealish-header">project</th>
<th class="table-tealish-header">datum</th>
<th class="table-tealish-header">kans</th>
<th class="table-tealish-header">geaccepteerd</th>
<th class="table-tealish-header">afgewezen</th>
<th class="table-tealish-header">&nbsp;</th>
<th class="table-tealish-header pointer" data-bind="click:directionOrderOffers.bind($data, 'offernumber')">nummer</th>
<th class="table-tealish-header pointer" data-bind="click:directionOrderOffers.bind($data, 'CUS.name')">klant</th>
<th class="table-tealish-header pointer" data-bind="click:directionOrderOffers.bind($data, 'offername')">offertenaam</th>
<th class="table-tealish-header pointer" data-bind="click:directionOrderOffers.bind($data, 'startdate')">datum</th>
<th class="table-tealish-header pointer" data-bind="click:directionOrderOffers.bind($data, 'acceptance_chance')">kans</th>
<th class="table-tealish-header pointer" data-bind="click:directionOrderOffers.bind($data, 'accepteddate')">geaccepteerd</th>
<th class="table-tealish-header pointer" data-bind="click:directionOrderOffers.bind($data, 'rejectdate')">afgewezen</th>
<th class="table-tealish-header pointer">&nbsp;</th>
</tr>
</thead>
<tbody data-bind="foreach:offers">
@@ -20,7 +39,7 @@
<span data-bind="text:customerName"></span>
</td>
<td data-bind="click:$root.selectOffer" class="pointer">
<span data-bind="text:projectNumber"></span>
<span data-bind="text:offername"></span>
</td>
<td data-bind="click:$root.selectOffer" class="pointer">
<span data-bind="text:startdate"></span>
+27 -4
View File
@@ -1,10 +1,33 @@
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<div class="input-group">
<input type="text"
data-bind="textInput:search,event:{keyup:searchProjects}"
class="form-control"
name=""
placeholder="Zoek...">
<span class="input-group-btn">
<button type="text"
class="btn btn-primary">
<i class="icon wb-search" aria-hidden="true"></i>
</button>
</span>
</div>
</div>
</div>
</div>
<table class="table table-sm">
<thead>
<tr>
<th class="table-tealish-header">nummer</th>
<th class="table-tealish-header">projectleider</th>
<th class="table-tealish-header">klant</th>
<th class="table-tealish-header">start</th>
<th class="table-tealish-header pointer"
data-bind="click:directionOrderProjects.bind($data, 'projectnumber')">nummer</th>
<th class="table-tealish-header pointer"
data-bind="click:directionOrderProjects.bind($data, 'USR.firstname')">projectleider</th>
<th class="table-tealish-header pointer"
data-bind="click:directionOrderProjects.bind($data, 'CUS.name')">klant</th>
<th class="table-tealish-header pointer"
data-bind="click:directionOrderProjects.bind($data, 'startdate')">start</th>
<th class="table-tealish-header align-right">eigen tarief omzet</th>
<th class="table-tealish-header align-right">overige kosten</th>
<th class="table-tealish-header align-right">Kosten derden</th>