diff --git a/app/Console/Commands/SendInvoiceReport.php b/app/Console/Commands/SendInvoiceReport.php index 990674e..27dc626 100644 --- a/app/Console/Commands/SendInvoiceReport.php +++ b/app/Console/Commands/SendInvoiceReport.php @@ -280,8 +280,8 @@ class SendInvoiceReport extends Command $mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name'); - $startDate = now()->setTime(8, 0, 0); - $endDate = now()->copy()->addDay()->setTime(8, 0, 0); + // $startDate = now()->setTime(8, 0, 0); + // $endDate = now()->copy()->addDay()->setTime(8, 0, 0); $serialTableData = []; $materialTableData = []; @@ -293,6 +293,16 @@ class SendInvoiceReport extends Command : [$plantIdArg]; $no = 1; + if (strtolower($schedule) == 'daily') + { + $startDate = now()->subDay()->setTime(8, 0, 0); + $endDate = now()->setTime(8, 0, 0); + } + else + { + $startDate = now()->setTime(8, 0, 0); + $endDate = now()->copy()->addDay()->setTime(8, 0, 0); + } foreach ($plantIds as $plantId) { $plant = Plant::find($plantId); $plantName = $plant ? $plant->name : $plantId;