Diversen
This commit is contained in:
@@ -22,4 +22,21 @@ class Invoice extends BaseModel {
|
||||
{
|
||||
return $this->belongsTo( 'Vat' );
|
||||
}
|
||||
|
||||
public static function saveInvoice( $invoiceID, $invoice )
|
||||
{
|
||||
$invoice = (array) $invoice;
|
||||
|
||||
if ( $invoiceID == 0 )
|
||||
{
|
||||
$invoice = Invoice::create( $invoice );
|
||||
$invoiceID = $invoice['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
Invoice::whereId( $invoiceID )->update( $invoice );
|
||||
}
|
||||
|
||||
return $invoiceID;
|
||||
}
|
||||
}
|
||||
@@ -52,13 +52,15 @@ class Offer extends BaseModel {
|
||||
if ( $offerID == 0 )
|
||||
{
|
||||
$offer = Offer::create( $offer );
|
||||
|
||||
$offerID = $offer['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$offer = Offer::whereId( $offerID )->update( $offer );
|
||||
Offer::whereId( $offerID )->update( $offer );
|
||||
}
|
||||
|
||||
return $offer['id'];
|
||||
return $offerID;
|
||||
}
|
||||
|
||||
public static function removeOffer( $offerID )
|
||||
|
||||
@@ -18,4 +18,21 @@ class Projectcost extends BaseModel {
|
||||
return $this->belongsTo( 'External' );
|
||||
}
|
||||
|
||||
public static function saveProjectcost( $projectID, $project )
|
||||
{
|
||||
$project = (array) $project;
|
||||
|
||||
if ( $projectID == 0 )
|
||||
{
|
||||
$project = Self::create( $project );
|
||||
$projectID = $project['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
Self::whereId( $projectID )->update( $project );
|
||||
}
|
||||
|
||||
return $projectID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,6 +23,19 @@ class Projectemployee extends BaseModel {
|
||||
return $this->hasMany( 'Projecthour' );
|
||||
}
|
||||
|
||||
public static function getAvailableEmployees( $projectID )
|
||||
{
|
||||
$currentEmployees = Self::whereProjectId( $projectID )
|
||||
->lists( 'user_id' );
|
||||
|
||||
$availableEmployees = User::selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" )
|
||||
->whereNotIn( 'id', $currentEmployees )
|
||||
->whereArchive( 'F' )
|
||||
->get();
|
||||
|
||||
return $availableEmployees;
|
||||
}
|
||||
|
||||
public static function createProjectEmployee( $projectID )
|
||||
{
|
||||
$projectemployee = Projectemployee::create( [
|
||||
|
||||
Reference in New Issue
Block a user