Payment summary improvements, removed invoice/payment API calls
This commit is contained in:
26
app/User.php
26
app/User.php
@@ -614,6 +614,32 @@ class User extends Authenticatable
|
||||
->from($summary,'summary');
|
||||
}
|
||||
|
||||
public function query_payment_summary()
|
||||
{
|
||||
$payment = (new Payment)
|
||||
->select([
|
||||
'payment_id',
|
||||
DB::raw('SUM(allocate) AS allocate'),
|
||||
|
||||
])
|
||||
->from($this->query_payment_items(),'PI')
|
||||
//->where('ab_payment.active',TRUE) // @todo To implement
|
||||
->groupBy(['payment_id']);
|
||||
|
||||
return (new Payment)
|
||||
->select([
|
||||
DB::raw('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'])
|
||||
->whereIN('account_id',$this->all_accounts()->pluck('id')->unique()->toArray())
|
||||
->from($payment,'summary');
|
||||
}
|
||||
|
||||
public function role()
|
||||
{
|
||||
// If I have agents and no parent, I am the wholesaler
|
||||
|
Reference in New Issue
Block a user