export based on payment date

This commit is contained in:
Omair Saleh
2024-07-01 12:57:23 +08:00
parent dcec8cb33b
commit c8b6e271e3
@@ -81,10 +81,13 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
$query->whereIn('type', [TransactionType::SHIPPING_INVOICE, TransactionType::STORAGE_INVOICE])->whereIn('status', [$approvalStatus]); $query->whereIn('type', [TransactionType::SHIPPING_INVOICE, TransactionType::STORAGE_INVOICE])->whereIn('status', [$approvalStatus]);
if($start_date && $end_date) { if($start_date && $end_date) {
$query->whereBetween('updated_at', [ $query->whereHas('transactions', function($transaction) use ($start_date, $end_date) {
Carbon::parse($start_date)->format('Y-m-d 0:00:00'), $transaction->where('type', TransactionType::PAYMENT)
Carbon::parse($end_date)->format('Y-m-d 23:59:59') ->whereBetween('updated_at', [
]); Carbon::parse($start_date)->format('Y-m-d 0:00:00'),
Carbon::parse($end_date)->format('Y-m-d 23:59:59')
]);
});
} }
elseif($start_date && !$end_date) { elseif($start_date && !$end_date) {
$query->whereHas('transactions', function($transaction) use ($start_date) { $query->whereHas('transactions', function($transaction) use ($start_date) {