mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-20 21:13:59 +00:00
fix proforma invoice
This commit is contained in:
+19
-8
@@ -118,14 +118,20 @@ class CreateProformaInvoiceTransactionProcessor
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('PYMT-');
|
||||
|
||||
$transaction = $booking->transactions()
|
||||
->where('type', TransactionType::PAYMENT)
|
||||
->first();
|
||||
|
||||
$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);
|
||||
if (!$transaction) {
|
||||
$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);
|
||||
$this->createsTransaction->execute($booking, $object);
|
||||
}
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('PROFORMA-');
|
||||
|
||||
@@ -160,6 +166,11 @@ class CreateProformaInvoiceTransactionProcessor
|
||||
->whereIn('status', [ApprovalStatus::REJECTED, ApprovalStatus::SUSPENDED])
|
||||
->sum('tax');
|
||||
|
||||
// delete prev proforma transactions
|
||||
$booking->transactions()
|
||||
->where('type', TransactionType::PROFORMA)
|
||||
->delete();
|
||||
|
||||
$transaction_object = new TransactionObject(
|
||||
$billNumber,
|
||||
TransactionType::PROFORMA,
|
||||
@@ -178,11 +189,11 @@ class CreateProformaInvoiceTransactionProcessor
|
||||
ApprovalStatus::APPROVED
|
||||
);
|
||||
|
||||
$perofrma_transaction = $this->createsTransaction->execute($po_order_transaction->booking, $transaction_object);
|
||||
$proforma_transaction = $this->createsTransaction->execute($po_order_transaction->booking, $transaction_object);
|
||||
|
||||
$supplier = $this->fetchesCompany->execute(['id' => $transaction->receiver]);
|
||||
|
||||
$purchase_order_pdf = LaravelMpdf::loadView('pages.pdfs.proforma_invoice', ['invoice_transaction' => $perofrma_transaction, 'po_order_transaction' => $po_order_transaction, 'supplier' => $supplier]);
|
||||
$purchase_order_pdf = LaravelMpdf::loadView('pages.pdfs.proforma_invoice', ['invoice_transaction' => $proforma_transaction, 'po_order_transaction' => $po_order_transaction, 'supplier' => $supplier]);
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::PROFORMA_INVOICE,
|
||||
[chunk_split('data:application/pdf;base64,'.base64_encode($purchase_order_pdf->output()))],
|
||||
|
||||
Reference in New Issue
Block a user