From 3b18411141dc1ed4987032361be3dcbb8d2ea639 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Thu, 31 Jul 2025 15:00:03 +0530 Subject: [PATCH] Added logic for invoice report for daily report --- app/Console/Commands/SendInvoiceReport.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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;