Fix payment entry
This commit is contained in:
@@ -15,7 +15,7 @@ use App\Traits\PushNew;
|
||||
*
|
||||
* Attributes for payments:
|
||||
* + lid : Local ID for payment
|
||||
* + payment_date : Date payment received
|
||||
* + paid_at : Date payment received
|
||||
* + sid : System ID for payment
|
||||
* + total : Payment total
|
||||
* + balance : Remaining credit on payment
|
||||
@@ -95,9 +95,9 @@ class Payment extends Model implements IDs
|
||||
public function scopeUnapplied($query)
|
||||
{
|
||||
return $query
|
||||
->select(['payments.id','payment_date','account_id','checkout_id','total_amt',DB::raw("SUM(amount) as allocated")])
|
||||
->select(['payments.id','paid_at','account_id','checkout_id','total_amt',DB::raw("SUM(amount) as allocated")])
|
||||
->leftJoin('payment_items',['payment_items.payment_id'=>'payments.id'])
|
||||
->groupBy(['payments.id','payment_date','total_amt','account_id','checkout_id'])
|
||||
->groupBy(['payments.id','paid_at','total_amt','account_id','checkout_id'])
|
||||
->having(DB::raw('ROUND(total_amt-IFNULL(allocated,0),2)'),'>',self::threshold);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user