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('/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', 2210)->whereMonth('created_at', 7)->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 ''; continue; } foreach ($purchaseOrder->transactionDetails as $item){ $i++; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } } } echo ''; echo '
-warning, booking ref.'.$booking->marking.' doesn\'t have purchase order000'.$booking->marking.'
'.$i.''.$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; $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) 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', function(){ 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); } });