E-Invoice - Update in export and import of Credit Note report with update of 'Ref' column

This commit is contained in:
Dillon Ngo
2025-09-30 13:50:05 +08:00
parent e0cfeca54b
commit 20cd90c9f0
7 changed files with 85 additions and 47 deletions
+8 -3
View File
@@ -7,6 +7,7 @@ use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\KVPKey;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Booking;
use App\Models\Transaction;
use Carbon\Carbon;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\Log;
@@ -40,9 +41,13 @@ class TransactionResource extends JsonResource
$eInvoice = false;
if($booking && $this->type === TransactionType::REFUND){
$kvp = $this->attributesKVP()->where('key', KVPKey::AUTOCOUNT_DOCNO_CREDIT_NOTE)->first();
if($kvp){
$eInvoice = true;
$kvp = $this->attributesKVP()->where('key', KVPKey::TRANSACTION_MODEL_CLASS)->first();
$transactionCreditNote = Transaction::where('id', $kvp->value)->first();
if($transactionCreditNote){
$kvp = $transactionCreditNote->attributesKVP()->where('key', KVPKey::AUTOCOUNT_DOCNO_CREDIT_NOTE)->first();
if($kvp){
$eInvoice = true;
}
}
}