performa invoice

This commit is contained in:
omair saleh
2021-11-28 21:35:30 +08:00
parent 079eb628da
commit 8dc10f59f2
@@ -63,6 +63,7 @@ class CreateProformaInvoiceTransactionProcessor
/** @var FetchesCompanyPaymentAttemptLimit */
private $fetchesCompanyPaymentAttemptLimit;
/**
* CreateProformaInvoiceTransactionProcessor constructor.
* @param CreatesTransaction $createsTransaction
@@ -106,15 +107,26 @@ class CreateProformaInvoiceTransactionProcessor
->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED])
->first();
$billNumber = $this->generatesTransactionBillNumber->execute('PROFORMA-');
$outstanding = $this->calculatesBookingOutstanding->execute($booking);
$conversionObject = new CurrencyConversionObject(floatval(str_replace(',', '', $outstanding)), $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1, PaymentMethodType::CASH);
$this->generatesBookingQuotation->execute(
$this->fetchesBookingQuotation->execute($booking->company, $conversionObject),
$this->fetchesCompanyPaymentAttemptLimit->execute($booking->company)
);
$configurations = $this->fetchesBookingQuotation->execute($booking->company, $conversionObject);
$paymentAttemptLimit = $this->fetchesCompanyPaymentAttemptLimit->execute($booking->company);
$billNumber = $this->generatesTransactionBillNumber->execute('PYMT-');
$object = new TransactionObject($billNumber, TransactionType::PAYMENT, 1, $booking->company->id,
$configurations->getConfigurations()->getBankId(), $configurations->getConversionObject()->getPaymentMethod(),
$configurations->getTotal(), $configurations->getForeignTotal(), 1,
$configurations->getConversionObject()->getCurrencyId(), $configurations->getConfigurations()->getRate(),
$configurations->getTax(), $configurations->getServiceCharge(), Carbon::now()->addMinutes($paymentAttemptLimit), ApprovalStatus::PENDING_SUBMISSION, [], isset($billPlzBill) ? $billPlzBill->id : NULL);
$this->createsTransaction->execute($booking, $object);
$billNumber = $this->generatesTransactionBillNumber->execute('PROFORMA-');
$payable_amount = $this->calculatesBookingPayableAmount->execute($booking, $booking->fix_currency_id);
$booking_amount = $booking->fix_amount;