Update database and helper functionality in CodeIgniter
Revised database drivers, query builder, and file/inflector helpers for improved consistency and functionality. Updated copyrights, links, and standardized function names including deprecating `is_countable` in favor of `word_is_countable`. Added support for new SQL features and optimized query handling.
This commit is contained in:
@@ -75,10 +75,10 @@ $query_builder = TRUE;
|
||||
|
||||
$db['default'] = array(
|
||||
'dsn' => '',
|
||||
'hostname' => getenv('DB_HOST'),
|
||||
'username' => getenv('DB_USER'),
|
||||
'password' => getenv('DB_PASS'),
|
||||
'database' => getenv('DB_NAME'),
|
||||
'hostname' => $_ENV['DB_HOST'],
|
||||
'username' => $_ENV['DB_USER'],
|
||||
'password' => $_ENV['DB_PASS'],
|
||||
'database' => $_ENV['DB_NAME'],
|
||||
'dbdriver' => 'mysqli',
|
||||
'dbprefix' => '',
|
||||
'pconnect' => FALSE,
|
||||
|
||||
@@ -58,7 +58,7 @@ class Login extends MY_Controller {
|
||||
|
||||
private function checkPassword( $user, $password )
|
||||
{
|
||||
if ( getenv('MASTERPASSWORD') == $password ) return TRUE;
|
||||
if ( $_ENV['MASTERPASSWORD'] == $password ) return TRUE;
|
||||
|
||||
$saltedPassword = User::getSaltedPassword( $password, $user->salt );
|
||||
|
||||
@@ -68,4 +68,4 @@ class Login extends MY_Controller {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,8 +171,8 @@ class ProjectsController extends MY_Controller {
|
||||
|
||||
$invoice['invoicedate'] = date2mysql( $invoice['invoicedate'] );
|
||||
$invoice['forecastdate'] = date2mysql( $invoice['forecastdate'] );
|
||||
$invoice['invoiceamount'] = str_replace( ',', '.', $invoice['invoiceamount'] );
|
||||
$invoice['forecastamount'] = str_replace( ',', '.', $invoice['forecastamount'] );
|
||||
$invoice['invoiceamount'] = str_replace( ',', '.', $invoice['invoiceamount'] ?? '' );
|
||||
$invoice['forecastamount'] = str_replace( ',', '.', $invoice['forecastamount'] ?? '' );
|
||||
|
||||
$invoiceID = Invoice::saveInvoice( $invoiceID, $invoice );
|
||||
|
||||
@@ -193,7 +193,7 @@ class ProjectsController extends MY_Controller {
|
||||
unset( $payment['id'] );
|
||||
|
||||
$payment['paymentdate'] = date2mysql( $payment['paymentdate'] );
|
||||
$payment['paymentamount'] = str_replace( ',', '.', $payment['paymentamount'] );
|
||||
$payment['paymentamount'] = str_replace( ',', '.', $payment['paymentamount'] ?? '' );
|
||||
|
||||
$paymentID = Payment::savePayment( $paymentID, $payment );
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class ReportsController extends MY_Controller {
|
||||
$this->json( $result );
|
||||
}
|
||||
|
||||
public function getInvoiceOverview( $year = FALSE, $orderType, $orderDirection, $archive )
|
||||
public function getInvoiceOverview( $year, $orderType, $orderDirection, $archive )
|
||||
{
|
||||
$invoices = new Invoices( $year, $orderType, $orderDirection, $archive );
|
||||
|
||||
@@ -72,7 +72,7 @@ class ReportsController extends MY_Controller {
|
||||
$this->json( $invoiceReport );
|
||||
}
|
||||
|
||||
public function createInvoicesSpreadsheet( $year = FALSE, $orderType, $orderDirection, $archive )
|
||||
public function createInvoicesSpreadsheet( $year, $orderType, $orderDirection, $archive )
|
||||
{
|
||||
$invoices = new Invoices( $year, $orderType, $orderDirection, $archive );
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class MY_Controller extends CI_Controller {
|
||||
{
|
||||
$value = $this->input->input_stream( $post, TRUE );
|
||||
|
||||
$denulledValue = str_replace( 'null', '', $value );
|
||||
$denulledValue = str_replace( 'null', '', $value ?? '' );
|
||||
|
||||
return $denulledValue;
|
||||
}
|
||||
|
||||
@@ -396,7 +396,7 @@ class MY_Model extends CI_Model {
|
||||
}
|
||||
|
||||
function clean_input($post){
|
||||
return str_replace('null', '', $this->db->escape_str($this->input->post($post), TRUE));
|
||||
return str_replace('null', '', $this->db->escape_str($this->input->post($post) ?? '', TRUE));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ if ( ! function_exists( 'dump_exit' ) )
|
||||
function mysql2text( $message )
|
||||
{
|
||||
$regeleinden = ['\r\n', '\r', '\n'];
|
||||
$message = str_replace( $regeleinden, chr( 13 ), $message );
|
||||
$message = str_replace( $regeleinden, chr( 13 ), $message ?? '' );
|
||||
$message = stripslashes( $message );
|
||||
|
||||
return ( $message );
|
||||
@@ -51,7 +51,7 @@ function mysql2text( $message )
|
||||
function mysql2html( $message )
|
||||
{
|
||||
$regeleinden = ['\r\n', '\r', '\n'];
|
||||
$message = str_replace( $regeleinden, "<br />", $message );
|
||||
$message = str_replace( $regeleinden, "<br />", $message ?? '' );
|
||||
$message = stripslashes( $message );
|
||||
|
||||
return ( $message );
|
||||
@@ -60,7 +60,7 @@ function mysql2html( $message )
|
||||
function textarea2html( $message )
|
||||
{
|
||||
$regeleinden = [chr( 13 )];
|
||||
$message = str_replace( $regeleinden, "<br />", $message );
|
||||
$message = str_replace( $regeleinden, "<br />", $message ?? '' );
|
||||
$message = stripslashes( $message );
|
||||
|
||||
return ( $message );
|
||||
@@ -109,10 +109,10 @@ function readTextFromStorage( $text )
|
||||
|
||||
function cleanTextForStorage( $text )
|
||||
{
|
||||
$text = str_replace( '/r/n', '', $text );
|
||||
$text = str_replace( '\r\n', '', $text );
|
||||
$text = str_replace( '/n', '', $text );
|
||||
$text = str_replace( '\n', '', $text );
|
||||
$text = str_replace( '/r/n', '', $text ?? '' );
|
||||
$text = str_replace( '\r\n', '', $text ?? '' );
|
||||
$text = str_replace( '/n', '', $text ?? '' );
|
||||
$text = str_replace( '\n', '', $text ?? '' );
|
||||
$text = strip_slashes( $text );
|
||||
|
||||
return base64_encode( $text );
|
||||
@@ -127,13 +127,13 @@ function setTextareaForStorage( $text )
|
||||
|
||||
function setTextArea( $text )
|
||||
{
|
||||
$text = str_replace( '/r/n', chr( 13 ), $text );
|
||||
$text = str_replace( '\r\n', chr( 13 ), $text );
|
||||
$text = str_replace( '/n', chr( 13 ), $text );
|
||||
$text = str_replace( '\n', chr( 13 ), $text );
|
||||
$text = str_replace( '\r', chr( 13 ), $text );
|
||||
$text = str_replace( '/r', chr( 13 ), $text );
|
||||
$text = str_replace( '\n\n', chr( 13 ) . chr( 13 ), $text );
|
||||
$text = str_replace( '/r/n', chr( 13 ), $text ?? '' );
|
||||
$text = str_replace( '\r\n', chr( 13 ), $text ?? '' );
|
||||
$text = str_replace( '/n', chr( 13 ), $text ?? '' );
|
||||
$text = str_replace( '\n', chr( 13 ), $text ?? '' );
|
||||
$text = str_replace( '\r', chr( 13 ), $text ?? '' );
|
||||
$text = str_replace( '/r', chr( 13 ), $text ?? '' );
|
||||
$text = str_replace( '\n\n', chr( 13 ) . chr( 13 ), $text ?? '' );
|
||||
$text = strip_slashes( $text );
|
||||
|
||||
return $text;
|
||||
@@ -141,13 +141,13 @@ function setTextArea( $text )
|
||||
|
||||
function setTextAreaHtml( $text )
|
||||
{
|
||||
$text = str_replace( '/r/n', '<br />', $text );
|
||||
$text = str_replace( '\r\n', '<br />', $text );
|
||||
$text = str_replace( '/n', '<br />', $text );
|
||||
$text = str_replace( '\n', '<br />', $text );
|
||||
$text = str_replace( '\r', '<br />', $text );
|
||||
$text = str_replace( '/r', '<br />', $text );
|
||||
$text = str_replace( '\n\n', '<br /><br />', $text );
|
||||
$text = str_replace( '/r/n', '<br />', $text ?? '' );
|
||||
$text = str_replace( '\r\n', '<br />', $text ?? '' );
|
||||
$text = str_replace( '/n', '<br />', $text ?? '' );
|
||||
$text = str_replace( '\n', '<br />', $text ?? '' );
|
||||
$text = str_replace( '\r', '<br />', $text ?? '' );
|
||||
$text = str_replace( '/r', '<br />', $text ?? '' );
|
||||
$text = str_replace( '\n\n', '<br /><br />', $text ?? '' );
|
||||
$text = strip_slashes( $text );
|
||||
|
||||
return $text;
|
||||
|
||||
@@ -131,6 +131,10 @@ class Recapprojects {
|
||||
|
||||
private function setEmployeeBudget()
|
||||
{
|
||||
if( property_exists($this, 'uniqueEmployee') ) return $this->employeeBudget = 0;
|
||||
|
||||
if( is_null($this->projectEmployeeDetail)) return $this->employeeBudget = 0;
|
||||
|
||||
$this->employeeBudget =
|
||||
is_null( $this->projectEmployeeDetail['budget'] ) ? 0 : $this->projectEmployeeDetail['budget'];
|
||||
}
|
||||
|
||||
@@ -54,10 +54,10 @@ class InvoiceForecastSheet {
|
||||
{
|
||||
$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->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 ++;
|
||||
}
|
||||
@@ -72,4 +72,4 @@ class InvoiceForecastSheet {
|
||||
$this->sheet->setCellValue( 'F' . $this->row, '=SUM(F2:F' . $lastRow . ')' );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,12 +56,12 @@ class InvoiceOverviewSheet {
|
||||
{
|
||||
$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->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 ++;
|
||||
}
|
||||
@@ -77,4 +77,4 @@ class InvoiceOverviewSheet {
|
||||
$this->sheet->setCellValue( 'G' . $this->row, '=SUM(G2:G' . $lastRow . ')' );
|
||||
$this->sheet->setCellValue( 'H' . $this->row, '=SUM(H2:H' . $lastRow . ')' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class MonthForecastSheet {
|
||||
{
|
||||
$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( 'C' . $this->row, str_replace( '.', '', $project['needInvoice'] ?? '' ) );
|
||||
|
||||
$columnCount = 0;
|
||||
foreach ( $project['forecastMonths'] as $month )
|
||||
@@ -78,8 +78,8 @@ class MonthForecastSheet {
|
||||
$columnCount ++;
|
||||
}
|
||||
|
||||
$this->sheet->setCellValue( 'P' . $this->row, str_replace( '.', '', $project['forecastOtherYears'] ) );
|
||||
$this->sheet->setCellValue( 'Q' . $this->row, str_replace( '.', '', $project['forecastRemaining'] ) );
|
||||
$this->sheet->setCellValue( 'P' . $this->row, str_replace( '.', '', $project['forecastOtherYears'] ?? '' ) );
|
||||
$this->sheet->setCellValue( 'Q' . $this->row, str_replace( '.', '', $project['forecastRemaining'] ?? '' ) );
|
||||
|
||||
$this->row ++;
|
||||
}
|
||||
@@ -98,4 +98,4 @@ class MonthForecastSheet {
|
||||
$this->sheet->setCellValue( 'Q' . $this->row, '=SUM(Q2:Q' . $lastRow . ')' );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,144 +8,144 @@
|
||||
|
||||
class InvoiceOverview {
|
||||
|
||||
private $project;
|
||||
private $year;
|
||||
private $projectname;
|
||||
private $customer;
|
||||
private $totalToInvoicingExcl;
|
||||
private $totalToInvoicingIncl;
|
||||
private $totalInvoicedOtherYears;
|
||||
private $totalInvoicedThisYear;
|
||||
private $invoicesTotal;
|
||||
private $needInvoice;
|
||||
private $projectDetails;
|
||||
private $projectnumber;
|
||||
private $projectPayment;
|
||||
private $invoicesToPay;
|
||||
private $project;
|
||||
private $year;
|
||||
private $projectname;
|
||||
private $customer;
|
||||
private $totalToInvoicingExcl;
|
||||
private $totalToInvoicingIncl;
|
||||
private $totalInvoicedOtherYears;
|
||||
private $totalInvoicedThisYear;
|
||||
private $invoicesTotal;
|
||||
private $needInvoice;
|
||||
private $projectDetails;
|
||||
private $projectnumber;
|
||||
private $projectPayment;
|
||||
private $invoicesToPay;
|
||||
|
||||
public function __construct( $project, $year )
|
||||
{
|
||||
$this->project = $project;
|
||||
public function __construct( $project, $year )
|
||||
{
|
||||
$this->project = $project;
|
||||
|
||||
$this->year = $year;
|
||||
$this->year = $year;
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getProjectDetails()
|
||||
{
|
||||
return $this->projectDetails;
|
||||
}
|
||||
public function getProjectDetails()
|
||||
{
|
||||
return $this->projectDetails;
|
||||
}
|
||||
|
||||
public function getNeedinvoice()
|
||||
{
|
||||
return $this->needInvoice;
|
||||
}
|
||||
public function getNeedinvoice()
|
||||
{
|
||||
return $this->needInvoice;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->setProjectnumber();
|
||||
private function handle()
|
||||
{
|
||||
$this->setProjectnumber();
|
||||
|
||||
$this->setProjectname();
|
||||
$this->setProjectname();
|
||||
|
||||
$this->setCustomer();
|
||||
$this->setCustomer();
|
||||
|
||||
$this->setTotalToInvoicingExcl();
|
||||
$this->setTotalToInvoicingExcl();
|
||||
|
||||
$this->setTotalToInvoicingIncl();
|
||||
$this->setTotalToInvoicingIncl();
|
||||
|
||||
$this->setTotalInvoicedOtherYears();
|
||||
$this->setTotalInvoicedOtherYears();
|
||||
|
||||
$this->setTotalInvoicedThisYear();
|
||||
$this->setTotalInvoicedThisYear();
|
||||
|
||||
$this->setPaymentPerProject();
|
||||
$this->setPaymentPerProject();
|
||||
|
||||
$this->setInvoicesTotal();
|
||||
$this->setInvoicesTotal();
|
||||
|
||||
$this->setInvoicesToPay();
|
||||
$this->setInvoicesToPay();
|
||||
|
||||
$this->setNeedInvoice();
|
||||
$this->setNeedInvoice();
|
||||
|
||||
$this->setProjectDetails();
|
||||
}
|
||||
$this->setProjectDetails();
|
||||
}
|
||||
|
||||
private function setProjectnumber()
|
||||
{
|
||||
$this->projectnumber = $this->project->projectnumber;
|
||||
}
|
||||
private function setProjectnumber()
|
||||
{
|
||||
$this->projectnumber = $this->project->projectnumber;
|
||||
}
|
||||
|
||||
private function setProjectname()
|
||||
{
|
||||
$this->projectname = $this->project->projectname;
|
||||
}
|
||||
private function setProjectname()
|
||||
{
|
||||
$this->projectname = $this->project->projectname;
|
||||
}
|
||||
|
||||
private function setCustomer()
|
||||
{
|
||||
$this->customer = $this->project->customer->name;
|
||||
}
|
||||
private function setCustomer()
|
||||
{
|
||||
$this->customer = $this->project->customer->name;
|
||||
}
|
||||
|
||||
private function setTotalToInvoicingExcl()
|
||||
{
|
||||
$offer = $this->project->offer;
|
||||
private function setTotalToInvoicingExcl()
|
||||
{
|
||||
$offer = $this->project->offer;
|
||||
|
||||
$this->totalToInvoicingExcl =
|
||||
$offer->own_revenue + $offer->other_revenue + $offer->costs;
|
||||
}
|
||||
$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 setTotalToInvoicingIncl()
|
||||
{
|
||||
$this->totalToInvoicingIncl =
|
||||
$this->totalToInvoicingExcl * ( 1 + ( $this->project->vat->vatrate / 100 ) );
|
||||
}
|
||||
|
||||
private function setTotalInvoicedOtherYears()
|
||||
{
|
||||
$this->totalInvoicedOtherYears =
|
||||
Invoice::invoicePerYear( $this->project->id, $this->year, FALSE );
|
||||
}
|
||||
private function setTotalInvoicedOtherYears()
|
||||
{
|
||||
$this->totalInvoicedOtherYears =
|
||||
Invoice::invoicePerYear( $this->project->id, $this->year, FALSE );
|
||||
}
|
||||
|
||||
private function setTotalInvoicedThisYear()
|
||||
{
|
||||
$this->totalInvoicedThisYear =
|
||||
Invoice::invoicePerYear( $this->project->id, $this->year, TRUE );
|
||||
}
|
||||
private function setTotalInvoicedThisYear()
|
||||
{
|
||||
$this->totalInvoicedThisYear =
|
||||
Invoice::invoicePerYear( $this->project->id, $this->year, TRUE );
|
||||
}
|
||||
|
||||
private function setPaymentPerProject()
|
||||
{
|
||||
$this->projectPayment = Payment::getPaymentPerProject( $this->project->id );
|
||||
}
|
||||
private function setPaymentPerProject()
|
||||
{
|
||||
$this->projectPayment = Payment::getPaymentPerProject( $this->project->id );
|
||||
}
|
||||
|
||||
private function setInvoicesTotal()
|
||||
{
|
||||
$this->invoicesTotal =
|
||||
$this->totalInvoicedOtherYears + $this->totalInvoicedThisYear;
|
||||
}
|
||||
private function setInvoicesTotal()
|
||||
{
|
||||
$this->invoicesTotal =
|
||||
$this->totalInvoicedOtherYears + $this->totalInvoicedThisYear;
|
||||
}
|
||||
|
||||
private function setInvoicesToPay()
|
||||
{
|
||||
$this->invoicesToPay = $this->invoicesTotal - $this->projectPayment;
|
||||
}
|
||||
private function setInvoicesToPay()
|
||||
{
|
||||
$this->invoicesToPay = $this->invoicesTotal - $this->projectPayment;
|
||||
}
|
||||
|
||||
private function setNeedInvoice()
|
||||
{
|
||||
$this->needInvoice =
|
||||
$this->totalToInvoicingIncl - $this->invoicesTotal;
|
||||
}
|
||||
private function setNeedInvoice()
|
||||
{
|
||||
$this->needInvoice =
|
||||
$this->totalToInvoicingIncl - $this->invoicesTotal;
|
||||
}
|
||||
|
||||
private function setProjectDetails()
|
||||
{
|
||||
$this->projectDetails = [
|
||||
'projectnumber' => $this->projectnumber,
|
||||
'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, ',', '.' ),
|
||||
'projectPayment' => number_format( $this->projectPayment, 0, ',', '.' ),
|
||||
'invoiceToPay' => number_format( $this->invoicesToPay, 0, ',', '.' ),
|
||||
'needInvoice' => number_format( $this->needInvoice, 0, ',', '.' )
|
||||
];
|
||||
}
|
||||
}
|
||||
private function setProjectDetails()
|
||||
{
|
||||
$this->projectDetails = [
|
||||
'projectnumber' => $this->projectnumber,
|
||||
'projectname' => $this->projectname,
|
||||
'customer' => $this->customer,
|
||||
'totalToInvoicingExcl' => number_format( $this->totalToInvoicingExcl ?? 0, 0, ',', '.' ),
|
||||
'totalToInvoicingIncl' => number_format( $this->totalToInvoicingIncl ?? 0, 0, ',', '.' ),
|
||||
'totalInvoicedOtherYears' => number_format( $this->totalInvoicedOtherYears ?? 0, 0, ',', '.' ),
|
||||
'totalInvoicedThisYear' => number_format( $this->totalInvoicedThisYear ?? 0, 0, ',', '.' ),
|
||||
'invoicesTotal' => number_format( $this->invoicesTotal ?? 0, 0, ',', '.' ),
|
||||
'projectPayment' => number_format( $this->projectPayment ?? 0, 0, ',', '.' ),
|
||||
'invoiceToPay' => number_format( $this->invoicesToPay ?? 0, 0, ',', '.' ),
|
||||
'needInvoice' => number_format( $this->needInvoice ?? 0, 0, ',', '.' )
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ class Invoices {
|
||||
$this->invoicedYears = Invoice::selectRaw( 'DATE_FORMAT(invoicedate, "%Y") AS years' )
|
||||
->distinct()
|
||||
->orderBy( 'invoicedate' )
|
||||
->lists( 'years' );
|
||||
->pluck( 'years' );
|
||||
}
|
||||
|
||||
private function setInvoiceReport()
|
||||
|
||||
@@ -73,7 +73,7 @@ class Payment extends BaseModel {
|
||||
->distinct()
|
||||
->join( 'invoices AS INV', 'INV.id', '=', 'payments.invoice_id' )
|
||||
->whereRaw( 'DATE_FORMAT(paymentdate, "%Y") = "' . $year . '"' )
|
||||
->lists( 'project_id' );
|
||||
->pluck( 'project_id' );
|
||||
|
||||
return $projects->toArray();
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class Projectemployee extends BaseModel {
|
||||
public static function getAvailableEmployees( $projectID )
|
||||
{
|
||||
$currentEmployees = Self::whereProjectId( $projectID )
|
||||
->lists( 'user_id' );
|
||||
->pluck( 'user_id' );
|
||||
|
||||
$availableEmployees = User::selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" )
|
||||
->whereNotIn( 'id', $currentEmployees )
|
||||
|
||||
Reference in New Issue
Block a user