Diversen opmerkingen
This commit is contained in:
@@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by Pensare Software.
|
||||||
|
* User: Theo Weijmer
|
||||||
|
* Date: 30/07/2018
|
||||||
|
* Time: 10:48
|
||||||
|
*/
|
||||||
|
|
||||||
|
class InvoiceForecastSheet {
|
||||||
|
|
||||||
|
const HEADERS = [
|
||||||
|
'A' => 'project',
|
||||||
|
'B' => 'klant',
|
||||||
|
'C' => 'Nog te factureren incl. btw',
|
||||||
|
'D' => 'Nog te factureren incl. btw lopend boekjaar incl. btw',
|
||||||
|
'E' => 'Nog te factureren na lopend boekjaar inc. btw',
|
||||||
|
'F' => 'Nog te prognotiseren inc. btw'
|
||||||
|
];
|
||||||
|
|
||||||
|
private $invoiceForecast;
|
||||||
|
private $sheet;
|
||||||
|
private $row;
|
||||||
|
|
||||||
|
public function __construct( $invoiceForecast, $sheet )
|
||||||
|
{
|
||||||
|
$this->invoiceForecast = $invoiceForecast;
|
||||||
|
$this->sheet = $sheet;
|
||||||
|
|
||||||
|
$this->handle();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function handle()
|
||||||
|
{
|
||||||
|
$this->setHeader();
|
||||||
|
|
||||||
|
$this->setBody();
|
||||||
|
|
||||||
|
$this->setTotals();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setHeader()
|
||||||
|
{
|
||||||
|
foreach ( self::HEADERS as $cell => $header )
|
||||||
|
{
|
||||||
|
$this->sheet->setCellValue( $cell . '1', $header );
|
||||||
|
$this->sheet->getColumnDimension( $cell )->setAutoSize( TRUE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setBody()
|
||||||
|
{
|
||||||
|
$this->row = 2;
|
||||||
|
foreach ( $this->invoiceForecast AS $project )
|
||||||
|
{
|
||||||
|
$this->sheet->setCellValue( 'A' . $this->row, $project['projectname'] );
|
||||||
|
$this->sheet->setCellValue( 'B' . $this->row, $project['customer'] );
|
||||||
|
$this->sheet->setCellValue( 'C' . $this->row, str_replace( '.', '', $project['needInvoice'] ) );
|
||||||
|
$this->sheet->setCellValue( 'D' . $this->row, str_replace( '.', '', $project['forecastThisYear'] ) );
|
||||||
|
$this->sheet->setCellValue( 'E' . $this->row, str_replace( '.', '', $project['forecastOtherYears'] ) );
|
||||||
|
$this->sheet->setCellValue( 'F' . $this->row, str_replace( '.', '', $project['forecastRemaining'] ) );
|
||||||
|
|
||||||
|
$this->row ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setTotals()
|
||||||
|
{
|
||||||
|
$lastRow = $this->row - 1;
|
||||||
|
$this->sheet->setCellValue( 'C' . $this->row, '=SUM(C2:C' . $lastRow . ')' );
|
||||||
|
$this->sheet->setCellValue( 'D' . $this->row, '=SUM(D2:D' . $lastRow . ')' );
|
||||||
|
$this->sheet->setCellValue( 'E' . $this->row, '=SUM(E2:E' . $lastRow . ')' );
|
||||||
|
$this->sheet->setCellValue( 'F' . $this->row, '=SUM(F2:F' . $lastRow . ')' );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
* Time: 20:40
|
* Time: 20:40
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class InvoiceSheet {
|
class InvoiceOverviewSheet {
|
||||||
|
|
||||||
const HEADERS = [
|
const HEADERS = [
|
||||||
'A' => 'project',
|
'A' => 'project',
|
||||||
@@ -34,7 +34,13 @@ class InvoiceSpreadsheet {
|
|||||||
{
|
{
|
||||||
$this->setSpreadsheet();
|
$this->setSpreadsheet();
|
||||||
|
|
||||||
$this->setInvoiceSheet();
|
$this->setInvoiceOverviewSheet();
|
||||||
|
|
||||||
|
$this->setInvoiceForecast();
|
||||||
|
|
||||||
|
$this->setMonthForecast();
|
||||||
|
|
||||||
|
$this->setMonthPayment();
|
||||||
|
|
||||||
$this->setFilename();
|
$this->setFilename();
|
||||||
|
|
||||||
@@ -50,14 +56,44 @@ class InvoiceSpreadsheet {
|
|||||||
$this->spreadsheet = new Spreadsheet();
|
$this->spreadsheet = new Spreadsheet();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setInvoiceSheet()
|
private function setInvoiceOverviewSheet()
|
||||||
{
|
{
|
||||||
$invoiceSheet = new Worksheet( $this->spreadsheet, 'Facturen' );
|
$invoiceSheet = new Worksheet( $this->spreadsheet, 'Facturen' );
|
||||||
|
|
||||||
$this->invoiceSheet =
|
$this->invoiceSheet =
|
||||||
$this->spreadsheet->addSheet( $invoiceSheet );
|
$this->spreadsheet->addSheet( $invoiceSheet );
|
||||||
|
|
||||||
new InvoiceSheet( $this->invoiceReport['invoiceOverview'], $this->invoiceSheet );
|
new InvoiceOverviewSheet( $this->invoiceReport['invoiceOverview'], $this->invoiceSheet );
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setInvoiceForecast()
|
||||||
|
{
|
||||||
|
$invoiceSheet = new Worksheet( $this->spreadsheet, 'prognose' );
|
||||||
|
|
||||||
|
$this->invoiceSheet =
|
||||||
|
$this->spreadsheet->addSheet( $invoiceSheet );
|
||||||
|
|
||||||
|
new InvoiceForecastSheet( $this->invoiceReport['forecasts'], $this->invoiceSheet );
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setMonthForecast()
|
||||||
|
{
|
||||||
|
$invoiceSheet = new Worksheet( $this->spreadsheet, 'maandprognose' );
|
||||||
|
|
||||||
|
$this->invoiceSheet =
|
||||||
|
$this->spreadsheet->addSheet( $invoiceSheet );
|
||||||
|
|
||||||
|
new MonthForecastSheet( $this->invoiceReport['monthForecasts'], $this->invoiceSheet );
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setMonthPayment()
|
||||||
|
{
|
||||||
|
$invoiceSheet = new Worksheet( $this->spreadsheet, 'maand betalingen' );
|
||||||
|
|
||||||
|
$this->invoiceSheet =
|
||||||
|
$this->spreadsheet->addSheet( $invoiceSheet );
|
||||||
|
|
||||||
|
new MonthPaymentSheet( $this->invoiceReport['monthPayments'], $this->invoiceSheet );
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setFilename()
|
private function setFilename()
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by Pensare Software.
|
||||||
|
* User: Theo Weijmer
|
||||||
|
* Date: 30/07/2018
|
||||||
|
* Time: 10:48
|
||||||
|
*/
|
||||||
|
|
||||||
|
class MonthForecastSheet {
|
||||||
|
|
||||||
|
const HEADERS = [
|
||||||
|
'A' => 'project',
|
||||||
|
'B' => 'klant',
|
||||||
|
'C' => 'Nog te factureren incl. btw',
|
||||||
|
'D' => 'januari',
|
||||||
|
'E' => 'februari',
|
||||||
|
'F' => 'maart',
|
||||||
|
'G' => 'april',
|
||||||
|
'H' => 'mei',
|
||||||
|
'I' => 'juni',
|
||||||
|
'J' => 'juli',
|
||||||
|
'K' => 'augustus',
|
||||||
|
'L' => 'september',
|
||||||
|
'M' => 'oktober',
|
||||||
|
'N' => 'november',
|
||||||
|
'O' => 'december',
|
||||||
|
'P' => 'Nog te factureren na lopend boekjaar inc. btw',
|
||||||
|
'Q' => 'Nog te prognotiseren inc. btw'
|
||||||
|
];
|
||||||
|
|
||||||
|
const MONTH_COLUMNS = ['D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O'];
|
||||||
|
|
||||||
|
private $invoiceForecast;
|
||||||
|
private $sheet;
|
||||||
|
private $row;
|
||||||
|
|
||||||
|
public function __construct( $invoiceForecast, $sheet )
|
||||||
|
{
|
||||||
|
$this->invoiceForecast = $invoiceForecast;
|
||||||
|
$this->sheet = $sheet;
|
||||||
|
|
||||||
|
$this->handle();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function handle()
|
||||||
|
{
|
||||||
|
$this->setHeader();
|
||||||
|
|
||||||
|
$this->setBody();
|
||||||
|
|
||||||
|
$this->setTotals();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setHeader()
|
||||||
|
{
|
||||||
|
foreach ( self::HEADERS as $cell => $header )
|
||||||
|
{
|
||||||
|
$this->sheet->setCellValue( $cell . '1', $header );
|
||||||
|
$this->sheet->getColumnDimension( $cell )->setAutoSize( TRUE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setBody()
|
||||||
|
{
|
||||||
|
$this->row = 2;
|
||||||
|
foreach ( $this->invoiceForecast AS $project )
|
||||||
|
{
|
||||||
|
$this->sheet->setCellValue( 'A' . $this->row, $project['projectname'] );
|
||||||
|
$this->sheet->setCellValue( 'B' . $this->row, $project['customer'] );
|
||||||
|
$this->sheet->setCellValue( 'C' . $this->row, str_replace( '.', '', $project['needInvoice'] ) );
|
||||||
|
|
||||||
|
$columnCount = 0;
|
||||||
|
foreach ( $project['forecastMonths'] as $month )
|
||||||
|
{
|
||||||
|
$column = self::MONTH_COLUMNS[ $columnCount ];
|
||||||
|
$forecast = $month['forecastamount'];
|
||||||
|
$this->sheet->setCellValue( $column . $this->row, $forecast );
|
||||||
|
$columnCount ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->sheet->setCellValue( 'P' . $this->row, str_replace( '.', '', $project['forecastOtherYears'] ) );
|
||||||
|
$this->sheet->setCellValue( 'Q' . $this->row, str_replace( '.', '', $project['forecastRemaining'] ) );
|
||||||
|
|
||||||
|
$this->row ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setTotals()
|
||||||
|
{
|
||||||
|
$lastRow = $this->row - 1;
|
||||||
|
$this->sheet->setCellValue( 'C' . $this->row, '=SUM(C2:C' . $lastRow . ')' );
|
||||||
|
$this->sheet->setCellValue( 'D' . $this->row, '=SUM(D2:D' . $lastRow . ')' );
|
||||||
|
foreach ( self::MONTH_COLUMNS as $column )
|
||||||
|
{
|
||||||
|
$this->sheet->setCellValue( $column . $this->row, '=SUM(' . $column . '2:' . $column . $lastRow . ')' );
|
||||||
|
}
|
||||||
|
$this->sheet->setCellValue( 'P' . $this->row, '=SUM(P2:P' . $lastRow . ')' );
|
||||||
|
$this->sheet->setCellValue( 'Q' . $this->row, '=SUM(Q2:Q' . $lastRow . ')' );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by Pensare Software.
|
||||||
|
* User: Theo Weijmer
|
||||||
|
* Date: 30/07/2018
|
||||||
|
* Time: 10:48
|
||||||
|
*/
|
||||||
|
|
||||||
|
class MonthPaymentSheet {
|
||||||
|
|
||||||
|
const HEADERS = [
|
||||||
|
'A' => 'project',
|
||||||
|
'B' => 'klant',
|
||||||
|
'C' => 'januari',
|
||||||
|
'D' => 'februari',
|
||||||
|
'E' => 'maart',
|
||||||
|
'F' => 'april',
|
||||||
|
'G' => 'mei',
|
||||||
|
'H' => 'juni',
|
||||||
|
'I' => 'juli',
|
||||||
|
'J' => 'augustus',
|
||||||
|
'K' => 'september',
|
||||||
|
'L' => 'oktober',
|
||||||
|
'M' => 'november',
|
||||||
|
'N' => 'december',
|
||||||
|
'O' => 'Totaal betaald lopend boekjaar inc. btw'
|
||||||
|
];
|
||||||
|
|
||||||
|
const MONTH_COLUMNS = ['C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N'];
|
||||||
|
|
||||||
|
private $invoiceForecast;
|
||||||
|
private $sheet;
|
||||||
|
private $row;
|
||||||
|
|
||||||
|
public function __construct( $invoiceForecast, $sheet )
|
||||||
|
{
|
||||||
|
$this->invoiceForecast = $invoiceForecast;
|
||||||
|
$this->sheet = $sheet;
|
||||||
|
|
||||||
|
$this->handle();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function handle()
|
||||||
|
{
|
||||||
|
$this->setHeader();
|
||||||
|
|
||||||
|
$this->setBody();
|
||||||
|
|
||||||
|
$this->setTotals();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setHeader()
|
||||||
|
{
|
||||||
|
foreach ( self::HEADERS as $cell => $header )
|
||||||
|
{
|
||||||
|
$this->sheet->setCellValue( $cell . '1', $header );
|
||||||
|
$this->sheet->getColumnDimension( $cell )->setAutoSize( TRUE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setBody()
|
||||||
|
{
|
||||||
|
$this->row = 2;
|
||||||
|
foreach ( $this->invoiceForecast AS $project )
|
||||||
|
{
|
||||||
|
$this->sheet->setCellValue( 'A' . $this->row, $project['projectname'] );
|
||||||
|
$this->sheet->setCellValue( 'B' . $this->row, $project['customer'] );
|
||||||
|
|
||||||
|
$columnCount = 0;
|
||||||
|
foreach ( $project['monthPayments'] as $month )
|
||||||
|
{
|
||||||
|
$column = self::MONTH_COLUMNS[ $columnCount ];
|
||||||
|
$forecast = $month['paymentamount'];
|
||||||
|
$this->sheet->setCellValue( $column . $this->row, $forecast );
|
||||||
|
$columnCount ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$formula = '=SUM(C'.$this->row.':N'.$this->row.')';
|
||||||
|
$this->sheet->setCellValue( 'O' . $this->row, $formula);
|
||||||
|
|
||||||
|
$this->row ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setTotals()
|
||||||
|
{
|
||||||
|
$lastRow = $this->row - 1;
|
||||||
|
foreach ( self::MONTH_COLUMNS as $column )
|
||||||
|
{
|
||||||
|
$this->sheet->setCellValue( $column . $this->row, '=SUM(' . $column . '2:' . $column . $lastRow . ')' );
|
||||||
|
}
|
||||||
|
$this->sheet->setCellValue( 'O' . $this->row, '=SUM(O2:O' . $lastRow . ')' );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
</th>
|
</th>
|
||||||
<!-- /ko -->
|
<!-- /ko -->
|
||||||
<th class="rotate">
|
<th class="rotate">
|
||||||
<div><span>Totaal gefactureerd<br />lopend boekjaar incl. btw</span></div>
|
<div><span>Totaal betaald<br />lopend boekjaar incl. btw</span></div>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|||||||
@@ -204,7 +204,8 @@ dbo.invoicereportInit = function () {
|
|||||||
|
|
||||||
createSpreadsheet:function(){
|
createSpreadsheet:function(){
|
||||||
var vm = dbo.invoicereport;
|
var vm = dbo.invoicereport;
|
||||||
dbo.invoiceDataService.createSpreadsheet(vm.selectedYear());
|
var url = 'index.php/reports/reportsController/createInvoicesSpreadsheet/' + vm.selectedYear();
|
||||||
|
window.open(url, '_blank');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user