mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Merge branch 'dillon/90-e-invoice-e' into vapor/development
This commit is contained in:
Vendored
+20
-1
@@ -120,10 +120,29 @@ pipeline {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
sh 'docker image prune -a -f'
|
||||
sh '''
|
||||
echo "Starting Docker cleanup..."
|
||||
|
||||
# Remove stopped containers
|
||||
docker container prune -f
|
||||
|
||||
# Remove unused networks
|
||||
docker network prune -f
|
||||
|
||||
# Remove unused images
|
||||
docker image prune -a -f
|
||||
|
||||
# Remove unused build cache
|
||||
docker builder prune -f
|
||||
|
||||
echo "Docker cleanup completed."
|
||||
|
||||
docker system df
|
||||
'''
|
||||
} catch (Exception e) {
|
||||
echo "Error during cleanup: ${e.message}"
|
||||
}
|
||||
|
||||
currentBuild.description = 'Step 6 of 6 Completed'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ use App\Http\Resources\BookingResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class RegenerateInvoiceBookingLogic extends AbstractControllerLogic
|
||||
@@ -81,15 +82,16 @@ class RegenerateInvoiceBookingLogic extends AbstractControllerLogic
|
||||
|
||||
$eInvoiceWithNormalInvoiceTemplate = $request->input('normal_invoice', false);
|
||||
$eInvoiceRefund = $request->input('e_invoice_refund', false);
|
||||
$eInvoiceTry = $request->input('e_invoice_try', false);
|
||||
|
||||
if(!$eInvoiceRefund){
|
||||
if(!$eInvoiceRefund && !$eInvoiceTry){
|
||||
if($booking->status !== ApprovalStatus::COMPLETED){
|
||||
throw new MalformedRequestException('Booking incomplete.');
|
||||
}
|
||||
}
|
||||
|
||||
// if($eInvoiceRefund){
|
||||
$this->regenerateInvoiceBookingV2Processor->execute($booking, $eInvoiceWithNormalInvoiceTemplate, $eInvoiceRefund);
|
||||
$this->regenerateInvoiceBookingV2Processor->execute($booking, $eInvoiceWithNormalInvoiceTemplate, $eInvoiceRefund, $eInvoiceTry);
|
||||
// }
|
||||
// else{
|
||||
// $this->regenerateInvoiceBookingProcessor->execute($booking, $eInvoiceWithNormalInvoiceTemplate);
|
||||
|
||||
@@ -10,6 +10,7 @@ use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionV2Proces
|
||||
use Illuminate\Support\Str;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
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;
|
||||
@@ -51,10 +52,16 @@ class RegenerateInvoiceBookingV2Processor
|
||||
|
||||
public function execute(Booking $booking,
|
||||
bool $eInvoiceWithNormalInvoiceTemplate = false,
|
||||
bool $eInvoiceWithRefund = false)
|
||||
bool $eInvoiceWithRefund = false, bool $eInvoiceTry = false)
|
||||
{
|
||||
$bookingOriginalStatus = $booking->status;
|
||||
|
||||
if($eInvoiceTry){
|
||||
if($booking->invoice_status === ApprovalStatus::APPROVED){
|
||||
$bookingOriginalStatus = ApprovalStatus::COMPLETED;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$eInvoiceWithRefund){
|
||||
$this->updatesBookingStatus->execute($booking, ApprovalStatus::APPROVED);
|
||||
}
|
||||
@@ -70,6 +77,13 @@ class RegenerateInvoiceBookingV2Processor
|
||||
->latest()
|
||||
->first();
|
||||
|
||||
// if($eInvoiceTry){
|
||||
// $kvpQuery = $latestInvoice->attributesKVP()->where('key', KVPKey::AUTOCOUNT_DOCNO_INVOICE);
|
||||
// if($kvpQuery->exists()){
|
||||
// $this->updateOrCreateKeyValuePair($booking, KVPKey::BOOKING_EINVOICE_ELIGIBLE, '1');
|
||||
// }
|
||||
// }
|
||||
|
||||
Log::info('RegenerateInvoiceBookingV2Processor booking: ' . json_encode($booking->marking));
|
||||
|
||||
// get the first bill_no
|
||||
@@ -135,4 +149,12 @@ class RegenerateInvoiceBookingV2Processor
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
private function updateOrCreateKeyValuePair($booking, $key, $value)
|
||||
{
|
||||
$booking->attributesKVP()->updateOrCreate(
|
||||
['key' => $key],
|
||||
['value' => $value]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +163,11 @@ class CreateInvoiceDocumentProcessor
|
||||
foreach ($purchaseOrderDocuments as $document){
|
||||
$currentFile = $document->files()->first()->file->file_info->original->file;
|
||||
if($filesystemDriver === 's3'){
|
||||
if (!Storage::disk('s3')->exists($currentFile)) {
|
||||
Log::error('S3 file missing: ' . $currentFile);
|
||||
continue;
|
||||
}
|
||||
|
||||
Log::info('CreateInvoiceDocumentProcessor 1: ' . $currentFile);
|
||||
$fileContent = Storage::disk('s3')->get($currentFile);
|
||||
$filepath = storage_path('app/documents/' . $currentFile);
|
||||
|
||||
@@ -26,4 +26,13 @@ class RegenerateBookingEInvoiceController
|
||||
public function batchProcess(Request $request, BatchBookingsGenerateEInvoiceLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param RegenerateInvoiceBookingLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function tryRegenerate(Request $request, RegenerateInvoiceBookingLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col bg-white padding-40 b-rad-lg">
|
||||
<loading-component style="height: 300px; top: 0;" key="1" color="success" v-show="isLoading" ></loading-component>
|
||||
<div class="row justify-content-center" v-show="!isLoading">
|
||||
<div class="col">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<h3 class="all-caps">Are you Sure?</h3>
|
||||
<div class="fs-11">Are you sure you want to try to regenerate the e-invoice for this payment?</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div class="btn btn-sm btn-success btn-block b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-sm btn-danger btn-block b-rad-none" @click="submitForm()">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
export default {
|
||||
methods: {
|
||||
submitForm() {
|
||||
this.parameters.normal_invoice = false;
|
||||
this.parameters.e_invoice_try = true;
|
||||
this.submit(this.route('api.booking.einvoice.try.regenerate', this.data.id), 'post', this.section, true, true);
|
||||
},
|
||||
successHandler(){
|
||||
this.closeModal();
|
||||
this.$store.dispatch('reloadList', {'name': "bookingDetailSection"});
|
||||
}
|
||||
},
|
||||
mixins: [componentHandler, ModalFormHandler]
|
||||
}
|
||||
</script>
|
||||
@@ -427,6 +427,14 @@
|
||||
<regenerate-e-invoice-component :data="booking" :section="section" class="text-center"></regenerate-e-invoice-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
<div class="row m-t-15" v-if="booking.status === 2 && ($store.getters.isSuperAdmin) && this.$store.getters.getUserId && this.$store.getters.getUserId === 5436">
|
||||
<div class="col-sm col-md-auto">
|
||||
<div class="btn btn-sm btn block all-caps b-rad-none btn-danger pointer requestModal equal-width-button" data-type="regenerateEInvoice">Regenerate E-Inv (Try)</div>
|
||||
</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="regenerateEInvoice">
|
||||
<regenerate-e-invoice-try-component :data="booking" :section="section" class="text-center"></regenerate-e-invoice-try-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
<div class="row m-t-15" v-if="booking.status === 3 && ($store.getters.isSuperAdmin || ($store.getters.isCustomer && $store.getters.getCompanyId === 199)) && booking.einvoice">
|
||||
<div class="col-sm col-md-auto">
|
||||
<div class="btn btn-sm btn block all-caps b-rad-none btn-danger pointer requestModal equal-width-button" data-type="regenerateNormalInvoiceEInvoice">Regenerate Normal Inv</div>
|
||||
|
||||
@@ -56,6 +56,7 @@ Route::group(['prefix' => 'booking', 'as' => 'booking.', 'namespace' => 'Booking
|
||||
});
|
||||
Route::group(['prefix' => '{id}/einvoice', 'as' => 'einvoice.'], function () {
|
||||
Route::post('/', [RegenerateBookingEInvoiceController::class, 'regenerate'])->name('regenerate');
|
||||
Route::post('/try', [RegenerateBookingEInvoiceController::class, 'tryRegenerate'])->name('try.regenerate');
|
||||
});
|
||||
Route::group(['prefix' => 'batch/einvoice', 'as' => 'batch.'], function () {
|
||||
Route::get('/process', [RegenerateBookingEInvoiceController::class, 'batchProcess'])->name('process');
|
||||
|
||||
Reference in New Issue
Block a user