Merge branch 'master' of https://bitbucket.org/pensare/dbois
# Conflicts: # application/views/main_view.php
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
ENVIRONMENT='development'DB_HOST='127.0.0.1'
|
||||
|
||||
DB_USER='root'
|
||||
DB_PASS='root'
|
||||
DB_NAME='dbois'
|
||||
|
||||
MASTERPASSWORD='123456'
|
||||
@@ -32,3 +32,4 @@ user_guide_src/cilexer/pycilexer.egg-info/*
|
||||
/resources
|
||||
/.env
|
||||
/themeforest
|
||||
/documents
|
||||
|
||||
@@ -89,7 +89,7 @@ $autoload['drivers'] = array();
|
||||
|
|
||||
| $autoload['helper'] = array('url', 'file');
|
||||
*/
|
||||
$autoload['helper'] = array();
|
||||
$autoload['helper'] = array('common');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
@@ -132,4 +132,4 @@ $autoload['language'] = array();
|
||||
|
|
||||
| $autoload['model'] = array('first_model' => 'first');
|
||||
*/
|
||||
$autoload['model'] = ['beheer/User'];
|
||||
$autoload['model'] = ['beheer/User_model'];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -52,7 +52,7 @@ $config['index_page'] = 'index.php';
|
||||
|
|
||||
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
|
||||
*/
|
||||
$config['uri_protocol'] = 'REQUEST_URI';
|
||||
$config['uri_protocol'] = 'REQUEST_URI';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -76,7 +76,7 @@ $config['url_suffix'] = '';
|
||||
| than english.
|
||||
|
|
||||
*/
|
||||
$config['language'] = 'english';
|
||||
$config['language'] = 'english';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -100,7 +100,7 @@ $config['charset'] = 'UTF-8';
|
||||
| setting this variable to TRUE (boolean). See the user guide for details.
|
||||
|
|
||||
*/
|
||||
$config['enable_hooks'] = FALSE;
|
||||
$config['enable_hooks'] = TRUE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -400,11 +400,11 @@ $config['sess_regenerate_destroy'] = FALSE;
|
||||
| 'cookie_httponly') will also affect sessions.
|
||||
|
|
||||
*/
|
||||
$config['cookie_prefix'] = '';
|
||||
$config['cookie_domain'] = '';
|
||||
$config['cookie_path'] = '/';
|
||||
$config['cookie_secure'] = FALSE;
|
||||
$config['cookie_httponly'] = FALSE;
|
||||
$config['cookie_prefix'] = '';
|
||||
$config['cookie_domain'] = '';
|
||||
$config['cookie_path'] = '/';
|
||||
$config['cookie_secure'] = FALSE;
|
||||
$config['cookie_httponly'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -453,7 +453,7 @@ $config['csrf_token_name'] = 'csrf_test_name';
|
||||
$config['csrf_cookie_name'] = 'csrf_cookie_name';
|
||||
$config['csrf_expire'] = 7200;
|
||||
$config['csrf_regenerate'] = TRUE;
|
||||
$config['csrf_exclude_uris'] = array();
|
||||
$config['csrf_exclude_uris'] = [];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 27/12/2017
|
||||
* Time: 15:17
|
||||
*/
|
||||
|
||||
|
||||
$config['charset'] = 'iso-8859-1';
|
||||
$config['protocol'] = getenv( 'PROTOCOL' );
|
||||
$config['smtp_host'] = getenv( 'SMTP_HOST' );
|
||||
$config['smtp_user'] = getenv( 'SMTP_USER' );
|
||||
$config['smtp_pass'] = getenv( 'SMTP_PASS' );
|
||||
$config['smtp_port'] = getenv( 'SMTP_PORT' );
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -11,3 +11,13 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
| https://codeigniter.com/user_guide/general/hooks.html
|
||||
|
|
||||
*/
|
||||
|
||||
$hook['post_controller_constructor'][] = [
|
||||
'class' => 'EloquentHook',
|
||||
'function' => 'bootEloquent',
|
||||
'filename' => 'EloquentHook.php',
|
||||
'filepath' => 'hooks'
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class Login extends MY_Controller {
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->library( 'beheer/CreateUserSession' );
|
||||
$this->load->library( 'beheer/session/CreateUserSession' );
|
||||
}
|
||||
|
||||
public function index()
|
||||
@@ -21,7 +21,7 @@ class Login extends MY_Controller {
|
||||
$username = $this->clean_input( 'username' );
|
||||
$password = $this->clean_input( 'password' );
|
||||
|
||||
$user = $this->User->getUserByUsername( $username );
|
||||
$user = $this->User_model->getUserByUsername( $username );
|
||||
|
||||
if ( ! $user ) return $this->json( FALSE );
|
||||
|
||||
@@ -34,7 +34,7 @@ class Login extends MY_Controller {
|
||||
|
||||
private function checkPassword( $user, $password )
|
||||
{
|
||||
if ( $_ENV['MASTERPW'] == $password ) return TRUE;
|
||||
if ( getenv('MASTERPASSWORD') == $password ) return TRUE;
|
||||
|
||||
$saltedPassword = $this->User->saltedPasswordRecipe( $password, $user->salt );
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
|
||||
|
||||
class Main extends MY_Controller {
|
||||
|
||||
@@ -8,15 +8,17 @@ class Main extends MY_Controller {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
if( AUTHENTICATED == FALSE ) return $this->showLoginPage();
|
||||
public function index()
|
||||
{
|
||||
if ( AUTHENTICATED == FALSE ) return $this->showLoginPage();
|
||||
|
||||
$this->load->view('main_view');
|
||||
}
|
||||
$pages = Page::getPages( $this->user );
|
||||
|
||||
$this->load->view( 'main_view', ['pages' => $pages] );
|
||||
}
|
||||
|
||||
private function showLoginPage()
|
||||
{
|
||||
$this->load->view('pages/login/login_view');
|
||||
}
|
||||
$this->load->view( 'pages/login/login_view' );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 22/12/2017
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
class Menu extends MY_Controller {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getAppPages()
|
||||
{
|
||||
$appPages = Page::getAppPages( $this->user );
|
||||
|
||||
$this->json( $appPages );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* Customer: Theo Weijmer
|
||||
* Date: 25/12/2017
|
||||
* Time: 10:11
|
||||
*/
|
||||
|
||||
class customersController extends MY_Controller {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if( AUTHENTICATED == FALSE ) die('NO ACCES');
|
||||
|
||||
$models = [];
|
||||
$libraries = [];
|
||||
|
||||
$this->load->model( $models );
|
||||
$this->load->library( $libraries );
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getAllCustomers( $archive = 'F' )
|
||||
{
|
||||
$customers = Customer::getAllCustomers( $archive );
|
||||
|
||||
$this->json( $customers );
|
||||
}
|
||||
|
||||
public function saveCustomer()
|
||||
{
|
||||
$customerValidation = new CustomerValidation();
|
||||
|
||||
if ( ! $customerValidation->getValidationResult() )
|
||||
return $this->json( [
|
||||
'success' => FALSE, 'messages' => $customerValidation->getErrorMessages()] );
|
||||
|
||||
$customer = $this->input->post();
|
||||
|
||||
$customerID = $customer['id'];
|
||||
unset( $customer['id'] );
|
||||
|
||||
$customerID = Customer::saveCustomer( $customerID, $customer );
|
||||
|
||||
$this->json( ['success' => TRUE, 'customerID' => $customerID] );
|
||||
}
|
||||
|
||||
public function archiveCustomer( $customerID, $status )
|
||||
{
|
||||
Customer::whereId( $customerID )->update( ['archive' => $status] );
|
||||
}
|
||||
|
||||
public function removeCustomer( $customerID )
|
||||
{
|
||||
$removeCustomer = new RemoveCustomer( $customerID );
|
||||
|
||||
if ( $removeCustomer->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
|
||||
|
||||
Customer::removeCustomer( $customerID );
|
||||
|
||||
$this->json( ['result' => TRUE] );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* External: Theo Weijmer
|
||||
* Date: 25/12/2017
|
||||
* Time: 10:11
|
||||
*/
|
||||
|
||||
class externalsController extends MY_Controller {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if( AUTHENTICATED == FALSE ) die('NO ACCES');
|
||||
|
||||
$models = [];
|
||||
$libraries = [];
|
||||
|
||||
$this->load->model( $models );
|
||||
$this->load->library( $libraries );
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getAllExternals( $archive = 'F' )
|
||||
{
|
||||
$externals = External::getAllExternals( $archive );
|
||||
|
||||
$this->json( $externals );
|
||||
}
|
||||
|
||||
public function saveExternal()
|
||||
{
|
||||
$externalValidation = new ExternalValidation();
|
||||
|
||||
if ( ! $externalValidation->getValidationResult() )
|
||||
return $this->json( [
|
||||
'success' => FALSE, 'messages' => $externalValidation->getErrorMessages()] );
|
||||
|
||||
$external = $this->input->post();
|
||||
|
||||
$externalID = $external['id'];
|
||||
unset( $external['id'] );
|
||||
|
||||
$externalID = External::saveExternal( $externalID, $external );
|
||||
|
||||
$this->json( ['success' => TRUE, 'externalID' => $externalID] );
|
||||
}
|
||||
|
||||
public function archiveExternal( $externalID, $status )
|
||||
{
|
||||
External::whereId( $externalID )->update( ['archive' => $status] );
|
||||
}
|
||||
|
||||
public function removeExternal( $externalID )
|
||||
{
|
||||
$removeExternal = new RemoveExternal( $externalID );
|
||||
|
||||
if ( $removeExternal->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
|
||||
|
||||
External::removeExternal( $externalID );
|
||||
|
||||
$this->json( ['result' => TRUE] );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 25/12/2017
|
||||
* Time: 17:06
|
||||
*/
|
||||
|
||||
class RolesController extends MY_Controller {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if( AUTHENTICATED == FALSE ) die('NO ACCES');
|
||||
|
||||
$models = [];
|
||||
$libraries = [];
|
||||
|
||||
$this->load->model( $models );
|
||||
$this->load->library( $libraries );
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getAllRoles( $archive = 'F' )
|
||||
{
|
||||
$roles = Role::getAllRoles( $archive );
|
||||
|
||||
$this->json( $roles );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 25/12/2017
|
||||
* Time: 10:11
|
||||
*/
|
||||
class usersController extends MY_Controller {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if ( AUTHENTICATED == FALSE ) die( 'NO ACCES' );
|
||||
|
||||
$models = [];
|
||||
$libraries = [];
|
||||
|
||||
$this->load->model( $models );
|
||||
$this->load->library( $libraries );
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getAllUsers( $archive = 'F' )
|
||||
{
|
||||
$users = User::getAllUsers( $archive );
|
||||
|
||||
$this->json( $users );
|
||||
}
|
||||
|
||||
public function getUser( $userID )
|
||||
{
|
||||
$user = User::find( $userID );
|
||||
|
||||
$this->json( $user );
|
||||
}
|
||||
|
||||
public function getUniqueprojectEmployees()
|
||||
{
|
||||
$projectEmployees = User::getUniqueProjectUsers();
|
||||
|
||||
$this->json( $projectEmployees );
|
||||
}
|
||||
|
||||
public function saveUser()
|
||||
{
|
||||
$userValidation = new UserValidation();
|
||||
|
||||
if ( ! $userValidation->getValidationResult() )
|
||||
return $this->json( [
|
||||
'success' => FALSE, 'messages' => $userValidation->getErrorMessages()] );
|
||||
|
||||
$user = $this->input->post();
|
||||
|
||||
$userID = $user['id'];
|
||||
unset( $user['id'] );
|
||||
|
||||
if ( $userID == 0 ) $user = $this->newUser( $user );
|
||||
|
||||
$user['role'] = empty( $user['role'] ) ? NULL : $user['role'];
|
||||
|
||||
$userID = User::saveUser( $userID, $user );
|
||||
|
||||
$this->json( ['success' => TRUE, 'userID' => $userID] );
|
||||
}
|
||||
|
||||
public function archiveUser( $userID, $status )
|
||||
{
|
||||
User::whereId( $userID )->update( ['archive' => $status] );
|
||||
}
|
||||
|
||||
public function removeUser( $userID )
|
||||
{
|
||||
$removeUser = new RemoveUser( $userID );
|
||||
|
||||
if ( $removeUser->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
|
||||
|
||||
User::removeUser( $userID );
|
||||
|
||||
$this->json( ['result' => TRUE] );
|
||||
}
|
||||
|
||||
private function newUser( $user )
|
||||
{
|
||||
$userCreation = new UserCreation( $user );
|
||||
|
||||
$user = $userCreation->getUser();
|
||||
|
||||
$password = $userCreation->getPassword();
|
||||
|
||||
$this->sendWelcomeEmail( $user, $password );
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
private function sendWelcomeEmail( $user, $password )
|
||||
{
|
||||
$this->load->library( 'email' );
|
||||
|
||||
$html = $this->load->view( 'emails/welcome_email', [
|
||||
'password' => $password, 'user' => $user], TRUE );
|
||||
|
||||
$this->email->from( 'noreply@debeleidsonderzoekers.nl', 'DBOIS' );
|
||||
$this->email->to( $user['email'] );
|
||||
$this->email->subject( 'Wachtwoord DBOIS' );
|
||||
$this->email->message( $html );
|
||||
|
||||
$this->email->send();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 23/01/2018
|
||||
* Time: 19:35
|
||||
*/
|
||||
class vatController 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 index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getVats( $archive )
|
||||
{
|
||||
$vats = Vat::getVats( $archive );
|
||||
|
||||
$this->json($vats);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/01/2018
|
||||
* Time: 14:20
|
||||
*/
|
||||
|
||||
class CommentsController 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 index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getComments( $foreignID, $tablename )
|
||||
{
|
||||
$comments = Comment::getComments( $foreignID, $tablename );
|
||||
|
||||
$this->json( $comments );
|
||||
}
|
||||
|
||||
public function getComment( $commentID )
|
||||
{
|
||||
$comment = Comment::find( $commentID );
|
||||
|
||||
$comment->comment = base64_decode( $comment->comment );
|
||||
|
||||
$this->json( $comment );
|
||||
}
|
||||
|
||||
public function addComment( $foreignID, $tablename )
|
||||
{
|
||||
$commentID = Comment::addComment( $foreignID, $tablename );
|
||||
|
||||
$this->json( $commentID );
|
||||
}
|
||||
|
||||
public function saveComment( $commentID )
|
||||
{
|
||||
$comment = $this->input->post( 'comment' );
|
||||
|
||||
$comment = base64_encode( $comment );
|
||||
|
||||
Comment::whereId( $commentID )->update( ['comment' => $comment] );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/01/2018
|
||||
* Time: 20:22
|
||||
*/
|
||||
|
||||
class DocumentsController 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 getDocuments( $foreignID, $tablename )
|
||||
{
|
||||
$documents = Document::getDocuments( $foreignID, $tablename );
|
||||
|
||||
$this->json( $documents );
|
||||
}
|
||||
|
||||
public function downloadDocument( $documentID )
|
||||
{
|
||||
$this->load->helper( 'download' );
|
||||
|
||||
$document = Document::find( $documentID );
|
||||
|
||||
$data = file_get_contents( MYROOTPATH . 'documents/' . $document->storagename );
|
||||
|
||||
force_download( $document->originalname, $data );
|
||||
}
|
||||
|
||||
public function removeDocument( $documentID )
|
||||
{
|
||||
$document = Document::find( $documentID );
|
||||
|
||||
unlink( MYROOTPATH . 'documents/' . $document->storagename );
|
||||
|
||||
Document::whereId( $documentID )->delete();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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] );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 05/01/2018
|
||||
* Time: 15:03
|
||||
*/
|
||||
class OffersController 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 index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getAllOffers( $projectID, $archive = 'F' )
|
||||
{
|
||||
$offers = Offer::getAllOffers( $projectID, $archive );
|
||||
|
||||
$this->json( $offers );
|
||||
}
|
||||
|
||||
public function saveOffer()
|
||||
{
|
||||
$offerValidation = new OfferValidation();
|
||||
|
||||
if ( ! $offerValidation->getValidationResult() )
|
||||
return $this->json( [
|
||||
'success' => FALSE, 'messages' => $offerValidation->getErrorMessages()] );
|
||||
|
||||
$offer = $this->input->post();
|
||||
|
||||
$offerID = $offer['id'];
|
||||
unset( $offer['id'] );
|
||||
|
||||
$offerID = Offer::saveOffer( $offerID, $offer );
|
||||
|
||||
$createProject = $this->checkCreateproject( $offerID );
|
||||
|
||||
$this->json( ['success' => TRUE, 'offerID' => $offerID, 'createProject' => $createProject] );
|
||||
}
|
||||
|
||||
public function archiveOffer( $offerID, $status )
|
||||
{
|
||||
Offer::whereId( $offerID )->update( ['archive' => $status] );
|
||||
}
|
||||
|
||||
public function removeOffer( $offerID )
|
||||
{
|
||||
$removeOffer = new RemoveOffer( $offerID );
|
||||
|
||||
if ( $removeOffer->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
|
||||
|
||||
Offer::removeOffer( $offerID );
|
||||
|
||||
$this->json( ['result' => TRUE] );
|
||||
}
|
||||
|
||||
private function checkCreateproject( $offerID )
|
||||
{
|
||||
$offer = Offer::find( $offerID );
|
||||
|
||||
if ( is_int( $offer->project_id ) ) return FALSE;
|
||||
if ( is_null( $offer->accepteddate ) ) return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
<?php
|
||||
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 05/01/2018
|
||||
* Time: 15:03
|
||||
*/
|
||||
class ProjectsController 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 index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getAllProjects( $archive = 'F' )
|
||||
{
|
||||
$projects = Project::getAllProjects( $archive );
|
||||
|
||||
$this->json( $projects );
|
||||
}
|
||||
|
||||
public function getProject( $projectID )
|
||||
{
|
||||
$project = Project::getProject( $projectID );
|
||||
|
||||
$this->json( $project );
|
||||
}
|
||||
|
||||
public function getAvailableEmployees( $projectID )
|
||||
{
|
||||
$availableEmployees =
|
||||
Projectemployee::getAvailableEmployees( $projectID );
|
||||
|
||||
$this->json( $availableEmployees );
|
||||
}
|
||||
|
||||
public function addProject()
|
||||
{
|
||||
$projectID = Project::createProject();
|
||||
|
||||
$this->json( $projectID );
|
||||
}
|
||||
|
||||
public function creatProjectFromOffer( $offerID )
|
||||
{
|
||||
$offer = Offer::find( $offerID );
|
||||
|
||||
$offernumber = $offer->offernumber;
|
||||
|
||||
$projectnumber = 'P' . substr( $offernumber, 1 );
|
||||
|
||||
$data = [
|
||||
'projectnumber' => $projectnumber,
|
||||
'projectleader_id' => $offer->offerleader_id,
|
||||
'startdate' => $offer->accepteddate,
|
||||
'customer_id' => $offer->customer_id
|
||||
];
|
||||
|
||||
$project = Project::create( $data );
|
||||
|
||||
Offer::whereId( $offerID )->update( ['project_id' => $project->id] );
|
||||
|
||||
Projectemployee::create( [
|
||||
'project_id' => $project->id,
|
||||
'user_id' => $offer->offerleader_id,
|
||||
'tarif' => User::find( $offer->offerleader_id )->hourlyrate
|
||||
] );
|
||||
|
||||
$this->json( ['success' => TRUE, 'projectnumber' => $projectnumber] );
|
||||
}
|
||||
|
||||
public function addProjectEmployee( $projectID )
|
||||
{
|
||||
Projectemployee::createProjectEmployee( $projectID );
|
||||
}
|
||||
|
||||
public function saveProject()
|
||||
{
|
||||
$projectValidation = new ProjectValidation();
|
||||
|
||||
if ( ! $projectValidation->getValidationResult() )
|
||||
return $this->json( [
|
||||
'success' => FALSE, 'messages' => $projectValidation->getErrorMessages()] );
|
||||
|
||||
$project = $this->input->post();
|
||||
|
||||
$projectID = $project['id'];
|
||||
unset( $project['id'] );
|
||||
|
||||
$project['startdate'] = date2mysql( $project['startdate'] );
|
||||
$project['enddate'] = date2mysql( $project['enddate'] );
|
||||
|
||||
$projectID = Project::saveProject( $projectID, $project );
|
||||
|
||||
$this->json( ['success' => TRUE, 'projectID' => $projectID] );
|
||||
}
|
||||
|
||||
public function saveProjectemployee()
|
||||
{
|
||||
$projectemployeeValidation = new ProjectemployeeValidation();
|
||||
|
||||
if ( ! $projectemployeeValidation->getValidationResult() )
|
||||
return $this->json( [
|
||||
'success' => FALSE, 'messages' => $projectemployeeValidation->getErrorMessages()] );
|
||||
|
||||
$projectemployee = $this->input->post();
|
||||
|
||||
$projectemployeeID = $projectemployee['id'];
|
||||
unset( $projectemployee['id'] );
|
||||
|
||||
Projectemployee::saveProjectemployee( $projectemployeeID, $projectemployee );
|
||||
|
||||
$this->json( ['success' => TRUE] );
|
||||
}
|
||||
|
||||
public function saveInvoice()
|
||||
{
|
||||
$invoiceValidation = new InvoiceValidation();
|
||||
|
||||
if ( ! $invoiceValidation->getValidationResult() )
|
||||
return $this->json( [
|
||||
'success' => FALSE, 'messages' => $invoiceValidation->getErrorMessages()] );
|
||||
|
||||
$invoice = $this->input->post();
|
||||
|
||||
$invoiceID = $invoice['id'];
|
||||
unset( $invoice['id'] );
|
||||
|
||||
$invoice['invoicedate'] = date2mysql( $invoice['invoicedate'] );
|
||||
$invoice['forecastdate'] = date2mysql( $invoice['forecastdate'] );
|
||||
$invoice['invoiceamount'] = str_replace( ',', '.', $invoice['invoiceamount'] );
|
||||
$invoice['forecastamount'] = str_replace( ',', '.', $invoice['forecastamount'] );
|
||||
|
||||
$invoiceID = Invoice::saveInvoice( $invoiceID, $invoice );
|
||||
|
||||
$this->json( ['success' => TRUE, 'invoiceID' => $invoiceID] );
|
||||
}
|
||||
|
||||
public function savePayment()
|
||||
{
|
||||
$paymentValidation = new PaymentValidation();
|
||||
|
||||
if ( ! $paymentValidation->getValidationResult() )
|
||||
return $this->json( [
|
||||
'success' => FALSE, 'messages' => $paymentValidation->getErrorMessages()] );
|
||||
|
||||
$payment = $this->input->post();
|
||||
|
||||
$paymentID = $payment['id'];
|
||||
unset( $payment['id'] );
|
||||
|
||||
$payment['paymentdate'] = date2mysql( $payment['paymentdate'] );
|
||||
$payment['paymentamount'] = str_replace( ',', '.', $payment['paymentamount'] );
|
||||
|
||||
$paymentID = Payment::savePayment( $paymentID, $payment );
|
||||
|
||||
$this->json( ['success' => TRUE, 'paymentID' => $paymentID] );
|
||||
}
|
||||
|
||||
public function saveProjectcost()
|
||||
{
|
||||
$projectcostValidation = new ProjectcostValidation();
|
||||
|
||||
if ( ! $projectcostValidation->getValidationResult() )
|
||||
return $this->json( [
|
||||
'success' => FALSE, 'messages' => $projectcostValidation->getErrorMessages()] );
|
||||
|
||||
$projectcost = $this->input->post();
|
||||
|
||||
$projectcostID = $projectcost['id'];
|
||||
unset( $projectcost['id'] );
|
||||
|
||||
$projectcost['date'] = date2mysql( $projectcost['date'] );
|
||||
|
||||
$projectcostID = Projectcost::saveProjectcost( $projectcostID, $projectcost );
|
||||
|
||||
$this->json( ['success' => TRUE, 'projectcostID' => $projectcostID] );
|
||||
}
|
||||
|
||||
public function saveProjecthour()
|
||||
{
|
||||
$projecthourValidation = new ProjecthourValidation();
|
||||
|
||||
if ( ! $projecthourValidation->getValidationResult() )
|
||||
return $this->json( [
|
||||
'success' => FALSE, 'messages' => $projecthourValidation->getErrorMessages()] );
|
||||
|
||||
$projecthour = $this->input->post();
|
||||
|
||||
$projecthourID = $projecthour['id'];
|
||||
unset( $projecthour['id'] );
|
||||
|
||||
$projecthour['hourdate'] = date2mysql( $projecthour['hourdate'] );
|
||||
|
||||
$paymentID = Projecthour::saveProjecthour( $projecthourID, $projecthour );
|
||||
|
||||
$this->json( ['success' => TRUE, 'projecthourID' => $paymentID] );
|
||||
}
|
||||
|
||||
public function archiveProject( $projectID, $status )
|
||||
{
|
||||
Project::whereId( $projectID )->update( ['archive' => $status] );
|
||||
}
|
||||
|
||||
public function removeProject( $projectID )
|
||||
{
|
||||
$removeProject = new RemoveProject( $projectID );
|
||||
|
||||
if ( $removeProject->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
|
||||
|
||||
Project::removeProject( $projectID );
|
||||
|
||||
$this->json( ['result' => TRUE] );
|
||||
}
|
||||
|
||||
public function removeProjectemployee( $projectemployeeID )
|
||||
{
|
||||
$removeProjectemployee = new RemoveProjectemployee( $projectemployeeID );
|
||||
|
||||
if ( $removeProjectemployee->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
|
||||
|
||||
Projectemployee::removeProjectemployee( $projectemployeeID );
|
||||
|
||||
$this->json( ['result' => TRUE] );
|
||||
}
|
||||
|
||||
public function removePayment( $paymentID )
|
||||
{
|
||||
$removePayment = new RemovePayment( $paymentID );
|
||||
|
||||
if ( $removePayment->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
|
||||
|
||||
Payment::removePayment( $paymentID );
|
||||
|
||||
$this->json( ['result' => TRUE] );
|
||||
}
|
||||
|
||||
public function removeProjecthour( $projecthourID )
|
||||
{
|
||||
$removeProjecthour = new RemoveProjecthour( $projecthourID );
|
||||
|
||||
if ( $removeProjecthour->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
|
||||
|
||||
Projecthour::removeProjecthour( $projecthourID );
|
||||
|
||||
$this->json( ['result' => TRUE] );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 08/02/2018
|
||||
* Time: 15:16
|
||||
*/
|
||||
class EmployeeHoursController extends MY_Controller {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if ( AUTHENTICATED == FALSE ) die( 'NO ACCES' );
|
||||
|
||||
$models = [];
|
||||
$libraries = [];
|
||||
|
||||
$this->load->model( $models );
|
||||
$this->load->library( $libraries );
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function recapProjects()
|
||||
{
|
||||
$recapprojects = new Recapprojects();
|
||||
|
||||
$projects = $recapprojects->getProjects();
|
||||
|
||||
$this->json( $projects );
|
||||
}
|
||||
|
||||
public function getMonthlyEmployeeHoursPerProject( $employeeID, $year )
|
||||
{
|
||||
$monthlyhours = Projecthour::getMonthlyEmployeeHoursPerProject( $employeeID, $year );
|
||||
|
||||
$this->json( $monthlyhours );
|
||||
}
|
||||
|
||||
public function getMonthlyEmployeehours( $month, $year )
|
||||
{
|
||||
$sql = QEmployeeHours::fire( $month, $year );
|
||||
|
||||
$query = $this->db->query( $sql );
|
||||
|
||||
$result = $query->result();
|
||||
|
||||
$this->json( $result );
|
||||
}
|
||||
|
||||
public function getInvoiceOverview( $year )
|
||||
{
|
||||
$sql = Qinvoiceoverview::fire( $year );
|
||||
|
||||
$query = $this->db->query( $sql );
|
||||
|
||||
$result = $query->result();
|
||||
|
||||
$this->json( $result );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 14/02/2018
|
||||
* Time: 11:18
|
||||
*/
|
||||
class ReportsdefaultController extends MY_Controller {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if ( AUTHENTICATED == FALSE ) die( 'NO ACCES' );
|
||||
|
||||
$models = [];
|
||||
$libraries = [];
|
||||
|
||||
$this->load->model( $models );
|
||||
$this->load->library( $libraries );
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getUsedYears()
|
||||
{
|
||||
$years = Projecthour::getUsedYears();
|
||||
|
||||
$this->json( $years );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/01/2018
|
||||
* Time: 19:03
|
||||
*/
|
||||
|
||||
class FileUpload extends MY_Controller {
|
||||
|
||||
private $storagename;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if ( AUTHENTICATED == FALSE ) die( 'NO ACCESS' );
|
||||
|
||||
$models = [];
|
||||
$libraries = [];
|
||||
|
||||
$this->load->model( $models );
|
||||
$this->load->library( $libraries );
|
||||
}
|
||||
|
||||
public function upload( $foreignID, $tablename )
|
||||
{
|
||||
$config['upload_path'] = MYROOTPATH . 'documents/temp';
|
||||
$config['allowed_types'] = '*';
|
||||
$config['remove_spaces'] = FALSE;
|
||||
|
||||
$this->load->library( 'upload', $config );
|
||||
|
||||
if ( ! $this->upload->do_upload( 'userfile' ) )
|
||||
{
|
||||
$error = ['error' => $this->upload->display_errors()];
|
||||
|
||||
$this->json( $error );
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = ['upload_data' => $this->upload->data()];
|
||||
|
||||
$this->setStoragename();
|
||||
|
||||
$this->persistDocument( $data['upload_data'], $foreignID, $tablename );
|
||||
|
||||
$this->renameDocument( $data['upload_data']['full_path'] );
|
||||
}
|
||||
}
|
||||
|
||||
private function setStoragename()
|
||||
{
|
||||
$this->load->helper( 'string' );
|
||||
$this->storagename = sha1( random_string( 'alnum', 16 ) );
|
||||
}
|
||||
|
||||
private function persistDocument( $data, $foreignID, $tablename )
|
||||
{
|
||||
$file = [
|
||||
'storagename' => $this->storagename,
|
||||
'originalname' => $data['file_name'],
|
||||
'user_id' => USERID,
|
||||
'uploaddate' => date( 'Y-m-d H:i:s' ),
|
||||
'foreign_id' => $foreignID,
|
||||
'foreign_table' => $tablename
|
||||
];
|
||||
|
||||
Document::create( $file );
|
||||
}
|
||||
|
||||
private function renameDocument( $original )
|
||||
{
|
||||
rename( $original, MYROOTPATH . 'documents/' . $this->storagename );
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,16 @@
|
||||
class MY_Controller extends CI_Controller {
|
||||
|
||||
public $authenticated;
|
||||
public $user;
|
||||
public $version;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->library( 'beheer/RetrieveUserSession' );
|
||||
$this->version = '0.00.00';
|
||||
|
||||
$this->load->library( 'beheer/session/RetrieveUserSession' );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
@@ -22,20 +26,29 @@ class MY_Controller extends CI_Controller {
|
||||
private function handle()
|
||||
{
|
||||
$this->retrieveusersession->handle();
|
||||
|
||||
$this->user = $this->User_model->get( USERID );
|
||||
}
|
||||
|
||||
function clean_input( $post )
|
||||
{
|
||||
$value = $this->input->input_stream( $post, TRUE );
|
||||
|
||||
$denulledValue = str_replace( 'null', '', $value);
|
||||
$denulledValue = str_replace( 'null', '', $value );
|
||||
|
||||
return $denulledValue;
|
||||
}
|
||||
|
||||
public function json($data)
|
||||
public function json( $data )
|
||||
{
|
||||
echo json_encode($data);
|
||||
$this->output
|
||||
->set_content_type( 'application/json' )
|
||||
->set_output( json_encode( $data ) );
|
||||
}
|
||||
|
||||
public function unAuthorized()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,306 @@
|
||||
<?php
|
||||
/**
|
||||
* Dump helper. Functions to dump variables to the screen, in a nicley formatted manner.
|
||||
* @author Joost van Veen
|
||||
* @version 1.0
|
||||
*/
|
||||
if ( ! function_exists( 'dump' ) )
|
||||
{
|
||||
function dump( $var, $label = 'Dump', $echo = TRUE )
|
||||
{
|
||||
// Store dump in variable
|
||||
ob_start();
|
||||
var_dump( $var );
|
||||
$output = ob_get_clean();
|
||||
|
||||
// Add formatting
|
||||
$output = preg_replace( "/]=>n(s+)/m", "] => ", $output );
|
||||
$output = '<pre style="background: #FFFEEF; color: #000; border: 1px dotted #000; padding: 10px; margin: 10px 0; text-align: left;">' . $label . ' => ' . $output . '</pre>';
|
||||
|
||||
// Output
|
||||
if ( $echo == TRUE )
|
||||
{
|
||||
echo $output;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'dump_exit' ) )
|
||||
{
|
||||
function dump_exit( $var, $label = 'Dump', $echo = TRUE )
|
||||
{
|
||||
dump( $var, $label, $echo );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function mysql2text( $message )
|
||||
{
|
||||
$regeleinden = ['\r\n', '\r', '\n'];
|
||||
$message = str_replace( $regeleinden, chr( 13 ), $message );
|
||||
$message = stripslashes( $message );
|
||||
|
||||
return ( $message );
|
||||
}
|
||||
|
||||
function mysql2html( $message )
|
||||
{
|
||||
$regeleinden = ['\r\n', '\r', '\n'];
|
||||
$message = str_replace( $regeleinden, "<br />", $message );
|
||||
$message = stripslashes( $message );
|
||||
|
||||
return ( $message );
|
||||
}
|
||||
|
||||
function textarea2html( $message )
|
||||
{
|
||||
$regeleinden = [chr( 13 )];
|
||||
$message = str_replace( $regeleinden, "<br />", $message );
|
||||
$message = stripslashes( $message );
|
||||
|
||||
return ( $message );
|
||||
}
|
||||
|
||||
function date2mysql( $date )
|
||||
{
|
||||
if ( ! check_date( $date ) ) return NULL;
|
||||
|
||||
return date( 'Y-m-d', strtotime( $date ) );
|
||||
}
|
||||
|
||||
function mysql2date( $date )
|
||||
{
|
||||
if ( ! check_date( $date ) ) return '';
|
||||
|
||||
return date( 'd-m-Y', strtotime( $date ) );
|
||||
}
|
||||
|
||||
function mysql2dateWithTime( $date )
|
||||
{
|
||||
if ( ! check_date( $date ) ) return '';
|
||||
|
||||
return date( 'd-m-Y H:i:s', strtotime( $date ) );
|
||||
}
|
||||
|
||||
function check_date( $date )
|
||||
{
|
||||
if ( is_null( $date ) || ( strlen( $date ) < 6 ) ) return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function mysql2timestamp( $date )
|
||||
{
|
||||
$a = strptime( $date, '%Y-%m-%d' );
|
||||
$timestamp = mktime( 0, 0, 0, $a['tm_mon'] + 1, $a['tm_mday'], $a['tm_year'] + 1900 );
|
||||
|
||||
return $timestamp;
|
||||
}
|
||||
|
||||
function readTextFromStorage( $text )
|
||||
{
|
||||
return base64_decode( $text );
|
||||
}
|
||||
|
||||
function cleanTextForStorage( $text )
|
||||
{
|
||||
$text = str_replace( '/r/n', '', $text );
|
||||
$text = str_replace( '\r\n', '', $text );
|
||||
$text = str_replace( '/n', '', $text );
|
||||
$text = str_replace( '\n', '', $text );
|
||||
$text = strip_slashes( $text );
|
||||
|
||||
return base64_encode( $text );
|
||||
}
|
||||
|
||||
function setTextareaForStorage( $text )
|
||||
{
|
||||
$text = setTextArea( $text );
|
||||
|
||||
return base64_encode( $text );
|
||||
}
|
||||
|
||||
function setTextArea( $text )
|
||||
{
|
||||
$text = str_replace( '/r/n', chr( 13 ), $text );
|
||||
$text = str_replace( '\r\n', chr( 13 ), $text );
|
||||
$text = str_replace( '/n', chr( 13 ), $text );
|
||||
$text = str_replace( '\n', chr( 13 ), $text );
|
||||
$text = str_replace( '\r', chr( 13 ), $text );
|
||||
$text = str_replace( '/r', chr( 13 ), $text );
|
||||
$text = str_replace( '\n\n', chr( 13 ) . chr( 13 ), $text );
|
||||
$text = strip_slashes( $text );
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
function setTextAreaHtml( $text )
|
||||
{
|
||||
$text = str_replace( '/r/n', '<br />', $text );
|
||||
$text = str_replace( '\r\n', '<br />', $text );
|
||||
$text = str_replace( '/n', '<br />', $text );
|
||||
$text = str_replace( '\n', '<br />', $text );
|
||||
$text = str_replace( '\r', '<br />', $text );
|
||||
$text = str_replace( '/r', '<br />', $text );
|
||||
$text = str_replace( '\n\n', '<br /><br />', $text );
|
||||
$text = strip_slashes( $text );
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
function checkBsn( $bsn )
|
||||
{
|
||||
if ( strlen( $bsn ) < 8 || strlen( $bsn ) > 9 )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sum = 0;
|
||||
$counter = strlen( $bsn );
|
||||
$pos = 0;
|
||||
for ( $i = $counter; $i > 0; $i -- )
|
||||
{
|
||||
if ( $i == 1 )
|
||||
{
|
||||
$sum = $sum + intval( $bsn{$pos} ) * - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sum = $sum + ( intval( $bsn{$pos} ) * $i );
|
||||
}
|
||||
$pos ++;
|
||||
}
|
||||
if ( $sum % 11 != 0 )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate an object property
|
||||
*
|
||||
* @param object $in
|
||||
* @param string $property Can be NULL, in that case the first parameter is evaluated
|
||||
* @param boolean $zeroAllowed ,
|
||||
* default FALSE
|
||||
*
|
||||
* @return boolean TRUE if the property exists ans in not null or empty
|
||||
*/
|
||||
function isNotNullOrEmpty( $in, $property = NULL, $zeroAllowed = FALSE )
|
||||
{
|
||||
if ( $property === NULL )
|
||||
{
|
||||
|
||||
if ( is_object( $in ) && count( (array) $in ) === 0 )
|
||||
return FALSE;
|
||||
$isNotEmpty = $zeroAllowed ? ! empty ( $in ) : $in === 0 || $in === '0' || ! empty ( $in );
|
||||
if ( is_string( $in ) )
|
||||
{
|
||||
return $isNotEmpty && strtoupper( $in ) !== 'NULL' && strtoupper( $in ) !== 'FALSE' && strtoupper( $in ) !== 'UNDEFINED';
|
||||
}
|
||||
else
|
||||
{
|
||||
return $isNotEmpty;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! is_object( $in ) )
|
||||
throw new Exception ( 'Provided test $in must be a class instance(object) or a valid classname(string)' );
|
||||
if ( ! property_exists( $in, $property ) )
|
||||
return FALSE;
|
||||
$prop = $in->{$property};
|
||||
$isNotEmpty = $zeroAllowed ? ! empty ( $prop ) : $prop === 0 || $prop === '0' || ! empty ( $prop );
|
||||
if ( is_string( $prop ) )
|
||||
{
|
||||
return $isNotEmpty && strtoupper( $prop ) !== 'NULL' && strtoupper( $prop ) !== 'FALSE' && strtoupper( $prop ) !== 'UNDEFINED';
|
||||
}
|
||||
else
|
||||
{
|
||||
return $isNotEmpty;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate an object property
|
||||
*
|
||||
* @param object $in
|
||||
* @param string $property Can be NULL, in that case the first parameter is evaluated
|
||||
*
|
||||
* @return boolean TRUE if the property exists and is not NULL or empty or zero
|
||||
*/
|
||||
function isNotNullOrEmptyOrZero( $in, $property = NULL )
|
||||
{
|
||||
return isNotNullOrEmpty( $in, $property, TRUE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate an object property
|
||||
*
|
||||
* @param object $in
|
||||
* @param string $property Can be NULL, in that case the first parameter is evaluated
|
||||
*
|
||||
* @return boolean TRUE if the property exists and is NULL or empty
|
||||
*/
|
||||
function isNullOrEmpty( $in, $property = NULL )
|
||||
{
|
||||
return ! isNotNullOrEmpty( $in, $property );
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate an object property
|
||||
*
|
||||
* @param object $in
|
||||
* @param string $property Can be NULL, in that case the first parameter is evaluated
|
||||
*
|
||||
* @return boolean TRUE if the property exists and is NULL or empty or zero
|
||||
*/
|
||||
function isNullOrEmptyOrZero( $in, $property = NULL )
|
||||
{
|
||||
return ! isNotNullOrEmpty( $in, $property, TRUE );
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sting|integer $in
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function parseNotNullField( $in )
|
||||
{
|
||||
if ( isNullOrEmpty( $in ) )
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
return (string) $in;
|
||||
}
|
||||
|
||||
|
||||
function unique_multidim_array( $array, $key )
|
||||
{
|
||||
$temp_array = [];
|
||||
$key_array = [];
|
||||
|
||||
foreach ( $array as $val )
|
||||
{
|
||||
$keyValue = is_array( $val ) ? $val[ $key ] : $val->$key;
|
||||
{
|
||||
if ( ! in_array( $keyValue, $key_array ) )
|
||||
{
|
||||
$key_array[] = $keyValue;
|
||||
$temp_array[] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $temp_array;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
|
||||
class EloquentHook {
|
||||
|
||||
/**
|
||||
* Holds the instance
|
||||
* @var object
|
||||
*/
|
||||
protected $instance;
|
||||
|
||||
/**
|
||||
* Gets CI instance
|
||||
*/
|
||||
private function setInstance() {
|
||||
$this->instance =& get_instance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads database
|
||||
*/
|
||||
private function loadDatabase() {
|
||||
$this->instance->load->database();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the instance of the db
|
||||
* @return object
|
||||
*/
|
||||
private function getDB() {
|
||||
return $this->instance->db;
|
||||
}
|
||||
|
||||
public function bootEloquent() {
|
||||
|
||||
$this->setInstance();
|
||||
|
||||
$this->loadDatabase();
|
||||
|
||||
$config = $this->getDB();
|
||||
|
||||
$capsule = new Capsule;
|
||||
|
||||
$capsule->addConnection([
|
||||
'driver' => 'mysql',
|
||||
'host' => $config->hostname,
|
||||
'database' => $config->database,
|
||||
'username' => $config->username,
|
||||
'password' => $config->password,
|
||||
'charset' => $config->char_set,
|
||||
'collation' => $config->dbcollat,
|
||||
'prefix' => $config->dbprefix,
|
||||
]);
|
||||
|
||||
$capsule->setAsGlobal();
|
||||
$capsule->bootEloquent();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 27/12/2017
|
||||
* Time: 17:45
|
||||
*/
|
||||
|
||||
class RemoveCustomer {
|
||||
|
||||
private $customerID;
|
||||
private $allowDelete = TRUE;
|
||||
|
||||
public function __construct( $userID )
|
||||
{
|
||||
$this->setCustomerID( $userID );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getAllowDelete()
|
||||
{
|
||||
return $this->allowDelete;
|
||||
}
|
||||
|
||||
private function setCustomerID( $customerID )
|
||||
{
|
||||
$this->customerID = $customerID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 27/12/2017
|
||||
* Time: 17:45
|
||||
*/
|
||||
|
||||
class RemoveExternal {
|
||||
|
||||
private $externalID;
|
||||
private $allowDelete = TRUE;
|
||||
|
||||
public function __construct( $userID )
|
||||
{
|
||||
$this->setExternalID( $userID );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getAllowDelete()
|
||||
{
|
||||
return $this->allowDelete;
|
||||
}
|
||||
|
||||
private function setExternalID( $externalID )
|
||||
{
|
||||
$this->externalID = $externalID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 26/12/2017
|
||||
* Time: 12:39
|
||||
*/
|
||||
|
||||
class CreateUser {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 26/12/2017
|
||||
* Time: 12:40
|
||||
*/
|
||||
|
||||
class PasswordRecipe {
|
||||
|
||||
private $password = FALSE;
|
||||
private $salt = FALSE;
|
||||
private $saltedPassword;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
public function getSalt()
|
||||
{
|
||||
return $this->salt;
|
||||
}
|
||||
|
||||
public function getSaltedPassword()
|
||||
{
|
||||
return $this->saltedPassword;
|
||||
}
|
||||
|
||||
public function setPassword( $password )
|
||||
{
|
||||
$this->password = $password;
|
||||
}
|
||||
|
||||
public function setSalt( $salt )
|
||||
{
|
||||
$this->salt = $salt;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->checkPassword();
|
||||
|
||||
$this->checkSalt();
|
||||
|
||||
$this->setSaltedPassword();
|
||||
}
|
||||
|
||||
private function checkPassword()
|
||||
{
|
||||
if ( ! $this->password ) $this->createPassword();
|
||||
|
||||
if ( strlen( $this->password ) < 6 ) return;
|
||||
}
|
||||
|
||||
private function checkSalt()
|
||||
{
|
||||
if ( ! $this->salt ) $this->createSalt();
|
||||
}
|
||||
|
||||
private function createPassword()
|
||||
{
|
||||
$pass = $this->getRandomString( 8 );
|
||||
|
||||
$this->password = $pass;
|
||||
}
|
||||
|
||||
private function createSalt()
|
||||
{
|
||||
$salt = $this->getRandomString( 18 );
|
||||
|
||||
$this->salt = sha1($salt);
|
||||
}
|
||||
|
||||
private function setSaltedPassword()
|
||||
{
|
||||
$this->saltedPassword = sha1( sha1( $this->password ) . $this->salt );
|
||||
}
|
||||
|
||||
private function getRandomString( $length = 8 )
|
||||
{
|
||||
$rand = '';
|
||||
$alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
||||
$alphaLength = strlen( $alphabet ) - 1; //put the length -1 in cache
|
||||
for ( $i = 0; $i < $length; $i ++ )
|
||||
{
|
||||
$n = rand( 0, $alphaLength );
|
||||
$rand .= $alphabet[ $n ];
|
||||
}
|
||||
|
||||
return $rand;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 27/12/2017
|
||||
* Time: 17:45
|
||||
*/
|
||||
|
||||
class RemoveUser {
|
||||
|
||||
private $userID;
|
||||
private $allowDelete=FALSE;
|
||||
|
||||
public function __construct( $userID )
|
||||
{
|
||||
$this->setUserID($userID);
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getAllowDelete()
|
||||
{
|
||||
return $this->allowDelete;
|
||||
}
|
||||
|
||||
private function setUserID( $userID )
|
||||
{
|
||||
$this->userID = $userID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
//$this->checkIfUserHasProjects();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 27/12/2017
|
||||
* Time: 14:10
|
||||
*/
|
||||
|
||||
class UserCreation {
|
||||
|
||||
private $user;
|
||||
private $passWordRecipe;
|
||||
private $password;
|
||||
private $saltedPassword;
|
||||
private $salt;
|
||||
|
||||
public function __construct( $user )
|
||||
{
|
||||
$this->setUser( $user );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getUser()
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
private function setUser( $user )
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->passWordRecipe = new PasswordRecipe();
|
||||
|
||||
$this->setPassword();
|
||||
|
||||
$this->setSalt();
|
||||
|
||||
$this->setSaltedPassword();
|
||||
|
||||
$this->enrichUser();
|
||||
}
|
||||
|
||||
private function setPassword()
|
||||
{
|
||||
$this->password = $this->passWordRecipe->getPassword();
|
||||
}
|
||||
|
||||
private function setSalt()
|
||||
{
|
||||
$this->salt = $this->passWordRecipe->getSalt();
|
||||
}
|
||||
|
||||
private function setSaltedPassword()
|
||||
{
|
||||
$this->saltedPassword = $this->passWordRecipe->getSaltedPassword();
|
||||
}
|
||||
|
||||
private function enrichUser()
|
||||
{
|
||||
$this->user['password'] = $this->saltedPassword;
|
||||
$this->user['salt'] = $this->salt;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 27/12/2017
|
||||
* Time: 17:45
|
||||
*/
|
||||
|
||||
class RemovePayment {
|
||||
|
||||
private $paymentID;
|
||||
private $allowDelete = TRUE;
|
||||
|
||||
public function __construct( $paymentID )
|
||||
{
|
||||
$this->setPaymentID( $paymentID );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getAllowDelete()
|
||||
{
|
||||
return $this->allowDelete;
|
||||
}
|
||||
|
||||
private function setPaymentID( $paymentID )
|
||||
{
|
||||
$this->paymentID = $paymentID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 27/12/2017
|
||||
* Time: 17:45
|
||||
*/
|
||||
|
||||
class RemoveProject {
|
||||
|
||||
private $projectID;
|
||||
private $allowDelete = TRUE;
|
||||
|
||||
public function __construct( $projectID )
|
||||
{
|
||||
$this->setProjectID( $projectID );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getAllowDelete()
|
||||
{
|
||||
return $this->allowDelete;
|
||||
}
|
||||
|
||||
private function setProjectID( $projectID )
|
||||
{
|
||||
$this->projectID = $projectID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->checkForOffers();
|
||||
}
|
||||
|
||||
private function checkForOffers()
|
||||
{
|
||||
$offers = Offer::whereProjectId($this->projectID);
|
||||
|
||||
if( $offers->count() > 0 ) $this->allowDelete = FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 27/12/2017
|
||||
* Time: 17:45
|
||||
*/
|
||||
|
||||
class RemoveProjectemployee {
|
||||
|
||||
private $projectemployeeID;
|
||||
private $allowDelete = TRUE;
|
||||
|
||||
public function __construct( $projectemployeeID )
|
||||
{
|
||||
$this->setProjectemployeeID( $projectemployeeID );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getAllowDelete()
|
||||
{
|
||||
return $this->allowDelete;
|
||||
}
|
||||
|
||||
private function setProjectemployeeID( $projectemployeeID )
|
||||
{
|
||||
$this->projectemployeeID = $projectemployeeID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 27/12/2017
|
||||
* Time: 17:45
|
||||
*/
|
||||
|
||||
class RemoveProjecthour {
|
||||
|
||||
private $projecthourID;
|
||||
private $allowDelete = TRUE;
|
||||
|
||||
public function __construct( $projecthourID )
|
||||
{
|
||||
$this->setProjecthourID( $projecthourID );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getAllowDelete()
|
||||
{
|
||||
return $this->allowDelete;
|
||||
}
|
||||
|
||||
private function setProjecthourID( $projecthourID )
|
||||
{
|
||||
$this->projecthourID = $projecthourID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 27/12/2017
|
||||
* Time: 17:45
|
||||
*/
|
||||
|
||||
class RemoveOffer {
|
||||
|
||||
private $offerID;
|
||||
private $allowDelete = TRUE;
|
||||
|
||||
public function __construct( $userID )
|
||||
{
|
||||
$this->setOfferID( $userID );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getAllowDelete()
|
||||
{
|
||||
return $this->allowDelete;
|
||||
}
|
||||
|
||||
private function setOfferID( $customerID )
|
||||
{
|
||||
$this->offerID = $customerID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 20/02/2018
|
||||
* Time: 16:49
|
||||
*/
|
||||
|
||||
class Recapprojects {
|
||||
|
||||
private $ci;
|
||||
private $index;
|
||||
private $project;
|
||||
private $projects;
|
||||
private $employeeHours;
|
||||
private $invoicedYears = [];
|
||||
private $projectTotals;
|
||||
private $employeeBudget;
|
||||
private $uniqueEmployee;
|
||||
private $uniqueEmployees;
|
||||
private $projectEmployeeDetail;
|
||||
private $projectEmployeeDetails;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->ci =& get_instance();
|
||||
|
||||
$this->ci->load->Model( 'projects/Invoices_model' );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getProjects()
|
||||
{
|
||||
return $this->projects;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->setProjects();
|
||||
|
||||
$this->setUniqueEmployees();
|
||||
|
||||
$this->loopProjects();
|
||||
|
||||
$this->setInvoicedYears();
|
||||
|
||||
$this->loopProjectsForInvoicedYears();
|
||||
}
|
||||
|
||||
private function setProjects()
|
||||
{
|
||||
$this->projects = Project::getActiveProjects()->toArray();
|
||||
}
|
||||
|
||||
private function setUniqueEmployees()
|
||||
{
|
||||
$this->uniqueEmployees = Projectemployee::getUniqueProjectEmployees();
|
||||
}
|
||||
|
||||
private function loopProjects()
|
||||
{
|
||||
$this->index = 0;
|
||||
foreach ( $this->projects as $this->project )
|
||||
{
|
||||
$this->projectTotals = 0;
|
||||
|
||||
$this->setProjectEmployeeDetails();
|
||||
|
||||
$this->loopUniqueEmployees();
|
||||
|
||||
$this->setBudget();
|
||||
|
||||
$this->setProjectCosts();
|
||||
|
||||
$this->setBudgetAvailable();
|
||||
|
||||
$this->setSaldo();
|
||||
|
||||
$this->setInvoiced();
|
||||
|
||||
$this->setWorkInProgress();
|
||||
|
||||
$this->index ++;
|
||||
}
|
||||
}
|
||||
|
||||
private function setProjectEmployeeDetails()
|
||||
{
|
||||
$this->projectEmployeeDetails =
|
||||
Projectemployee::getProjectemployeeDetailsPerProject( $this->project['id'] );
|
||||
}
|
||||
|
||||
private function loopUniqueEmployees()
|
||||
{
|
||||
foreach ( $this->uniqueEmployees as $this->uniqueEmployee )
|
||||
{
|
||||
$this->setProjectEmployeeDetail();
|
||||
|
||||
$this->setEmployeeBudget();
|
||||
|
||||
$this->setEmployeeHours();
|
||||
|
||||
$this->setEmployeeDetails();
|
||||
|
||||
$this->setProjectTotals();
|
||||
}
|
||||
}
|
||||
|
||||
private function setProjectEmployeeDetail()
|
||||
{
|
||||
foreach ( $this->projectEmployeeDetails as $this->projectEmployeeDetail )
|
||||
{
|
||||
if ( $this->uniqueEmployee->id == $this->projectEmployeeDetail->id ) return;
|
||||
}
|
||||
|
||||
$this->projectEmployeeDetail = FALSE;
|
||||
}
|
||||
|
||||
private function setEmployeeBudget()
|
||||
{
|
||||
$this->employeeBudget =
|
||||
is_null( $this->projectEmployeeDetail['budget'] ) ? 0 : $this->projectEmployeeDetail['budget'];
|
||||
}
|
||||
|
||||
private function setEmployeeHours()
|
||||
{
|
||||
$this->employeeHours =
|
||||
$this->projectEmployeeDetail ? $this->projectEmployeeDetail->hours : 0;
|
||||
}
|
||||
|
||||
private function setEmployeeDetails()
|
||||
{
|
||||
$this->projects[ $this->index ]['employees'][] = [
|
||||
'id' => $this->uniqueEmployee->id,
|
||||
'fullname' => $this->uniqueEmployee->fullname,
|
||||
'hours' => $this->employeeHours,
|
||||
'revenues' => $this->projectEmployeeDetail ? $this->projectEmployeeDetail->revenues : 0,
|
||||
'budget' => $this->employeeBudget,
|
||||
'availableHours' => $this->employeeBudget - $this->employeeHours
|
||||
];
|
||||
}
|
||||
|
||||
private function setProjectTotals()
|
||||
{
|
||||
if ( ! isset( $this->projects[ $this->index ]['projectHours'] ) )
|
||||
$this->projects[ $this->index ]['projectHours'] = 0;
|
||||
if ( ! isset( $this->projects[ $this->index ]['projectEuros'] ) )
|
||||
$this->projects[ $this->index ]['projectEuros'] = 0;
|
||||
if ( ! isset( $this->projects[ $this->index ]['hoursAvailable'] ) )
|
||||
$this->projects[ $this->index ]['hoursAvailable'] = 0;
|
||||
|
||||
$this->projects[ $this->index ]['projectHours'] +=
|
||||
$this->projectEmployeeDetail ? $this->projectEmployeeDetail->hours : 0;
|
||||
$this->projects[ $this->index ]['projectEuros'] +=
|
||||
$this->projectEmployeeDetail ? $this->projectEmployeeDetail->revenues : 0;
|
||||
$this->projects[ $this->index ]['hoursAvailable'] +=
|
||||
$this->employeeBudget - $this->employeeHours;
|
||||
}
|
||||
|
||||
private function setBudget()
|
||||
{
|
||||
$this->projects[ $this->index ]['budget'] =
|
||||
round( ( $this->projects[ $this->index ]['own_revenue'] + $this->projects[ $this->index ]['other_revenue'] ), 0 );
|
||||
}
|
||||
|
||||
private function setProjectCosts()
|
||||
{
|
||||
$this->projects[ $this->index ]['projectcosts'] =
|
||||
Projectcost::getCostsPerPerProject( $this->projects[ $this->index ]['id'] );
|
||||
}
|
||||
|
||||
private function setBudgetAvailable()
|
||||
{
|
||||
$this->projects[ $this->index ]['budgetAvailable'] =
|
||||
$this->projects[ $this->index ]['budget'] - $this->projects[ $this->index ]['projectcosts'];
|
||||
}
|
||||
|
||||
private function setSaldo()
|
||||
{
|
||||
$this->projects[ $this->index ]['saldo'] =
|
||||
$this->projects[ $this->index ]['budgetAvailable'] - $this->projects[ $this->index ]['projectEuros'];
|
||||
}
|
||||
|
||||
private function setInvoiced()
|
||||
{
|
||||
$invoiced =
|
||||
$this->ci->Invoices_model->getInvoicedPerYearPerProject( $this->projects[ $this->index ]['id'] );
|
||||
|
||||
foreach ( $invoiced ? $invoiced : [] as $invoice )
|
||||
{
|
||||
$this->projects[ $this->index ]['invoiced'][] = [
|
||||
'year' => $invoice->invoiceyear,
|
||||
'invoiced' => $invoice->invoiced
|
||||
];
|
||||
|
||||
$this->setTotalInvoiced( $invoice->invoiced );
|
||||
}
|
||||
|
||||
if ( ! isset( $this->projects[ $this->index ]['invoiced'] ) )
|
||||
{
|
||||
$this->projects[ $this->index ]['invoiced'] = [];
|
||||
$this->projects[ $this->index ]['totalInvoiced'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private function setTotalInvoiced( $invoiced )
|
||||
{
|
||||
if ( ! isset( $this->projects[ $this->index ]['totalInvoiced'] ) )
|
||||
$this->projects[ $this->index ]['totalInvoiced'] = 0;
|
||||
|
||||
$this->projects[ $this->index ]['totalInvoiced'] += $invoiced;
|
||||
}
|
||||
|
||||
private function setWorkInProgress()
|
||||
{
|
||||
$this->projects[ $this->index ]['workInProgress'] =
|
||||
$this->projects[ $this->index ]['projectEuros'] +
|
||||
$this->projects[ $this->index ]['projectcosts'] -
|
||||
$this->projects[ $this->index ]['totalInvoiced'];
|
||||
|
||||
if( $this->projects[ $this->index ]['workInProgress'] < 0 )
|
||||
$this->projects[ $this->index ]['workInProgress'] = 0;
|
||||
}
|
||||
|
||||
private function setInvoicedYears()
|
||||
{
|
||||
foreach ( $this->projects as $this->project )
|
||||
{
|
||||
foreach ( $this->project['invoiced'] as $year )
|
||||
{
|
||||
if ( in_array( $year['year'], $this->invoicedYears ) ) continue;
|
||||
|
||||
array_push( $this->invoicedYears, $year['year'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function loopProjectsForInvoicedYears()
|
||||
{
|
||||
$this->index = 0;
|
||||
|
||||
foreach ( $this->projects as $this->project )
|
||||
{
|
||||
foreach ( $this->invoicedYears as $invoiceYear )
|
||||
{
|
||||
$hasYear = FALSE;
|
||||
foreach ( $this->project['invoiced'] as $year )
|
||||
{
|
||||
if ( $invoiceYear == $year['year'] ) $hasYear = TRUE;
|
||||
}
|
||||
|
||||
if ( ! $hasYear ) $this->projects[ $this->index ]['invoiced'][] = [
|
||||
'year' => $invoiceYear,
|
||||
'invoiced' => 0
|
||||
];
|
||||
}
|
||||
usort( $this->projects[ $this->index ]['invoiced'], function ( $a, $b ) {
|
||||
return $a['year'] - $b['year'];
|
||||
} );
|
||||
$this->index ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
<?php defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: imac-3
|
||||
* Date: 04/06/16
|
||||
* Time: 14:17
|
||||
*/
|
||||
class validation {
|
||||
|
||||
private $fieldValue;
|
||||
private $validations;
|
||||
private $validation;
|
||||
private $validationResult;
|
||||
private $errorMessages = [];
|
||||
private $validationField;
|
||||
private $ci;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->ci =& get_instance();
|
||||
}
|
||||
|
||||
public function validate( $fieldValue, $validationField = FALSE )
|
||||
{
|
||||
$this->setValidationField( $validationField );
|
||||
|
||||
$this->setFieldValue( $fieldValue );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function setValidationField( $validationfield )
|
||||
{
|
||||
$this->validationField = $validationfield;
|
||||
}
|
||||
|
||||
public function getErrorMessages()
|
||||
{
|
||||
return $this->errorMessages;
|
||||
}
|
||||
|
||||
public function getValidationResult()
|
||||
{
|
||||
return $this->validationResult;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->setValidations();
|
||||
|
||||
$this->checkValidations();
|
||||
|
||||
$this->setValidationResult();
|
||||
}
|
||||
|
||||
private function setValidations()
|
||||
{
|
||||
$this->validations = explode( '|', $this->validationField['validations'] );
|
||||
}
|
||||
|
||||
private function setFieldValue( $fieldValue )
|
||||
{
|
||||
$this->fieldValue = $fieldValue;
|
||||
}
|
||||
|
||||
private function setValidationResult()
|
||||
{
|
||||
if ( count( $this->errorMessages ) == 0 ) return $this->validationResult = TRUE;
|
||||
|
||||
$this->validationResult = FALSE;
|
||||
}
|
||||
|
||||
private function checkValidations()
|
||||
{
|
||||
foreach ( $this->validations as $this->validation )
|
||||
{
|
||||
if ( $this->validation == 'required' ) $this->checkRequired();
|
||||
if ( $this->validation == 'alpha' ) $this->checkAlfa();
|
||||
if ( $this->validation == 'alphaNumeric' ) $this->checkAlfanumeric();
|
||||
if ( $this->validation == 'alphaNumericSpaces' ) $this->checkAlphaNumericSpaces();
|
||||
if ( $this->validation == 'alphaDash' ) $this->checkAlphaDash();
|
||||
if ( $this->validation == 'numeric' ) $this->checkNumeric();
|
||||
if ( $this->validation == 'integer' ) $this->checkInteger();
|
||||
if ( $this->validation == 'decimal' ) $this->checkDecimal();
|
||||
if ( $this->validation == 'email' ) $this->checkEmail();
|
||||
if ( $this->validation == 'unique' ) $this->checkUnique();
|
||||
if( $this->validation == 'date' ) $this->checkdate();
|
||||
if ( substr( $this->validation, 0, 9 ) == 'minlength' ) $this->checkMinlength();
|
||||
if ( substr( $this->validation, 0, 9 ) == 'maxlength' ) $this->checkMaxlength();
|
||||
if ( substr( $this->validation, 0, 8 ) == 'minvalue' ) $this->checkMinvalue();
|
||||
if ( substr( $this->validation, 0, 8 ) == 'maxvalue' ) $this->checkMaxvalue();
|
||||
}
|
||||
}
|
||||
|
||||
public function checkRequired()
|
||||
{
|
||||
if ( ! $this->fieldValue || empty( $this->fieldValue ) || strlen( $this->fieldValue ) == 0 )
|
||||
$this->errorMessages[] = 'veld is verplicht';
|
||||
}
|
||||
|
||||
public function checkAlfa()
|
||||
{
|
||||
$value = ctype_alpha( $this->fieldValue );
|
||||
|
||||
if ( ! $value ) $this->errorMessages[] = 'alleen letters toegestaan';
|
||||
}
|
||||
|
||||
public function checkAlfaNumeric()
|
||||
{
|
||||
$value = ctype_alnum( (string) $this->fieldValue );
|
||||
|
||||
if ( ! $value ) $this->errorMessages[] = 'alleen letters en cijfers toegestaan';
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function checkAlphaNumericSpaces()
|
||||
{
|
||||
$value = (bool) preg_match( '/^[A-Z0-9 ]+$/i', $this->fieldValue );
|
||||
|
||||
if ( ! $value ) $this->errorMessages[] = 'alleen letters, cijfers en spaties toegestaan';
|
||||
}
|
||||
|
||||
public function checkAlphaDash()
|
||||
{
|
||||
$value = (bool) preg_match( '/^[a-z0-9_-]+$/i', $this->fieldValue );
|
||||
|
||||
if ( ! $value ) $this->errorMessages[] = 'alleen letters, cijfers en streepjes toegestaan';
|
||||
}
|
||||
|
||||
public function checkNumeric()
|
||||
{
|
||||
$value = (bool) preg_match( '/^[\-+]?[0-9]*\.?[0-9]+$/', $this->fieldValue );
|
||||
|
||||
if ( ! $value ) $this->errorMessages[] = 'alleen getallen toegestaan';
|
||||
}
|
||||
|
||||
public function checkInteger()
|
||||
{
|
||||
$value = (bool) preg_match( '/^[\-+]?[0-9]+$/', $this->fieldValue );
|
||||
|
||||
if ( ! $value ) $this->errorMessages[] = 'alleen gehele getallen toegestaan';
|
||||
}
|
||||
|
||||
public function checkDecimal()
|
||||
{
|
||||
$value = is_numeric( $this->fieldValue );
|
||||
|
||||
if ( ! $value ) $this->errorMessages[] = 'alleen getallen toegestaan';
|
||||
}
|
||||
|
||||
public function checkEmail()
|
||||
{
|
||||
if ( ! $this->fieldValue || empty( $this->fieldValue ) || strlen( $this->fieldValue ) == 0 ) return;
|
||||
|
||||
$value = (bool) filter_var( $this->fieldValue, FILTER_VALIDATE_EMAIL );
|
||||
|
||||
if ( ! $value ) $this->errorMessages[] = 'ongeldig emailadres';
|
||||
}
|
||||
|
||||
public function checkUnique()
|
||||
{
|
||||
$recordID = $this->ci->input->post( 'id' );
|
||||
|
||||
$model = $this->validationField['model'];
|
||||
$field = $this->validationField['field'];
|
||||
|
||||
$value = $this->ci
|
||||
->$model
|
||||
->checkUnique( $recordID, $field, $this->fieldValue );
|
||||
|
||||
if ( ! $value ) $this->errorMessages[] = 'invoer moet uniek zijn';
|
||||
}
|
||||
|
||||
public function checkDate()
|
||||
{
|
||||
if( empty($this->fieldValue) ) return;
|
||||
|
||||
$dateParts = explode('-', $this->fieldValue);
|
||||
|
||||
if( count($dateParts) != 3) $dateParts = explode('/', $this->fieldValue);
|
||||
|
||||
if( count($dateParts) != 3)
|
||||
return $this->errorMessages[] = 'invoer is geen datum';
|
||||
|
||||
if( ! checkdate($dateParts[1], $dateParts[0], $dateParts[2] ))
|
||||
$this->errorMessages[] = 'invoer is geen datum';
|
||||
}
|
||||
|
||||
private function checkMinlength()
|
||||
{
|
||||
$length = explode( '-', $this->validation );
|
||||
|
||||
if ( strlen( $this->fieldValue ) < $length[1] )
|
||||
$this->errorMessages[] = 'moet minimaal uit ' . $length[1] . ' karakters bestaan';
|
||||
}
|
||||
|
||||
private function checkMaxlength()
|
||||
{
|
||||
$length = explode( $this->validation, '-' );
|
||||
|
||||
if ( strlen( $this->fieldValue ) > $length[1] )
|
||||
$this->errorMessages[] = 'mag maximaal uit ' . $length[1] . ' karakters bestaan';
|
||||
}
|
||||
|
||||
private function checkMinValue()
|
||||
{
|
||||
$value = explode( $this->validation, '-' );
|
||||
|
||||
if( $this->fieldValue < $value[1])
|
||||
$this->errorMessages[] = 'moet minimaal ' . $value[1] . ' zijn';
|
||||
}
|
||||
|
||||
private function checkMaxValue()
|
||||
{
|
||||
$value = explode( $this->validation, '-' );
|
||||
|
||||
if( $this->fieldValue > $value[1])
|
||||
$this->errorMessages[] = 'mag maximaal ' . $value[1] . ' zijn';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php if ( ! defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: imac-3
|
||||
* Date: 26/06/16
|
||||
* Time: 21:17
|
||||
*/
|
||||
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/Validation.php' );
|
||||
|
||||
|
||||
class BaseValidation {
|
||||
|
||||
protected $validationField;
|
||||
protected $key;
|
||||
protected $fieldValue;
|
||||
protected $errorMessages = [];
|
||||
protected $validation;
|
||||
protected $fieldname;
|
||||
protected $ci;
|
||||
protected $validationResult;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->ci =& get_instance();
|
||||
|
||||
$this->validateInput();
|
||||
}
|
||||
|
||||
public function getValidationResult()
|
||||
{
|
||||
return $this->validationResult;
|
||||
}
|
||||
|
||||
public function validateInput()
|
||||
{
|
||||
$this->loopFields();
|
||||
}
|
||||
|
||||
public function getErrorMessages( )
|
||||
{
|
||||
return $this->errorMessages;
|
||||
}
|
||||
|
||||
private function loopFields()
|
||||
{
|
||||
foreach ( $this->validationFields as $this->key => $this->validationField )
|
||||
{
|
||||
$this->validation = new Validation();
|
||||
|
||||
$this->setInputfield();
|
||||
|
||||
$this->validateFieldvalue();
|
||||
|
||||
$this->setFieldname();
|
||||
|
||||
$this->setValidationResult();
|
||||
|
||||
$this->setErrorMesagges();
|
||||
}
|
||||
}
|
||||
|
||||
private function setInputfield()
|
||||
{
|
||||
$this->fieldValue = $this->ci->input->post( $this->key );
|
||||
}
|
||||
|
||||
private function validateFieldvalue()
|
||||
{
|
||||
$this->validation->validate( $this->fieldValue, $this->validationField );
|
||||
}
|
||||
|
||||
private function setFieldname()
|
||||
{
|
||||
$this->fieldname = $this->validationField['fieldname'];
|
||||
}
|
||||
|
||||
private function setErrorMesagges()
|
||||
{
|
||||
$this->errorMessages[ $this->fieldname ] = $this->validation->getErrorMessages();
|
||||
}
|
||||
|
||||
private function setValidationResult()
|
||||
{
|
||||
if( $this->validationResult === FALSE ) return;
|
||||
|
||||
$this->validationResult = $this->validation->getValidationResult();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class CustomerValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'name' => [
|
||||
'validations' => 'required|alphaNumericSpaces',
|
||||
'fieldname' => 'name'
|
||||
],
|
||||
'email' => [
|
||||
'validations' => 'email',
|
||||
'fieldname' => 'email'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->ci =& get_instance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class ExternalValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'contactperson' => [
|
||||
'validations' => 'required|alphaNumericSpaces',
|
||||
'fieldname' => 'contact'
|
||||
],
|
||||
'email' => [
|
||||
'validations' => 'email',
|
||||
'fieldname' => 'email'
|
||||
],
|
||||
'rate' => [
|
||||
'validations' => 'numeric',
|
||||
'fieldname' => 'tarief'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->ci =& get_instance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class InvoiceValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'project_id' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'project'
|
||||
],
|
||||
'invoicedate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'factuurdatum'
|
||||
],
|
||||
'forecastdate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'prognosedatum'
|
||||
],
|
||||
'invoiceamount' => [
|
||||
'validations' => 'number',
|
||||
'fieldname' => 'factuurbedrag'
|
||||
],
|
||||
'forecastamount' => [
|
||||
'validations' => 'number',
|
||||
'fieldname' => 'prognosebedrag'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->ci =& get_instance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php if ( ! defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: imac-3
|
||||
* Date: 26/06/16
|
||||
* Time: 21:13
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class LoginValidation extends BaseValidation {
|
||||
|
||||
protected $validationFields = [
|
||||
'username' => [
|
||||
'validations' => 'required|alphaNumericSpaces',
|
||||
'fieldname' => 'gebruikersnaam'
|
||||
],
|
||||
'password' => [
|
||||
'validations' => 'required',
|
||||
'fieldname' => 'wachtwoord'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class OfferValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'customer_id' => [
|
||||
'validations' => 'required|numeric',
|
||||
'fieldname' => 'klant'
|
||||
],
|
||||
'startdate' => [
|
||||
'validations' => 'required|date',
|
||||
'fieldname' => 'offertedatum'
|
||||
],
|
||||
'acceptdate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'acceptatiedatum'
|
||||
],
|
||||
'rejectdate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'afwijsdatum'
|
||||
],
|
||||
'acceptance_chance' => [
|
||||
'validations' => 'numeric',
|
||||
'fieldname' => 'afwijsdatum|minvalue-0|maxvalue-100'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->ci =& get_instance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php if ( ! defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
|
||||
|
||||
/**
|
||||
* Created by Pensare Software
|
||||
* User: Theo Weijmer
|
||||
* Date: 26/06/16
|
||||
* Time: 20:39
|
||||
*/
|
||||
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class OrganisationValidation extends BaseValidation {
|
||||
|
||||
protected $validationFields = [
|
||||
'brin' => [
|
||||
'validations' => 'required|alphaNumeric',
|
||||
'fieldname' => 'brinnummer'
|
||||
],
|
||||
'naam' => [
|
||||
'validations' => 'required',
|
||||
'fieldname' => 'Organisatienaam'
|
||||
],
|
||||
'naamkort' => [
|
||||
'validations' => 'required',
|
||||
'fieldname' => 'Organisatienaam (kort)'
|
||||
],
|
||||
'vestiging' => [
|
||||
'validations' => 'required|alphaNumeric|unique',
|
||||
'fieldname' => 'vestigingsnummer',
|
||||
'model' => 'organisations_model',
|
||||
'field' => 'vestiging'
|
||||
],
|
||||
'email' => [
|
||||
'validations' => 'email',
|
||||
'fieldname' => 'email'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->ci =& get_instance();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: imac-3
|
||||
* Date: 26/06/16
|
||||
* Time: 21:13
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class PasswordRequestValidation extends BaseValidation {
|
||||
|
||||
protected $validationFields = [
|
||||
'username' => [
|
||||
'validations' => 'required|alphaNumericSpaces',
|
||||
'fieldname' => 'gebruikersnaam'
|
||||
],
|
||||
'email' => [
|
||||
'validations' => 'required|email',
|
||||
'fieldname' => 'email'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class PaymentValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'invoice_id' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'factuur'
|
||||
],
|
||||
'paymentdate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'betaaldatum'
|
||||
],
|
||||
'paymentamount' => [
|
||||
'validations' => 'number',
|
||||
'fieldname' => 'bedrag'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->ci =& get_instance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class ProjectValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'customer_id' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'klant'
|
||||
],
|
||||
'startdate' => [
|
||||
'validations' => 'required|date',
|
||||
'fieldname' => 'start project'
|
||||
],
|
||||
'enddate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'eind project'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->ci =& get_instance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class ProjectcostValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'project_id' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'project'
|
||||
],
|
||||
'external_id' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'externe'
|
||||
],
|
||||
'date' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'datum'
|
||||
],
|
||||
'costs' => [
|
||||
'validations' => 'number',
|
||||
'fieldname' => 'kosten'
|
||||
],
|
||||
'payed' => [
|
||||
'validations' => 'number',
|
||||
'fieldname' => 'betaald'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->ci =& get_instance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class ProjectemployeeValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'user_id' => [
|
||||
'validations' => 'integer',
|
||||
'fieldname' => 'klant'
|
||||
],
|
||||
'startdate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'start project'
|
||||
],
|
||||
'enddate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'eind project'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->ci =& get_instance();
|
||||
|
||||
$this->handleSpecificValidations();
|
||||
}
|
||||
|
||||
protected function handleSpecificValidations()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class ProjecthourValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'projectemployee_id' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'projectmedewerker'
|
||||
],
|
||||
'hourdate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'datum'
|
||||
],
|
||||
'hours' => [
|
||||
'validations' => 'number',
|
||||
'fieldname' => 'uren'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->ci =& get_instance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class UserValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'firstname' => [
|
||||
'validations' => 'required|alphaNumericSpaces',
|
||||
'fieldname' => 'firstname'
|
||||
],
|
||||
'lastname' => [
|
||||
'validations' => 'required|alphaNumericSpaces',
|
||||
'fieldname' => 'lastname'
|
||||
],
|
||||
'email' => [
|
||||
'validations' => 'required|email|unique',
|
||||
'fieldname' => 'email',
|
||||
'model' => 'User_model',
|
||||
'field' => 'email'
|
||||
],
|
||||
'username' => [
|
||||
'validations' => 'required|alphanumeric|minlength-4|unique',
|
||||
'fieldname' => 'username',
|
||||
'model' => 'User_model',
|
||||
'field' => 'username'
|
||||
],
|
||||
'hourlyrate' =>[
|
||||
'validations' => 'decimal',
|
||||
'fieldname' => 'uurtarief'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->ci =& get_instance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 15/12/2017
|
||||
* Time: 19:37
|
||||
*/
|
||||
|
||||
class Customer_model extends MY_Model {
|
||||
|
||||
protected $tablename = "customers";
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 15/12/2017
|
||||
* Time: 19:37
|
||||
*/
|
||||
|
||||
class External_model extends MY_Model {
|
||||
|
||||
protected $tablename = "externals";
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 15/12/2017
|
||||
* Time: 19:37
|
||||
*/
|
||||
|
||||
class User extends MY_Model {
|
||||
|
||||
protected $tablename = "users";
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getUserByUsername( $username )
|
||||
{
|
||||
$user = $this->get( [
|
||||
'UCASE(username)' => strtoupper( $username )], FALSE, TRUE);
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 15/12/2017
|
||||
* Time: 19:37
|
||||
*/
|
||||
|
||||
class User_model extends MY_Model {
|
||||
|
||||
protected $tablename = "users";
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getUserByUsername( $username )
|
||||
{
|
||||
$user = $this->get( [
|
||||
'UCASE(username)' => strtoupper( $username )], FALSE, TRUE);
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function checkUnique($recordID, $field, $fieldValue)
|
||||
{
|
||||
$this->sql = "
|
||||
SELECT *
|
||||
FROM users
|
||||
WHERE ucase( {$field} ) = '".strtoupper($fieldValue)."'
|
||||
AND id != {$recordID} ";
|
||||
|
||||
$result = $this->get_query_row();
|
||||
|
||||
if( ! $result ) return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 25/12/2017
|
||||
* Time: 10:20
|
||||
*/
|
||||
|
||||
use \Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
|
||||
class BaseModel extends Eloquent {
|
||||
|
||||
|
||||
/**
|
||||
* The name of the "created at" column.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const CREATED_AT = 'created_by';
|
||||
|
||||
/**
|
||||
* The name of the "updated at" column.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const UPDATED_AT = 'last_update_date';
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
protected $hidden = ['creation_date', 'last_update_date', 'created_by', 'updated_by', 'password', 'salt'];
|
||||
|
||||
protected static $oldValue;
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating( function ( $model ) {
|
||||
static::$oldValue = '';
|
||||
|
||||
if ( AUTHENTICATED )
|
||||
{
|
||||
$user = User::find(USERID);
|
||||
$model->created_by = $user->username;
|
||||
$model->updated_by = $user->username;
|
||||
}
|
||||
} );
|
||||
static::updating( function ( $model ) {
|
||||
static::$oldValue = json_encode($model->original);
|
||||
|
||||
if ( AUTHENTICATED )
|
||||
{
|
||||
$user = User::find(USERID);
|
||||
$model->updated_by = $user->username;
|
||||
}
|
||||
} );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/01/2018
|
||||
* Time: 14:22
|
||||
*/
|
||||
|
||||
class Comment extends BaseModel {
|
||||
|
||||
protected $table = "comments";
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo( 'User' );
|
||||
}
|
||||
|
||||
public static function getComments( $foreignID, $tablename )
|
||||
{
|
||||
$comments = Comment::orderBy( 'comment_date', 'desc' )
|
||||
->with( [
|
||||
'user' => function ( $q ) {
|
||||
$q->selectRaw( "CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname, id" );
|
||||
}] )
|
||||
->whereForeignId( $foreignID )
|
||||
->whereForeignTable( $tablename )
|
||||
->get();
|
||||
|
||||
foreach ( $comments as $comment )
|
||||
{
|
||||
$comment->comment = base64_decode( $comment->comment );
|
||||
}
|
||||
|
||||
return $comments;
|
||||
}
|
||||
|
||||
public static function addComment( $foreignID, $tablename )
|
||||
{
|
||||
$data = [
|
||||
'foreign_id' => $foreignID,
|
||||
'foreign_table' => $tablename,
|
||||
'user_id' => USERID,
|
||||
'comment_date' => date( 'Y-m-d H:i:s' )
|
||||
];
|
||||
|
||||
$comment = Comment::create( $data );
|
||||
|
||||
return $comment['id'];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* Customer: Theo Weijmer
|
||||
* Date: 21/12/2017
|
||||
* Time: 18:04
|
||||
*/
|
||||
|
||||
|
||||
class Customer extends BaseModel {
|
||||
|
||||
protected $table = "customers";
|
||||
|
||||
public static function getAllCustomers( $archive )
|
||||
{
|
||||
$customers = Customer::orderBy( 'name' );
|
||||
|
||||
if ( $archive == 'F' ) $customers = $customers->whereArchive( 'F' );
|
||||
|
||||
$customers = $customers->get();
|
||||
|
||||
return $customers;
|
||||
}
|
||||
|
||||
public static function saveCustomer( $customerID, $customer )
|
||||
{
|
||||
$customer = (array)$customer;
|
||||
|
||||
if( $customerID == 0)
|
||||
{
|
||||
$customer = Customer::create($customer);
|
||||
$customerID = $customer['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
Customer::whereId($customerID)->update($customer);
|
||||
}
|
||||
|
||||
return $customerID;
|
||||
}
|
||||
|
||||
public static function removeCustomer($customerID)
|
||||
{
|
||||
Customer::whereId($customerID)->delete();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/01/2018
|
||||
* Time: 20:02
|
||||
*/
|
||||
|
||||
class Document extends BaseModel {
|
||||
|
||||
protected $table = "documents";
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo( 'User' );
|
||||
}
|
||||
|
||||
public static function getDocuments( $foreignID, $tablename )
|
||||
{
|
||||
$documents = Document::orderBy( 'uploaddate', 'desc' )
|
||||
->with( [
|
||||
'user' => function ( $q ) {
|
||||
$q->selectRaw( "CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname, id" );
|
||||
}] )
|
||||
->whereForeignId( $foreignID )
|
||||
->whereForeignTable( $tablename )
|
||||
->get();
|
||||
|
||||
return $documents;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* External: Theo Weijmer
|
||||
* Date: 21/12/2017
|
||||
* Time: 18:04
|
||||
*/
|
||||
|
||||
|
||||
class External extends BaseModel {
|
||||
|
||||
protected $table = "externals";
|
||||
|
||||
public static function getAllExternals( $archive )
|
||||
{
|
||||
$externals = External::orderBy( 'name' );
|
||||
|
||||
if ( $archive == 'F' ) $externals = $externals->whereArchive( 'F' );
|
||||
|
||||
$externals = $externals->get();
|
||||
|
||||
return $externals;
|
||||
}
|
||||
|
||||
public static function saveExternal( $externalID, $external )
|
||||
{
|
||||
$external = (array)$external;
|
||||
|
||||
if( $externalID == 0)
|
||||
{
|
||||
$external = External::create($external);
|
||||
$externalID = $external['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
External::whereId($externalID)->update($external);
|
||||
}
|
||||
|
||||
return $externalID;
|
||||
}
|
||||
|
||||
public static function removeExternal($externalID)
|
||||
{
|
||||
External::whereId($externalID)->delete();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 23/01/2018
|
||||
* Time: 15:58
|
||||
*/
|
||||
|
||||
|
||||
class Invoice extends BaseModel {
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo( 'Project' );
|
||||
}
|
||||
|
||||
public function payments()
|
||||
{
|
||||
return $this->hasMany( 'Payment' );
|
||||
}
|
||||
|
||||
public function vat()
|
||||
{
|
||||
return $this->belongsTo( 'Vat' );
|
||||
}
|
||||
|
||||
public static function saveInvoice( $invoiceID, $invoice )
|
||||
{
|
||||
$invoice = (array) $invoice;
|
||||
|
||||
if ( $invoiceID == 0 )
|
||||
{
|
||||
$invoice = Invoice::create( $invoice );
|
||||
$invoiceID = $invoice['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
Invoice::whereId( $invoiceID )->update( $invoice );
|
||||
}
|
||||
|
||||
return $invoiceID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 21/12/2017
|
||||
* Time: 18:05
|
||||
*/
|
||||
|
||||
|
||||
class Offer extends BaseModel {
|
||||
|
||||
protected $table = "offers";
|
||||
|
||||
public function payments()
|
||||
{
|
||||
return $this->hasMany( 'Payment' );
|
||||
}
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo( 'Project' );
|
||||
}
|
||||
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo( 'Customer' );
|
||||
}
|
||||
|
||||
public static function getAllOffers( $projectID, $archive = 'F' )
|
||||
{
|
||||
$offers = Offer::orderBy( 'startdate' )
|
||||
->with( 'customer' )
|
||||
->with( 'project' );
|
||||
|
||||
if ( $projectID ) $offers = $offers->whereProjectId( $projectID );
|
||||
|
||||
if ( $archive == 'F' ) $offers = $offers->whereArchive( 'F' );
|
||||
|
||||
$offers = $offers->get();
|
||||
|
||||
return $offers;
|
||||
}
|
||||
|
||||
public static function saveOffer( $offerID, $offer )
|
||||
{
|
||||
$offer = (array) $offer;
|
||||
|
||||
$offer['startdate'] = date2mysql( $offer['startdate'] );
|
||||
$offer['accepteddate'] = date2mysql( $offer['accepteddate'] );
|
||||
$offer['rejectdate'] = date2mysql( $offer['rejectdate'] );
|
||||
|
||||
if ( $offerID == 0 )
|
||||
{
|
||||
$offer = Offer::create( $offer );
|
||||
|
||||
$offerID = $offer['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
Offer::whereId( $offerID )->update( $offer );
|
||||
}
|
||||
|
||||
return $offerID;
|
||||
}
|
||||
|
||||
public static function removeOffer( $offerID )
|
||||
{
|
||||
Offer::whereId( $offerID )->delete();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 21/12/2017
|
||||
* Time: 18:05
|
||||
*/
|
||||
|
||||
use \Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
|
||||
class Page extends Eloquent {
|
||||
|
||||
protected $table = "pages";
|
||||
|
||||
public function subpages()
|
||||
{
|
||||
return $this->hasMany( 'Page' );
|
||||
}
|
||||
|
||||
|
||||
public static function getPages( $user )
|
||||
{
|
||||
$pages = Page::whereRaw( 'id = page_id' )
|
||||
->with( [
|
||||
'subpages' => function ( $q ) use ( $user ) {
|
||||
$q->whereRaw(
|
||||
"id != page_id AND ((SELECT {$user->role} & pagelevel) != 0 OR pagelevel = 0)" )
|
||||
->orderBy( 'pageorder' );
|
||||
}] )
|
||||
->orderBy( 'pageorder' )
|
||||
->get();
|
||||
|
||||
return $pages;
|
||||
}
|
||||
|
||||
public static function getAppPages( $user )
|
||||
{
|
||||
$appPages = Page::select( 'id', 'pageurl' )
|
||||
->whereAppPage( 'T' )
|
||||
->whereRaw(
|
||||
"((SELECT {$user->role} & pagelevel) != 0 OR pagelevel = 0)" )
|
||||
->get();
|
||||
|
||||
return $appPages;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 16/01/2018
|
||||
* Time: 10:27
|
||||
*/
|
||||
|
||||
class Payment extends BaseModel {
|
||||
|
||||
protected $table = "payments";
|
||||
|
||||
public function invoice()
|
||||
{
|
||||
return $this->belongsTo( 'Invoice' );
|
||||
}
|
||||
|
||||
public static function savePayment( $paymentID, $payment )
|
||||
{
|
||||
$payment = (array) $payment;
|
||||
|
||||
if ( $paymentID == 0 )
|
||||
{
|
||||
$payment = Payment::create( $payment );
|
||||
$paymentID = $payment['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
Payment::whereId( $paymentID )->update( $payment );
|
||||
}
|
||||
|
||||
return $paymentID;
|
||||
}
|
||||
|
||||
public static function removePayment( $paymentID )
|
||||
{
|
||||
Payment::whereId( $paymentID )->delete();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 21/12/2017
|
||||
* Time: 18:05
|
||||
*/
|
||||
|
||||
|
||||
class Project extends BaseModel {
|
||||
|
||||
protected $table = "projects";
|
||||
|
||||
public function offers()
|
||||
{
|
||||
return $this->hasMany( 'Offer' );
|
||||
}
|
||||
|
||||
public function projectemployees()
|
||||
{
|
||||
return $this->hasMany( 'Projectemployee' );
|
||||
}
|
||||
|
||||
public function projectcosts()
|
||||
{
|
||||
return $this->hasMany( 'Projectcost' );
|
||||
}
|
||||
|
||||
public function invoices()
|
||||
{
|
||||
return $this->hasMany( 'Invoice' );
|
||||
}
|
||||
|
||||
public function projectleader()
|
||||
{
|
||||
return $this->belongsTo( 'User', 'projectleader_id' );
|
||||
}
|
||||
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo( 'Customer' );
|
||||
}
|
||||
|
||||
public static function getAllProjects( $archive = 'F' )
|
||||
{
|
||||
$projects = Project::getBaseProject();
|
||||
|
||||
if ( $archive == 'F' ) $projects = $projects->whereArchive( 'F' );
|
||||
|
||||
$projects = $projects->get();
|
||||
|
||||
return $projects;
|
||||
}
|
||||
|
||||
public static function getProject( $projectID )
|
||||
{
|
||||
$project = Project::getBaseProject();
|
||||
|
||||
$project = $project->whereArchive( 'F' )
|
||||
->whereId( $projectID )
|
||||
->first();
|
||||
|
||||
return $project;
|
||||
}
|
||||
|
||||
public static function removeProject( $projectID )
|
||||
{
|
||||
Project::whereId( $projectID )->delete();
|
||||
}
|
||||
|
||||
public static function getActiveProjects()
|
||||
{
|
||||
$projects = Project::selectRaw( "projects.id, YEAR(projects.startdate) AS instroom, YEAR(projects.enddate) AS uitstroom, projectnumber,
|
||||
projectname, CUS.name, OFF.own_revenue, OFF.other_revenue" )
|
||||
->join( 'customers AS CUS', 'CUS.id', '=', 'projects.customer_id' )
|
||||
->join( 'offers AS OFF', 'OFF.project_id', '=', 'projects.id' )
|
||||
->groupBy( 'projects.id' )
|
||||
->groupBy( 'OFF.own_revenue' )
|
||||
->groupBy( 'OFF.other_revenue' )
|
||||
->get();
|
||||
|
||||
return $projects;
|
||||
}
|
||||
|
||||
public static function getBaseProject()
|
||||
{
|
||||
$project = Project::with( [
|
||||
'projectleader' => function ( $q ) {
|
||||
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
|
||||
}] )
|
||||
->with( [
|
||||
'offers' => function ( $q ) {
|
||||
$q->whereArchive( 'F' );
|
||||
}] )
|
||||
->with( [
|
||||
'projectemployees.user' => function ( $q ) {
|
||||
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
|
||||
}] )
|
||||
->with( 'projectemployees.projecthours' )
|
||||
->with( 'projectcosts.external' )
|
||||
->with( 'invoices.payments' )
|
||||
->with( 'invoices.vat' )
|
||||
->with( 'customer' );
|
||||
|
||||
return $project;
|
||||
}
|
||||
|
||||
public static function createProject()
|
||||
{
|
||||
$data = ['startdate' => date( 'Y-m-d' )];
|
||||
|
||||
$project = Project::create( $data );
|
||||
|
||||
return $project->id;
|
||||
}
|
||||
|
||||
public static function saveProject( $projectID, $project )
|
||||
{
|
||||
$project = (array) $project;
|
||||
|
||||
if ( $projectID == 0 )
|
||||
{
|
||||
$project = Project::create( $project );
|
||||
$projectID = $project['id'];;
|
||||
}
|
||||
else
|
||||
{
|
||||
Project::whereId( $projectID )->update( $project );
|
||||
}
|
||||
|
||||
return $projectID;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 23/01/2018
|
||||
* Time: 11:37
|
||||
*/
|
||||
|
||||
class Projectcost extends BaseModel {
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo( 'Project' );
|
||||
}
|
||||
|
||||
public function external()
|
||||
{
|
||||
return $this->belongsTo( 'External' );
|
||||
}
|
||||
|
||||
public static function saveProjectcost( $projectID, $project )
|
||||
{
|
||||
$project = (array) $project;
|
||||
|
||||
if ( $projectID == 0 )
|
||||
{
|
||||
$project = Self::create( $project );
|
||||
$projectID = $project['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
Self::whereId( $projectID )->update( $project );
|
||||
}
|
||||
|
||||
return $projectID;
|
||||
}
|
||||
|
||||
public static function getCostsPerPerProject( $projectID )
|
||||
{
|
||||
$projectCosts = Projectcost::selectraw( 'ROUND(COALESCE(SUM(costs), 0), 0) AS costs')
|
||||
->whereProjectId($projectID)
|
||||
->first();
|
||||
|
||||
return $projectCosts->costs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 17/01/2018
|
||||
* Time: 10:25
|
||||
*/
|
||||
|
||||
class Projectemployee extends BaseModel {
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo( 'Project' );
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo( 'User' );
|
||||
}
|
||||
|
||||
public function projecthours()
|
||||
{
|
||||
return $this->hasMany( 'Projecthour' );
|
||||
}
|
||||
|
||||
public static function getAvailableEmployees( $projectID )
|
||||
{
|
||||
$currentEmployees = Self::whereProjectId( $projectID )
|
||||
->lists( 'user_id' );
|
||||
|
||||
$availableEmployees = User::selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" )
|
||||
->whereNotIn( 'id', $currentEmployees )
|
||||
->whereArchive( 'F' )
|
||||
->get();
|
||||
|
||||
return $availableEmployees;
|
||||
}
|
||||
|
||||
public static function getUniqueProjectEmployees()
|
||||
{
|
||||
$projectemployees = Projectemployee::selectRaw( "USR.id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" )
|
||||
->distinct()
|
||||
->join( 'users AS USR', 'USR.id', '=', 'projectemployees.user_id' )
|
||||
->get();
|
||||
|
||||
return $projectemployees;
|
||||
}
|
||||
|
||||
public static function getProjectemployeeDetailsPerProject( $projectID )
|
||||
{
|
||||
$details = Projectemployee::selectRaw( 'USR.id, budget, project_id, ROUND(SUM(hours), 0) AS hours, ROUND(SUM(hours * tarif), 0) AS revenues, projectemployees.id AS projectemployeeID' )
|
||||
->join( 'users AS USR', 'USR.id', '=', 'projectemployees.user_id' )
|
||||
->join( 'projecthours AS PRH', 'PRH.projectemployee_id', '=', 'projectemployees.id' )
|
||||
->where( 'projectemployees.project_id', '=', $projectID )
|
||||
->where( 'PRH.hourtype_id', '=', 1 )
|
||||
->groupBy( 'projectemployees.id' )
|
||||
->get();
|
||||
|
||||
return $details;
|
||||
}
|
||||
|
||||
public static function createProjectEmployee( $projectID )
|
||||
{
|
||||
$projectemployee = Projectemployee::create( [
|
||||
'project_id' => $projectID
|
||||
] );
|
||||
|
||||
return $projectemployee->id;
|
||||
}
|
||||
|
||||
public static function saveProjectemployee( $projectemployeeID, $projectemployee )
|
||||
{
|
||||
Projectemployee::whereId( $projectemployeeID )
|
||||
->update( $projectemployee );
|
||||
}
|
||||
|
||||
public static function removeProjectemployee( $projectemployeeID )
|
||||
{
|
||||
Projectemployee::whereId( $projectemployeeID )->delete();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 19/01/2018
|
||||
* Time: 15:51
|
||||
*/
|
||||
|
||||
class Projecthour extends BaseModel {
|
||||
|
||||
protected $table = "projecthours";
|
||||
|
||||
public function projectemployee()
|
||||
{
|
||||
$this->belongsTo( 'Projectemployee' );
|
||||
}
|
||||
|
||||
public static function getUsedYears()
|
||||
{
|
||||
$years = Projecthour::selectRaw( "YEAR(hourdate) AS year" )
|
||||
->distinct()
|
||||
->orderByRaw( 'YEAR( hourdate )' )
|
||||
->get();
|
||||
|
||||
return $years;
|
||||
}
|
||||
|
||||
public static function getMonthlyEmployeeHoursPerProject( $employeeID, $year )
|
||||
{
|
||||
$projectHours = ProjecthoursPerEmployeePerMonth::fire($employeeID, $year);
|
||||
|
||||
return $projectHours;
|
||||
}
|
||||
|
||||
public static function recapProjects()
|
||||
{
|
||||
$recaps = QRecapProjects::fire();
|
||||
|
||||
return $recaps;
|
||||
}
|
||||
|
||||
public static function saveProjecthour( $projecthourID, $projecthour )
|
||||
{
|
||||
$projecthour = (array) $projecthour;
|
||||
|
||||
if ( $projecthourID == 0 )
|
||||
{
|
||||
$projecthour = Projecthour::create( $projecthour );
|
||||
$projecthourID = $projecthour['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
Projecthour::whereId( $projecthourID )->update( $projecthour );
|
||||
}
|
||||
|
||||
return $projecthourID;
|
||||
}
|
||||
|
||||
public static function removeProjecthour( $projecthourID )
|
||||
{
|
||||
Projecthour::whereId( $projecthourID )->delete();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 25/12/2017
|
||||
* Time: 17:07
|
||||
*/
|
||||
|
||||
class Role extends BaseModel {
|
||||
|
||||
protected $table = "roles";
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne( 'User', 'role', 'rolelevel' );
|
||||
}
|
||||
|
||||
public static function getAllRoles( $archive )
|
||||
{
|
||||
$roleHierarchy = Role::getUserroleHierachy();
|
||||
|
||||
$roles = Role::orderBy( 'rolehierarchy' )
|
||||
->where( 'rolehierarchy', '>=', $roleHierarchy );
|
||||
|
||||
if ( $archive == 'F' ) $roles = $roles->whereArchive( 'F' );
|
||||
|
||||
$roles = $roles->get();
|
||||
|
||||
return $roles;
|
||||
}
|
||||
|
||||
public static function getUserroleHierachy()
|
||||
{
|
||||
$userrole = User::getUserRoleHierarchy();
|
||||
|
||||
if( $userrole == 0 ) return 0;
|
||||
|
||||
$roleHierarchy = Role::whereRolelevel($userrole)
|
||||
->first()
|
||||
->rolehierarchy;
|
||||
|
||||
return $roleHierarchy;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 21/12/2017
|
||||
* Time: 18:04
|
||||
*/
|
||||
|
||||
|
||||
class User extends BaseModel {
|
||||
|
||||
protected $table = "users";
|
||||
|
||||
public function projectemployees()
|
||||
{
|
||||
return $this->hasMany( 'Projectemployee' );
|
||||
}
|
||||
|
||||
public function projectemployee()
|
||||
{
|
||||
return $this->hasOne( 'Projectemployee' );
|
||||
}
|
||||
|
||||
public function role()
|
||||
{
|
||||
return $this->belongsTo( 'Role', 'level', 'rolelevel' );
|
||||
}
|
||||
|
||||
public static function getAllUsers( $archive )
|
||||
{
|
||||
$users = User::selectRaw( "*, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" )
|
||||
->orderBy( 'lastname' );
|
||||
|
||||
if ( $archive == 'F' ) $users = $users->whereArchive( 'F' );
|
||||
|
||||
$users = $users->get();
|
||||
|
||||
return $users;
|
||||
}
|
||||
|
||||
public static function getUserRoleHierarchy()
|
||||
{
|
||||
$userrole = User::find( USERID )->role;
|
||||
|
||||
return $userrole;
|
||||
}
|
||||
|
||||
public static function checkUsername( $username )
|
||||
{
|
||||
$username = strtoupper( $username );
|
||||
|
||||
$user = User::whereRaw( "UCASE(username) = {$username}" );
|
||||
|
||||
if ( $user->count() == 0 ) return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public static function saveUser( $userID, $user )
|
||||
{
|
||||
$user = (array) $user;
|
||||
|
||||
if ( $userID == 0 )
|
||||
{
|
||||
$user = User::create( $user );
|
||||
$userID = $user['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
User::whereId( $userID )->update( $user );
|
||||
}
|
||||
|
||||
return $userID;
|
||||
}
|
||||
|
||||
public static function removeUser( $userID )
|
||||
{
|
||||
User::whereId( $userID )->delete();
|
||||
}
|
||||
|
||||
public static function getUniqueProjectUsers()
|
||||
{
|
||||
//TODO: date range
|
||||
$projectusers = User::selectRaw( "
|
||||
users.id,
|
||||
CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname,
|
||||
SUBSTR(MD5(users.id), 1, 6) AS slug" )
|
||||
->join( 'projectemployees AS PEM', 'PEM.user_id', '=', 'users.id' )
|
||||
->with( [
|
||||
'projectemployee.project' => function ( $q ) {
|
||||
$q->selectRaw( "id, YEAR(startdate) AS instroom, COALESCE(YEAR(enddate), '') AS uitstroom" );
|
||||
}] )
|
||||
->distinct()
|
||||
->get();
|
||||
|
||||
return $projectusers;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 23/01/2018
|
||||
* Time: 19:37
|
||||
*/
|
||||
|
||||
class Vat extends BaseModel {
|
||||
|
||||
public function invoices()
|
||||
{
|
||||
return $this->hasMany( 'Invoice' );
|
||||
}
|
||||
|
||||
public static function getVats( $archive )
|
||||
{
|
||||
if ( $archive == 'F' )
|
||||
{
|
||||
$vats = vat::whereArchive( 'F' )->get();
|
||||
}
|
||||
else
|
||||
{
|
||||
$vats = Vat::get();
|
||||
}
|
||||
|
||||
return $vats;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 20/02/2018
|
||||
* Time: 09:36
|
||||
*/
|
||||
|
||||
class ProjecthoursPerEmployeePerMonth extends BaseModel {
|
||||
|
||||
public static function fire($employeeID, $year)
|
||||
{
|
||||
$projectHours = Projecthour::selectRaw( "
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-1', projecthours.hours, 0)) AS januari,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-2', projecthours.hours, 0)) AS februari,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-3', projecthours.hours, 0)) AS maart,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-4', projecthours.hours, 0)) AS april,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-5', projecthours.hours, 0)) AS mei,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-6', projecthours.hours, 0)) AS juni,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-7', projecthours.hours, 0)) AS juli,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-8', projecthours.hours, 0)) AS augustus,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-9', projecthours.hours, 0)) AS september,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-10', projecthours.hours, 0)) AS oktober,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-11', projecthours.hours, 0)) AS november,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-12', projecthours.hours, 0)) AS december,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-1', projecthours.hours * tarif, 0)) AS januariRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-2', projecthours.hours * tarif, 0)) AS februariRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-3', projecthours.hours * tarif, 0)) AS maartRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-4', projecthours.hours * tarif, 0)) AS aprilRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-5', projecthours.hours * tarif, 0)) AS meiRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-6', projecthours.hours * tarif, 0)) AS juniRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-7', projecthours.hours * tarif, 0)) AS juliRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-8', projecthours.hours * tarif, 0)) AS augustusRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-9', projecthours.hours * tarif, 0)) AS septemberRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-10', projecthours.hours * tarif, 0)) AS oktoberRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-11', projecthours.hours * tarif, 0)) AS novemberRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-12', projecthours.hours * tarif, 0)) AS decemberRevenue,
|
||||
SUM(IF(YEAR(hourdate) = {$year},projecthours.hours, 0)) AS totalyear,
|
||||
SUM(IF(YEAR(hourdate) != {$year},projecthours.hours, 0)) AS totalotheryears,
|
||||
SUM(IF(YEAR(hourdate) = {$year},projecthours.hours * tarif, 0)) AS totalyearRevenue,
|
||||
SUM(IF(YEAR(hourdate) != {$year},projecthours.hours * tarif, 0)) AS totalotheryearsRevenue,
|
||||
SUM(projecthours.hours) AS totalhours,
|
||||
SUM(projecthours.hours * tarif) AS totalhoursRevenue,
|
||||
PEM.tarif,
|
||||
PRJ.projectname" )
|
||||
->join( 'projectemployees AS PEM', 'PEM.id', '=', 'projecthours.projectemployee_id' )
|
||||
->join( 'projects AS PRJ', 'PRJ.id', '=', 'PEM.project_id' )
|
||||
->where( 'PEM.user_id', '=', $employeeID )
|
||||
->where( 'projecthours.hourtype_id', '=', 1)
|
||||
->groupBy('PRJ.id')
|
||||
->groupBy('PEM.tarif')
|
||||
->groupBy('PRJ.projectname')
|
||||
->get();
|
||||
|
||||
return $projectHours;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 01/03/2018
|
||||
* Time: 12:03
|
||||
*/
|
||||
|
||||
class QEmployeeHours {
|
||||
|
||||
public static function fire( $month, $year )
|
||||
{
|
||||
$sql = "
|
||||
SELECT monthID,
|
||||
user_id,
|
||||
CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname,
|
||||
SUM(projecthours) AS projecthours,
|
||||
SUM(profitablehours) AS profitablehours,
|
||||
SUM(nonprofitablehours) AS nonprofitablehours,
|
||||
SUM(revenues) AS revenues,
|
||||
SUM(nonprojecthours) AS nonprojecthours,
|
||||
SUM(projecthours + nonprojecthours) AS totalhours,
|
||||
targethours
|
||||
FROM (
|
||||
SELECT employee_id AS user_id,
|
||||
MONTH(hourdate) monthID,
|
||||
0 AS projecthours,
|
||||
0 AS profitablehours,
|
||||
0 AS nonprofitablehours,
|
||||
0 AS revenues,
|
||||
SUM(hours) AS nonprojecthours
|
||||
FROM employeehours
|
||||
WHERE YEAR(hourdate) = '{$year}' ";
|
||||
if( $month != 0 ) $sql .= "AND MONTH(hourdate) = '$month' ";
|
||||
$sql .= "
|
||||
GROUP BY employee_id, MONTH(hourdate)
|
||||
UNION
|
||||
SELECT PEM.user_id,
|
||||
MONTH(hourdate) monthID,
|
||||
SUM(hours) AS projecthours,
|
||||
SUM(IF(hourtype_id = 1, hours, 0)) AS profitablehours,
|
||||
SUM(IF(hourtype_id = 2, hours, 0)) AS nonprofitablehours,
|
||||
ROUND(SUM( IF(hourtype_id = 1, (hours * PEM.tarif), 0) ), 0) AS revenues,
|
||||
0 AS nonprojecthours
|
||||
FROM projecthours PH
|
||||
JOIN projectemployees PEM
|
||||
ON PEM.id = PH.projectemployee_id
|
||||
WHERE YEAR(hourdate) = '{$year}' ";
|
||||
if( $month != 0 ) $sql .= "AND MONTH(hourdate) = '$month' ";
|
||||
$sql .= "
|
||||
GROUP BY PEM.user_id, MONTH(hourdate)
|
||||
) AS Q1
|
||||
JOIN users AS USR
|
||||
ON USR.id = Q1.user_id
|
||||
GROUP BY user_id ";
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 20/02/2018
|
||||
* Time: 09:45
|
||||
*/
|
||||
|
||||
class QRecapProjects {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 02/03/2018
|
||||
* Time: 15:56
|
||||
*/
|
||||
|
||||
class Qinvoiceoverview {
|
||||
|
||||
|
||||
public static function fire( $year )
|
||||
{
|
||||
$sql = "
|
||||
SELECT PRJ.id, PRJ.projectnumber,
|
||||
PRJ.projectname,
|
||||
(own_revenue + other_revenue ) AS revenues,
|
||||
CUS.name AS customername,
|
||||
IF( YEAR(invoicedate) = {$year},SUM(invoiceamount), 0) AS currentyear,
|
||||
IF( YEAR(invoicedate) != {$year},SUM(invoiceamount), 0) AS otheryear,
|
||||
COALESCE(Q1.currentyearpayed, 0) AS currentyearpayed,
|
||||
COALESCE(Q1.otheryearpayed, 0) AS otheryearpayed,
|
||||
CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname
|
||||
FROM invoices INV
|
||||
RIGHT JOIN projects PRJ
|
||||
ON PRJ.id = INV.project_id
|
||||
JOIN offers OFF
|
||||
ON PRJ.id = OFF.project_id
|
||||
JOIN customers CUS
|
||||
ON CUS.id = PRJ.customer_id
|
||||
JOIN users USR
|
||||
ON USR.id = PRJ.projectleader_id
|
||||
LEFT JOIN (
|
||||
SELECT invoice_id,
|
||||
SUM(IF(YEAR(paymentdate) = {$year},paymentamount, 0)) AS currentyearpayed,
|
||||
SUM(IF(YEAR(paymentdate) != {$year},paymentamount, 0)) AS otheryearpayed
|
||||
FROM payments
|
||||
GROUP BY invoice_id
|
||||
) AS Q1
|
||||
ON INV.id = Q1.invoice_id
|
||||
GROUP BY PRJ.projectnumber, PRJ.projectname ";
|
||||
|
||||
return $sql;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 21/02/2018
|
||||
* Time: 10:34
|
||||
*/
|
||||
|
||||
class Invoices_model extends MY_Model {
|
||||
|
||||
protected $tablename = 'invoices';
|
||||
|
||||
public function getInvoicedPerYearPerProject( $projectID )
|
||||
{
|
||||
$this->sql = "
|
||||
SELECT ROUND(COALESCE(SUM(invoiceamount), 0),0) AS invoiced, YEAR(invoicedate) AS invoiceyear
|
||||
FROM invoices
|
||||
WHERE project_id = {$projectID}
|
||||
GROUP BY YEAR(invoicedate)
|
||||
ORDER BY YEAR(invoicedate) ";
|
||||
|
||||
$invoiced = $this->get_query_result();
|
||||
|
||||
return $invoiced;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 15/12/2017
|
||||
* Time: 19:37
|
||||
*/
|
||||
|
||||
class Offer_model extends MY_Model {
|
||||
|
||||
protected $tablename = "offers";
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,375 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width"/>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>wachtwoord DBOIS</title>
|
||||
<link href="styles.css" media="all" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<style>
|
||||
|
||||
/* -------------------------------------
|
||||
GLOBAL
|
||||
------------------------------------- */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
|
||||
box-sizing: border-box;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-webkit-text-size-adjust: none;
|
||||
width: 100% !important;
|
||||
height: 100%;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
/* Let's make sure all tables have defaults */
|
||||
table td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
BODY & CONTAINER
|
||||
------------------------------------- */
|
||||
body {
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
.body-wrap {
|
||||
background-color: #f6f6f6;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: block !important;
|
||||
max-width: 600px !important;
|
||||
margin: 0 auto !important;
|
||||
/* makes it centered */
|
||||
clear: both !important;
|
||||
}
|
||||
|
||||
.content {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
display: block;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
HEADER, FOOTER, MAIN
|
||||
------------------------------------- */
|
||||
.main {
|
||||
background: #fff;
|
||||
border: 1px solid #e9e9e9;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.content-wrap {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.content-block {
|
||||
padding: 0 0 20px;
|
||||
}
|
||||
|
||||
.header {
|
||||
width: 100%;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
width: 100%;
|
||||
clear: both;
|
||||
color: #999;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.footer a {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.footer p, .footer a, .footer unsubscribe, .footer td {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
GRID AND COLUMNS
|
||||
------------------------------------- */
|
||||
.column-left {
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.column-right {
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
TYPOGRAPHY
|
||||
------------------------------------- */
|
||||
h1, h2, h3 {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
||||
color: #000;
|
||||
margin: 40px 0 0;
|
||||
line-height: 1.2;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 32px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
p, ul, ol {
|
||||
margin-bottom: 10px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
p li, ul li, ol li {
|
||||
margin-left: 5px;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
LINKS & BUTTONS
|
||||
------------------------------------- */
|
||||
a {
|
||||
color: #348eda;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
text-decoration: none;
|
||||
color: #FFF;
|
||||
background-color: #348eda;
|
||||
border: solid #348eda;
|
||||
border-width: 10px 20px;
|
||||
line-height: 2;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
border-radius: 5px;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
OTHER STYLES THAT MIGHT BE USEFUL
|
||||
------------------------------------- */
|
||||
.last {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.first {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.padding {
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.aligncenter {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.alignright {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.alignleft {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
Alerts
|
||||
------------------------------------- */
|
||||
.alert {
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
border-radius: 3px 3px 0 0;
|
||||
}
|
||||
|
||||
.alert a {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.alert.alert-warning {
|
||||
background: #ff9f00;
|
||||
}
|
||||
|
||||
.alert.alert-bad {
|
||||
background: #d0021b;
|
||||
}
|
||||
|
||||
.alert.alert-good {
|
||||
background: #68b90f;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
INVOICE
|
||||
------------------------------------- */
|
||||
.invoice {
|
||||
margin: 40px auto;
|
||||
text-align: left;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.invoice td {
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
.invoice .invoice-items {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.invoice .invoice-items td {
|
||||
border-top: #eee 1px solid;
|
||||
}
|
||||
|
||||
.invoice .invoice-items .total td {
|
||||
border-top: 2px solid #333;
|
||||
border-bottom: 2px solid #333;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
RESPONSIVE AND MOBILE FRIENDLY STYLES
|
||||
------------------------------------- */
|
||||
@media only screen and (max-width: 640px) {
|
||||
h1, h2, h3, h4 {
|
||||
font-weight: 600 !important;
|
||||
margin: 20px 0 5px !important;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 22px !important;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 18px !important;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 16px !important;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.content, .content-wrapper {
|
||||
padding: 10px !important;
|
||||
}
|
||||
|
||||
.invoice {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<body>
|
||||
|
||||
<table class="body-wrap">
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="container" width="600">
|
||||
<div class="content">
|
||||
<table class="main" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="alert alert-warning">
|
||||
Wachtwoord De Beleidsonderzoeker IS
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="content-wrap">
|
||||
<table width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="content-block">
|
||||
Hieronder vindt u uw gebruikersnaam wachtwoord om in te loggen op het
|
||||
informatiesysteem van De Beleidsonderzoekers
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="content-block">
|
||||
<p>
|
||||
Beste <?= $user['firstname']?> <?=$user['middlename']?> <?=$user['lastname']?>
|
||||
</p>
|
||||
<p>
|
||||
Er is voor u een account aangemaakt is het informatiesysteem van de Beleidsonderzoekers, hieronder vindt u uw gebruikersnaam en wachtwoord waarmee u kun t inloggen in het systeem.
|
||||
</p>
|
||||
<br />
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="content-block">
|
||||
|
||||
<table class="invoice">
|
||||
<tr>
|
||||
<td>
|
||||
<table class="invoice-items" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td>gebruikersnaam</td>
|
||||
<td class="alignright"><?= $user['username'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>wacthwoord</td>
|
||||
<td class="alignright"><?= $password ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="content-block">
|
||||
<a href="<?php echo getenv('APP_URL'); ?>" class="btn-primary">
|
||||
Ga naar de website
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -9,45 +9,43 @@
|
||||
<meta name="description" content="bootstrap admin template">
|
||||
<meta name="author" content="">
|
||||
|
||||
<link rel="icon" href="css/images/dbo-01-80x80.png" type="image/png">
|
||||
|
||||
<title>** De Beleidsonderzoeker **</title>
|
||||
|
||||
<?php $this->load->view('partials/_css'); ?>
|
||||
<?php $this->load->view( 'partials/_css' ); ?>
|
||||
|
||||
<?php $this->load->view( 'partials/_fonts' ); ?>
|
||||
|
||||
<?php $this->load->view('partials/_fonts'); ?>
|
||||
<script src="../../global/vendor/breakpoints/breakpoints.js"></script>
|
||||
<script>
|
||||
Breakpoints();
|
||||
</script>
|
||||
</head>
|
||||
<body id="dbois-app">
|
||||
<!-- ko stopBinding: true -->
|
||||
<?php $this->load->view('partials/_modals'); ?>
|
||||
<!-- /ko -->
|
||||
|
||||
<body class="animsition dashboard">
|
||||
<nav class="site-navbar navbar navbar-default navbar-fixed-top navbar-mega" role="navigation">
|
||||
<?php $this->load->view( 'partials/_navbar-left' ); ?>
|
||||
|
||||
<?php $this->load->view('partials/_navbar-header'); ?>
|
||||
|
||||
<div class="navbar-container container-fluid">
|
||||
<div class="collapse navbar-collapse navbar-collapse-toolbar" id="site-navbar-collapse">
|
||||
<?php $this->load->view('partials/_navbar-container/_navbar-toolbar'); ?>
|
||||
|
||||
<?php $this->load->view('partials/_navbar-container/_navbar-right'); ?>
|
||||
</div>
|
||||
|
||||
<!-- Site Navbar Seach -->
|
||||
<div class="collapse navbar-search-overlap" id="site-navbar-search">
|
||||
<form role="search">
|
||||
<div class="form-group">
|
||||
<div class="input-search">
|
||||
<i class="input-search-icon wb-search" aria-hidden="true"></i>
|
||||
<input type="text" class="form-control" name="site-search" placeholder="Search...">
|
||||
<button type="button" class="input-search-close icon wb-close" data-target="#site-navbar-search"
|
||||
data-toggle="collapse" aria-label="Close"></button>
|
||||
</div>
|
||||
<div id="main-content" data-bind="fadeVisible:initialized" style="display:none">
|
||||
<?php foreach ( $pages as $page ): ?>
|
||||
<?php if ( count( $page->subpages ) == 0 ): ?>
|
||||
<?php if($page->app_page == 'F') continue; ?>
|
||||
<div data-bind="visible: <?= $page->pageurl ?>">
|
||||
<!-- ko stopBinding: true -->
|
||||
<?php $this->load->view( 'pages/content', ['pageurl' => $page->pageurl] ); ?>
|
||||
<!-- /ko -->
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ( $page->subpages as $subpage ): ?>
|
||||
<div data-bind="visible: <?= $subpage->pageurl ?>">
|
||||
<!-- ko stopBinding: true -->
|
||||
<?php $this->load->view( 'pages/content', ['pageurl' => $subpage->pageurl] ); ?>
|
||||
<!-- /ko -->
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- End Site Navbar Seach -->
|
||||
</div>
|
||||
</nav>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php $this->load->view( 'partials/_js' ); ?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<div class="modal modal-fade-in-scale-up modal-primary" tabindex="-1" id="comment-modal">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">toevoegen / wijzigen commentaar</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<textarea data-bind="froala:comment, froalaOptions:options"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button"
|
||||
class="btn btn-success"
|
||||
data-bind="click:saveComment">opslaan
|
||||
</button>
|
||||
<button type="button" class="btn btn-warning" data-dismiss="modal">annuleren</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,158 @@
|
||||
<div class="modal modal-fade-in-scale-up modal-primary" tabindex="-1" id="customer-modal">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">toevoegen / wijzigen opdrachtgever</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div role="form" class="form-horizontal">
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
naam
|
||||
</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="naam"
|
||||
class="form-control"
|
||||
data-bind="textInput:name,
|
||||
css:{'is-invalid':nameInvalid}">
|
||||
</div>
|
||||
<small class="invalid-feedback"
|
||||
data-bind="style:{display: nameInvalid() ? 'block' : 'none'}">
|
||||
voer een naam in
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
adres
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-address-book-o"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="adres"
|
||||
class="form-control"
|
||||
data-bind="textInput:address">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
postcode
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-address-book-o"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="postcode"
|
||||
class="form-control"
|
||||
data-bind="textInput:postcode">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
plaats
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-address-book-o"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="plaats"
|
||||
class="form-control"
|
||||
data-bind="textInput:place">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
contactpersoon
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-user"></i>
|
||||
</span>
|
||||
<input type="email"
|
||||
placeholder="contactpersoon"
|
||||
class="form-control"
|
||||
data-bind="textInput:contactperson">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
email
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-envelope"></i>
|
||||
</span>
|
||||
<input type="email"
|
||||
placeholder="email"
|
||||
class="form-control"
|
||||
data-bind="textInput:email,
|
||||
css:{'is-invalid':emailInvalid}">
|
||||
</div>
|
||||
<small class="invalid-feedback"
|
||||
data-bind="style:{display: emailInvalid() ? 'block' : 'none'}">
|
||||
email ongeldig<span data-bind="text:emailInvalid"></span>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
website
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-link"></i>
|
||||
</span>
|
||||
<input type="email"
|
||||
placeholder="email"
|
||||
class="form-control"
|
||||
data-bind="textInput:website">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
opmerkingen
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<textarea class="form-control" data-bind="textInput:remarks"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button"
|
||||
class="btn btn-success"
|
||||
data-bind="visible:formValid(), click:saveCustomer">opslaan
|
||||
</button>
|
||||
<button type="button" class="btn btn-warning" data-dismiss="modal">annuleren</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,206 @@
|
||||
<div class="modal modal-fade-in-scale-up modal-primary" tabindex="-1" id="external-modal">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">toevoegen / wijzigen onderaannemer</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div role="form" class="form-horizontal">
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
naam
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-user"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="contactperson"
|
||||
class="form-control"
|
||||
data-bind="textInput:contactperson,
|
||||
css:{'is-invalid':contactpersonInvalid}">
|
||||
</div>
|
||||
<small class="invalid-feedback"
|
||||
data-bind="style:{display: contactpersonInvalid() ? 'block' : 'none'}">
|
||||
voer een naam in
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
bedrijfsnaam
|
||||
</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="bedrijfsnaam"
|
||||
class="form-control"
|
||||
data-bind="textInput:name">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
adres
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-address-book-o"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="adres"
|
||||
class="form-control"
|
||||
data-bind="textInput:address">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
postcode
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-address-book-o"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="postcode"
|
||||
class="form-control"
|
||||
data-bind="textInput:postcode">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
plaats
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-address-book-o"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="plaats"
|
||||
class="form-control"
|
||||
data-bind="textInput:place">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
email
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-envelope"></i>
|
||||
</span>
|
||||
<input type="email"
|
||||
placeholder="email"
|
||||
class="form-control"
|
||||
data-bind="textInput:email,
|
||||
css:{'is-invalid':emailInvalid}">
|
||||
</div>
|
||||
<small class="invalid-feedback"
|
||||
data-bind="style:{display: emailInvalid() ? 'block' : 'none'}">
|
||||
email ongeldig<span data-bind="text:emailInvalid"></span>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
website
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-link"></i>
|
||||
</span>
|
||||
<input type="email"
|
||||
placeholder="email"
|
||||
class="form-control"
|
||||
data-bind="textInput:website">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
kvk - nummer
|
||||
</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="kvk nummer"
|
||||
class="form-control"
|
||||
data-bind="textInput:kvk_number">
|
||||
</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)
|
||||
</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="tarief"
|
||||
class="form-control align-right"
|
||||
data-bind="textInput:rate, event:{keyup:validateNumber}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
opmerkingen
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<textarea class="form-control" data-bind="textInput:remarks"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button"
|
||||
class="btn btn-success"
|
||||
data-bind="visible:formValid(), click:saveExternal">opslaan
|
||||
</button>
|
||||
<button type="button" class="btn btn-warning" data-dismiss="modal">annuleren</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,227 @@
|
||||
<div class="modal modal-fade-in-scale-up modal-primary" tabindex="-1" id="offer-modal">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">toevoegen / wijzigen offerte</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div role="form" class="form-horizontal">
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
offerte nummer
|
||||
</label>
|
||||
<div class="col-xl-5">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-asterisk"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="offerte nummer"
|
||||
class="form-control"
|
||||
data-bind="textInput:offernumber">
|
||||
</div>
|
||||
<small class="invalid-feedback"
|
||||
data-bind="style:{display: ! offernumber() ? 'block' : 'none'}">
|
||||
voer een offerte nummer in
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
offerte leider
|
||||
</label>
|
||||
<div class="col-xl-8">
|
||||
<div class="input-group input-group-icon">
|
||||
<select class="form-control"
|
||||
data-bind="options:users,
|
||||
optionsValue:'id',
|
||||
optionsText:'fullname',
|
||||
value:offerleader_id,
|
||||
optionsCaption:'selecteer offerteleider'">
|
||||
</select>
|
||||
</div>
|
||||
<small class="invalid-feedback"
|
||||
data-bind="style:{display: ! offerleader_id() ? 'block' : 'none'}">
|
||||
selecteer een offerteleider
|
||||
</small>
|
||||
</div>
|
||||
<div class="col-xl-1">
|
||||
<i class="icon fa-plus-square greenish pointer" data-bind="click:addUser"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
klant
|
||||
</label>
|
||||
<div class="col-xl-8">
|
||||
<div class="input-group input-group-icon">
|
||||
<select class="form-control"
|
||||
data-bind="options:customers,
|
||||
optionsValue:'id',
|
||||
optionsText:'name',
|
||||
value:customer_id,
|
||||
optionsCaption:'selecteer klant',
|
||||
event:{change:getCustomerProjects}"></select>
|
||||
</div>
|
||||
<small class="invalid-feedback"
|
||||
data-bind="style:{display: ! customer_id() ? 'block' : 'none'}">
|
||||
selecteer een klant
|
||||
</small>
|
||||
</div>
|
||||
<div class="col-xl-1">
|
||||
<i class="icon fa-plus-square greenish pointer" data-bind="click:addCustomer"></i>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group row">-->
|
||||
<!-- <label class="col-xl-3 form-control-label">-->
|
||||
<!-- project-->
|
||||
<!-- </label>-->
|
||||
<!-- <div class="col-xl-8">-->
|
||||
<!-- <select class="form-control"-->
|
||||
<!-- data-bind="options:projects,-->
|
||||
<!-- optionsValue: 'id',-->
|
||||
<!-- optionsText:'projectnumber',-->
|
||||
<!-- disable: ! customer_id(),-->
|
||||
<!-- value:project_id"></select>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div class="form-group row">
|
||||
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
datum offerte
|
||||
</label>
|
||||
<div class="col-xl-5">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-calendar"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="datum offerte"
|
||||
class="form-control"
|
||||
readonly
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' }, value:startdate, css:{'is-invalid': ! offerDateValid()}">
|
||||
</div>
|
||||
<small class="invalid-feedback"
|
||||
data-bind="style:{display: ! offerDateValid() ? 'block' : 'none'}">
|
||||
voer een offerte datum in
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
kans
|
||||
</label>
|
||||
<div class="col-xl-4">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-percent"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="kans"
|
||||
class="form-control percentage-input"
|
||||
data-bind="textInput:acceptance_chance,
|
||||
event:{keyup:validateNumber}">
|
||||
<span class="percentage-sign">%</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
omzet
|
||||
</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:own_revenue,
|
||||
event:{keyup:validateNumber}">
|
||||
</div>
|
||||
<small>
|
||||
eigen omzet (excl btw)
|
||||
</small>
|
||||
</div>
|
||||
<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="overige omzet"
|
||||
class="form-control align-right"
|
||||
data-bind="textInput:other_revenue,
|
||||
event:{keyup:validateNumber}">
|
||||
</div>
|
||||
<small>
|
||||
overige omzet (excl btw)
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
acceptatie datum
|
||||
</label>
|
||||
<div class="col-xl-5">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-calendar"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="acceptatie datum"
|
||||
class="form-control"
|
||||
readonly
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:accepteddate, disable:rejectdate()">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-1">
|
||||
<span class="icon fa-remove redish pointer"
|
||||
data-bind="visible:accepteddate(), click:resetDate.bind($data, 'accepteddate')"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
afwijsdatum
|
||||
</label>
|
||||
<div class="col-xl-5">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-calendar"></i>
|
||||
</span>
|
||||
<input type="email"
|
||||
placeholder="afwijsdatum"
|
||||
class="form-control"
|
||||
readonly
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' }, value:rejectdate, disable:accepteddate()">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-1">
|
||||
<span class="icon fa-remove redish pointer"
|
||||
data-bind="visible:rejectdate(), click:resetDate.bind($data, 'rejectdate')"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button"
|
||||
class="btn btn-success"
|
||||
data-bind="visible:formValid(), click:saveOffer">opslaan
|
||||
</button>
|
||||
<button type="button" class="btn btn-warning" data-dismiss="modal">annuleren</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,102 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
projecturen
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<th class="table-cyanish-header" width="35%">
|
||||
medewerker
|
||||
</th>
|
||||
<th class="table-cyanish-header" width="15%">
|
||||
datum
|
||||
</th>
|
||||
<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 align-right" width="15%">
|
||||
omzet
|
||||
</th>
|
||||
<th class="table-cyanish-header" width="8%">
|
||||
|
||||
</th>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:projecthours">
|
||||
<tr>
|
||||
<td>
|
||||
<span data-bind="text:dbo.helpers.findArrayElement('id', 'fullname', projectemployee_id(), $root.projectEmployees()),
|
||||
visible:! inEdit()"></span>
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:$root.projectEmployees,
|
||||
optionsText:'fullname',
|
||||
optionsValue:'id',
|
||||
value:projectemployee_id,
|
||||
optionsCaption:'medewerker',
|
||||
visible: inEdit(),
|
||||
event:{change:$root.saveProjecthour}">
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:hourdate, visible:! inEdit()"></span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
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>
|
||||
uur
|
||||
</span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm align-right"
|
||||
paceholder="uren"
|
||||
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"
|
||||
data-bind="click:$root.removeProjecthour"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th class="table-cyanish-header" colspan="2">Totaal</th>
|
||||
<th class="table-cyanish-header"> </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"> </th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newProjecthour">
|
||||
nieuwe uren
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,188 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
uitgaande facturen
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<th class="table-cyanish-header"> </th>
|
||||
<th class="table-cyanish-header">
|
||||
factuurnummer
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
factuurdatum
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right">
|
||||
bedrag (excl btw)
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right">
|
||||
bedrag (incl btw)
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right">
|
||||
openstaand( incl btw)
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right">
|
||||
btw tarief
|
||||
</th>
|
||||
<th class="table-cyanish-header" width="40px">
|
||||
|
||||
</th>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:invoices">
|
||||
<tr>
|
||||
<td>
|
||||
<i class="icon fa-chevron-right" data-bind="visible: ! showPayments(), click:$root.togglePayments"></i>
|
||||
<i class="icon fa-chevron-down" data-bind="visible:showPayments(), click:$root.togglePayments"></i>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:invoicenumber, visible:! inEdit()"></span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
placeholder="factuurnummer"
|
||||
data-bind="textInput:invoicenumber, visible:inEdit,
|
||||
event:{change:$root.saveInvoice}"/>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:invoicedate, visible:! inEdit()"></span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
placeholder="datum"
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:invoicedate, visible:inEdit,
|
||||
event:{change:$root.saveInvoice}"/>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind=" visible: ! inEdit()">
|
||||
<i class="icon fa-euro"></i>
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(invoiceamount())"></span>
|
||||
</span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm align-right"
|
||||
paceholder="bedrag"
|
||||
data-bind="textInput:invoiceamount, visible:inEdit,
|
||||
event:{change:$root.saveInvoice,keyup:$root.validateNumber.bind($data, 'invoiceamount')}"/>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<i class="icon fa-euro"></i>
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(inclBtw())"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<i class="icon fa-euro"></i>
|
||||
<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:dbo.helpers.numberWithPoints(forecastamount())"></span>-->
|
||||
<!-- </span>-->
|
||||
<!-- <input type="text"-->
|
||||
<!-- class="form-control form-control-sm align-right"-->
|
||||
<!-- paceholder="bedrag"-->
|
||||
<!-- data-bind="textInput:forecastamount, visible:inEdit,-->
|
||||
<!-- event:{change:$root.saveInvoice,keyup:$root.validateNumber.bind($data, 'forecastamount')}"/>-->
|
||||
<!-- </td>-->
|
||||
<!-- <td class="align-right">-->
|
||||
<!-- <span data-bind="text:forecastdate, visible:! inEdit()"></span>-->
|
||||
<!-- <input type="text"-->
|
||||
<!-- class="form-control form-control-sm"-->
|
||||
<!-- placeholder="datum"-->
|
||||
<!-- data-bind="datepicker:{dateFormat: 'dd-mm-yy' },-->
|
||||
<!-- value:forecastdate, visible:inEdit,-->
|
||||
<!-- event:{change:$root.saveInvoice}"/>-->
|
||||
<!-- </td>-->
|
||||
<td class="align-right">
|
||||
<span data-bind="visible:! inEdit()">
|
||||
<span data-bind="text:dbo.helpers.findArrayElement('id', 'vatrate', vat_id(), $root.vats())"></span>
|
||||
%
|
||||
</span>
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:$root.vats,
|
||||
optionsText:'vatrate',
|
||||
optionsValue:'id',
|
||||
value:vat_id,
|
||||
optionsCaption:'btw',
|
||||
visible:inEdit(),
|
||||
event:{change:$root.saveInvoice}">
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editInvoice"></i>
|
||||
<i class="icon fa-trash redish pointer" title="verwijder"
|
||||
data-bind="click:$root.removeInvoice"></i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr data-bind="visible:showPayments()">
|
||||
<td colspan="8">
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<th> </th>
|
||||
<th class="table-cyanish-header-light">
|
||||
datum
|
||||
</th>
|
||||
<th class="table-cyanish-header-light">
|
||||
bedrag
|
||||
</th>
|
||||
<th class="table-cyanish-header-light">
|
||||
</th>
|
||||
<th width="50%"> </th>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:payments">
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>
|
||||
<span data-bind="text:paymentdate, visible:! inEdit()"></span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
placeholder="datum"
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:paymentdate, visible:inEdit,
|
||||
event:{change:$root.savePayment}"/>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind=" visible: ! inEdit()">
|
||||
<i class="icon fa-euro"></i>
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(paymentamount())"></span>
|
||||
</span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm align-right"
|
||||
paceholder="bedrag"
|
||||
data-bind="textInput:paymentamount, visible:inEdit,
|
||||
event:{change:$root.savePayment,
|
||||
keyup:$root.validateNumber.bind($data, 'paymentamount')}"/>
|
||||
</td>
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editPayment.bind($data, $parents[0])"></i>
|
||||
<i class="icon fa-trash redish pointer" title="verwijder"
|
||||
data-bind="click:$root.removePayment"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<td></td>
|
||||
<td colspan="3">
|
||||
<a href="#" data-bind="click:$root.newPayment">
|
||||
nieuwe betaling
|
||||
</a>
|
||||
</td>
|
||||
</tfoot>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="10" class="table-cyanish-header"></th>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newInvoice">
|
||||
nieuwe factuur
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,43 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
opmerkingen
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="2" class="table-cyanish-header">
|
||||
offerte opmerkingen
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:projectFiles">
|
||||
<td>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editPayment"></i>
|
||||
<i class="icon fa-trash redish pointer" title="verwijder"
|
||||
data-bind="click:$root.removePayment"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" class="table-cyanish-header">
|
||||
project opmerkingen
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,112 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
inkomende facturen (bedragen incl btw)
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<th class="table-cyanish-header">
|
||||
onderaannemer
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
omschrijving
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
datum
|
||||
</th>
|
||||
<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">
|
||||
|
||||
</th>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:projectcosts">
|
||||
<tr>
|
||||
<td>
|
||||
<span data-bind="text:dbo.helpers.findArrayElement('id', 'contactperson', external_id(), $root.externals()),
|
||||
visible:! inEdit()"></span>
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:$root.externals,
|
||||
optionsText:'contactperson',
|
||||
optionsValue:'id',
|
||||
value:external_id,
|
||||
optionsCaption:'extern',
|
||||
visible: inEdit(),
|
||||
event:{change:$root.saveProjectcosts}">
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind=" visible: ! inEdit()">
|
||||
<span data-bind="text:description"></span>
|
||||
</span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm align-right"
|
||||
paceholder="omschrijving"
|
||||
data-bind="textInput:description, visible:inEdit,
|
||||
event:{change:$root.saveProjectcosts}"/>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:date, visible:! inEdit()"></span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
placeholder="start"
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:date, visible:inEdit,
|
||||
event:{change:$root.saveProjectcosts}"/>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind=" visible: ! inEdit()">
|
||||
<i class="icon fa-euro"></i>
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(costs())"></span>
|
||||
</span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm align-right"
|
||||
paceholder="bedrag"
|
||||
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"
|
||||
data-bind="click:$root.removeProjecthour"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newProjectcost">
|
||||
nieuwe projectkosten
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,121 @@
|
||||
<div class="row form-inline">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-3 col-form-label">klant</label>
|
||||
<div class="col-md-9">
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:customers,
|
||||
optionsText:'name',
|
||||
optionsValue: 'id',
|
||||
value:customerID,
|
||||
disable:offers().length > 0,
|
||||
optionsCaption:'selecteer klant',
|
||||
event:{change:saveProject},
|
||||
css:{'is-invalid': ! customerID()}"></select>
|
||||
<small class="invalid-feedback"
|
||||
data-bind="style:{display: ! customerID() ? 'block' : 'none'}">
|
||||
selecteer een klant
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-5 col-form-label">projectleider</label>
|
||||
<div class="col-md-7">
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:users,
|
||||
optionsText:'fullname',
|
||||
optionsValue:'id',
|
||||
value:projectleaderID,
|
||||
optionsCaption:'projectleider',
|
||||
event:{change:saveProject}">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-5 col-form-label">begin project</label>
|
||||
<div class="col-md-7">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-calendar"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="start project"
|
||||
class="form-control form-control-sm"
|
||||
readonly
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:startdate,
|
||||
event:{change:saveProject}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-5 col-form-label">eind project</label>
|
||||
<div class="col-md-7">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-calendar"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="eind project"
|
||||
class="form-control form-control-sm"
|
||||
readonly
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:enddate,
|
||||
event:{change:saveProject}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-top:10px;">
|
||||
<div class="col-md-5">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-3 form-control-label">omschrijving</label>
|
||||
<div class="col-md-9">
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
data-bind="textInput:projectname, event:{keyup:saveProjectname}"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<h4 class="form-control-label">eigenomzet:
|
||||
<i class="icon fa-euro"> </i><span data-bind="text:ownRevenue"></span>
|
||||
</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<h4 class="form-control-label">overige omzet:
|
||||
<i class="icon fa-euro"> </i><span data-bind="text:otherRevenue"></span>
|
||||
</h4>
|
||||
</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">
|
||||
<canvas id="hours-vs-budget" height="300"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="graph-holder">
|
||||
<canvas id="invoice-vs-payed" height="300"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,82 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
project medewerkers
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<th class="table-cyanish-header">
|
||||
naam
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right">
|
||||
tarief
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right">
|
||||
budget
|
||||
</th>
|
||||
<th class="table-cyanish-header" width="40px">
|
||||
|
||||
</th>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:projectEmployees">
|
||||
<tr>
|
||||
<td>
|
||||
<span data-bind="text:dbo.helpers.findArrayElement('id', 'fullname', employeeID(), $root.users()),
|
||||
visible: ! inEdit()"></span>
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="
|
||||
options:$root.users,
|
||||
optionsText:'fullname',
|
||||
optionsValue:'id',
|
||||
value:employeeID,
|
||||
optionsCaption:'naam',
|
||||
event:{change:$root.changeProjectemployee},
|
||||
visible:inEdit"></select>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind=" visible: ! inEdit()">
|
||||
<i class="icon fa-euro"></i>
|
||||
<span data-bind="text:tarif"></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 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"
|
||||
placeholder="budget"
|
||||
data-bind="textInput:budget, visible:inEdit,
|
||||
event:{change:$root.saveProjectemployee,keyup:$root.validateNumber.bind($data, 'budget')}"/>
|
||||
</td>
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editProjectemployee"></i>
|
||||
<i class="icon fa-trash redish pointer" title="verwijder"
|
||||
data-bind="click:$root.removeProjectemployee"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th class="table-cyanish-header align-right" colspan="2"> </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">
|
||||
nieuwe project medewerker
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,43 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
bestanden
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="2" class="table-cyanish-header">
|
||||
offerte bestanden
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:projectFiles">
|
||||
<td>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editPayment"></i>
|
||||
<i class="icon fa-trash redish pointer" title="verwijder"
|
||||
data-bind="click:$root.removePayment"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" class="table-cyanish-header">
|
||||
project bestanden
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,49 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
offerte
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<th class="table-cyanish-header">
|
||||
nummer
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
start
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right">
|
||||
eigen omzet (excl btw)
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right">
|
||||
overig omzet (excl btw)
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
|
||||
</th>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:offers">
|
||||
<tr>
|
||||
<td>
|
||||
<span data-bind="text:offernumber"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:startdate"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(own_revenue.toFixed(0))"></span>
|
||||
</td>
|
||||
<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>-->
|
||||
<!-- <i class="icon fa-trash redish pointer" title="verwijder"-->
|
||||
<!-- data-bind="click:$root.removeOffer"></i>-->
|
||||
<!-- </td>-->
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,92 @@
|
||||
<div class="project-page" id="project-modal" data-bind="fadeVisible:showProject()">
|
||||
|
||||
<div class="container" style="margin-top:15px;padding-top:15px;">
|
||||
<div class="nav-tabs-horizontal nav-tabs-animate nav-tab-reverse">
|
||||
<ul class="nav nav-tabs nav-tabs-solid">
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link active"
|
||||
data-toggle="tab"
|
||||
href="#dashboard">
|
||||
<i class="icon fa-area-chart"></i>
|
||||
algemeen</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link"
|
||||
data-toggle="tab"
|
||||
href="#financial"
|
||||
aria-control="financial"
|
||||
role="tab">
|
||||
<i class="icon fa-euro"></i>
|
||||
financieel</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link"
|
||||
data-toggle="tab"
|
||||
href="#employees"
|
||||
aria-control="employees"
|
||||
role="tab">
|
||||
<i class="icon fa-user-circle"></i>
|
||||
medewerkers</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link"
|
||||
data-toggle="tab"
|
||||
href="#files"
|
||||
aria-control="files"
|
||||
role="tab">
|
||||
<i class="icon fa-files"></i>
|
||||
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-5">-->
|
||||
<!-- --><?php //$this->load->view( 'modals/partials/_projectoffers' ); ?>
|
||||
<!-- </div>-->
|
||||
<div class="col-md-7">
|
||||
<?php $this->load->view( 'modals/partials/_projectcosts' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<?php $this->load->view( 'modals/partials/_invoices' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane animation-slide-top" id="employees">
|
||||
<div class="row" 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-7">
|
||||
<?php $this->load->view( 'modals/partials/_hours' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane animation-slide-top" id="files">
|
||||
<div class="row" data-bind="fadeVisible:customerID()">
|
||||
<div class="col-md-4">
|
||||
<?php $this->load->view( 'modals/partials/_projectfiles' ); ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?php $this->load->view( 'modals/partials/_projectcomments' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,158 @@
|
||||
<div class="modal modal-fade-in-scale-up modal-primary" tabindex="-1" id="user-modal">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">toevoegen / wijzigen medewerker</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div role="form" class="form-horizontal">
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
voornaam
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-user"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="voornaam"
|
||||
class="form-control"
|
||||
data-bind="textInput:firstname,
|
||||
css:{'is-invalid':firstnameInvalid}">
|
||||
</div>
|
||||
<small class="invalid-feedback"
|
||||
data-bind="style:{display: firstnameInvalid() ? 'block' : 'none'}">
|
||||
voer een voornaam in<span data-bind="text:firstnameInvalid"></span>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
tussenvoegsel
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-user"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="tussenvoegsel"
|
||||
class="form-control"
|
||||
data-bind="textInput:middlename">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
achternaam
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-user"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="achternaam"
|
||||
class="form-control"
|
||||
data-bind="textInput:lastname,
|
||||
css:{'is-invalid':lastnameInvalid}">
|
||||
</div>
|
||||
<small class="invalid-feedback"
|
||||
data-bind="style:{display: lastnameInvalid() ? 'block' : 'none'}">
|
||||
voer een achternaam in<span data-bind="text:lastnameInvalid"></span>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
gebruikersnaam
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-user"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="gebruikersnaam"
|
||||
class="form-control"
|
||||
data-bind="textInput:username,
|
||||
css:{'is-invalid':usernameInvalid}">
|
||||
</div>
|
||||
<small class="invalid-feedback"
|
||||
data-bind="style:{display: usernameInvalid() ? 'block' : 'none'}">
|
||||
voer een gebruikernaam in<span data-bind="text:username"></span>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
email
|
||||
</label>
|
||||
<div class="col-xl-9">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-envelope"></i>
|
||||
</span>
|
||||
<input type="email"
|
||||
placeholder="email"
|
||||
class="form-control"
|
||||
data-bind="textInput:email,
|
||||
css:{'is-invalid':emailInvalid}">
|
||||
</div>
|
||||
<small class="invalid-feedback"
|
||||
data-bind="style:{display: emailInvalid() ? 'block' : 'none'}">
|
||||
email ongeldig<span data-bind="text:emailInvalid"></span>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
uurtarief
|
||||
</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="uurtarief"
|
||||
class="form-control align-right"
|
||||
data-bind="textInput:hourlyRate,
|
||||
event:{keyup:validateNumber.bind($data, 'hourlyRate')}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-xl-3"> </div>
|
||||
<!-- ko foreach:roles -->
|
||||
<div class="radio-inline">
|
||||
<i class="icon fa-circle-o blueish"
|
||||
style="cursor:pointer;"
|
||||
data-bind="visible:$root.role() != rolelevel,
|
||||
click:$root.setRole"></i>
|
||||
<i class="icon fa-check-circle-o greenish"
|
||||
data-bind="visible:$root.role() == rolelevel"></i>
|
||||
<label data-bind="text:rolename">
|
||||
</label>
|
||||
</div>
|
||||
<!-- /ko -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button"
|
||||
class="btn btn-success"
|
||||
data-bind="visible:formValid(), click:saveUser">opslaan</button>
|
||||
<button type="button" class="btn btn-warning" data-dismiss="modal">annuleren</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
<div class="page" id="<?= $pageurl ?>">
|
||||
<?php $this->load->view( 'pages/' . strtolower( $pageurl ) . '_view' ); ?>
|
||||
</div>
|
||||
@@ -0,0 +1,68 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="table-tealish-header">naam</th>
|
||||
<th class="table-tealish-header">adres</th>
|
||||
<th class="table-tealish-header">plaats</th>
|
||||
<th class="table-tealish-header">contactpersoon</th>
|
||||
<th class="table-tealish-header">email</th>
|
||||
<th class="table-tealish-header"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:customers">
|
||||
<tr>
|
||||
<td><span data-bind="text:name"></span></td>
|
||||
<td><span data-bind="text:address"></span></td>
|
||||
<td><span data-bind="text:postcode + ' ' + place"></span></td>
|
||||
<td><span data-bind="text:contactperson"</td>
|
||||
<td><span data-bind="text:email"></span></td>
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editCustomer"></i>
|
||||
<!-- ko if:archive == 'F' -->
|
||||
<i class="icon fa-archive pointer" title="archiveer"
|
||||
data-bind="click:$root.archiveCustomer"></i>
|
||||
<!-- /ko -->
|
||||
<!-- ko if:archive != 'F' -->
|
||||
<i class="icon fa-minus-circle redish pointer" title="archiveer"
|
||||
data-bind="click:$root.archiveCustomer"></i>
|
||||
<!-- /ko -->
|
||||
<i class="icon fa-trash redish pointer" title="verwijder"
|
||||
data-bind="click:$root.removeCustomer"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="4" class="">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newCustomer">
|
||||
nieuwe opdrachtgever
|
||||
</button>
|
||||
</td>
|
||||
<td colspan="2" class="">
|
||||
<div class="row form-horizontal">
|
||||
<label class="col-md-4 form-control-label">archief</label>
|
||||
<div class="col-md-8">
|
||||
<div class="onoffswitch" data-bind="click:toggleArchive">
|
||||
<input type="checkbox"
|
||||
name="onoffswitch"
|
||||
class="onoffswitch-checkbox"
|
||||
data-bind="checked:archive"
|
||||
id="myonoffswitch">
|
||||
<label class="onoffswitch-label" for="myonoffswitch">
|
||||
<span class="onoffswitch-inner"></span>
|
||||
<span class="onoffswitch-switch"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user