fix payment due date days filter

This commit is contained in:
Omair Saleh
2022-10-30 18:41:55 +08:00
parent 2e5d39fe96
commit e91e770bf3
2 changed files with 3 additions and 2 deletions
@@ -3,6 +3,7 @@
namespace App\Classes\General\Eloquent\Filters;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
@@ -17,7 +18,7 @@ class PaymentDay implements Filter
public static function apply(Builder $builder, $value)
{
return $builder->whereHas('transactions', function (Builder $query) use($value) {
$query->where('transactions.type', 1)->whereRaw("DATEDIFF(NOW(), transactions.updated_at) <= $value");
$query->where('transactions.type', 1)->where('status', ApprovalStatus::APPROVED)->whereDate('updated_at', '<=', Carbon::now()->subdays($value));
});
}
}
@@ -63,7 +63,7 @@
fetchPaymentList(){
this.$store.dispatch('reloadList', {name: this.section});
this.$store.dispatch('updateListQueue', {name: this.section, page:1, filters: {per_page:5, group_by: 'DATE(transactions.updated_at)', has_invoice_status_in:[2], payment_day:this.parameters.due, credit_term:this.parameters.segment }});
this.$store.dispatch('updateListQueue', {name: this.section, page:1, filters: {per_page:5, has_invoice_status_in:[2], payment_day:this.parameters.due, credit_term:this.parameters.segment }});
//this.$store.dispatch('toggleSection', {name: this.section, status: true});
//this.$store.dispatch('updateListQueue', {name: this.section, page:1, filters: {per_page:5, group_by: 'transactions.id', payment_day:this.due,has_invoice_status_in:[2] /*,credit_term:[0.0]*/ }});