mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-21 13:33:57 +00:00
Merge branch 'dillon/90-e-invoice-e' into vapor/development
This commit is contained in:
@@ -105,5 +105,19 @@ class ProcessBookingForEInvoiceV2CommandJob implements ShouldQueue
|
||||
$firstInvoiceTrx->bill_no = explode('-deleted-', $firstInvoiceTrx->bill_no)[0];
|
||||
$firstInvoiceTrx->save();
|
||||
}
|
||||
else{
|
||||
$transaction = $this->booking->transactions()->whereIn('type', [TransactionType::INVOICE]);
|
||||
Log::info('count again making sure there is an invoice: ' . $transaction->count());
|
||||
if($transaction->count() === 0){
|
||||
$firstInvoiceTrx = $this->booking->transactions()
|
||||
->whereIn('type', [TransactionType::INVOICE])
|
||||
->withTrashed()
|
||||
->orderBy('created_at', 'asc')
|
||||
->first();
|
||||
$firstInvoiceTrx->restore();
|
||||
$firstInvoiceTrx->bill_no = explode('-deleted-', $firstInvoiceTrx->bill_no)[0];
|
||||
$firstInvoiceTrx->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -92,7 +92,10 @@ class BatchBookingsGenerateEInvoiceLogic extends AbstractControllerLogic
|
||||
|
||||
foreach ($bookings as $booking) {
|
||||
// Log::info('Booking ID: ' . $booking->marking);
|
||||
ProcessBookingForEInvoiceV2CommandJob::dispatch($booking);
|
||||
//if($booking->marking === '833065' || $booking->marking === '798334'){ //798334, 833065
|
||||
ProcessBookingForEInvoiceV2CommandJob::dispatch($booking);
|
||||
//}
|
||||
|
||||
}
|
||||
$this->processedCount = count($bookings);
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\V2;
|
||||
|
||||
|
||||
use App\Classes\Jobs\Commands\V2\OneTimeBatchProcessEInvoicesV2CommandJob;
|
||||
use App\Classes\Jobs\Commands\V2\ProcessBookingForEInvoiceV2CommandJob;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\Booking;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class RegenerateInvoiceEInvoiceV2Comman extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
||||
protected $signature = 'regenerate-invoice-einvoice-command';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Regenerate Invoice E-Invoices';
|
||||
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$bookings = Booking::whereIn('invoice_status', [ApprovalStatus::APPROVED])->whereIn('status', [ApprovalStatus::APPROVED])->get();
|
||||
|
||||
$count = 0;
|
||||
foreach ($bookings as $booking) {
|
||||
$count++;
|
||||
$start = Carbon::parse('2026-03-05 04:00:00');
|
||||
$end = Carbon::parse('2026-03-05 05:00:00');
|
||||
|
||||
if ($booking->updated_at->between($start, $end)) {
|
||||
Log::info('Processed: ' . $count . ', Booking ID: ' . $booking->marking . ', Booking updated: ' . $booking->updated_at);
|
||||
$booking->status = 3;
|
||||
$booking->save();
|
||||
}
|
||||
Log::info('Processed: ' . $count . ', Booking ID: ' . $booking->marking . ', Booking ID: ' . $booking->marking);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user