Diverse wijzigingen nav word document
This commit is contained in:
@@ -67,6 +67,13 @@ class usersController extends MY_Controller {
|
||||
$this->json( $projectEmployees );
|
||||
}
|
||||
|
||||
public function getUniqueEmployeesWithActivity($archive)
|
||||
{
|
||||
$projectEmployees = Projectemployee::getUniqueEmployeesWithActivity($archive);
|
||||
|
||||
$this->json( $projectEmployees );
|
||||
}
|
||||
|
||||
public function saveUser()
|
||||
{
|
||||
$userValidation = new UserValidation();
|
||||
|
||||
@@ -29,7 +29,10 @@ class ReportsController extends MY_Controller {
|
||||
|
||||
public function recapProjects( $archive )
|
||||
{
|
||||
$recapprojects = new Recapprojects( $archive );
|
||||
$field = $this->input->post('field');
|
||||
$direction = $this->input->post('direction');
|
||||
|
||||
$recapprojects = new Recapprojects( $archive, $field, $direction );
|
||||
|
||||
$projects = $recapprojects->getProjects();
|
||||
|
||||
|
||||
@@ -10,9 +10,11 @@ class Recapprojects {
|
||||
|
||||
private $ci;
|
||||
private $index;
|
||||
private $field;
|
||||
private $archive;
|
||||
private $project;
|
||||
private $projects;
|
||||
private $direction;
|
||||
private $employeeHours;
|
||||
private $invoicedYears = [];
|
||||
private $projectTotals;
|
||||
@@ -23,11 +25,13 @@ class Recapprojects {
|
||||
private $projectEmployeeDetail;
|
||||
private $projectEmployeeDetails;
|
||||
|
||||
public function __construct( $archive )
|
||||
public function __construct( $archive, $field, $direction )
|
||||
{
|
||||
$this->ci =& get_instance();
|
||||
|
||||
$this->archive = $archive;
|
||||
$this->field = $field;
|
||||
$this->direction = $direction;
|
||||
|
||||
$this->ci->load->Model( 'projects/Invoices_model' );
|
||||
|
||||
@@ -54,12 +58,14 @@ class Recapprojects {
|
||||
|
||||
private function setProjects()
|
||||
{
|
||||
$this->projects = Project::getActiveProjects( $this->archive )->toArray();
|
||||
$this->projects = Project::getActiveProjects(
|
||||
$this->archive, $this->field, $this->direction )->toArray();
|
||||
}
|
||||
|
||||
private function setUniqueEmployees()
|
||||
{
|
||||
$this->uniqueEmployees = Projectemployee::getUniqueProjectEmployees();
|
||||
$this->uniqueEmployees =
|
||||
Projectemployee::getUniqueEmployeesWithActivity();
|
||||
}
|
||||
|
||||
private function loopProjects()
|
||||
|
||||
@@ -45,6 +45,9 @@ class Invoices {
|
||||
|
||||
$this->loopProjects();
|
||||
|
||||
//only projects with payments also archived projects
|
||||
$this->setMonthPayments();
|
||||
|
||||
$this->setInvoiceReport();
|
||||
}
|
||||
|
||||
@@ -63,8 +66,6 @@ class Invoices {
|
||||
$this->setInvoiceForecasts();
|
||||
|
||||
$this->setMonthForecasts();
|
||||
|
||||
$this->setMonthPayments();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,10 +94,10 @@ class Invoices {
|
||||
|
||||
public function setMonthPayments()
|
||||
{
|
||||
$this->monthPayment =
|
||||
new MonthPayments( $this->project, $this->year );
|
||||
$monthPayment = new MonthPayments(
|
||||
$this->year, $this->orderType, $this->orderDirection );
|
||||
|
||||
$this->monthPayments[] = $this->monthPayment->getProjectDetails();
|
||||
$this->monthPayments = $monthPayment->getProjectDetails();
|
||||
}
|
||||
|
||||
private function setInvoiceReport()
|
||||
|
||||
@@ -15,12 +15,16 @@ class MonthPayments {
|
||||
private $projectname;
|
||||
private $monthPayments;
|
||||
private $projectDetails;
|
||||
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->orderType = $orderType;
|
||||
$this->orderDirection = $orderDirection;
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
@@ -31,6 +35,24 @@ class MonthPayments {
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
@@ -42,6 +64,7 @@ class MonthPayments {
|
||||
|
||||
$this->setProjectDetails();
|
||||
}
|
||||
}
|
||||
|
||||
private function setProjectname()
|
||||
{
|
||||
@@ -65,7 +88,7 @@ class MonthPayments {
|
||||
{
|
||||
foreach ( $this->project->invoices as $invoice )
|
||||
{
|
||||
foreach($invoice->payments as $this->payment)
|
||||
foreach ( $invoice->payments as $this->payment )
|
||||
{
|
||||
$this->setMonthPayments();
|
||||
|
||||
@@ -93,7 +116,7 @@ class MonthPayments {
|
||||
|
||||
private function setProjectDetails()
|
||||
{
|
||||
$this->projectDetails = [
|
||||
$this->projectDetails[] = [
|
||||
'projectname' => $this->projectname,
|
||||
'customer' => $this->customer,
|
||||
'monthPayments' => $this->monthPayments,
|
||||
|
||||
@@ -28,6 +28,17 @@ class Payment extends BaseModel {
|
||||
return $projectPayment->payment;
|
||||
}
|
||||
|
||||
public static function getProjectsWithPayments($year)
|
||||
{
|
||||
$projects = self::selectRaw('INV.project_id')
|
||||
->distinct()
|
||||
->join('invoices AS INV', 'INV.id', '=', 'payments.invoice_id')
|
||||
->whereRaw('DATE_FORMAT(INV.invoicedate, "%Y") = "'. $year.'"')
|
||||
->lists('project_id');
|
||||
|
||||
return $projects->toArray();
|
||||
}
|
||||
|
||||
public static function savePayment( $paymentID, $payment )
|
||||
{
|
||||
$payment = (array) $payment;
|
||||
|
||||
@@ -96,7 +96,7 @@ class Project extends BaseModel {
|
||||
Project::whereId( $projectID )->delete();
|
||||
}
|
||||
|
||||
public static function getActiveProjects( $archive = 'T' )
|
||||
public static function getActiveProjects( $archive = 'T', $sortField = FALSE, $direction = FALSE )
|
||||
{
|
||||
$projects = Project::selectRaw( "projects.id, YEAR(projects.startdate) AS instroom, YEAR(projects.enddate) AS uitstroom, projectnumber, current_financial_year,
|
||||
projectname, CUS.name, OFF.own_revenue, OFF.other_revenue" )
|
||||
@@ -106,6 +106,8 @@ class Project extends BaseModel {
|
||||
->groupBy( 'OFF.own_revenue' )
|
||||
->groupBy( 'OFF.other_revenue' );
|
||||
|
||||
if ( $sortField ) $projects = $projects->orderBy( $sortField, $direction );
|
||||
|
||||
if ( $archive == 'F' ) $projects = $projects->where( 'projects.archive', '=', 'F' );
|
||||
|
||||
$projects = $projects->get();
|
||||
@@ -113,12 +115,14 @@ class Project extends BaseModel {
|
||||
return $projects;
|
||||
}
|
||||
|
||||
public static function getProjectsForReport( $orderType, $orderDirection, $archive = 'F' )
|
||||
public static function getProjectsForReport( $orderType, $orderDirection, $archive = 'F', $projectsArray = FALSE )
|
||||
{
|
||||
$projects = self::getBaseProject();
|
||||
|
||||
if ( $archive == 'F' ) $projects = $projects->whereArchive( 'F' );
|
||||
|
||||
if ( is_array( $projectsArray ) ) $projects = $projects->whereIn( 'id', $projectsArray );
|
||||
|
||||
$projects = $projects->orderBy( $orderType, $orderDirection )->get();
|
||||
|
||||
return $projects;
|
||||
|
||||
@@ -46,6 +46,21 @@ class Projectemployee extends BaseModel {
|
||||
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 )
|
||||
{
|
||||
$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' )
|
||||
@@ -53,7 +68,9 @@ class Projectemployee extends BaseModel {
|
||||
->join( 'projecthours AS PRH', 'PRH.projectemployee_id', '=', 'projectemployees.id' )
|
||||
->where( 'projectemployees.project_id', '=', $projectID )
|
||||
->where( 'PRH.hourtype_id', '=', 1 )
|
||||
->where( 'budget', '!=', 0 )
|
||||
->groupBy( 'projectemployees.id' )
|
||||
->havingRaw( 'ROUND(SUM(hours), 0) > 0' )
|
||||
->get();
|
||||
|
||||
return $details;
|
||||
@@ -61,9 +78,9 @@ class Projectemployee extends BaseModel {
|
||||
|
||||
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 );
|
||||
|
||||
|
||||
@@ -311,7 +311,7 @@
|
||||
<table class="main" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="alert alert-warning">
|
||||
Nieuw wachtwoord DBOIS De Beleidsonderzoeker
|
||||
Nieuw wachtwoord DBOIS De Beleidsonderzoekers
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -311,7 +311,7 @@
|
||||
<table class="main" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="alert alert-warning">
|
||||
Wachtwoord De Beleidsonderzoeker
|
||||
Wachtwoord De Beleidsonderzoekers
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<link rel="icon" href="css/images/dbo-01-80x80.png" type="image/png">
|
||||
|
||||
<title>** De Beleidsonderzoeker **</title>
|
||||
<title>** De Beleidsonderzoekers **</title>
|
||||
|
||||
<?php $this->load->view( 'partials/_css' ); ?>
|
||||
|
||||
|
||||
@@ -169,11 +169,21 @@
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="10" class="table-cyanish-header"></th>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="3" class="table-cyanish-header"></th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalInvoiceamount())"></span>
|
||||
</th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalInclBtw())"></span>
|
||||
</th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalOutstanding())"></span>
|
||||
</th>
|
||||
<th colspan="2" class="table-cyanish-header"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newInvoice">
|
||||
|
||||
@@ -110,6 +110,20 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="3" class="table-cyanish-header"></th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalCosts())"></span>
|
||||
</th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalPayed())"></span>
|
||||
</th>
|
||||
<th class="table-cyanish-header"></th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalToPay())"></span>
|
||||
</th>
|
||||
<th class="table-cyanish-header"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newProjectcost">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
budget onderaannemers (incl. btw)
|
||||
gereserveerd op spaarrekening (incl. btw)
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
@@ -49,6 +49,12 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalReservationamount())"></span>
|
||||
</th>
|
||||
<th class="table-cyanish-header" colspan="2"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="4">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:addReservation">
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
</div>
|
||||
|
||||
<footer class="page-copyright page-copyright-inverse">
|
||||
<p>© 2018. De Beleidsonderzoeker.</p>
|
||||
<p>© 2018. De Beleidsonderzoekers</p>
|
||||
<!-- <p style="font-size:.8em">powered by: Pensare Software</p>-->
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<th width="17%">project</th>
|
||||
<th width="10%" class="align-right">Kosten derden</th>
|
||||
<th width="10%" class="align-right">factuur INK</th>
|
||||
<th width="10%" class="align-right">budget onderaannemers</th>
|
||||
<th width="10%" class="align-right">gereserveerd op<br/>spaarrekening</th>
|
||||
<th width="10%" class="align-right">betaald</th>
|
||||
<th width="10%" class="align-right">saldo te<br />betalen</th>
|
||||
<th width="10%" class="align-right">betaald via<br />reserveringen</th>
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
<table class="table" style="font-size:.8em;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="rotate">
|
||||
<div><span>projectnummer</span></div>
|
||||
<th class="rotate sorting-field">
|
||||
<div data-bind="click:setSorting.bind($data, 'projectnumber')">
|
||||
<span>projectnummer</span>
|
||||
</div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>instroom</span></div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>naam</span></div>
|
||||
<th class="rotate sorting-field">
|
||||
<div data-bind="click:setSorting.bind($data, 'projectname')">
|
||||
<span>naam</span>
|
||||
</div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>opdrachtgever</span></div>
|
||||
<th class="rotate sorting-field">
|
||||
<div data-bind="click:setSorting.bind($data, 'CUS.name')">
|
||||
<span>opdrachtgever</span>
|
||||
</div>
|
||||
</th>
|
||||
<!-- ko foreach: uniqueEmployees -->
|
||||
<th class="rotate">
|
||||
@@ -43,6 +49,32 @@
|
||||
<div><span>Volgende boekjaren</span></div>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="align-right" colspan="4">totaal</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalRevenue"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalOwnRevenue"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeRevenues"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalAvailableRevenues"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalOwp"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalCurrentFinancialYear"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalNextFinancialYear"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:recap">
|
||||
<tr>
|
||||
@@ -79,32 +111,6 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th class="align-right" colspan="4">totaal</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalRevenue"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalOwnRevenue"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeRevenues"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalAvailableRevenues"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalOwp"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalCurrentFinancialYear"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalNextFinancialYear"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="rotate">
|
||||
<div><span>projectnummer</span></div>
|
||||
<div data-bind="click:setSorting.bind($data, 'projectnumber')">
|
||||
<span>projectnummer</span>
|
||||
</div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>instroom</span></div>
|
||||
@@ -11,10 +13,14 @@
|
||||
<div><span>uitstroom</span></div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>naam</span></div>
|
||||
<div data-bind="click:setSorting.bind($data, 'projectname')">
|
||||
<span>naam</span>
|
||||
</div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>opdrachtgever</span></div>
|
||||
<div data-bind="click:setSorting.bind($data, 'CUS.name')">
|
||||
<span>opdrachtgever</span>
|
||||
</div>
|
||||
</th>
|
||||
<!-- ko foreach: uniqueEmployees -->
|
||||
<th class="rotate">
|
||||
@@ -33,6 +39,25 @@
|
||||
<div><span>totaal beschikbare uren</span></div>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="align-right" colspan="5">totaal</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalHours"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeHours"></span>
|
||||
</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalAvailableHours"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeAvailableHours"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:recap">
|
||||
<tr>
|
||||
@@ -60,24 +85,5 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th class="align-right" colspan="5">totaal</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalHours"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeHours"></span>
|
||||
</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalAvailableHours"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeAvailableHours"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
@@ -103,6 +103,10 @@ th.rotate > div > span {
|
||||
border-right: 1px solid #ccc;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
th.sorting-field:hover{
|
||||
cursor: pointer;
|
||||
color:#222;
|
||||
}
|
||||
.pie-test{
|
||||
width:20px;
|
||||
height:20px;
|
||||
|
||||
@@ -15,11 +15,15 @@ dbo.reportsDataService = {
|
||||
} );
|
||||
},
|
||||
|
||||
getRecapProjects: function(archive, callback){
|
||||
$.getJSON( 'index.php/reports/reportsController/recapProjects/' + archive )
|
||||
getRecapProjects: function ( field, direction, archive, callback ) {
|
||||
var submitDATA = {
|
||||
field : field,
|
||||
direction: direction
|
||||
};
|
||||
$.post( 'index.php/reports/reportsController/recapProjects/' + archive, submitDATA )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
}, 'JSON' );
|
||||
},
|
||||
|
||||
getEmployeeHours: function ( employeeID, year, callback ) {
|
||||
@@ -29,8 +33,8 @@ dbo.reportsDataService = {
|
||||
} );
|
||||
},
|
||||
|
||||
saveCurrentFinnacialYear: function(projectID, amount, callback){
|
||||
$.post( 'index.php/reports/reportsController/saveCurrentFinnacialYear/' + projectID, {amount:amount} )
|
||||
saveCurrentFinnacialYear: function ( projectID, amount, callback ) {
|
||||
$.post( 'index.php/reports/reportsController/saveCurrentFinnacialYear/' + projectID, {amount: amount} )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
}, '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 ) {
|
||||
$.post( 'index.php/beheer/userController/checkUsername', 'json' )
|
||||
.done( function ( data ) {
|
||||
|
||||
@@ -51,7 +51,7 @@ $( function () {
|
||||
totalInvoiced : ko.observable(),
|
||||
totalRevenuesIncl : ko.observable(),
|
||||
outstanding : ko.observable(),
|
||||
outstandingInvoices: ko.observable(),
|
||||
outstandingInvoices : ko.observable(),
|
||||
payed : ko.observable(),
|
||||
totalForecast : ko.observable(),
|
||||
toForecast : ko.observable(),
|
||||
@@ -60,6 +60,14 @@ $( function () {
|
||||
totalNonDeclarable : ko.observable( 0 ),
|
||||
totalDeclarable : 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 () {
|
||||
var vm = dbo.editProjectModal;
|
||||
@@ -831,6 +839,14 @@ $( function () {
|
||||
vm.payed( dbo.helpers.numberWithPoints( Math.round( Number( data.invoiceDetails.payed ) ) ) );
|
||||
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.projecthours.removeAll();
|
||||
|
||||
@@ -907,8 +923,8 @@ $( function () {
|
||||
vm.totalForecast( vm.totalForecast() + Number( p.forecastamount() ) );
|
||||
vm.toForecast( vm.toForecast() - Number( p.forecastamount() ) );
|
||||
} );
|
||||
vm.toForecast( dbo.helpers.numberWithPoints( Number( vm.toForecast() ) ) );
|
||||
vm.totalForecast( dbo.helpers.numberWithPoints( Number( vm.totalForecast() ) ) );
|
||||
vm.toForecast( dbo.helpers.numberWithPoints( Math.round( Number( vm.toForecast() ) ) ) );
|
||||
vm.totalForecast( dbo.helpers.numberWithPoints( Math.round( Number( vm.totalForecast() ) ) ) );
|
||||
},
|
||||
|
||||
Projectemployee: function ( data ) {
|
||||
@@ -951,6 +967,7 @@ $( function () {
|
||||
|
||||
Projectcost: function ( data ) {
|
||||
var self = this;
|
||||
var vm = dbo.editProjectModal;
|
||||
|
||||
self.id = data.id;
|
||||
self.external_id = ko.observable( data.external_id );
|
||||
@@ -962,12 +979,17 @@ $( function () {
|
||||
self.inEdit = ko.observable( data.inEdit || 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.payed() ) ) return 0;
|
||||
|
||||
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 ) {
|
||||
@@ -1009,6 +1031,10 @@ $( function () {
|
||||
} );
|
||||
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 ) {
|
||||
@@ -1032,12 +1058,15 @@ $( function () {
|
||||
},
|
||||
|
||||
Reservation: function ( data ) {
|
||||
this.id = data.id;
|
||||
var vm = dbo.editProjectModal;
|
||||
this.project_id = data.project_id;
|
||||
this.reservationamount = ko.observable( data.reservationamount );
|
||||
this.external_id = ko.observable( data.external_id );
|
||||
this.inEdit = ko.observable( data.inEdit || false );
|
||||
this.invalidReservation = ko.observable( data.invalidReservation || false );
|
||||
|
||||
vm.totalReservationamount(
|
||||
Number( vm.totalReservationamount() ) + Number( this.reservationamount() ) )
|
||||
},
|
||||
|
||||
addDocument: function ( data, evt ) {
|
||||
|
||||
@@ -79,7 +79,6 @@ dbo.invoicereportInit = function () {
|
||||
_.each( data.monthPayments, function ( p ) {
|
||||
vm.monthPayments.push( new vm.Monthpayment( p ) );
|
||||
vm.totalProjectPayments( Number( vm.totalProjectPayments() ) + Number( p.totalProjectPayments.replace( '.', '' ) ) );
|
||||
console.log( vm.totalProjectPayments() );
|
||||
} );
|
||||
vm.totalProjectPayments( dbo.helpers.thousandSeparator( vm.totalProjectPayments() ) );
|
||||
_.each( vm.monthPaymentTotals(), function ( p ) {
|
||||
@@ -115,7 +114,7 @@ dbo.invoicereportInit = function () {
|
||||
vm.invoicesTotal( 0 );
|
||||
vm.totalPayment( 0 );
|
||||
vm.totalToPay( 0 );
|
||||
vm.needInvoice( 0 );
|
||||
vm.needInvoice( Number( 0 ) );
|
||||
vm.forecastThisYear( 0 );
|
||||
vm.forecastOtherYears( 0 );
|
||||
vm.forecastRemaining( 0 );
|
||||
@@ -140,7 +139,7 @@ dbo.invoicereportInit = function () {
|
||||
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.needInvoice( Number( vm.needInvoice() ) + Number( p.needInvoice.replace( '.', '' ) ) );
|
||||
} );
|
||||
|
||||
vm.totalToInvoicingExcl( dbo.helpers.thousandSeparator( vm.totalToInvoicingExcl() ) );
|
||||
@@ -167,6 +166,7 @@ dbo.invoicereportInit = function () {
|
||||
},
|
||||
|
||||
setForecastMonthsTotals: function ( data ) {
|
||||
console.log( data );
|
||||
var vm = dbo.invoicereport;
|
||||
|
||||
_.each( data, function ( p ) {
|
||||
@@ -193,6 +193,7 @@ dbo.invoicereportInit = function () {
|
||||
},
|
||||
|
||||
Monthforecast: function ( data ) {
|
||||
console.log( data );
|
||||
var vm = dbo.invoicereport;
|
||||
var self = this;
|
||||
self.projectnumber = data.projectnumber;
|
||||
@@ -206,13 +207,13 @@ dbo.invoicereportInit = function () {
|
||||
_.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 ) );
|
||||
if ( q.monthID == (i + 1) ) q.forecastamount( Math.round( Number( q.forecastamount() ) ) + Math.round( Number( p.forecastamount ) ) );
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
ForecastMonth: function ( data ) {
|
||||
this.forecastamount = dbo.helpers.thousandSeparator( data.forecastamount );
|
||||
this.forecastamount = dbo.helpers.thousandSeparator( Math.round( data.forecastamount ) );
|
||||
},
|
||||
|
||||
Monthpayment: function ( data ) {
|
||||
@@ -226,13 +227,13 @@ dbo.invoicereportInit = function () {
|
||||
_.each( data.monthPayments, function ( p, i ) {
|
||||
self.paymentMonths.push( new vm.PaymentMonth( p ) );
|
||||
_.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 ) {
|
||||
this.paymentamount = dbo.helpers.thousandSeparator( data.paymentamount );
|
||||
this.paymentamount = dbo.helpers.thousandSeparator( Math.round(data.paymentamount) );
|
||||
},
|
||||
|
||||
createSpreadsheet: function () {
|
||||
|
||||
@@ -40,6 +40,8 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
totalInvoicedYear : ko.observableArray( [] ),
|
||||
validYear : ko.observable( true ),
|
||||
archive : ko.observable(),
|
||||
field : 'projectnumber',
|
||||
direction : 'asc',
|
||||
|
||||
init: function () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
@@ -54,6 +56,8 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
|
||||
initModule: function () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
var archive = vm.archive() ? 'T' : 'F';
|
||||
|
||||
vm.totalBudget( 0 );
|
||||
vm.totalOwnRevenue( 0 );
|
||||
vm.totalCosts( 0 );
|
||||
@@ -67,15 +71,14 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
vm.totalOwp( 0 );
|
||||
vm.totalPerEmployee.removeAll();
|
||||
vm.totalInvoicedYear.removeAll();
|
||||
dbo.userDataService.getUniqueProjectEmployees( function ( data ) {
|
||||
dbo.userDataService.getUniqueEmployeesWithActivity( archive, function ( data ) {
|
||||
vm.uniqueEmployees.removeAll();
|
||||
$.each( data, function ( i, p ) {
|
||||
vm.uniqueEmployees.push( new vm.UniqueEmployee( p ) )
|
||||
} );
|
||||
} );
|
||||
|
||||
var archive = vm.archive() ? 'T' : 'F';
|
||||
dbo.reportsDataService.getRecapProjects( archive, function ( data ) {
|
||||
dbo.reportsDataService.getRecapProjects( vm.field, vm.direction, archive, function ( data ) {
|
||||
vm.recap.removeAll();
|
||||
vm.uniqueYears.removeAll();
|
||||
$.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 () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user