Refactor invoice query in SendInvoiceDataReport to use groupBy and orderBy for improved data retrieval

This commit is contained in:
dhanabalan
2025-11-06 13:58:19 +05:30
parent f82dd74d9d
commit 11ab8ce326

View File

@@ -257,7 +257,9 @@ class SendInvoiceDataReport extends Command
->where('distribution_channel_desc', $selectedDistribution)
->whereBetween('document_date', [$startDate, $endDate])
->select('customer_code', 'document_number', 'document_date', 'customer_trade_name', 'customer_location')
->distinct('document_number')
//->distinct('document_number')
->groupBy('customer_code', 'document_number', 'document_date', 'customer_trade_name', 'customer_location')
->orderBy('document_date', 'asc')
->get();
if ($invoices->isEmpty()) {