mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-21 05:23:58 +00:00
E-Invoice - Automapping Issues, Credit Note Report (Import) Partial Completion
This commit is contained in:
@@ -314,9 +314,21 @@ class ImportExcelLogic extends AbstractControllerLogic
|
||||
$booking = Booking::where('marking', $ref)->first();
|
||||
if($booking){
|
||||
if($docNo != "" && $docNo != "<<New>>"){
|
||||
$this->updateOrCreateKeyValuePair($booking, KVPKey::AUTOCOUNT_DOCNO_CREDIT_NOTE, $docNo);
|
||||
if($eInvoiceValidationLink){
|
||||
$this->updateOrCreateKeyValuePair($booking, KVPKey::AUTOCOUNT_EINVOICE_VALIDATION_LINK_CREDIT_NOTE, $eInvoiceValidationLink);
|
||||
$payments = $booking->transactions()->payments()->get();
|
||||
$processed = false;
|
||||
foreach ($payments as $payment) {
|
||||
$refundTransaction = $payment->transactions()->refunds()->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->latest()->first();
|
||||
if($refundTransaction){
|
||||
$this->updateOrCreateKeyValuePair($refundTransaction, KVPKey::AUTOCOUNT_DOCNO_CREDIT_NOTE, $docNo);
|
||||
if($eInvoiceValidationLink){
|
||||
$this->updateOrCreateKeyValuePair($refundTransaction, KVPKey::AUTOCOUNT_EINVOICE_VALIDATION_LINK_CREDIT_NOTE, $eInvoiceValidationLink);
|
||||
}
|
||||
$processed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!$processed){
|
||||
$unprocessedDocNos[] = $docNo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
-12
@@ -94,20 +94,24 @@ class GenerateCreditNotePdfV2Logic
|
||||
if($eInvoiceStarted) {
|
||||
$eInvoiceStarted = false; //reset to re-evaluate second time
|
||||
|
||||
$metadata = $booking->attributesKVP()->where('key', KVPKey::AUTOCOUNT_DOCNO_CREDIT_NOTE)->first();
|
||||
if($metadata){
|
||||
$autoCountInvoiceId = $metadata->value;
|
||||
}
|
||||
$metadata = $booking->attributesKVP()->where('key', KVPKey::AUTOCOUNT_EINVOICE_VALIDATION_LINK_CREDIT_NOTE)->first();
|
||||
if($metadata){
|
||||
$autoCountEInvoiceValidationLink = $metadata->value;
|
||||
}
|
||||
$kvp = KeyValuePair::where('key', KVPKey::TRANSACTION_MODEL_CLASS)->where('value', $transaction->id)->first();
|
||||
$refundTransaction = $kvp ? $kvp->owner : null;
|
||||
if($refundTransaction && $refundTransaction->type === TransactionType::REFUND){
|
||||
$metadata = $refundTransaction->attributesKVP()->where('key', KVPKey::AUTOCOUNT_DOCNO_CREDIT_NOTE)->first();
|
||||
if($metadata){
|
||||
$autoCountInvoiceId = $metadata->value;
|
||||
}
|
||||
$metadata = $refundTransaction->attributesKVP()->where('key', KVPKey::AUTOCOUNT_EINVOICE_VALIDATION_LINK_CREDIT_NOTE)->first();
|
||||
if($metadata){
|
||||
$autoCountEInvoiceValidationLink = $metadata->value;
|
||||
}
|
||||
|
||||
Log::info('AUTOCOUNT_DOCNO_CREDIT_NOTE: ' . $autoCountInvoiceId);
|
||||
Log::info('AUTOCOUNT_EINVOICE_VALIDATION_LINK_CREDIT_NOTE: ' . $autoCountEInvoiceValidationLink);
|
||||
Log::info('AUTOCOUNT_DOCNO_CREDIT_NOTE: ' . $autoCountInvoiceId);
|
||||
Log::info('AUTOCOUNT_EINVOICE_VALIDATION_LINK_CREDIT_NOTE: ' . $autoCountEInvoiceValidationLink);
|
||||
|
||||
if($autoCountInvoiceId && $autoCountEInvoiceValidationLink){
|
||||
$eInvoiceStarted = true;
|
||||
if($autoCountInvoiceId && $autoCountEInvoiceValidationLink){
|
||||
$eInvoiceStarted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class TransactionResource extends JsonResource
|
||||
|
||||
$eInvoice = false;
|
||||
if($booking && $this->type === TransactionType::REFUND){
|
||||
$kvp = $booking->attributesKVP()->where('key', KVPKey::AUTOCOUNT_DOCNO_CREDIT_NOTE)->first();
|
||||
$kvp = $this->attributesKVP()->where('key', KVPKey::AUTOCOUNT_DOCNO_CREDIT_NOTE)->first();
|
||||
if($kvp){
|
||||
$eInvoice = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user