This commit is contained in:
2018-01-31 11:10:17 +01:00
parent f3bf0c9f80
commit 05c165c9ed
27 changed files with 724 additions and 265 deletions
+17
View File
@@ -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;
}
}
+4 -2
View File
@@ -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( [