invoice added new columns
This commit is contained in:
@@ -15,6 +15,19 @@ class Payment extends BaseModel {
|
||||
return $this->belongsTo( 'Invoice' );
|
||||
}
|
||||
|
||||
public static function getPaymentPerProject( $projectID )
|
||||
{
|
||||
$projectPayment = self::selectRAW( 'id, invoice_id, SUM(paymentamount) as payment' )
|
||||
->whereHas( 'invoice', function ( $q ) use ( $projectID ) {
|
||||
$q->whereProjectId( $projectID );
|
||||
} )
|
||||
->first();
|
||||
|
||||
if( ! $projectPayment) return 0;
|
||||
|
||||
return $projectPayment->payment;
|
||||
}
|
||||
|
||||
public static function savePayment( $paymentID, $payment )
|
||||
{
|
||||
$payment = (array) $payment;
|
||||
|
||||
Reference in New Issue
Block a user