add overdue

This commit is contained in:
radhika587
2022-03-02 18:09:41 +05:30
parent 3908878109
commit 2cb51b84c7
11 changed files with 52 additions and 42 deletions

View File

@ -41,11 +41,12 @@ class CheckInvoiceStatus extends Command
{
$date = Carbon::now();
$invoices = Invoice::whereNotIn('status', [Invoice::STATUS_COMPLETED, Invoice::STATUS_DRAFT])
->where('overdue', false)
->whereDate('due_date', '<', $date)
->get();
foreach ($invoices as $invoice) {
$invoice->status = Invoice::STATUS_OVERDUE;
$invoice->overdue = true;
printf("Invoice %s is OVERDUE \n", $invoice->invoice_number);
$invoice->save();
}