Merge branch 'master' of bitbucket.org:pensare/dbois
# Conflicts: # application/views/modals/partials/_reservations.php # application/views/pages/reservations_view.php
This commit is contained in:
@@ -60,12 +60,19 @@ class usersController extends MY_Controller {
|
|||||||
$this->json( $userActiveProjects );
|
$this->json( $userActiveProjects );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUniqueprojectEmployees()
|
public function getUniqueprojectEmployees()
|
||||||
{
|
{
|
||||||
$projectEmployees = User::getUniqueProjectUsers();
|
$projectEmployees = User::getUniqueProjectUsers();
|
||||||
|
|
||||||
$this->json( $projectEmployees );
|
$this->json( $projectEmployees );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getUniqueEmployeesWithActivity($archive)
|
||||||
|
{
|
||||||
|
$projectEmployees = Projectemployee::getUniqueEmployeesWithActivity($archive);
|
||||||
|
|
||||||
|
$this->json( $projectEmployees );
|
||||||
|
}
|
||||||
|
|
||||||
public function saveUser()
|
public function saveUser()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,10 @@ class ReportsController extends MY_Controller {
|
|||||||
|
|
||||||
public function recapProjects( $archive )
|
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();
|
$projects = $recapprojects->getProjects();
|
||||||
|
|
||||||
@@ -84,4 +87,4 @@ class ReportsController extends MY_Controller {
|
|||||||
Project::whereId( $projectID )->update( ['current_financial_year' => $amount] );
|
Project::whereId( $projectID )->update( ['current_financial_year' => $amount] );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,11 @@ class Recapprojects {
|
|||||||
|
|
||||||
private $ci;
|
private $ci;
|
||||||
private $index;
|
private $index;
|
||||||
|
private $field;
|
||||||
private $archive;
|
private $archive;
|
||||||
private $project;
|
private $project;
|
||||||
private $projects;
|
private $projects;
|
||||||
|
private $direction;
|
||||||
private $employeeHours;
|
private $employeeHours;
|
||||||
private $invoicedYears = [];
|
private $invoicedYears = [];
|
||||||
private $projectTotals;
|
private $projectTotals;
|
||||||
@@ -23,11 +25,13 @@ class Recapprojects {
|
|||||||
private $projectEmployeeDetail;
|
private $projectEmployeeDetail;
|
||||||
private $projectEmployeeDetails;
|
private $projectEmployeeDetails;
|
||||||
|
|
||||||
public function __construct( $archive )
|
public function __construct( $archive, $field, $direction )
|
||||||
{
|
{
|
||||||
$this->ci =& get_instance();
|
$this->ci =& get_instance();
|
||||||
|
|
||||||
$this->archive = $archive;
|
$this->archive = $archive;
|
||||||
|
$this->field = $field;
|
||||||
|
$this->direction = $direction;
|
||||||
|
|
||||||
$this->ci->load->Model( 'projects/Invoices_model' );
|
$this->ci->load->Model( 'projects/Invoices_model' );
|
||||||
|
|
||||||
@@ -54,12 +58,14 @@ class Recapprojects {
|
|||||||
|
|
||||||
private function setProjects()
|
private function setProjects()
|
||||||
{
|
{
|
||||||
$this->projects = Project::getActiveProjects( $this->archive )->toArray();
|
$this->projects = Project::getActiveProjects(
|
||||||
|
$this->archive, $this->field, $this->direction )->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setUniqueEmployees()
|
private function setUniqueEmployees()
|
||||||
{
|
{
|
||||||
$this->uniqueEmployees = Projectemployee::getUniqueProjectEmployees();
|
$this->uniqueEmployees =
|
||||||
|
Projectemployee::getUniqueEmployeesWithActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function loopProjects()
|
private function loopProjects()
|
||||||
@@ -272,4 +278,4 @@ class Recapprojects {
|
|||||||
$this->index ++;
|
$this->index ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,104 +8,105 @@
|
|||||||
|
|
||||||
class Invoices {
|
class Invoices {
|
||||||
|
|
||||||
private $year;
|
private $year;
|
||||||
private $project;
|
private $project;
|
||||||
private $projects;
|
private $projects;
|
||||||
private $monthPayment;
|
private $monthPayment;
|
||||||
private $monthPayments;
|
private $monthPayments;
|
||||||
private $monthForecast;
|
private $monthForecast;
|
||||||
private $monthForecasts;
|
private $monthForecasts;
|
||||||
private $invoiceOverview;
|
private $invoiceOverview;
|
||||||
private $invoiceForecast;
|
private $invoiceForecast;
|
||||||
private $invoiceForecasts;
|
private $invoiceForecasts;
|
||||||
private $invoiceOverviews = [];
|
private $invoiceOverviews = [];
|
||||||
private $invoiceReport = [];
|
private $invoiceReport = [];
|
||||||
private $orderType;
|
private $orderType;
|
||||||
private $orderDirection;
|
private $orderDirection;
|
||||||
private $archive;
|
private $archive;
|
||||||
|
|
||||||
public function __construct( $year, $orderType, $orderDirection, $archive )
|
public function __construct( $year, $orderType, $orderDirection, $archive )
|
||||||
{
|
{
|
||||||
$this->year = $year;
|
$this->year = $year;
|
||||||
$this->orderType = $orderType;
|
$this->orderType = $orderType;
|
||||||
$this->orderDirection = $orderDirection;
|
$this->orderDirection = $orderDirection;
|
||||||
$this->archive = $archive;
|
$this->archive = $archive;
|
||||||
|
|
||||||
$this->handle();
|
$this->handle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getInvoiceReport()
|
public function getInvoiceReport()
|
||||||
{
|
{
|
||||||
return $this->invoiceReport;
|
return $this->invoiceReport;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function handle()
|
private function handle()
|
||||||
{
|
{
|
||||||
$this->setProjects();
|
$this->setProjects();
|
||||||
|
|
||||||
$this->loopProjects();
|
$this->loopProjects();
|
||||||
|
|
||||||
$this->setInvoiceReport();
|
//only projects with payments also archived projects
|
||||||
}
|
$this->setMonthPayments();
|
||||||
|
|
||||||
private function setProjects()
|
$this->setInvoiceReport();
|
||||||
{
|
}
|
||||||
$this->projects =
|
|
||||||
Project::getProjectsForReport( $this->orderType, $this->orderDirection, $this->archive );
|
|
||||||
}
|
|
||||||
|
|
||||||
private function loopProjects()
|
private function setProjects()
|
||||||
{
|
{
|
||||||
foreach ( $this->projects as $this->project )
|
$this->projects =
|
||||||
{
|
Project::getProjectsForReport( $this->orderType, $this->orderDirection, $this->archive );
|
||||||
$this->setInvoiceOverview();
|
}
|
||||||
|
|
||||||
$this->setInvoiceForecasts();
|
private function loopProjects()
|
||||||
|
{
|
||||||
|
foreach ( $this->projects as $this->project )
|
||||||
|
{
|
||||||
|
$this->setInvoiceOverview();
|
||||||
|
|
||||||
$this->setMonthForecasts();
|
$this->setInvoiceForecasts();
|
||||||
|
|
||||||
$this->setMonthPayments();
|
$this->setMonthForecasts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setInvoiceOverview()
|
private function setInvoiceOverview()
|
||||||
{
|
{
|
||||||
$this->invoiceOverview = new InvoiceOverview( $this->project, $this->year );
|
$this->invoiceOverview = new InvoiceOverview( $this->project, $this->year );
|
||||||
|
|
||||||
$this->invoiceOverviews[] = $this->invoiceOverview->getProjectDetails();
|
$this->invoiceOverviews[] = $this->invoiceOverview->getProjectDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setInvoiceForecasts()
|
private function setInvoiceForecasts()
|
||||||
{
|
{
|
||||||
$this->invoiceForecast =
|
$this->invoiceForecast =
|
||||||
new InvoiceForecast( $this->project, $this->invoiceOverview->getNeedinvoice(), $this->year );
|
new InvoiceForecast( $this->project, $this->invoiceOverview->getNeedinvoice(), $this->year );
|
||||||
|
|
||||||
$this->invoiceForecasts[] = $this->invoiceForecast->getProjectDetails();
|
$this->invoiceForecasts[] = $this->invoiceForecast->getProjectDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMonthForecasts()
|
public function setMonthForecasts()
|
||||||
{
|
{
|
||||||
$this->monthForecast =
|
$this->monthForecast =
|
||||||
new MonthForecast( $this->invoiceForecast, $this->project, $this->year );
|
new MonthForecast( $this->invoiceForecast, $this->project, $this->year );
|
||||||
|
|
||||||
$this->monthForecasts[] = $this->monthForecast->getProjectDetails();
|
$this->monthForecasts[] = $this->monthForecast->getProjectDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMonthPayments()
|
public function setMonthPayments()
|
||||||
{
|
{
|
||||||
$this->monthPayment =
|
$monthPayment = new MonthPayments(
|
||||||
new MonthPayments( $this->project, $this->year );
|
$this->year, $this->orderType, $this->orderDirection );
|
||||||
|
|
||||||
$this->monthPayments[] = $this->monthPayment->getProjectDetails();
|
$this->monthPayments = $monthPayment->getProjectDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setInvoiceReport()
|
private function setInvoiceReport()
|
||||||
{
|
{
|
||||||
$this->invoiceReport = [
|
$this->invoiceReport = [
|
||||||
'invoiceOverview' => $this->invoiceOverviews,
|
'invoiceOverview' => $this->invoiceOverviews,
|
||||||
'forecasts' => $this->invoiceForecasts,
|
'forecasts' => $this->invoiceForecasts,
|
||||||
'monthForecasts' => $this->monthForecasts,
|
'monthForecasts' => $this->monthForecasts,
|
||||||
'monthPayments' => $this->monthPayments
|
'monthPayments' => $this->monthPayments
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,96 +8,119 @@
|
|||||||
|
|
||||||
class MonthPayments {
|
class MonthPayments {
|
||||||
|
|
||||||
private $year;
|
private $year;
|
||||||
private $project;
|
private $project;
|
||||||
private $payment;
|
private $payment;
|
||||||
private $customer;
|
private $customer;
|
||||||
private $projectname;
|
private $projectname;
|
||||||
private $monthPayments;
|
private $monthPayments;
|
||||||
private $projectDetails;
|
private $projectDetails;
|
||||||
private $totalProjectPayments;
|
private $projectsWithPayments;
|
||||||
|
private $totalProjectPayments;
|
||||||
|
private $orderType;
|
||||||
|
private $orderDirection;
|
||||||
|
|
||||||
public function __construct( $project, $year )
|
public function __construct( $year, $orderType, $orderDirection )
|
||||||
{
|
{
|
||||||
$this->project = $project;
|
$this->year = $year;
|
||||||
$this->year = $year;
|
$this->orderType = $orderType;
|
||||||
|
$this->orderDirection = $orderDirection;
|
||||||
|
|
||||||
$this->handle();
|
$this->handle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getProjectDetails()
|
public function getProjectDetails()
|
||||||
{
|
{
|
||||||
return $this->projectDetails;
|
return $this->projectDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function handle()
|
private function handle()
|
||||||
{
|
{
|
||||||
$this->setProjectname();
|
$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->setCustomer();
|
||||||
{
|
|
||||||
$this->projectname = $this->project->projectname . '(' . $this->project->projectnumber . ')';
|
|
||||||
}
|
|
||||||
|
|
||||||
private function setCustomer()
|
$this->setInitialsMonthPayments();
|
||||||
{
|
|
||||||
$this->customer = $this->project->customer->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function setInitialsMonthPayments()
|
$this->loopPayments();
|
||||||
{
|
|
||||||
for ( $i = 1; $i <= 12; $i ++ )
|
|
||||||
{
|
|
||||||
$this->monthPayments[ $i ] = ['paymentamount' => 0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function loopPayments()
|
$this->setProjectDetails();
|
||||||
{
|
}
|
||||||
foreach ( $this->project->invoices as $invoice )
|
}
|
||||||
{
|
|
||||||
foreach($invoice->payments as $this->payment)
|
|
||||||
{
|
|
||||||
$this->setMonthPayments();
|
|
||||||
|
|
||||||
$this->setTotalProjectPayments();
|
private function setProjectname()
|
||||||
}
|
{
|
||||||
}
|
$this->projectname = $this->project->projectname . '(' . $this->project->projectnumber . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setMonthPayments()
|
private function setCustomer()
|
||||||
{
|
{
|
||||||
$paymentYear = date( 'Y', strtotime( $this->payment->paymentdate ) );
|
$this->customer = $this->project->customer->name;
|
||||||
$paymentMonth = date( 'n', strtotime( $this->payment->paymentdate ) );
|
}
|
||||||
|
|
||||||
if ( $paymentYear == $this->year )
|
private function setInitialsMonthPayments()
|
||||||
$this->monthPayments[ $paymentMonth ]['paymentamount'] += $this->payment->paymentamount;
|
{
|
||||||
}
|
for ( $i = 1; $i <= 12; $i ++ )
|
||||||
|
{
|
||||||
|
$this->monthPayments[ $i ] = ['paymentamount' => 0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function setTotalProjectPayments()
|
private function loopPayments()
|
||||||
{
|
{
|
||||||
$paymentYear = date( 'Y', strtotime( $this->payment->paymentdate ) );
|
foreach ( $this->project->invoices as $invoice )
|
||||||
|
{
|
||||||
|
foreach ( $invoice->payments as $this->payment )
|
||||||
|
{
|
||||||
|
$this->setMonthPayments();
|
||||||
|
|
||||||
if ( $paymentYear == $this->year )
|
$this->setTotalProjectPayments();
|
||||||
$this->totalProjectPayments += $this->payment->paymentamount;
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function setProjectDetails()
|
private function setMonthPayments()
|
||||||
{
|
{
|
||||||
$this->projectDetails = [
|
$paymentYear = date( 'Y', strtotime( $this->payment->paymentdate ) );
|
||||||
'projectname' => $this->projectname,
|
$paymentMonth = date( 'n', strtotime( $this->payment->paymentdate ) );
|
||||||
'customer' => $this->customer,
|
|
||||||
'monthPayments' => $this->monthPayments,
|
if ( $paymentYear == $this->year )
|
||||||
'totalProjectPayments' => number_format( $this->totalProjectPayments, 0, ',', '.' )
|
$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;
|
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 )
|
public static function savePayment( $paymentID, $payment )
|
||||||
{
|
{
|
||||||
$payment = (array) $payment;
|
$payment = (array) $payment;
|
||||||
@@ -50,4 +61,4 @@ class Payment extends BaseModel {
|
|||||||
Payment::whereId( $paymentID )->delete();
|
Payment::whereId( $paymentID )->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class Project extends BaseModel {
|
|||||||
Project::whereId( $projectID )->delete();
|
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,
|
$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" )
|
projectname, CUS.name, OFF.own_revenue, OFF.other_revenue" )
|
||||||
@@ -106,6 +106,8 @@ class Project extends BaseModel {
|
|||||||
->groupBy( 'OFF.own_revenue' )
|
->groupBy( 'OFF.own_revenue' )
|
||||||
->groupBy( 'OFF.other_revenue' );
|
->groupBy( 'OFF.other_revenue' );
|
||||||
|
|
||||||
|
if ( $sortField ) $projects = $projects->orderBy( $sortField, $direction );
|
||||||
|
|
||||||
if ( $archive == 'F' ) $projects = $projects->where( 'projects.archive', '=', 'F' );
|
if ( $archive == 'F' ) $projects = $projects->where( 'projects.archive', '=', 'F' );
|
||||||
|
|
||||||
$projects = $projects->get();
|
$projects = $projects->get();
|
||||||
@@ -113,12 +115,14 @@ class Project extends BaseModel {
|
|||||||
return $projects;
|
return $projects;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getProjectsForReport( $orderType, $orderDirection, $archive = 'F' )
|
public static function getProjectsForReport( $orderType, $orderDirection, $archive = 'F', $projectsArray = FALSE )
|
||||||
{
|
{
|
||||||
$projects = self::getBaseProject();
|
$projects = self::getBaseProject();
|
||||||
|
|
||||||
if ( $archive == 'F' ) $projects = $projects->whereArchive( 'F' );
|
if ( $archive == 'F' ) $projects = $projects->whereArchive( 'F' );
|
||||||
|
|
||||||
|
if ( is_array( $projectsArray ) ) $projects = $projects->whereIn( 'id', $projectsArray );
|
||||||
|
|
||||||
$projects = $projects->orderBy( $orderType, $orderDirection )->get();
|
$projects = $projects->orderBy( $orderType, $orderDirection )->get();
|
||||||
|
|
||||||
return $projects;
|
return $projects;
|
||||||
|
|||||||
@@ -8,94 +8,112 @@
|
|||||||
|
|
||||||
class Projectemployee extends BaseModel {
|
class Projectemployee extends BaseModel {
|
||||||
|
|
||||||
public function project()
|
public function project()
|
||||||
{
|
{
|
||||||
return $this->belongsTo( '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()
|
public static function getProjectemployeeDetailsPerProject( $projectID )
|
||||||
{
|
{
|
||||||
return $this->belongsTo( 'User' );
|
$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' );
|
||||||
|
$details = $details->get();
|
||||||
|
|
||||||
public function projecthours()
|
return $details;
|
||||||
{
|
}
|
||||||
return $this->hasMany( 'Projecthour' );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getAvailableEmployees( $projectID )
|
public static function firstOrCreateProjectemployee( $userID, $projectID )
|
||||||
{
|
{
|
||||||
$currentEmployees = Self::whereProjectId( $projectID )
|
$projectemployee = self::whereUserId( $userID )->whereProjectId( $projectID );
|
||||||
->lists( 'user_id' );
|
|
||||||
|
|
||||||
$availableEmployees = User::selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" )
|
if ( $projectemployee->count() > 0 ) return $projectemployee->first();
|
||||||
->whereNotIn( 'id', $currentEmployees )
|
|
||||||
->whereArchive( 'F' )
|
|
||||||
->get();
|
|
||||||
|
|
||||||
return $availableEmployees;
|
$user = User::find( $userID );
|
||||||
}
|
|
||||||
|
|
||||||
public static function getUniqueProjectEmployees()
|
$tarif = $user ? $user->hourlyrate : 0;
|
||||||
{
|
|
||||||
$projectemployees = Projectemployee::selectRaw( "USR.id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" )
|
|
||||||
->distinct()
|
|
||||||
->join( 'users AS USR', 'USR.id', '=', 'projectemployees.user_id' )
|
|
||||||
->get();
|
|
||||||
|
|
||||||
return $projectemployees;
|
$projectemployee = Projectemployee::create( [
|
||||||
}
|
'project_id' => $projectID,
|
||||||
|
'user_id' => $userID,
|
||||||
|
'tarif' => $tarif
|
||||||
|
] );
|
||||||
|
|
||||||
public static function getProjectemployeeDetailsPerProject( $projectID )
|
return $projectemployee;
|
||||||
{
|
}
|
||||||
$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
|
||||||
|
] );
|
||||||
|
|
||||||
public static function firstOrCreateProjectemployee( $userID, $projectID )
|
return $projectemployee->id;
|
||||||
{
|
}
|
||||||
$projectemployee = self::whereUserId($userID)->whereProjectId($projectID);
|
|
||||||
|
|
||||||
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">
|
<table class="main" width="100%" cellpadding="0" cellspacing="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="alert alert-warning">
|
<td class="alert alert-warning">
|
||||||
Nieuw wachtwoord DBOIS De Beleidsonderzoeker
|
Nieuw wachtwoord DBOIS De Beleidsonderzoekers
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -311,7 +311,7 @@
|
|||||||
<table class="main" width="100%" cellpadding="0" cellspacing="0">
|
<table class="main" width="100%" cellpadding="0" cellspacing="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="alert alert-warning">
|
<td class="alert alert-warning">
|
||||||
Wachtwoord De Beleidsonderzoeker
|
Wachtwoord De Beleidsonderzoekers
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<link rel="icon" href="css/images/dbo-01-80x80.png" type="image/png">
|
<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' ); ?>
|
<?php $this->load->view( 'partials/_css' ); ?>
|
||||||
|
|
||||||
|
|||||||
@@ -169,11 +169,21 @@
|
|||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<th colspan="10" class="table-cyanish-header"></th>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<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>
|
<tr>
|
||||||
<td colspan="5">
|
<td colspan="5">
|
||||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newInvoice">
|
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newInvoice">
|
||||||
@@ -184,4 +194,4 @@
|
|||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -110,6 +110,20 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<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>
|
<tr>
|
||||||
<td colspan="8">
|
<td colspan="8">
|
||||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newProjectcost">
|
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newProjectcost">
|
||||||
@@ -120,4 +134,4 @@
|
|||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<div class="panel panel-bordered panel-primary panel-line">
|
<div class="panel panel-bordered panel-primary panel-line">
|
||||||
<div class="panel-heading panel-heading-project">
|
<div class="panel-heading panel-heading-project">
|
||||||
<h3 class="">
|
<h3 class="">
|
||||||
budget gereserveerd (incl. btw)
|
gereserveerd op spaarrekening (incl. btw)
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body panel-body-project">
|
<div class="panel-body panel-body-project">
|
||||||
@@ -49,6 +49,12 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<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>
|
<tr>
|
||||||
<th colspan="4">
|
<th colspan="4">
|
||||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:addReservation">
|
<button class="btn btn-primary btn-round btn-sm" data-bind="click:addReservation">
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer class="page-copyright page-copyright-inverse">
|
<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>-->
|
<!-- <p style="font-size:.8em">powered by: Pensare Software</p>-->
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<th width="17%">project</th>
|
<th width="17%">project</th>
|
||||||
<th width="10%" class="align-right">Kosten derden</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">factuur INK</th>
|
||||||
<th width="10%" class="align-right">budget gereserveerd</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">betaald</th>
|
||||||
<th width="10%" class="align-right">saldo te<br />betalen</th>
|
<th width="10%" class="align-right">saldo te<br />betalen</th>
|
||||||
<th width="10%" class="align-right">betaald via<br />reserveringen</th>
|
<th width="10%" class="align-right">betaald via<br />reserveringen</th>
|
||||||
|
|||||||
@@ -1,17 +1,23 @@
|
|||||||
<table class="table" style="font-size:.8em;">
|
<table class="table" style="font-size:.8em;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="rotate">
|
<th class="rotate sorting-field">
|
||||||
<div><span>projectnummer</span></div>
|
<div data-bind="click:setSorting.bind($data, 'projectnumber')">
|
||||||
|
<span>projectnummer</span>
|
||||||
|
</div>
|
||||||
</th>
|
</th>
|
||||||
<th class="rotate">
|
<th class="rotate">
|
||||||
<div><span>instroom</span></div>
|
<div><span>instroom</span></div>
|
||||||
</th>
|
</th>
|
||||||
<th class="rotate">
|
<th class="rotate sorting-field">
|
||||||
<div><span>naam</span></div>
|
<div data-bind="click:setSorting.bind($data, 'projectname')">
|
||||||
|
<span>naam</span>
|
||||||
|
</div>
|
||||||
</th>
|
</th>
|
||||||
<th class="rotate">
|
<th class="rotate sorting-field">
|
||||||
<div><span>opdrachtgever</span></div>
|
<div data-bind="click:setSorting.bind($data, 'CUS.name')">
|
||||||
|
<span>opdrachtgever</span>
|
||||||
|
</div>
|
||||||
</th>
|
</th>
|
||||||
<!-- ko foreach: uniqueEmployees -->
|
<!-- ko foreach: uniqueEmployees -->
|
||||||
<th class="rotate">
|
<th class="rotate">
|
||||||
@@ -43,6 +49,32 @@
|
|||||||
<div><span>Volgende boekjaren</span></div>
|
<div><span>Volgende boekjaren</span></div>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</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>
|
</thead>
|
||||||
<tbody data-bind="foreach:recap">
|
<tbody data-bind="foreach:recap">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -79,32 +111,6 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<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>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="rotate">
|
<th class="rotate">
|
||||||
<div><span>projectnummer</span></div>
|
<div data-bind="click:setSorting.bind($data, 'projectnumber')">
|
||||||
|
<span>projectnummer</span>
|
||||||
|
</div>
|
||||||
</th>
|
</th>
|
||||||
<th class="rotate">
|
<th class="rotate">
|
||||||
<div><span>instroom</span></div>
|
<div><span>instroom</span></div>
|
||||||
@@ -11,10 +13,14 @@
|
|||||||
<div><span>uitstroom</span></div>
|
<div><span>uitstroom</span></div>
|
||||||
</th>
|
</th>
|
||||||
<th class="rotate">
|
<th class="rotate">
|
||||||
<div><span>naam</span></div>
|
<div data-bind="click:setSorting.bind($data, 'projectname')">
|
||||||
|
<span>naam</span>
|
||||||
|
</div>
|
||||||
</th>
|
</th>
|
||||||
<th class="rotate">
|
<th class="rotate">
|
||||||
<div><span>opdrachtgever</span></div>
|
<div data-bind="click:setSorting.bind($data, 'CUS.name')">
|
||||||
|
<span>opdrachtgever</span>
|
||||||
|
</div>
|
||||||
</th>
|
</th>
|
||||||
<!-- ko foreach: uniqueEmployees -->
|
<!-- ko foreach: uniqueEmployees -->
|
||||||
<th class="rotate">
|
<th class="rotate">
|
||||||
@@ -33,6 +39,25 @@
|
|||||||
<div><span>totaal beschikbare uren</span></div>
|
<div><span>totaal beschikbare uren</span></div>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</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>
|
</thead>
|
||||||
<tbody data-bind="foreach:recap">
|
<tbody data-bind="foreach:recap">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -60,24 +85,5 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<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>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -103,6 +103,10 @@ th.rotate > div > span {
|
|||||||
border-right: 1px solid #ccc;
|
border-right: 1px solid #ccc;
|
||||||
border-bottom: 1px solid #ccc;
|
border-bottom: 1px solid #ccc;
|
||||||
}
|
}
|
||||||
|
th.sorting-field:hover{
|
||||||
|
cursor: pointer;
|
||||||
|
color:#222;
|
||||||
|
}
|
||||||
.pie-test{
|
.pie-test{
|
||||||
width:20px;
|
width:20px;
|
||||||
height:20px;
|
height:20px;
|
||||||
|
|||||||
@@ -8,32 +8,36 @@
|
|||||||
|
|
||||||
dbo.reportsDataService = {
|
dbo.reportsDataService = {
|
||||||
|
|
||||||
getUsedYears: function ( callback ) {
|
getUsedYears: function ( callback ) {
|
||||||
$.getJSON( 'index.php/reports/reportsdefaultController/getUsedYears' )
|
$.getJSON( 'index.php/reports/reportsdefaultController/getUsedYears' )
|
||||||
.done( function ( data ) {
|
.done( function ( data ) {
|
||||||
callback( data );
|
callback( data );
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
getRecapProjects: function(archive, callback){
|
getRecapProjects: function ( field, direction, archive, callback ) {
|
||||||
$.getJSON( 'index.php/reports/reportsController/recapProjects/' + archive )
|
var submitDATA = {
|
||||||
.done( function ( data ) {
|
field : field,
|
||||||
callback( data );
|
direction: direction
|
||||||
} );
|
};
|
||||||
},
|
$.post( 'index.php/reports/reportsController/recapProjects/' + archive, submitDATA )
|
||||||
|
.done( function ( data ) {
|
||||||
|
callback( data );
|
||||||
|
}, 'JSON' );
|
||||||
|
},
|
||||||
|
|
||||||
getEmployeeHours: function ( employeeID, year, callback ) {
|
getEmployeeHours: function ( employeeID, year, callback ) {
|
||||||
$.getJSON( 'index.php/reports/reportsController/getMonthlyEmployeeHoursPerProject/' + employeeID + '/' + year )
|
$.getJSON( 'index.php/reports/reportsController/getMonthlyEmployeeHoursPerProject/' + employeeID + '/' + year )
|
||||||
.done( function ( data ) {
|
.done( function ( data ) {
|
||||||
callback( data );
|
callback( data );
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
saveCurrentFinnacialYear: function(projectID, amount, callback){
|
saveCurrentFinnacialYear: function ( projectID, amount, callback ) {
|
||||||
$.post( 'index.php/reports/reportsController/saveCurrentFinnacialYear/' + projectID, {amount:amount} )
|
$.post( 'index.php/reports/reportsController/saveCurrentFinnacialYear/' + projectID, {amount: amount} )
|
||||||
.done( function ( data ) {
|
.done( function ( data ) {
|
||||||
callback( data );
|
callback( data );
|
||||||
}, 'json' );
|
}, 'json' );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,12 +42,19 @@ dbo.userDataService = {
|
|||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
getUniqueProjectEmployees: function ( callback ) {
|
getUniqueProjectEmployees: function ( callback ) {
|
||||||
$.post( 'index.php/beheer/usersController/getUniqueprojectEmployees', 'json' )
|
$.post( 'index.php/beheer/usersController/getUniqueprojectEmployees', 'json' )
|
||||||
.done( function ( data ) {
|
.done( function ( data ) {
|
||||||
callback( data );
|
callback( data );
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getUniqueEmployeesWithActivity: function ( archive, callback ) {
|
||||||
|
$.post( 'index.php/beheer/usersController/getUniqueEmployeesWithActivity/' + archive, 'json' )
|
||||||
|
.done( function ( data ) {
|
||||||
|
callback( data );
|
||||||
|
} );
|
||||||
|
},
|
||||||
|
|
||||||
checkUsername: function ( username, callback ) {
|
checkUsername: function ( username, callback ) {
|
||||||
$.post( 'index.php/beheer/userController/checkUsername', 'json' )
|
$.post( 'index.php/beheer/userController/checkUsername', 'json' )
|
||||||
|
|||||||
+1118
-1088
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -8,251 +8,252 @@
|
|||||||
|
|
||||||
dbo.invoicereportInit = function () {
|
dbo.invoicereportInit = function () {
|
||||||
|
|
||||||
if ( dbo.invoicereport !== undefined ) {
|
if ( dbo.invoicereport !== undefined ) {
|
||||||
|
|
||||||
dbo.invoicereport.initModule();
|
dbo.invoicereport.initModule();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dbo.invoicereport = {
|
dbo.invoicereport = {
|
||||||
|
|
||||||
selectedYear : ko.observable(),
|
selectedYear : ko.observable(),
|
||||||
invoiceOverview : ko.observableArray( [] ),
|
invoiceOverview : ko.observableArray( [] ),
|
||||||
forecasts : ko.observableArray( [] ),
|
forecasts : ko.observableArray( [] ),
|
||||||
monthForecasts : ko.observableArray( [] ),
|
monthForecasts : ko.observableArray( [] ),
|
||||||
monthPayments : ko.observableArray( [] ),
|
monthPayments : ko.observableArray( [] ),
|
||||||
months : ko.observableArray( [] ),
|
months : ko.observableArray( [] ),
|
||||||
monthTotals : ko.observableArray( [] ),
|
monthTotals : ko.observableArray( [] ),
|
||||||
monthPaymentTotals : ko.observableArray( [] ),
|
monthPaymentTotals : ko.observableArray( [] ),
|
||||||
validYear : ko.observable(),
|
validYear : ko.observable(),
|
||||||
invoiceTab : ko.observable(),
|
invoiceTab : ko.observable(),
|
||||||
totalToInvoicingExcl : ko.observable(),
|
totalToInvoicingExcl : ko.observable(),
|
||||||
totalToInvoicingIncl : ko.observable(),
|
totalToInvoicingIncl : ko.observable(),
|
||||||
totalInvoicedOtherYears: ko.observable(),
|
totalInvoicedOtherYears: ko.observable(),
|
||||||
totalInvoicedThisYear : ko.observable(),
|
totalInvoicedThisYear : ko.observable(),
|
||||||
totalPayment : ko.observable(),
|
totalPayment : ko.observable(),
|
||||||
totalToPay : ko.observable(),
|
totalToPay : ko.observable(),
|
||||||
invoicesTotal : ko.observable(),
|
invoicesTotal : ko.observable(),
|
||||||
needInvoice : ko.observable(),
|
needInvoice : ko.observable(),
|
||||||
forecastThisYear : ko.observable(),
|
forecastThisYear : ko.observable(),
|
||||||
forecastOtherYears : ko.observable(),
|
forecastOtherYears : ko.observable(),
|
||||||
forecastRemaining : ko.observable(),
|
forecastRemaining : ko.observable(),
|
||||||
totalProjectPayments : ko.observable(),
|
totalProjectPayments : ko.observable(),
|
||||||
orderType : 'projectnumber',
|
orderType : 'projectnumber',
|
||||||
orderDirection : false,
|
orderDirection : false,
|
||||||
archive : ko.observable( false ),
|
archive : ko.observable( false ),
|
||||||
|
|
||||||
init: function () {
|
init: function () {
|
||||||
var vm = dbo.invoicereport;
|
var vm = dbo.invoicereport;
|
||||||
|
|
||||||
vm.selectedYear( (new Date()).getFullYear() );
|
vm.selectedYear( (new Date()).getFullYear() );
|
||||||
vm.invoiceTab( 'invoice' );
|
vm.invoiceTab( 'invoice' );
|
||||||
vm.validYear( true );
|
vm.validYear( true );
|
||||||
vm.months( dbo.monthArray );
|
vm.months( dbo.monthArray );
|
||||||
|
|
||||||
vm.initModule();
|
vm.initModule();
|
||||||
},
|
},
|
||||||
|
|
||||||
initModule: function () {
|
initModule: function () {
|
||||||
var vm = dbo.invoicereport;
|
var vm = dbo.invoicereport;
|
||||||
|
|
||||||
vm.resetTotals();
|
vm.resetTotals();
|
||||||
|
|
||||||
var orderDirection = vm.orderDirection ? 'ASC' : 'DESC';
|
var orderDirection = vm.orderDirection ? 'ASC' : 'DESC';
|
||||||
var archive = vm.archive() ? 'T' : 'F';
|
var archive = vm.archive() ? 'T' : 'F';
|
||||||
|
|
||||||
dbo.invoiceDataService.getInvoiceOverview( vm.selectedYear(), vm.orderType, orderDirection, archive, function ( data ) {
|
dbo.invoiceDataService.getInvoiceOverview( vm.selectedYear(), vm.orderType, orderDirection, archive, function ( data ) {
|
||||||
vm.invoiceOverview( data.invoiceOverview );
|
vm.invoiceOverview( data.invoiceOverview );
|
||||||
vm.setInvoiceOverviewTotals( data.invoiceOverview );
|
vm.setInvoiceOverviewTotals( data.invoiceOverview );
|
||||||
|
|
||||||
vm.forecasts( data.forecasts );
|
vm.forecasts( data.forecasts );
|
||||||
vm.setForecastsTotals( data.forecasts );
|
vm.setForecastsTotals( data.forecasts );
|
||||||
|
|
||||||
vm.monthForecasts.removeAll();
|
vm.monthForecasts.removeAll();
|
||||||
_.each( data.monthForecasts, function ( p ) {
|
_.each( data.monthForecasts, function ( p ) {
|
||||||
vm.monthForecasts.push( new vm.Monthforecast( p ) );
|
vm.monthForecasts.push( new vm.Monthforecast( p ) );
|
||||||
} );
|
} );
|
||||||
_.each( vm.monthTotals(), function ( p ) {
|
_.each( vm.monthTotals(), function ( p ) {
|
||||||
p.forecastamount( dbo.helpers.thousandSeparator( p.forecastamount() ) );
|
p.forecastamount( dbo.helpers.thousandSeparator( p.forecastamount() ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
vm.monthPayments.removeAll();
|
vm.monthPayments.removeAll();
|
||||||
_.each( data.monthPayments, function ( p ) {
|
_.each( data.monthPayments, function ( p ) {
|
||||||
vm.monthPayments.push( new vm.Monthpayment( p ) );
|
vm.monthPayments.push( new vm.Monthpayment( p ) );
|
||||||
vm.totalProjectPayments( Number( vm.totalProjectPayments() ) + Number( p.totalProjectPayments.replace( '.', '' ) ) );
|
vm.totalProjectPayments( Number( vm.totalProjectPayments() ) + Number( p.totalProjectPayments.replace( '.', '' ) ) );
|
||||||
console.log( vm.totalProjectPayments() );
|
} );
|
||||||
} );
|
vm.totalProjectPayments( dbo.helpers.thousandSeparator( vm.totalProjectPayments() ) );
|
||||||
vm.totalProjectPayments( dbo.helpers.thousandSeparator( vm.totalProjectPayments() ) );
|
_.each( vm.monthPaymentTotals(), function ( p ) {
|
||||||
_.each( vm.monthPaymentTotals(), function ( p ) {
|
p.paymentamount( dbo.helpers.thousandSeparator( p.paymentamount() ) );
|
||||||
p.paymentamount( dbo.helpers.thousandSeparator( p.paymentamount() ) );
|
} );
|
||||||
} );
|
|
||||||
|
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleArchive: function () {
|
toggleArchive: function () {
|
||||||
var vm = dbo.invoicereport;
|
var vm = dbo.invoicereport;
|
||||||
vm.archive( !vm.archive() );
|
vm.archive( !vm.archive() );
|
||||||
|
|
||||||
vm.initModule();
|
vm.initModule();
|
||||||
},
|
},
|
||||||
|
|
||||||
sortList: function ( orderType ) {
|
sortList: function ( orderType ) {
|
||||||
var vm = dbo.invoicereport;
|
var vm = dbo.invoicereport;
|
||||||
|
|
||||||
vm.orderType = orderType;
|
vm.orderType = orderType;
|
||||||
vm.orderDirection = !vm.orderDirection;
|
vm.orderDirection = !vm.orderDirection;
|
||||||
|
|
||||||
vm.initModule();
|
vm.initModule();
|
||||||
},
|
},
|
||||||
|
|
||||||
resetTotals: function () {
|
resetTotals: function () {
|
||||||
var vm = dbo.invoicereport;
|
var vm = dbo.invoicereport;
|
||||||
|
|
||||||
vm.totalToInvoicingExcl( 0 );
|
vm.totalToInvoicingExcl( 0 );
|
||||||
vm.totalToInvoicingIncl( 0 );
|
vm.totalToInvoicingIncl( 0 );
|
||||||
vm.totalInvoicedOtherYears( 0 );
|
vm.totalInvoicedOtherYears( 0 );
|
||||||
vm.totalInvoicedThisYear( 0 );
|
vm.totalInvoicedThisYear( 0 );
|
||||||
vm.invoicesTotal( 0 );
|
vm.invoicesTotal( 0 );
|
||||||
vm.totalPayment( 0 );
|
vm.totalPayment( 0 );
|
||||||
vm.totalToPay( 0 );
|
vm.totalToPay( 0 );
|
||||||
vm.needInvoice( 0 );
|
vm.needInvoice( Number( 0 ) );
|
||||||
vm.forecastThisYear( 0 );
|
vm.forecastThisYear( 0 );
|
||||||
vm.forecastOtherYears( 0 );
|
vm.forecastOtherYears( 0 );
|
||||||
vm.forecastRemaining( 0 );
|
vm.forecastRemaining( 0 );
|
||||||
vm.totalProjectPayments( 0 );
|
vm.totalProjectPayments( 0 );
|
||||||
|
|
||||||
vm.monthTotals.removeAll();
|
vm.monthTotals.removeAll();
|
||||||
vm.monthPaymentTotals.removeAll();
|
vm.monthPaymentTotals.removeAll();
|
||||||
for ( var i = 1; i <= 12; i++ ) {
|
for ( var i = 1; i <= 12; i++ ) {
|
||||||
vm.monthTotals.push( {monthID: i, forecastamount: ko.observable( 0 )} );
|
vm.monthTotals.push( {monthID: i, forecastamount: ko.observable( 0 )} );
|
||||||
vm.monthPaymentTotals.push( {monthID: i, paymentamount: ko.observable( 0 )} );
|
vm.monthPaymentTotals.push( {monthID: i, paymentamount: ko.observable( 0 )} );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setInvoiceOverviewTotals: function ( data ) {
|
setInvoiceOverviewTotals: function ( data ) {
|
||||||
var vm = dbo.invoicereport;
|
var vm = dbo.invoicereport;
|
||||||
|
|
||||||
_.each( data, function ( p ) {
|
_.each( data, function ( p ) {
|
||||||
vm.totalToInvoicingExcl( vm.totalToInvoicingExcl() + Number( p.totalToInvoicingExcl.replace( '.', '' ) ) );
|
vm.totalToInvoicingExcl( vm.totalToInvoicingExcl() + Number( p.totalToInvoicingExcl.replace( '.', '' ) ) );
|
||||||
vm.totalToInvoicingIncl( vm.totalToInvoicingIncl() + Number( p.totalToInvoicingIncl.replace( '.', '' ) ) );
|
vm.totalToInvoicingIncl( vm.totalToInvoicingIncl() + Number( p.totalToInvoicingIncl.replace( '.', '' ) ) );
|
||||||
vm.totalInvoicedOtherYears( vm.totalInvoicedOtherYears() + Number( p.totalInvoicedOtherYears.replace( '.', '' ) ) );
|
vm.totalInvoicedOtherYears( vm.totalInvoicedOtherYears() + Number( p.totalInvoicedOtherYears.replace( '.', '' ) ) );
|
||||||
vm.totalInvoicedThisYear( vm.totalInvoicedThisYear() + Number( p.totalInvoicedThisYear.replace( '.', '' ) ) );
|
vm.totalInvoicedThisYear( vm.totalInvoicedThisYear() + Number( p.totalInvoicedThisYear.replace( '.', '' ) ) );
|
||||||
vm.invoicesTotal( vm.invoicesTotal() + Number( p.invoicesTotal.replace( '.', '' ) ) );
|
vm.invoicesTotal( vm.invoicesTotal() + Number( p.invoicesTotal.replace( '.', '' ) ) );
|
||||||
vm.totalPayment( vm.totalPayment() + Number( p.projectPayment.replace( '.', '' ) ) );
|
vm.totalPayment( vm.totalPayment() + Number( p.projectPayment.replace( '.', '' ) ) );
|
||||||
vm.totalToPay( vm.totalToPay() + Number( p.invoiceToPay.replace( '.', '' ) ) );
|
vm.totalToPay( vm.totalToPay() + Number( p.invoiceToPay.replace( '.', '' ) ) );
|
||||||
vm.needInvoice( vm.needInvoice() + Number( p.needInvoice.replace( '.', '' ) ) );
|
vm.needInvoice( Number( vm.needInvoice() ) + Number( p.needInvoice.replace( '.', '' ) ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
vm.totalToInvoicingExcl( dbo.helpers.thousandSeparator( vm.totalToInvoicingExcl() ) );
|
vm.totalToInvoicingExcl( dbo.helpers.thousandSeparator( vm.totalToInvoicingExcl() ) );
|
||||||
vm.totalToInvoicingIncl( dbo.helpers.thousandSeparator( vm.totalToInvoicingIncl() ) );
|
vm.totalToInvoicingIncl( dbo.helpers.thousandSeparator( vm.totalToInvoicingIncl() ) );
|
||||||
vm.totalInvoicedOtherYears( dbo.helpers.thousandSeparator( vm.totalInvoicedOtherYears() ) );
|
vm.totalInvoicedOtherYears( dbo.helpers.thousandSeparator( vm.totalInvoicedOtherYears() ) );
|
||||||
vm.totalInvoicedThisYear( dbo.helpers.thousandSeparator( vm.totalInvoicedThisYear() ) );
|
vm.totalInvoicedThisYear( dbo.helpers.thousandSeparator( vm.totalInvoicedThisYear() ) );
|
||||||
vm.invoicesTotal( dbo.helpers.thousandSeparator( vm.invoicesTotal() ) );
|
vm.invoicesTotal( dbo.helpers.thousandSeparator( vm.invoicesTotal() ) );
|
||||||
vm.totalPayment( dbo.helpers.thousandSeparator( vm.totalPayment() ) );
|
vm.totalPayment( dbo.helpers.thousandSeparator( vm.totalPayment() ) );
|
||||||
vm.totalToPay( dbo.helpers.thousandSeparator( vm.totalToPay() ) );
|
vm.totalToPay( dbo.helpers.thousandSeparator( vm.totalToPay() ) );
|
||||||
vm.needInvoice( dbo.helpers.thousandSeparator( vm.needInvoice() ) );
|
vm.needInvoice( dbo.helpers.thousandSeparator( vm.needInvoice() ) );
|
||||||
},
|
},
|
||||||
|
|
||||||
setForecastsTotals: function ( data ) {
|
setForecastsTotals: function ( data ) {
|
||||||
var vm = dbo.invoicereport;
|
var vm = dbo.invoicereport;
|
||||||
|
|
||||||
_.each( data, function ( p ) {
|
_.each( data, function ( p ) {
|
||||||
vm.forecastThisYear( vm.forecastThisYear() + Number( p.forecastThisYear.replace( '.', '' ) ) );
|
vm.forecastThisYear( vm.forecastThisYear() + Number( p.forecastThisYear.replace( '.', '' ) ) );
|
||||||
vm.forecastOtherYears( vm.forecastOtherYears() + Number( p.forecastOtherYears.replace( '.', '' ) ) );
|
vm.forecastOtherYears( vm.forecastOtherYears() + Number( p.forecastOtherYears.replace( '.', '' ) ) );
|
||||||
vm.forecastRemaining( vm.forecastRemaining() + Number( p.forecastRemaining.replace( '.', '' ) ) );
|
vm.forecastRemaining( vm.forecastRemaining() + Number( p.forecastRemaining.replace( '.', '' ) ) );
|
||||||
} );
|
} );
|
||||||
vm.forecastThisYear( dbo.helpers.thousandSeparator( vm.forecastThisYear() ) );
|
vm.forecastThisYear( dbo.helpers.thousandSeparator( vm.forecastThisYear() ) );
|
||||||
vm.forecastOtherYears( dbo.helpers.thousandSeparator( vm.forecastOtherYears() ) );
|
vm.forecastOtherYears( dbo.helpers.thousandSeparator( vm.forecastOtherYears() ) );
|
||||||
vm.forecastRemaining( dbo.helpers.thousandSeparator( vm.forecastRemaining() ) );
|
vm.forecastRemaining( dbo.helpers.thousandSeparator( vm.forecastRemaining() ) );
|
||||||
},
|
},
|
||||||
|
|
||||||
setForecastMonthsTotals: function ( data ) {
|
setForecastMonthsTotals: function ( data ) {
|
||||||
var vm = dbo.invoicereport;
|
console.log( data );
|
||||||
|
var vm = dbo.invoicereport;
|
||||||
|
|
||||||
_.each( data, function ( p ) {
|
_.each( data, function ( p ) {
|
||||||
_.each( p.forecastMonths(), function ( q ) {
|
_.each( p.forecastMonths(), function ( q ) {
|
||||||
vm.forecastMonths( vm.forecastMonths() + q );
|
vm.forecastMonths( vm.forecastMonths() + q );
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
checkYear: function () {
|
checkYear: function () {
|
||||||
var vm = dbo.invoicereport;
|
var vm = dbo.invoicereport;
|
||||||
if ( !Number.isInteger( Number( vm.selectedYear() ) ) ) return vm.validYear( false );
|
if ( !Number.isInteger( Number( vm.selectedYear() ) ) ) return vm.validYear( false );
|
||||||
if ( Number( vm.selectedYear() ) > 2100 ) return vm.validYear( false );
|
if ( Number( vm.selectedYear() ) > 2100 ) return vm.validYear( false );
|
||||||
if ( Number( vm.selectedYear() ) < 2000 ) return vm.validYear( false );
|
if ( Number( vm.selectedYear() ) < 2000 ) return vm.validYear( false );
|
||||||
vm.validYear( true );
|
vm.validYear( true );
|
||||||
|
|
||||||
vm.initModule();
|
vm.initModule();
|
||||||
},
|
},
|
||||||
|
|
||||||
setActivetab: function ( page ) {
|
setActivetab: function ( page ) {
|
||||||
var vm = dbo.invoicereport;
|
var vm = dbo.invoicereport;
|
||||||
|
|
||||||
vm.invoiceTab( page );
|
vm.invoiceTab( page );
|
||||||
},
|
},
|
||||||
|
|
||||||
Monthforecast: function ( data ) {
|
Monthforecast: function ( data ) {
|
||||||
var vm = dbo.invoicereport;
|
console.log( data );
|
||||||
var self = this;
|
var vm = dbo.invoicereport;
|
||||||
self.projectnumber = data.projectnumber;
|
var self = this;
|
||||||
self.projectname = data.projectname;
|
self.projectnumber = data.projectnumber;
|
||||||
self.customer = data.customer;
|
self.projectname = data.projectname;
|
||||||
self.needInvoice = data.needInvoice;
|
self.customer = data.customer;
|
||||||
self.forecastOtherYears = data.forecastOtherYears;
|
self.needInvoice = data.needInvoice;
|
||||||
self.forecastRemaining = data.forecastRemaining;
|
self.forecastOtherYears = data.forecastOtherYears;
|
||||||
|
self.forecastRemaining = data.forecastRemaining;
|
||||||
|
|
||||||
self.forecastMonths = ko.observableArray( [] );
|
self.forecastMonths = ko.observableArray( [] );
|
||||||
_.each( data.forecastMonths, function ( p, i ) {
|
_.each( data.forecastMonths, function ( p, i ) {
|
||||||
self.forecastMonths.push( new vm.ForecastMonth( p ) );
|
self.forecastMonths.push( new vm.ForecastMonth( p ) );
|
||||||
_.each( vm.monthTotals(), function ( q ) {
|
_.each( vm.monthTotals(), function ( q ) {
|
||||||
if ( q.monthID == i ) q.forecastamount( Number( q.forecastamount() ) + Number( p.forecastamount ) );
|
if ( q.monthID == (i + 1) ) q.forecastamount( Math.round( Number( q.forecastamount() ) ) + Math.round( Number( p.forecastamount ) ) );
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
ForecastMonth: function ( data ) {
|
ForecastMonth: function ( data ) {
|
||||||
this.forecastamount = dbo.helpers.thousandSeparator( data.forecastamount );
|
this.forecastamount = dbo.helpers.thousandSeparator( Math.round( data.forecastamount ) );
|
||||||
},
|
},
|
||||||
|
|
||||||
Monthpayment: function ( data ) {
|
Monthpayment: function ( data ) {
|
||||||
var vm = dbo.invoicereport;
|
var vm = dbo.invoicereport;
|
||||||
var self = this;
|
var self = this;
|
||||||
self.projectname = data.projectname;
|
self.projectname = data.projectname;
|
||||||
self.customer = data.customer;
|
self.customer = data.customer;
|
||||||
self.totalProjectPayments = data.totalProjectPayments;
|
self.totalProjectPayments = data.totalProjectPayments;
|
||||||
|
|
||||||
self.paymentMonths = ko.observableArray( [] );
|
self.paymentMonths = ko.observableArray( [] );
|
||||||
_.each( data.monthPayments, function ( p, i ) {
|
_.each( data.monthPayments, function ( p, i ) {
|
||||||
self.paymentMonths.push( new vm.PaymentMonth( p ) );
|
self.paymentMonths.push( new vm.PaymentMonth( p ) );
|
||||||
_.each( vm.monthPaymentTotals(), function ( q ) {
|
_.each( vm.monthPaymentTotals(), function ( q ) {
|
||||||
if ( q.monthID == i ) q.paymentamount( Number( q.paymentamount() ) + Number( p.paymentamount ) );
|
if ( q.monthID == i ) q.paymentamount( Math.round(Number( q.paymentamount()) ) + Math.round(Number( p.paymentamount ) ));
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
PaymentMonth: function ( data ) {
|
PaymentMonth: function ( data ) {
|
||||||
this.paymentamount = dbo.helpers.thousandSeparator( data.paymentamount );
|
this.paymentamount = dbo.helpers.thousandSeparator( Math.round(data.paymentamount) );
|
||||||
},
|
},
|
||||||
|
|
||||||
createSpreadsheet: function () {
|
createSpreadsheet: function () {
|
||||||
var vm = dbo.invoicereport;
|
var vm = dbo.invoicereport;
|
||||||
|
|
||||||
var orderDirection = vm.orderDirection ? 'ASC' : 'DESC';
|
var orderDirection = vm.orderDirection ? 'ASC' : 'DESC';
|
||||||
var archive = vm.archive() ? 'T' : 'F';
|
var archive = vm.archive() ? 'T' : 'F';
|
||||||
|
|
||||||
var url = 'index.php/reports/reportsController/createInvoicesSpreadsheet/' + vm.selectedYear() + '/' + vm.orderType + '/' + orderDirection + '/' + archive;
|
var url = 'index.php/reports/reportsController/createInvoicesSpreadsheet/' + vm.selectedYear() + '/' + vm.orderType + '/' + orderDirection + '/' + archive;
|
||||||
window.open( url, '_blank' );
|
window.open( url, '_blank' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dbo.invoicereport.init();
|
dbo.invoicereport.init();
|
||||||
|
|
||||||
ko.applyBindings(
|
ko.applyBindings(
|
||||||
dbo.invoicereport, document.getElementById( "INVOICEREPORT" ) );
|
dbo.invoicereport, document.getElementById( "INVOICEREPORT" ) );
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,462 +6,478 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
dbo.monthlyemployeehoursInit = function () {
|
dbo.monthlyemployeehoursInit = function () {
|
||||||
var timeout;
|
var timeout;
|
||||||
|
|
||||||
if ( dbo.monthlyEmployeeHoursModel !== undefined ) {
|
if ( dbo.monthlyEmployeeHoursModel !== undefined ) {
|
||||||
|
|
||||||
dbo.monthlyEmployeeHoursModel.initModule();
|
dbo.monthlyEmployeeHoursModel.initModule();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
dbo.monthlyEmployeeHoursModel = {
|
dbo.monthlyEmployeeHoursModel = {
|
||||||
|
|
||||||
uniqueEmployees : ko.observableArray( [] ),
|
uniqueEmployees : ko.observableArray( [] ),
|
||||||
uniqueYears : ko.observableArray( [] ),
|
uniqueYears : ko.observableArray( [] ),
|
||||||
sluggy : ko.observable( 'euro' ),
|
sluggy : ko.observable( 'euro' ),
|
||||||
years : ko.observableArray( [] ),
|
years : ko.observableArray( [] ),
|
||||||
selectedYear : ko.observable(),
|
selectedYear : ko.observable(),
|
||||||
currentTab : false,
|
currentTab : false,
|
||||||
recap : ko.observableArray( [] ),
|
recap : ko.observableArray( [] ),
|
||||||
totalPerEmployee : ko.observableArray( [] ),
|
totalPerEmployee : ko.observableArray( [] ),
|
||||||
totalEmployeeRevenues : ko.observable(),
|
totalEmployeeRevenues : ko.observable(),
|
||||||
totalAvailableRevenues : ko.observable(),
|
totalAvailableRevenues : ko.observable(),
|
||||||
totalEmployeeHours : ko.observable(),
|
totalEmployeeHours : ko.observable(),
|
||||||
totalEmployeeAvailableHours: ko.observable(),
|
totalEmployeeAvailableHours: ko.observable(),
|
||||||
totalBudget : ko.observable(),
|
totalBudget : ko.observable(),
|
||||||
totalOwnRevenue : ko.observable(),
|
totalOwnRevenue : ko.observable(),
|
||||||
totalCosts : ko.observable(),
|
totalCosts : ko.observable(),
|
||||||
totalAvailableBudget : ko.observable(),
|
totalAvailableBudget : ko.observable(),
|
||||||
totalSaldo : ko.observable(),
|
totalSaldo : ko.observable(),
|
||||||
totalOwp : ko.observable(),
|
totalOwp : ko.observable(),
|
||||||
totalWorkInProgress : ko.observable(),
|
totalWorkInProgress : ko.observable(),
|
||||||
totalCurrentFinancialYear : ko.observable(),
|
totalCurrentFinancialYear : ko.observable(),
|
||||||
totalNextFinancialYear : ko.observable(),
|
totalNextFinancialYear : ko.observable(),
|
||||||
totalInvoicedYear : ko.observableArray( [] ),
|
totalInvoicedYear : ko.observableArray( [] ),
|
||||||
validYear : ko.observable( true ),
|
validYear : ko.observable( true ),
|
||||||
archive : ko.observable(),
|
archive : ko.observable(),
|
||||||
|
field : 'projectnumber',
|
||||||
|
direction : 'asc',
|
||||||
|
|
||||||
init: function () {
|
init: function () {
|
||||||
var vm = dbo.monthlyEmployeeHoursModel;
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
|
|
||||||
dbo.reportsDataService.getUsedYears( function ( data ) {
|
dbo.reportsDataService.getUsedYears( function ( data ) {
|
||||||
vm.years( dbo.years )
|
vm.years( dbo.years )
|
||||||
vm.selectedYear( dbo.currentYear );
|
vm.selectedYear( dbo.currentYear );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
vm.initModule();
|
vm.initModule();
|
||||||
},
|
},
|
||||||
|
|
||||||
initModule: function () {
|
initModule: function () {
|
||||||
var vm = dbo.monthlyEmployeeHoursModel;
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
vm.totalBudget( 0 );
|
var archive = vm.archive() ? 'T' : 'F';
|
||||||
vm.totalOwnRevenue( 0 );
|
|
||||||
vm.totalCosts( 0 );
|
|
||||||
vm.totalAvailableBudget( 0 );
|
|
||||||
vm.totalSaldo( 0 );
|
|
||||||
vm.totalWorkInProgress( 0 );
|
|
||||||
vm.totalEmployeeRevenues( 0 );
|
|
||||||
vm.totalAvailableRevenues( 0 )
|
|
||||||
vm.totalEmployeeHours( 0 );
|
|
||||||
vm.totalEmployeeAvailableHours( 0 );
|
|
||||||
vm.totalOwp( 0 );
|
|
||||||
vm.totalPerEmployee.removeAll();
|
|
||||||
vm.totalInvoicedYear.removeAll();
|
|
||||||
dbo.userDataService.getUniqueProjectEmployees( function ( data ) {
|
|
||||||
vm.uniqueEmployees.removeAll();
|
|
||||||
$.each( data, function ( i, p ) {
|
|
||||||
vm.uniqueEmployees.push( new vm.UniqueEmployee( p ) )
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
|
|
||||||
var archive = vm.archive() ? 'T' : 'F';
|
vm.totalBudget( 0 );
|
||||||
dbo.reportsDataService.getRecapProjects( archive, function ( data ) {
|
vm.totalOwnRevenue( 0 );
|
||||||
vm.recap.removeAll();
|
vm.totalCosts( 0 );
|
||||||
vm.uniqueYears.removeAll();
|
vm.totalAvailableBudget( 0 );
|
||||||
$.each( data, function ( i, p ) {
|
vm.totalSaldo( 0 );
|
||||||
if ( i == 0 ) {
|
vm.totalWorkInProgress( 0 );
|
||||||
$.each( p.invoiced, function ( y, q ) {
|
vm.totalEmployeeRevenues( 0 );
|
||||||
vm.uniqueYears.push( {year: q.year} );
|
vm.totalAvailableRevenues( 0 )
|
||||||
} );
|
vm.totalEmployeeHours( 0 );
|
||||||
}
|
vm.totalEmployeeAvailableHours( 0 );
|
||||||
vm.recap.push( new vm.Project( p ) )
|
vm.totalOwp( 0 );
|
||||||
} );
|
vm.totalPerEmployee.removeAll();
|
||||||
vm.totalBudget( dbo.helpers.thousandSeparator( vm.totalBudget() ) );
|
vm.totalInvoicedYear.removeAll();
|
||||||
vm.totalOwnRevenue( dbo.helpers.thousandSeparator( vm.totalOwnRevenue() ) );
|
dbo.userDataService.getUniqueEmployeesWithActivity( archive, function ( data ) {
|
||||||
vm.totalCosts( dbo.helpers.thousandSeparator( vm.totalCosts() ) );
|
vm.uniqueEmployees.removeAll();
|
||||||
vm.totalAvailableBudget( dbo.helpers.thousandSeparator( vm.totalAvailableBudget() ) );
|
$.each( data, function ( i, p ) {
|
||||||
vm.totalSaldo( dbo.helpers.thousandSeparator( vm.totalSaldo() ) );
|
vm.uniqueEmployees.push( new vm.UniqueEmployee( p ) )
|
||||||
vm.totalWorkInProgress( dbo.helpers.thousandSeparator( vm.totalWorkInProgress() ) );
|
} );
|
||||||
vm.totalEmployeeRevenues( dbo.helpers.thousandSeparator( vm.totalEmployeeRevenues() ) );
|
} );
|
||||||
vm.totalAvailableRevenues( dbo.helpers.thousandSeparator( vm.totalAvailableRevenues() ) );
|
|
||||||
vm.totalOwp( dbo.helpers.thousandSeparator( vm.totalOwp() ) );
|
dbo.reportsDataService.getRecapProjects( vm.field, vm.direction, archive, function ( data ) {
|
||||||
vm.totalEmployeeHours( dbo.helpers.thousandSeparator( vm.totalEmployeeHours() ) );
|
vm.recap.removeAll();
|
||||||
_.each( vm.totalPerEmployee(), function ( p ) {
|
vm.uniqueYears.removeAll();
|
||||||
p.totalRevenue( dbo.helpers.thousandSeparator( p.totalRevenue() ) );
|
$.each( data, function ( i, p ) {
|
||||||
} );
|
if ( i == 0 ) {
|
||||||
_.each( vm.totalInvoicedYear(), function ( p ) {
|
$.each( p.invoiced, function ( y, q ) {
|
||||||
p.totalInvoiced( dbo.helpers.thousandSeparator( p.totalInvoiced() ) );
|
vm.uniqueYears.push( {year: q.year} );
|
||||||
} );
|
} );
|
||||||
var chartData = [];
|
}
|
||||||
var chartLabels = [];
|
vm.recap.push( new vm.Project( p ) )
|
||||||
_.each( vm.totalPerEmployee(), function ( p ) {
|
} );
|
||||||
chartData.push( Number( p.totalRevenue().replace( '.', '' ) ) );
|
vm.totalBudget( dbo.helpers.thousandSeparator( vm.totalBudget() ) );
|
||||||
chartLabels.push( p.fullname );
|
vm.totalOwnRevenue( dbo.helpers.thousandSeparator( vm.totalOwnRevenue() ) );
|
||||||
} );
|
vm.totalCosts( dbo.helpers.thousandSeparator( vm.totalCosts() ) );
|
||||||
var chartDataProjects = [];
|
vm.totalAvailableBudget( dbo.helpers.thousandSeparator( vm.totalAvailableBudget() ) );
|
||||||
var chartLabelsProjects = [];
|
vm.totalSaldo( dbo.helpers.thousandSeparator( vm.totalSaldo() ) );
|
||||||
var chartDataOwh = [];
|
vm.totalWorkInProgress( dbo.helpers.thousandSeparator( vm.totalWorkInProgress() ) );
|
||||||
var chartColorOwh = [];
|
vm.totalEmployeeRevenues( dbo.helpers.thousandSeparator( vm.totalEmployeeRevenues() ) );
|
||||||
_.each( vm.recap(), function ( p ) {
|
vm.totalAvailableRevenues( dbo.helpers.thousandSeparator( vm.totalAvailableRevenues() ) );
|
||||||
chartDataProjects.push( Number( p.totalEmployeeRevenues.replace( '.', '' ) ) );
|
vm.totalOwp( dbo.helpers.thousandSeparator( vm.totalOwp() ) );
|
||||||
chartLabelsProjects.push( p.projectname );
|
vm.totalEmployeeHours( dbo.helpers.thousandSeparator( vm.totalEmployeeHours() ) );
|
||||||
chartDataOwh.push( Number( p.workInProgress.replace( '.', '' ) ) );
|
_.each( vm.totalPerEmployee(), function ( p ) {
|
||||||
chartColorOwh.push( Number( p.workInProgress.replace( '.', '' ) ) < 0 ? '#d53d24' : '#78be4b' );
|
p.totalRevenue( dbo.helpers.thousandSeparator( p.totalRevenue() ) );
|
||||||
} );
|
} );
|
||||||
|
_.each( vm.totalInvoicedYear(), function ( p ) {
|
||||||
|
p.totalInvoiced( dbo.helpers.thousandSeparator( p.totalInvoiced() ) );
|
||||||
|
} );
|
||||||
|
var chartData = [];
|
||||||
|
var chartLabels = [];
|
||||||
|
_.each( vm.totalPerEmployee(), function ( p ) {
|
||||||
|
chartData.push( Number( p.totalRevenue().replace( '.', '' ) ) );
|
||||||
|
chartLabels.push( p.fullname );
|
||||||
|
} );
|
||||||
|
var chartDataProjects = [];
|
||||||
|
var chartLabelsProjects = [];
|
||||||
|
var chartDataOwh = [];
|
||||||
|
var chartColorOwh = [];
|
||||||
|
_.each( vm.recap(), function ( p ) {
|
||||||
|
chartDataProjects.push( Number( p.totalEmployeeRevenues.replace( '.', '' ) ) );
|
||||||
|
chartLabelsProjects.push( p.projectname );
|
||||||
|
chartDataOwh.push( Number( p.workInProgress.replace( '.', '' ) ) );
|
||||||
|
chartColorOwh.push( Number( p.workInProgress.replace( '.', '' ) ) < 0 ? '#d53d24' : '#78be4b' );
|
||||||
|
} );
|
||||||
// dbo.charts.drawPie( 'recap-revenues', chartData, chartLabels, 'omzet per medewerker' );
|
// dbo.charts.drawPie( 'recap-revenues', chartData, chartLabels, 'omzet per medewerker' );
|
||||||
// dbo.charts.drawPie( 'recap-revenues-project', chartDataProjects, chartLabelsProjects, 'omzet per project' );
|
// dbo.charts.drawPie( 'recap-revenues-project', chartDataProjects, chartLabelsProjects, 'omzet per project' );
|
||||||
// dbo.charts.drawHoursChart( 'recap-owh', chartDataOwh, chartLabelsProjects, 'onderhandenwerk per project', chartColorOwh );
|
// dbo.charts.drawHoursChart( 'recap-owh', chartDataOwh, chartLabelsProjects, 'onderhandenwerk per project', chartColorOwh );
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleArchive: function () {
|
setSorting: function ( field ) {
|
||||||
var vm = dbo.monthlyEmployeeHoursModel;
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
|
if ( vm.field == field ) {
|
||||||
|
vm.direction = vm.direction == 'desc' ? 'asc' : 'desc';
|
||||||
|
} else {
|
||||||
|
vm.direction = 'asc';
|
||||||
|
}
|
||||||
|
|
||||||
vm.archive( !vm.archive() );
|
vm.field = field;
|
||||||
vm.initModule();
|
|
||||||
},
|
|
||||||
|
|
||||||
checkYear: function () {
|
vm.initModule();
|
||||||
var vm = dbo.monthlyEmployeeHoursModel;
|
},
|
||||||
if ( timeout ) {
|
|
||||||
clearTimeout( timeout );
|
|
||||||
timeout = null;
|
|
||||||
}
|
|
||||||
timeout = setTimeout( function () {
|
|
||||||
vm.validYear( true );
|
|
||||||
if ( !Number.isInteger( Number( vm.selectedYear() ) ) ) return vm.validYear( false );
|
|
||||||
if ( Number( vm.selectedYear() ) > 2100 ) return vm.validYear( false );
|
|
||||||
if ( Number( vm.selectedYear() ) < 2000 ) return vm.validYear( false );
|
|
||||||
vm.initModule();
|
|
||||||
}, 700 );
|
|
||||||
},
|
|
||||||
|
|
||||||
refreshTab: function () {
|
toggleArchive: function () {
|
||||||
var vm = dbo.monthlyEmployeeHoursModel;
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
|
|
||||||
if ( vm.currentTab == false ) return;
|
vm.archive( !vm.archive() );
|
||||||
|
vm.initModule();
|
||||||
|
},
|
||||||
|
|
||||||
dbo.reportsDataService.getEmployeeHours( vm.currentTab.id, vm.selectedYear(), function ( data ) {
|
checkYear: function () {
|
||||||
vm.currentTab.myData( data );
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
vm.currentTab.totalJanuari( 0 );
|
if ( timeout ) {
|
||||||
vm.currentTab.totalFebruari( 0 );
|
clearTimeout( timeout );
|
||||||
vm.currentTab.totalMaart( 0 );
|
timeout = null;
|
||||||
vm.currentTab.totalApril( 0 );
|
}
|
||||||
vm.currentTab.totalMei( 0 );
|
timeout = setTimeout( function () {
|
||||||
vm.currentTab.totalJuni( 0 );
|
vm.validYear( true );
|
||||||
vm.currentTab.totalJuli( 0 );
|
if ( !Number.isInteger( Number( vm.selectedYear() ) ) ) return vm.validYear( false );
|
||||||
vm.currentTab.totalAugustus( 0 );
|
if ( Number( vm.selectedYear() ) > 2100 ) return vm.validYear( false );
|
||||||
vm.currentTab.totalSeptember( 0 );
|
if ( Number( vm.selectedYear() ) < 2000 ) return vm.validYear( false );
|
||||||
vm.currentTab.totalOktober( 0 );
|
vm.initModule();
|
||||||
vm.currentTab.totalNovember( 0 );
|
}, 700 );
|
||||||
vm.currentTab.totalDecember( 0 );
|
},
|
||||||
vm.currentTab.totalTotal( 0 );
|
|
||||||
vm.currentTab.totalTotalOtheryears( 0 );
|
|
||||||
vm.currentTab.totalJanuariRevenue( 0 );
|
|
||||||
vm.currentTab.totalFebruariRevenue( 0 );
|
|
||||||
vm.currentTab.totalMaartRevenue( 0 );
|
|
||||||
vm.currentTab.totalAprilRevenue( 0 );
|
|
||||||
vm.currentTab.totalMeiRevenue( 0 );
|
|
||||||
vm.currentTab.totalJuniRevenue( 0 );
|
|
||||||
vm.currentTab.totalJuliRevenue( 0 );
|
|
||||||
vm.currentTab.totalAugustusRevenue( 0 );
|
|
||||||
vm.currentTab.totalSeptemberRevenue( 0 );
|
|
||||||
vm.currentTab.totalOktoberRevenue( 0 );
|
|
||||||
vm.currentTab.totalNovemberRevenue( 0 );
|
|
||||||
vm.currentTab.totalDecemberRevenue( 0 );
|
|
||||||
vm.currentTab.totalTotalRevenue( 0 );
|
|
||||||
vm.currentTab.totalTotalOtheryearsRevenue( 0 );
|
|
||||||
vm.currentTab.totalHoursChart = [];
|
|
||||||
vm.currentTab.totalHoursRevenueChart = [];
|
|
||||||
vm.currentTab.projectChart = [];
|
|
||||||
$.each( vm.currentTab.myData(), function ( i, q ) {
|
|
||||||
vm.currentTab.tarif( q.tarif );
|
|
||||||
vm.currentTab.totalJanuari( vm.currentTab.totalJanuari() + q.januari );
|
|
||||||
vm.currentTab.totalFebruari( vm.currentTab.totalFebruari() + q.februari );
|
|
||||||
vm.currentTab.totalMaart( vm.currentTab.totalMaart() + q.maart );
|
|
||||||
vm.currentTab.totalApril( vm.currentTab.totalApril() + q.april );
|
|
||||||
vm.currentTab.totalMei( vm.currentTab.totalMei() + q.mei );
|
|
||||||
vm.currentTab.totalJuni( vm.currentTab.totalJuni() + q.juni );
|
|
||||||
vm.currentTab.totalJuli( vm.currentTab.totalJuli() + q.juli );
|
|
||||||
vm.currentTab.totalAugustus( vm.currentTab.totalAugustus() + q.augustus );
|
|
||||||
vm.currentTab.totalSeptember( vm.currentTab.totalSeptember() + q.september );
|
|
||||||
vm.currentTab.totalOktober( vm.currentTab.totalOktober() + q.oktober );
|
|
||||||
vm.currentTab.totalNovember( vm.currentTab.totalNovember() + q.november );
|
|
||||||
vm.currentTab.totalDecember( vm.currentTab.totalDecember() + q.december );
|
|
||||||
vm.currentTab.totalTotal( vm.currentTab.totalTotal() + q.totalyear );
|
|
||||||
vm.currentTab.totalTotalOtheryears( vm.currentTab.totalTotalOtheryears() + q.totalotheryears );
|
|
||||||
|
|
||||||
vm.currentTab.totalJanuariRevenue( vm.currentTab.totalJanuariRevenue() + q.januariRevenue );
|
refreshTab: function () {
|
||||||
vm.currentTab.totalFebruariRevenue( vm.currentTab.totalFebruariRevenue() + q.februariRevenue );
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
vm.currentTab.totalMaartRevenue( vm.currentTab.totalMaartRevenue() + q.maartRevenue );
|
|
||||||
vm.currentTab.totalAprilRevenue( vm.currentTab.totalAprilRevenue() + q.aprilRevenue );
|
|
||||||
vm.currentTab.totalMeiRevenue( vm.currentTab.totalMeiRevenue() + q.meiRevenue );
|
|
||||||
vm.currentTab.totalJuniRevenue( vm.currentTab.totalJuniRevenue() + q.juniRevenue );
|
|
||||||
vm.currentTab.totalJuliRevenue( vm.currentTab.totalJuliRevenue() + q.juliRevenue );
|
|
||||||
vm.currentTab.totalAugustusRevenue( vm.currentTab.totalAugustusRevenue() + q.augustusRevenue );
|
|
||||||
vm.currentTab.totalSeptemberRevenue( vm.currentTab.totalSeptemberRevenue() + q.septemberRevenue );
|
|
||||||
vm.currentTab.totalOktoberRevenue( vm.currentTab.totalOktoberRevenue() + q.oktoberRevenue );
|
|
||||||
vm.currentTab.totalNovemberRevenue( vm.currentTab.totalNovemberRevenue() + q.novemberRevenue );
|
|
||||||
vm.currentTab.totalDecemberRevenue( vm.currentTab.totalDecemberRevenue() + q.decemberRevenue );
|
|
||||||
vm.currentTab.totalTotalRevenue( vm.currentTab.totalTotalRevenue() + q.totalyearRevenue );
|
|
||||||
vm.currentTab.totalTotalOtheryearsRevenue( vm.currentTab.totalTotalOtheryearsRevenue() + q.totalotheryearsRevenue );
|
|
||||||
|
|
||||||
vm.currentTab.projectChart.push( q.projectname );
|
if ( vm.currentTab == false ) return;
|
||||||
vm.currentTab.totalHoursChart.push( q.totalhours );
|
|
||||||
vm.currentTab.totalHoursRevenueChart.push( q.totalhoursRevenue );
|
dbo.reportsDataService.getEmployeeHours( vm.currentTab.id, vm.selectedYear(), function ( data ) {
|
||||||
} );
|
vm.currentTab.myData( data );
|
||||||
vm.currentTab.chartData = [vm.currentTab.totalJanuari(), vm.currentTab.totalFebruari(), vm.currentTab.totalMaart(), vm.currentTab.totalApril(), vm.currentTab.totalMei(), vm.currentTab.totalJuni(), vm.currentTab.totalJuli(), vm.currentTab.totalAugustus(), vm.currentTab.totalSeptember(), vm.currentTab.totalOktober(), vm.currentTab.totalNovember(), vm.currentTab.totalDecember()];
|
vm.currentTab.totalJanuari( 0 );
|
||||||
vm.currentTab.chartRevenueData = [vm.currentTab.totalJanuariRevenue(), vm.currentTab.totalFebruariRevenue(), vm.currentTab.totalMaartRevenue(), vm.currentTab.totalAprilRevenue(), vm.currentTab.totalMeiRevenue(), vm.currentTab.totalJuniRevenue(), vm.currentTab.totalJuliRevenue(), vm.currentTab.totalAugustusRevenue(), vm.currentTab.totalSeptemberRevenue(), vm.currentTab.totalOktoberRevenue(), vm.currentTab.totalNovemberRevenue(), vm.currentTab.totalDecemberRevenue()];
|
vm.currentTab.totalFebruari( 0 );
|
||||||
|
vm.currentTab.totalMaart( 0 );
|
||||||
|
vm.currentTab.totalApril( 0 );
|
||||||
|
vm.currentTab.totalMei( 0 );
|
||||||
|
vm.currentTab.totalJuni( 0 );
|
||||||
|
vm.currentTab.totalJuli( 0 );
|
||||||
|
vm.currentTab.totalAugustus( 0 );
|
||||||
|
vm.currentTab.totalSeptember( 0 );
|
||||||
|
vm.currentTab.totalOktober( 0 );
|
||||||
|
vm.currentTab.totalNovember( 0 );
|
||||||
|
vm.currentTab.totalDecember( 0 );
|
||||||
|
vm.currentTab.totalTotal( 0 );
|
||||||
|
vm.currentTab.totalTotalOtheryears( 0 );
|
||||||
|
vm.currentTab.totalJanuariRevenue( 0 );
|
||||||
|
vm.currentTab.totalFebruariRevenue( 0 );
|
||||||
|
vm.currentTab.totalMaartRevenue( 0 );
|
||||||
|
vm.currentTab.totalAprilRevenue( 0 );
|
||||||
|
vm.currentTab.totalMeiRevenue( 0 );
|
||||||
|
vm.currentTab.totalJuniRevenue( 0 );
|
||||||
|
vm.currentTab.totalJuliRevenue( 0 );
|
||||||
|
vm.currentTab.totalAugustusRevenue( 0 );
|
||||||
|
vm.currentTab.totalSeptemberRevenue( 0 );
|
||||||
|
vm.currentTab.totalOktoberRevenue( 0 );
|
||||||
|
vm.currentTab.totalNovemberRevenue( 0 );
|
||||||
|
vm.currentTab.totalDecemberRevenue( 0 );
|
||||||
|
vm.currentTab.totalTotalRevenue( 0 );
|
||||||
|
vm.currentTab.totalTotalOtheryearsRevenue( 0 );
|
||||||
|
vm.currentTab.totalHoursChart = [];
|
||||||
|
vm.currentTab.totalHoursRevenueChart = [];
|
||||||
|
vm.currentTab.projectChart = [];
|
||||||
|
$.each( vm.currentTab.myData(), function ( i, q ) {
|
||||||
|
vm.currentTab.tarif( q.tarif );
|
||||||
|
vm.currentTab.totalJanuari( vm.currentTab.totalJanuari() + q.januari );
|
||||||
|
vm.currentTab.totalFebruari( vm.currentTab.totalFebruari() + q.februari );
|
||||||
|
vm.currentTab.totalMaart( vm.currentTab.totalMaart() + q.maart );
|
||||||
|
vm.currentTab.totalApril( vm.currentTab.totalApril() + q.april );
|
||||||
|
vm.currentTab.totalMei( vm.currentTab.totalMei() + q.mei );
|
||||||
|
vm.currentTab.totalJuni( vm.currentTab.totalJuni() + q.juni );
|
||||||
|
vm.currentTab.totalJuli( vm.currentTab.totalJuli() + q.juli );
|
||||||
|
vm.currentTab.totalAugustus( vm.currentTab.totalAugustus() + q.augustus );
|
||||||
|
vm.currentTab.totalSeptember( vm.currentTab.totalSeptember() + q.september );
|
||||||
|
vm.currentTab.totalOktober( vm.currentTab.totalOktober() + q.oktober );
|
||||||
|
vm.currentTab.totalNovember( vm.currentTab.totalNovember() + q.november );
|
||||||
|
vm.currentTab.totalDecember( vm.currentTab.totalDecember() + q.december );
|
||||||
|
vm.currentTab.totalTotal( vm.currentTab.totalTotal() + q.totalyear );
|
||||||
|
vm.currentTab.totalTotalOtheryears( vm.currentTab.totalTotalOtheryears() + q.totalotheryears );
|
||||||
|
|
||||||
|
vm.currentTab.totalJanuariRevenue( vm.currentTab.totalJanuariRevenue() + q.januariRevenue );
|
||||||
|
vm.currentTab.totalFebruariRevenue( vm.currentTab.totalFebruariRevenue() + q.februariRevenue );
|
||||||
|
vm.currentTab.totalMaartRevenue( vm.currentTab.totalMaartRevenue() + q.maartRevenue );
|
||||||
|
vm.currentTab.totalAprilRevenue( vm.currentTab.totalAprilRevenue() + q.aprilRevenue );
|
||||||
|
vm.currentTab.totalMeiRevenue( vm.currentTab.totalMeiRevenue() + q.meiRevenue );
|
||||||
|
vm.currentTab.totalJuniRevenue( vm.currentTab.totalJuniRevenue() + q.juniRevenue );
|
||||||
|
vm.currentTab.totalJuliRevenue( vm.currentTab.totalJuliRevenue() + q.juliRevenue );
|
||||||
|
vm.currentTab.totalAugustusRevenue( vm.currentTab.totalAugustusRevenue() + q.augustusRevenue );
|
||||||
|
vm.currentTab.totalSeptemberRevenue( vm.currentTab.totalSeptemberRevenue() + q.septemberRevenue );
|
||||||
|
vm.currentTab.totalOktoberRevenue( vm.currentTab.totalOktoberRevenue() + q.oktoberRevenue );
|
||||||
|
vm.currentTab.totalNovemberRevenue( vm.currentTab.totalNovemberRevenue() + q.novemberRevenue );
|
||||||
|
vm.currentTab.totalDecemberRevenue( vm.currentTab.totalDecemberRevenue() + q.decemberRevenue );
|
||||||
|
vm.currentTab.totalTotalRevenue( vm.currentTab.totalTotalRevenue() + q.totalyearRevenue );
|
||||||
|
vm.currentTab.totalTotalOtheryearsRevenue( vm.currentTab.totalTotalOtheryearsRevenue() + q.totalotheryearsRevenue );
|
||||||
|
|
||||||
|
vm.currentTab.projectChart.push( q.projectname );
|
||||||
|
vm.currentTab.totalHoursChart.push( q.totalhours );
|
||||||
|
vm.currentTab.totalHoursRevenueChart.push( q.totalhoursRevenue );
|
||||||
|
} );
|
||||||
|
vm.currentTab.chartData = [vm.currentTab.totalJanuari(), vm.currentTab.totalFebruari(), vm.currentTab.totalMaart(), vm.currentTab.totalApril(), vm.currentTab.totalMei(), vm.currentTab.totalJuni(), vm.currentTab.totalJuli(), vm.currentTab.totalAugustus(), vm.currentTab.totalSeptember(), vm.currentTab.totalOktober(), vm.currentTab.totalNovember(), vm.currentTab.totalDecember()];
|
||||||
|
vm.currentTab.chartRevenueData = [vm.currentTab.totalJanuariRevenue(), vm.currentTab.totalFebruariRevenue(), vm.currentTab.totalMaartRevenue(), vm.currentTab.totalAprilRevenue(), vm.currentTab.totalMeiRevenue(), vm.currentTab.totalJuniRevenue(), vm.currentTab.totalJuliRevenue(), vm.currentTab.totalAugustusRevenue(), vm.currentTab.totalSeptemberRevenue(), vm.currentTab.totalOktoberRevenue(), vm.currentTab.totalNovemberRevenue(), vm.currentTab.totalDecemberRevenue()];
|
||||||
|
|
||||||
// vm.drawCharts( vm.currentTab );
|
// vm.drawCharts( vm.currentTab );
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
drawCharts: function ( self ) {
|
drawCharts: function ( self ) {
|
||||||
if ( self.hourView() ) {
|
if ( self.hourView() ) {
|
||||||
dbo.charts.drawHoursChart( 'hours-per-month-' + self.slug, self.chartData, dbo.monthLabels, 'uren per maand', '#f28f25' );
|
dbo.charts.drawHoursChart( 'hours-per-month-' + self.slug, self.chartData, dbo.monthLabels, 'uren per maand', '#f28f25' );
|
||||||
dbo.charts.drawHoursChart( 'hours-per-project-' + self.slug, self.totalHoursChart, self.projectChart, 'uren per project', '#0daef0' );
|
dbo.charts.drawHoursChart( 'hours-per-project-' + self.slug, self.totalHoursChart, self.projectChart, 'uren per project', '#0daef0' );
|
||||||
} else {
|
} else {
|
||||||
dbo.charts.drawHoursChart( 'revenue-per-month-' + self.slug, self.chartRevenueData, dbo.monthLabels, 'omzet per maand', '#f28f25' );
|
dbo.charts.drawHoursChart( 'revenue-per-month-' + self.slug, self.chartRevenueData, dbo.monthLabels, 'omzet per maand', '#f28f25' );
|
||||||
dbo.charts.drawHoursChart( 'revenue-per-project-' + self.slug, self.totalHoursRevenueChart, self.projectChart, 'omzet per project', '#0daef0' );
|
dbo.charts.drawHoursChart( 'revenue-per-project-' + self.slug, self.totalHoursRevenueChart, self.projectChart, 'omzet per project', '#0daef0' );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleHourView: function () {
|
toggleHourView: function () {
|
||||||
this.hourView( !this.hourView() );
|
this.hourView( !this.hourView() );
|
||||||
|
|
||||||
dbo.monthlyEmployeeHoursModel.drawCharts( this );
|
dbo.monthlyEmployeeHoursModel.drawCharts( this );
|
||||||
},
|
},
|
||||||
|
|
||||||
setActivetab: function ( tab ) {
|
setActivetab: function ( tab ) {
|
||||||
var vm = dbo.monthlyEmployeeHoursModel;
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
|
|
||||||
$.each( vm.uniqueEmployees(), function ( i, p ) {
|
$.each( vm.uniqueEmployees(), function ( i, p ) {
|
||||||
if ( tab == p.slug ) {
|
if ( tab == p.slug ) {
|
||||||
vm.currentTab = p;
|
vm.currentTab = p;
|
||||||
vm.refreshTab();
|
vm.refreshTab();
|
||||||
}
|
}
|
||||||
} )
|
} )
|
||||||
|
|
||||||
vm.sluggy( tab );
|
vm.sluggy( tab );
|
||||||
},
|
},
|
||||||
|
|
||||||
UniqueEmployee: function ( data ) {
|
UniqueEmployee: function ( data ) {
|
||||||
var vm = dbo.monthlyEmployeeHoursModel;
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.id = data.id;
|
self.id = data.id;
|
||||||
self.fullname = data.fullname;
|
self.fullname = data.fullname;
|
||||||
self.slug = data.slug;
|
self.slug = data.slug;
|
||||||
|
|
||||||
self.tarif = ko.observable( 0 );
|
self.tarif = ko.observable( 0 );
|
||||||
|
|
||||||
self.totalJanuari = ko.observable( 0 );
|
self.totalJanuari = ko.observable( 0 );
|
||||||
self.totalFebruari = ko.observable( 0 );
|
self.totalFebruari = ko.observable( 0 );
|
||||||
self.totalMaart = ko.observable( 0 );
|
self.totalMaart = ko.observable( 0 );
|
||||||
self.totalApril = ko.observable( 0 );
|
self.totalApril = ko.observable( 0 );
|
||||||
self.totalMei = ko.observable( 0 );
|
self.totalMei = ko.observable( 0 );
|
||||||
self.totalJuni = ko.observable( 0 );
|
self.totalJuni = ko.observable( 0 );
|
||||||
self.totalJuli = ko.observable( 0 );
|
self.totalJuli = ko.observable( 0 );
|
||||||
self.totalAugustus = ko.observable( 0 );
|
self.totalAugustus = ko.observable( 0 );
|
||||||
self.totalSeptember = ko.observable( 0 );
|
self.totalSeptember = ko.observable( 0 );
|
||||||
self.totalOktober = ko.observable( 0 );
|
self.totalOktober = ko.observable( 0 );
|
||||||
self.totalNovember = ko.observable( 0 );
|
self.totalNovember = ko.observable( 0 );
|
||||||
self.totalDecember = ko.observable( 0 );
|
self.totalDecember = ko.observable( 0 );
|
||||||
self.totalTotal = ko.observable( 0 );
|
self.totalTotal = ko.observable( 0 );
|
||||||
self.totalOtheryears = ko.observable( 0 );
|
self.totalOtheryears = ko.observable( 0 );
|
||||||
self.totalTotalOtheryears = ko.observable( 0 );
|
self.totalTotalOtheryears = ko.observable( 0 );
|
||||||
|
|
||||||
|
|
||||||
self.totalJanuariRevenue = ko.observable( 0 );
|
self.totalJanuariRevenue = ko.observable( 0 );
|
||||||
self.totalFebruariRevenue = ko.observable( 0 );
|
self.totalFebruariRevenue = ko.observable( 0 );
|
||||||
self.totalMaartRevenue = ko.observable( 0 );
|
self.totalMaartRevenue = ko.observable( 0 );
|
||||||
self.totalAprilRevenue = ko.observable( 0 );
|
self.totalAprilRevenue = ko.observable( 0 );
|
||||||
self.totalMeiRevenue = ko.observable( 0 );
|
self.totalMeiRevenue = ko.observable( 0 );
|
||||||
self.totalJuniRevenue = ko.observable( 0 );
|
self.totalJuniRevenue = ko.observable( 0 );
|
||||||
self.totalJuliRevenue = ko.observable( 0 );
|
self.totalJuliRevenue = ko.observable( 0 );
|
||||||
self.totalAugustusRevenue = ko.observable( 0 );
|
self.totalAugustusRevenue = ko.observable( 0 );
|
||||||
self.totalSeptemberRevenue = ko.observable( 0 );
|
self.totalSeptemberRevenue = ko.observable( 0 );
|
||||||
self.totalOktoberRevenue = ko.observable( 0 );
|
self.totalOktoberRevenue = ko.observable( 0 );
|
||||||
self.totalNovemberRevenue = ko.observable( 0 );
|
self.totalNovemberRevenue = ko.observable( 0 );
|
||||||
self.totalDecemberRevenue = ko.observable( 0 );
|
self.totalDecemberRevenue = ko.observable( 0 );
|
||||||
self.totalTotalRevenue = ko.observable( 0 );
|
self.totalTotalRevenue = ko.observable( 0 );
|
||||||
self.totalOtheryearsRevenue = ko.observable( 0 );
|
self.totalOtheryearsRevenue = ko.observable( 0 );
|
||||||
self.totalTotalOtheryearsRevenue = ko.observable( 0 );
|
self.totalTotalOtheryearsRevenue = ko.observable( 0 );
|
||||||
|
|
||||||
self.hourView = ko.observable( true );
|
self.hourView = ko.observable( true );
|
||||||
|
|
||||||
self.myData = ko.observableArray( [] );
|
self.myData = ko.observableArray( [] );
|
||||||
},
|
},
|
||||||
|
|
||||||
Detail: function ( data ) {
|
Detail: function ( data ) {
|
||||||
this.test = data;
|
this.test = data;
|
||||||
},
|
},
|
||||||
|
|
||||||
Project: function ( data ) {
|
Project: function ( data ) {
|
||||||
var vm = dbo.monthlyEmployeeHoursModel;
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.projectID = data.id
|
self.projectID = data.id
|
||||||
self.projectnumber = data.projectnumber;
|
self.projectnumber = data.projectnumber;
|
||||||
self.instroom = data.instroom;
|
self.instroom = data.instroom;
|
||||||
self.uitstroom = data.uitstroom;
|
self.uitstroom = data.uitstroom;
|
||||||
self.projectname = data.projectname;
|
self.projectname = data.projectname;
|
||||||
self.name = data.name;
|
self.name = data.name;
|
||||||
self.revenues = dbo.helpers.thousandSeparator( data.budget );
|
self.revenues = dbo.helpers.thousandSeparator( data.budget );
|
||||||
self.hours = data.hours;
|
self.hours = data.hours;
|
||||||
self.totalEmpoloyeeRevenues = 0;
|
self.totalEmpoloyeeRevenues = 0;
|
||||||
self.availableRevenue = data.own_revenue - data.projectEuros;
|
self.availableRevenue = data.own_revenue - data.projectEuros;
|
||||||
self.owpNumber = self.availableRevenue < 0 ? 0 : self.availableRevenue;
|
self.owpNumber = self.availableRevenue < 0 ? 0 : self.availableRevenue;
|
||||||
self.owp = self.owpNumber;
|
self.owp = self.owpNumber;
|
||||||
self.currentFinancialYear = ko.observable( data.current_financial_year );
|
self.currentFinancialYear = ko.observable( data.current_financial_year );
|
||||||
self.pristine = ko.observable( true );
|
self.pristine = ko.observable( true );
|
||||||
|
|
||||||
self.nextFinancialYears = ko.pureComputed( function () {
|
self.nextFinancialYears = ko.pureComputed( function () {
|
||||||
return dbo.helpers.thousandSeparator( Number( self.owpNumber ) - Number( self.currentFinancialYear() ) );
|
return dbo.helpers.thousandSeparator( Number( self.owpNumber ) - Number( self.currentFinancialYear() ) );
|
||||||
} );
|
} );
|
||||||
self.externCosts = dbo.helpers.thousandSeparator( data.projectcosts );
|
self.externCosts = dbo.helpers.thousandSeparator( data.projectcosts );
|
||||||
self.budget = dbo.helpers.thousandSeparator( data.budget );
|
self.budget = dbo.helpers.thousandSeparator( data.budget );
|
||||||
self.ownRevenue = dbo.helpers.thousandSeparator( data.own_revenue );
|
self.ownRevenue = dbo.helpers.thousandSeparator( data.own_revenue );
|
||||||
self.budgetAvailable = dbo.helpers.thousandSeparator( data.budgetAvailable );
|
self.budgetAvailable = dbo.helpers.thousandSeparator( data.budgetAvailable );
|
||||||
self.saldo = dbo.helpers.thousandSeparator( data.saldo );
|
self.saldo = dbo.helpers.thousandSeparator( data.saldo );
|
||||||
|
|
||||||
self.employees = ko.observableArray( [] );
|
self.employees = ko.observableArray( [] );
|
||||||
$.each( data.employees, function ( i, p ) {
|
$.each( data.employees, function ( i, p ) {
|
||||||
self.employees.push( new vm.Employee( p ) );
|
self.employees.push( new vm.Employee( p ) );
|
||||||
if ( !self.totalEmployeeRevenues ) self.totalEmployeeRevenues = 0;
|
if ( !self.totalEmployeeRevenues ) self.totalEmployeeRevenues = 0;
|
||||||
if ( !self.totalEmployeeHours ) self.totalEmployeeHours = 0;
|
if ( !self.totalEmployeeHours ) self.totalEmployeeHours = 0;
|
||||||
} );
|
} );
|
||||||
self.totalEmployeeRevenues = data.projectEuros;
|
self.totalEmployeeRevenues = data.projectEuros;
|
||||||
self.totalEmployeeHours = data.projectHours;
|
self.totalEmployeeHours = data.projectHours;
|
||||||
self.hoursAvailable = data.hoursAvailable;
|
self.hoursAvailable = data.hoursAvailable;
|
||||||
vm.totalEmployeeRevenues( vm.totalEmployeeRevenues() + Number( self.totalEmployeeRevenues ) );
|
vm.totalEmployeeRevenues( vm.totalEmployeeRevenues() + Number( self.totalEmployeeRevenues ) );
|
||||||
vm.totalEmployeeHours( vm.totalEmployeeHours() + Number( self.totalEmployeeHours ) );
|
vm.totalEmployeeHours( vm.totalEmployeeHours() + Number( self.totalEmployeeHours ) );
|
||||||
vm.totalEmployeeAvailableHours( vm.totalEmployeeAvailableHours() + Number( self.hoursAvailable ) );
|
vm.totalEmployeeAvailableHours( vm.totalEmployeeAvailableHours() + Number( self.hoursAvailable ) );
|
||||||
vm.totalAvailableRevenues( Number( vm.totalAvailableRevenues() ) + Number( self.availableRevenue ) );
|
vm.totalAvailableRevenues( Number( vm.totalAvailableRevenues() ) + Number( self.availableRevenue ) );
|
||||||
vm.totalOwp( Number( vm.totalOwp() ) + Number( self.owp ) );
|
vm.totalOwp( Number( vm.totalOwp() ) + Number( self.owp ) );
|
||||||
self.totalEmployeeRevenues = dbo.helpers.thousandSeparator( self.totalEmployeeRevenues );
|
self.totalEmployeeRevenues = dbo.helpers.thousandSeparator( self.totalEmployeeRevenues );
|
||||||
self.availableRevenue = dbo.helpers.thousandSeparator( self.availableRevenue );
|
self.availableRevenue = dbo.helpers.thousandSeparator( self.availableRevenue );
|
||||||
self.workInProgress = dbo.helpers.thousandSeparator( data.workInProgress );
|
self.workInProgress = dbo.helpers.thousandSeparator( data.workInProgress );
|
||||||
self.owp = dbo.helpers.thousandSeparator( self.owp );
|
self.owp = dbo.helpers.thousandSeparator( self.owp );
|
||||||
self.hoursAvailable = data.hoursAvailable;
|
self.hoursAvailable = data.hoursAvailable;
|
||||||
|
|
||||||
self.invoiced = ko.observableArray( [] );
|
self.invoiced = ko.observableArray( [] );
|
||||||
$.each( data.invoiced, function ( i, p ) {
|
$.each( data.invoiced, function ( i, p ) {
|
||||||
self.invoiced.push( {invoiced: dbo.helpers.thousandSeparator( p.invoiced )} );
|
self.invoiced.push( {invoiced: dbo.helpers.thousandSeparator( p.invoiced )} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
vm.setTotals( data );
|
vm.setTotals( data );
|
||||||
},
|
},
|
||||||
|
|
||||||
setTotals: function ( data ) {
|
setTotals: function ( data ) {
|
||||||
var vm = dbo.monthlyEmployeeHoursModel;
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
|
|
||||||
vm.totalBudget( vm.totalBudget() + Number( data.budget ) );
|
vm.totalBudget( vm.totalBudget() + Number( data.budget ) );
|
||||||
vm.totalOwnRevenue( vm.totalOwnRevenue() + Number( data.own_revenue ) );
|
vm.totalOwnRevenue( vm.totalOwnRevenue() + Number( data.own_revenue ) );
|
||||||
vm.totalCosts( vm.totalCosts() + Number( data.projectcosts ) );
|
vm.totalCosts( vm.totalCosts() + Number( data.projectcosts ) );
|
||||||
vm.totalAvailableBudget( vm.totalAvailableBudget() + Number( data.ownRevenueAvailable ) );
|
vm.totalAvailableBudget( vm.totalAvailableBudget() + Number( data.ownRevenueAvailable ) );
|
||||||
vm.totalSaldo( vm.totalSaldo() + Number( data.saldo ) );
|
vm.totalSaldo( vm.totalSaldo() + Number( data.saldo ) );
|
||||||
vm.totalWorkInProgress( vm.totalWorkInProgress() + Number( data.workInProgress ) );
|
vm.totalWorkInProgress( vm.totalWorkInProgress() + Number( data.workInProgress ) );
|
||||||
|
|
||||||
var hasTotalEmployees = true;
|
var hasTotalEmployees = true;
|
||||||
if ( vm.totalPerEmployee().length == 0 ) hasTotalEmployees = false;
|
if ( vm.totalPerEmployee().length == 0 ) hasTotalEmployees = false;
|
||||||
_.each( data.employees, function ( p ) {
|
_.each( data.employees, function ( p ) {
|
||||||
if ( !hasTotalEmployees ) {
|
if ( !hasTotalEmployees ) {
|
||||||
vm.totalPerEmployee.push( {
|
vm.totalPerEmployee.push( {
|
||||||
id : p.id,
|
id : p.id,
|
||||||
fullname : p.fullname,
|
fullname : p.fullname,
|
||||||
totalRevenue : ko.observable( 0 ),
|
totalRevenue : ko.observable( 0 ),
|
||||||
totalHours : ko.observable( 0 ),
|
totalHours : ko.observable( 0 ),
|
||||||
totalAvailableHours: ko.observable( 0 )
|
totalAvailableHours: ko.observable( 0 )
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
var a = _.find( vm.totalPerEmployee(), function ( o ) {
|
var a = _.find( vm.totalPerEmployee(), function ( o ) {
|
||||||
return o.id == p.id
|
return o.id == p.id
|
||||||
} );
|
} );
|
||||||
a.totalRevenue( a.totalRevenue() + Number( p.revenues ) );
|
a.totalRevenue( a.totalRevenue() + Number( p.revenues ) );
|
||||||
a.totalHours( a.totalHours() + Number( p.hours ) );
|
a.totalHours( a.totalHours() + Number( p.hours ) );
|
||||||
a.totalAvailableHours( a.totalAvailableHours() + Number( p.availableHours ) );
|
a.totalAvailableHours( a.totalAvailableHours() + Number( p.availableHours ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
var hasTotalsOwpYear = true;
|
var hasTotalsOwpYear = true;
|
||||||
if ( vm.totalInvoicedYear().length == 0 ) hasTotalsOwpYear = false;
|
if ( vm.totalInvoicedYear().length == 0 ) hasTotalsOwpYear = false;
|
||||||
_.each( data.invoiced, function ( p ) {
|
_.each( data.invoiced, function ( p ) {
|
||||||
if ( !hasTotalsOwpYear ) {
|
if ( !hasTotalsOwpYear ) {
|
||||||
vm.totalInvoicedYear.push( {year: p.year, totalInvoiced: ko.observable( 0 )} );
|
vm.totalInvoicedYear.push( {year: p.year, totalInvoiced: ko.observable( 0 )} );
|
||||||
}
|
}
|
||||||
var a = _.find( vm.totalInvoicedYear(), function ( o ) {
|
var a = _.find( vm.totalInvoicedYear(), function ( o ) {
|
||||||
return o.year == p.year
|
return o.year == p.year
|
||||||
} );
|
} );
|
||||||
a.totalInvoiced( a.totalInvoiced() + Number( p.invoiced ) );
|
a.totalInvoiced( a.totalInvoiced() + Number( p.invoiced ) );
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
Employee: function ( data ) {
|
Employee: function ( data ) {
|
||||||
this.fullname = data.fullname;
|
this.fullname = data.fullname;
|
||||||
this.revenues = dbo.helpers.thousandSeparator( data.revenues );
|
this.revenues = dbo.helpers.thousandSeparator( data.revenues );
|
||||||
this.hours = data.hours;
|
this.hours = data.hours;
|
||||||
this.budget = data.budget;
|
this.budget = data.budget;
|
||||||
this.availableHours = data.availableHours;
|
this.availableHours = data.availableHours;
|
||||||
},
|
},
|
||||||
|
|
||||||
saveCurrentFinancialYear: function () {
|
saveCurrentFinancialYear: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.pristine( false );
|
self.pristine( false );
|
||||||
|
|
||||||
self.currentFinancialYear( dbo.helpers.validateNumber( self.currentFinancialYear() ) );
|
self.currentFinancialYear( dbo.helpers.validateNumber( self.currentFinancialYear() ) );
|
||||||
|
|
||||||
if ( timeout ) {
|
if ( timeout ) {
|
||||||
clearTimeout( timeout );
|
clearTimeout( timeout );
|
||||||
timeout = null;
|
timeout = null;
|
||||||
}
|
}
|
||||||
timeout = setTimeout( function () {
|
timeout = setTimeout( function () {
|
||||||
if ( self.currentFinancialYear().length == 0 ) self.currentFinancialYear( 0 );
|
if ( self.currentFinancialYear().length == 0 ) self.currentFinancialYear( 0 );
|
||||||
|
|
||||||
dbo.reportsDataService.saveCurrentFinnacialYear(
|
dbo.reportsDataService.saveCurrentFinnacialYear(
|
||||||
self.projectID, self.currentFinancialYear(), function () {
|
self.projectID, self.currentFinancialYear(), function () {
|
||||||
self.pristine( true );
|
self.pristine( true );
|
||||||
} );
|
} );
|
||||||
}, 400 );
|
}, 400 );
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
dbo.monthlyEmployeeHoursModel.init();
|
dbo.monthlyEmployeeHoursModel.init();
|
||||||
|
|
||||||
|
|
||||||
dbo.monthlyEmployeeHoursModel.totalCurrentFinancialYear = ko.pureComputed( function () {
|
dbo.monthlyEmployeeHoursModel.totalCurrentFinancialYear = ko.pureComputed( function () {
|
||||||
var totalCurrentFinancialYear = 0
|
var totalCurrentFinancialYear = 0
|
||||||
var vm = dbo.monthlyEmployeeHoursModel;
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
_.each( vm.recap(), function ( p ) {
|
_.each( vm.recap(), function ( p ) {
|
||||||
totalCurrentFinancialYear += Number( p.currentFinancialYear() );
|
totalCurrentFinancialYear += Number( p.currentFinancialYear() );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
return dbo.helpers.thousandSeparator( totalCurrentFinancialYear );
|
return dbo.helpers.thousandSeparator( totalCurrentFinancialYear );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
dbo.monthlyEmployeeHoursModel.totalNextFinancialYear = ko.pureComputed( function () {
|
dbo.monthlyEmployeeHoursModel.totalNextFinancialYear = ko.pureComputed( function () {
|
||||||
var totalNextFinancialYear = 0
|
var totalNextFinancialYear = 0
|
||||||
var vm = dbo.monthlyEmployeeHoursModel;
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
_.each( vm.recap(), function ( p ) {
|
_.each( vm.recap(), function ( p ) {
|
||||||
totalNextFinancialYear += Number( p.owpNumber ) - Number( p.currentFinancialYear() );
|
totalNextFinancialYear += Number( p.owpNumber ) - Number( p.currentFinancialYear() );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
return dbo.helpers.thousandSeparator( totalNextFinancialYear );
|
return dbo.helpers.thousandSeparator( totalNextFinancialYear );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
ko.applyBindings( dbo.monthlyEmployeeHoursModel, document.getElementById( "MONTHLYEMPLOYEEHOURS" ) );
|
ko.applyBindings( dbo.monthlyEmployeeHoursModel, document.getElementById( "MONTHLYEMPLOYEEHOURS" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user