Merge branch 'master' of bitbucket.org:pensare/dbois

# Conflicts:
#	application/views/modals/partials/_reservations.php
#	application/views/pages/reservations_view.php
This commit is contained in:
2019-10-31 14:04:47 +01:00
25 changed files with 6792 additions and 2028 deletions
@@ -67,6 +67,13 @@ class usersController extends MY_Controller {
$this->json( $projectEmployees ); $this->json( $projectEmployees );
} }
public function getUniqueEmployeesWithActivity($archive)
{
$projectEmployees = Projectemployee::getUniqueEmployeesWithActivity($archive);
$this->json( $projectEmployees );
}
public function saveUser() public function saveUser()
{ {
$userValidation = new UserValidation(); $userValidation = new UserValidation();
@@ -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();
@@ -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()
@@ -45,6 +45,9 @@ class Invoices {
$this->loopProjects(); $this->loopProjects();
//only projects with payments also archived projects
$this->setMonthPayments();
$this->setInvoiceReport(); $this->setInvoiceReport();
} }
@@ -63,8 +66,6 @@ class Invoices {
$this->setInvoiceForecasts(); $this->setInvoiceForecasts();
$this->setMonthForecasts(); $this->setMonthForecasts();
$this->setMonthPayments();
} }
} }
@@ -93,10 +94,10 @@ class Invoices {
public function setMonthPayments() public function setMonthPayments()
{ {
$this->monthPayment = $monthPayment = new MonthPayments(
new MonthPayments( $this->project, $this->year ); $this->year, $this->orderType, $this->orderDirection );
$this->monthPayments[] = $this->monthPayment->getProjectDetails(); $this->monthPayments = $monthPayment->getProjectDetails();
} }
private function setInvoiceReport() private function setInvoiceReport()
@@ -15,12 +15,16 @@ class MonthPayments {
private $projectname; private $projectname;
private $monthPayments; private $monthPayments;
private $projectDetails; private $projectDetails;
private $projectsWithPayments;
private $totalProjectPayments; 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();
} }
@@ -31,6 +35,24 @@ class MonthPayments {
} }
private function handle() private function handle()
{
$this->setProjectsWithPayments();
$this->loopProjectsWithPayments();
}
private function setProjectsWithPayments()
{
$projectsArray = Payment::getProjectsWithPayments( $this->year );
$this->projectsWithPayments =
Project::getProjectsForReport(
$this->orderType, $this->orderDirection, FALSE, $projectsArray );
}
private function loopProjectsWithPayments()
{
foreach ( $this->projectsWithPayments as $this->project )
{ {
$this->setProjectname(); $this->setProjectname();
@@ -42,6 +64,7 @@ class MonthPayments {
$this->setProjectDetails(); $this->setProjectDetails();
} }
}
private function setProjectname() private function setProjectname()
{ {
@@ -65,7 +88,7 @@ class MonthPayments {
{ {
foreach ( $this->project->invoices as $invoice ) foreach ( $this->project->invoices as $invoice )
{ {
foreach($invoice->payments as $this->payment) foreach ( $invoice->payments as $this->payment )
{ {
$this->setMonthPayments(); $this->setMonthPayments();
@@ -93,7 +116,7 @@ class MonthPayments {
private function setProjectDetails() private function setProjectDetails()
{ {
$this->projectDetails = [ $this->projectDetails[] = [
'projectname' => $this->projectname, 'projectname' => $this->projectname,
'customer' => $this->customer, 'customer' => $this->customer,
'monthPayments' => $this->monthPayments, 'monthPayments' => $this->monthPayments,
+11
View File
@@ -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;
+6 -2
View File
@@ -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;
@@ -46,24 +46,42 @@ class Projectemployee extends BaseModel {
return $projectemployees; return $projectemployees;
} }
public static function getUniqueEmployeesWithActivity( $archive = 'F' )
{
$projectemployees = Projectemployee::selectRaw( "USR.id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" )
->distinct()
->join( 'users AS USR', 'USR.id', '=', 'projectemployees.user_id' )
->join( 'projectemployees AS PRE', 'PRE.user_id', '=', 'USR.id' )
->join( 'projects AS PRJ', 'PRJ.id', '=', 'PRE.project_id' );
if ( $archive == 'F' ) $projectemployees = $projectemployees->where( 'PRJ.archive', '=', 'F' );
$projectemployees = $projectemployees->get();
return $projectemployees;
}
public static function getProjectemployeeDetailsPerProject( $projectID ) public static function getProjectemployeeDetailsPerProject( $projectID )
{ {
$details = Projectemployee::selectRaw( 'USR.id, budget, project_id, ROUND(SUM(hours), 0) AS hours, ROUND(SUM(hours * tarif), 0) AS revenues, projectemployees.id AS projectemployeeID' ) $details = Projectemployee::selectRaw( '
USR.id, budget, project_id, ROUND(SUM(hours), 0) AS hours, ROUND(SUM(hours * tarif), 0) AS revenues, projectemployees.id AS projectemployeeID' )
->join( 'users AS USR', 'USR.id', '=', 'projectemployees.user_id' ) ->join( 'users AS USR', 'USR.id', '=', 'projectemployees.user_id' )
->join( 'projecthours AS PRH', 'PRH.projectemployee_id', '=', 'projectemployees.id' ) ->join( 'projecthours AS PRH', 'PRH.projectemployee_id', '=', 'projectemployees.id' )
->where( 'projectemployees.project_id', '=', $projectID ) ->where( 'projectemployees.project_id', '=', $projectID )
->where( 'PRH.hourtype_id', '=', 1 ) ->where( 'PRH.hourtype_id', '=', 1 )
// ->where( 'budget', '!=', 0 )
->groupBy( 'projectemployees.id' ) ->groupBy( 'projectemployees.id' )
->get(); ->havingRaw( 'ROUND(SUM(hours), 0) > 0' );
$details = $details->get();
return $details; return $details;
} }
public static function firstOrCreateProjectemployee( $userID, $projectID ) public static function firstOrCreateProjectemployee( $userID, $projectID )
{ {
$projectemployee = self::whereUserId($userID)->whereProjectId($projectID); $projectemployee = self::whereUserId( $userID )->whereProjectId( $projectID );
if( $projectemployee->count() > 0 ) return $projectemployee->first(); if ( $projectemployee->count() > 0 ) return $projectemployee->first();
$user = User::find( $userID ); $user = User::find( $userID );
@@ -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>
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -7,7 +7,7 @@
<link rel="icon" href="css/images/dbo-01-80x80.png" type="image/png"> <link rel="icon" href="css/images/dbo-01-80x80.png" type="image/png">
<title>** De Beleidsonderzoeker **</title> <title>** De Beleidsonderzoekers **</title>
<?php $this->load->view( 'partials/_css' ); ?> <?php $this->load->view( 'partials/_css' ); ?>
@@ -169,11 +169,21 @@
</table> </table>
</td> </td>
</tr> </tr>
<tr>
<th colspan="10" class="table-cyanish-header"></th>
</tr>
</tbody> </tbody>
<tfoot> <tfoot>
<tr>
<th colspan="3" class="table-cyanish-header"></th>
<th class="align-right table-cyanish-header">
<span data-bind="text:dbo.helpers.numberWithPoints(totalInvoiceamount())"></span>
</th>
<th class="align-right table-cyanish-header">
<span data-bind="text:dbo.helpers.numberWithPoints(totalInclBtw())"></span>
</th>
<th class="align-right table-cyanish-header">
<span data-bind="text:dbo.helpers.numberWithPoints(totalOutstanding())"></span>
</th>
<th colspan="2" class="table-cyanish-header"></th>
</tr>
<tr> <tr>
<td colspan="5"> <td colspan="5">
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newInvoice"> <button class="btn btn-primary btn-round btn-sm" data-bind="click:newInvoice">
@@ -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">
@@ -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">
+1 -1
View File
@@ -93,7 +93,7 @@
</div> </div>
<footer class="page-copyright page-copyright-inverse"> <footer class="page-copyright page-copyright-inverse">
<p>© 2018. De Beleidsonderzoeker.</p> <p>© 2018. De Beleidsonderzoekers</p>
<!-- <p style="font-size:.8em">powered by: Pensare Software</p>--> <!-- <p style="font-size:.8em">powered by: Pensare Software</p>-->
</footer> </footer>
</div> </div>
@@ -11,7 +11,7 @@
<th width="17%">project</th> <th width="17%">project</th>
<th width="10%" class="align-right">Kosten derden</th> <th width="10%" class="align-right">Kosten derden</th>
<th width="10%" class="align-right">factuur INK</th> <th width="10%" class="align-right">factuur INK</th>
<th width="10%" class="align-right">budget gereserveerd</th> <th width="10%" class="align-right">gereserveerd op<br/>spaarrekening</th>
<th width="10%" class="align-right">betaald</th> <th width="10%" class="align-right">betaald</th>
<th width="10%" class="align-right">saldo te<br />betalen</th> <th width="10%" class="align-right">saldo te<br />betalen</th>
<th width="10%" class="align-right">betaald via<br />reserveringen</th> <th width="10%" class="align-right">betaald via<br />reserveringen</th>
@@ -1,17 +1,23 @@
<table class="table" style="font-size:.8em;"> <table class="table" style="font-size:.8em;">
<thead> <thead>
<tr> <tr>
<th class="rotate"> <th class="rotate sorting-field">
<div><span>projectnummer</span></div> <div data-bind="click:setSorting.bind($data, 'projectnumber')">
<span>projectnummer</span>
</div>
</th> </th>
<th class="rotate"> <th class="rotate">
<div><span>instroom</span></div> <div><span>instroom</span></div>
</th> </th>
<th class="rotate"> <th class="rotate sorting-field">
<div><span>naam</span></div> <div data-bind="click:setSorting.bind($data, 'projectname')">
<span>naam</span>
</div>
</th> </th>
<th class="rotate"> <th class="rotate sorting-field">
<div><span>opdrachtgever</span></div> <div data-bind="click:setSorting.bind($data, 'CUS.name')">
<span>opdrachtgever</span>
</div>
</th> </th>
<!-- ko foreach: uniqueEmployees --> <!-- ko foreach: uniqueEmployees -->
<th class="rotate"> <th class="rotate">
@@ -43,6 +49,32 @@
<div><span>Volgende boekjaren</span></div> <div><span>Volgende boekjaren</span></div>
</th> </th>
</tr> </tr>
<tr>
<th class="align-right" colspan="4">totaal</th>
<!-- ko foreach: totalPerEmployee -->
<th class="align-right">
<span data-bind="text:totalRevenue"></span>
</th>
<!-- /ko -->
<th class="align-right">
<span data-bind="text:totalOwnRevenue"></span>
</th>
<th class="align-right">
<span data-bind="text:totalEmployeeRevenues"></span>
</th>
<th class="align-right">
<span data-bind="text:totalAvailableRevenues"></span>
</th>
<th class="align-right">
<span data-bind="text:totalOwp"></span>
</th>
<th class="align-right">
<span data-bind="text:totalCurrentFinancialYear"></span>
</th>
<th class="align-right">
<span data-bind="text:totalNextFinancialYear"></span>
</th>
</tr>
</thead> </thead>
<tbody data-bind="foreach:recap"> <tbody data-bind="foreach:recap">
<tr> <tr>
@@ -79,32 +111,6 @@
</tr> </tr>
</tbody> </tbody>
<tfoot> <tfoot>
<tr>
<th class="align-right" colspan="4">totaal</th>
<!-- ko foreach: totalPerEmployee -->
<th class="align-right">
<span data-bind="text:totalRevenue"></span>
</th>
<!-- /ko -->
<th class="align-right">
<span data-bind="text:totalOwnRevenue"></span>
</th>
<th class="align-right">
<span data-bind="text:totalEmployeeRevenues"></span>
</th>
<th class="align-right">
<span data-bind="text:totalAvailableRevenues"></span>
</th>
<th class="align-right">
<span data-bind="text:totalOwp"></span>
</th>
<th class="align-right">
<span data-bind="text:totalCurrentFinancialYear"></span>
</th>
<th class="align-right">
<span data-bind="text:totalNextFinancialYear"></span>
</th>
</tr>
</tfoot> </tfoot>
</table> </table>
@@ -2,7 +2,9 @@
<thead> <thead>
<tr> <tr>
<th class="rotate"> <th class="rotate">
<div><span>projectnummer</span></div> <div data-bind="click:setSorting.bind($data, 'projectnumber')">
<span>projectnummer</span>
</div>
</th> </th>
<th class="rotate"> <th class="rotate">
<div><span>instroom</span></div> <div><span>instroom</span></div>
@@ -11,10 +13,14 @@
<div><span>uitstroom</span></div> <div><span>uitstroom</span></div>
</th> </th>
<th class="rotate"> <th class="rotate">
<div><span>naam</span></div> <div data-bind="click:setSorting.bind($data, 'projectname')">
<span>naam</span>
</div>
</th> </th>
<th class="rotate"> <th class="rotate">
<div><span>opdrachtgever</span></div> <div data-bind="click:setSorting.bind($data, 'CUS.name')">
<span>opdrachtgever</span>
</div>
</th> </th>
<!-- ko foreach: uniqueEmployees --> <!-- ko foreach: uniqueEmployees -->
<th class="rotate"> <th class="rotate">
@@ -33,6 +39,25 @@
<div><span>totaal beschikbare uren</span></div> <div><span>totaal beschikbare uren</span></div>
</th> </th>
</tr> </tr>
<tr>
<th class="align-right" colspan="5">totaal</th>
<!-- ko foreach: totalPerEmployee -->
<th class="align-right">
<span data-bind="text:totalHours"></span>
</th>
<!-- /ko -->
<th class="align-right">
<span data-bind="text:totalEmployeeHours"></span>
</th>
<!-- ko foreach: totalPerEmployee -->
<th class="align-right">
<span data-bind="text:totalAvailableHours"></span>
</th>
<!-- /ko -->
<th class="align-right">
<span data-bind="text:totalEmployeeAvailableHours"></span>
</th>
</tr>
</thead> </thead>
<tbody data-bind="foreach:recap"> <tbody data-bind="foreach:recap">
<tr> <tr>
@@ -60,24 +85,5 @@
</tr> </tr>
</tbody> </tbody>
<tfoot> <tfoot>
<tr>
<th class="align-right" colspan="5">totaal</th>
<!-- ko foreach: totalPerEmployee -->
<th class="align-right">
<span data-bind="text:totalHours"></span>
</th>
<!-- /ko -->
<th class="align-right">
<span data-bind="text:totalEmployeeHours"></span>
</th>
<!-- ko foreach: totalPerEmployee -->
<th class="align-right">
<span data-bind="text:totalAvailableHours"></span>
</th>
<!-- /ko -->
<th class="align-right">
<span data-bind="text:totalEmployeeAvailableHours"></span>
</th>
</tr>
</tfoot> </tfoot>
</table> </table>
+4
View File
@@ -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;
@@ -15,11 +15,15 @@ dbo.reportsDataService = {
} ); } );
}, },
getRecapProjects: function(archive, callback){ getRecapProjects: function ( field, direction, archive, callback ) {
$.getJSON( 'index.php/reports/reportsController/recapProjects/' + archive ) var submitDATA = {
field : field,
direction: direction
};
$.post( 'index.php/reports/reportsController/recapProjects/' + archive, submitDATA )
.done( function ( data ) { .done( function ( data ) {
callback( data ); callback( data );
} ); }, 'JSON' );
}, },
getEmployeeHours: function ( employeeID, year, callback ) { getEmployeeHours: function ( employeeID, year, callback ) {
@@ -29,8 +33,8 @@ dbo.reportsDataService = {
} ); } );
}, },
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' );
@@ -49,6 +49,13 @@ dbo.userDataService = {
} ); } );
}, },
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' )
.done( function ( data ) { .done( function ( data ) {
+34 -4
View File
@@ -51,7 +51,7 @@ $( function () {
totalInvoiced : ko.observable(), totalInvoiced : ko.observable(),
totalRevenuesIncl : ko.observable(), totalRevenuesIncl : ko.observable(),
outstanding : ko.observable(), outstanding : ko.observable(),
outstandingInvoices: ko.observable(), outstandingInvoices : ko.observable(),
payed : ko.observable(), payed : ko.observable(),
totalForecast : ko.observable(), totalForecast : ko.observable(),
toForecast : ko.observable(), toForecast : ko.observable(),
@@ -60,6 +60,14 @@ $( function () {
totalNonDeclarable : ko.observable( 0 ), totalNonDeclarable : ko.observable( 0 ),
totalDeclarable : ko.observable( 0 ), totalDeclarable : ko.observable( 0 ),
totalRevenueHours : ko.observable( 0 ), totalRevenueHours : ko.observable( 0 ),
totalCosts : ko.observable(),
totalPayed : ko.observable(),
totalToPay : ko.observable(),
totalReservationamount: ko.observable(),
totalInvoiceamount : ko.observable(0),
totalInclBtw : ko.observable(0),
totalOutstanding : ko.observable(0),
init: function () { init: function () {
var vm = dbo.editProjectModal; var vm = dbo.editProjectModal;
@@ -831,6 +839,14 @@ $( function () {
vm.payed( dbo.helpers.numberWithPoints( Math.round( Number( data.invoiceDetails.payed ) ) ) ); vm.payed( dbo.helpers.numberWithPoints( Math.round( Number( data.invoiceDetails.payed ) ) ) );
vm.toInvoice = Math.round( totalRevenuesIncl - Number( data.invoiceDetails.totalinvoiced ) ); vm.toInvoice = Math.round( totalRevenuesIncl - Number( data.invoiceDetails.totalinvoiced ) );
vm.totalCosts( 0 );
vm.totalPayed( 0 );
vm.totalToPay( 0 );
vm.totalReservationamount( 0 );
vm.totalInvoiceamount( 0 );
vm.totalInclBtw( 0 );
vm.totalOutstanding( 0 );
vm.projectEmployees.removeAll(); vm.projectEmployees.removeAll();
vm.projecthours.removeAll(); vm.projecthours.removeAll();
@@ -907,8 +923,8 @@ $( function () {
vm.totalForecast( vm.totalForecast() + Number( p.forecastamount() ) ); vm.totalForecast( vm.totalForecast() + Number( p.forecastamount() ) );
vm.toForecast( vm.toForecast() - Number( p.forecastamount() ) ); vm.toForecast( vm.toForecast() - Number( p.forecastamount() ) );
} ); } );
vm.toForecast( dbo.helpers.numberWithPoints( Number( vm.toForecast() ) ) ); vm.toForecast( dbo.helpers.numberWithPoints( Math.round( Number( vm.toForecast() ) ) ) );
vm.totalForecast( dbo.helpers.numberWithPoints( Number( vm.totalForecast() ) ) ); vm.totalForecast( dbo.helpers.numberWithPoints( Math.round( Number( vm.totalForecast() ) ) ) );
}, },
Projectemployee: function ( data ) { Projectemployee: function ( data ) {
@@ -951,6 +967,7 @@ $( function () {
Projectcost: function ( data ) { Projectcost: function ( data ) {
var self = this; var self = this;
var vm = dbo.editProjectModal;
self.id = data.id; self.id = data.id;
self.external_id = ko.observable( data.external_id ); self.external_id = ko.observable( data.external_id );
@@ -962,12 +979,17 @@ $( function () {
self.inEdit = ko.observable( data.inEdit || false ); self.inEdit = ko.observable( data.inEdit || false );
self.fromReservation = ko.observable( data.from_reservation == 'T' ? true : false ); self.fromReservation = ko.observable( data.from_reservation == 'T' ? true : false );
this.toPay = ko.pureComputed( function () {
self.toPay = ko.pureComputed( function () {
if ( isNaN( self.costs() ) ) return 0; if ( isNaN( self.costs() ) ) return 0;
if ( isNaN( self.payed() ) ) return 0; if ( isNaN( self.payed() ) ) return 0;
return self.costs() - self.payed(); return self.costs() - self.payed();
} ) } )
vm.totalCosts( Number( vm.totalCosts() ) + Number( self.costs() ) );
vm.totalPayed( Number( vm.totalPayed() ) + Number( self.payed() ) );
vm.totalToPay( Number( vm.totalToPay() ) + Number( self.toPay() ) );
}, },
Invoice: function ( data ) { Invoice: function ( data ) {
@@ -1009,6 +1031,10 @@ $( function () {
} ); } );
return (self.inclBtw() - payed).toFixed( 0 ); return (self.inclBtw() - payed).toFixed( 0 );
} ); } );
vm.totalInvoiceamount( Number( vm.totalInvoiceamount() + Number( self.invoiceamount() ) ) );
vm.totalInclBtw( Number( vm.totalInclBtw() + Number( self.inclBtw() ) ) );
vm.totalOutstanding( Number( vm.totalOutstanding() + Number( self.outstanding() ) ) );
}, },
Payment: function ( data ) { Payment: function ( data ) {
@@ -1032,12 +1058,16 @@ $( function () {
}, },
Reservation: function ( data ) { Reservation: function ( data ) {
var vm = dbo.editProjectModal;
this.id = data.id; this.id = data.id;
this.project_id = data.project_id; this.project_id = data.project_id;
this.reservationamount = ko.observable( data.reservationamount ); this.reservationamount = ko.observable( data.reservationamount );
this.external_id = ko.observable( data.external_id ); this.external_id = ko.observable( data.external_id );
this.inEdit = ko.observable( data.inEdit || false ); this.inEdit = ko.observable( data.inEdit || false );
this.invalidReservation = ko.observable( data.invalidReservation || false ); this.invalidReservation = ko.observable( data.invalidReservation || false );
vm.totalReservationamount(
Number( vm.totalReservationamount() ) + Number( this.reservationamount() ) )
}, },
addDocument: function ( data, evt ) { addDocument: function ( data, evt ) {
File diff suppressed because it is too large Load Diff
@@ -79,7 +79,6 @@ dbo.invoicereportInit = function () {
_.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 ) {
@@ -115,7 +114,7 @@ dbo.invoicereportInit = function () {
vm.invoicesTotal( 0 ); vm.invoicesTotal( 0 );
vm.totalPayment( 0 ); vm.totalPayment( 0 );
vm.totalToPay( 0 ); vm.totalToPay( 0 );
vm.needInvoice( 0 ); vm.needInvoice( Number( 0 ) );
vm.forecastThisYear( 0 ); vm.forecastThisYear( 0 );
vm.forecastOtherYears( 0 ); vm.forecastOtherYears( 0 );
vm.forecastRemaining( 0 ); vm.forecastRemaining( 0 );
@@ -140,7 +139,7 @@ dbo.invoicereportInit = function () {
vm.invoicesTotal( vm.invoicesTotal() + Number( p.invoicesTotal.replace( '.', '' ) ) ); vm.invoicesTotal( vm.invoicesTotal() + Number( p.invoicesTotal.replace( '.', '' ) ) );
vm.totalPayment( vm.totalPayment() + Number( p.projectPayment.replace( '.', '' ) ) ); vm.totalPayment( vm.totalPayment() + Number( p.projectPayment.replace( '.', '' ) ) );
vm.totalToPay( vm.totalToPay() + Number( p.invoiceToPay.replace( '.', '' ) ) ); vm.totalToPay( vm.totalToPay() + Number( p.invoiceToPay.replace( '.', '' ) ) );
vm.needInvoice( vm.needInvoice() + Number( p.needInvoice.replace( '.', '' ) ) ); vm.needInvoice( Number( vm.needInvoice() ) + Number( p.needInvoice.replace( '.', '' ) ) );
} ); } );
vm.totalToInvoicingExcl( dbo.helpers.thousandSeparator( vm.totalToInvoicingExcl() ) ); vm.totalToInvoicingExcl( dbo.helpers.thousandSeparator( vm.totalToInvoicingExcl() ) );
@@ -167,6 +166,7 @@ dbo.invoicereportInit = function () {
}, },
setForecastMonthsTotals: function ( data ) { setForecastMonthsTotals: function ( data ) {
console.log( data );
var vm = dbo.invoicereport; var vm = dbo.invoicereport;
_.each( data, function ( p ) { _.each( data, function ( p ) {
@@ -193,6 +193,7 @@ dbo.invoicereportInit = function () {
}, },
Monthforecast: function ( data ) { Monthforecast: function ( data ) {
console.log( data );
var vm = dbo.invoicereport; var vm = dbo.invoicereport;
var self = this; var self = this;
self.projectnumber = data.projectnumber; self.projectnumber = data.projectnumber;
@@ -206,13 +207,13 @@ dbo.invoicereportInit = function () {
_.each( data.forecastMonths, function ( p, i ) { _.each( data.forecastMonths, function ( p, i ) {
self.forecastMonths.push( new vm.ForecastMonth( p ) ); self.forecastMonths.push( new vm.ForecastMonth( p ) );
_.each( vm.monthTotals(), function ( q ) { _.each( vm.monthTotals(), function ( q ) {
if ( q.monthID == i ) q.forecastamount( Number( q.forecastamount() ) + Number( p.forecastamount ) ); if ( q.monthID == (i + 1) ) q.forecastamount( Math.round( Number( q.forecastamount() ) ) + Math.round( Number( p.forecastamount ) ) );
} ); } );
} ); } );
}, },
ForecastMonth: function ( data ) { ForecastMonth: function ( data ) {
this.forecastamount = dbo.helpers.thousandSeparator( data.forecastamount ); this.forecastamount = dbo.helpers.thousandSeparator( Math.round( data.forecastamount ) );
}, },
Monthpayment: function ( data ) { Monthpayment: function ( data ) {
@@ -226,13 +227,13 @@ dbo.invoicereportInit = function () {
_.each( data.monthPayments, function ( p, i ) { _.each( data.monthPayments, function ( p, i ) {
self.paymentMonths.push( new vm.PaymentMonth( p ) ); self.paymentMonths.push( new vm.PaymentMonth( p ) );
_.each( vm.monthPaymentTotals(), function ( q ) { _.each( vm.monthPaymentTotals(), function ( q ) {
if ( q.monthID == i ) q.paymentamount( Number( q.paymentamount() ) + Number( p.paymentamount ) ); if ( q.monthID == i ) q.paymentamount( Math.round(Number( q.paymentamount()) ) + Math.round(Number( p.paymentamount ) ));
} ); } );
} ); } );
}, },
PaymentMonth: function ( data ) { PaymentMonth: function ( data ) {
this.paymentamount = dbo.helpers.thousandSeparator( data.paymentamount ); this.paymentamount = dbo.helpers.thousandSeparator( Math.round(data.paymentamount) );
}, },
createSpreadsheet: function () { createSpreadsheet: function () {
@@ -40,6 +40,8 @@ dbo.monthlyemployeehoursInit = function () {
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;
@@ -54,6 +56,8 @@ dbo.monthlyemployeehoursInit = function () {
initModule: function () { initModule: function () {
var vm = dbo.monthlyEmployeeHoursModel; var vm = dbo.monthlyEmployeeHoursModel;
var archive = vm.archive() ? 'T' : 'F';
vm.totalBudget( 0 ); vm.totalBudget( 0 );
vm.totalOwnRevenue( 0 ); vm.totalOwnRevenue( 0 );
vm.totalCosts( 0 ); vm.totalCosts( 0 );
@@ -67,15 +71,14 @@ dbo.monthlyemployeehoursInit = function () {
vm.totalOwp( 0 ); vm.totalOwp( 0 );
vm.totalPerEmployee.removeAll(); vm.totalPerEmployee.removeAll();
vm.totalInvoicedYear.removeAll(); vm.totalInvoicedYear.removeAll();
dbo.userDataService.getUniqueProjectEmployees( function ( data ) { dbo.userDataService.getUniqueEmployeesWithActivity( archive, function ( data ) {
vm.uniqueEmployees.removeAll(); vm.uniqueEmployees.removeAll();
$.each( data, function ( i, p ) { $.each( data, function ( i, p ) {
vm.uniqueEmployees.push( new vm.UniqueEmployee( p ) ) vm.uniqueEmployees.push( new vm.UniqueEmployee( p ) )
} ); } );
} ); } );
var archive = vm.archive() ? 'T' : 'F'; dbo.reportsDataService.getRecapProjects( vm.field, vm.direction, archive, function ( data ) {
dbo.reportsDataService.getRecapProjects( archive, function ( data ) {
vm.recap.removeAll(); vm.recap.removeAll();
vm.uniqueYears.removeAll(); vm.uniqueYears.removeAll();
$.each( data, function ( i, p ) { $.each( data, function ( i, p ) {
@@ -124,6 +127,19 @@ dbo.monthlyemployeehoursInit = function () {
} ); } );
}, },
setSorting: function ( field ) {
var vm = dbo.monthlyEmployeeHoursModel;
if ( vm.field == field ) {
vm.direction = vm.direction == 'desc' ? 'asc' : 'desc';
} else {
vm.direction = 'asc';
}
vm.field = field;
vm.initModule();
},
toggleArchive: function () { toggleArchive: function () {
var vm = dbo.monthlyEmployeeHoursModel; var vm = dbo.monthlyEmployeeHoursModel;