Files
dbois/application/libraries/reports/invoice/Invoices.php
T
2018-07-29 21:26:49 +02:00

104 lines
2.4 KiB
PHP

<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 29/07/2018
* Time: 10:19
*/
class Invoices {
private $year;
private $project;
private $projects;
private $monthPayment;
private $monthPayments;
private $monthForecast;
private $monthForecasts;
private $invoiceOverview;
private $invoiceForecast;
private $invoiceForecasts;
private $invoiceOverviews = [];
private $invoiceReport = [];
public function __construct( $year )
{
$this->year = $year;
$this->handle();
}
public function getInvoiceReport()
{
return $this->invoiceReport;
}
private function handle()
{
$this->setProjects();
$this->loopProjects();
$this->setInvoiceReport();
}
private function setProjects()
{
$this->projects = Project::getProjectsForReport();
}
private function loopProjects()
{
foreach ( $this->projects as $this->project )
{
$this->setInvoiceOverview();
$this->setInvoiceForecasts();
$this->setMonthForecasts();
$this->setMonthPayments();
}
}
private function setInvoiceOverview()
{
$this->invoiceOverview = new InvoiceOverview( $this->project, $this->year );
$this->invoiceOverviews[] = $this->invoiceOverview->getProjectDetails();
}
private function setInvoiceForecasts()
{
$this->invoiceForecast =
new InvoiceForecast( $this->project, $this->invoiceOverview->getNeedinvoice(), $this->year );
$this->invoiceForecasts[] = $this->invoiceForecast->getProjectDetails();
}
public function setMonthForecasts()
{
$this->monthForecast =
new MonthForecast( $this->invoiceForecast, $this->project, $this->year );
$this->monthForecasts[] = $this->monthForecast->getProjectDetails();
}
public function setMonthPayments()
{
$this->monthPayment =
new MonthPayments( $this->project, $this->year );
$this->monthPayments[] = $this->monthPayment->getProjectDetails();
}
private function setInvoiceReport()
{
$this->invoiceReport = [
'invoiceOverview' => $this->invoiceOverviews,
'forecasts' => $this->invoiceForecasts,
'monthForecasts' => $this->monthForecasts,
'monthPayments' => $this->monthPayments
];
}
}