Diversen dashboard
This commit is contained in:
@@ -52,7 +52,9 @@ class DashboardController extends MY_Controller {
|
|||||||
'revenuesNextyear' => round( $currentFinancialYear / 0.4 ),
|
'revenuesNextyear' => round( $currentFinancialYear / 0.4 ),
|
||||||
'totalRevenues' => round( $totalRevenues ),
|
'totalRevenues' => round( $totalRevenues ),
|
||||||
'outstandings' => $this->getInvoiceOverview(),
|
'outstandings' => $this->getInvoiceOverview(),
|
||||||
'costsToPay' => $this->reservations()
|
'costsToPay' => $this->reservations(),
|
||||||
|
'invoiced' => $this->getInvoiced(),
|
||||||
|
'totalChance' => $this->getChanceRevenues()
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,4 +108,33 @@ class DashboardController extends MY_Controller {
|
|||||||
return $costsToPay;
|
return $costsToPay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getInvoiced()
|
||||||
|
{
|
||||||
|
$invoiced = Invoice::getInvoiced( date( 'Y' ) );
|
||||||
|
|
||||||
|
$totalInvoiced = 0;
|
||||||
|
foreach ( $invoiced as $invoice )
|
||||||
|
{
|
||||||
|
$totalInvoiced += ROUND( ( $invoice->invoiceamount * 1.21 ), 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $totalInvoiced;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getChanceRevenues()
|
||||||
|
{
|
||||||
|
$offers = Offer::getAllOffers( FALSE, 'F', '', 'id', 'desc' );
|
||||||
|
|
||||||
|
$totalChance = 0;
|
||||||
|
foreach ( $offers as $offer )
|
||||||
|
{
|
||||||
|
$totalChance +=
|
||||||
|
ROUND(
|
||||||
|
( $offer->own_revenue + $offer->other_revenue ) *
|
||||||
|
( $offer->acceptance_chance / 100 ), 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $totalChance;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class Invoice extends BaseModel {
|
|||||||
|
|
||||||
public static function getInvoiced( $year )
|
public static function getInvoiced( $year )
|
||||||
{
|
{
|
||||||
$invoiced = Invoice::selectRaw('invoicenumber, PRJ.projectname, projectnumber, CUS.name, invoicedate, CUS.name, invoiceamount')
|
$invoiced = Invoice::selectRaw('invoicenumber, PRJ.projectname, projectnumber, CUS.name, invoicedate, CUS.name, ROUND(invoiceamount, 0) AS invoiceamount')
|
||||||
->join('projects AS PRJ', 'PRJ.id', '=', 'invoices.project_id')
|
->join('projects AS PRJ', 'PRJ.id', '=', 'invoices.project_id')
|
||||||
->join('customers AS CUS', 'CUS.id', '=', 'PRJ.customer_id')
|
->join('customers AS CUS', 'CUS.id', '=', 'PRJ.customer_id')
|
||||||
->whereRaw("DATE_FORMAT(invoicedate, '%Y') = {$year}")
|
->whereRaw("DATE_FORMAT(invoicedate, '%Y') = {$year}")
|
||||||
|
|||||||
@@ -34,15 +34,19 @@
|
|||||||
<div class="db-panel-body" data-bind="width:owp">
|
<div class="db-panel-body" data-bind="width:owp">
|
||||||
<br>
|
<br>
|
||||||
<h4>
|
<h4>
|
||||||
<span class="db-panel-label">Omzet komende jaar:</span>
|
<span class="db-panel-label">Omzet totaal gerealiseerd lopend jaar:</span>
|
||||||
|
<span class="db-panel-data"><strong data-bind="text:revenuesThisYear"></strong></span>
|
||||||
|
</h4>
|
||||||
|
<h4>
|
||||||
|
<span class="db-panel-label">Minimum omzet lopend jaar:</span>
|
||||||
|
<span class="db-panel-data"><strong data-bind="text:minimumRevenues"></strong></span>
|
||||||
|
</h4>
|
||||||
|
<h4>
|
||||||
|
<span class="db-panel-label">Verwachte omzet komende 12 maanden:</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>
|
||||||
</h4>
|
</h4>
|
||||||
<h4>
|
|
||||||
<span class="db-panel-label">Omzet totaal gerealiseerd lopend jaar:</span>
|
|
||||||
<span class="db-panel-data"><strong data-bind="text:revenuesThisYear"></strong></span>
|
|
||||||
</h4>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -92,6 +96,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="db-panel-body" data-bind="width:owp">
|
<div class="db-panel-body" data-bind="width:owp">
|
||||||
<br>
|
<br>
|
||||||
|
<h4>
|
||||||
|
<span class="db-panel-label">Verstuurde facturen lopende jaar (incl btw):</span>
|
||||||
|
<span class="db-panel-data">
|
||||||
|
<strong data-bind="text:invoiced">
|
||||||
|
</strong>
|
||||||
|
</span>
|
||||||
|
</h4>
|
||||||
<h4>
|
<h4>
|
||||||
<span class="db-panel-label">Openstaande facturen (incl btw):</span>
|
<span class="db-panel-label">Openstaande facturen (incl btw):</span>
|
||||||
<span class="db-panel-data">
|
<span class="db-panel-data">
|
||||||
@@ -116,13 +127,17 @@
|
|||||||
<div class="db-panel-body" data-bind="width:owp">
|
<div class="db-panel-body" data-bind="width:owp">
|
||||||
<br>
|
<br>
|
||||||
<h4>
|
<h4>
|
||||||
<span class="db-panel-label">Kosten derden (excl btw):</span>
|
<span class="db-panel-label">Kosten derden (incl btw):</span>
|
||||||
<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 (excl btw):</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>
|
||||||
|
<span class="db-panel-label">(eigen) omzet * kans (excl btw):</span>
|
||||||
|
<span class="db-panel-data"><strong data-bind="text:totalChance"></strong></span>
|
||||||
|
</h4>
|
||||||
<!-- <h4>-->
|
<!-- <h4>-->
|
||||||
<!-- <span class="db-panel-label">Omzet lopend jaar (excl btw):</span>-->
|
<!-- <span class="db-panel-label">Omzet lopend jaar (excl btw):</span>-->
|
||||||
<!-- <span class="db-panel-data"><strong data-bind="text:revenueCurrentYear"></strong></span>-->
|
<!-- <span class="db-panel-data"><strong data-bind="text:revenueCurrentYear"></strong></span>-->
|
||||||
|
|||||||
@@ -51,6 +51,20 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th colspan="4" class="align-right">Totaal</th>
|
||||||
|
<th class="align-right">
|
||||||
|
<span data-bind="text:totalInvoiced"></span>
|
||||||
|
</th>
|
||||||
|
<th class="align-right">
|
||||||
|
<span data-bind="text:totalVat"></span>
|
||||||
|
</th>
|
||||||
|
<th class="align-right">
|
||||||
|
<span data-bind="text:totalInclVat"></span>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ dbo.dashboardInit = function () {
|
|||||||
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),
|
||||||
|
minimumRevenues : ko.observable(null),
|
||||||
|
totalChance : ko.observable(null),
|
||||||
|
|
||||||
init: function () {
|
init: function () {
|
||||||
var self = dbo.dashboardModel
|
var self = dbo.dashboardModel
|
||||||
@@ -41,8 +44,11 @@ dbo.dashboardInit = function () {
|
|||||||
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.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.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))
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ dbo.invoicereportInit = function () {
|
|||||||
archive : ko.observable(false),
|
archive : ko.observable(false),
|
||||||
recievedInvoices : ko.observableArray([]),
|
recievedInvoices : ko.observableArray([]),
|
||||||
invoiced : ko.observableArray([]),
|
invoiced : ko.observableArray([]),
|
||||||
|
totalInvoiced : ko.observable(),
|
||||||
|
totalVat : ko.observable(),
|
||||||
|
totalInclVat : ko.observable(),
|
||||||
|
|
||||||
init: function () {
|
init: function () {
|
||||||
var vm = dbo.invoicereport
|
var vm = dbo.invoicereport
|
||||||
@@ -87,13 +90,18 @@ dbo.invoicereportInit = function () {
|
|||||||
p.paymentamount(dbo.helpers.thousandSeparator(p.paymentamount()))
|
p.paymentamount(dbo.helpers.thousandSeparator(p.paymentamount()))
|
||||||
})
|
})
|
||||||
|
|
||||||
vm.years(data.invoicedYears);
|
vm.years(data.invoicedYears)
|
||||||
|
|
||||||
vm.invoiced.removeAll()
|
vm.invoiced.removeAll()
|
||||||
|
vm.totalInvoiced(0)
|
||||||
|
vm.totalVat(0)
|
||||||
|
vm.totalInclVat(0)
|
||||||
_.each(data.invoiced, function (p) {
|
_.each(data.invoiced, function (p) {
|
||||||
vm.invoiced.push( new vm.Invoice(p));
|
vm.invoiced.push(new vm.Invoice(p))
|
||||||
});
|
})
|
||||||
|
vm.totalInvoiced(dbo.helpers.thousandSeparator(vm.totalInvoiced()))
|
||||||
|
vm.totalVat(dbo.helpers.thousandSeparator(vm.totalVat()))
|
||||||
|
vm.totalInclVat(dbo.helpers.thousandSeparator(vm.totalInclVat()))
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -245,8 +253,9 @@ dbo.invoicereportInit = function () {
|
|||||||
},
|
},
|
||||||
|
|
||||||
Invoice: function (data) {
|
Invoice: function (data) {
|
||||||
var vat = Math.round((data.invoiceamount * 21) / 100);
|
var vm = dbo.invoicereport
|
||||||
var inclVat = vat + Number(data.invoiceamount);
|
var vat = Math.round((data.invoiceamount * 21) / 100)
|
||||||
|
var inclVat = vat + Number(data.invoiceamount)
|
||||||
this.invoiceamount = dbo.helpers.thousandSeparator(data.invoiceamount)
|
this.invoiceamount = dbo.helpers.thousandSeparator(data.invoiceamount)
|
||||||
this.vat = dbo.helpers.thousandSeparator(vat)
|
this.vat = dbo.helpers.thousandSeparator(vat)
|
||||||
this.inclVat = dbo.helpers.thousandSeparator(inclVat)
|
this.inclVat = dbo.helpers.thousandSeparator(inclVat)
|
||||||
@@ -254,6 +263,9 @@ dbo.invoicereportInit = function () {
|
|||||||
this.invoicedate = data.invoicedate
|
this.invoicedate = data.invoicedate
|
||||||
this.name = data.name
|
this.name = data.name
|
||||||
this.invoicenumber = ko.observable(data.invoicenumber)
|
this.invoicenumber = ko.observable(data.invoicenumber)
|
||||||
|
vm.totalInvoiced(Number(vm.totalInvoiced()) + Number(data.invoiceamount))
|
||||||
|
vm.totalVat(Number(vm.totalVat()) + Number(vat))
|
||||||
|
vm.totalInclVat(Number(vm.totalInclVat()) + Number(inclVat))
|
||||||
},
|
},
|
||||||
|
|
||||||
createSpreadsheet: function () {
|
createSpreadsheet: function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user