Update end date calculation in SendInvoiceDataReport to add one day and set time to 10:00 AM

This commit is contained in:
dhanabalan
2025-11-07 23:14:11 +05:30
parent f6c2f10f5a
commit e38c96f2ca

View File

@@ -90,7 +90,10 @@ class SendInvoiceDataReport extends Command
if ($firstRecord && $lastRecord) { if ($firstRecord && $lastRecord) {
$startDate = \Carbon\Carbon::parse($firstRecord->document_date)->startOfDay(); $startDate = \Carbon\Carbon::parse($firstRecord->document_date)->startOfDay();
$endDate = \Carbon\Carbon::parse($lastRecord->document_date)->endOfDay(); //$endDate = \Carbon\Carbon::parse($lastRecord->document_date)->endOfDay();
$endDate = \Carbon\Carbon::parse($lastRecord->document_date)
->addDay()
->setTime(10, 0, 0);
} }
else else
{ {
@@ -127,6 +130,11 @@ class SendInvoiceDataReport extends Command
continue; continue;
} }
// $lastInvoiceDate = $invoices->max('document_date');
// $extendedEndDate = \Carbon\Carbon::parse($lastInvoiceDate)
// ->addDay() // +1 day
// ->setTime(10, 0, 0); // 10:00 AM
// Filter invoices directly — exclude ones with '-' in document_number // Filter invoices directly — exclude ones with '-' in document_number
$invoices = $invoices->filter(function ($inv) { $invoices = $invoices->filter(function ($inv) {