fix rack do's

This commit is contained in:
omair saleh
2022-04-14 11:55:12 +08:00
parent 4e5fc70eea
commit e3da93807b
+2 -3
View File
@@ -100,16 +100,15 @@ Route::get('/products', function (\App\Classes\Modules\Exports\Services\ExportsP
Route::get('/fix_bills', function () {
ini_set('max_execution_time', '1000000');
Auth()->login(User::find(1));
$bookings = \App\Models\Booking::whereHas('transactions', function ($query){
$bookings = \App\Models\Booking::where('status', 3)->whereHas('transactions', function ($query){
return $query->where('type', 1)->whereHas('transactions', function($query){
return $query->where('type', 3)->where('issuer', 2210);
});
})->get();
foreach ($bookings as $booking){
// $booking->documents()->where('document_type', DocumentType::SUPPLIER_DELIVER_ORDER)->delete();
$booking->documents()->where('document_type', DocumentType::SUPPLIER_DELIVER_ORDER)->delete();
$po = $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->first();
$supplier_deliver_order_transaction = $booking->transactions()->where('type', TransactionType::SUPPLIER_DELIVER)->first();
dd($supplier_deliver_order_transaction);
$supplier = Company::find($booking->transactions()->where('type', TransactionType::PAYMENT)->where('status', 3)->first()->transactions()->first());
$supplier_order_pdf = LaravelMpdf::loadView('pages.pdfs.supplier_deliver_order', ['supplier_deliver_order_transaction' => $supplier_deliver_order_transaction, 'po_order_transaction' => $po, 'supplier' => $supplier]);
$document_object = new DocumentObject(