Minor job cleanup, import Ezypay payments update
This commit is contained in:
@@ -74,11 +74,12 @@ class Payment extends Model implements IDs
|
||||
|
||||
public function scopeUnapplied($query)
|
||||
{
|
||||
//DB::enableQueryLog();
|
||||
return $query
|
||||
->select([DB::raw('payment_id AS id'),'payment_date','account_id','checkout_id','total_amt',DB::raw("SUM(alloc_amt) as allocated")])
|
||||
->join('payment_items',['payment_items.payment_id'=>'payments.id'])
|
||||
->groupBy(['payment_id','payment_date','total_amt','account_id','checkout_id'])
|
||||
->having(DB::raw("ROUND(total_amt-allocated,2)"),'>',self::threshold);
|
||||
->select(['payments.id','payment_date','account_id','checkout_id','total_amt',DB::raw("SUM(alloc_amt) as allocated")])
|
||||
->leftJoin('payment_items',['payment_items.payment_id'=>'payments.id'])
|
||||
->groupBy(['payments.id','payment_date','total_amt','account_id','checkout_id'])
|
||||
->having(DB::raw('ROUND(total_amt-IFNULL(allocated,0),2)'),'>',self::threshold);
|
||||
}
|
||||
|
||||
/* ATTRIBUTES */
|
||||
|
Reference in New Issue
Block a user