Merge branch 'master' into feature/dashboard
# Conflicts: # application/models/eloquent/Projectemployee.php
This commit is contained in:
@@ -60,12 +60,19 @@ class usersController extends MY_Controller {
|
||||
$this->json( $userActiveProjects );
|
||||
}
|
||||
|
||||
public function getUniqueprojectEmployees()
|
||||
{
|
||||
$projectEmployees = User::getUniqueProjectUsers();
|
||||
public function getUniqueprojectEmployees()
|
||||
{
|
||||
$projectEmployees = User::getUniqueProjectUsers();
|
||||
|
||||
$this->json( $projectEmployees );
|
||||
}
|
||||
$this->json( $projectEmployees );
|
||||
}
|
||||
|
||||
public function getUniqueEmployeesWithActivity($archive)
|
||||
{
|
||||
$projectEmployees = Projectemployee::getUniqueEmployeesWithActivity($archive);
|
||||
|
||||
$this->json( $projectEmployees );
|
||||
}
|
||||
|
||||
public function saveUser()
|
||||
{
|
||||
|
||||
@@ -29,7 +29,10 @@ class ReportsController extends MY_Controller {
|
||||
|
||||
public function recapProjects( $archive )
|
||||
{
|
||||
$recapprojects = new Recapprojects( $archive );
|
||||
$field = $this->input->post('field');
|
||||
$direction = $this->input->post('direction');
|
||||
|
||||
$recapprojects = new Recapprojects( $archive, $field, $direction );
|
||||
|
||||
$projects = $recapprojects->getProjects();
|
||||
|
||||
@@ -84,4 +87,4 @@ class ReportsController extends MY_Controller {
|
||||
Project::whereId( $projectID )->update( ['current_financial_year' => $amount] );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ class ReservationsController extends MY_Controller {
|
||||
{
|
||||
$projects[ $result->projectID ] = [
|
||||
'projectnumber' => $result->projectnumber,
|
||||
'projectname' => $result->projectname,
|
||||
'costs' => 0,
|
||||
'reservation' => 0,
|
||||
'payed' => 0,
|
||||
|
||||
@@ -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 ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,9 @@ class InvoiceSpreadsheet {
|
||||
|
||||
$this->setMonthForecast();
|
||||
|
||||
$this->setMonthPayment();
|
||||
$this->setMonthPayment();
|
||||
|
||||
$this->setInvoiced();
|
||||
|
||||
$this->setFilename();
|
||||
|
||||
@@ -86,15 +88,25 @@ class InvoiceSpreadsheet {
|
||||
new MonthForecastSheet( $this->invoiceReport['monthForecasts'], $this->invoiceSheet );
|
||||
}
|
||||
|
||||
private function setMonthPayment()
|
||||
{
|
||||
$invoiceSheet = new Worksheet( $this->spreadsheet, 'maand betalingen' );
|
||||
private function setMonthPayment()
|
||||
{
|
||||
$invoiceSheet = new Worksheet( $this->spreadsheet, 'maand betalingen' );
|
||||
|
||||
$this->invoiceSheet =
|
||||
$this->spreadsheet->addSheet( $invoiceSheet );
|
||||
$this->invoiceSheet =
|
||||
$this->spreadsheet->addSheet( $invoiceSheet );
|
||||
|
||||
new MonthPaymentSheet( $this->invoiceReport['monthPayments'], $this->invoiceSheet );
|
||||
}
|
||||
new MonthPaymentSheet( $this->invoiceReport['monthPayments'], $this->invoiceSheet );
|
||||
}
|
||||
|
||||
private function setInvoiced()
|
||||
{
|
||||
$invoiceSheet = new Worksheet( $this->spreadsheet, 'ontvangen facturen' );
|
||||
|
||||
$this->invoiceSheet =
|
||||
$this->spreadsheet->addSheet( $invoiceSheet );
|
||||
|
||||
new InvoicedSheet( $this->invoiceReport['invoiced'], $this->invoiceSheet );
|
||||
}
|
||||
|
||||
private function setFilename()
|
||||
{
|
||||
@@ -121,4 +133,4 @@ class InvoiceSpreadsheet {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 30/07/2018
|
||||
* Time: 10:48
|
||||
*/
|
||||
|
||||
class InvoicedSheet {
|
||||
|
||||
const HEADERS = [
|
||||
'A' => 'factuurnummer',
|
||||
'B' => 'project',
|
||||
'C' => 'klant',
|
||||
'D' => 'factuurdatum',
|
||||
'E' => 'exc btw',
|
||||
'F' => 'btw',
|
||||
'G' => 'incl btw'
|
||||
];
|
||||
|
||||
private $invoiced;
|
||||
private $sheet;
|
||||
private $row;
|
||||
|
||||
public function __construct( $invoiced, $sheet )
|
||||
{
|
||||
$this->invoiced = $invoiced;
|
||||
$this->sheet = $sheet;
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->setHeader();
|
||||
|
||||
$this->setBody();
|
||||
}
|
||||
|
||||
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->invoiced AS $invoice )
|
||||
{
|
||||
$vat = ROUND($invoice->invoiceamount * 0.21, 2);
|
||||
$this->sheet->setCellValue( 'A' . $this->row, $invoice->invoicenumber );
|
||||
$this->sheet->setCellValue( 'B' . $this->row, ($invoice->projectnumber . ' ' . $invoice['projectname']));
|
||||
$this->sheet->setCellValue( 'C' . $this->row, $invoice->name );
|
||||
$this->sheet->setCellValue( 'D' . $this->row, $invoice->invoicenumber );
|
||||
$this->sheet->setCellValue( 'E' . $this->row, $invoice->invoiceamount );
|
||||
$this->sheet->setCellValue( 'F' . $this->row, $vat );
|
||||
$this->sheet->setCellValue( 'G' . $this->row, $invoice->invoiceamount + $vat );
|
||||
|
||||
$this->row ++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,104 +8,126 @@
|
||||
|
||||
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;
|
||||
private $invoicedYears;
|
||||
private $invoiced;
|
||||
|
||||
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->setInvoicedyears();
|
||||
|
||||
private function loopProjects()
|
||||
{
|
||||
foreach ( $this->projects as $this->project )
|
||||
{
|
||||
$this->setInvoiceOverview();
|
||||
$this->setInvoiced();
|
||||
|
||||
$this->setInvoiceForecasts();
|
||||
$this->setInvoiceReport();
|
||||
}
|
||||
|
||||
$this->setMonthForecasts();
|
||||
private function setProjects()
|
||||
{
|
||||
$this->projects =
|
||||
Project::getProjectsForReport( $this->orderType, $this->orderDirection, $this->archive );
|
||||
}
|
||||
|
||||
$this->setMonthPayments();
|
||||
}
|
||||
}
|
||||
private function loopProjects()
|
||||
{
|
||||
foreach ( $this->projects as $this->project )
|
||||
{
|
||||
$this->setInvoiceOverview();
|
||||
|
||||
private function setInvoiceOverview()
|
||||
{
|
||||
$this->invoiceOverview = new InvoiceOverview( $this->project, $this->year );
|
||||
$this->setInvoiceForecasts();
|
||||
|
||||
$this->invoiceOverviews[] = $this->invoiceOverview->getProjectDetails();
|
||||
}
|
||||
$this->setMonthForecasts();
|
||||
}
|
||||
}
|
||||
|
||||
private function setInvoiceForecasts()
|
||||
{
|
||||
$this->invoiceForecast =
|
||||
new InvoiceForecast( $this->project, $this->invoiceOverview->getNeedinvoice(), $this->year );
|
||||
private function setInvoiceOverview()
|
||||
{
|
||||
$this->invoiceOverview = new InvoiceOverview( $this->project, $this->year );
|
||||
|
||||
$this->invoiceForecasts[] = $this->invoiceForecast->getProjectDetails();
|
||||
}
|
||||
$this->invoiceOverviews[] = $this->invoiceOverview->getProjectDetails();
|
||||
}
|
||||
|
||||
public function setMonthForecasts()
|
||||
{
|
||||
$this->monthForecast =
|
||||
new MonthForecast( $this->invoiceForecast, $this->project, $this->year );
|
||||
private function setInvoiceForecasts()
|
||||
{
|
||||
$this->invoiceForecast =
|
||||
new InvoiceForecast( $this->project, $this->invoiceOverview->getNeedinvoice(), $this->year );
|
||||
|
||||
$this->monthForecasts[] = $this->monthForecast->getProjectDetails();
|
||||
}
|
||||
$this->invoiceForecasts[] = $this->invoiceForecast->getProjectDetails();
|
||||
}
|
||||
|
||||
public function setMonthPayments()
|
||||
{
|
||||
$this->monthPayment =
|
||||
new MonthPayments( $this->project, $this->year );
|
||||
public function setMonthForecasts()
|
||||
{
|
||||
$this->monthForecast =
|
||||
new MonthForecast( $this->invoiceForecast, $this->project, $this->year );
|
||||
|
||||
$this->monthPayments[] = $this->monthPayment->getProjectDetails();
|
||||
}
|
||||
$this->monthForecasts[] = $this->monthForecast->getProjectDetails();
|
||||
}
|
||||
|
||||
private function setInvoiceReport()
|
||||
{
|
||||
$this->invoiceReport = [
|
||||
'invoiceOverview' => $this->invoiceOverviews,
|
||||
'forecasts' => $this->invoiceForecasts,
|
||||
'monthForecasts' => $this->monthForecasts,
|
||||
'monthPayments' => $this->monthPayments
|
||||
];
|
||||
}
|
||||
}
|
||||
public function setMonthPayments()
|
||||
{
|
||||
$monthPayment = new MonthPayments(
|
||||
$this->year, $this->orderType, $this->orderDirection );
|
||||
|
||||
$this->monthPayments = $monthPayment->getProjectDetails();
|
||||
}
|
||||
|
||||
private function setInvoiced()
|
||||
{
|
||||
$this->invoiced = Invoice::getInvoiced( $this->year );
|
||||
}
|
||||
|
||||
private function setInvoicedYears()
|
||||
{
|
||||
$this->invoicedYears = Invoice::selectRaw( 'DATE_FORMAT(invoicedate, "%Y") AS years' )
|
||||
->distinct()
|
||||
->orderBy( 'invoicedate' )
|
||||
->lists( 'years' );
|
||||
}
|
||||
|
||||
private function setInvoiceReport()
|
||||
{
|
||||
$this->invoiceReport = [
|
||||
'invoiceOverview' => $this->invoiceOverviews,
|
||||
'forecasts' => $this->invoiceForecasts,
|
||||
'monthForecasts' => $this->monthForecasts,
|
||||
'monthPayments' => $this->monthPayments,
|
||||
'invoicedYears' => $this->invoicedYears,
|
||||
'invoiced' => $this->invoiced
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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, ',', '.' )
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,4 +62,16 @@ class Invoice extends BaseModel {
|
||||
|
||||
return $invoiceID;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getInvoiced( $year )
|
||||
{
|
||||
$invoiced = Invoice::selectRaw('invoicenumber, PRJ.projectname, projectnumber, CUS.name, invoicedate, CUS.name, invoiceamount')
|
||||
->join('projects AS PRJ', 'PRJ.id', '=', 'invoices.project_id')
|
||||
->join('customers AS CUS', 'CUS.id', '=', 'PRJ.customer_id')
|
||||
->whereRaw("DATE_FORMAT(invoicedate, '%Y') = {$year}")
|
||||
->orderBy('invoicedate')
|
||||
->get();
|
||||
|
||||
return $invoiced;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,17 @@ class Payment extends BaseModel {
|
||||
return $projectPayment->payment;
|
||||
}
|
||||
|
||||
public static function getProjectsWithPayments($year)
|
||||
{
|
||||
$projects = self::selectRaw('INV.project_id')
|
||||
->distinct()
|
||||
->join('invoices AS INV', 'INV.id', '=', 'payments.invoice_id')
|
||||
->whereRaw('DATE_FORMAT(INV.invoicedate, "%Y") = "'. $year.'"')
|
||||
->lists('project_id');
|
||||
|
||||
return $projects->toArray();
|
||||
}
|
||||
|
||||
public static function savePayment( $paymentID, $payment )
|
||||
{
|
||||
$payment = (array) $payment;
|
||||
@@ -50,4 +61,4 @@ class Payment extends BaseModel {
|
||||
Payment::whereId( $paymentID )->delete();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ class Project extends BaseModel {
|
||||
Project::whereId( $projectID )->delete();
|
||||
}
|
||||
|
||||
public static function getActiveProjects( $archive = 'T' )
|
||||
public static function getActiveProjects( $archive = 'T', $sortField = FALSE, $direction = FALSE )
|
||||
{
|
||||
$projects = Project::selectRaw( "projects.id, YEAR(projects.startdate) AS instroom, YEAR(projects.enddate) AS uitstroom, projectnumber, current_financial_year,
|
||||
projectname, CUS.name, OFF.own_revenue, OFF.other_revenue" )
|
||||
@@ -106,6 +106,8 @@ class Project extends BaseModel {
|
||||
->groupBy( 'OFF.own_revenue' )
|
||||
->groupBy( 'OFF.other_revenue' );
|
||||
|
||||
if ( $sortField ) $projects = $projects->orderBy( $sortField, $direction );
|
||||
|
||||
if ( $archive == 'F' ) $projects = $projects->where( 'projects.archive', '=', 'F' );
|
||||
|
||||
$projects = $projects->get();
|
||||
@@ -113,12 +115,14 @@ class Project extends BaseModel {
|
||||
return $projects;
|
||||
}
|
||||
|
||||
public static function getProjectsForReport( $orderType, $orderDirection, $archive = 'F' )
|
||||
public static function getProjectsForReport( $orderType, $orderDirection, $archive = 'F', $projectsArray = FALSE )
|
||||
{
|
||||
$projects = self::getBaseProject();
|
||||
|
||||
if ( $archive == 'F' ) $projects = $projects->whereArchive( 'F' );
|
||||
|
||||
if ( is_array( $projectsArray ) ) $projects = $projects->whereIn( 'id', $projectsArray );
|
||||
|
||||
$projects = $projects->orderBy( $orderType, $orderDirection )->get();
|
||||
|
||||
return $projects;
|
||||
|
||||
@@ -77,4 +77,4 @@ class QEmployeeHours {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class QinvoiceMonthOverview {
|
||||
|
||||
public static function fire( $projectID, $year )
|
||||
{
|
||||
$sql = "SELECT MNT.id,
|
||||
$sql = "SELECT MNT.id,
|
||||
month,
|
||||
COALESCE(forecastamount, 0) AS forecastamount,
|
||||
COALESCE(paymentamount, 0) AS paymentamount
|
||||
@@ -34,10 +34,10 @@ class QinvoiceMonthOverview {
|
||||
) AS PAY
|
||||
ON MNT.id = PAY.month_id
|
||||
LEFT JOIN projects PRJ
|
||||
GROUP BY MNT.id
|
||||
GROUP BY MNT.id
|
||||
ORDER BY MNT.id ";
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,8 @@ class ReservationTotals {
|
||||
public static function fire()
|
||||
{
|
||||
// UNION ALL wordt gebruikt voor een full outer join
|
||||
$sql = " SELECT PRJ.id AS projectID, external_id AS externalID,
|
||||
$sql = "SELECT PRJ.id AS projectID, external_id AS externalID,
|
||||
PRJ.projectname,
|
||||
COALESCE(fromreservation, 0) AS fromreservation,
|
||||
COALESCE(Q5.costs, 0) AS costs, COALESCE(reservation, 0) AS reservation,
|
||||
COALESCE(payed, 0) AS payed, (COALESCE(reservation, 0) - COALESCE(fromreservation, 0)) AS saldo,
|
||||
|
||||
@@ -311,7 +311,7 @@
|
||||
<table class="main" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="alert alert-warning">
|
||||
Nieuw wachtwoord DBOIS De Beleidsonderzoeker
|
||||
Nieuw wachtwoord DBOIS De Beleidsonderzoekers
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -311,7 +311,7 @@
|
||||
<table class="main" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="alert alert-warning">
|
||||
Wachtwoord De Beleidsonderzoeker
|
||||
Wachtwoord De Beleidsonderzoekers
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<link rel="icon" href="css/images/dbo-01-80x80.png" type="image/png">
|
||||
|
||||
<title>** De Beleidsonderzoeker **</title>
|
||||
<title>** De Beleidsonderzoekers **</title>
|
||||
|
||||
<?php $this->load->view( 'partials/_css' ); ?>
|
||||
|
||||
|
||||
@@ -169,11 +169,21 @@
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="10" class="table-cyanish-header"></th>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="3" class="table-cyanish-header"></th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalInvoiceamount())"></span>
|
||||
</th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalInclBtw())"></span>
|
||||
</th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalOutstanding())"></span>
|
||||
</th>
|
||||
<th colspan="2" class="table-cyanish-header"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newInvoice">
|
||||
@@ -184,4 +194,4 @@
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -110,6 +110,20 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="3" class="table-cyanish-header"></th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalCosts())"></span>
|
||||
</th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalPayed())"></span>
|
||||
</th>
|
||||
<th class="table-cyanish-header"></th>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalToPay())"></span>
|
||||
</th>
|
||||
<th class="table-cyanish-header"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newProjectcost">
|
||||
@@ -120,4 +134,4 @@
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
budget gereserveerd (incl. btw)
|
||||
gereserveerd op spaarrekening (incl. btw)
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
@@ -49,6 +49,12 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th class="align-right table-cyanish-header">
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(totalReservationamount())"></span>
|
||||
</th>
|
||||
<th class="table-cyanish-header" colspan="2"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="4">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:addReservation">
|
||||
|
||||
@@ -48,9 +48,12 @@
|
||||
<a class="nav-link"
|
||||
data-bind="css:{'active':invoiceTab() == 'monthforecast'}">maand prognoses</a>
|
||||
</li>
|
||||
<li class="nav-item" data-bind="click:setActivetab.bind($data, 'monthpayments')" style="z-index:10">
|
||||
<a class="nav-link" data-bind="css:{'active':invoiceTab() == 'monthpayments'}">maand betalingen</a>
|
||||
</li>
|
||||
<li class="nav-item" data-bind="click:setActivetab.bind($data, 'monthpayments')" style="z-index:10">
|
||||
<a class="nav-link" data-bind="css:{'active':invoiceTab() == 'monthpayments'}">maand betalingen</a>
|
||||
</li>
|
||||
<li class="nav-item" data-bind="click:setActivetab.bind($data, 'invoices')" style="z-index:10">
|
||||
<a class="nav-link" data-bind="css:{'active':invoiceTab() == 'invoices'}">ontvangen facturen</a>
|
||||
</li>
|
||||
<!-- <li class="nav-item" data-bind="click:setActivetab.bind($data, 'externals')" style="z-index:10">-->
|
||||
<!-- <a class="nav-link" data-bind="css:{'active':invoiceTab() == 'externals'}">onderaannemers</a>-->
|
||||
<!-- </li>-->
|
||||
@@ -65,9 +68,12 @@
|
||||
<div id="invoiceforecast" data-bind="visible:invoiceTab() == 'monthforecast'">
|
||||
<?php $this->load->view('reports/invoices/monthforecast_report'); ?>
|
||||
</div>
|
||||
<div id="invoiceforecast" data-bind="visible:invoiceTab() == 'monthpayments'">
|
||||
<?php $this->load->view('reports/invoices/monthpayment_report'); ?>
|
||||
</div>
|
||||
<div id="invoiceforecast" data-bind="visible:invoiceTab() == 'monthpayments'">
|
||||
<?php $this->load->view('reports/invoices/monthpayment_report'); ?>
|
||||
</div>
|
||||
<div id="invoiceforecast" data-bind="visible:invoiceTab() == 'invoices'">
|
||||
<?php $this->load->view('reports/invoices/invoices_report'); ?>
|
||||
</div>
|
||||
<!-- <div id="invoiceforecast" data-bind="visible:invoiceTab() == 'externals'">-->
|
||||
<!-- --><?php //$this->load->view('reports/invoices/contractors_report'); ?>
|
||||
<!-- </div>-->
|
||||
@@ -76,4 +82,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
</div>
|
||||
|
||||
<footer class="page-copyright page-copyright-inverse">
|
||||
<p>© 2018. De Beleidsonderzoeker.</p>
|
||||
<p>© 2018. De Beleidsonderzoekers</p>
|
||||
<!-- <p style="font-size:.8em">powered by: Pensare Software</p>-->
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
@@ -7,16 +7,16 @@
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="3%"> </th>
|
||||
<th width="17%">project</th>
|
||||
<th width="10%" class="align-right">Kosten derden</th>
|
||||
<th width="10%" class="align-right">factuur INK</th>
|
||||
<th width="10%" class="align-right">budget gereserveerd</th>
|
||||
<th width="10%" class="align-right">betaald</th>
|
||||
<th width="10%" class="align-right">saldo te<br />betalen</th>
|
||||
<th width="10%" class="align-right">betaald via<br />reserveringen</th>
|
||||
<th width="10%" class="align-right">saldo reservering</th>
|
||||
<th width="10%" class="align-right">saldo facturen INK</th>
|
||||
<th width="2%"> </th>
|
||||
<th width="34%">project</th>
|
||||
<th width="8%" class="align-right">Kosten derden</th>
|
||||
<th width="8%" class="align-right">factuur INK</th>
|
||||
<th width="8%" class="align-right">gereserveerd op<br/>spaarrekening</th>
|
||||
<th width="8%" class="align-right">betaald</th>
|
||||
<th width="8%" class="align-right">nog te betalen<br />facturen</th>
|
||||
<th width="8%" class="align-right">betaald via<br />reserveringen</th>
|
||||
<th width="8%" class="align-right">saldo reservering</th>
|
||||
<th width="8%" class="align-right">saldo facturen INK</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<!-- ko foreach:projects -->
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<table class="table table-striped table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
factuurnummer
|
||||
</th>
|
||||
<th>
|
||||
project
|
||||
</th>
|
||||
<th>
|
||||
klant
|
||||
</th>
|
||||
<th>
|
||||
factuur datum
|
||||
</th>
|
||||
<th>
|
||||
excl btw
|
||||
</th>
|
||||
<th>
|
||||
btw
|
||||
</th>
|
||||
<th>
|
||||
incl btw
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:invoiced">
|
||||
<tr>
|
||||
<td>
|
||||
<span data-bind="text:invoicenumber"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:project"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:name"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:invoicedate"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:invoiceamount"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:vat"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:inclVat"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,17 +1,23 @@
|
||||
<table class="table" style="font-size:.8em;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="rotate">
|
||||
<div><span>projectnummer</span></div>
|
||||
<th class="rotate sorting-field">
|
||||
<div data-bind="click:setSorting.bind($data, 'projectnumber')">
|
||||
<span>projectnummer</span>
|
||||
</div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>instroom</span></div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>naam</span></div>
|
||||
<th class="rotate sorting-field">
|
||||
<div data-bind="click:setSorting.bind($data, 'projectname')">
|
||||
<span>naam</span>
|
||||
</div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>opdrachtgever</span></div>
|
||||
<th class="rotate sorting-field">
|
||||
<div data-bind="click:setSorting.bind($data, 'CUS.name')">
|
||||
<span>opdrachtgever</span>
|
||||
</div>
|
||||
</th>
|
||||
<!-- ko foreach: uniqueEmployees -->
|
||||
<th class="rotate">
|
||||
@@ -43,6 +49,32 @@
|
||||
<div><span>Volgende boekjaren</span></div>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="align-right" colspan="4">totaal</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalRevenue"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalOwnRevenue"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeRevenues"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalAvailableRevenues"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalOwp"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalCurrentFinancialYear"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalNextFinancialYear"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:recap">
|
||||
<tr>
|
||||
@@ -79,32 +111,6 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th class="align-right" colspan="4">totaal</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalRevenue"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalOwnRevenue"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeRevenues"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalAvailableRevenues"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalOwp"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalCurrentFinancialYear"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalNextFinancialYear"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="rotate">
|
||||
<div><span>projectnummer</span></div>
|
||||
<div data-bind="click:setSorting.bind($data, 'projectnumber')">
|
||||
<span>projectnummer</span>
|
||||
</div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>instroom</span></div>
|
||||
@@ -11,10 +13,14 @@
|
||||
<div><span>uitstroom</span></div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>naam</span></div>
|
||||
<div data-bind="click:setSorting.bind($data, 'projectname')">
|
||||
<span>naam</span>
|
||||
</div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>opdrachtgever</span></div>
|
||||
<div data-bind="click:setSorting.bind($data, 'CUS.name')">
|
||||
<span>opdrachtgever</span>
|
||||
</div>
|
||||
</th>
|
||||
<!-- ko foreach: uniqueEmployees -->
|
||||
<th class="rotate">
|
||||
@@ -33,6 +39,25 @@
|
||||
<div><span>totaal beschikbare uren</span></div>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="align-right" colspan="5">totaal</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalHours"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeHours"></span>
|
||||
</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalAvailableHours"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeAvailableHours"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:recap">
|
||||
<tr>
|
||||
@@ -60,24 +85,5 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th class="align-right" colspan="5">totaal</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalHours"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeHours"></span>
|
||||
</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalAvailableHours"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeAvailableHours"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user