Refactor invoice query in SendInvoiceDataReport to use groupBy and orderBy for improved data retrieval
This commit is contained in:
@@ -257,7 +257,9 @@ class SendInvoiceDataReport extends Command
|
|||||||
->where('distribution_channel_desc', $selectedDistribution)
|
->where('distribution_channel_desc', $selectedDistribution)
|
||||||
->whereBetween('document_date', [$startDate, $endDate])
|
->whereBetween('document_date', [$startDate, $endDate])
|
||||||
->select('customer_code', 'document_number', 'document_date', 'customer_trade_name', 'customer_location')
|
->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();
|
->get();
|
||||||
|
|
||||||
if ($invoices->isEmpty()) {
|
if ($invoices->isEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user