Diverse wijzigingen nav word document
This commit is contained in:
@@ -60,12 +60,19 @@ class usersController extends MY_Controller {
|
||||
$this->json( $userActiveProjects );
|
||||
}
|
||||
|
||||
public function getUniqueprojectEmployees()
|
||||
{
|
||||
$projectEmployees = User::getUniqueProjectUsers();
|
||||
public function getUniqueprojectEmployees()
|
||||
{
|
||||
$projectEmployees = User::getUniqueProjectUsers();
|
||||
|
||||
$this->json( $projectEmployees );
|
||||
}
|
||||
$this->json( $projectEmployees );
|
||||
}
|
||||
|
||||
public function getUniqueEmployeesWithActivity($archive)
|
||||
{
|
||||
$projectEmployees = Projectemployee::getUniqueEmployeesWithActivity($archive);
|
||||
|
||||
$this->json( $projectEmployees );
|
||||
}
|
||||
|
||||
public function saveUser()
|
||||
{
|
||||
|
||||
@@ -29,7 +29,10 @@ class ReportsController extends MY_Controller {
|
||||
|
||||
public function recapProjects( $archive )
|
||||
{
|
||||
$recapprojects = new Recapprojects( $archive );
|
||||
$field = $this->input->post('field');
|
||||
$direction = $this->input->post('direction');
|
||||
|
||||
$recapprojects = new Recapprojects( $archive, $field, $direction );
|
||||
|
||||
$projects = $recapprojects->getProjects();
|
||||
|
||||
@@ -84,4 +87,4 @@ class ReportsController extends MY_Controller {
|
||||
Project::whereId( $projectID )->update( ['current_financial_year' => $amount] );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,11 @@ class Recapprojects {
|
||||
|
||||
private $ci;
|
||||
private $index;
|
||||
private $field;
|
||||
private $archive;
|
||||
private $project;
|
||||
private $projects;
|
||||
private $direction;
|
||||
private $employeeHours;
|
||||
private $invoicedYears = [];
|
||||
private $projectTotals;
|
||||
@@ -23,11 +25,13 @@ class Recapprojects {
|
||||
private $projectEmployeeDetail;
|
||||
private $projectEmployeeDetails;
|
||||
|
||||
public function __construct( $archive )
|
||||
public function __construct( $archive, $field, $direction )
|
||||
{
|
||||
$this->ci =& get_instance();
|
||||
|
||||
$this->archive = $archive;
|
||||
$this->field = $field;
|
||||
$this->direction = $direction;
|
||||
|
||||
$this->ci->load->Model( 'projects/Invoices_model' );
|
||||
|
||||
@@ -54,12 +58,14 @@ class Recapprojects {
|
||||
|
||||
private function setProjects()
|
||||
{
|
||||
$this->projects = Project::getActiveProjects( $this->archive )->toArray();
|
||||
$this->projects = Project::getActiveProjects(
|
||||
$this->archive, $this->field, $this->direction )->toArray();
|
||||
}
|
||||
|
||||
private function setUniqueEmployees()
|
||||
{
|
||||
$this->uniqueEmployees = Projectemployee::getUniqueProjectEmployees();
|
||||
$this->uniqueEmployees =
|
||||
Projectemployee::getUniqueEmployeesWithActivity();
|
||||
}
|
||||
|
||||
private function loopProjects()
|
||||
@@ -272,4 +278,4 @@ class Recapprojects {
|
||||
$this->index ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,104 +8,105 @@
|
||||
|
||||
class Invoices {
|
||||
|
||||
private $year;
|
||||
private $project;
|
||||
private $projects;
|
||||
private $monthPayment;
|
||||
private $monthPayments;
|
||||
private $monthForecast;
|
||||
private $monthForecasts;
|
||||
private $invoiceOverview;
|
||||
private $invoiceForecast;
|
||||
private $invoiceForecasts;
|
||||
private $invoiceOverviews = [];
|
||||
private $invoiceReport = [];
|
||||
private $orderType;
|
||||
private $orderDirection;
|
||||
private $archive;
|
||||
private $year;
|
||||
private $project;
|
||||
private $projects;
|
||||
private $monthPayment;
|
||||
private $monthPayments;
|
||||
private $monthForecast;
|
||||
private $monthForecasts;
|
||||
private $invoiceOverview;
|
||||
private $invoiceForecast;
|
||||
private $invoiceForecasts;
|
||||
private $invoiceOverviews = [];
|
||||
private $invoiceReport = [];
|
||||
private $orderType;
|
||||
private $orderDirection;
|
||||
private $archive;
|
||||
|
||||
public function __construct( $year, $orderType, $orderDirection, $archive )
|
||||
{
|
||||
$this->year = $year;
|
||||
$this->orderType = $orderType;
|
||||
$this->orderDirection = $orderDirection;
|
||||
$this->archive = $archive;
|
||||
public function __construct( $year, $orderType, $orderDirection, $archive )
|
||||
{
|
||||
$this->year = $year;
|
||||
$this->orderType = $orderType;
|
||||
$this->orderDirection = $orderDirection;
|
||||
$this->archive = $archive;
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getInvoiceReport()
|
||||
{
|
||||
return $this->invoiceReport;
|
||||
}
|
||||
public function getInvoiceReport()
|
||||
{
|
||||
return $this->invoiceReport;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->setProjects();
|
||||
private function handle()
|
||||
{
|
||||
$this->setProjects();
|
||||
|
||||
$this->loopProjects();
|
||||
$this->loopProjects();
|
||||
|
||||
$this->setInvoiceReport();
|
||||
}
|
||||
//only projects with payments also archived projects
|
||||
$this->setMonthPayments();
|
||||
|
||||
private function setProjects()
|
||||
{
|
||||
$this->projects =
|
||||
Project::getProjectsForReport( $this->orderType, $this->orderDirection, $this->archive );
|
||||
}
|
||||
$this->setInvoiceReport();
|
||||
}
|
||||
|
||||
private function loopProjects()
|
||||
{
|
||||
foreach ( $this->projects as $this->project )
|
||||
{
|
||||
$this->setInvoiceOverview();
|
||||
private function setProjects()
|
||||
{
|
||||
$this->projects =
|
||||
Project::getProjectsForReport( $this->orderType, $this->orderDirection, $this->archive );
|
||||
}
|
||||
|
||||
$this->setInvoiceForecasts();
|
||||
private function loopProjects()
|
||||
{
|
||||
foreach ( $this->projects as $this->project )
|
||||
{
|
||||
$this->setInvoiceOverview();
|
||||
|
||||
$this->setMonthForecasts();
|
||||
$this->setInvoiceForecasts();
|
||||
|
||||
$this->setMonthPayments();
|
||||
}
|
||||
}
|
||||
$this->setMonthForecasts();
|
||||
}
|
||||
}
|
||||
|
||||
private function setInvoiceOverview()
|
||||
{
|
||||
$this->invoiceOverview = new InvoiceOverview( $this->project, $this->year );
|
||||
private function setInvoiceOverview()
|
||||
{
|
||||
$this->invoiceOverview = new InvoiceOverview( $this->project, $this->year );
|
||||
|
||||
$this->invoiceOverviews[] = $this->invoiceOverview->getProjectDetails();
|
||||
}
|
||||
$this->invoiceOverviews[] = $this->invoiceOverview->getProjectDetails();
|
||||
}
|
||||
|
||||
private function setInvoiceForecasts()
|
||||
{
|
||||
$this->invoiceForecast =
|
||||
new InvoiceForecast( $this->project, $this->invoiceOverview->getNeedinvoice(), $this->year );
|
||||
private function setInvoiceForecasts()
|
||||
{
|
||||
$this->invoiceForecast =
|
||||
new InvoiceForecast( $this->project, $this->invoiceOverview->getNeedinvoice(), $this->year );
|
||||
|
||||
$this->invoiceForecasts[] = $this->invoiceForecast->getProjectDetails();
|
||||
}
|
||||
$this->invoiceForecasts[] = $this->invoiceForecast->getProjectDetails();
|
||||
}
|
||||
|
||||
public function setMonthForecasts()
|
||||
{
|
||||
$this->monthForecast =
|
||||
new MonthForecast( $this->invoiceForecast, $this->project, $this->year );
|
||||
public function setMonthForecasts()
|
||||
{
|
||||
$this->monthForecast =
|
||||
new MonthForecast( $this->invoiceForecast, $this->project, $this->year );
|
||||
|
||||
$this->monthForecasts[] = $this->monthForecast->getProjectDetails();
|
||||
}
|
||||
$this->monthForecasts[] = $this->monthForecast->getProjectDetails();
|
||||
}
|
||||
|
||||
public function setMonthPayments()
|
||||
{
|
||||
$this->monthPayment =
|
||||
new MonthPayments( $this->project, $this->year );
|
||||
public function setMonthPayments()
|
||||
{
|
||||
$monthPayment = new MonthPayments(
|
||||
$this->year, $this->orderType, $this->orderDirection );
|
||||
|
||||
$this->monthPayments[] = $this->monthPayment->getProjectDetails();
|
||||
}
|
||||
$this->monthPayments = $monthPayment->getProjectDetails();
|
||||
}
|
||||
|
||||
private function setInvoiceReport()
|
||||
{
|
||||
$this->invoiceReport = [
|
||||
'invoiceOverview' => $this->invoiceOverviews,
|
||||
'forecasts' => $this->invoiceForecasts,
|
||||
'monthForecasts' => $this->monthForecasts,
|
||||
'monthPayments' => $this->monthPayments
|
||||
];
|
||||
}
|
||||
}
|
||||
private function setInvoiceReport()
|
||||
{
|
||||
$this->invoiceReport = [
|
||||
'invoiceOverview' => $this->invoiceOverviews,
|
||||
'forecasts' => $this->invoiceForecasts,
|
||||
'monthForecasts' => $this->monthForecasts,
|
||||
'monthPayments' => $this->monthPayments
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,96 +8,119 @@
|
||||
|
||||
class MonthPayments {
|
||||
|
||||
private $year;
|
||||
private $project;
|
||||
private $payment;
|
||||
private $customer;
|
||||
private $projectname;
|
||||
private $monthPayments;
|
||||
private $projectDetails;
|
||||
private $totalProjectPayments;
|
||||
private $year;
|
||||
private $project;
|
||||
private $payment;
|
||||
private $customer;
|
||||
private $projectname;
|
||||
private $monthPayments;
|
||||
private $projectDetails;
|
||||
private $projectsWithPayments;
|
||||
private $totalProjectPayments;
|
||||
private $orderType;
|
||||
private $orderDirection;
|
||||
|
||||
public function __construct( $project, $year )
|
||||
{
|
||||
$this->project = $project;
|
||||
$this->year = $year;
|
||||
public function __construct( $year, $orderType, $orderDirection )
|
||||
{
|
||||
$this->year = $year;
|
||||
$this->orderType = $orderType;
|
||||
$this->orderDirection = $orderDirection;
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getProjectDetails()
|
||||
{
|
||||
return $this->projectDetails;
|
||||
}
|
||||
public function getProjectDetails()
|
||||
{
|
||||
return $this->projectDetails;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->setProjectname();
|
||||
private function handle()
|
||||
{
|
||||
$this->setProjectsWithPayments();
|
||||
|
||||
$this->setCustomer();
|
||||
$this->loopProjectsWithPayments();
|
||||
}
|
||||
|
||||
$this->setInitialsMonthPayments();
|
||||
private function setProjectsWithPayments()
|
||||
{
|
||||
$projectsArray = Payment::getProjectsWithPayments( $this->year );
|
||||
|
||||
$this->loopPayments();
|
||||
$this->projectsWithPayments =
|
||||
Project::getProjectsForReport(
|
||||
$this->orderType, $this->orderDirection, FALSE, $projectsArray );
|
||||
}
|
||||
|
||||
$this->setProjectDetails();
|
||||
}
|
||||
private function loopProjectsWithPayments()
|
||||
{
|
||||
foreach ( $this->projectsWithPayments as $this->project )
|
||||
{
|
||||
$this->setProjectname();
|
||||
|
||||
private function setProjectname()
|
||||
{
|
||||
$this->projectname = $this->project->projectname . '(' . $this->project->projectnumber . ')';
|
||||
}
|
||||
$this->setCustomer();
|
||||
|
||||
private function setCustomer()
|
||||
{
|
||||
$this->customer = $this->project->customer->name;
|
||||
}
|
||||
$this->setInitialsMonthPayments();
|
||||
|
||||
private function setInitialsMonthPayments()
|
||||
{
|
||||
for ( $i = 1; $i <= 12; $i ++ )
|
||||
{
|
||||
$this->monthPayments[ $i ] = ['paymentamount' => 0];
|
||||
}
|
||||
}
|
||||
$this->loopPayments();
|
||||
|
||||
private function loopPayments()
|
||||
{
|
||||
foreach ( $this->project->invoices as $invoice )
|
||||
{
|
||||
foreach($invoice->payments as $this->payment)
|
||||
{
|
||||
$this->setMonthPayments();
|
||||
$this->setProjectDetails();
|
||||
}
|
||||
}
|
||||
|
||||
$this->setTotalProjectPayments();
|
||||
}
|
||||
}
|
||||
}
|
||||
private function setProjectname()
|
||||
{
|
||||
$this->projectname = $this->project->projectname . '(' . $this->project->projectnumber . ')';
|
||||
}
|
||||
|
||||
private function setMonthPayments()
|
||||
{
|
||||
$paymentYear = date( 'Y', strtotime( $this->payment->paymentdate ) );
|
||||
$paymentMonth = date( 'n', strtotime( $this->payment->paymentdate ) );
|
||||
private function setCustomer()
|
||||
{
|
||||
$this->customer = $this->project->customer->name;
|
||||
}
|
||||
|
||||
if ( $paymentYear == $this->year )
|
||||
$this->monthPayments[ $paymentMonth ]['paymentamount'] += $this->payment->paymentamount;
|
||||
}
|
||||
private function setInitialsMonthPayments()
|
||||
{
|
||||
for ( $i = 1; $i <= 12; $i ++ )
|
||||
{
|
||||
$this->monthPayments[ $i ] = ['paymentamount' => 0];
|
||||
}
|
||||
}
|
||||
|
||||
private function setTotalProjectPayments()
|
||||
{
|
||||
$paymentYear = date( 'Y', strtotime( $this->payment->paymentdate ) );
|
||||
private function loopPayments()
|
||||
{
|
||||
foreach ( $this->project->invoices as $invoice )
|
||||
{
|
||||
foreach ( $invoice->payments as $this->payment )
|
||||
{
|
||||
$this->setMonthPayments();
|
||||
|
||||
if ( $paymentYear == $this->year )
|
||||
$this->totalProjectPayments += $this->payment->paymentamount;
|
||||
}
|
||||
$this->setTotalProjectPayments();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function setProjectDetails()
|
||||
{
|
||||
$this->projectDetails = [
|
||||
'projectname' => $this->projectname,
|
||||
'customer' => $this->customer,
|
||||
'monthPayments' => $this->monthPayments,
|
||||
'totalProjectPayments' => number_format( $this->totalProjectPayments, 0, ',', '.' )
|
||||
];
|
||||
}
|
||||
}
|
||||
private function setMonthPayments()
|
||||
{
|
||||
$paymentYear = date( 'Y', strtotime( $this->payment->paymentdate ) );
|
||||
$paymentMonth = date( 'n', strtotime( $this->payment->paymentdate ) );
|
||||
|
||||
if ( $paymentYear == $this->year )
|
||||
$this->monthPayments[ $paymentMonth ]['paymentamount'] += $this->payment->paymentamount;
|
||||
}
|
||||
|
||||
private function setTotalProjectPayments()
|
||||
{
|
||||
$paymentYear = date( 'Y', strtotime( $this->payment->paymentdate ) );
|
||||
|
||||
if ( $paymentYear == $this->year )
|
||||
$this->totalProjectPayments += $this->payment->paymentamount;
|
||||
}
|
||||
|
||||
private function setProjectDetails()
|
||||
{
|
||||
$this->projectDetails[] = [
|
||||
'projectname' => $this->projectname,
|
||||
'customer' => $this->customer,
|
||||
'monthPayments' => $this->monthPayments,
|
||||
'totalProjectPayments' => number_format( $this->totalProjectPayments, 0, ',', '.' )
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,17 @@ class Payment extends BaseModel {
|
||||
return $projectPayment->payment;
|
||||
}
|
||||
|
||||
public static function getProjectsWithPayments($year)
|
||||
{
|
||||
$projects = self::selectRaw('INV.project_id')
|
||||
->distinct()
|
||||
->join('invoices AS INV', 'INV.id', '=', 'payments.invoice_id')
|
||||
->whereRaw('DATE_FORMAT(INV.invoicedate, "%Y") = "'. $year.'"')
|
||||
->lists('project_id');
|
||||
|
||||
return $projects->toArray();
|
||||
}
|
||||
|
||||
public static function savePayment( $paymentID, $payment )
|
||||
{
|
||||
$payment = (array) $payment;
|
||||
@@ -50,4 +61,4 @@ class Payment extends BaseModel {
|
||||
Payment::whereId( $paymentID )->delete();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ class Project extends BaseModel {
|
||||
Project::whereId( $projectID )->delete();
|
||||
}
|
||||
|
||||
public static function getActiveProjects( $archive = 'T' )
|
||||
public static function getActiveProjects( $archive = 'T', $sortField = FALSE, $direction = FALSE )
|
||||
{
|
||||
$projects = Project::selectRaw( "projects.id, YEAR(projects.startdate) AS instroom, YEAR(projects.enddate) AS uitstroom, projectnumber, current_financial_year,
|
||||
projectname, CUS.name, OFF.own_revenue, OFF.other_revenue" )
|
||||
@@ -106,6 +106,8 @@ class Project extends BaseModel {
|
||||
->groupBy( 'OFF.own_revenue' )
|
||||
->groupBy( 'OFF.other_revenue' );
|
||||
|
||||
if ( $sortField ) $projects = $projects->orderBy( $sortField, $direction );
|
||||
|
||||
if ( $archive == 'F' ) $projects = $projects->where( 'projects.archive', '=', 'F' );
|
||||
|
||||
$projects = $projects->get();
|
||||
@@ -113,12 +115,14 @@ class Project extends BaseModel {
|
||||
return $projects;
|
||||
}
|
||||
|
||||
public static function getProjectsForReport( $orderType, $orderDirection, $archive = 'F' )
|
||||
public static function getProjectsForReport( $orderType, $orderDirection, $archive = 'F', $projectsArray = FALSE )
|
||||
{
|
||||
$projects = self::getBaseProject();
|
||||
|
||||
if ( $archive == 'F' ) $projects = $projects->whereArchive( 'F' );
|
||||
|
||||
if ( is_array( $projectsArray ) ) $projects = $projects->whereIn( 'id', $projectsArray );
|
||||
|
||||
$projects = $projects->orderBy( $orderType, $orderDirection )->get();
|
||||
|
||||
return $projects;
|
||||
|
||||
@@ -8,94 +8,111 @@
|
||||
|
||||
class Projectemployee extends BaseModel {
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo( 'Project' );
|
||||
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 getUniqueEmployeesWithActivity( $archive = 'F' )
|
||||
{
|
||||
$projectemployees = Projectemployee::selectRaw( "USR.id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" )
|
||||
->distinct()
|
||||
->join( 'users AS USR', 'USR.id', '=', 'projectemployees.user_id' )
|
||||
->join( 'projectemployees AS PRE', 'PRE.user_id', '=', 'USR.id' )
|
||||
->join( 'projects AS PRJ', 'PRJ.id', '=', 'PRE.project_id' );
|
||||
|
||||
if ( $archive == 'F' ) $projectemployees = $projectemployees->where( 'PRJ.archive', '=', 'F' );
|
||||
|
||||
$projectemployees = $projectemployees->get();
|
||||
|
||||
return $projectemployees;
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo( 'User' );
|
||||
}
|
||||
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 )
|
||||
->where( 'budget', '!=', 0 )
|
||||
->groupBy( 'projectemployees.id' )
|
||||
->havingRaw( 'ROUND(SUM(hours), 0) > 0' )
|
||||
->get();
|
||||
|
||||
public function projecthours()
|
||||
{
|
||||
return $this->hasMany( 'Projecthour' );
|
||||
}
|
||||
return $details;
|
||||
}
|
||||
|
||||
public static function getAvailableEmployees( $projectID )
|
||||
{
|
||||
$currentEmployees = Self::whereProjectId( $projectID )
|
||||
->lists( 'user_id' );
|
||||
public static function firstOrCreateProjectemployee( $userID, $projectID )
|
||||
{
|
||||
$projectemployee = self::whereUserId( $userID )->whereProjectId( $projectID );
|
||||
|
||||
$availableEmployees = User::selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" )
|
||||
->whereNotIn( 'id', $currentEmployees )
|
||||
->whereArchive( 'F' )
|
||||
->get();
|
||||
if ( $projectemployee->count() > 0 ) return $projectemployee->first();
|
||||
|
||||
return $availableEmployees;
|
||||
}
|
||||
$user = User::find( $userID );
|
||||
|
||||
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();
|
||||
$tarif = $user ? $user->hourlyrate : 0;
|
||||
|
||||
return $projectemployees;
|
||||
}
|
||||
$projectemployee = Projectemployee::create( [
|
||||
'project_id' => $projectID,
|
||||
'user_id' => $userID,
|
||||
'tarif' => $tarif
|
||||
] );
|
||||
|
||||
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 $projectemployee;
|
||||
}
|
||||
|
||||
return $details;
|
||||
}
|
||||
public static function createProjectEmployee( $projectID )
|
||||
{
|
||||
$projectemployee = Projectemployee::create( [
|
||||
'project_id' => $projectID
|
||||
] );
|
||||
|
||||
public static function firstOrCreateProjectemployee( $userID, $projectID )
|
||||
{
|
||||
$projectemployee = self::whereUserId($userID)->whereProjectId($projectID);
|
||||
return $projectemployee->id;
|
||||
}
|
||||
|
||||
if( $projectemployee->count() > 0 ) return $projectemployee->first();
|
||||
public static function saveProjectemployee( $projectemployeeID, $projectemployee )
|
||||
{
|
||||
Projectemployee::whereId( $projectemployeeID )
|
||||
->update( $projectemployee );
|
||||
}
|
||||
|
||||
$user = User::find( $userID );
|
||||
public static function removeProjectemployee( $projectemployeeID )
|
||||
{
|
||||
Projectemployee::whereId( $projectemployeeID )->delete();
|
||||
}
|
||||
|
||||
$tarif = $user ? $user->hourlyrate : 0;
|
||||
|
||||
$projectemployee = Projectemployee::create( [
|
||||
'project_id' => $projectID,
|
||||
'user_id' => $userID,
|
||||
'tarif' => $tarif
|
||||
] );
|
||||
|
||||
return $projectemployee;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@
|
||||
<table class="main" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="alert alert-warning">
|
||||
Nieuw wachtwoord DBOIS De Beleidsonderzoeker
|
||||
Nieuw wachtwoord DBOIS De Beleidsonderzoekers
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -311,7 +311,7 @@
|
||||
<table class="main" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="alert alert-warning">
|
||||
Wachtwoord De Beleidsonderzoeker
|
||||
Wachtwoord De Beleidsonderzoekers
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<link rel="icon" href="css/images/dbo-01-80x80.png" type="image/png">
|
||||
|
||||
<title>** De Beleidsonderzoeker **</title>
|
||||
<title>** De Beleidsonderzoekers **</title>
|
||||
|
||||
<?php $this->load->view( 'partials/_css' ); ?>
|
||||
|
||||
|
||||
@@ -169,11 +169,21 @@
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="10" class="table-cyanish-header"></th>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="3" class="table-cyanish-header"></th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalInvoiceamount())"></span>
|
||||
</th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalInclBtw())"></span>
|
||||
</th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalOutstanding())"></span>
|
||||
</th>
|
||||
<th colspan="2" class="table-cyanish-header"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newInvoice">
|
||||
@@ -184,4 +194,4 @@
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -110,6 +110,20 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="3" class="table-cyanish-header"></th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalCosts())"></span>
|
||||
</th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalPayed())"></span>
|
||||
</th>
|
||||
<th class="table-cyanish-header"></th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalToPay())"></span>
|
||||
</th>
|
||||
<th class="table-cyanish-header"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newProjectcost">
|
||||
@@ -120,4 +134,4 @@
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
budget onderaannemers (incl. btw)
|
||||
gereserveerd op spaarrekening (incl. btw)
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
@@ -49,6 +49,12 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalReservationamount())"></span>
|
||||
</th>
|
||||
<th class="table-cyanish-header" colspan="2"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="4">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:addReservation">
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
</div>
|
||||
|
||||
<footer class="page-copyright page-copyright-inverse">
|
||||
<p>© 2018. De Beleidsonderzoeker.</p>
|
||||
<p>© 2018. De Beleidsonderzoekers</p>
|
||||
<!-- <p style="font-size:.8em">powered by: Pensare Software</p>-->
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<th width="17%">project</th>
|
||||
<th width="10%" class="align-right">Kosten derden</th>
|
||||
<th width="10%" class="align-right">factuur INK</th>
|
||||
<th width="10%" class="align-right">budget onderaannemers</th>
|
||||
<th width="10%" class="align-right">gereserveerd op<br/>spaarrekening</th>
|
||||
<th width="10%" class="align-right">betaald</th>
|
||||
<th width="10%" class="align-right">saldo te<br />betalen</th>
|
||||
<th width="10%" class="align-right">betaald via<br />reserveringen</th>
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
<table class="table" style="font-size:.8em;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="rotate">
|
||||
<div><span>projectnummer</span></div>
|
||||
<th class="rotate sorting-field">
|
||||
<div data-bind="click:setSorting.bind($data, 'projectnumber')">
|
||||
<span>projectnummer</span>
|
||||
</div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>instroom</span></div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>naam</span></div>
|
||||
<th class="rotate sorting-field">
|
||||
<div data-bind="click:setSorting.bind($data, 'projectname')">
|
||||
<span>naam</span>
|
||||
</div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>opdrachtgever</span></div>
|
||||
<th class="rotate sorting-field">
|
||||
<div data-bind="click:setSorting.bind($data, 'CUS.name')">
|
||||
<span>opdrachtgever</span>
|
||||
</div>
|
||||
</th>
|
||||
<!-- ko foreach: uniqueEmployees -->
|
||||
<th class="rotate">
|
||||
@@ -43,6 +49,32 @@
|
||||
<div><span>Volgende boekjaren</span></div>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="align-right" colspan="4">totaal</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalRevenue"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalOwnRevenue"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeRevenues"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalAvailableRevenues"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalOwp"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalCurrentFinancialYear"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalNextFinancialYear"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:recap">
|
||||
<tr>
|
||||
@@ -79,32 +111,6 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th class="align-right" colspan="4">totaal</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalRevenue"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalOwnRevenue"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeRevenues"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalAvailableRevenues"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalOwp"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalCurrentFinancialYear"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalNextFinancialYear"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="rotate">
|
||||
<div><span>projectnummer</span></div>
|
||||
<div data-bind="click:setSorting.bind($data, 'projectnumber')">
|
||||
<span>projectnummer</span>
|
||||
</div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>instroom</span></div>
|
||||
@@ -11,10 +13,14 @@
|
||||
<div><span>uitstroom</span></div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>naam</span></div>
|
||||
<div data-bind="click:setSorting.bind($data, 'projectname')">
|
||||
<span>naam</span>
|
||||
</div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>opdrachtgever</span></div>
|
||||
<div data-bind="click:setSorting.bind($data, 'CUS.name')">
|
||||
<span>opdrachtgever</span>
|
||||
</div>
|
||||
</th>
|
||||
<!-- ko foreach: uniqueEmployees -->
|
||||
<th class="rotate">
|
||||
@@ -33,6 +39,25 @@
|
||||
<div><span>totaal beschikbare uren</span></div>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="align-right" colspan="5">totaal</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalHours"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeHours"></span>
|
||||
</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalAvailableHours"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeAvailableHours"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:recap">
|
||||
<tr>
|
||||
@@ -60,24 +85,5 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th class="align-right" colspan="5">totaal</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalHours"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeHours"></span>
|
||||
</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalAvailableHours"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeAvailableHours"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user