name('login'); Route::get('/signup', function () { return view('pages.accounts.sign_up'); })->name('signup'); Route::get('/account/email/verification/{token}', function ($token) { return view('pages.accounts.email_verified', ['token' => $token]); })->name('account.email.verification'); Route::get('/account/password/reset/{token}', function ($token) { return view('pages.accounts.reset_password', ['token' => $token]); })->name('account.password.reset'); Route::get('/dashboard', function () { return view('pages.dashboards.index'); })->name('dashboard'); Route::get('/banks', function () { return view('pages.banks.index'); })->name('banks'); Route::get('/settings', function () { return view('pages.settings'); })->name('settings'); Route::get('/customers', function () { return view('pages.customers.index'); })->name('customers'); Route::get('/customer/{marking}', function ($marking) { $id = \App\Models\Company::where('reference', '=', $marking)->first()->id; return view('pages.customers.profile', ['id' => $id]); })->name('customer.profile'); Route::get('/payments', function () { return view('pages.payments'); })->name('payments'); Route::get('/billings', function () { return view('pages.billings'); })->name('billings'); Route::get('/currency_orders', function () { return view('pages.currency_orders'); })->name('currency_orders'); Route::get('/transfers', function () { return view('pages.bookings.index'); })->name('bookings'); Route::get('/bookings/urgent', function () { return view('pages.urgent_list'); })->name('bookings.urgent'); Route::get('/transfer/{marking}', function ($marking) { return view('pages.bookings.profile', ['marking' => $marking]); })->name('booking.details'); Route::get('/transfer/merge/{marking}', function ($marking) { return view('pages.bookings.merge', ['marking' => $marking]); })->name('booking.merge'); Route::get('/purchase_orders', function () { return view('pages.purchase_orders'); })->name('purchase_orders'); Route::get('/support', function () { return view('pages.customer_support', [ 'marking' => null, 'email' => null, 'bookingReference' => null, 'company' => null, 'booking' => null ]); })->name('support'); Route::post('/support', function (Request $request) { $marking = $request->input('marking'); $email = $request->input('customer_email'); $bookingReference = $request->input('booking_reference'); $company = null; $booking = null; if($email) { $company = Company::whereHas('Employees', function($user) use($email) { return $user->where('email', $email); })->first(); } if($marking) { $company = Company::where('reference', $marking)->first(); } if($bookingReference) { $booking = Booking::where('marking', $bookingReference)->first(); $company = $booking->company; } return view('pages.customer_support', [ 'marking' => $marking, 'email' => $email, 'bookingReference' => $bookingReference, 'company' => $company, 'booking' => $booking, ]); })->name('support'); Route::get('/online_payment/redirect', 'Billplz\CallbackBillplzController@callback')->name('online_payment.redirect'); Route::get('/export/customers/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export'); Route::get('/export/transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@transactions'); Route::get('/export/analytic/booking', 'Exports\ExportAnalyticToExcelController@bookingData'); Route::get('/export/analytic/bills', 'Exports\ExportAnalyticToExcelController@billingData'); Route::get('/export/customers/leads', 'Exports\ExportCustomersToExcelController@leadsData')->name('leads.export'); Route::get('/products', function (\App\Classes\Modules\Exports\Services\ExportsProducts $exportsProducts) { return $exportsProducts->download('products.csv', Excel::CSV, ['Content-Type' => 'text/csv']); })->name('products.random'); Route::get('/fix_bills', function () { ini_set('max_execution_time', '1000000'); Auth()->login(User::find(1)); $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(); $po = $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->first(); $supplier_deliver_order_transaction = $booking->transactions()->where('type', TransactionType::SUPPLIER_DELIVER)->first(); $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( DocumentType::SUPPLIER_DELIVER_ORDER, [chunk_split('data:application/pdf;base64,'.base64_encode($supplier_order_pdf->output()))], '', ApprovalStatus::COMPLETED, 'supplier_delivery_orders' ); $document = (App()->make(CreatesDocument::class))->execute($booking, $document_object); (App()->make(CreatesFiles::class))->execute($document, $document_object); } })->name('products.random'); Route::get('/wallet/{marking}/details', function ($marking) { $id = \App\Models\Company::where('reference', '=', $marking)->first()->id; return view('pages.wallet.index', ['id' => $id]); })->name('wallet.details'); Route::get('/wallets', function () { return view('pages.wallet.wallets'); })->name('wallet.wallets'); Route::get('/bookings/billplz', function () { return view('pages.billplz_redirect'); })->name('bookings.billplz'); Route::get('/document/download', 'Bookings\DownloadBookingDocumentController@download')->name('documents.download'); Route::get('billplz/bills/{bill_no}', function($bill_no){ return redirect(env('BILLPLZ_BASE_URL').'/bills/'.$bill_no); })->name('billplz.bill'); Route::get('/export/customers/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export'); Route::get('/export/transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@transactions'); Route::get('/export/null-debtor/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@nullDebtor')->name('newDebtor.export'); Route::get('/export/payment-transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@paymentTransactions')->name('paymentTransactions.export'); Route::get('/export/wallet-transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@walletTransactions')->name('walletTransactions.export'); Route::get('/export/booking-transactions', 'Exports\ExportCustomersToExcelController@bookingTransactions')->name('export.transactions.booking'); Route::get('/products', function (\App\Classes\Modules\Exports\Services\ExportsProducts $exportsProducts) { $bookings = Booking::where(function($query){ return $query->whereMonth('created_at', 7)->orWhereMonth('created_at', 8)->orWhereMonth('created_at', 9)->orWhereMonth('created_at', 10)->orWhereMonth('created_at', 11)->orWhereMonth('created_at', 12); })->whereDoesntHave('transactions', function($q){ $q->where('type', TransactionType::PURCHASE_ORDER); $q->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED]); })->get(); dd($bookings->count()); return $exportsProducts->download('products.csv', Excel::CSV, ['Content-Type' => 'text/csv']); })->name('products.random'); Route::get('/auto-purchase-order-fill', 'Bookings\AutoPurchaseOrderFillController@auto')->name('assign'); Route::get('purchase/sensitive/', function(Request $request){ $keywords = json_decode($request->input('keywords')); $items = \App\Models\TransactionDetail::query(); foreach ($keywords as $key => $keyword){ if(!$key){ $items->Where('product_name', 'like', '%'.$keyword.'%'); continue; } $items->orWhere('product_name', 'like', '%'.$keyword.'%'); } $items = $items->get(); foreach ($items as $key => $item){ echo ($key+1).'. '.$item->product_name.' => '.$item->transaction->owner->marking.'

'; } }); Route::get('/transactions/supplier/{id}/mock_up', 'Transactions\DownloadMockUpWhiteFormPdfController@download')->name('whiteForm.mockUp'); Route::get('/notifications/list', 'Notifications\ListNotificationsController@list')->name('notifications.list'); Route::get('/supplier/pi/export', function(){ $groups = \App\Models\Group::where('issuer', 2729)->whereMonth('created_at', 9)->whereYear('created_at', 2022)->get(); echo ''; $i = 0; foreach ($groups as $group){ foreach ($group->transactions as $transaction){ $booking = $purchaseOrder = $transaction->owner->owner; $purchaseOrder = $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->where('status', ApprovalStatus::APPROVED)->first(); if(!$purchaseOrder) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; continue; } foreach ($purchaseOrder->transactionDetails as $item){ $i++; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } } } echo ''; echo '
-'.$group->created_at.'warning, booking ref.'.$booking->marking.' doesn\'t have purchase order000'.$booking->marking.'
'.$i.''.$group->created_at.''.$item->product_name.''.$item->quantity.''.$item->price * (1/$group->currency_rate).''.($item->price * $item->quantity) * (1/$group->currency_rate).''.$booking->marking.'
Service Charge'.$groups->sum('service_charge').'
'; }); Route::get('/segments', function (Request $request) { $segment = null; if ($request->has('id')) { $segment = App\Models\Segment::find($request->id); } return view('pages.segments.index', compact('segment')); })->name('segments'); Route::get('/pending_orders', function(){ $payments = Transaction::where('type', TransactionType::PAYMENT)->where('owner_type', Booking::class)->whereIn('status', [ApprovalStatus::APPROVED])->get(); echo ''; $i = 0; foreach ($payments as $payment){ $booking = $payment->owner; if(!$booking instanceof Booking){ dd($payment); } $bankType = str::length($booking->bank->holder_name) > 4 ? 'Company' : 'Personal'; if (!preg_match('/[^A-Za-z0-9]/', $booking->bank->holder_name)) { $bankType = str_word_count($booking->bank->holder_name) > 4 ? 'Company' : 'Personal'; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
'.$payment->updated_at->format('d-M-y').''.$booking->marking.''.\App\Classes\ValueObjects\Constants\PaymentMethodType::PAYMENT_METHODS_ID[$payment->payment_method].''.$payment->currency->short_code.''.$payment->amount.''.$booking->company->reference.''.$payment->original_currency->short_code.''.$payment->original_amount.''.$booking->service->name.''.$payment->updated_at->diffForHumans().''.$bankType.''.$booking->bank->holder_name.'
'; })->name('orders.pending'); Route::get('/group/text/{id}', function($id){ $group = \App\Models\Group::where('id', $id)->first(); echo 'RATE: '.$group->currency_rate.'
'; echo 'DATE: '.$group->created_at.'


'; $i = 0; foreach ($group->transactions as $transaction){ $i++; $booking = $transaction->owner->owner; echo 'No.'.$i.'
'; echo 'Bank Details:'.$booking->bank->holder_name.'
'; echo $booking->bank->bank_name.' '.$booking->bank->bank_branch.'
'; echo 'Bank Account Number:'.$booking->bank->account_no.'
'; echo 'Order Amount:'.$transaction->original_currency->short_code.' '.(round($transaction->original_amount, 2) + 0).'

'; } })->name('group.text'); Route::get('/wallet/audit', function (Request $request) { $wallets = \App\Models\Wallet::all(); $i = 0; foreach ($wallets as $wallet){ $topups = 0; $credit = 0; $payments = 0; $debit = 0; foreach ($wallet->transactions as $transaction){ if(!in_array((int) $transaction->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) continue; if((int) $transaction->type === TransactionType::TOP_UP) { $topups += (float) $transaction->amount; // $response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference); // // if($response->successful()){ // $data = $response->json(); // if($data['paid']){ // // } else { // echo $transaction->id." => Fraud"; // } // }else{ // echo "billplz error"; // } } if((int) $transaction->type === TransactionType::CREDIT_NOTE) $credit += (float) $transaction->amount; if((int) $transaction->type === TransactionType::PAYMENT) $payments += (float) $transaction->amount; if((int) $transaction->type === TransactionType::DEBIT_NOTE) $debit += (float) $transaction->amount; } if((round((float) $wallet->amount - (($topups + $credit) - ($payments + $debit)), 2) == 0) AND $wallet->amount > -0.01) continue; $i++; echo $i.". Marking: ". $wallet->owner->reference ."(".$wallet->id.")
Current Balance: ". $wallet->amount ."
Audit Balance: ". (($topups + $credit) - ($payments + $debit)) ."
Difference: ". round((float) $wallet->amount - (($topups + $credit) - ($payments + $debit)), 2) ."


"; } }); Route::get('/wallets/active', function(){ $wallets = Wallet::all(); echo ''; foreach ($wallets as $wallet){ echo ''; echo ''; echo ''; echo ''; } echo '
'.$wallet->owner->reference.''.$wallet->amount.'
'; }); Route::get('/payments/manual', function(){ $payments = Transaction::where('type', TransactionType::PAYMENT)->whereIn('payment_method', [\App\Classes\ValueObjects\Constants\PaymentMethodType::CASH, \App\Classes\ValueObjects\Constants\PaymentMethodType::BA, \App\Classes\ValueObjects\Constants\PaymentMethodType::CHEQUE])->where('owner_type', Booking::class)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->get(); $i = 0; echo ''; foreach ($payments as $payment){ $i++; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
'.$i.''.$payment->documents()->first()->created_at->format('d-m-Y').''.$payment->owner->marking.''.$payment->amount.'
'; }); Route::get('/1688/fix/{reference}', function($reference){ $booking = Booking::where('marking', $reference)->first(); (App()->make(createPurchaseOrderFor1688OrderProcessor::class))->execute($booking); // set_time_limit(1800); // $purchaseOrderDocuments = \App\Models\Document::where('document_type', DocumentType::ECOMMERCE_PURCHASE_ORDER)->get(); // // foreach($purchaseOrderDocuments as $document){ // $booking = $document->owner; // $booking->status = ApprovalStatus::APPROVED; // $booking->save(); // // $booking->documents()->whereIn('document_type', [DocumentType::INVOICE, DocumentType::PURCHASE_ORDER, DocumentType::DELIVER_ORDER, DocumentType::SUPPLIER_DELIVER_ORDER])->delete(); // // (App()->make(createPurchaseOrderFor1688OrderProcessor::class))->execute($document->owner); // } })->name('ecommerce.fix'); Route::get('/po/manual/fix', function(){ $bookings = Booking::whereIn('company_id', [199, 510])->whereHas('documents', function($query){ return $query->where('document_type', DocumentType::ECOMMERCE_PURCHASE_ORDER); })->get(); foreach ($bookings as $booking){ $booking->status = ApprovalStatus::APPROVED; $booking->save(); $booking->documents()->whereIn('document_type', [DocumentType::PURCHASE_ORDER, DocumentType::DELIVER_ORDER, DocumentType::INVOICE, DocumentType::SUPPLIER_DELIVER_ORDER])->delete(); $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->update(['status' => ApprovalStatus::PENDING_SUBMISSION]); } })->name('ecommerce.fix'); Route::get('/payment/check', function(){ $transactions = Transaction::where('type', TransactionType::BILL)->whereDate('created_at', '>=', Carbon::today())->get(); foreach ($transactions as $transaction){ $booking = $transaction->owner->owner; $documents = $transaction->documents; if(!count($documents)){ echo $booking->marking.'

'; continue; } // echo $transaction->owner->owner->marking.'. payment: '.$transaction->updated_at.' -> document: '.$documents[0]->created_at.'
'; } })->name('payment.check'); Route::get('/refund/fix', function(){ $bookings = Booking::whereIn('marking', [82935, 92135, 96183, 94448, 29819, 30403, 63969, 42116, 79278, 89987, 51432, 76289, 67767, 98433, 47431, 93472, 50933, 87298, 35329, 93845, 55902, 82629, 51019, 42820, 90666, 40167, 29253, 48891, 67364, 64628, 91859, 22123, 34154, 84366, 27370, 58222, 67695, 71233, 26466, 83894, 35664, 65669, 68986, 40382, 63743, 39611, 60658, 32893, 98243, 23822, 64323, 79271, 79053, 48497, 48708, 86463, 30054, 50590, 85808, 88988, 79663, 57558, 85902, 95451, 95897, 33164, 82342, 38091, 27451, 64809, 39444, 32101, 27242, 71851, 50850, 70659, 89403, 55540, 65743, 77315, 22921, 35623, 77315, 32344, 81717, 57176, 48775, 34133, 39396, 67473, 42749, 89395, 32132, 23670, 36783, 21783, 66348, 47205, 72784, 22437, 96271, 45396, 45352, 47896, 61654, 73174, 47002, 25448, 95810, 80827, 81180, 52142, 37640, 30295, 59816, 99197, 76541, 94786, 30776, 89769, 77720, 30610, 28546, 50931, 94525, 43425, 37461, 20629, 60586, 87228, 24814, 68011, 90547, 30572, 26274, 26274, 38599, 44487, 96767, 63872, 29576, 20173, 23555, 64657, 71021, 65316, 86540, 73981, 32747, 71086, 83221, 66168, 90541, 52366, 29227, 30915, 45242, 81384, 37533, 89752, 70133, 45894, 21918, 85579, 48650, 88747, 23200, 37018, 21753, 21188, 60449, 63918, 68888, 49910, 30402, 96338, 36578, 82133, 37872, 90437, 54404, 73439, 94283, 97752, 83333, 38548, 74366, 21060, 43240, 94612, 33164, 98630, 33164, 22898, 44320, 31153, 36480, 55085, 64039, 99796, 42238, 71458, 34415, 49935, 37902, 25598, 51833, 89733, 38081, 71564, 51366, 20173, 91400, 86540, 92131, 76724, 22657, 62117, 86443, 85827, 46570, 99809, 89258, 68834, 20785, 24478, 79588, 49111, 24838, 41989, 79081, 48440, 57375, 86104, 78719, 61502, 96167, 23398, 27873, 80065, 33048, 83138, 99211, 98183, 28639, 54547, 70098, 27216, 67404, 47761, 85049, 41906, 62328, 63645, 46750, 86975, 69955, 21714, 33889, 87344, 58345, 34183, 82504, 68636, 70962, 92553, 20125, 88625, 20661, 98146, 92075, 67543, 99045, 27395, 67163, 32245, 43347, 87947, 97897, 59860, 26003, 47852, 96008, 54166, 50037, 31435, 35821, 81929, 76751, 80379, 32473, 81598, 58716, 70554, 67473, 82491, 93859, 99159, 84772, 84772, 32473, 42050, 26532, 81526, 81526, 45780, 46570, 78657, 35293, 98311, 62095, 86914, 45215, 37650, 57708, 60449, 46750, 91834, 60989, 54877, 98298, 52382, 86346, 65219]) ->get(); $notPlaced = []; $placed = []; $completed = []; foreach ($bookings as $booking){ $payments = $booking->transactions()->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->get(); foreach ($payments as $payment){ if($payment->status === ApprovalStatus::APPROVED){ $notPlaced[] = $booking; continue; } $bill = $payment->transactions()->where('type', TransactionType::BILL)->first(); if(!$bill){ $notPlaced[] = $booking; continue; } if(in_array($bill->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])){ $completed[] = $booking; continue; } $placed[] = $booking; } } echo '

Customer Paid ('.count($notPlaced).')

'; foreach ($notPlaced as $booking){ echo ''.$booking->marking.'
'; } echo '

White Form Generated ('.count($placed).')

'; foreach ($placed as $booking){ echo ''.$booking->marking.'
'; } echo '

China Bankslip Uploaded ('.count($completed).')

'; foreach ($completed as $booking){ echo ''.$booking->marking.'
'; } });