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]);
if($start_date && $end_date) {
$query->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')
]);
$query->whereHas('transactions', function($transaction) use ($start_date, $end_date) {
$transaction->where('type', TransactionType::PAYMENT)
->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) {
$query->whereHas('transactions', function($transaction) use ($start_date) {