fix regenerate invoice

This commit is contained in:
edmondlang
2023-09-07 00:26:09 +08:00
parent 2e7b994dea
commit d0d901d7ab
+3 -2
View File
@@ -492,16 +492,17 @@ Route::get('/invoice/fix', function(){
Booking::where('status', ApprovalStatus::COMPLETED)
->whereDate('updated_at', '>=', Carbon::parse('01-01-2023'))
->orderBy('id')
->chunk(100, function ($bookings) use ($processed_invoice){
->chunk(100, function ($bookings) use (&$processed_invoice) {
foreach ($bookings as $booking) {
Log::channel('regenerateInvoice')->info('Counter ' . $processed_invoice);
dump('Counter ' . $processed_invoice);
$processed_invoice += 1;
if ($booking->transactions()->where('transactions.type', TransactionType::INVOICE)
->first()
->created_at
->greaterThanOrEqualTo(Carbon::parse('2023-09-06'))) {
->greaterThanOrEqualTo(Carbon::parse('2023-09-07'))) {
continue;
}