E-Invoice - Update 'Process E-Invoice' date range filtering target

This commit is contained in:
Dillon Ngo
2025-11-06 22:40:16 +08:00
parent 7f94148ed9
commit 650cfba74a
@@ -63,11 +63,15 @@ class CreateBatchProcessingAutoCountImportLogic extends AbstractControllerLogic
$query->whereIn('type', [TransactionType::SHIPPING_INVOICE, TransactionType::STORAGE_INVOICE])
->where('status', $approvalStatus);
$transactions = $query->whereHas('transactions', function($transaction) use ($startDate, $endDate) {
$transaction->where('type', TransactionType::PAYMENT)
->whereBetween('updated_at', [$startDate, $endDate])
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
})->get();
// $transactions = $query->whereHas('transactions', function($transaction) use ($startDate, $endDate) {
// $transaction->where('type', TransactionType::PAYMENT)
// ->whereBetween('updated_at', [$startDate, $endDate])
// ->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
// })->get();
Log::info('CreateBatchProcessingAutoCountImportLogic startDate: ' . json_encode($startDate));
Log::info('CreateBatchProcessingAutoCountImportLogic endDate: ' . json_encode($endDate));
$transactions = $query->whereBetween('created_at', [$startDate, $endDate])->get();
$count = 0;
foreach ($transactions as $transaction) {