performa invoice

This commit is contained in:
omair saleh
2021-11-28 21:23:27 +08:00
parent f017b30db4
commit 6163afc862
2 changed files with 4 additions and 1 deletions
@@ -54,6 +54,7 @@ class CreateProformaInvoiceTransactionLogic extends AbstractControllerLogic
* @param Request $request
* @return JsonResponse
* @throws \App\Classes\Exceptions\AccessForbiddenException
* @throws \App\Classes\Exceptions\MalformedRequestException
* @throws \App\Classes\Exceptions\RequestValidationException
*/
public function logic(Request $request) : JsonResponse
@@ -123,7 +123,9 @@ class CreateProformaInvoiceTransactionProcessor
->where('type', TransactionType::PAYMENT)
->first();
$booking_currency_average_rate = $this->calculatesBookingCurrencyAverageRate->execute($booking, TransactionType::PAYMENT);
$totalPayment = $booking->fix_currency_id === 1 ? $booking->transactions()->payments()->complete()->sum('original_amount') :
$booking->transactions()->payments()->selectRaw('sum(amount - service_charge - tax) as sub_total')->get()->sum('sub_total');
$booking_currency_average_rate = $this->calculatesBookingPayableAmount->execute($booking, $booking->fix_currency_id) / $totalPayment;
$total_service_charge = $booking->transactions()
->where('type', TransactionType::PAYMENT)