A free open source IT asset/license management system
Removed old reports methods and routes
snipe97f748d58ed9
diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.phpindex 507498afc4..7b54ae0fa6 100644--- a/app/Http/Controllers/ReportsController.php+++ b/app/Http/Controllers/ReportsController.php@@ -81,137 +81,7 @@ class ReportsController extends Controllerreturn $response;}-- /**- * Display asset report view.- *- * @author [A. Gianotto] [<[email protected]>]- * @since [v1.0]- * @return View- */- public function getAssetsReport()- {- $settings = \App\Models\Setting::first();- return view('reports/asset', compact('assets'))->with('settings', $settings);- }---- /**- * Exports the assets to CSV- *- * @author [A. Gianotto] [<[email protected]>]- * @since [v1.0]- * @return \Illuminate\Http\Response- */- public function exportAssetReport(Request $request)- {-- \Debugbar::disable();-- $customfields = CustomField::get();-- $response = new StreamedResponse(function () use ($customfields, $request) {- // Open output stream- $handle = fopen('php://output', 'w');-- $assets = Asset::with('assignedTo', 'location','defaultLoc','assignedTo','model','supplier','assetstatus','model.manufacturer');-- // This is used by the sidenav, mostly- switch ($request->input('status')) {- case 'Deleted':- $assets->withTrashed()->Deleted();- break;- case 'Pending':- $assets->Pending();- break;- case 'RTD':- $assets->RTD();- break;- case 'Undeployable':- $assets->Undeployable();- break;- case 'Archived':- $assets->Archived();- break;- case 'Requestable':- $assets->RequestableAssets();- break;- case 'Deployed':- $assets->Deployed();- break;- }-- $headers=[- trans('general.company'),- trans('admin/hardware/table.asset_tag'),- trans('admin/hardware/form.manufacturer'),- trans('general.category'),- trans('admin/hardware/form.model'),- trans('general.model_no'),- trans('general.name'),- trans('admin/hardware/table.serial'),- trans('general.status'),- trans('admin/hardware/table.purchase_date'),- trans('admin/hardware/table.purchase_cost'),- trans('admin/hardware/form.order'),- trans('general.supplier'),- trans('admin/hardware/table.checkoutto'),- trans('general.type'),- trans('admin/hardware/table.checkout_date'),- trans('admin/hardware/table.location'),- trans('general.notes'),- ];- foreach ($customfields as $field) {- $headers[]=$field->name;- }- fputcsv($handle, $headers);-- $assets->orderBy('created_at', 'DESC')->chunk(500, function($assets) use($handle, $customfields) {--- foreach ($assets as $asset) {-- // Add a new row with data- $values=[- ($asset->company) ? $asset->company->name : '',- $asset->asset_tag,- ($asset->model->manufacturer) ? $asset->model->manufacturer->name : '',- ($asset->model->category) ? $asset->model->category->name : '',- ($asset->model) ? $asset->model->name : '',- ($asset->model->model_number) ? $asset->model->model_number : '',- ($asset->name) ? $asset->name : '',- ($asset->serial) ? $asset->serial : '',- ($asset->assetstatus) ? e($asset->present()->statusText) : '',- ($asset->purchase_date) ? e($asset->purchase_date) : '',- ($asset->purchase_cost > 0) ? Helper::formatCurrencyOutput($asset->purchase_cost) : '',- ($asset->order_number) ? e($asset->order_number) : '',- ($asset->supplier) ? e($asset->supplier->name) : '',- ($asset->checkedOutToUser() && $asset->assigned) ? e($asset->assigned->getFullNameAttribute()) : ($asset->assigned ? e($asset->assigned->display_name) : ''),- ($asset->checkedOutToUser() && $asset->assigned) ? 'user' : e($asset->assignedType()),- ($asset->last_checkout!='') ? e($asset->last_checkout) : '',- ($asset->location) ? e($asset->location->name) : '',- ($asset->notes) ? e($asset->notes) : '',- ];- foreach ($customfields as $field) {- $values[]=$asset->{$field->db_column_name()};- }- fputcsv($handle, $values);- }- });-- // Close the output stream- fclose($handle);- }, 200, [- 'Content-Type' => 'text/csv',- 'Content-Disposition'- => 'attachment; filename="'.(($request->has('status')) ? trim($request->input('status')) : 'all').'-assets-'.date('Y-m-d-his').'.csv"',- ]);-- return $response;-- }-+/*** Show depreciation report for assets.*diff --git a/routes/web.php b/routes/web.phpindex baa58ec81c..8ba63470bc 100644--- a/routes/web.php+++ b/routes/web.php@@ -316,11 +316,7 @@ Route::group(['middleware' => ['auth']], function () {'reports/export/licenses',[ 'as' => 'reports/export/licenses', 'uses' => 'ReportsController@exportLicenseReport' ]);- Route::get('reports/assets', [ 'as' => 'reports/assets', 'uses' => 'ReportsController@getAssetsReport' ]);- Route::get(- 'reports/export/assets',- [ 'as' => 'reports.export.assets', 'uses' => 'ReportsController@exportAssetReport' ]- );+Route::get('reports/accessories', [ 'as' => 'reports/accessories', 'uses' => 'ReportsController@getAccessoryReport' ]);Route::get('reports/export/accessories',