diff --git a/app/Filters/InvoiceFilters.php b/app/Filters/InvoiceFilters.php index c96d7507dcb2..b94fb80f70ea 100644 --- a/app/Filters/InvoiceFilters.php +++ b/app/Filters/InvoiceFilters.php @@ -53,9 +53,9 @@ class InvoiceFilters extends QueryFilters $this->builder->where('status_id', Invoice::STATUS_PAID); if(in_array('unpaid', $status_parameters)) - $this->builder->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]) - ->where('due_date', '>', Carbon::now()) - ->orWhere('partial_due_date', '>', Carbon::now()); + $this->builder->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]); + //->where('due_date', '>', Carbon::now()) + //->orWhere('partial_due_date', '>', Carbon::now()); if(in_array('overdue', $status_parameters)) $this->builder->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]) diff --git a/database/seeds/RandomDataSeeder.php b/database/seeds/RandomDataSeeder.php index c8db0649dc1a..0e2956af9e35 100644 --- a/database/seeds/RandomDataSeeder.php +++ b/database/seeds/RandomDataSeeder.php @@ -133,21 +133,23 @@ class RandomDataSeeder extends Seeder event(new InvoiceWasMarkedSent($invoice)); - $payment = App\Models\Payment::create([ - 'user_id' => $user->id, - 'company_id' => $company->id, - 'client_id' => $client->id, - 'amount' => $invoice->balance, - 'transaction_reference' => rand(0,500), - 'payment_type_id' => PaymentType::CREDIT_CARD_OTHER, - ]); + if(rand(0, 1)) { + $payment = App\Models\Payment::create([ + 'user_id' => $user->id, + 'company_id' => $company->id, + 'client_id' => $client->id, + 'amount' => $invoice->balance, + 'transaction_reference' => rand(0,500), + 'payment_type_id' => PaymentType::CREDIT_CARD_OTHER, + ]); - $payment->invoices()->save($invoice); + $payment->invoices()->save($invoice); - event(new PaymentWasCreated($payment)); - - UpdateInvoicePayment::dispatchNow($payment); + event(new PaymentWasCreated($payment)); + UpdateInvoicePayment::dispatchNow($payment); + } + }); /** Recurring Invoice Factory */