fix Supplier delivery order

This commit is contained in:
omair saleh
2022-02-13 14:54:07 +08:00
parent 36ff2c3be0
commit 2cfeea79cc
2 changed files with 18 additions and 6 deletions
@@ -210,6 +210,10 @@ class CreateInvoiceTransactionProcessor
$booking_currency_average_rate = $this->calculatesBookingCurrencyAverageRate->execute($booking, TransactionType::BILL);
$transaction = $booking->transactions()
->where('type', TransactionType::BILL)
->first();
$transaction_object = new TransactionObject(
$billNumber,
TransactionType::SUPPLIER_DELIVER,
+14 -6
View File
@@ -2,6 +2,7 @@
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Booking;
use App\Models\Transaction;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
@@ -87,10 +88,17 @@ Route::get('/products', function (\App\Classes\Modules\Exports\Services\ExportsP
return $exportsProducts->download('products.csv', Excel::CSV, ['Content-Type' => 'text/csv']);
})->name('products.random');
Route::get('/fix_bills', function () {
Auth()->login(User::find(1));
$supplierDo = Transaction::where('type', TransactionType::SUPPLIER_DELIVER)->where('issuer', 1)->withTrashed()->get();
foreach ($supplierDo as $do){
$bill = $do->owner->transactions()
->where('type', TransactionType::BILL)
->first();
$do->issuer = $bill->issuer;
$do->receiver = $bill->receiver;
$do->save();
}
//Route::get('/duplicated_bills', function (Request $request) {
// Auth()->login(User::find(1));
// $bookings = Booking::whereIn('id', [10391, 10275, 10109, 10108, 10070, 10066, 10063, 9801, 9166, 8895, 8790, 8544, 8264, 6957, 5409, 4717])->with('transactions')->pluck('marking');
// dd($bookings);
//
//})->name('x2.data');
})->name('products.random');