From b86c3fc4b90b70ebc1adad127ae4c995d8c36ae6 Mon Sep 17 00:00:00 2001 From: Theo Weijmer Date: Sun, 29 Jul 2018 21:26:49 +0200 Subject: [PATCH] Spreadsheet --- .../controllers/reports/ReportsController.php | 24 +- .../reports/invoice/Excel/InvoiceSheet.php | 80 +++++++ .../invoice/Excel/InvoiceSpreadsheet.php | 88 +++++++ .../reports/invoice/InvoiceForecast.php | 124 ++++++++++ .../reports/invoice/InvoiceOverview.php | 129 ++++++++++ .../libraries/reports/invoice/Invoices.php | 104 +++++++++ .../reports/invoice/MonthForecast.php | 91 ++++++++ .../reports/invoice/MonthPayments.php | 100 ++++++++ application/models/eloquent/Invoice.php | 22 ++ application/models/eloquent/Project.php | 8 + .../views/pages/invoicereport_view.php | 61 +++++ .../views/pages/outgoinginvoices_view.php | 37 --- application/views/partials/_js.php | 2 +- .../views/reports/invoices/_invoicetable.php | 218 ----------------- .../reports/invoices/contractors_report.php | 7 + .../invoices/invoiceforecast_report.php | 55 +++++ .../invoices/invoiceoverview_report.php | 69 ++++++ .../reports/invoices/monthforecast_report.php | 61 +++++ .../reports/invoices/monthpayment_report.php | 47 ++++ composer.json | 3 +- public/css/main.css | 2 +- public/hello world.xlsx | Bin 0 -> 8255 bytes .../js/lib/dataservices/invoiceDataService.js | 4 + public/js/lib/modules/menuModule.js | 2 + .../js/lib/modules/reports/invoicereport.js | 220 ++++++++++++++++++ .../lib/modules/reports/outgoingInvoices.js | 160 ------------- 26 files changed, 1286 insertions(+), 432 deletions(-) create mode 100644 application/libraries/reports/invoice/Excel/InvoiceSheet.php create mode 100644 application/libraries/reports/invoice/Excel/InvoiceSpreadsheet.php create mode 100644 application/libraries/reports/invoice/InvoiceForecast.php create mode 100644 application/libraries/reports/invoice/InvoiceOverview.php create mode 100644 application/libraries/reports/invoice/Invoices.php create mode 100644 application/libraries/reports/invoice/MonthForecast.php create mode 100644 application/libraries/reports/invoice/MonthPayments.php create mode 100644 application/views/pages/invoicereport_view.php delete mode 100644 application/views/pages/outgoinginvoices_view.php delete mode 100644 application/views/reports/invoices/_invoicetable.php create mode 100644 application/views/reports/invoices/contractors_report.php create mode 100644 application/views/reports/invoices/invoiceforecast_report.php create mode 100644 application/views/reports/invoices/invoiceoverview_report.php create mode 100644 application/views/reports/invoices/monthforecast_report.php create mode 100644 application/views/reports/invoices/monthpayment_report.php create mode 100644 public/hello world.xlsx create mode 100644 public/js/lib/modules/reports/invoicereport.js delete mode 100644 public/js/lib/modules/reports/outgoingInvoices.js diff --git a/application/controllers/reports/ReportsController.php b/application/controllers/reports/ReportsController.php index efece4a..925ca3a 100644 --- a/application/controllers/reports/ReportsController.php +++ b/application/controllers/reports/ReportsController.php @@ -59,26 +59,22 @@ class ReportsController extends MY_Controller { $this->json( $result ); } - public function getInvoiceOverview( $year ) + public function getInvoiceOverview( $year = FALSE ) { - $sql = Qinvoiceoverview::fire( $year ); + $invoices = new Invoices( $year ); - $query = $this->db->query( $sql ); + $invoiceReport = $invoices->getInvoiceReport(); - $result = $query->result(); + $this->json( $invoiceReport ); + } - foreach ( $result as $project ) - { - $sql = QinvoiceMonthOverview::fire( $project->id, $year ); + public function createInvoicesSpreadsheet( $year = FALSE ) + { + $invoices = new Invoices( $year ); - $query = $this->db->query( $sql ); + $invoiceReport = $invoices->getInvoiceReport(); - $months = $query->result(); - - $project->months = $months; - } - - $this->json( $result ); + new InvoiceSpreadsheet($invoiceReport); } public function saveCurrentFinnacialYear( $projectID ) diff --git a/application/libraries/reports/invoice/Excel/InvoiceSheet.php b/application/libraries/reports/invoice/Excel/InvoiceSheet.php new file mode 100644 index 0000000..6aed139 --- /dev/null +++ b/application/libraries/reports/invoice/Excel/InvoiceSheet.php @@ -0,0 +1,80 @@ + 'project', + 'B' => 'klant', + 'C' => 'Totaal te factureren excl. btw', + 'D' => 'Totaal te factureren incl. btw', + 'E' => 'Gefactureerd overige jaren incl. btw', + 'F' => 'Gefactureerd lopende boekjaar incl. btw', + 'G' => 'Gefactureerd totaal incl. btw', + 'H' => 'Nog te factureren incl. btw' + ]; + + private $invoiceOverview; + private $sheet; + private $row; + + public function __construct( $invoiceOverview, $sheet ) + { + $this->invoiceOverview = $invoiceOverview; + $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->invoiceOverview 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['totalToInvoicingExcl'] ) ); + $this->sheet->setCellValue( 'D' . $this->row, str_replace( '.', '', $project['totalToInvoicingIncl'] ) ); + $this->sheet->setCellValue( 'E' . $this->row, str_replace( '.', '', $project['totalInvoicedOtherYears'] ) ); + $this->sheet->setCellValue( 'F' . $this->row, str_replace( '.', '', $project['totalInvoicedThisYear'] ) ); + $this->sheet->setCellValue( 'G' . $this->row, str_replace( '.', '', $project['invoicesTotal'] ) ); + $this->sheet->setCellValue( 'H' . $this->row, str_replace( '.', '', $project['needInvoice'] ) ); + + $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 . ')' ); + $this->sheet->setCellValue( 'G' . $this->row, '=SUM(G2:G' . $lastRow . ')' ); + $this->sheet->setCellValue( 'H' . $this->row, '=SUM(H2:H' . $lastRow . ')' ); + } +} \ No newline at end of file diff --git a/application/libraries/reports/invoice/Excel/InvoiceSpreadsheet.php b/application/libraries/reports/invoice/Excel/InvoiceSpreadsheet.php new file mode 100644 index 0000000..bb73646 --- /dev/null +++ b/application/libraries/reports/invoice/Excel/InvoiceSpreadsheet.php @@ -0,0 +1,88 @@ +ci =& get_instance(); + + $this->invoiceReport = $invoiceReport; + + $this->ci->load->helper( 'download' ); + + $this->handle(); + } + + private function handle() + { + $this->setSpreadsheet(); + + $this->setInvoiceSheet(); + + $this->setFilename(); + + $this->setFullPathname(); + + $this->createFile(); + + $this->downloadSpreadsheet(); + } + + private function setSpreadsheet() + { + $this->spreadsheet = new Spreadsheet(); + } + + private function setInvoiceSheet() + { + $invoiceSheet = new Worksheet( $this->spreadsheet, 'Facturen' ); + + $this->invoiceSheet = + $this->spreadsheet->addSheet( $invoiceSheet ); + + new InvoiceSheet( $this->invoiceReport['invoiceOverview'], $this->invoiceSheet ); + } + + private function setFilename() + { + $this->filename = 'facturen' . date( 'YmdHis' ) . '.xlsx'; + } + + private function setFullPathname() + { + $this->fullpathname = MYROOTPATH . 'documents/spreadsheets/' . $this->filename; + } + + private function createFile() + { + $writer = new Xlsx( $this->spreadsheet ); + + $writer->save( $this->fullpathname ); + } + + private function downloadSpreadsheet() + { + $data = file_get_contents( $this->fullpathname ); + + force_download( $this->filename, $data ); + } + + +} \ No newline at end of file diff --git a/application/libraries/reports/invoice/InvoiceForecast.php b/application/libraries/reports/invoice/InvoiceForecast.php new file mode 100644 index 0000000..89ad696 --- /dev/null +++ b/application/libraries/reports/invoice/InvoiceForecast.php @@ -0,0 +1,124 @@ +project = $project; + $this->needInvoice = $needInvoice; + $this->year = $year; + + $this->handle(); + } + + public function getProjectDetails() + { + return $this->projectDetails; + } + + public function getNeedInvoice() + { + return $this->needInvoice; + } + + public function getForecastOtherYear() + { + return $this->forecastOtherYears; + } + + public function getForecastRemaining() + { + return $this->forecastRemaining; + } + + private function handle() + { + $this->setCurrentyear(); + + $this->setProjectname(); + + $this->setCustomer(); + + $this->loopForecasts(); + + $this->setForecastRemaining(); + + $this->setProjectDetails(); + } + + private function setCurrentyear() + { + $this->currentYear = date( 'Y' ); + } + + private function setProjectname() + { + $this->projectname = $this->project->projectname . '(' . $this->project->projectnumber . ')'; + } + + private function setCustomer() + { + $this->customer = $this->project->customer->name; + } + + private function loopForecasts() + { + if ( is_null( $this->project->forecasts ) ) return $this->forecastThisYear = 0; + + foreach ( $this->project->forecasts as $this->forecast ) + { + $this->setForecastThisYear(); + + $this->setForecastOtherYears(); + } + } + + private function setForecastThisYear() + { + if ( $this->forecast->year == $this->year ) + $this->forecastThisYear += $this->forecast->forecastamount; + } + + private function setForecastOtherYears() + { + if ( $this->forecast->year != $this->year ) + $this->forecastOtherYears += $this->forecast->forecastamount; + } + + private function setForecastRemaining() + { + $this->forecastRemaining = + $this->needInvoice - $this->forecastThisYear - $this->forecastOtherYears; + } + + private function setProjectDetails() + { + $this->projectDetails = [ + 'projectname' => $this->projectname, + 'customer' => $this->customer, + 'needInvoice' => number_format( $this->needInvoice, 0, ',', '.' ), + 'forecastThisYear' => number_format( $this->forecastThisYear, 0, ',', '.' ), + 'forecastOtherYears' => number_format( $this->forecastOtherYears, 0, ',', '.' ), + 'forecastRemaining' => number_format( $this->forecastRemaining, 0, ',', '.' ), + ]; + } + +} \ No newline at end of file diff --git a/application/libraries/reports/invoice/InvoiceOverview.php b/application/libraries/reports/invoice/InvoiceOverview.php new file mode 100644 index 0000000..b0f1397 --- /dev/null +++ b/application/libraries/reports/invoice/InvoiceOverview.php @@ -0,0 +1,129 @@ +project = $project; + + $this->handle(); + } + + public function getProjectDetails() + { + return $this->projectDetails; + } + + public function getNeedinvoice( ) + { + return $this->needInvoice; + } + + private function handle() + { + $this->setCurrentyear(); + + $this->setProjectname(); + + $this->setCustomer(); + + $this->setTotalToInvoicingExcl(); + + $this->setTotalToInvoicingIncl(); + + $this->setTotalInvoicedOtherYears(); + + $this->setTotalInvoicedThisYear(); + + $this->setInvoicesTotal(); + + $this->setNeedInvoice(); + + $this->setProjectDetails(); + } + + private function setCurrentyear() + { + $this->currentYear = date( 'Y' ); + } + + private function setProjectname() + { + $this->projectname = $this->project->projectname . '(' . $this->project->projectnumber . ')'; + } + + private function setCustomer() + { + $this->customer = $this->project->customer->name; + } + + private function setTotalToInvoicingExcl() + { + $offer = $this->project->offer; + + $this->totalToInvoicingExcl = + $offer->own_revenue + $offer->other_revenue + $offer->costs; + } + + private function setTotalToInvoicingIncl() + { + $this->totalToInvoicingIncl = + $this->totalToInvoicingExcl * ( 1 + ( $this->project->vat->vatrate / 100 ) ); + } + + private function setTotalInvoicedOtherYears() + { + $this->totalInvoicedOtherYears = + Invoice::invoicePerYear( $this->project->id, $this->currentYear, FALSE ); + } + + private function setTotalInvoicedThisYear() + { + $this->totalInvoicedThisYear = + Invoice::invoicePerYear( $this->project->id, $this->currentYear, TRUE ); + } + + private function setInvoicesTotal() + { + $this->invoicesTotal = + $this->totalInvoicedOtherYears + $this->totalInvoicedThisYear; + } + + private function setNeedInvoice() + { + $this->needInvoice = + $this->totalToInvoicingIncl - $this->invoicesTotal; + } + + private function setProjectDetails() + { + $this->projectDetails = [ + 'projectname' => $this->projectname, + 'customer' => $this->customer, + 'totalToInvoicingExcl' => number_format( $this->totalToInvoicingExcl, 0, ',', '.' ), + 'totalToInvoicingIncl' => number_format( $this->totalToInvoicingIncl, 0, ',', '.' ), + 'totalInvoicedOtherYears' => number_format( $this->totalInvoicedOtherYears, 0, ',', '.' ), + 'totalInvoicedThisYear' => number_format( $this->totalInvoicedThisYear, 0, ',', '.' ), + 'invoicesTotal' => number_format( $this->invoicesTotal, 0, ',', '.' ), + 'needInvoice' => number_format( $this->needInvoice, 0, ',', '.' ) + ]; + } +} \ No newline at end of file diff --git a/application/libraries/reports/invoice/Invoices.php b/application/libraries/reports/invoice/Invoices.php new file mode 100644 index 0000000..dcbc909 --- /dev/null +++ b/application/libraries/reports/invoice/Invoices.php @@ -0,0 +1,104 @@ +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 + ]; + } +} \ No newline at end of file diff --git a/application/libraries/reports/invoice/MonthForecast.php b/application/libraries/reports/invoice/MonthForecast.php new file mode 100644 index 0000000..8fa6f8c --- /dev/null +++ b/application/libraries/reports/invoice/MonthForecast.php @@ -0,0 +1,91 @@ +project = $project; + $this->invoiceForecast = $invoiceForecast; + $this->year = $year; + + $this->handle(); + } + + public function getProjectDetails() + { + return $this->projectDetails; + } + + private function handle() + { + $this->setProjectname(); + + $this->setCustomer(); + + $this->setInitialsForecastMonths(); + + $this->loopForecasts(); + + $this->setProjectDetails(); + } + + private function setProjectname() + { + $this->projectname = $this->project->projectname . '(' . $this->project->projectnumber . ')'; + } + + private function setCustomer() + { + $this->customer = $this->project->customer->name; + } + + private function setInitialsForecastMonths() + { + for ( $i = 1; $i <= 12; $i ++ ) + { + $this->forecastMonths[ $i ] = ['forecastamount' => 0]; + } + } + + private function loopForecasts() + { + foreach ( $this->project->forecasts as $this->forecast ) + { + $this->setMonthForecast(); + } + } + + private function setMonthForecast() + { + if ( $this->forecast->year == $this->year ) + $this->forecastMonths[ $this->forecast->month_id ]['forecastamount'] += $this->forecast->forecastamount; + } + + private function setProjectDetails() + { + $this->projectDetails = [ + 'projectname' => $this->projectname, + 'customer' => $this->customer, + 'needInvoice' => number_format( $this->invoiceForecast->getNeedInvoice(), 0, ',', '.' ), + 'forecastOtherYears' => number_format( $this->invoiceForecast->getForecastOtherYear(), 0, ',', '.' ), + 'forecastRemaining' => number_format( $this->invoiceForecast->getForecastRemaining(), 0, ',', '.' ), + 'forecastMonths' => $this->forecastMonths + ]; + } + +} \ No newline at end of file diff --git a/application/libraries/reports/invoice/MonthPayments.php b/application/libraries/reports/invoice/MonthPayments.php new file mode 100644 index 0000000..023e25f --- /dev/null +++ b/application/libraries/reports/invoice/MonthPayments.php @@ -0,0 +1,100 @@ +project = $project; + $this->year = $year; + + $this->handle(); + } + + public function getProjectDetails() + { + return $this->projectDetails; + } + + private function handle() + { + $this->setProjectname(); + + $this->setCustomer(); + + $this->setInitialsMonthPayments(); + + $this->loopPayments(); + + $this->setProjectDetails(); + } + + private function setProjectname() + { + $this->projectname = $this->project->projectname . '(' . $this->project->projectnumber . ')'; + } + + private function setCustomer() + { + $this->customer = $this->project->customer->name; + } + + private function setInitialsMonthPayments() + { + for ( $i = 1; $i <= 12; $i ++ ) + { + $this->monthPayments[ $i ] = ['paymentamount' => 0]; + } + } + + private function loopPayments() + { + foreach ( $this->project->invoices as $invoice ) + { + foreach($invoice->payments as $this->payment) + { + $this->setMonthPayments(); + + $this->setTotalProjectPayments(); + } + } + } + + 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() + { + $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, ',', '.' ) + ]; + } +} \ No newline at end of file diff --git a/application/models/eloquent/Invoice.php b/application/models/eloquent/Invoice.php index dbcf462..6430b1e 100644 --- a/application/models/eloquent/Invoice.php +++ b/application/models/eloquent/Invoice.php @@ -24,6 +24,28 @@ class Invoice extends BaseModel { return $this->belongsTo( 'Vat' ); } + public static function invoicePerYear( $projectID, $year, $thatYear = TRUE ) + { + $invoices = Invoice::selectRAW( 'SUM(invoiceamount * ( 1 +(vatrate / 100))) AS invoicetotal' ) + ->join( 'vats', 'vats.id', '=', 'invoices.vat_id' ) + ->whereProjectId( $projectID ); + + if ( $thatYear ) + { + $invoices = $invoices->whereRaw( "YEAR(invoicedate) = {$year}" ); + } + else + { + $invoices = $invoices->whereRaw( "YEAR(invoicedate) != {$year}" ); + } + + if ( $invoices->count() == 0 ) return 0; + + $invoices = $invoices->first(); + + return $invoices->invoicetotal; + } + public static function saveInvoice( $invoiceID, $invoice ) { $invoice = (array) $invoice; diff --git a/application/models/eloquent/Project.php b/application/models/eloquent/Project.php index 2fddfc4..86bd800 100644 --- a/application/models/eloquent/Project.php +++ b/application/models/eloquent/Project.php @@ -104,6 +104,13 @@ class Project extends BaseModel { return $projects; } + public static function getProjectsForReport() + { + $projects = self::getBaseProject()->get(); + + return $projects; + } + public static function getBaseProject() { $project = Project::with( [ @@ -115,6 +122,7 @@ class Project extends BaseModel { 'projectemployees.user' => function ( $q ) { $q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" ); }] ) + ->with('vat') ->with(['forecasts']) ->with(['reservations']) ->with( 'projectemployees.projecthours' ) diff --git a/application/views/pages/invoicereport_view.php b/application/views/pages/invoicereport_view.php new file mode 100644 index 0000000..6dc15c0 --- /dev/null +++ b/application/views/pages/invoicereport_view.php @@ -0,0 +1,61 @@ +
+
+
+ +
+
+ +
geen geldig jaar
+
+
+ +
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/application/views/pages/outgoinginvoices_view.php b/application/views/pages/outgoinginvoices_view.php deleted file mode 100644 index 8527a94..0000000 --- a/application/views/pages/outgoinginvoices_view.php +++ /dev/null @@ -1,37 +0,0 @@ -
-
-
- -
-
- -
geen geldig jaar
-
-
-
-
- -
-
-
\ No newline at end of file diff --git a/application/views/partials/_js.php b/application/views/partials/_js.php index f4e897c..324475f 100644 --- a/application/views/partials/_js.php +++ b/application/views/partials/_js.php @@ -44,7 +44,7 @@ - + diff --git a/application/views/reports/invoices/_invoicetable.php b/application/views/reports/invoices/_invoicetable.php deleted file mode 100644 index a5f9ccf..0000000 --- a/application/views/reports/invoices/_invoicetable.php +++ /dev/null @@ -1,218 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
project
-
-
klant
-
-
status afgehandeld
-
-
te factureren(excl btw)
-
-
te factureren(incl btw)
-
-
gefactureerd
voorgaande jaren(incl btw)
-
-
gefactureerd
lopend jaar(incl btw)
-
-
totaal gefactureerd
-
-
betaald voorgaande jaren
-
-
betaald lopend jaar
-
-
totaal betaald
-
-
nog niet betaald
-
-
nog te factureren (incl.btw)
-
-
nog te factureren lopend jaar
-
-
nog te factureren na lopend jaar
-
-
nog te prognotiseren
-
-
te factureren(incl btw)
-
-
te factureren volgende jaren
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- totaal - - - - - - - - - - - - - - - - - - - - - - - - -
\ No newline at end of file diff --git a/application/views/reports/invoices/contractors_report.php b/application/views/reports/invoices/contractors_report.php new file mode 100644 index 0000000..593b05d --- /dev/null +++ b/application/views/reports/invoices/contractors_report.php @@ -0,0 +1,7 @@ + + + + +
project
+ + +
klant
+ + +
Nog te factureren
incl. btw
+ + +
Nog te factureren
lopend boekjaar incl. btw
+ + +
Nog te factureren
na lopend boekjaar incl. btw
+ + +
Nog te prognotiseren
incl. btw
+ + + + + + + + + + + + + + + + + + + totaal + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/application/views/reports/invoices/invoiceoverview_report.php b/application/views/reports/invoices/invoiceoverview_report.php new file mode 100644 index 0000000..5607f81 --- /dev/null +++ b/application/views/reports/invoices/invoiceoverview_report.php @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
project
+
+
klant
+
+
Totaal te factureren
excl. btw
+
+
Totaal te factureren
incl. btw
+
+
Gefactureerd overige jaren
incl. btw
+
+
Gefactureerd lopende boekjaar
incl. btw
+
+
Gefactureerd totaal
incl. btw
+
+
Nog te factureren
incl. btw
+
+ totaal + + + + + + + + + + + + +
\ No newline at end of file diff --git a/application/views/reports/invoices/monthforecast_report.php b/application/views/reports/invoices/monthforecast_report.php new file mode 100644 index 0000000..1bafc8f --- /dev/null +++ b/application/views/reports/invoices/monthforecast_report.php @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
project
+
+
klant
+
+
Nog te factureren
incl. btw
+
+
+
+
Nog te factureren
na lopend boekjaar incl. btw
+
+
Nog te prognotiseren
incl. btw
+
+ + + + + + + + + +
\ No newline at end of file diff --git a/application/views/reports/invoices/monthpayment_report.php b/application/views/reports/invoices/monthpayment_report.php new file mode 100644 index 0000000..e725a89 --- /dev/null +++ b/application/views/reports/invoices/monthpayment_report.php @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
project
+
+
klant
+
+
+
+
Totaal gefactureerd
lopend boekjaar incl. btw
+
+ totaal + + + + +
\ No newline at end of file diff --git a/composer.json b/composer.json index 49a89aa..70ea60a 100755 --- a/composer.json +++ b/composer.json @@ -14,7 +14,8 @@ "php": ">=5.3.7", "vlucas/phpdotenv": "^2.4", "illuminate/database": "5.1.16", - "symfony/var-dumper": "^3.4" + "symfony/var-dumper": "^3.4", + "phpoffice/phpspreadsheet": "^1.3" }, "autoload": { "classmap": [ diff --git a/public/css/main.css b/public/css/main.css index 8a82341..4cc81f7 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -108,7 +108,7 @@ th.rotate > div > span { height:20px; border:1px solid #777; } -th.focus-green{ +.focus-green{ background-color:#dcf7b0; border:0; font-weight: bold; diff --git a/public/hello world.xlsx b/public/hello world.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..b74e7d506691a9efcca0b17672c420635586dbdd GIT binary patch literal 8255 zcmc(EWl)^kwrvwgkl?}H-Q9y*W5L}zXyfh>AV`8+aCd^c2MO+OfuOT}WF}~GvtU1>dB_K2m1^@tn0~i)P$XQMxg7lyO0JrA=z$?hFI%2jq zP9`=^2CD9MCXRYcZq`;`V-%qBX$( z0BYXJfn9$e+ECIs_<4yk0*Yv6ab`lFH$aL%FS1t73I7wBbZra}HK*gd0?iS6LtH^m zfP7DRcci2k*C*E2zGN0-GYK;8?J_Y19|q6;K%{0vHW+Z69EPq{>Q9MbZ!Ns%3nk9- z=*tUBTuf^esFTaj^usz)MJzu9l&#&(JSavpRX;Kw#L`OQv`w zw+7oaHjYMUxfv3Td2e=Uz4z94yY8lI!M5u9!1Y_?wC=NQXarF`0zmQ>$F@KeW%t{* z$ktD#UV&$;y`<(-z7#|YHYFnCOkMP|KR10%BgS8Eevy?Nv!$Jg(tj9y-0>bFT_FCk z@k;3rHL&Zrd3GQw0G|N>FCnXegNc?H|fy{cg zD%dfr&0vaz%2r12JNMwq=S>q`5ea#U8G$Z$?s(Ju!E+xcE0|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fTfT)4AIozFj;_O|qx zEoEPHDPt1&7T0V)+kBWhU*?FEI;JcXB6F0?Q=N;A6=;;{lb#nJlzwMPMzj#f+22`z&7tMu@d^Qq<-gk)S*K0a@RlZHc}ZW!b-g;D;pe1G z*={sWqiuJlV3u<#3q$BQ6^v=OKSR$86CPfPyM3vGWlGi|-2z(mhau~1A1hOe^}gA) zE^c#Kux8JQj_!hD&%94GNqNb1_jbvT(TJ1SiZXErf3<*9-nQI4E*3;<KIOI$IFZsydlZ)S3$zO8|`7l=GXQZeAPXm#=ep0g3=tWrWfn}Tmj>vXpT2qJ1bTCz8)I@( zF<^-vU1Zlb2;-X2#k(b%S>WD%*@E;}MHO$&hh*v>VYfG7|A!m@>jwE>-Z<1V4Cwzn z!i1RpuTR~(U(3H4Xet5!BzQV?`x_1b)V+&<)DHic!94{&9ZvlQW!zp0@`V&uk-A@UgwoZN%z(MNr zf7eKP%J8(5|IN^Z{5QjY7xqt~Pb<9N&}GOJ4D#}S)_YIEPpgOD;C4s~^ 2100 ) return vm.validYear( false ); + if ( Number( vm.selectedYear() ) < 2000 ) return vm.validYear( false ); + vm.validYear( true ); + + vm.initModule(); + }, + + setActivetab: function ( page ) { + var vm = dbo.invoicereport; + + vm.invoiceTab( page ); + }, + + Monthforecast: function ( data ) { + var vm = dbo.invoicereport; + var self = this; + self.projectname = data.projectname; + self.customer = data.customer; + self.needInvoice = data.needInvoice; + self.forecastOtherYears = data.forecastOtherYears; + self.forecastRemaining = data.forecastRemaining; + + self.forecastMonths = ko.observableArray( [] ); + _.each( data.forecastMonths, function ( p, i ) { + self.forecastMonths.push( new vm.ForecastMonth( p ) ); + _.each( vm.monthTotals(), function ( q ) { + if ( q.monthID == i ) q.forecastamount( Number( q.forecastamount() ) + p.forecastamount ); + } ); + } ); + }, + + ForecastMonth: function ( data ) { + this.forecastamount = dbo.helpers.thousandSeparator( data.forecastamount ); + }, + + Monthpayment: function ( data ) { + var vm = dbo.invoicereport; + var self = this; + self.projectname = data.projectname; + self.customer = data.customer; + self.totalProjectPayments = data.totalProjectPayments; + + self.paymentMonths = ko.observableArray( [] ); + _.each( data.monthPayments, function ( p, i ) { + self.paymentMonths.push( new vm.PaymentMonth( p ) ); + _.each( vm.monthPaymentTotals(), function ( q ) { + if ( q.monthID == i ) q.paymentamount( Number( q.paymentamount() ) + p.paymentamount ); + } ); + } ); + }, + + PaymentMonth: function ( data ) { + this.paymentamount = dbo.helpers.thousandSeparator( data.paymentamount ); + }, + + createSpreadsheet:function(){ + var vm = dbo.invoicereport; + dbo.invoiceDataService.createSpreadsheet(vm.selectedYear()); + } + } + + dbo.invoicereport.init(); + + ko.applyBindings( + dbo.invoicereport, document.getElementById( "INVOICEREPORT" ) ); + + + } + + +} \ No newline at end of file diff --git a/public/js/lib/modules/reports/outgoingInvoices.js b/public/js/lib/modules/reports/outgoingInvoices.js deleted file mode 100644 index 90e00f4..0000000 --- a/public/js/lib/modules/reports/outgoingInvoices.js +++ /dev/null @@ -1,160 +0,0 @@ -/** - * Created by Pensare Software. - * User: Theo Weijmer - * Date: 02/03/2018 - * Time: 11:43 - */ - - -dbo.outgoinginvoicesInit = function () { - - if ( dbo.outgoinginvoicesModel !== undefined ) { - - - } else { - dbo.outgoinginvoicesModel = { - - initialize : null, - years : ko.observableArray( [] ), - selectedYear : ko.observable(), - selectedMonthID : ko.observable(), - projects : ko.observableArray( [] ), - invoiceTab : ko.observable( 'invoice' ), - months : ko.observableArray( dbo.monthArray ), - totalToInvoice : ko.observable(), - totalToInvoiceFuture: ko.observable(), - initialize : null, - validYear : ko.observable(), - totalToInvoice : ko.observable(), - totalCurrentforecast: ko.observable(), - totalOtherforecast : ko.observable(), - totalMissingForecast: ko.observable(), - - init: function () { - var vm = dbo.outgoinginvoicesModel; - - vm.selectedYear( (new Date()).getFullYear() ); - vm.selectedMonthID( 0 ); - vm.validYear( true ); - - vm.initModule(); - }, - - setActivetab: function ( tab ) { - var vm = dbo.outgoinginvoicesModel; - - vm.invoiceTab( tab ); - }, - - initModule: function () { - var vm = dbo.outgoinginvoicesModel; - - vm.refreshInvoiceDetails(); - }, - - checkYear: function () { - var vm = dbo.outgoinginvoicesModel; - if ( !Number.isInteger( Number( vm.selectedYear() ) ) ) return vm.validYear( false ); - if ( Number( vm.selectedYear() ) > 2100 ) return vm.validYear( false ); - if ( Number( vm.selectedYear() ) < 2000 ) return vm.validYear( false ); - vm.validYear( true ); - - vm.initModule(); - }, - - refreshInvoiceDetails: function () { - var vm = dbo.outgoinginvoicesModel; - - vm.resetModel(); - - if ( vm.initialize ) return; - - dbo.invoiceDataService.getInvoiceOverview( vm.selectedYear(), function ( data ) { - vm.projects.removeAll(); - _.each( data, function ( p ) { - vm.projects.push( new vm.Project( p ) ); - } ); - vm.totalToInvoice( dbo.helpers.numberWithPoints( Math.round( vm.totalToInvoice() ) ) ); - vm.totalToInvoiceFuture( dbo.helpers.numberWithPoints( Math.round( vm.totalToInvoiceFuture() ) ) ); - vm.totalCurrentforecast( dbo.helpers.numberWithPoints( Math.round( vm.totalCurrentforecast() ) ) ); - vm.totalOtherforecast( dbo.helpers.numberWithPoints( Math.round( vm.totalOtherforecast() ) ) ); - vm.totalMissingForecast( dbo.helpers.numberWithPoints( Math.round( vm.totalMissingForecast() ) ) ); - } ); - }, - - resetModel: function () { - var vm = dbo.outgoinginvoicesModel; - vm.totalToInvoice( 0 ); - vm.totalToInvoiceFuture( 0 ); - vm.totalCurrentforecast( 0 ); - vm.totalOtherforecast( 0 ); - vm.totalMissingForecast( 0 ); - }, - - Project: function ( data ) { - var vm = dbo.outgoinginvoicesModel; - var self = this; - var openstaand = data.revenues - (Number( data.currentyear ) + Number( data.otheryear )); - var totalInvoice = data.revenues * (1 + (data.vatrate / 100)); - var totalInvoiced = Math.round( data.currentyear ) + Math.round( data.otheryear ); - var totalInvoicedPayed = Math.round( data.currentyearpayed ) + Math.round( data.otheryearpayed ); - var notPayed = totalInvoiced - totalInvoicedPayed; - - self.projectnumber = data.projectnumber; - self.customername = data.customername; - self.statusProject = Math.abs( openstaand ) > 2 ? 'OPEN' : 'CLOSED'; - self.fullname = data.fullname; - self.revenues = dbo.helpers.numberWithPoints( Number(data.revenues).toFixed(0) ); - self.totalInvoice = dbo.helpers.numberWithPoints( Number(totalInvoice).toFixed(0) ); - self.openstaand = dbo.helpers.numberWithPoints( Math.round( openstaand ) ); - self.openstaandIncl = dbo.helpers.numberWithPoints( Math.round( openstaand * 1.21 ) ); - self.invoicedOtherYears = dbo.helpers.numberWithPoints( Math.round( data.otheryear ) ); - self.invoicedCurentYear = dbo.helpers.numberWithPoints( Math.round( data.currentyear ) ); - self.totalInvoiced = dbo.helpers.numberWithPoints( totalInvoiced ); - self.invoicedOtherYearsPayed = dbo.helpers.numberWithPoints( Math.round( data.otheryearpayed ) ); - self.invoicedCurentYearPayed = dbo.helpers.numberWithPoints( Math.round( data.currentyearpayed ) ); - self.totalInvoicedPayed = dbo.helpers.numberWithPoints( Math.round( totalInvoicedPayed ) ); - self.notPayed = dbo.helpers.numberWithPoints( Math.round( notPayed ) ); - self.toInvoice = dbo.helpers.numberWithPoints( Math.round( totalInvoice - totalInvoiced ) ); - self.toInvoiceFuture = dbo.helpers.numberWithPoints( Math.round( totalInvoice - totalInvoiced - Number( data.currentforecast ) ) ); - self.currentforecast = dbo.helpers.numberWithPoints( Math.round( data.currentforecast ) ); - self.otherforecast = dbo.helpers.numberWithPoints( Math.round( data.otherforecast ) ); - var missingForcast = Math.round( totalInvoice - totalInvoiced - data.otherforecast - data.currentforecast ); - console.log( missingForcast ); - self.missingForecast = dbo.helpers.numberWithPoints( missingForcast ); - - self.months = ko.observableArray( [] ); - _.each( data.months, function ( p ) { - self.months.push( new vm.Month( p ) ); - - if ( !vm['forecast' + p.month] ) vm['forecast' + p.month] = ko.observable( 0 ); - vm['forecast' + p.month]( Number( vm['forecast' + p.month]() ) + Number( p.forecastamount ) ); - - if ( !vm['payment' + p.month] ) vm['payment' + p.month] = ko.observable( 0 ); - vm['payment' + p.month]( Number( vm['payment' + p.month]() ) + Number( p.paymentamount ) ); - } ); - - - vm.totalToInvoice( vm.totalToInvoice() + (totalInvoice - totalInvoiced) ); - vm.totalToInvoiceFuture( vm.totalToInvoiceFuture() + (totalInvoice - totalInvoiced - Number( data.currentforecast )) ); - vm.totalCurrentforecast( Number( vm.totalCurrentforecast() ) + Number( data.currentforecast ) ); - vm.totalOtherforecast( Number( vm.totalOtherforecast() ) + Number( data.otherforecast ) ); - vm.totalMissingForecast( Number( vm.totalMissingForecast() ) + Number( missingForcast ) ); - }, - - Month: function ( data ) { - this.forecastamount = dbo.helpers.numberWithPoints( Number( data.forecastamount ).toFixed( 0 ) ); - this.paymentamount = dbo.helpers.numberWithPoints( Number( data.paymentamount ).toFixed( 0 ) ); - } - } - - dbo.outgoinginvoicesModel.init(); - - ko.applyBindings( - dbo.outgoinginvoicesModel, document.getElementById( "OUTGOINGINVOICES" ) ); - - - } - - -} \ No newline at end of file