Diverse aanpassing nav mail Peter
This commit is contained in:
@@ -70,6 +70,7 @@ class EmployeeHoursController extends MY_Controller {
|
||||
}
|
||||
elseif ( $hourType == 'OFFERS' )
|
||||
{
|
||||
$data['projectemployee_id'] = $data['employee_id'];
|
||||
unset( $data['employee_id'] );
|
||||
$data['hourtype_id'] = $data['hourtype_id'] - 8;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class ProjectsController extends MY_Controller {
|
||||
|
||||
}
|
||||
|
||||
public function getAllProjects( )
|
||||
public function getAllProjects()
|
||||
{
|
||||
$archive = $this->clean_input( 'archive' );
|
||||
$search = $this->clean_input( 'search' );
|
||||
@@ -46,6 +46,9 @@ class ProjectsController extends MY_Controller {
|
||||
$project->invoiceDetails =
|
||||
$this->Invoices_model->getOutstandingPerProject( $project->id );
|
||||
|
||||
$project->hourTotals =
|
||||
Projecthour::getTotalHoursPerProject( $project->id );
|
||||
|
||||
$this->json( $project );
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ class ReportsController extends MY_Controller {
|
||||
|
||||
}
|
||||
|
||||
public function recapProjects()
|
||||
public function recapProjects( $archive )
|
||||
{
|
||||
$recapprojects = new Recapprojects();
|
||||
$recapprojects = new Recapprojects( $archive );
|
||||
|
||||
$projects = $recapprojects->getProjects();
|
||||
|
||||
@@ -51,17 +51,17 @@ class ReportsController extends MY_Controller {
|
||||
|
||||
$result = $query->result();
|
||||
|
||||
foreach($result as $user)
|
||||
foreach ( $result as $user )
|
||||
{
|
||||
$user->targethours = Employeetarget::getTargetHoursPerEmployee( $user->user_id, $year, $month);
|
||||
$user->targethours = Employeetarget::getTargetHoursPerEmployee( $user->user_id, $year, $month );
|
||||
}
|
||||
|
||||
$this->json( $result );
|
||||
}
|
||||
|
||||
public function getInvoiceOverview( $year = FALSE )
|
||||
public function getInvoiceOverview( $year = FALSE, $orderType, $orderDirection, $archive )
|
||||
{
|
||||
$invoices = new Invoices( $year );
|
||||
$invoices = new Invoices( $year, $orderType, $orderDirection, $archive );
|
||||
|
||||
$invoiceReport = $invoices->getInvoiceReport();
|
||||
|
||||
@@ -74,7 +74,7 @@ class ReportsController extends MY_Controller {
|
||||
|
||||
$invoiceReport = $invoices->getInvoiceReport();
|
||||
|
||||
new InvoiceSpreadsheet($invoiceReport);
|
||||
new InvoiceSpreadsheet( $invoiceReport );
|
||||
}
|
||||
|
||||
public function saveCurrentFinnacialYear( $projectID )
|
||||
|
||||
@@ -16,7 +16,7 @@ class MY_Controller extends CI_Controller {
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->version = '1.00.00';
|
||||
$this->version = '1.00.01';
|
||||
|
||||
$this->load->library( 'beheer/session/RetrieveUserSession' );
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ class Recapprojects {
|
||||
|
||||
private $ci;
|
||||
private $index;
|
||||
private $archive;
|
||||
private $project;
|
||||
private $projects;
|
||||
private $employeeHours;
|
||||
@@ -22,10 +23,12 @@ class Recapprojects {
|
||||
private $projectEmployeeDetail;
|
||||
private $projectEmployeeDetails;
|
||||
|
||||
public function __construct()
|
||||
public function __construct( $archive )
|
||||
{
|
||||
$this->ci =& get_instance();
|
||||
|
||||
$this->archive = $archive;
|
||||
|
||||
$this->ci->load->Model( 'projects/Invoices_model' );
|
||||
|
||||
$this->handle();
|
||||
@@ -51,7 +54,7 @@ class Recapprojects {
|
||||
|
||||
private function setProjects()
|
||||
{
|
||||
$this->projects = Project::getActiveProjects()->toArray();
|
||||
$this->projects = Project::getActiveProjects( $this->archive )->toArray();
|
||||
}
|
||||
|
||||
private function setUniqueEmployees()
|
||||
@@ -222,7 +225,7 @@ class Recapprojects {
|
||||
$this->projects[ $this->index ]['projectcosts'] -
|
||||
$this->projects[ $this->index ]['totalInvoiced'];
|
||||
|
||||
if( $this->projects[ $this->index ]['workInProgress'] < 0 )
|
||||
if ( $this->projects[ $this->index ]['workInProgress'] < 0 )
|
||||
$this->projects[ $this->index ]['workInProgress'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ class InvoiceOverview {
|
||||
private $invoicesTotal;
|
||||
private $needInvoice;
|
||||
private $projectDetails;
|
||||
private $projectnumber;
|
||||
|
||||
public function __construct( $project, $year )
|
||||
{
|
||||
@@ -41,6 +42,8 @@ class InvoiceOverview {
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->setProjectnumber();
|
||||
|
||||
$this->setProjectname();
|
||||
|
||||
$this->setCustomer();
|
||||
@@ -60,9 +63,14 @@ class InvoiceOverview {
|
||||
$this->setProjectDetails();
|
||||
}
|
||||
|
||||
private function setProjectnumber()
|
||||
{
|
||||
$this->projectnumber = $this->project->projectnumber;
|
||||
}
|
||||
|
||||
private function setProjectname()
|
||||
{
|
||||
$this->projectname = $this->project->projectname . '(' . $this->project->projectnumber . ')';
|
||||
$this->projectname = $this->project->projectname;
|
||||
}
|
||||
|
||||
private function setCustomer()
|
||||
@@ -111,6 +119,7 @@ class InvoiceOverview {
|
||||
private function setProjectDetails()
|
||||
{
|
||||
$this->projectDetails = [
|
||||
'projectnumber' => $this->projectnumber,
|
||||
'projectname' => $this->projectname,
|
||||
'customer' => $this->customer,
|
||||
'totalToInvoicingExcl' => number_format( $this->totalToInvoicingExcl, 0, ',', '.' ),
|
||||
|
||||
@@ -20,10 +20,16 @@ class Invoices {
|
||||
private $invoiceForecasts;
|
||||
private $invoiceOverviews = [];
|
||||
private $invoiceReport = [];
|
||||
private $orderType;
|
||||
private $orderDirection;
|
||||
private $archive;
|
||||
|
||||
public function __construct( $year )
|
||||
public function __construct( $year, $orderType, $orderDirection, $archive )
|
||||
{
|
||||
$this->year = $year;
|
||||
$this->orderType = $orderType;
|
||||
$this->orderDirection = $orderDirection;
|
||||
$this->archive = $archive;
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
@@ -44,7 +50,8 @@ class Invoices {
|
||||
|
||||
private function setProjects()
|
||||
{
|
||||
$this->projects = Project::getProjectsForReport();
|
||||
$this->projects =
|
||||
Project::getProjectsForReport( $this->orderType, $this->orderDirection, $this->archive );
|
||||
}
|
||||
|
||||
private function loopProjects()
|
||||
|
||||
@@ -48,7 +48,7 @@ class Project extends BaseModel {
|
||||
|
||||
public function vat()
|
||||
{
|
||||
return $this->belongsTo('Vat');
|
||||
return $this->belongsTo( 'Vat' );
|
||||
}
|
||||
|
||||
public function projectleader()
|
||||
@@ -65,11 +65,11 @@ class Project extends BaseModel {
|
||||
{
|
||||
$projects = Project::getBaseProject();
|
||||
|
||||
$projects = $projects->selectRaw('projects.*')
|
||||
->join('customers AS CUS', 'CUS.id', '=', 'projects.customer_id')
|
||||
->join('users AS USR', 'USR.id', '=', 'projects.projectleader_id')
|
||||
->where('projects.projectnumber', 'LIKE', "%{$search}%")
|
||||
->orderBy($order, $direction);
|
||||
$projects = $projects->selectRaw( 'projects.*' )
|
||||
->join( 'customers AS CUS', 'CUS.id', '=', 'projects.customer_id' )
|
||||
->join( 'users AS USR', 'USR.id', '=', 'projects.projectleader_id' )
|
||||
->where( 'projects.projectnumber', 'LIKE', "%{$search}%" )
|
||||
->orderBy( $order, $direction );
|
||||
|
||||
if ( $archive == 'F' ) $projects = $projects->where( 'projects.archive', '=', 'F' );
|
||||
|
||||
@@ -96,7 +96,7 @@ class Project extends BaseModel {
|
||||
Project::whereId( $projectID )->delete();
|
||||
}
|
||||
|
||||
public static function getActiveProjects()
|
||||
public static function getActiveProjects($archive = 'T')
|
||||
{
|
||||
$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" )
|
||||
@@ -104,15 +104,22 @@ class Project extends BaseModel {
|
||||
->join( 'offers AS OFF', 'OFF.project_id', '=', 'projects.id' )
|
||||
->groupBy( 'projects.id' )
|
||||
->groupBy( 'OFF.own_revenue' )
|
||||
->groupBy( 'OFF.other_revenue' )
|
||||
->get();
|
||||
->groupBy( 'OFF.other_revenue' );
|
||||
|
||||
if( $archive == 'F') $projects = $projects->where('projects.archive', '=', 'F');
|
||||
|
||||
$projects = $projects->get();
|
||||
|
||||
return $projects;
|
||||
}
|
||||
|
||||
public static function getProjectsForReport()
|
||||
public static function getProjectsForReport( $orderType, $orderDirection, $archive = 'F' )
|
||||
{
|
||||
$projects = self::getBaseProject()->get();
|
||||
$projects = self::getBaseProject();
|
||||
|
||||
if ( $archive == 'F' ) $projects = $projects->whereArchive( 'F' );
|
||||
|
||||
$projects = $projects->orderBy( $orderType, $orderDirection )->get();
|
||||
|
||||
return $projects;
|
||||
}
|
||||
@@ -128,9 +135,9 @@ class Project extends BaseModel {
|
||||
'projectemployees.user' => function ( $q ) {
|
||||
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
|
||||
}] )
|
||||
->with('vat')
|
||||
->with(['forecasts'])
|
||||
->with(['reservations'])
|
||||
->with( 'vat' )
|
||||
->with( ['forecasts'] )
|
||||
->with( ['reservations'] )
|
||||
->with( 'projectemployees.projecthours' )
|
||||
->with( 'projectcosts.external' )
|
||||
->with( 'invoices.payments' )
|
||||
|
||||
@@ -27,7 +27,7 @@ class Projecthour extends BaseModel {
|
||||
|
||||
public static function getMonthlyEmployeeHoursPerProject( $employeeID, $year )
|
||||
{
|
||||
$projectHours = ProjecthoursPerEmployeePerMonth::fire($employeeID, $year);
|
||||
$projectHours = ProjecthoursPerEmployeePerMonth::fire( $employeeID, $year );
|
||||
|
||||
return $projectHours;
|
||||
}
|
||||
@@ -61,5 +61,21 @@ class Projecthour extends BaseModel {
|
||||
Projecthour::whereId( $projecthourID )->delete();
|
||||
}
|
||||
|
||||
public static function getTotalHoursPerProject( $projectID )
|
||||
{
|
||||
$totalProjecthours =
|
||||
self::selectRaw( "CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname,
|
||||
SUM(IF(hourtype_id = 1, hours, 0)) AS declarable,
|
||||
SUM(IF(hourtype_id = 1, hours * tarif, 0)) AS revenues,
|
||||
SUM(IF(hourtype_id != 1, hours, 0)) AS nondeclarable" )
|
||||
->join( 'projectemployees AS PRE', 'PRE.id', '=', 'projecthours.projectemployee_id' )
|
||||
->join( 'users AS USR', 'USR.id', '=', 'PRE.user_id' )
|
||||
->groupBy( 'USR.id' )
|
||||
->where( 'PRE.project_id', '=', $projectID )
|
||||
->get();
|
||||
|
||||
return $totalProjecthours;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -49,7 +49,21 @@ class QEmployeeHours {
|
||||
if( $month != 0 ) $sql .= "AND MONTH(hourdate) = '$month' ";
|
||||
$sql .= "
|
||||
GROUP BY PEM.user_id, MONTH(hourdate)
|
||||
UNION
|
||||
SELECT PH.projectemployee_id AS user_id,
|
||||
MONTH(hourdate) monthID,
|
||||
SUM(hours) AS projecthours,
|
||||
0 AS profitablehours,
|
||||
SUM(IF(hourtype_id = 3, hours, 0)) AS nonprofitablehours,
|
||||
0 AS revenues,
|
||||
0 AS nonprojecthours
|
||||
FROM projecthours PH
|
||||
WHERE YEAR(hourdate) = '{$year}' ";
|
||||
if( $month != 0 ) $sql .= "AND MONTH(hourdate) = '$month' ";
|
||||
$sql .= "
|
||||
GROUP BY PH.projectemployee_id, MONTH(hourdate)
|
||||
) AS Q1
|
||||
|
||||
JOIN users AS USR
|
||||
ON USR.id = Q1.user_id
|
||||
GROUP BY user_id ";
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
projecturen
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<th class="table-cyanish-header" width="40%">
|
||||
medewerker
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right" width="20%">
|
||||
niet declarabel
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right" width="20%">
|
||||
declarabel
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right" width="20%">
|
||||
omzet
|
||||
</th>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:hourTotals">
|
||||
<tr>
|
||||
<td>
|
||||
<span data-bind="text:fullname"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:nondeclarable"></span> uur
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:declarable"></span> uur
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:revenues"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th class="table-cyanish-header">
|
||||
totaal
|
||||
</th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:totalNonDeclarable"></span> uur
|
||||
</th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:totalDeclarable"></span> uur
|
||||
</th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:totalRevenueHours"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -65,7 +65,7 @@
|
||||
<?php $this->load->view( 'modals/partials/_projectemployees' ); ?>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<?php $this->load->view( 'modals/partials/_hours' ); ?>
|
||||
<?php $this->load->view( 'modals/partials/_hourTotals' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,6 +12,24 @@
|
||||
maak spreadsheet
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="row form-horizontal">
|
||||
<label class="col-md-4 form-control-label">archief</label>
|
||||
<div class="col-md-8">
|
||||
<div class="onoffswitch" data-bind="click:toggleArchive">
|
||||
<input type="checkbox"
|
||||
name="onoffswitch"
|
||||
class="onoffswitch-checkbox"
|
||||
data-bind="checked:archive"
|
||||
id="myonoffswitch">
|
||||
<label class="onoffswitch-label" for="myonoffswitch">
|
||||
<span class="onoffswitch-inner"></span>
|
||||
<span class="onoffswitch-switch"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
@@ -8,6 +8,26 @@
|
||||
<!-- <div class="invalid-feedback" data-bind="visible: ! validYear()">geen geldig jaar</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<div class="row form-horizontal">
|
||||
<label class="col-md-4 form-control-label">archief</label>
|
||||
<div class="col-md-8">
|
||||
<div class="onoffswitch" data-bind="click:toggleArchive">
|
||||
<input type="checkbox"
|
||||
name="onoffswitch"
|
||||
class="onoffswitch-checkbox"
|
||||
data-bind="checked:archive"
|
||||
id="myonoffswitch">
|
||||
<label class="onoffswitch-label" for="myonoffswitch">
|
||||
<span class="onoffswitch-inner"></span>
|
||||
<span class="onoffswitch-switch"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="nav-tabs-horizontal">
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<th class="table-tealish-header pointer"
|
||||
data-bind="click:directionOrderProjects.bind($data, 'USR.firstname')">projectleider</th>
|
||||
<th class="table-tealish-header pointer"
|
||||
data-bind="click:directionOrderProjects.bind($data, 'CUS.name')">klant</th>
|
||||
data-bind="click:directionOrderProjects.bind($data, 'projectname')">projectnaam</th>
|
||||
<th class="table-tealish-header pointer"
|
||||
data-bind="click:directionOrderProjects.bind($data, 'startdate')">start</th>
|
||||
<th class="table-tealish-header align-right">eigen tarief omzet</th>
|
||||
@@ -44,7 +44,7 @@
|
||||
<span data-bind="text:projectleader"></span>
|
||||
</td>
|
||||
<td data-bind="click:$root.selectPoject" class="pointer">
|
||||
<span data-bind="text:customer"></span>
|
||||
<span data-bind="text:projectname, attr:{title:customer}"></span>
|
||||
</td>
|
||||
<td data-bind="click:$root.selectPoject" class="pointer">
|
||||
<span data-bind="text:startdate"></span>
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
<table class="table table-condensed" style="font-size:0.8em;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="rotate">
|
||||
<div class="pointer">
|
||||
<span data-bind="click:sortList.bind($data, 'projectnumber')">
|
||||
projectnummer
|
||||
</span>
|
||||
</div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>project</span></div>
|
||||
</th>
|
||||
@@ -30,6 +37,7 @@
|
||||
<tbody>
|
||||
<!-- ko foreach: invoiceOverview -->
|
||||
<tr>
|
||||
<td><span data-bind="text:projectnumber"></span></td>
|
||||
<td><span data-bind="text:projectname"></span></td>
|
||||
<td><span data-bind="text:customer"></span></td>
|
||||
<td class="align-right"><span data-bind="text:totalToInvoicingExcl"></span></td>
|
||||
@@ -43,7 +51,7 @@
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="2" class="align-right">
|
||||
<th colspan="3" class="align-right">
|
||||
totaal
|
||||
</th>
|
||||
<th class="align-right">
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
dbo.invoiceDataService = {
|
||||
|
||||
getInvoiceOverview: function ( year, callback ) {
|
||||
$.getJSON( 'index.php/reports/reportsController/getInvoiceOverview/' + year )
|
||||
getInvoiceOverview: function ( year, orderType, orderDirection, archive, callback ) {
|
||||
$.getJSON( 'index.php/reports/reportsController/getInvoiceOverview/' + year + '/' + orderType + '/' + orderDirection + '/' + archive )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
|
||||
@@ -15,8 +15,8 @@ dbo.reportsDataService = {
|
||||
} );
|
||||
},
|
||||
|
||||
getRecapProjects: function(callback){
|
||||
$.getJSON( 'index.php/reports/reportsController/recapProjects' )
|
||||
getRecapProjects: function(archive, callback){
|
||||
$.getJSON( 'index.php/reports/reportsController/recapProjects/' + archive )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
|
||||
@@ -56,10 +56,10 @@ dbo.helpers = {
|
||||
},
|
||||
|
||||
findArrayElement: function ( toFind, element, value, array ) {
|
||||
console.log( toFind ); // het element in de array
|
||||
console.log( element );
|
||||
console.log( value );
|
||||
console.log( array );
|
||||
// console.log( toFind ); // het element in de array
|
||||
// console.log( element );
|
||||
// console.log( value );
|
||||
// console.log( array );
|
||||
if ( !Array.isArray( array ) ) return null;
|
||||
|
||||
var foundValue = null
|
||||
|
||||
@@ -49,13 +49,17 @@ $( function () {
|
||||
activeTab : ko.observable(),
|
||||
totalRevenues : ko.observable(),
|
||||
totalInvoiced : ko.observable(),
|
||||
totalRevenuesIncl: ko.observable(),
|
||||
totalRevenuesIncl : ko.observable(),
|
||||
outstanding : ko.observable(),
|
||||
outstandingInvoices: ko.observable(),
|
||||
payed : ko.observable(),
|
||||
totalForecast : ko.observable(),
|
||||
toForecast : ko.observable(),
|
||||
toInvoice : 0,
|
||||
hourTotals : ko.observableArray( [] ),
|
||||
totalNonDeclarable : ko.observable( 0 ),
|
||||
totalDeclarable : ko.observable( 0 ),
|
||||
totalRevenueHours : ko.observable( 0 ),
|
||||
|
||||
init: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
@@ -113,7 +117,7 @@ $( function () {
|
||||
|
||||
self.fromReservation( !self.fromReservation() );
|
||||
|
||||
vm.saveProjectCost(self);
|
||||
vm.saveProjectCost( self );
|
||||
},
|
||||
|
||||
editProjectemployee: function () {
|
||||
@@ -800,7 +804,7 @@ $( function () {
|
||||
dbo.projectDataService.getAvailableEmployees( vm.projectID, function ( data ) {
|
||||
vm.availableEmployees( data );
|
||||
|
||||
if ( typeof(callback) == 'function' ) callback();
|
||||
if ( typeof (callback) == 'function' ) callback();
|
||||
} );
|
||||
},
|
||||
|
||||
@@ -809,7 +813,7 @@ $( function () {
|
||||
vm.busy = true;
|
||||
|
||||
dbo.projectDataService.getProject( vm.projectID, function ( data ) {
|
||||
var revenues = Number(data.offer.own_revenue) + Number(data.offer.other_revenue) + Number(data.offer.costs);
|
||||
var revenues = Number( data.offer.own_revenue ) + Number( data.offer.other_revenue ) + Number( data.offer.costs );
|
||||
var totalRevenuesIncl = Math.round( (revenues * (Number( data.vat.vatrate ) + 100)) / 100 );
|
||||
|
||||
vm.id = data.id
|
||||
@@ -832,9 +836,25 @@ $( function () {
|
||||
|
||||
vm.ownRevenue( dbo.helpers.numberWithPoints( Math.round( Number( data.offer.own_revenue ) ) ) );
|
||||
vm.otherRevenue( dbo.helpers.numberWithPoints( Math.round( Number( data.offer.other_revenue ) ) ) );
|
||||
vm.costs(dbo.helpers.numberWithPoints( Math.round( Number( data.offer.costs ) ) ) );
|
||||
vm.costs( dbo.helpers.numberWithPoints( Math.round( Number( data.offer.costs ) ) ) );
|
||||
vm.totalRevenues( dbo.helpers.numberWithPoints( Math.round( revenues ) ) );
|
||||
|
||||
vm.hourTotals.removeAll();
|
||||
vm.totalNonDeclarable( 0 );
|
||||
vm.totalDeclarable( 0 );
|
||||
vm.totalRevenueHours( 0 );
|
||||
_.each( data.hourTotals, function ( p ) {
|
||||
vm.hourTotals.push( {
|
||||
fullname : p.fullname,
|
||||
nondeclarable: p.nondeclarable,
|
||||
declarable : p.declarable,
|
||||
revenues : dbo.helpers.numberWithPoints( Math.round( Number( p.revenues ) ) )
|
||||
} );
|
||||
vm.totalNonDeclarable( Number( vm.totalNonDeclarable() ) + Number( p.nondeclarable ) );
|
||||
vm.totalDeclarable( Number( vm.totalDeclarable() ) + Number( p.declarable ) );
|
||||
vm.totalRevenueHours( Number( vm.totalRevenueHours() ) + Number( p.revenues ) );
|
||||
} );
|
||||
vm.totalRevenueHours( dbo.helpers.numberWithPoints( Math.round( vm.totalRevenueHours() ) ) );
|
||||
|
||||
_.each( data.projectemployees, function ( p ) {
|
||||
vm.projectEmployees.push( new vm.Projectemployee( p ) );
|
||||
@@ -1012,7 +1032,6 @@ $( function () {
|
||||
},
|
||||
|
||||
Reservation: function ( data ) {
|
||||
console.log( data );
|
||||
this.id = data.id;
|
||||
this.project_id = data.project_id;
|
||||
this.reservationamount = ko.observable( data.reservationamount );
|
||||
|
||||
@@ -154,6 +154,7 @@ dbo.projectsInit = function () {
|
||||
self.id = data.id;
|
||||
self.projectnumber = data.projectnumber;
|
||||
self.projectleader = data.projectleader ? data.projectleader.fullname : '#NB';
|
||||
self.projectname = data.projectname;
|
||||
self.customer = data.customer ? data.customer.name : '#NB';
|
||||
self.startdate = data.startdate;
|
||||
self.enddate = data.enddate;
|
||||
|
||||
@@ -35,6 +35,9 @@ dbo.invoicereportInit = function () {
|
||||
forecastOtherYears : ko.observable(),
|
||||
forecastRemaining : ko.observable(),
|
||||
totalProjectPayments : ko.observable(),
|
||||
orderType : 'projectnumber',
|
||||
orderDirection : false,
|
||||
archive : ko.observable( false ),
|
||||
|
||||
init: function () {
|
||||
var vm = dbo.invoicereport;
|
||||
@@ -52,7 +55,10 @@ dbo.invoicereportInit = function () {
|
||||
|
||||
vm.resetTotals();
|
||||
|
||||
dbo.invoiceDataService.getInvoiceOverview( vm.selectedYear(), function ( data ) {
|
||||
var orderDirection = vm.orderDirection ? 'ASC' : 'DESC';
|
||||
var archive = vm.archive() ? 'T' : 'F';
|
||||
|
||||
dbo.invoiceDataService.getInvoiceOverview( vm.selectedYear(), vm.orderType, orderDirection, archive, function ( data ) {
|
||||
vm.invoiceOverview( data.invoiceOverview );
|
||||
vm.setInvoiceOverviewTotals( data.invoiceOverview );
|
||||
|
||||
@@ -70,7 +76,7 @@ dbo.invoicereportInit = function () {
|
||||
vm.monthPayments.removeAll();
|
||||
_.each( data.monthPayments, function ( 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() ) );
|
||||
@@ -81,6 +87,22 @@ dbo.invoicereportInit = function () {
|
||||
} );
|
||||
},
|
||||
|
||||
toggleArchive: function () {
|
||||
var vm = dbo.invoicereport;
|
||||
vm.archive( !vm.archive() );
|
||||
|
||||
vm.initModule();
|
||||
},
|
||||
|
||||
sortList: function ( orderType ) {
|
||||
var vm = dbo.invoicereport;
|
||||
|
||||
vm.orderType = orderType;
|
||||
vm.orderDirection = !vm.orderDirection;
|
||||
|
||||
vm.initModule();
|
||||
},
|
||||
|
||||
resetTotals: function () {
|
||||
var vm = dbo.invoicereport;
|
||||
|
||||
@@ -165,6 +187,7 @@ dbo.invoicereportInit = function () {
|
||||
Monthforecast: function ( data ) {
|
||||
var vm = dbo.invoicereport;
|
||||
var self = this;
|
||||
self.projectnumber = data.projectnumber;
|
||||
self.projectname = data.projectname;
|
||||
self.customer = data.customer;
|
||||
self.needInvoice = data.needInvoice;
|
||||
@@ -175,7 +198,7 @@ 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 ) q.forecastamount( Number( q.forecastamount() ) + Number( p.forecastamount ) );
|
||||
} );
|
||||
} );
|
||||
},
|
||||
@@ -195,7 +218,7 @@ 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( Number( q.paymentamount() ) + Number( p.paymentamount ) );
|
||||
} );
|
||||
} );
|
||||
},
|
||||
@@ -204,10 +227,10 @@ dbo.invoicereportInit = function () {
|
||||
this.paymentamount = dbo.helpers.thousandSeparator( data.paymentamount );
|
||||
},
|
||||
|
||||
createSpreadsheet:function(){
|
||||
createSpreadsheet: function () {
|
||||
var vm = dbo.invoicereport;
|
||||
var url = 'index.php/reports/reportsController/createInvoicesSpreadsheet/' + vm.selectedYear();
|
||||
window.open(url, '_blank');
|
||||
window.open( url, '_blank' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
totalNextFinancialYear : ko.observable(),
|
||||
totalInvoicedYear : ko.observableArray( [] ),
|
||||
validYear : ko.observable( true ),
|
||||
archive : ko.observable(),
|
||||
|
||||
init: function () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
@@ -72,7 +73,9 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
vm.uniqueEmployees.push( new vm.UniqueEmployee( p ) )
|
||||
} );
|
||||
} );
|
||||
dbo.reportsDataService.getRecapProjects( function ( data ) {
|
||||
|
||||
var archive = vm.archive() ? 'T' : 'F';
|
||||
dbo.reportsDataService.getRecapProjects( archive, function ( data ) {
|
||||
vm.recap.removeAll();
|
||||
vm.uniqueYears.removeAll();
|
||||
$.each( data, function ( i, p ) {
|
||||
@@ -90,7 +93,7 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
vm.totalSaldo( dbo.helpers.thousandSeparator( vm.totalSaldo() ) );
|
||||
vm.totalWorkInProgress( dbo.helpers.thousandSeparator( vm.totalWorkInProgress() ) );
|
||||
vm.totalEmployeeRevenues( dbo.helpers.thousandSeparator( vm.totalEmployeeRevenues() ) );
|
||||
vm.totalAvailableRevenues( dbo.helpers.thousandSeparator( vm.totalAvailableRevenues() ));
|
||||
vm.totalAvailableRevenues( dbo.helpers.thousandSeparator( vm.totalAvailableRevenues() ) );
|
||||
vm.totalOwp( dbo.helpers.thousandSeparator( vm.totalOwp() ) );
|
||||
vm.totalEmployeeHours( dbo.helpers.thousandSeparator( vm.totalEmployeeHours() ) );
|
||||
_.each( vm.totalPerEmployee(), function ( p ) {
|
||||
@@ -121,6 +124,13 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
} );
|
||||
},
|
||||
|
||||
toggleArchive: function () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
|
||||
vm.archive( !vm.archive() );
|
||||
vm.initModule();
|
||||
},
|
||||
|
||||
checkYear: function () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
if ( timeout ) {
|
||||
|
||||
Reference in New Issue
Block a user