Removalls and offers revenues
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/06/2018
|
||||
* Time: 17:06
|
||||
*/
|
||||
|
||||
class RemoveInvoice {
|
||||
|
||||
private $invoiceID;
|
||||
private $payments;
|
||||
private $removeAllowed;
|
||||
|
||||
public function __construct( $invoiceID )
|
||||
{
|
||||
$this->setInvoiceID( $invoiceID );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getRemoveAllowed()
|
||||
{
|
||||
return $this->removeAllowed;
|
||||
}
|
||||
|
||||
private function setInvoiceID( $invoiceID )
|
||||
{
|
||||
$this->invoiceID = $invoiceID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->setPayment();
|
||||
|
||||
$this->setRemoveAllowed();
|
||||
}
|
||||
|
||||
private function setPayment()
|
||||
{
|
||||
$payments = Payment::whereInvoiceId( $this->invoiceID );
|
||||
|
||||
$this->payments = $payments->count() == 0 ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
private function setRemoveAllowed()
|
||||
{
|
||||
if ( $this->payments === FALSE ) return $this->removeAllowed = FALSE;
|
||||
|
||||
$this->removeAllowed = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/06/2018
|
||||
* Time: 15:56
|
||||
*/
|
||||
|
||||
class RemoveInvoices {
|
||||
|
||||
private $invoiceID;
|
||||
private $payments;
|
||||
private $removeAllowed;
|
||||
|
||||
public function __construct( $invoiceID )
|
||||
{
|
||||
$this->setInvoiceID($invoiceID);
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
private function setInvoiceID( $invoiceID )
|
||||
{
|
||||
$this->invoiceID = $invoiceID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->setPayments();
|
||||
|
||||
$this->setRemoveAllowed();
|
||||
}
|
||||
|
||||
private function setPayments()
|
||||
{
|
||||
$payments = Payment::whereInvoiceId($this->invoiceID);
|
||||
|
||||
$this->payments = $payments->count() == 0 ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
private function setRemoveAllowed()
|
||||
{
|
||||
$this->removeAllowed = $this->payments;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/06/2018
|
||||
* Time: 16:28
|
||||
*/
|
||||
|
||||
class RemoveOffer {
|
||||
|
||||
private $offerID;
|
||||
private $project;
|
||||
private $removeAllowed;
|
||||
|
||||
public function __construct($offerID)
|
||||
{
|
||||
$this->setOfferID($offerID);
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getRemoveAllowed()
|
||||
{
|
||||
return $this->removeAllowed;
|
||||
}
|
||||
|
||||
private function setOfferID( $offerID )
|
||||
{
|
||||
$this->offerID = $offerID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->setProject();
|
||||
|
||||
$this->setRemoveAllowed();
|
||||
}
|
||||
|
||||
private function setProject()
|
||||
{
|
||||
$offer = Offer::Find($this->offerID);
|
||||
|
||||
$this->project = is_null($offer->project_id) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
private function setRemoveAllowed()
|
||||
{
|
||||
if( $this->project === FALSE ) return $this->removeAllowed = FALSE;
|
||||
|
||||
$this->removeAllowed = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/06/2018
|
||||
* Time: 15:53
|
||||
*/
|
||||
|
||||
class RemoveProject {
|
||||
|
||||
private $projectID;
|
||||
private $forecast;
|
||||
private $invoices;
|
||||
private $projectemployees;
|
||||
private $reservations;
|
||||
private $removeAllowed;
|
||||
private $projectcosts;
|
||||
|
||||
public function __construct( $projectID )
|
||||
{
|
||||
$this->setProjectID( $projectID );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getRemoveAllowed()
|
||||
{
|
||||
return $this->removeAllowed;
|
||||
}
|
||||
|
||||
private function setProjectID( $projectID )
|
||||
{
|
||||
$this->projectID = $projectID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->setForecast();
|
||||
|
||||
$this->setInvoices();
|
||||
|
||||
$this->setProjectemployees();
|
||||
|
||||
$this->setReservations();
|
||||
|
||||
$this->setRemoveAllowed();
|
||||
|
||||
$this->setProjectCosts();
|
||||
}
|
||||
|
||||
private function setForecast()
|
||||
{
|
||||
$forecast = Forecast::whereProjectId( $this->projectID );
|
||||
|
||||
$this->forecast = $forecast->count() == 0 ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
private function setInvoices()
|
||||
{
|
||||
$invoices = Invoice::whereProjectId( $this->projectID );
|
||||
|
||||
$this->invoices = $invoices->count() == 0 ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
private function setProjectemployees( )
|
||||
{
|
||||
$setProjectemployees = Projectemployee::whereProjectId($this->projectID);
|
||||
|
||||
$this->projectemployees = $setProjectemployees->count() == 0 ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
private function setReservations( )
|
||||
{
|
||||
$reservations = Reservation::whereProjectId($this->projectID);
|
||||
|
||||
$this->reservations = $reservations->count() == 0 ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
private function setProjectcosts( )
|
||||
{
|
||||
$projectcosts = Projectcost::whereProjectId($this->projectID);
|
||||
|
||||
$this->projectcosts = $projectcosts->count() == 0 ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
private function setRemoveAllowed()
|
||||
{
|
||||
if( $this->forecast === false ) return $this->removeAllowed = FALSE;
|
||||
if( $this->invoices === false ) return $this->removeAllowed = FALSE;
|
||||
if( $this->projectemployees === false ) return $this->removeAllowed = FALSE;
|
||||
if( $this->reservations === false ) return $this->removeAllowed = FALSE;
|
||||
if( $this->projectcosts === false ) return $this->removeAllowed = FALSE;
|
||||
|
||||
$this->removeAllowed = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 27/12/2017
|
||||
* Time: 17:45
|
||||
*/
|
||||
|
||||
class RemoveProjectemployee {
|
||||
|
||||
private $projectemployeeID;
|
||||
private $removeAllowed;
|
||||
private $projecthours;
|
||||
|
||||
public function __construct( $projectemployeeID )
|
||||
{
|
||||
$this->setProjectemployeeID( $projectemployeeID );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getRemoveAllowed()
|
||||
{
|
||||
return $this->removeAllowed;
|
||||
}
|
||||
|
||||
private function setProjectemployeeID( $projectemployeeID )
|
||||
{
|
||||
$this->projectemployeeID = $projectemployeeID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->setProjectHours();
|
||||
|
||||
$this->setRemoveAllowed();
|
||||
}
|
||||
|
||||
private function setProjecthours()
|
||||
{
|
||||
$projecthours = Projecthour::whereProjectemployeeId($this->projectemployeeID);
|
||||
|
||||
$this->projecthours = $projecthours->count() == 0 ?TRUE : FALSE;
|
||||
}
|
||||
|
||||
private function setRemoveAllowed()
|
||||
{
|
||||
if( $this->projecthours === false ) return $this->removeAllowed = FALSE;
|
||||
|
||||
$this->removeAllowed = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 27/12/2017
|
||||
* Time: 17:45
|
||||
*/
|
||||
|
||||
class RemoveProject {
|
||||
|
||||
private $projectID;
|
||||
private $allowDelete = TRUE;
|
||||
|
||||
public function __construct( $projectID )
|
||||
{
|
||||
$this->setProjectID( $projectID );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getAllowDelete()
|
||||
{
|
||||
return $this->allowDelete;
|
||||
}
|
||||
|
||||
private function setProjectID( $projectID )
|
||||
{
|
||||
$this->projectID = $projectID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->checkForOffers();
|
||||
}
|
||||
|
||||
private function checkForOffers()
|
||||
{
|
||||
$offers = Offer::whereProjectId($this->projectID);
|
||||
|
||||
if( $offers->count() > 0 ) $this->allowDelete = FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 27/12/2017
|
||||
* Time: 17:45
|
||||
*/
|
||||
|
||||
class RemoveProjectemployee {
|
||||
|
||||
private $projectemployeeID;
|
||||
private $allowDelete = TRUE;
|
||||
|
||||
public function __construct( $projectemployeeID )
|
||||
{
|
||||
$this->setProjectemployeeID( $projectemployeeID );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getAllowDelete()
|
||||
{
|
||||
return $this->allowDelete;
|
||||
}
|
||||
|
||||
private function setProjectemployeeID( $projectemployeeID )
|
||||
{
|
||||
$this->projectemployeeID = $projectemployeeID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 27/12/2017
|
||||
* Time: 17:45
|
||||
*/
|
||||
|
||||
class RemoveOffer {
|
||||
|
||||
private $offerID;
|
||||
private $allowDelete = TRUE;
|
||||
|
||||
public function __construct( $userID )
|
||||
{
|
||||
$this->setOfferID( $userID );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getAllowDelete()
|
||||
{
|
||||
return $this->allowDelete;
|
||||
}
|
||||
|
||||
private function setOfferID( $customerID )
|
||||
{
|
||||
$this->offerID = $customerID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user