diversen dashboard
This commit is contained in:
@@ -42,12 +42,15 @@ class DashboardController extends MY_Controller {
|
|||||||
$available += $project['budgetAvailable'];
|
$available += $project['budgetAvailable'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$outstandings = $this->Invoices_model-> getTotalsOutstandingPerProject();
|
||||||
|
|
||||||
$this->json( [
|
$this->json( [
|
||||||
'totalOwp' => $totalOwp,
|
'totalOwp' => round( $totalOwp, 0 ),
|
||||||
'currentFinancialYear' => $currentFinancialYear,
|
'currentFinancialYear' => round( $currentFinancialYear ),
|
||||||
'owpNextyear' => $totalOwp - $currentFinancialYear,
|
'owpNextyear' => round( $totalOwp - $currentFinancialYear ),
|
||||||
'revenuesNextyear' => $totalOwp / 0.4,
|
'revenuesNextyear' => round( $totalOwp / 0.4 ),
|
||||||
'totalRevenues' => $totalRevenues
|
'totalRevenues' => round( $totalRevenues ),
|
||||||
|
'outstandings' => $outstandings
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,113 +8,70 @@
|
|||||||
|
|
||||||
class Projectemployee extends BaseModel {
|
class Projectemployee extends BaseModel {
|
||||||
|
|
||||||
public function project()
|
public function project()
|
||||||
{
|
{
|
||||||
return $this->belongsTo( 'Project' );
|
return $this->belongsTo( 'Project' );
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< Updated upstream
|
public function user()
|
||||||
public function user()
|
{
|
||||||
{
|
return $this->belongsTo( 'User' );
|
||||||
return $this->belongsTo( 'User' );
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function projecthours()
|
public function projecthours()
|
||||||
{
|
{
|
||||||
return $this->hasMany( 'Projecthour' );
|
return $this->hasMany( 'Projecthour' );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getAvailableEmployees( $projectID )
|
public static function getAvailableEmployees( $projectID )
|
||||||
{
|
{
|
||||||
$currentEmployees = Self::whereProjectId( $projectID )
|
$currentEmployees = Self::whereProjectId( $projectID )
|
||||||
->lists( 'user_id' );
|
->lists( 'user_id' );
|
||||||
|
|
||||||
$availableEmployees = User::selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" )
|
$availableEmployees = User::selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" )
|
||||||
->whereNotIn( 'id', $currentEmployees )
|
->whereNotIn( 'id', $currentEmployees )
|
||||||
->whereArchive( 'F' )
|
->whereArchive( 'F' )
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return $availableEmployees;
|
return $availableEmployees;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getUniqueProjectEmployees()
|
public static function getUniqueProjectEmployees()
|
||||||
{
|
{
|
||||||
$projectemployees = Projectemployee::selectRaw( "USR.id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" )
|
$projectemployees = Projectemployee::selectRaw( "USR.id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" )
|
||||||
->distinct()
|
->distinct()
|
||||||
->join( 'users AS USR', 'USR.id', '=', 'projectemployees.user_id' )
|
->join( 'users AS USR', 'USR.id', '=', 'projectemployees.user_id' )
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return $projectemployees;
|
return $projectemployees;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getProjectemployeeDetailsPerProject( $projectID )
|
public static function getUniqueEmployeesWithActivity( $archive = 'F' )
|
||||||
{
|
{
|
||||||
$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' )
|
$projectemployees = Projectemployee::selectRaw( "USR.id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" )
|
||||||
->join( 'users AS USR', 'USR.id', '=', 'projectemployees.user_id' )
|
->distinct()
|
||||||
->join( 'projecthours AS PRH', 'PRH.projectemployee_id', '=', 'projectemployees.id' )
|
->join( 'users AS USR', 'USR.id', '=', 'projectemployees.user_id' )
|
||||||
->where( 'projectemployees.project_id', '=', $projectID )
|
->join( 'projectemployees AS PRE', 'PRE.user_id', '=', 'USR.id' )
|
||||||
->where( 'PRH.hourtype_id', '=', 1 )
|
->join( 'projects AS PRJ', 'PRJ.id', '=', 'PRE.project_id' );
|
||||||
->groupBy( 'projectemployees.id' )
|
|
||||||
->get();
|
|
||||||
|
|
||||||
return $details;
|
if ( $archive == 'F' ) $projectemployees = $projectemployees->where( 'PRJ.archive', '=', 'F' );
|
||||||
}
|
|
||||||
|
|
||||||
public static function firstOrCreateProjectemployee( $userID, $projectID )
|
$projectemployees = $projectemployees->get();
|
||||||
{
|
|
||||||
$projectemployee = self::whereUserId($userID)->whereProjectId($projectID);
|
|
||||||
|
|
||||||
if( $projectemployee->count() > 0 ) return $projectemployee->first();
|
return $projectemployees;
|
||||||
|
}
|
||||||
|
|
||||||
$user = User::find( $userID );
|
|
||||||
|
|
||||||
$tarif = $user ? $user->hourlyrate : 0;
|
|
||||||
|
|
||||||
$projectemployee = Projectemployee::create( [
|
|
||||||
'project_id' => $projectID,
|
|
||||||
'user_id' => $userID,
|
|
||||||
'tarif' => $tarif
|
|
||||||
] );
|
|
||||||
|
|
||||||
return $projectemployee;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function createProjectEmployee( $projectID )
|
|
||||||
{
|
|
||||||
$projectemployee = Projectemployee::create( [
|
|
||||||
'project_id' => $projectID
|
|
||||||
] );
|
|
||||||
|
|
||||||
return $projectemployee->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function saveProjectemployee( $projectemployeeID, $projectemployee )
|
|
||||||
{
|
|
||||||
Projectemployee::whereId( $projectemployeeID )
|
|
||||||
->update( $projectemployee );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function removeProjectemployee( $projectemployeeID )
|
|
||||||
{
|
|
||||||
Projectemployee::whereId( $projectemployeeID )->delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
=======
|
|
||||||
public static function getProjectemployeeDetailsPerProject( $projectID )
|
public static function getProjectemployeeDetailsPerProject( $projectID )
|
||||||
{
|
{
|
||||||
$details = Projectemployee::selectRaw( '
|
$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' )
|
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( 'PRH.hourtype_id', '=', 1 )
|
->where( 'PRH.hourtype_id', '=', 1 )
|
||||||
// ->where( 'budget', '!=', 0 )
|
// ->where( 'budget', '!=', 0 )
|
||||||
->groupBy( 'projectemployees.id' )
|
->groupBy( 'projectemployees.id' )
|
||||||
->havingRaw( 'ROUND(SUM(hours), 0) > 0' );
|
->havingRaw( 'ROUND(SUM(hours), 0) > 0' );
|
||||||
|
|
||||||
if( $projectID)
|
|
||||||
$details = $details->where( 'projectemployees.project_id', '=', $projectID );
|
|
||||||
|
|
||||||
$details = $details->get();
|
$details = $details->get();
|
||||||
|
|
||||||
return $details;
|
return $details;
|
||||||
@@ -160,4 +117,3 @@ class Projectemployee extends BaseModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
>>>>>>> Stashed changes
|
|
||||||
|
|||||||
@@ -54,4 +54,60 @@ class Invoices_model extends MY_Model {
|
|||||||
|
|
||||||
return $invoiceDetails;
|
return $invoiceDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTotalsOutstandingPerProject()
|
||||||
|
{
|
||||||
|
$this->sql = "
|
||||||
|
SELECT
|
||||||
|
PRJ.id,
|
||||||
|
projectnumber,
|
||||||
|
projectname,
|
||||||
|
SUM(invoiced) AS invoiced,
|
||||||
|
SUM(payment) AS payment,
|
||||||
|
revenues,
|
||||||
|
costs,
|
||||||
|
COALESCE(payedcosts, 0) AS payedcosts
|
||||||
|
FROM (
|
||||||
|
SELECT
|
||||||
|
project_id,
|
||||||
|
ROUND(SUM(invoiceamount * (1 + (vatrate / 100))), 0) AS invoiced,
|
||||||
|
payment
|
||||||
|
FROM
|
||||||
|
invoices INV
|
||||||
|
JOIN vats VAT ON VAT.id = INV.vat_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
ROUND(COALESCE(SUM(paymentamount), 0), 0) AS payment,
|
||||||
|
invoice_id
|
||||||
|
FROM
|
||||||
|
payments
|
||||||
|
GROUP BY
|
||||||
|
invoice_id) AS Q1 ON INV.id = Q1.invoice_id
|
||||||
|
GROUP BY
|
||||||
|
INV.id) Q2
|
||||||
|
JOIN projects PRJ ON PRJ.id = Q2.project_id
|
||||||
|
JOIN (
|
||||||
|
SELECT
|
||||||
|
ROUND((own_revenue + other_revenue + costs) * (1 + (vatrate / 100)), 0) revenues,
|
||||||
|
ROUND(costs * (1 + (vatrate / 100)), 0) costs,
|
||||||
|
OFF.project_id
|
||||||
|
FROM
|
||||||
|
offers OFF
|
||||||
|
JOIN projects PRJ ON PRJ.id = OFF.project_id
|
||||||
|
JOIN vats VAT ON VAT.id = PRJ.vat_id) Q3 ON Q3.project_id = PRJ.id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
SUM(costs) AS payedcosts,
|
||||||
|
project_id
|
||||||
|
FROM
|
||||||
|
projectcosts
|
||||||
|
GROUP BY
|
||||||
|
project_id) Q4 ON Q4.project_id = PRJ.id
|
||||||
|
GROUP BY
|
||||||
|
PRJ.id ";
|
||||||
|
|
||||||
|
$outstandings = $this->get_query_result();
|
||||||
|
|
||||||
|
return $outstandings;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,8 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Libre+Franklin&display=swap" rel="stylesheet">
|
||||||
|
|
||||||
<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 Beleidsonderzoeker **</title>
|
||||||
@@ -12,7 +14,8 @@
|
|||||||
<?php $this->load->view( 'partials/_css' ); ?>
|
<?php $this->load->view( 'partials/_css' ); ?>
|
||||||
|
|
||||||
<?php $this->load->view( 'partials/_fonts' ); ?>
|
<?php $this->load->view( 'partials/_fonts' ); ?>
|
||||||
<link rel="stylesheet" href="css/menu.css">
|
<link rel="stylesheet" href="css/menu.css">
|
||||||
|
<link rel="stylesheet" href="css/dashboard.css">
|
||||||
</head>
|
</head>
|
||||||
<body id="dbois-app">
|
<body id="dbois-app">
|
||||||
<!-- ko stopBinding: true -->
|
<!-- ko stopBinding: true -->
|
||||||
|
|||||||
@@ -1,44 +1,90 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-6">
|
<div class="db-panel">
|
||||||
<div class="panel panel-success">
|
<div class="db-panel-holder db-panel-success">
|
||||||
<div class="panel-heading">
|
<div class="db-panel-heading">
|
||||||
<h3 class="panel-title">
|
<h3 class="db-panel-title">
|
||||||
Onderhanden werkpositie
|
Onderhanden werkpositie
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body" data-bind="width:owp">
|
<div class="db-panel-body" data-bind="width:owp">
|
||||||
<br>
|
<br>
|
||||||
<h4>
|
<h4>
|
||||||
<span style="width:80%; float:left;">Onderhanden werkpositie huidig jaar:</span>
|
<span class="db-panel-label">Onderhanden werkpositie huidig jaar:</span>
|
||||||
<span><strong data-bind="text:owpThisYear"></strong></span>
|
<span class="db-panel-data"><strong data-bind="text:owpThisYear"></strong></span>
|
||||||
</h4>
|
</h4>
|
||||||
<h4>
|
<h4>
|
||||||
<span style="width:80%; float:left;">Onderhanden werkpositie volgend jaar:</span>
|
<span class="db-panel-label">Onderhanden werkpositie volgend jaar:</span>
|
||||||
<span><strong data-bind="text:owpNextYear"></strong></span>
|
<span class="db-panel-data"><strong data-bind="text:owpNextYear"></strong></span>
|
||||||
</h4>
|
</h4>
|
||||||
<h4>
|
<h4>
|
||||||
<span style="width:80%; float:left;">Totaal:</span>
|
<span class="db-panel-label">Totaal:</span>
|
||||||
<span><strong data-bind="text:owpTotal"></strong></span>
|
<span class="db-panel-data"><strong data-bind="text:owpTotal"></strong></span>
|
||||||
</h4>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-6">
|
<div class="db-panel">
|
||||||
<div class="panel panel-warning">
|
<div class="db-panel-holder db-panel-warning">
|
||||||
<div class="panel-heading">
|
<div class="db-panel-heading">
|
||||||
<h3 class="panel-title">
|
<h3 class="db-panel-title">
|
||||||
Omzet
|
Omzet
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body" data-bind="width:owp">
|
<div class="db-panel-body" data-bind="width:owp">
|
||||||
<br>
|
<br>
|
||||||
<h4>
|
<h4>
|
||||||
<span style="width:80%; float:left;">Omzet komende jaar:</span>
|
<span class="db-panel-label">Omzet komende jaar:</span>
|
||||||
<span><strong data-bind="text:owpThisYear"></strong></span>
|
<span class="db-panel-data"><strong data-bind="text:revenuesNextyear"></strong></span>
|
||||||
</h4>
|
</h4>
|
||||||
<h4>
|
<h4>
|
||||||
<span style="width:80%; float:left;">Omzet totaal gerealiseerd lopend jaar:</span>
|
<span class="db-panel-label">Omzet totaal gerealiseerd lopend jaar:</span>
|
||||||
<span><strong data-bind="text:revenuesNextyear"></strong></span>
|
<span class="db-panel-data"><strong data-bind="text:owpThisYear"></strong></span>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="db-panel">
|
||||||
|
<div class="db-panel-holder db-panel-info">
|
||||||
|
<div class="db-panel-heading">
|
||||||
|
<h3 class="db-panel-title">
|
||||||
|
Facturatie
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="db-panel-body" data-bind="width:owp">
|
||||||
|
<br>
|
||||||
|
<h4>
|
||||||
|
<span class="db-panel-label">Openstaande facturen (incl btw):</span>
|
||||||
|
<span class="db-panel-data"><strong data-bind="text:outstanding"></strong></span>
|
||||||
|
</h4>
|
||||||
|
<h4>
|
||||||
|
<span class="db-panel-label">Nog te factureren (incl btw):</span>
|
||||||
|
<span class="db-panel-data"><strong data-bind="text:toInvoice"></strong></span>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="db-panel">
|
||||||
|
<div class="db-panel-holder db-panel-danger">
|
||||||
|
<div class="db-panel-heading">
|
||||||
|
<h3 class="db-panel-title">
|
||||||
|
Resultaat
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="db-panel-body" data-bind="width:owp">
|
||||||
|
<br>
|
||||||
|
<h4>
|
||||||
|
<span class="db-panel-label">Kosten derden (excl btw):</span>
|
||||||
|
<span class="db-panel-data"><strong data-bind="text:openCosts"></strong></span>
|
||||||
|
</h4>
|
||||||
|
<h4>
|
||||||
|
<span class="db-panel-label">Saldo inkomsten (excl btw):</span>
|
||||||
|
<span class="db-panel-data"><strong data-bind="text:revenues"></strong></span>
|
||||||
|
</h4>
|
||||||
|
<h4>
|
||||||
|
<span class="db-panel-label">Omzet lopend jaar (excl btw):</span>
|
||||||
|
<span class="db-panel-data"><strong data-bind="text:revenueCurrentYear"></strong></span>
|
||||||
</h4>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
<!-- <link rel="stylesheet" href="css/vendor/plugins/animsition/animsition.css">-->
|
<!-- <link rel="stylesheet" href="css/vendor/plugins/animsition/animsition.css">-->
|
||||||
<link rel="stylesheet" href="css/vendor/plugins/asscrollable/asScrollable.css?v=? =$this-version ?>">
|
<link rel="stylesheet" href="css/vendor/plugins/asscrollable/asScrollable.css?v=? =$this-version ?>">
|
||||||
<link rel="stylesheet" href="css/vendor/plugins/switchery/switchery.css?v=? =$this-version ?>">
|
<link rel="stylesheet" href="css/vendor/plugins/switchery/switchery.css?v=? =$this-version ?>">
|
||||||
<link rel="stylesheet" href="css/vendor/plugins/intro-js/introjs.css?v=? =$this-version ?>">
|
|
||||||
<link rel="stylesheet" href="css/vendor/plugins/slidepanel/slidePanel.css?v=? =$this-version ?>">
|
<link rel="stylesheet" href="css/vendor/plugins/slidepanel/slidePanel.css?v=? =$this-version ?>">
|
||||||
<link rel="stylesheet" href="css/vendor/plugins/flag-icon-css/flag-icon.css?v=? =$this-version ?>">
|
<link rel="stylesheet" href="css/vendor/plugins/flag-icon-css/flag-icon.css?v=? =$this-version ?>">
|
||||||
<link rel="stylesheet" href="css/login-v3.css?v=? =$this-version ?>">
|
<link rel="stylesheet" href="css/login-v3.css?v=? =$this-version ?>">
|
||||||
@@ -102,42 +101,16 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- Core -->
|
<!-- Core -->
|
||||||
<script src="js/vendor/babel-external-helpers/babel-external-helpers.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/jquery/jquery.js?v=<? $this->version ?>"></script>
|
<script src="js/vendor/jquery/jquery.js?v=<? $this->version ?>"></script>
|
||||||
<script src="js/vendor/popper-js/umd/popper.min.js?v=<? $this->version ?>"></script>
|
<script src="js/vendor/popper-js/umd/popper.min.js?v=<? $this->version ?>"></script>
|
||||||
<script src="js/vendor/bootstrap/bootstrap.js?v=<? $this->version ?>"></script>
|
<script src="js/vendor/bootstrap/bootstrap.js?v=<? $this->version ?>"></script>
|
||||||
<script src="js/vendor/animsition/animsition.js?v=<? $this->version ?>"></script>
|
<script src="js/vendor/animsition/animsition.js?v=<? $this->version ?>"></script>
|
||||||
<script src="js/vendor/mousewheel/jquery.mousewheel.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/asscrollbar/jquery-asScrollbar.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/asscrollable/jquery-asScrollable.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/ashoverscroll/jquery-asHoverScroll.js?v=<? $this->version ?>"></script>
|
|
||||||
|
|
||||||
<!-- Plugins -->
|
|
||||||
<script src="js/vendor/switchery/switchery.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/intro-js/intro.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/screenfull/screenfull.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/slidepanel/jquery-slidePanel.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/jquery-placeholder/jquery.placeholder.js?v=<? $this->version ?>"></script>
|
|
||||||
|
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
<script src="js/vendor/Component.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/Plugin.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/Base.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/Config.js?v=<? $this->version ?>"></script>
|
<script src="js/vendor/Config.js?v=<? $this->version ?>"></script>
|
||||||
|
|
||||||
<script src="js/vendor/Section/Menubar.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/Section/GridMenu.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/Section/Sidebar.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/Section/PageAside.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/Plugin/menu.js?v=<? $this->version ?>"></script>
|
|
||||||
|
|
||||||
<!-- Page -->
|
<!-- Page -->
|
||||||
<script src="/js/vendor/Site.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/Plugin/asscrollable.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/Plugin/slidepanel.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/Plugin/switchery.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/Plugin/jquery-placeholder.js?v=<? $this->version ?>"></script>
|
|
||||||
<script src="js/vendor/Plugin/material.js?v=<? $this->version ?>"></script>
|
|
||||||
|
|
||||||
<script src="js/vendor/Knockout.min.js?v=<? $this->version ?>"></script>
|
<script src="js/vendor/Knockout.min.js?v=<? $this->version ?>"></script>
|
||||||
<script src="js/lib/modules/login/loginModule.js?v=<? $this->version ?>"></script>
|
<script src="js/lib/modules/login/loginModule.js?v=<? $this->version ?>"></script>
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/* @override
|
||||||
|
http://dbois.test/css/dashboard.css */
|
||||||
|
#DASHBOARD {
|
||||||
|
font-family: 'Libre Franklin', sans-serif;
|
||||||
|
}
|
||||||
|
.db-panel {
|
||||||
|
float: left;
|
||||||
|
width: 50%;
|
||||||
|
padding: 5px;
|
||||||
|
/*border: 1px solid #333;*/
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.db-panel-holder {
|
||||||
|
padding: 15px;
|
||||||
|
border-radius: 5px;
|
||||||
|
box-shadow: 5px 5px 10px #aaa;
|
||||||
|
height: 270px;
|
||||||
|
}
|
||||||
|
.db-panel-success {
|
||||||
|
background-color: #616236;
|
||||||
|
}
|
||||||
|
.db-panel-warning {
|
||||||
|
background-color: #db9c01;
|
||||||
|
/*color: #256;*/
|
||||||
|
}
|
||||||
|
.db-panel-danger {
|
||||||
|
background-color: #930125;
|
||||||
|
}
|
||||||
|
.db-panel-info {
|
||||||
|
background-color: #202737;
|
||||||
|
}
|
||||||
|
.db-panel-holder h3 {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.db-panel-holder h3, .db-panel-holder h4 {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.db-panel-label {
|
||||||
|
line-height: 2em;
|
||||||
|
}
|
||||||
|
.db-panel-body h4 {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
border-bottom: 1px solid #fff;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
/*text-align: right;*/
|
||||||
|
}
|
||||||
|
.db-panel-data {
|
||||||
|
float: right;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
dbo.dashboardInit = function () {
|
dbo.dashboardInit = function () {
|
||||||
console.log( dbo.dashboardModel );
|
|
||||||
if ( dbo.dashboardModel !== undefined ) {
|
if ( dbo.dashboardModel !== undefined ) {
|
||||||
|
|
||||||
dbo.dashboardModel.init();
|
dbo.dashboardModel.init();
|
||||||
@@ -15,21 +15,56 @@ dbo.dashboardInit = function () {
|
|||||||
dbo.dashboardModel = {
|
dbo.dashboardModel = {
|
||||||
|
|
||||||
|
|
||||||
owpThisYear : ko.observable( null ),
|
owpThisYear : ko.observable( null ),
|
||||||
owpNextYear : ko.observable( null ),
|
owpNextYear : ko.observable( null ),
|
||||||
owpTotal : ko.observable( null ),
|
owpTotal : ko.observable( null ),
|
||||||
revenuesNextyear: ko.observable( null ),
|
revenuesNextyear : ko.observable( null ),
|
||||||
totalRevenues : ko.observable( null ),
|
totalRevenues : ko.observable( null ),
|
||||||
|
outstanding : ko.observable( null ),
|
||||||
|
toInvoice : ko.observable( null ),
|
||||||
|
openCosts : ko.observable( null ),
|
||||||
|
revenues : ko.observable( null ),
|
||||||
|
revenues : ko.observable( null ),
|
||||||
|
revenueCurrentYear: ko.observable( null ),
|
||||||
|
|
||||||
init: function () {
|
init: function () {
|
||||||
var self = dbo.dashboardModel;
|
var self = dbo.dashboardModel;
|
||||||
dbo.dashboardDataservice.getOwhp( function ( data ) {
|
dbo.dashboardDataservice.getOwhp( function ( data ) {
|
||||||
|
var outstandings = self.getOutstandingTotal( data.outstandings );
|
||||||
|
var revCurYear = Number( data.currentFinancialYear ) + Number( data.totalOwp );
|
||||||
|
|
||||||
self.owpThisYear( dbo.helpers.thousandSeparator( data.currentFinancialYear ) );
|
self.owpThisYear( dbo.helpers.thousandSeparator( data.currentFinancialYear ) );
|
||||||
self.owpNextYear( dbo.helpers.thousandSeparator( data.owpNextyear ) );
|
self.owpNextYear( dbo.helpers.thousandSeparator( data.owpNextyear ) );
|
||||||
self.owpTotal( dbo.helpers.thousandSeparator( data.totalOwp ) );
|
self.owpTotal( dbo.helpers.thousandSeparator( data.totalOwp ) );
|
||||||
self.revenuesNextyear( dbo.helpers.thousandSeparator( data.revenuesNextyear ) );
|
self.revenuesNextyear( dbo.helpers.thousandSeparator( data.revenuesNextyear ) );
|
||||||
self.totalRevenues( dbo.helpers.thousandSeparator( data.totalRevenues ) );
|
self.totalRevenues( dbo.helpers.thousandSeparator( data.totalRevenues ) );
|
||||||
|
self.outstanding( dbo.helpers.thousandSeparator( outstandings.open ) );
|
||||||
|
self.toInvoice( dbo.helpers.thousandSeparator( outstandings.toInvoice ) );
|
||||||
|
self.openCosts( dbo.helpers.thousandSeparator( outstandings.openCosts ) );
|
||||||
|
self.revenues( dbo.helpers.thousandSeparator( outstandings.revenues ) );
|
||||||
|
self.revenueCurrentYear( dbo.helpers.thousandSeparator( revCurYear ) );
|
||||||
} );
|
} );
|
||||||
|
},
|
||||||
|
|
||||||
|
getOutstandingTotal: function ( data ) {
|
||||||
|
var open = 0;
|
||||||
|
var toInvoice = 0;
|
||||||
|
var costs = 0;
|
||||||
|
var openCosts = 0;
|
||||||
|
_.each( data, function ( p ) {
|
||||||
|
open += Number( p.invoiced ) - Number( p.payment );
|
||||||
|
toInvoice += Number( p.revenues ) - Number( p.invoiced );
|
||||||
|
costs += Number( p.costs );
|
||||||
|
openCosts += Number( p.costs ) - Number( p.payedcosts )
|
||||||
|
} );
|
||||||
|
var revenues = (Number( open ) + Number( toInvoice ) - Number( openCosts )) / 1.21;
|
||||||
|
return {
|
||||||
|
open : open,
|
||||||
|
toInvoice: toInvoice,
|
||||||
|
costs : costs,
|
||||||
|
revenues : Math.round( revenues ),
|
||||||
|
openCosts: openCosts
|
||||||
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user