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/staging
This commit is contained in:
+11
-12
@@ -138,19 +138,18 @@ class CreateInvoiceTransactionV2Processor
|
||||
// return;
|
||||
}
|
||||
|
||||
$purchaseOrder = null;
|
||||
if($generateEInvoiceRefund){
|
||||
$purchaseOrder = $booking->transactions()
|
||||
->where('type', TransactionType::PURCHASE_ORDER)
|
||||
->complete()
|
||||
->first();
|
||||
|
||||
if(!$purchaseOrder){
|
||||
//was use for $generateEInvoiceRefund true
|
||||
$purchaseOrder = $booking->transactions()
|
||||
->where('type', TransactionType::PURCHASE_ORDER)
|
||||
->where('status', ApprovalStatus::PENDING_SUBMISSION)
|
||||
->first();
|
||||
}
|
||||
else{
|
||||
$purchaseOrder = $booking->transactions()
|
||||
->where('type', TransactionType::PURCHASE_ORDER)
|
||||
->complete()
|
||||
->first();
|
||||
}
|
||||
|
||||
$constants = SegmentConstant::where('reference', SegmentConstants::SERVICE_TYPE)->where('detail->id', $booking->service->id)->first();
|
||||
// if ($constants->detail->is_billable && !$purchaseOrder && !$generateEInvoiceRefund) {
|
||||
@@ -330,14 +329,14 @@ class CreateInvoiceTransactionV2Processor
|
||||
}
|
||||
}
|
||||
|
||||
//if(!$generateEInvoiceRefund){
|
||||
$this->updatesBookingStatus->execute($booking, $bookingOriginalStatus);
|
||||
//}
|
||||
|
||||
// update perfex crm
|
||||
// if(config('perfexcrm.is_enabled') == 'true'){
|
||||
// CreatePerfexCRMInvoice::dispatch($invoice_transaction, $purchaseOrder, $supplier);
|
||||
// }
|
||||
}
|
||||
|
||||
//if(!$generateEInvoiceRefund){
|
||||
$this->updatesBookingStatus->execute($booking, $bookingOriginalStatus);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?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 OneTimeProcessBookingForEInvoiceV2Command extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
||||
protected $signature = 'one-time-process-booking-for-einvoice-command';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'One time batch process 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', ['821671', '773802','106426'])->get();
|
||||
|
||||
$count = 0;
|
||||
foreach ($bookings as $booking) {
|
||||
ProcessBookingForEInvoiceV2CommandJob::dispatch($booking);
|
||||
$count++;
|
||||
Log::info('Processed: ' . $count);
|
||||
Log::info('Booking ID: ' . $booking->marking . ' for E-Invoice ');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user