mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
regenerate invoices for 2023
This commit is contained in:
+3
-6
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Classes\Jobs\GenerateInvoice;
|
||||
use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionProcessor;
|
||||
use App\Http\Controllers\Accounting\BankStatementController;
|
||||
use Carbon\Carbon;
|
||||
@@ -469,12 +470,8 @@ Route::get('/invoice/fix', function(){
|
||||
$bookings = Booking::where('status', ApprovalStatus::COMPLETED)->whereDate('updated_at', '>=', Carbon::parse('01-01-2023'))->get();
|
||||
|
||||
foreach($bookings as $booking){
|
||||
$booking->transactions()->whereIn('transactions.type', [TransactionType::INVOICE, TransactionType::SUPPLIER_DELIVER])->delete();
|
||||
$booking->documents()->whereIn('document_type', [DocumentType::INVOICE, DocumentType::PURCHASE_ORDER, DocumentType::DELIVER_ORDER, DocumentType::SUPPLIER_DELIVER_ORDER])->delete();
|
||||
$booking->status = ApprovalStatus::APPROVED;
|
||||
$booking->save();
|
||||
|
||||
(App()->make(CreateInvoiceTransactionProcessor::class))->execute($booking);
|
||||
GenerateInvoice::dispatch($booking);
|
||||
return 'Invoice fixing job dispatched.';
|
||||
}
|
||||
})->name('invoice.fix');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user