mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Fix invoice trasaction bill_no messed up reported by Mira
This commit is contained in:
+14
-8
@@ -234,14 +234,20 @@ class CreateInvoiceTransactionV2Processor
|
|||||||
}
|
}
|
||||||
|
|
||||||
$invoice_transaction = null;
|
$invoice_transaction = null;
|
||||||
if($booking->status === ApprovalStatus::APPROVED){
|
// if($booking->status === ApprovalStatus::APPROVED){
|
||||||
//NEW INVOICE for non-einvoice user applicable only when booking is completed
|
// //NEW INVOICE for non-einvoice user applicable only when booking is completed
|
||||||
$invoice_transaction = $booking->transactions()
|
// $invoice_transaction = $booking->transactions()
|
||||||
->where('type', TransactionType::INVOICE)
|
// ->where('type', TransactionType::INVOICE)
|
||||||
->complete()
|
// ->complete()
|
||||||
->latest()
|
// ->latest()
|
||||||
->first();
|
// ->first();
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
$invoice_transaction = $booking->transactions()
|
||||||
|
->whereIn('type', [TransactionType::INVOICE])
|
||||||
|
->complete()
|
||||||
|
->latest()
|
||||||
|
->first();
|
||||||
|
|
||||||
if(!$invoice_transaction) {
|
if(!$invoice_transaction) {
|
||||||
$transaction_object = new TransactionObject(
|
$transaction_object = new TransactionObject(
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\V2;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Classes\Jobs\Commands\V2\CreateInvoiceTransactionV2CommandJob;
|
||||||
|
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 TestCreateEInvoiceV2Command extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected $signature = 'test-create-einvoice-command';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Test Create 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('marking', ['644794'])->get();
|
||||||
|
$bookings = Booking::whereIn('marking', ['507945'])->get();
|
||||||
|
|
||||||
|
$count = 0;
|
||||||
|
foreach ($bookings as $booking) {
|
||||||
|
CreateInvoiceTransactionV2CommandJob::dispatch($booking);
|
||||||
|
$count++;
|
||||||
|
Log::info('Processed: ' . $count);
|
||||||
|
Log::info('Booking ID: ' . $booking->marking . ' for E-Invoice ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user