Merge branch 'master' into feature/dashboard
# Conflicts: # application/models/eloquent/Projectemployee.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] );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class ReservationsController extends MY_Controller {
|
|||||||
{
|
{
|
||||||
$projects[ $result->projectID ] = [
|
$projects[ $result->projectID ] = [
|
||||||
'projectnumber' => $result->projectnumber,
|
'projectnumber' => $result->projectnumber,
|
||||||
|
'projectname' => $result->projectname,
|
||||||
'costs' => 0,
|
'costs' => 0,
|
||||||
'reservation' => 0,
|
'reservation' => 0,
|
||||||
'payed' => 0,
|
'payed' => 0,
|
||||||
|
|||||||
@@ -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 ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,9 @@ class InvoiceSpreadsheet {
|
|||||||
|
|
||||||
$this->setMonthForecast();
|
$this->setMonthForecast();
|
||||||
|
|
||||||
$this->setMonthPayment();
|
$this->setMonthPayment();
|
||||||
|
|
||||||
|
$this->setInvoiced();
|
||||||
|
|
||||||
$this->setFilename();
|
$this->setFilename();
|
||||||
|
|
||||||
@@ -86,15 +88,25 @@ class InvoiceSpreadsheet {
|
|||||||
new MonthForecastSheet( $this->invoiceReport['monthForecasts'], $this->invoiceSheet );
|
new MonthForecastSheet( $this->invoiceReport['monthForecasts'], $this->invoiceSheet );
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setMonthPayment()
|
private function setMonthPayment()
|
||||||
{
|
{
|
||||||
$invoiceSheet = new Worksheet( $this->spreadsheet, 'maand betalingen' );
|
$invoiceSheet = new Worksheet( $this->spreadsheet, 'maand betalingen' );
|
||||||
|
|
||||||
$this->invoiceSheet =
|
$this->invoiceSheet =
|
||||||
$this->spreadsheet->addSheet( $invoiceSheet );
|
$this->spreadsheet->addSheet( $invoiceSheet );
|
||||||
|
|
||||||
new MonthPaymentSheet( $this->invoiceReport['monthPayments'], $this->invoiceSheet );
|
new MonthPaymentSheet( $this->invoiceReport['monthPayments'], $this->invoiceSheet );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function setInvoiced()
|
||||||
|
{
|
||||||
|
$invoiceSheet = new Worksheet( $this->spreadsheet, 'ontvangen facturen' );
|
||||||
|
|
||||||
|
$this->invoiceSheet =
|
||||||
|
$this->spreadsheet->addSheet( $invoiceSheet );
|
||||||
|
|
||||||
|
new InvoicedSheet( $this->invoiceReport['invoiced'], $this->invoiceSheet );
|
||||||
|
}
|
||||||
|
|
||||||
private function setFilename()
|
private function setFilename()
|
||||||
{
|
{
|
||||||
@@ -121,4 +133,4 @@ class InvoiceSpreadsheet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by Pensare Software.
|
||||||
|
* User: Theo Weijmer
|
||||||
|
* Date: 30/07/2018
|
||||||
|
* Time: 10:48
|
||||||
|
*/
|
||||||
|
|
||||||
|
class InvoicedSheet {
|
||||||
|
|
||||||
|
const HEADERS = [
|
||||||
|
'A' => 'factuurnummer',
|
||||||
|
'B' => 'project',
|
||||||
|
'C' => 'klant',
|
||||||
|
'D' => 'factuurdatum',
|
||||||
|
'E' => 'exc btw',
|
||||||
|
'F' => 'btw',
|
||||||
|
'G' => 'incl btw'
|
||||||
|
];
|
||||||
|
|
||||||
|
private $invoiced;
|
||||||
|
private $sheet;
|
||||||
|
private $row;
|
||||||
|
|
||||||
|
public function __construct( $invoiced, $sheet )
|
||||||
|
{
|
||||||
|
$this->invoiced = $invoiced;
|
||||||
|
$this->sheet = $sheet;
|
||||||
|
|
||||||
|
$this->handle();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function handle()
|
||||||
|
{
|
||||||
|
$this->setHeader();
|
||||||
|
|
||||||
|
$this->setBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setHeader()
|
||||||
|
{
|
||||||
|
foreach ( self::HEADERS as $cell => $header )
|
||||||
|
{
|
||||||
|
$this->sheet->setCellValue( $cell . '1', $header );
|
||||||
|
$this->sheet->getColumnDimension( $cell )->setAutoSize( TRUE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setBody()
|
||||||
|
{
|
||||||
|
$this->row = 2;
|
||||||
|
foreach ( $this->invoiced AS $invoice )
|
||||||
|
{
|
||||||
|
$vat = ROUND($invoice->invoiceamount * 0.21, 2);
|
||||||
|
$this->sheet->setCellValue( 'A' . $this->row, $invoice->invoicenumber );
|
||||||
|
$this->sheet->setCellValue( 'B' . $this->row, ($invoice->projectnumber . ' ' . $invoice['projectname']));
|
||||||
|
$this->sheet->setCellValue( 'C' . $this->row, $invoice->name );
|
||||||
|
$this->sheet->setCellValue( 'D' . $this->row, $invoice->invoicenumber );
|
||||||
|
$this->sheet->setCellValue( 'E' . $this->row, $invoice->invoiceamount );
|
||||||
|
$this->sheet->setCellValue( 'F' . $this->row, $vat );
|
||||||
|
$this->sheet->setCellValue( 'G' . $this->row, $invoice->invoiceamount + $vat );
|
||||||
|
|
||||||
|
$this->row ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,104 +8,126 @@
|
|||||||
|
|
||||||
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;
|
||||||
|
private $invoicedYears;
|
||||||
|
private $invoiced;
|
||||||
|
|
||||||
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->setInvoicedyears();
|
||||||
{
|
|
||||||
$this->projects =
|
|
||||||
Project::getProjectsForReport( $this->orderType, $this->orderDirection, $this->archive );
|
|
||||||
}
|
|
||||||
|
|
||||||
private function loopProjects()
|
$this->setInvoiced();
|
||||||
{
|
|
||||||
foreach ( $this->projects as $this->project )
|
|
||||||
{
|
|
||||||
$this->setInvoiceOverview();
|
|
||||||
|
|
||||||
$this->setInvoiceForecasts();
|
$this->setInvoiceReport();
|
||||||
|
}
|
||||||
|
|
||||||
$this->setMonthForecasts();
|
private function setProjects()
|
||||||
|
{
|
||||||
|
$this->projects =
|
||||||
|
Project::getProjectsForReport( $this->orderType, $this->orderDirection, $this->archive );
|
||||||
|
}
|
||||||
|
|
||||||
$this->setMonthPayments();
|
private function loopProjects()
|
||||||
}
|
{
|
||||||
}
|
foreach ( $this->projects as $this->project )
|
||||||
|
{
|
||||||
|
$this->setInvoiceOverview();
|
||||||
|
|
||||||
private function setInvoiceOverview()
|
$this->setInvoiceForecasts();
|
||||||
{
|
|
||||||
$this->invoiceOverview = new InvoiceOverview( $this->project, $this->year );
|
|
||||||
|
|
||||||
$this->invoiceOverviews[] = $this->invoiceOverview->getProjectDetails();
|
$this->setMonthForecasts();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function setInvoiceForecasts()
|
private function setInvoiceOverview()
|
||||||
{
|
{
|
||||||
$this->invoiceForecast =
|
$this->invoiceOverview = new InvoiceOverview( $this->project, $this->year );
|
||||||
new InvoiceForecast( $this->project, $this->invoiceOverview->getNeedinvoice(), $this->year );
|
|
||||||
|
|
||||||
$this->invoiceForecasts[] = $this->invoiceForecast->getProjectDetails();
|
$this->invoiceOverviews[] = $this->invoiceOverview->getProjectDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMonthForecasts()
|
private function setInvoiceForecasts()
|
||||||
{
|
{
|
||||||
$this->monthForecast =
|
$this->invoiceForecast =
|
||||||
new MonthForecast( $this->invoiceForecast, $this->project, $this->year );
|
new InvoiceForecast( $this->project, $this->invoiceOverview->getNeedinvoice(), $this->year );
|
||||||
|
|
||||||
$this->monthForecasts[] = $this->monthForecast->getProjectDetails();
|
$this->invoiceForecasts[] = $this->invoiceForecast->getProjectDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMonthPayments()
|
public function setMonthForecasts()
|
||||||
{
|
{
|
||||||
$this->monthPayment =
|
$this->monthForecast =
|
||||||
new MonthPayments( $this->project, $this->year );
|
new MonthForecast( $this->invoiceForecast, $this->project, $this->year );
|
||||||
|
|
||||||
$this->monthPayments[] = $this->monthPayment->getProjectDetails();
|
$this->monthForecasts[] = $this->monthForecast->getProjectDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setInvoiceReport()
|
public function setMonthPayments()
|
||||||
{
|
{
|
||||||
$this->invoiceReport = [
|
$monthPayment = new MonthPayments(
|
||||||
'invoiceOverview' => $this->invoiceOverviews,
|
$this->year, $this->orderType, $this->orderDirection );
|
||||||
'forecasts' => $this->invoiceForecasts,
|
|
||||||
'monthForecasts' => $this->monthForecasts,
|
$this->monthPayments = $monthPayment->getProjectDetails();
|
||||||
'monthPayments' => $this->monthPayments
|
}
|
||||||
];
|
|
||||||
}
|
private function setInvoiced()
|
||||||
}
|
{
|
||||||
|
$this->invoiced = Invoice::getInvoiced( $this->year );
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setInvoicedYears()
|
||||||
|
{
|
||||||
|
$this->invoicedYears = Invoice::selectRaw( 'DATE_FORMAT(invoicedate, "%Y") AS years' )
|
||||||
|
->distinct()
|
||||||
|
->orderBy( 'invoicedate' )
|
||||||
|
->lists( 'years' );
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setInvoiceReport()
|
||||||
|
{
|
||||||
|
$this->invoiceReport = [
|
||||||
|
'invoiceOverview' => $this->invoiceOverviews,
|
||||||
|
'forecasts' => $this->invoiceForecasts,
|
||||||
|
'monthForecasts' => $this->monthForecasts,
|
||||||
|
'monthPayments' => $this->monthPayments,
|
||||||
|
'invoicedYears' => $this->invoicedYears,
|
||||||
|
'invoiced' => $this->invoiced
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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, ',', '.' )
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -62,4 +62,16 @@ class Invoice extends BaseModel {
|
|||||||
|
|
||||||
return $invoiceID;
|
return $invoiceID;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public static function getInvoiced( $year )
|
||||||
|
{
|
||||||
|
$invoiced = Invoice::selectRaw('invoicenumber, PRJ.projectname, projectnumber, CUS.name, invoicedate, CUS.name, invoiceamount')
|
||||||
|
->join('projects AS PRJ', 'PRJ.id', '=', 'invoices.project_id')
|
||||||
|
->join('customers AS CUS', 'CUS.id', '=', 'PRJ.customer_id')
|
||||||
|
->whereRaw("DATE_FORMAT(invoicedate, '%Y') = {$year}")
|
||||||
|
->orderBy('invoicedate')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return $invoiced;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -77,4 +77,4 @@ class QEmployeeHours {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class QinvoiceMonthOverview {
|
|||||||
|
|
||||||
public static function fire( $projectID, $year )
|
public static function fire( $projectID, $year )
|
||||||
{
|
{
|
||||||
$sql = "SELECT MNT.id,
|
$sql = "SELECT MNT.id,
|
||||||
month,
|
month,
|
||||||
COALESCE(forecastamount, 0) AS forecastamount,
|
COALESCE(forecastamount, 0) AS forecastamount,
|
||||||
COALESCE(paymentamount, 0) AS paymentamount
|
COALESCE(paymentamount, 0) AS paymentamount
|
||||||
@@ -34,10 +34,10 @@ class QinvoiceMonthOverview {
|
|||||||
) AS PAY
|
) AS PAY
|
||||||
ON MNT.id = PAY.month_id
|
ON MNT.id = PAY.month_id
|
||||||
LEFT JOIN projects PRJ
|
LEFT JOIN projects PRJ
|
||||||
GROUP BY MNT.id
|
GROUP BY MNT.id
|
||||||
ORDER BY MNT.id ";
|
ORDER BY MNT.id ";
|
||||||
|
|
||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ class ReservationTotals {
|
|||||||
public static function fire()
|
public static function fire()
|
||||||
{
|
{
|
||||||
// UNION ALL wordt gebruikt voor een full outer join
|
// UNION ALL wordt gebruikt voor een full outer join
|
||||||
$sql = " SELECT PRJ.id AS projectID, external_id AS externalID,
|
$sql = "SELECT PRJ.id AS projectID, external_id AS externalID,
|
||||||
|
PRJ.projectname,
|
||||||
COALESCE(fromreservation, 0) AS fromreservation,
|
COALESCE(fromreservation, 0) AS fromreservation,
|
||||||
COALESCE(Q5.costs, 0) AS costs, COALESCE(reservation, 0) AS reservation,
|
COALESCE(Q5.costs, 0) AS costs, COALESCE(reservation, 0) AS reservation,
|
||||||
COALESCE(payed, 0) AS payed, (COALESCE(reservation, 0) - COALESCE(fromreservation, 0)) AS saldo,
|
COALESCE(payed, 0) AS payed, (COALESCE(reservation, 0) - COALESCE(fromreservation, 0)) AS saldo,
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -9,7 +9,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">
|
||||||
|
|||||||
@@ -48,9 +48,12 @@
|
|||||||
<a class="nav-link"
|
<a class="nav-link"
|
||||||
data-bind="css:{'active':invoiceTab() == 'monthforecast'}">maand prognoses</a>
|
data-bind="css:{'active':invoiceTab() == 'monthforecast'}">maand prognoses</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" data-bind="click:setActivetab.bind($data, 'monthpayments')" style="z-index:10">
|
<li class="nav-item" data-bind="click:setActivetab.bind($data, 'monthpayments')" style="z-index:10">
|
||||||
<a class="nav-link" data-bind="css:{'active':invoiceTab() == 'monthpayments'}">maand betalingen</a>
|
<a class="nav-link" data-bind="css:{'active':invoiceTab() == 'monthpayments'}">maand betalingen</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item" data-bind="click:setActivetab.bind($data, 'invoices')" style="z-index:10">
|
||||||
|
<a class="nav-link" data-bind="css:{'active':invoiceTab() == 'invoices'}">ontvangen facturen</a>
|
||||||
|
</li>
|
||||||
<!-- <li class="nav-item" data-bind="click:setActivetab.bind($data, 'externals')" style="z-index:10">-->
|
<!-- <li class="nav-item" data-bind="click:setActivetab.bind($data, 'externals')" style="z-index:10">-->
|
||||||
<!-- <a class="nav-link" data-bind="css:{'active':invoiceTab() == 'externals'}">onderaannemers</a>-->
|
<!-- <a class="nav-link" data-bind="css:{'active':invoiceTab() == 'externals'}">onderaannemers</a>-->
|
||||||
<!-- </li>-->
|
<!-- </li>-->
|
||||||
@@ -65,9 +68,12 @@
|
|||||||
<div id="invoiceforecast" data-bind="visible:invoiceTab() == 'monthforecast'">
|
<div id="invoiceforecast" data-bind="visible:invoiceTab() == 'monthforecast'">
|
||||||
<?php $this->load->view('reports/invoices/monthforecast_report'); ?>
|
<?php $this->load->view('reports/invoices/monthforecast_report'); ?>
|
||||||
</div>
|
</div>
|
||||||
<div id="invoiceforecast" data-bind="visible:invoiceTab() == 'monthpayments'">
|
<div id="invoiceforecast" data-bind="visible:invoiceTab() == 'monthpayments'">
|
||||||
<?php $this->load->view('reports/invoices/monthpayment_report'); ?>
|
<?php $this->load->view('reports/invoices/monthpayment_report'); ?>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="invoiceforecast" data-bind="visible:invoiceTab() == 'invoices'">
|
||||||
|
<?php $this->load->view('reports/invoices/invoices_report'); ?>
|
||||||
|
</div>
|
||||||
<!-- <div id="invoiceforecast" data-bind="visible:invoiceTab() == 'externals'">-->
|
<!-- <div id="invoiceforecast" data-bind="visible:invoiceTab() == 'externals'">-->
|
||||||
<!-- --><?php //$this->load->view('reports/invoices/contractors_report'); ?>
|
<!-- --><?php //$this->load->view('reports/invoices/contractors_report'); ?>
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
@@ -76,4 +82,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -92,7 +92,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>
|
||||||
|
|||||||
@@ -7,16 +7,16 @@
|
|||||||
<table class="table table-condensed">
|
<table class="table table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="3%"> </th>
|
<th width="2%"> </th>
|
||||||
<th width="17%">project</th>
|
<th width="34%">project</th>
|
||||||
<th width="10%" class="align-right">Kosten derden</th>
|
<th width="8%" class="align-right">Kosten derden</th>
|
||||||
<th width="10%" class="align-right">factuur INK</th>
|
<th width="8%" class="align-right">factuur INK</th>
|
||||||
<th width="10%" class="align-right">budget gereserveerd</th>
|
<th width="8%" class="align-right">gereserveerd op<br/>spaarrekening</th>
|
||||||
<th width="10%" class="align-right">betaald</th>
|
<th width="8%" class="align-right">betaald</th>
|
||||||
<th width="10%" class="align-right">saldo te<br />betalen</th>
|
<th width="8%" class="align-right">nog te betalen<br />facturen</th>
|
||||||
<th width="10%" class="align-right">betaald via<br />reserveringen</th>
|
<th width="8%" class="align-right">betaald via<br />reserveringen</th>
|
||||||
<th width="10%" class="align-right">saldo reservering</th>
|
<th width="8%" class="align-right">saldo reservering</th>
|
||||||
<th width="10%" class="align-right">saldo facturen INK</th>
|
<th width="8%" class="align-right">saldo facturen INK</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<!-- ko foreach:projects -->
|
<!-- ko foreach:projects -->
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<table class="table table-striped table-condensed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
factuurnummer
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
project
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
klant
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
factuur datum
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
excl btw
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
btw
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
incl btw
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody data-bind="foreach:invoiced">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<span data-bind="text:invoicenumber"></span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span data-bind="text:project"></span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span data-bind="text:name"></span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span data-bind="text:invoicedate"></span>
|
||||||
|
</td>
|
||||||
|
<td class="align-right">
|
||||||
|
<span data-bind="text:invoiceamount"></span>
|
||||||
|
</td>
|
||||||
|
<td class="align-right">
|
||||||
|
<span data-bind="text:vat"></span>
|
||||||
|
</td>
|
||||||
|
<td class="align-right">
|
||||||
|
<span data-bind="text:inclVat"></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -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
@@ -181,12 +181,15 @@ dbo.employeehoursInit = function () {
|
|||||||
var employeeID = vm.selectedEmployeeID() || 0;
|
var employeeID = vm.selectedEmployeeID() || 0;
|
||||||
|
|
||||||
vm.employeehours.removeAll();
|
vm.employeehours.removeAll();
|
||||||
dbo.employeehoursDataService.getEmployeehours(
|
|
||||||
vm.selectedMonth(), vm.selectedYear(), employeeID, function ( data ) {
|
setTimeout(function(){
|
||||||
$.each( data, function ( i, p ) {
|
dbo.employeehoursDataService.getEmployeehours(
|
||||||
vm.employeehours.push( new vm.Employeehour( p ) );
|
vm.selectedMonth(), vm.selectedYear(), employeeID, function ( data ) {
|
||||||
|
$.each( data, function ( i, p ) {
|
||||||
|
vm.employeehours.push( new vm.Employeehour( p ) );
|
||||||
|
} );
|
||||||
} );
|
} );
|
||||||
} );
|
}, 1000);
|
||||||
},
|
},
|
||||||
|
|
||||||
validateNumber: function ( field ) {
|
validateNumber: function ( field ) {
|
||||||
@@ -249,8 +252,6 @@ dbo.employeehoursInit = function () {
|
|||||||
self.hours( 0 );
|
self.hours( 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,254 +5,273 @@
|
|||||||
* Time: 11:43
|
* Time: 11:43
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
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(),
|
years : ko.observableArray([]),
|
||||||
invoiceOverview : ko.observableArray( [] ),
|
selectedYear : ko.observable(),
|
||||||
forecasts : ko.observableArray( [] ),
|
invoiceOverview : ko.observableArray([]),
|
||||||
monthForecasts : ko.observableArray( [] ),
|
forecasts : ko.observableArray([]),
|
||||||
monthPayments : ko.observableArray( [] ),
|
monthForecasts : ko.observableArray([]),
|
||||||
months : ko.observableArray( [] ),
|
monthPayments : ko.observableArray([]),
|
||||||
monthTotals : ko.observableArray( [] ),
|
months : ko.observableArray([]),
|
||||||
monthPaymentTotals : ko.observableArray( [] ),
|
monthTotals : ko.observableArray([]),
|
||||||
validYear : ko.observable(),
|
monthPaymentTotals : ko.observableArray([]),
|
||||||
invoiceTab : ko.observable(),
|
validYear : ko.observable(),
|
||||||
totalToInvoicingExcl : ko.observable(),
|
invoiceTab : ko.observable(),
|
||||||
totalToInvoicingIncl : ko.observable(),
|
totalToInvoicingExcl : ko.observable(),
|
||||||
totalInvoicedOtherYears: ko.observable(),
|
totalToInvoicingIncl : ko.observable(),
|
||||||
totalInvoicedThisYear : ko.observable(),
|
totalInvoicedOtherYears: ko.observable(),
|
||||||
totalPayment : ko.observable(),
|
totalInvoicedThisYear : ko.observable(),
|
||||||
totalToPay : ko.observable(),
|
totalPayment : ko.observable(),
|
||||||
invoicesTotal : ko.observable(),
|
totalToPay : ko.observable(),
|
||||||
needInvoice : ko.observable(),
|
invoicesTotal : ko.observable(),
|
||||||
forecastThisYear : ko.observable(),
|
needInvoice : ko.observable(),
|
||||||
forecastOtherYears : ko.observable(),
|
forecastThisYear : ko.observable(),
|
||||||
forecastRemaining : ko.observable(),
|
forecastOtherYears : ko.observable(),
|
||||||
totalProjectPayments : ko.observable(),
|
forecastRemaining : ko.observable(),
|
||||||
orderType : 'projectnumber',
|
totalProjectPayments : ko.observable(),
|
||||||
orderDirection : false,
|
orderType : 'projectnumber',
|
||||||
archive : ko.observable( false ),
|
orderDirection : false,
|
||||||
|
archive : ko.observable(false),
|
||||||
|
recievedInvoices : ko.observableArray([]),
|
||||||
|
invoiced : ko.observableArray([]),
|
||||||
|
|
||||||
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() ) );
|
})
|
||||||
} );
|
|
||||||
|
|
||||||
} );
|
vm.years(data.invoicedYears);
|
||||||
},
|
|
||||||
|
|
||||||
toggleArchive: function () {
|
vm.invoiced.removeAll()
|
||||||
var vm = dbo.invoicereport;
|
_.each(data.invoiced, function(p){
|
||||||
vm.archive( !vm.archive() );
|
vm.invoiced.push( new vm.Invoice(p));
|
||||||
|
});
|
||||||
|
|
||||||
vm.initModule();
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
sortList: function ( orderType ) {
|
toggleArchive: function () {
|
||||||
var vm = dbo.invoicereport;
|
var vm = dbo.invoicereport
|
||||||
|
vm.archive(!vm.archive())
|
||||||
|
|
||||||
vm.orderType = orderType;
|
vm.initModule()
|
||||||
vm.orderDirection = !vm.orderDirection;
|
},
|
||||||
|
|
||||||
vm.initModule();
|
sortList: function (orderType) {
|
||||||
},
|
var vm = dbo.invoicereport
|
||||||
|
|
||||||
resetTotals: function () {
|
vm.orderType = orderType
|
||||||
var vm = dbo.invoicereport;
|
vm.orderDirection = !vm.orderDirection
|
||||||
|
|
||||||
vm.totalToInvoicingExcl( 0 );
|
vm.initModule()
|
||||||
vm.totalToInvoicingIncl( 0 );
|
},
|
||||||
vm.totalInvoicedOtherYears( 0 );
|
|
||||||
vm.totalInvoicedThisYear( 0 );
|
|
||||||
vm.invoicesTotal( 0 );
|
|
||||||
vm.totalPayment( 0 );
|
|
||||||
vm.totalToPay( 0 );
|
|
||||||
vm.needInvoice( 0 );
|
|
||||||
vm.forecastThisYear( 0 );
|
|
||||||
vm.forecastOtherYears( 0 );
|
|
||||||
vm.forecastRemaining( 0 );
|
|
||||||
vm.totalProjectPayments( 0 );
|
|
||||||
|
|
||||||
vm.monthTotals.removeAll();
|
resetTotals: function () {
|
||||||
vm.monthPaymentTotals.removeAll();
|
var vm = dbo.invoicereport
|
||||||
for ( var i = 1; i <= 12; i++ ) {
|
|
||||||
vm.monthTotals.push( {monthID: i, forecastamount: ko.observable( 0 )} );
|
|
||||||
vm.monthPaymentTotals.push( {monthID: i, paymentamount: ko.observable( 0 )} );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
setInvoiceOverviewTotals: function ( data ) {
|
vm.totalToInvoicingExcl(0)
|
||||||
var vm = dbo.invoicereport;
|
vm.totalToInvoicingIncl(0)
|
||||||
|
vm.totalInvoicedOtherYears(0)
|
||||||
|
vm.totalInvoicedThisYear(0)
|
||||||
|
vm.invoicesTotal(0)
|
||||||
|
vm.totalPayment(0)
|
||||||
|
vm.totalToPay(0)
|
||||||
|
vm.needInvoice(Number(0))
|
||||||
|
vm.forecastThisYear(0)
|
||||||
|
vm.forecastOtherYears(0)
|
||||||
|
vm.forecastRemaining(0)
|
||||||
|
vm.totalProjectPayments(0)
|
||||||
|
|
||||||
_.each( data, function ( p ) {
|
vm.monthTotals.removeAll()
|
||||||
vm.totalToInvoicingExcl( vm.totalToInvoicingExcl() + Number( p.totalToInvoicingExcl.replace( '.', '' ) ) );
|
vm.monthPaymentTotals.removeAll()
|
||||||
vm.totalToInvoicingIncl( vm.totalToInvoicingIncl() + Number( p.totalToInvoicingIncl.replace( '.', '' ) ) );
|
for (var i = 1; i <= 12; i++) {
|
||||||
vm.totalInvoicedOtherYears( vm.totalInvoicedOtherYears() + Number( p.totalInvoicedOtherYears.replace( '.', '' ) ) );
|
vm.monthTotals.push({ monthID: i, forecastamount: ko.observable(0) })
|
||||||
vm.totalInvoicedThisYear( vm.totalInvoicedThisYear() + Number( p.totalInvoicedThisYear.replace( '.', '' ) ) );
|
vm.monthPaymentTotals.push({ monthID: i, paymentamount: ko.observable(0) })
|
||||||
vm.invoicesTotal( vm.invoicesTotal() + Number( p.invoicesTotal.replace( '.', '' ) ) );
|
}
|
||||||
vm.totalPayment( vm.totalPayment() + Number( p.projectPayment.replace( '.', '' ) ) );
|
},
|
||||||
vm.totalToPay( vm.totalToPay() + Number( p.invoiceToPay.replace( '.', '' ) ) );
|
|
||||||
vm.needInvoice( vm.needInvoice() + Number( p.needInvoice.replace( '.', '' ) ) );
|
|
||||||
} );
|
|
||||||
|
|
||||||
vm.totalToInvoicingExcl( dbo.helpers.thousandSeparator( vm.totalToInvoicingExcl() ) );
|
setInvoiceOverviewTotals: function (data) {
|
||||||
vm.totalToInvoicingIncl( dbo.helpers.thousandSeparator( vm.totalToInvoicingIncl() ) );
|
var vm = dbo.invoicereport
|
||||||
vm.totalInvoicedOtherYears( dbo.helpers.thousandSeparator( vm.totalInvoicedOtherYears() ) );
|
|
||||||
vm.totalInvoicedThisYear( dbo.helpers.thousandSeparator( vm.totalInvoicedThisYear() ) );
|
|
||||||
vm.invoicesTotal( dbo.helpers.thousandSeparator( vm.invoicesTotal() ) );
|
|
||||||
vm.totalPayment( dbo.helpers.thousandSeparator( vm.totalPayment() ) );
|
|
||||||
vm.totalToPay( dbo.helpers.thousandSeparator( vm.totalToPay() ) );
|
|
||||||
vm.needInvoice( dbo.helpers.thousandSeparator( vm.needInvoice() ) );
|
|
||||||
},
|
|
||||||
|
|
||||||
setForecastsTotals: function ( data ) {
|
_.each(data, function (p) {
|
||||||
var vm = dbo.invoicereport;
|
vm.totalToInvoicingExcl(vm.totalToInvoicingExcl() + Number(p.totalToInvoicingExcl.replace('.', '')))
|
||||||
|
vm.totalToInvoicingIncl(vm.totalToInvoicingIncl() + Number(p.totalToInvoicingIncl.replace('.', '')))
|
||||||
|
vm.totalInvoicedOtherYears(vm.totalInvoicedOtherYears() + Number(p.totalInvoicedOtherYears.replace('.', '')))
|
||||||
|
vm.totalInvoicedThisYear(vm.totalInvoicedThisYear() + Number(p.totalInvoicedThisYear.replace('.', '')))
|
||||||
|
vm.invoicesTotal(vm.invoicesTotal() + Number(p.invoicesTotal.replace('.', '')))
|
||||||
|
vm.totalPayment(vm.totalPayment() + Number(p.projectPayment.replace('.', '')))
|
||||||
|
vm.totalToPay(vm.totalToPay() + Number(p.invoiceToPay.replace('.', '')))
|
||||||
|
vm.needInvoice(Number(vm.needInvoice()) + Number(p.needInvoice.replace('.', '')))
|
||||||
|
})
|
||||||
|
|
||||||
_.each( data, function ( p ) {
|
vm.totalToInvoicingExcl(dbo.helpers.thousandSeparator(vm.totalToInvoicingExcl()))
|
||||||
vm.forecastThisYear( vm.forecastThisYear() + Number( p.forecastThisYear.replace( '.', '' ) ) );
|
vm.totalToInvoicingIncl(dbo.helpers.thousandSeparator(vm.totalToInvoicingIncl()))
|
||||||
vm.forecastOtherYears( vm.forecastOtherYears() + Number( p.forecastOtherYears.replace( '.', '' ) ) );
|
vm.totalInvoicedOtherYears(dbo.helpers.thousandSeparator(vm.totalInvoicedOtherYears()))
|
||||||
vm.forecastRemaining( vm.forecastRemaining() + Number( p.forecastRemaining.replace( '.', '' ) ) );
|
vm.totalInvoicedThisYear(dbo.helpers.thousandSeparator(vm.totalInvoicedThisYear()))
|
||||||
} );
|
vm.invoicesTotal(dbo.helpers.thousandSeparator(vm.invoicesTotal()))
|
||||||
vm.forecastThisYear( dbo.helpers.thousandSeparator( vm.forecastThisYear() ) );
|
vm.totalPayment(dbo.helpers.thousandSeparator(vm.totalPayment()))
|
||||||
vm.forecastOtherYears( dbo.helpers.thousandSeparator( vm.forecastOtherYears() ) );
|
vm.totalToPay(dbo.helpers.thousandSeparator(vm.totalToPay()))
|
||||||
vm.forecastRemaining( dbo.helpers.thousandSeparator( vm.forecastRemaining() ) );
|
vm.needInvoice(dbo.helpers.thousandSeparator(vm.needInvoice()))
|
||||||
},
|
},
|
||||||
|
|
||||||
setForecastMonthsTotals: function ( data ) {
|
setForecastsTotals: function (data) {
|
||||||
var vm = dbo.invoicereport;
|
var vm = dbo.invoicereport
|
||||||
|
|
||||||
_.each( data, function ( p ) {
|
_.each(data, function (p) {
|
||||||
_.each( p.forecastMonths(), function ( q ) {
|
vm.forecastThisYear(vm.forecastThisYear() + Number(p.forecastThisYear.replace('.', '')))
|
||||||
vm.forecastMonths( vm.forecastMonths() + q );
|
vm.forecastOtherYears(vm.forecastOtherYears() + Number(p.forecastOtherYears.replace('.', '')))
|
||||||
} );
|
vm.forecastRemaining(vm.forecastRemaining() + Number(p.forecastRemaining.replace('.', '')))
|
||||||
} );
|
})
|
||||||
},
|
vm.forecastThisYear(dbo.helpers.thousandSeparator(vm.forecastThisYear()))
|
||||||
|
vm.forecastOtherYears(dbo.helpers.thousandSeparator(vm.forecastOtherYears()))
|
||||||
|
vm.forecastRemaining(dbo.helpers.thousandSeparator(vm.forecastRemaining()))
|
||||||
|
},
|
||||||
|
|
||||||
checkYear: function () {
|
setForecastMonthsTotals: function (data) {
|
||||||
var vm = dbo.invoicereport;
|
console.log(data)
|
||||||
if ( !Number.isInteger( Number( vm.selectedYear() ) ) ) return vm.validYear( false );
|
var vm = dbo.invoicereport
|
||||||
if ( Number( vm.selectedYear() ) > 2100 ) return vm.validYear( false );
|
|
||||||
if ( Number( vm.selectedYear() ) < 2000 ) return vm.validYear( false );
|
|
||||||
vm.validYear( true );
|
|
||||||
|
|
||||||
vm.initModule();
|
_.each(data, function (p) {
|
||||||
},
|
_.each(p.forecastMonths(), function (q) {
|
||||||
|
vm.forecastMonths(vm.forecastMonths() + q)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
setActivetab: function ( page ) {
|
checkYear: function () {
|
||||||
var vm = dbo.invoicereport;
|
var vm = dbo.invoicereport
|
||||||
|
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.validYear(true)
|
||||||
|
|
||||||
vm.invoiceTab( page );
|
vm.initModule()
|
||||||
},
|
},
|
||||||
|
|
||||||
Monthforecast: function ( data ) {
|
setActivetab: function (page) {
|
||||||
var vm = dbo.invoicereport;
|
var vm = dbo.invoicereport
|
||||||
var self = this;
|
|
||||||
self.projectnumber = data.projectnumber;
|
|
||||||
self.projectname = data.projectname;
|
|
||||||
self.customer = data.customer;
|
|
||||||
self.needInvoice = data.needInvoice;
|
|
||||||
self.forecastOtherYears = data.forecastOtherYears;
|
|
||||||
self.forecastRemaining = data.forecastRemaining;
|
|
||||||
|
|
||||||
self.forecastMonths = ko.observableArray( [] );
|
vm.invoiceTab(page)
|
||||||
_.each( data.forecastMonths, function ( p, i ) {
|
},
|
||||||
self.forecastMonths.push( new vm.ForecastMonth( p ) );
|
|
||||||
_.each( vm.monthTotals(), function ( q ) {
|
|
||||||
if ( q.monthID == i ) q.forecastamount( Number( q.forecastamount() ) + Number( p.forecastamount ) );
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
},
|
|
||||||
|
|
||||||
ForecastMonth: function ( data ) {
|
Monthforecast: function (data) {
|
||||||
this.forecastamount = dbo.helpers.thousandSeparator( data.forecastamount );
|
var vm = dbo.invoicereport
|
||||||
},
|
var self = this
|
||||||
|
self.projectnumber = data.projectnumber
|
||||||
|
self.projectname = data.projectname
|
||||||
|
self.customer = data.customer
|
||||||
|
self.needInvoice = data.needInvoice
|
||||||
|
self.forecastOtherYears = data.forecastOtherYears
|
||||||
|
self.forecastRemaining = data.forecastRemaining
|
||||||
|
|
||||||
Monthpayment: function ( data ) {
|
self.forecastMonths = ko.observableArray([])
|
||||||
var vm = dbo.invoicereport;
|
_.each(data.forecastMonths, function (p, i) {
|
||||||
var self = this;
|
self.forecastMonths.push(new vm.ForecastMonth(p))
|
||||||
self.projectname = data.projectname;
|
_.each(vm.monthTotals(), function (q) {
|
||||||
self.customer = data.customer;
|
if (q.monthID == (i + 1)) q.forecastamount(Math.round(Number(q.forecastamount())) + Math.round(Number(p.forecastamount)))
|
||||||
self.totalProjectPayments = data.totalProjectPayments;
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
self.paymentMonths = ko.observableArray( [] );
|
ForecastMonth: function (data) {
|
||||||
_.each( data.monthPayments, function ( p, i ) {
|
this.forecastamount = dbo.helpers.thousandSeparator(Math.round(data.forecastamount))
|
||||||
self.paymentMonths.push( new vm.PaymentMonth( p ) );
|
},
|
||||||
_.each( vm.monthPaymentTotals(), function ( q ) {
|
|
||||||
if ( q.monthID == i ) q.paymentamount( Number( q.paymentamount() ) + Number( p.paymentamount ) );
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
},
|
|
||||||
|
|
||||||
PaymentMonth: function ( data ) {
|
Monthpayment: function (data) {
|
||||||
this.paymentamount = dbo.helpers.thousandSeparator( data.paymentamount );
|
var vm = dbo.invoicereport
|
||||||
},
|
var self = this
|
||||||
|
self.projectname = data.projectname
|
||||||
|
self.customer = data.customer
|
||||||
|
self.totalProjectPayments = data.totalProjectPayments
|
||||||
|
|
||||||
createSpreadsheet: function () {
|
self.paymentMonths = ko.observableArray([])
|
||||||
var vm = dbo.invoicereport;
|
_.each(data.monthPayments, function (p, i) {
|
||||||
|
self.paymentMonths.push(new vm.PaymentMonth(p))
|
||||||
|
_.each(vm.monthPaymentTotals(), function (q) {
|
||||||
|
if (q.monthID == i) q.paymentamount(Math.round(Number(q.paymentamount())) + Math.round(Number(p.paymentamount)))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
var orderDirection = vm.orderDirection ? 'ASC' : 'DESC';
|
PaymentMonth: function (data) {
|
||||||
var archive = vm.archive() ? 'T' : 'F';
|
this.paymentamount = dbo.helpers.thousandSeparator(Math.round(data.paymentamount))
|
||||||
|
},
|
||||||
|
|
||||||
var url = 'index.php/reports/reportsController/createInvoicesSpreadsheet/' + vm.selectedYear() + '/' + vm.orderType + '/' + orderDirection + '/' + archive;
|
Invoice : function(data){
|
||||||
window.open( url, '_blank' );
|
var vat = Math.round((data.invoiceamount * 21) / 100);
|
||||||
}
|
var inclVat = vat + Number(data.invoiceamount);
|
||||||
}
|
this.invoiceamount = dbo.helpers.thousandSeparator(data.invoiceamount)
|
||||||
|
this.vat = dbo.helpers.thousandSeparator(vat)
|
||||||
|
this.inclVat = dbo.helpers.thousandSeparator(inclVat)
|
||||||
|
this.project = data.projectnumber + ' ' + data.projectname
|
||||||
|
this.invoicedate = data.invoicedate
|
||||||
|
this.name = data.name
|
||||||
|
this.invoicenumber = ko.observable(data.invoicenumber)
|
||||||
|
},
|
||||||
|
|
||||||
dbo.invoicereport.init();
|
createSpreadsheet: function () {
|
||||||
|
var vm = dbo.invoicereport
|
||||||
|
|
||||||
ko.applyBindings(
|
var orderDirection = vm.orderDirection ? 'ASC' : 'DESC'
|
||||||
dbo.invoicereport, document.getElementById( "INVOICEREPORT" ) );
|
var archive = vm.archive() ? 'T' : 'F'
|
||||||
|
|
||||||
|
var url = 'index.php/reports/reportsController/createInvoicesSpreadsheet/' + vm.selectedYear() + '/' + vm.orderType + '/' + orderDirection + '/' + archive
|
||||||
|
window.open(url, '_blank')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
dbo.invoicereport.init()
|
||||||
|
|
||||||
|
ko.applyBindings(
|
||||||
|
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" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ dbo.reservationsInit = function () {
|
|||||||
var vm = dbo.reservationsModel;
|
var vm = dbo.reservationsModel;
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.projectnumber = data.projectnumber;
|
self.projectnumber = data.projectnumber + ' ' + data.projectname;
|
||||||
self.costs = dbo.helpers.numberWithPoints( data.costs );
|
self.costs = dbo.helpers.numberWithPoints( data.costs );
|
||||||
self.reservation = dbo.helpers.numberWithPoints( data.reservation );
|
self.reservation = dbo.helpers.numberWithPoints( data.reservation );
|
||||||
self.payed = dbo.helpers.numberWithPoints( data.payed );
|
self.payed = dbo.helpers.numberWithPoints( data.payed );
|
||||||
|
|||||||
Reference in New Issue
Block a user