Fix payment join to show unapplied payments
This commit is contained in:
@@ -618,7 +618,7 @@ class User extends Authenticatable
|
||||
{
|
||||
$payment = (new Payment)
|
||||
->select([
|
||||
'payment_id',
|
||||
DB::raw('payment_id AS id'),
|
||||
DB::raw('SUM(allocate) AS allocate'),
|
||||
|
||||
])
|
||||
@@ -628,14 +628,15 @@ class User extends Authenticatable
|
||||
|
||||
return (new Payment)
|
||||
->select([
|
||||
DB::raw('payment_id AS id'),
|
||||
DB::raw('ab_payment.id AS id'),
|
||||
'date_orig',
|
||||
'date_payment',
|
||||
'total_amt',
|
||||
//'fees_amt',
|
||||
DB::raw('total_amt-allocate AS balance'),
|
||||
])
|
||||
->join('ab_payment',['ab_payment.id'=>'payment_id'])
|
||||
->rightJoin('ab_payment',['ab_payment.id'=>'summary.id'])
|
||||
//->where('ab_payment.active',TRUE) // @todo To implement
|
||||
->whereIN('account_id',$this->all_accounts()->pluck('id')->unique()->toArray())
|
||||
->from($payment,'summary');
|
||||
}
|
||||
|
Reference in New Issue
Block a user