Fix payment entry
This commit is contained in:
@@ -281,7 +281,7 @@ class Invoice extends Model implements IDs
|
||||
->filter(function($item) { return ! $item->pending_status; })
|
||||
->last();
|
||||
|
||||
return $o?->payment_date;
|
||||
return $o?->paid_at;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -10,6 +10,8 @@ class PaymentItem extends Model
|
||||
{
|
||||
use PushNew;
|
||||
|
||||
public $timestamps = FALSE;
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
public function invoice()
|
||||
|
Reference in New Issue
Block a user