Diverse wijzigingen nav word document

This commit is contained in:
2019-10-25 16:47:46 +02:00
parent 6f21ab10de
commit d0069061ba
24 changed files with 2203 additions and 2028 deletions
@@ -10,9 +10,11 @@ class Recapprojects {
private $ci;
private $index;
private $field;
private $archive;
private $project;
private $projects;
private $direction;
private $employeeHours;
private $invoicedYears = [];
private $projectTotals;
@@ -23,11 +25,13 @@ class Recapprojects {
private $projectEmployeeDetail;
private $projectEmployeeDetails;
public function __construct( $archive )
public function __construct( $archive, $field, $direction )
{
$this->ci =& get_instance();
$this->archive = $archive;
$this->field = $field;
$this->direction = $direction;
$this->ci->load->Model( 'projects/Invoices_model' );
@@ -54,12 +58,14 @@ class Recapprojects {
private function setProjects()
{
$this->projects = Project::getActiveProjects( $this->archive )->toArray();
$this->projects = Project::getActiveProjects(
$this->archive, $this->field, $this->direction )->toArray();
}
private function setUniqueEmployees()
{
$this->uniqueEmployees = Projectemployee::getUniqueProjectEmployees();
$this->uniqueEmployees =
Projectemployee::getUniqueEmployeesWithActivity();
}
private function loopProjects()
@@ -272,4 +278,4 @@ class Recapprojects {
$this->index ++;
}
}
}
}
@@ -8,104 +8,105 @@
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 = [];
private $orderType;
private $orderDirection;
private $archive;
private $year;
private $project;
private $projects;
private $monthPayment;
private $monthPayments;
private $monthForecast;
private $monthForecasts;
private $invoiceOverview;
private $invoiceForecast;
private $invoiceForecasts;
private $invoiceOverviews = [];
private $invoiceReport = [];
private $orderType;
private $orderDirection;
private $archive;
public function __construct( $year, $orderType, $orderDirection, $archive )
{
$this->year = $year;
$this->orderType = $orderType;
$this->orderDirection = $orderDirection;
$this->archive = $archive;
public function __construct( $year, $orderType, $orderDirection, $archive )
{
$this->year = $year;
$this->orderType = $orderType;
$this->orderDirection = $orderDirection;
$this->archive = $archive;
$this->handle();
}
$this->handle();
}
public function getInvoiceReport()
{
return $this->invoiceReport;
}
public function getInvoiceReport()
{
return $this->invoiceReport;
}
private function handle()
{
$this->setProjects();
private function handle()
{
$this->setProjects();
$this->loopProjects();
$this->loopProjects();
$this->setInvoiceReport();
}
//only projects with payments also archived projects
$this->setMonthPayments();
private function setProjects()
{
$this->projects =
Project::getProjectsForReport( $this->orderType, $this->orderDirection, $this->archive );
}
$this->setInvoiceReport();
}
private function loopProjects()
{
foreach ( $this->projects as $this->project )
{
$this->setInvoiceOverview();
private function setProjects()
{
$this->projects =
Project::getProjectsForReport( $this->orderType, $this->orderDirection, $this->archive );
}
$this->setInvoiceForecasts();
private function loopProjects()
{
foreach ( $this->projects as $this->project )
{
$this->setInvoiceOverview();
$this->setMonthForecasts();
$this->setInvoiceForecasts();
$this->setMonthPayments();
}
}
$this->setMonthForecasts();
}
}
private function setInvoiceOverview()
{
$this->invoiceOverview = new InvoiceOverview( $this->project, $this->year );
private function setInvoiceOverview()
{
$this->invoiceOverview = new InvoiceOverview( $this->project, $this->year );
$this->invoiceOverviews[] = $this->invoiceOverview->getProjectDetails();
}
$this->invoiceOverviews[] = $this->invoiceOverview->getProjectDetails();
}
private function setInvoiceForecasts()
{
$this->invoiceForecast =
new InvoiceForecast( $this->project, $this->invoiceOverview->getNeedinvoice(), $this->year );
private function setInvoiceForecasts()
{
$this->invoiceForecast =
new InvoiceForecast( $this->project, $this->invoiceOverview->getNeedinvoice(), $this->year );
$this->invoiceForecasts[] = $this->invoiceForecast->getProjectDetails();
}
$this->invoiceForecasts[] = $this->invoiceForecast->getProjectDetails();
}
public function setMonthForecasts()
{
$this->monthForecast =
new MonthForecast( $this->invoiceForecast, $this->project, $this->year );
public function setMonthForecasts()
{
$this->monthForecast =
new MonthForecast( $this->invoiceForecast, $this->project, $this->year );
$this->monthForecasts[] = $this->monthForecast->getProjectDetails();
}
$this->monthForecasts[] = $this->monthForecast->getProjectDetails();
}
public function setMonthPayments()
{
$this->monthPayment =
new MonthPayments( $this->project, $this->year );
public function setMonthPayments()
{
$monthPayment = new MonthPayments(
$this->year, $this->orderType, $this->orderDirection );
$this->monthPayments[] = $this->monthPayment->getProjectDetails();
}
$this->monthPayments = $monthPayment->getProjectDetails();
}
private function setInvoiceReport()
{
$this->invoiceReport = [
'invoiceOverview' => $this->invoiceOverviews,
'forecasts' => $this->invoiceForecasts,
'monthForecasts' => $this->monthForecasts,
'monthPayments' => $this->monthPayments
];
}
}
private function setInvoiceReport()
{
$this->invoiceReport = [
'invoiceOverview' => $this->invoiceOverviews,
'forecasts' => $this->invoiceForecasts,
'monthForecasts' => $this->monthForecasts,
'monthPayments' => $this->monthPayments
];
}
}
@@ -8,96 +8,119 @@
class MonthPayments {
private $year;
private $project;
private $payment;
private $customer;
private $projectname;
private $monthPayments;
private $projectDetails;
private $totalProjectPayments;
private $year;
private $project;
private $payment;
private $customer;
private $projectname;
private $monthPayments;
private $projectDetails;
private $projectsWithPayments;
private $totalProjectPayments;
private $orderType;
private $orderDirection;
public function __construct( $project, $year )
{
$this->project = $project;
$this->year = $year;
public function __construct( $year, $orderType, $orderDirection )
{
$this->year = $year;
$this->orderType = $orderType;
$this->orderDirection = $orderDirection;
$this->handle();
}
$this->handle();
}
public function getProjectDetails()
{
return $this->projectDetails;
}
public function getProjectDetails()
{
return $this->projectDetails;
}
private function handle()
{
$this->setProjectname();
private function handle()
{
$this->setProjectsWithPayments();
$this->setCustomer();
$this->loopProjectsWithPayments();
}
$this->setInitialsMonthPayments();
private function setProjectsWithPayments()
{
$projectsArray = Payment::getProjectsWithPayments( $this->year );
$this->loopPayments();
$this->projectsWithPayments =
Project::getProjectsForReport(
$this->orderType, $this->orderDirection, FALSE, $projectsArray );
}
$this->setProjectDetails();
}
private function loopProjectsWithPayments()
{
foreach ( $this->projectsWithPayments as $this->project )
{
$this->setProjectname();
private function setProjectname()
{
$this->projectname = $this->project->projectname . '(' . $this->project->projectnumber . ')';
}
$this->setCustomer();
private function setCustomer()
{
$this->customer = $this->project->customer->name;
}
$this->setInitialsMonthPayments();
private function setInitialsMonthPayments()
{
for ( $i = 1; $i <= 12; $i ++ )
{
$this->monthPayments[ $i ] = ['paymentamount' => 0];
}
}
$this->loopPayments();
private function loopPayments()
{
foreach ( $this->project->invoices as $invoice )
{
foreach($invoice->payments as $this->payment)
{
$this->setMonthPayments();
$this->setProjectDetails();
}
}
$this->setTotalProjectPayments();
}
}
}
private function setProjectname()
{
$this->projectname = $this->project->projectname . '(' . $this->project->projectnumber . ')';
}
private function setMonthPayments()
{
$paymentYear = date( 'Y', strtotime( $this->payment->paymentdate ) );
$paymentMonth = date( 'n', strtotime( $this->payment->paymentdate ) );
private function setCustomer()
{
$this->customer = $this->project->customer->name;
}
if ( $paymentYear == $this->year )
$this->monthPayments[ $paymentMonth ]['paymentamount'] += $this->payment->paymentamount;
}
private function setInitialsMonthPayments()
{
for ( $i = 1; $i <= 12; $i ++ )
{
$this->monthPayments[ $i ] = ['paymentamount' => 0];
}
}
private function setTotalProjectPayments()
{
$paymentYear = date( 'Y', strtotime( $this->payment->paymentdate ) );
private function loopPayments()
{
foreach ( $this->project->invoices as $invoice )
{
foreach ( $invoice->payments as $this->payment )
{
$this->setMonthPayments();
if ( $paymentYear == $this->year )
$this->totalProjectPayments += $this->payment->paymentamount;
}
$this->setTotalProjectPayments();
}
}
}
private function setProjectDetails()
{
$this->projectDetails = [
'projectname' => $this->projectname,
'customer' => $this->customer,
'monthPayments' => $this->monthPayments,
'totalProjectPayments' => number_format( $this->totalProjectPayments, 0, ',', '.' )
];
}
}
private function setMonthPayments()
{
$paymentYear = date( 'Y', strtotime( $this->payment->paymentdate ) );
$paymentMonth = date( 'n', strtotime( $this->payment->paymentdate ) );
if ( $paymentYear == $this->year )
$this->monthPayments[ $paymentMonth ]['paymentamount'] += $this->payment->paymentamount;
}
private function setTotalProjectPayments()
{
$paymentYear = date( 'Y', strtotime( $this->payment->paymentdate ) );
if ( $paymentYear == $this->year )
$this->totalProjectPayments += $this->payment->paymentamount;
}
private function setProjectDetails()
{
$this->projectDetails[] = [
'projectname' => $this->projectname,
'customer' => $this->customer,
'monthPayments' => $this->monthPayments,
'totalProjectPayments' => number_format( $this->totalProjectPayments, 0, ',', '.' )
];
}
}