Missed some references to ab_payments in d463239

This commit is contained in:
Deon George 2021-07-23 17:49:59 +10:00
parent 7a963c8461
commit 10e6c73b2b
No known key found for this signature in database
GPG Key ID: 7670E8DC27415254
2 changed files with 8 additions and 8 deletions

View File

@ -528,7 +528,7 @@ class User extends Authenticatable
*/ */
private function query_payment_items() private function query_payment_items()
{ {
return DB::table('ab_payment_item') return DB::table('payment_items')
->select([ ->select([
'payment_id', 'payment_id',
'invoice_id', 'invoice_id',
@ -573,9 +573,9 @@ class User extends Authenticatable
DB::raw('SUM(fees_amt) AS payment_fees'), DB::raw('SUM(fees_amt) AS payment_fees'),
]) ])
->from($this->query_payment_items(),'PI') ->from($this->query_payment_items(),'PI')
->join('ab_payment',['ab_payment.id'=>'PI.payment_id']) ->join('payments',['payments.id'=>'PI.payment_id'])
->whereIN('account_id',$this->all_accounts()->pluck('id')->unique()->toArray()) ->whereIN('account_id',$this->all_accounts()->pluck('id')->unique()->toArray())
//->where('ab_payment.active',TRUE) // @todo To implement //->where('payments.active',TRUE) // @todo To implement
->groupBy(['invoice_id']); ->groupBy(['invoice_id']);
$summary = (new Invoice) $summary = (new Invoice)
@ -618,20 +618,20 @@ class User extends Authenticatable
]) ])
->from($this->query_payment_items(),'PI') ->from($this->query_payment_items(),'PI')
//->where('ab_payment.active',TRUE) // @todo To implement //->where('payments.active',TRUE) // @todo To implement
->groupBy(['payment_id']); ->groupBy(['payment_id']);
return (new Payment) return (new Payment)
->select([ ->select([
DB::raw('ab_payment.id AS id'), DB::raw('payments.id AS id'),
'date_orig', 'date_orig',
'payment_date', 'payment_date',
'total_amt', 'total_amt',
//'fees_amt', //'fees_amt',
DB::raw('total_amt-allocate AS balance'), DB::raw('total_amt-allocate AS balance'),
]) ])
->rightJoin('ab_payment',['ab_payment.id'=>'summary.id']) ->rightJoin('payments',['payments.id'=>'summary.id'])
//->where('ab_payment.active',TRUE) // @todo To implement //->where('payments.active',TRUE) // @todo To implement
->whereIN('account_id',$this->all_accounts()->pluck('id')->unique()->toArray()) ->whereIN('account_id',$this->all_accounts()->pluck('id')->unique()->toArray())
->from($payment,'summary'); ->from($payment,'summary');
} }

View File

@ -5,7 +5,7 @@
</div> </div>
<div class="card-body"> <div class="card-body">
@if(($x=$o->payments()->where('ab_payment.date_orig','>',\Carbon\Carbon::now()->subMonths(12)->unix())->with(['items','account'])->get())->count()) @if(($x=$o->payments()->where('payments.date_orig','>',\Carbon\Carbon::now()->subMonths(12)->unix())->with(['items','account'])->get())->count())
<table class="table table-bordered w-100" id="payments_past"> <table class="table table-bordered w-100" id="payments_past">
<thead> <thead>
<tr> <tr>