fix proforma invoice currency rate

This commit is contained in:
Omair Saleh
2022-09-30 13:40:18 +08:00
parent 2f9b63ba70
commit 30ca010f3f
@@ -135,12 +135,11 @@ class CreateProformaInvoiceTransactionProcessor
$transaction = $booking->transactions()
->where('type', TransactionType::PAYMENT)
->first();
dd($booking->transactions()->payments()->get());
dd($booking->transactions()->payments()->where(function($query){
return $query->where(function($query){
return $query->where('status', ApprovalStatus::PENDING_SUBMISSION)->whereDate('expires_on', '>', Carbon::now())->get();
});
})->selectRaw('sum(amount - service_charge - tax) as sub_total')->get()->sum('sub_total'));
})->get());
$booking_currency_average_rate = $this->calculatesBookingPayableAmount->execute($booking, $booking->fix_currency_id) / $booking->transactions()->payments()->where(function($query){
return $query->where('status', ApprovalStatus::PENDING_SUBMISSION)->whereDate('expires_on', '>', Carbon::now())->get();
})->orWhere(function($query){