diveren. mail peter 16-02-2020
This commit is contained in:
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
class DashboardController extends MY_Controller {
|
class DashboardController extends MY_Controller {
|
||||||
|
|
||||||
|
private $invoiceOverviews = [];
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@@ -44,6 +46,8 @@ class DashboardController extends MY_Controller {
|
|||||||
|
|
||||||
$outstandings = $this->Invoices_model->getTotalsOutstandingPerProject( FALSE );
|
$outstandings = $this->Invoices_model->getTotalsOutstandingPerProject( FALSE );
|
||||||
|
|
||||||
|
$this->setInvoiceOverview();
|
||||||
|
|
||||||
$this->json( [
|
$this->json( [
|
||||||
'totalOwp' => round( $totalOwp, 0 ),
|
'totalOwp' => round( $totalOwp, 0 ),
|
||||||
'revenuesThisYear' => $this->getRevenuesThisYear(),
|
'revenuesThisYear' => $this->getRevenuesThisYear(),
|
||||||
@@ -51,10 +55,11 @@ class DashboardController extends MY_Controller {
|
|||||||
'owpNextyear' => round( $totalOwp - $currentFinancialYear ),
|
'owpNextyear' => round( $totalOwp - $currentFinancialYear ),
|
||||||
'revenuesNextyear' => round( $currentFinancialYear / 0.4 ),
|
'revenuesNextyear' => round( $currentFinancialYear / 0.4 ),
|
||||||
'totalRevenues' => round( $totalRevenues ),
|
'totalRevenues' => round( $totalRevenues ),
|
||||||
'outstandings' => $this->getInvoiceOverview(),
|
'outstandings' => $this->invoiceOverviews,
|
||||||
'costsToPay' => $this->reservations(),
|
'costsToPay' => $this->reservations(),
|
||||||
'invoiced' => $this->getInvoiced(),
|
'invoiced' => $this->getInvoiced(),
|
||||||
'totalChance' => $this->getChanceRevenues()
|
'totalChance' => $this->getChanceRevenues(),
|
||||||
|
'totalPayment' => $this->getTotalpayment()
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +81,7 @@ class DashboardController extends MY_Controller {
|
|||||||
return $totalRevenue;
|
return $totalRevenue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getInvoiceOverview()
|
private function setInvoiceOverview()
|
||||||
{
|
{
|
||||||
$projects = Project::whereArchive( 'F' )->get();
|
$projects = Project::whereArchive( 'F' )->get();
|
||||||
|
|
||||||
@@ -84,10 +89,8 @@ class DashboardController extends MY_Controller {
|
|||||||
{
|
{
|
||||||
$invoiceOverview = new InvoiceOverview( $project, date( 'Y' ) );
|
$invoiceOverview = new InvoiceOverview( $project, date( 'Y' ) );
|
||||||
|
|
||||||
$invoiceOverviews[] = $invoiceOverview->getProjectDetails();
|
$this->invoiceOverviews[] = $invoiceOverview->getProjectDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $invoiceOverviews;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function reservations()
|
private function reservations()
|
||||||
@@ -137,4 +140,15 @@ class DashboardController extends MY_Controller {
|
|||||||
return $totalChance;
|
return $totalChance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getTotalPayment()
|
||||||
|
{
|
||||||
|
$totalPayment = 0;
|
||||||
|
foreach($this->invoiceOverviews as $invoiceOverview)
|
||||||
|
{
|
||||||
|
$totalPayment += str_replace( '.', '', $invoiceOverview['projectPayment']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $totalPayment;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class MY_Controller extends CI_Controller {
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->version = '1.00.40';
|
$this->version = '1.00.50';
|
||||||
|
|
||||||
$this->load->library( 'beheer/session/RetrieveUserSession' );
|
$this->load->library( 'beheer/session/RetrieveUserSession' );
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ class Offer extends BaseModel {
|
|||||||
|
|
||||||
public static function getOffersWithoutProject()
|
public static function getOffersWithoutProject()
|
||||||
{
|
{
|
||||||
$offersWithoutProject = Offer::orderBy( 'startdate' )
|
$offersWithoutProject = Offer::selectRAW('offers.*, CONCAT(offernumber, " ", offername) AS fulloffer')
|
||||||
|
->orderBy( 'startdate' )
|
||||||
// ->whereNull('rejectdate')
|
// ->whereNull('rejectdate')
|
||||||
// ->whereNull('project_id')
|
// ->whereNull('project_id')
|
||||||
->whereArchive( 'F' )
|
->whereArchive( 'F' )
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<?php if(in_array(ROLE, [2] )): ?>
|
<?php if(in_array(ROLE, [2] )): ?>
|
||||||
<div class="db-panel">
|
<div class="db-panel">
|
||||||
|
<div class="conceal-panel db-panel-success" data-bind="click:hideConceals">
|
||||||
|
<h3>Onderhanden werkpositie</h3>
|
||||||
|
</div>
|
||||||
<div class="db-panel-holder db-panel-success">
|
<div class="db-panel-holder db-panel-success">
|
||||||
<div class="db-panel-heading">
|
<div class="db-panel-heading" data-bind="click:showConceals">
|
||||||
<h3 class="db-panel-title">
|
<h3 class="db-panel-title">
|
||||||
Onderhanden werkpositie
|
Onderhanden werkpositie
|
||||||
</h3>
|
</h3>
|
||||||
@@ -25,8 +28,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="db-panel">
|
<div class="db-panel">
|
||||||
|
<div class="conceal-panel db-panel-warning" data-bind="click:hideConceals">
|
||||||
|
<h3>Omzet</h3>
|
||||||
|
</div>
|
||||||
<div class="db-panel-holder db-panel-warning">
|
<div class="db-panel-holder db-panel-warning">
|
||||||
<div class="db-panel-heading">
|
<div class="db-panel-heading" data-bind="click:showConceals">
|
||||||
<h3 class="db-panel-title">
|
<h3 class="db-panel-title">
|
||||||
Omzet
|
Omzet
|
||||||
</h3>
|
</h3>
|
||||||
@@ -38,11 +44,37 @@
|
|||||||
<span class="db-panel-data"><strong data-bind="text:revenuesThisYear"></strong></span>
|
<span class="db-panel-data"><strong data-bind="text:revenuesThisYear"></strong></span>
|
||||||
</h4>
|
</h4>
|
||||||
<h4>
|
<h4>
|
||||||
<span class="db-panel-label">Minimum omzet lopend jaar:</span>
|
<span class="db-panel-label">
|
||||||
|
Minimum omzet lopend jaar:
|
||||||
|
</span>
|
||||||
|
<span class="dashboard-info"
|
||||||
|
data-bind="event: {
|
||||||
|
mouseover: enableDetails.bind($data, 'toolTip1'),
|
||||||
|
mouseout: disableDetails.bind($data, 'toolTip1') }">
|
||||||
|
<label>?</label>
|
||||||
|
<div data-bind="if:toolTip1" class="my-tooltip">
|
||||||
|
<h5>Dit is een voorbeeld header</h5>
|
||||||
|
<p>Mollis Egestas Fusce Parturient</p>
|
||||||
|
<p>Ultricies Ligula Risus</p>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
<span class="db-panel-data"><strong data-bind="text:minimumRevenues"></strong></span>
|
<span class="db-panel-data"><strong data-bind="text:minimumRevenues"></strong></span>
|
||||||
</h4>
|
</h4>
|
||||||
<h4>
|
<h4>
|
||||||
<span class="db-panel-label">Verwachte omzet komende 12 maanden:</span>
|
<span class="db-panel-label">
|
||||||
|
Verwachte omzet komende 12 maanden:
|
||||||
|
</span>
|
||||||
|
<span class="dashboard-info"
|
||||||
|
data-bind="event: {
|
||||||
|
mouseover: enableDetails.bind($data, 'toolTip3'),
|
||||||
|
mouseout: disableDetails.bind($data, 'toolTip3') }">
|
||||||
|
<label>?</label>
|
||||||
|
<div data-bind="if:toolTip3" class="my-tooltip">
|
||||||
|
<h5>Dit is een voorbeeld header</h5>
|
||||||
|
<p>Mollis Egestas Fusce Parturient</p>
|
||||||
|
<p>Ultricies Ligula Risus</p>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
<span class="db-panel-data">
|
<span class="db-panel-data">
|
||||||
<strong data-bind="text:revenuesNextyear"></strong>
|
<strong data-bind="text:revenuesNextyear"></strong>
|
||||||
</span>
|
</span>
|
||||||
@@ -53,9 +85,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="db-panel">
|
<div class="db-panel">
|
||||||
|
<div class="conceal-panel db-panel-info" data-bind="click:hideConceals">
|
||||||
|
<h3>Facturatie</h3>
|
||||||
|
</div>
|
||||||
<div class="db-panel-holder db-panel-info">
|
<div class="db-panel-holder db-panel-info">
|
||||||
<div class="db-panel-heading">
|
<div class="db-panel-heading">
|
||||||
<h3 class="db-panel-title">
|
<h3 class="db-panel-title" data-bind="click:showConceals">
|
||||||
Facturatie
|
Facturatie
|
||||||
<span style="margin-left:10px;display:none"
|
<span style="margin-left:10px;display:none"
|
||||||
class="glyphicon glyphicon-question-sign pointer"
|
class="glyphicon glyphicon-question-sign pointer"
|
||||||
@@ -111,15 +146,22 @@
|
|||||||
</span>
|
</span>
|
||||||
</h4>
|
</h4>
|
||||||
<h4>
|
<h4>
|
||||||
<span class="db-panel-label">Nog te factureren (incl btw):</span>
|
<span class="db-panel-label">Nog te factureren totaal(incl btw):</span>
|
||||||
<span class="db-panel-data"><strong data-bind="text:toInvoice"></strong></span>
|
<span class="db-panel-data"><strong data-bind="text:toInvoice"></strong></span>
|
||||||
</h4>
|
</h4>
|
||||||
|
<h4>
|
||||||
|
<span class="db-panel-label">betaalde facturen lopende jaar (incl btw):</span>
|
||||||
|
<span class="db-panel-data"><strong data-bind="text:payments"></strong></span>
|
||||||
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="db-panel">
|
<div class="db-panel">
|
||||||
|
<div class="conceal-panel db-panel-danger" data-bind="click:hideConceals">
|
||||||
|
<h3>Resultaat</h3>
|
||||||
|
</div>
|
||||||
<div class="db-panel-holder db-panel-danger">
|
<div class="db-panel-holder db-panel-danger">
|
||||||
<div class="db-panel-heading">
|
<div class="db-panel-heading" data-bind="click:showConceals">
|
||||||
<h3 class="db-panel-title">
|
<h3 class="db-panel-title">
|
||||||
Resultaat
|
Resultaat
|
||||||
</h3>
|
</h3>
|
||||||
@@ -131,7 +173,20 @@
|
|||||||
<span class="db-panel-data"><strong data-bind="text:openCosts"></strong></span>
|
<span class="db-panel-data"><strong data-bind="text:openCosts"></strong></span>
|
||||||
</h4>
|
</h4>
|
||||||
<h4>
|
<h4>
|
||||||
<span class="db-panel-label">Saldo inkomsten (excl btw):</span>
|
<span class="db-panel-label">
|
||||||
|
Saldo inkomsten totaal(excl btw):
|
||||||
|
</span>
|
||||||
|
<span class="dashboard-info"
|
||||||
|
data-bind="event: {
|
||||||
|
mouseover: enableDetails.bind($data, 'toolTip2'),
|
||||||
|
mouseout: disableDetails.bind($data, 'toolTip2') }">
|
||||||
|
<label>?</label>
|
||||||
|
<div data-bind="if:toolTip2" class="my-tooltip">
|
||||||
|
<h5>Dit is een voorbeeld header</h5>
|
||||||
|
<p>Mollis Egestas Fusce Parturient</p>
|
||||||
|
<p>Ultricies Ligula Risus</p>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
<span class="db-panel-data"><strong data-bind="text:revenues"></strong></span>
|
<span class="db-panel-data"><strong data-bind="text:revenues"></strong></span>
|
||||||
</h4>
|
</h4>
|
||||||
<h4>
|
<h4>
|
||||||
@@ -155,3 +210,4 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
<!-- ko if: hourType() == 'OFFERS' && archive() == 'F' -->
|
<!-- ko if: hourType() == 'OFFERS' && archive() == 'F' -->
|
||||||
<select class="form-control form-control-sm"
|
<select class="form-control form-control-sm"
|
||||||
data-bind="options:$root.offersWithoutProject,
|
data-bind="options:$root.offersWithoutProject,
|
||||||
optionsText:'offername',
|
optionsText:'fulloffer',
|
||||||
optionsValue:'id',
|
optionsValue:'id',
|
||||||
value:projectID,
|
value:projectID,
|
||||||
optionsCaption:'selecteer...',
|
optionsCaption:'selecteer...',
|
||||||
|
|||||||
@@ -9,12 +9,28 @@
|
|||||||
padding: 5px;
|
padding: 5px;
|
||||||
/*border: 1px solid #333;*/
|
/*border: 1px solid #333;*/
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.conceal-panel {
|
||||||
|
position: absolute;
|
||||||
|
height: 96%;
|
||||||
|
border-radius: 5px;
|
||||||
|
width: 99%;
|
||||||
|
top: 5px;
|
||||||
|
left: 0;
|
||||||
|
background-color: #000;
|
||||||
|
/*opacity: .97;*/
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
.conceal-panel > h3 {
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 100px;
|
||||||
}
|
}
|
||||||
.db-panel-holder {
|
.db-panel-holder {
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
box-shadow: 5px 5px 10px #aaa;
|
box-shadow: 5px 5px 10px #aaa;
|
||||||
height: 270px;
|
height: 300px;
|
||||||
}
|
}
|
||||||
.db-panel-success {
|
.db-panel-success {
|
||||||
background-color: #616236;
|
background-color: #616236;
|
||||||
@@ -60,4 +76,49 @@
|
|||||||
top: -40px;
|
top: -40px;
|
||||||
border: 2px solid #000;
|
border: 2px solid #000;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
.dashboard-info {
|
||||||
|
width: 15px;
|
||||||
|
height: 15px;
|
||||||
|
font-size: .6em;
|
||||||
|
background-color: #444;
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 50%;
|
||||||
|
text-align: center;
|
||||||
|
position: relative;
|
||||||
|
top: -3px;
|
||||||
|
box-shadow: 0px 3px 5px #444;
|
||||||
|
margin-left: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.dashboard-info > label {
|
||||||
|
position: absolute;
|
||||||
|
top: 2px;
|
||||||
|
left: 5px;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.my-tooltip {
|
||||||
|
position: absolute;
|
||||||
|
width: 230px;
|
||||||
|
background-color: #fff;
|
||||||
|
/*display: inline-block;*/
|
||||||
|
color:#000;
|
||||||
|
top:0px;
|
||||||
|
left: -240px;
|
||||||
|
box-shadow: 2px 2px 5px #222;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
.my-tooltip > h5 {
|
||||||
|
background-color: #ccc;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: left;
|
||||||
|
padding: 5px;
|
||||||
|
margin-top: 0;
|
||||||
|
border-radius: 5px 5px 0 0 ;
|
||||||
|
}
|
||||||
|
.my-tooltip > p {
|
||||||
|
margin: 0;
|
||||||
|
text-align: left;
|
||||||
|
padding: 0px 5px;
|
||||||
|
color: #333;
|
||||||
}
|
}
|
||||||
@@ -7,103 +7,124 @@
|
|||||||
|
|
||||||
dbo.dashboardInit = function () {
|
dbo.dashboardInit = function () {
|
||||||
|
|
||||||
if (dbo.dashboardModel !== undefined) {
|
if ( dbo.dashboardModel !== undefined ) {
|
||||||
|
|
||||||
dbo.dashboardModel.init()
|
dbo.dashboardModel.init()
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
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),
|
outstanding : ko.observable( null ),
|
||||||
toInvoice : ko.observable(null),
|
toInvoice : ko.observable( null ),
|
||||||
openCosts : ko.observable(null),
|
openCosts : ko.observable( null ),
|
||||||
revenues : ko.observable(null),
|
payments : ko.observable( null ),
|
||||||
revenues : ko.observable(null),
|
revenues : ko.observable( null ),
|
||||||
revenueCurrentYear : ko.observable(null),
|
revenueCurrentYear : ko.observable( null ),
|
||||||
revenuesThisYear : ko.observable(null),
|
revenuesThisYear : ko.observable( null ),
|
||||||
billingOverview : ko.observableArray([]),
|
billingOverview : ko.observableArray( [] ),
|
||||||
showInvoiceOverview: ko.observable(false),
|
showInvoiceOverview: ko.observable( false ),
|
||||||
openInvoices : ko.observable(null),
|
openInvoices : ko.observable( null ),
|
||||||
invoiced : ko.observable(null),
|
invoiced : ko.observable( null ),
|
||||||
minimumRevenues : ko.observable(null),
|
minimumRevenues : ko.observable( null ),
|
||||||
totalChance : ko.observable(null),
|
totalChance : ko.observable( null ),
|
||||||
|
toolTip1 : ko.observable( false ),
|
||||||
|
toolTip2 : ko.observable( false ),
|
||||||
|
toolTip3 : ko.observable( false ),
|
||||||
|
|
||||||
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 outstandings = self.getOutstandingTotal( data.outstandings )
|
||||||
var revCurYear = Number(data.currentFinancialYear) + Number(data.totalOwp)
|
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.minimumRevenues(dbo.helpers.thousandSeparator(data.currentFinancialYear + data.revenuesThisYear))
|
self.minimumRevenues( dbo.helpers.thousandSeparator( data.currentFinancialYear + data.revenuesThisYear ) )
|
||||||
self.invoiced(dbo.helpers.thousandSeparator(data.invoiced))
|
self.invoiced( dbo.helpers.thousandSeparator( data.invoiced ) )
|
||||||
self.openInvoices(dbo.helpers.thousandSeparator(outstandings.openInvoices))
|
self.openInvoices( dbo.helpers.thousandSeparator( outstandings.openInvoices ) )
|
||||||
self.toInvoice(dbo.helpers.thousandSeparator(outstandings.toInvoice))
|
self.toInvoice( dbo.helpers.thousandSeparator( outstandings.toInvoice ) )
|
||||||
self.totalChance(dbo.helpers.thousandSeparator(data.totalChance))
|
self.totalChance( dbo.helpers.thousandSeparator( data.totalChance ) )
|
||||||
|
self.payments(dbo.helpers.thousandSeparator(data.totalPayment))
|
||||||
|
|
||||||
self.revenueCurrentYear(dbo.helpers.thousandSeparator(revCurYear))
|
self.revenueCurrentYear( dbo.helpers.thousandSeparator( revCurYear ) )
|
||||||
self.revenuesThisYear(dbo.helpers.thousandSeparator(data.revenuesThisYear))
|
self.revenuesThisYear( dbo.helpers.thousandSeparator( data.revenuesThisYear ) )
|
||||||
dbo.reservationsDataservice.getReservations(function (data) {
|
dbo.reservationsDataservice.getReservations( function ( data ) {
|
||||||
var openCosts = 0
|
var openCosts = 0
|
||||||
$.each(data, function (i, p) {
|
$.each( data, function ( i, p ) {
|
||||||
openCosts += Number(p.other_revenue) - Number(p.payed)
|
openCosts += Number( p.other_revenue ) - Number( p.payed )
|
||||||
})
|
} )
|
||||||
self.openCosts(dbo.helpers.thousandSeparator(openCosts))
|
self.openCosts( dbo.helpers.thousandSeparator( openCosts ) )
|
||||||
|
|
||||||
var revenues = outstandings.openInvoices + outstandings.toInvoice - openCosts
|
var revenues = outstandings.openInvoices + outstandings.toInvoice + openCosts
|
||||||
revenues = Math.round(revenues / 1.21)
|
revenues = Math.round( revenues / 1.21 )
|
||||||
self.revenues(dbo.helpers.thousandSeparator(revenues))
|
self.revenues( dbo.helpers.thousandSeparator( revenues ) )
|
||||||
})
|
} )
|
||||||
})
|
} )
|
||||||
},
|
},
|
||||||
|
|
||||||
getOutstandingTotal: function (data) {
|
getOutstandingTotal: function ( data ) {
|
||||||
var self = dbo.dashboardModel
|
var self = dbo.dashboardModel
|
||||||
var openInvoices = 0
|
var openInvoices = 0
|
||||||
var toInvoice = 0
|
var toInvoice = 0
|
||||||
var costs = 0
|
var costs = 0
|
||||||
var openCosts = 0
|
var openCosts = 0
|
||||||
|
|
||||||
_.each(data, function (p) {
|
_.each( data, function ( p ) {
|
||||||
openInvoices += Number(p.invoiceToPay.replace('.', ''))
|
openInvoices += Number( p.invoiceToPay.replace( '.', '' ) )
|
||||||
toInvoice += Number(p.needInvoice.replace('.', ''))
|
toInvoice += Number( p.needInvoice.replace( '.', '' ) )
|
||||||
})
|
} )
|
||||||
|
|
||||||
var revenues = (Number(open) + Number(toInvoice) - Number(openCosts)) / 1.21
|
var revenues = (Number( open ) + Number( toInvoice ) - Number( openCosts )) / 1.21
|
||||||
return {
|
return {
|
||||||
openInvoices: openInvoices,
|
openInvoices: openInvoices,
|
||||||
toInvoice : toInvoice,
|
toInvoice : toInvoice,
|
||||||
costs : costs,
|
costs : costs,
|
||||||
revenues : Math.round(revenues),
|
revenues : Math.round( revenues ),
|
||||||
openCosts : openCosts
|
openCosts : openCosts
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
invoiceOverview : function () {
|
invoiceOverview : function () {
|
||||||
var self = dbo.dashboardModel
|
var self = dbo.dashboardModel
|
||||||
|
|
||||||
self.showInvoiceOverview(!self.showInvoiceOverview())
|
self.showInvoiceOverview( !self.showInvoiceOverview() )
|
||||||
},
|
},
|
||||||
Billing : function (data) {
|
Billing : function ( data ) {
|
||||||
console.log(data)
|
|
||||||
self.project = data.projectnumber + ' ' + data.projectname
|
self.project = data.projectnumber + ' ' + data.projectname
|
||||||
self.invoiced = dbo.helpers.thousandSeparator(data.invoiced)
|
self.invoiced = dbo.helpers.thousandSeparator( data.invoiced )
|
||||||
self.payedcosts = dbo.helpers.thousandSeparator(data.payedcosts)
|
self.payedcosts = dbo.helpers.thousandSeparator( data.payedcosts )
|
||||||
self.openCosts = dbo.helpers.thousandSeparator(Number(data.invoiced) - Number(data.payedcosts))
|
self.openCosts = dbo.helpers.thousandSeparator( Number( data.invoiced ) - Number( data.payedcosts ) )
|
||||||
self.archive = data.archive
|
self.archive = data.archive
|
||||||
|
},
|
||||||
|
|
||||||
|
hideConceals: function () {
|
||||||
|
$( '.conceal-panel' ).hide( 'slow' );
|
||||||
|
},
|
||||||
|
|
||||||
|
showConceals: function () {
|
||||||
|
$( '.conceal-panel' ).show( 'slow' );
|
||||||
|
},
|
||||||
|
|
||||||
|
enableDetails: function ( toolTip ) {
|
||||||
|
var self = dbo.dashboardModel
|
||||||
|
self[toolTip]( true )
|
||||||
|
},
|
||||||
|
|
||||||
|
disableDetails: function ( toolTip ) {
|
||||||
|
var self = dbo.dashboardModel
|
||||||
|
self[toolTip]( false )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dbo.dashboardModel.init()
|
dbo.dashboardModel.init()
|
||||||
|
|
||||||
ko.applyBindings(dbo.dashboardModel, document.getElementById('DASHBOARD'))
|
ko.applyBindings( dbo.dashboardModel, document.getElementById( 'DASHBOARD' ) )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user