mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
Merge branch 'hotfixes/purchase_cost' into develop
# Conflicts: # app/Http/Controllers/ReportsController.php # config/version.php
This commit is contained in:
commit
9091385182
|
@ -495,4 +495,16 @@ class Helper
|
|||
|
||||
}
|
||||
|
||||
|
||||
public static function stripTagsFromJSON(Array $array) {
|
||||
|
||||
foreach ($array as $key => $value) {
|
||||
$clean_value = strip_tags($value);
|
||||
$clean_array[$key] = $clean_value;
|
||||
}
|
||||
return $clean_array;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class AccessoriesController extends Controller
|
|||
if (e(Input::get('purchase_cost')) == '0.00') {
|
||||
$accessory->purchase_cost = null;
|
||||
} else {
|
||||
$accessory->purchase_cost = e(Input::get('purchase_cost'));
|
||||
$accessory->purchase_cost = Helper::ParseFloat(e(Input::get('purchase_cost')))p;
|
||||
}
|
||||
|
||||
$accessory->qty = e(Input::get('qty'));
|
||||
|
@ -126,7 +126,7 @@ class AccessoriesController extends Controller
|
|||
}
|
||||
|
||||
return View::make('accessories/edit', compact('accessory'))
|
||||
->with('category_list', Helper::categoryList('accessory'))
|
||||
->with('category_list', erper::categoryList('accessory'))
|
||||
->with('company_list', Helper::companyList())
|
||||
->with('location_list', Helper::locationsList())
|
||||
->with('manufacturer_list', Helper::manufacturerList());
|
||||
|
|
|
@ -141,7 +141,7 @@ class AssetMaintenancesController extends Controller
|
|||
'completion_date' => $maintenance->completion_date,
|
||||
'user_id' => ($maintenance->admin) ? (string)link_to('/admin/users/'.$maintenance->admin->id.'/view', $maintenance->admin->fullName()) : '',
|
||||
'actions' => $actions,
|
||||
'companyName' => ($maintenance->asset) ? $maintenance->asset->company->name : ''
|
||||
'companyName' => ($maintenance->asset->company) ? $maintenance->asset->company->name : ''
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ class AssetMaintenancesController extends Controller
|
|||
if (e(Input::get('cost')) == '') {
|
||||
$assetMaintenance->cost = '';
|
||||
} else {
|
||||
$assetMaintenance->cost = e(Input::get('cost'));
|
||||
$assetMaintenance->cost = Helper::ParseFloat(e(Input::get('cost')));
|
||||
}
|
||||
|
||||
if (e(Input::get('notes')) == '') {
|
||||
|
@ -363,7 +363,7 @@ class AssetMaintenancesController extends Controller
|
|||
if (e(Input::get('cost')) == '') {
|
||||
$assetMaintenance->cost = '';
|
||||
} else {
|
||||
$assetMaintenance->cost = e(Input::get('cost'));
|
||||
$assetMaintenance->cost = Helper::ParseFloat(e(Input::get('cost')));
|
||||
}
|
||||
|
||||
if (e(Input::get('notes')) == '') {
|
||||
|
|
|
@ -178,7 +178,7 @@ class AssetsController extends Controller
|
|||
if (e(Input::get('purchase_cost')) == '') {
|
||||
$asset->purchase_cost = null;
|
||||
} else {
|
||||
$asset->purchase_cost = (e(Input::get('purchase_cost')));
|
||||
$asset->purchase_cost = Helper::ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
if (e(Input::get('purchase_date')) == '') {
|
||||
|
@ -354,7 +354,7 @@ class AssetsController extends Controller
|
|||
}
|
||||
|
||||
if ($request->has('purchase_cost')) {
|
||||
$asset->purchase_cost = e(Helper::formatCurrencyOutput($request->input('purchase_cost')));
|
||||
$asset->purchase_cost = Helper::ParseFloat(e($request->input('purchase_cost')));
|
||||
} else {
|
||||
$asset->purchase_cost = null;
|
||||
}
|
||||
|
@ -1492,7 +1492,7 @@ class AssetsController extends Controller
|
|||
}
|
||||
|
||||
if (Input::has('purchase_cost')) {
|
||||
$update_array['purchase_cost'] = e(Input::get('purchase_cost'));
|
||||
$update_array['purchase_cost'] = Helper::ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
if (Input::has('supplier_id')) {
|
||||
|
@ -1840,7 +1840,13 @@ class AssetsController extends Controller
|
|||
}
|
||||
|
||||
}
|
||||
$rows[]=$row;
|
||||
|
||||
if (($request->has('report')) && ($request->get('report')=='true')) {
|
||||
$rows[]= Helper::stripTagsFromJSON($row);
|
||||
} else {
|
||||
$rows[]= $row;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$data = array('total'=>$assetCount, 'rows'=>$rows);
|
||||
|
|
|
@ -99,7 +99,7 @@ class ComponentsController extends Controller
|
|||
if (e(Input::get('purchase_cost')) == '0.00') {
|
||||
$component->purchase_cost = null;
|
||||
} else {
|
||||
$component->purchase_cost = e(Input::get('purchase_cost'));
|
||||
$component->purchase_cost = Helper::ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
$component->total_qty = e(Input::get('total_qty'));
|
||||
|
@ -183,7 +183,7 @@ class ComponentsController extends Controller
|
|||
if (e(Input::get('purchase_cost')) == '0.00') {
|
||||
$component->purchase_cost = null;
|
||||
} else {
|
||||
$component->purchase_cost = e(Input::get('purchase_cost'));
|
||||
$component->purchase_cost = Helper::ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
$component->total_qty = e(Input::get('total_qty'));
|
||||
|
|
|
@ -97,7 +97,7 @@ class ConsumablesController extends Controller
|
|||
if (e(Input::get('purchase_cost')) == '0.00') {
|
||||
$consumable->purchase_cost = null;
|
||||
} else {
|
||||
$consumable->purchase_cost = e(Input::get('purchase_cost'));
|
||||
$consumable->purchase_cost = Helper::ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
$consumable->qty = e(Input::get('qty'));
|
||||
|
@ -182,10 +182,10 @@ class ConsumablesController extends Controller
|
|||
if (e(Input::get('purchase_cost')) == '0.00') {
|
||||
$consumable->purchase_cost = null;
|
||||
} else {
|
||||
$consumable->purchase_cost = e(Input::get('purchase_cost'));
|
||||
$consumable->purchase_cost = Helper::ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
$consumable->qty = e(Input::get('qty'));
|
||||
$consumable->qty = Helper::ParseFloat(e(Input::get('qty')));
|
||||
|
||||
if ($consumable->save()) {
|
||||
return redirect()->to("admin/consumables")->with('success', trans('admin/consumables/message.update.success'));
|
||||
|
|
|
@ -87,17 +87,13 @@ class LicensesController extends Controller
|
|||
public function postCreate()
|
||||
{
|
||||
|
||||
|
||||
// get the POST data
|
||||
$new = Input::all();
|
||||
|
||||
// create a new model instance
|
||||
$license = new License();
|
||||
|
||||
if (e(Input::get('purchase_cost')) == '') {
|
||||
$license->purchase_cost = null;
|
||||
} else {
|
||||
$license->purchase_cost = e(Input::get('purchase_cost'));
|
||||
$license->purchase_cost = Helper::ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
if (e(Input::get('supplier_id')) == '') {
|
||||
|
@ -289,10 +285,9 @@ class LicensesController extends Controller
|
|||
}
|
||||
|
||||
if (e(Input::get('purchase_cost')) == '') {
|
||||
$license->purchase_cost = null;
|
||||
$license->purchase_cost = null;
|
||||
} else {
|
||||
$license->purchase_cost = e(Input::get('purchase_cost'));
|
||||
//$license->purchase_cost = e(Input::get('purchase_cost'));
|
||||
$license->purchase_cost = Helper::ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
if (e(Input::get('maintained')) == '') {
|
||||
|
|
|
@ -33,12 +33,12 @@ class ReportsController extends Controller
|
|||
{
|
||||
|
||||
/**
|
||||
* Returns a view that displays the accessories report.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
* Returns a view that displaysthe accessories report.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getAccessoryReport()
|
||||
{
|
||||
$accessories = Accessory::orderBy('created_at', 'DESC')->with('company')->get();
|
||||
|
@ -47,14 +47,14 @@ class ReportsController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Exports the accessories to CSV
|
||||
*
|
||||
* @deprecated Server-side exports have been replaced by datatables export since v2.
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @see ManufacturersController::getDatatable() method that generates the JSON response
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
* Exports the accessories to CSV
|
||||
*
|
||||
* @deprecated Server-side exports have been replaced by datatables export since v2.
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @see ManufacturersController::getDatatable() method that generates the JSON response
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function exportAccessoryReport()
|
||||
{
|
||||
$accessories = Accessory::orderBy('created_at', 'DESC')->get();
|
||||
|
@ -89,53 +89,41 @@ class ReportsController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Display asset report.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
* Display asset report view.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getAssetsReport()
|
||||
{
|
||||
$settings = \App\Models\Setting::first();
|
||||
// Grab all the assets
|
||||
$assets = Asset::with(
|
||||
'model',
|
||||
'assigneduser.userLoc',
|
||||
'assetstatus',
|
||||
'defaultLoc',
|
||||
'assetlog',
|
||||
'supplier',
|
||||
'model.manufacturer',
|
||||
'company'
|
||||
)
|
||||
->orderBy('created_at', 'DESC')
|
||||
->get();
|
||||
|
||||
return View::make('reports/asset', compact('assets'))->with('settings', $settings);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Exports the assets to CSV
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
* Exports the assets to CSV
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function exportAssetReport()
|
||||
{
|
||||
|
||||
\Debugbar::disable();
|
||||
\Debugbar::disable();
|
||||
|
||||
$customfields = CustomField::get();
|
||||
|
||||
$response = new StreamedResponse(function(){
|
||||
// Open output stream
|
||||
$handle = fopen('php://output', 'w');
|
||||
|
||||
Asset::with('assigneduser', 'assetloc','defaultLoc','assigneduser.userloc','model','supplier','assetstatus','model.manufacturer')->orderBy('created_at', 'DESC')->chunk(500, function($assets) use($handle) {
|
||||
|
||||
//BOM
|
||||
fputs($handle, chr(0xEF) . chr(0xBB) . chr(0xBF));
|
||||
fputcsv($handle, [
|
||||
$headers=[
|
||||
trans('general.company'),
|
||||
trans('admin/hardware/table.asset_tag'),
|
||||
trans('admin/hardware/form.manufacturer'),
|
||||
trans('admin/hardware/form.model'),
|
||||
|
@ -148,13 +136,19 @@ class ReportsController extends Controller
|
|||
trans('admin/hardware/form.order'),
|
||||
trans('admin/hardware/form.supplier'),
|
||||
trans('admin/hardware/table.checkoutto'),
|
||||
trans('admin/hardware/table.checkout_date'),
|
||||
trans('admin/hardware/table.location'),
|
||||
trans('general.notes'),
|
||||
]);
|
||||
];
|
||||
foreach($customfields as $field) {
|
||||
$headers[]=$field->name;
|
||||
}
|
||||
fputcsv($handle, $headers);
|
||||
|
||||
foreach ($assets as $asset) {
|
||||
// Add a new row with data
|
||||
fputcsv($handle, [
|
||||
$values=[
|
||||
($asset->company) ? $asset->company->name : '',
|
||||
$asset->asset_tag,
|
||||
($asset->model->manufacturer) ? $asset->model->manufacturer->name : '',
|
||||
($asset->model) ? $asset->model->name : '',
|
||||
|
@ -167,10 +161,15 @@ class ReportsController extends Controller
|
|||
($asset->order_number) ? e($asset->order_number) : '',
|
||||
($asset->supplier) ? e($asset->supplier->name) : '',
|
||||
($asset->assigneduser) ? e($asset->assigneduser->fullName()) : '',
|
||||
($asset->last_checkout!='') ? e($asset->last_checkout) : '',
|
||||
($asset->assigneduser && $asset->assigneduser->userloc!='') ?
|
||||
e($asset->assigneduser->userloc->name) : ( ($asset->defaultLoc!='') ? e($asset->defaultLoc->name) : ''),
|
||||
($asset->notes) ? e($asset->notes) : '',
|
||||
]);
|
||||
];
|
||||
foreach($customfields as $field) {
|
||||
$values[]=$asset->{$field->db_column_name()};
|
||||
}
|
||||
fputcsv($handle, $values);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -186,36 +185,36 @@ class ReportsController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Show depreciation report for assets.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
* Show depreciation report for assets.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getDeprecationReport()
|
||||
{
|
||||
|
||||
// Grab all the assets
|
||||
$assets = Asset::with('model', 'assigneduser', 'assetstatus', 'defaultLoc', 'assetlog', 'company')
|
||||
->orderBy('created_at', 'DESC')->get();
|
||||
->orderBy('created_at', 'DESC')->get();
|
||||
|
||||
return View::make('reports/depreciation', compact('assets'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports the depreciations to CSV
|
||||
*
|
||||
* @deprecated Server-side exports have been replaced by datatables export since v2.
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
* Exports the depreciations to CSV
|
||||
*
|
||||
* @deprecated Server-side exports have been replaced by datatables export since v2.
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function exportDeprecationReport()
|
||||
{
|
||||
|
||||
// Grab all the assets
|
||||
$assets = Asset::with('model', 'assigneduser', 'assetstatus', 'defaultLoc', 'assetlog')
|
||||
->orderBy('created_at', 'DESC')->get();
|
||||
->orderBy('created_at', 'DESC')->get();
|
||||
|
||||
$csv = \League\Csv\Writer::createFromFileObject(new \SplTempFileObject());
|
||||
$csv->setOutputBOM(Reader::BOM_UTF16_BE);
|
||||
|
@ -284,143 +283,51 @@ class ReportsController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Displays activity report.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
* Displays activity report.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getActivityReport()
|
||||
{
|
||||
$log_actions = Actionlog::orderBy('created_at', 'DESC')
|
||||
->with('item')
|
||||
->orderBy('created_at', 'DESC')
|
||||
->get();
|
||||
->with('adminlog')
|
||||
->with('accessorylog')
|
||||
->with('assetlog')
|
||||
->with('licenselog')
|
||||
->with('userlog')
|
||||
->orderBy('created_at', 'DESC')
|
||||
->get();
|
||||
|
||||
return View::make('reports/activity', compact('log_actions'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns Activity Report JSON.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getActivityReportDataTable()
|
||||
{
|
||||
$activitylogs = Actionlog::orderBy('created_at', 'DESC');
|
||||
|
||||
if (Input::has('search')) {
|
||||
$activity = $activity->TextSearch(e(Input::get('search')));
|
||||
}
|
||||
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
|
||||
$allowed_columns = ['created_at'];
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? e(Input::get('sort')) : 'created_at';
|
||||
|
||||
|
||||
$activityCount = $activitylogs->count();
|
||||
$activitylogs = $activitylogs->skip($offset)->take($limit)->get();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($activitylogs as $activity) {
|
||||
|
||||
if ($activity->itemType() == "asset") {
|
||||
$activity_icons = '<i class="fa fa-barcode"></i>';
|
||||
} elseif ($activity->itemType() == "accessory") {
|
||||
$activity_icons = '<i class="fa fa-keyboard-o"></i>';
|
||||
} elseif ($activity->itemType()=="consumable") {
|
||||
$activity_icons = '<i class="fa fa-tint"></i>';
|
||||
} elseif ($activity->itemType()=="license"){
|
||||
$activity_icons = '<i class="fa fa-floppy-o"></i>';
|
||||
} elseif ($activity->itemType()=="component") {
|
||||
$activity_icons = '<i class="fa fa-hdd-o"></i>';
|
||||
} else {
|
||||
$activity_icons = '<i class="fa fa-paperclip"></i>';
|
||||
}
|
||||
|
||||
if (($activity->item) && ($activity->itemType()=="asset")) {
|
||||
$actvity_item = '<a href="'.route('view/hardware', $activity->item_id).'">'.e($activity->item->asset_tag).' - '. e($activity->item->showAssetName()).'</a>';
|
||||
$item_type = 'asset';
|
||||
} elseif ($activity->item) {
|
||||
$actvity_item = '<a href="'.route('view/'. $activity->itemType(), $activity->item_id).'">'.e($activity->item->name).'</a>';
|
||||
$item_type = $activity->itemType();
|
||||
}
|
||||
|
||||
|
||||
if (($activity->userasassetlog) && ($activity->action_type=="uploaded") && ($activity->itemType()=="user")) {
|
||||
$activity_target = '<a href="'.route('view/user', $activity->target_id).'">'.$activity->userasassetlog->fullName().'</a>';
|
||||
} elseif (($activity->item) && ($activity->target instanceof \App\Models\Asset)) {
|
||||
$activity_target = '<a href="'.route('view/hardware', $activity->target_id).'">'.$activity->target->showAssetName().'</a>';
|
||||
} elseif (($activity->item) && ($activity->target instanceof \App\Models\User)) {
|
||||
$activity_target = '<a href="'.route('view/user', $activity->target_id).'">'.$activity->target->fullName().'</a>';
|
||||
} elseif ($activity->action_type=='requested') {
|
||||
$activity_target = '<a href="'.route('view/user', $activity->user_id).'">'.$activity->user->fullName().'</a>';
|
||||
} else {
|
||||
$activity_target = $activity->target;
|
||||
}
|
||||
|
||||
|
||||
$rows[] = array(
|
||||
'icon' => $activity_icons,
|
||||
'created_at' => date("M d, Y g:iA", strtotime($activity->created_at)),
|
||||
'action_type' => strtolower(trans('general.'.str_replace(' ','_',$activity->action_type))),
|
||||
'admin' => $activity->user ? (string) link_to('/admin/users/'.$activity->user_id.'/view', $activity->user->fullName()) : 'Deleted Admin',
|
||||
'target' => $activity_target,
|
||||
'item' => $actvity_item,
|
||||
'item_type' => $item_type,
|
||||
'note' => e($activity->note),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total'=>$activityCount, 'rows'=>$rows);
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays license report
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
* Displays license report
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getLicenseReport()
|
||||
{
|
||||
|
||||
$licenses = License::with('depreciation')->orderBy('created_at', 'DESC')
|
||||
->with('company')
|
||||
->get();
|
||||
$licenses = License::orderBy('created_at', 'DESC')
|
||||
->with('company')
|
||||
->get();
|
||||
|
||||
return View::make('reports/licenses', compact('licenses'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports the licenses to CSV
|
||||
*
|
||||
* @deprecated Server-side exports have been replaced by datatables export since v2.
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
* Exports the licenses to CSV
|
||||
*
|
||||
* @deprecated Server-side exports have been replaced by datatables export since v2.
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function exportLicenseReport()
|
||||
{
|
||||
$licenses = License::orderBy('created_at', 'DESC')->get();
|
||||
|
@ -433,7 +340,6 @@ class ReportsController extends Controller
|
|||
trans('admin/licenses/form.remaining_seats'),
|
||||
trans('admin/licenses/form.expiration'),
|
||||
trans('admin/licenses/form.date'),
|
||||
trans('admin/licenses/form.depreciation'),
|
||||
trans('admin/licenses/form.cost')
|
||||
];
|
||||
|
||||
|
@ -449,7 +355,6 @@ class ReportsController extends Controller
|
|||
$row[] = $license->remaincount();
|
||||
$row[] = $license->expiration_date;
|
||||
$row[] = $license->purchase_date;
|
||||
$row[] = ($license->depreciation!='') ? '' : e($license->depreciation->name);
|
||||
$row[] = '"' . Helper::formatCurrencyOutput($license->purchase_cost) . '"';
|
||||
|
||||
$rows[] = implode($row, ',');
|
||||
|
@ -464,13 +369,13 @@ class ReportsController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a form that allows the user to generate a custom CSV report.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @see ReportsController::postCustomReport() method that generates the CSV
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
* Returns a form that allows the user to generate a custom CSV report.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @see ReportsController::postCustomReport() method that generates the CSV
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getCustomReport()
|
||||
{
|
||||
$customfields = CustomField::get();
|
||||
|
@ -493,10 +398,10 @@ class ReportsController extends Controller
|
|||
$rows = [ ];
|
||||
$header = [ ];
|
||||
|
||||
if (e(Input::get('company_name')) == '1') {
|
||||
if (e(Input::get('company')) == '1') {
|
||||
$header[] = 'Company Name';
|
||||
}
|
||||
|
||||
|
||||
if (e(Input::get('asset_name')) == '1') {
|
||||
$header[] = 'Asset Name';
|
||||
}
|
||||
|
@ -562,9 +467,9 @@ class ReportsController extends Controller
|
|||
|
||||
foreach ($assets as $asset) {
|
||||
$row = [ ];
|
||||
|
||||
if (e(Input::get('company_name')) == '1') {
|
||||
$row[] = is_null($asset->company) ? '' : e($asset->company->name);
|
||||
|
||||
if (e(Input::get('company')) == '1') {
|
||||
$row[] = is_null($asset->company) ? '' : '"'.$asset->company->name.'"';
|
||||
}
|
||||
|
||||
if (e(Input::get('asset_name')) == '1') {
|
||||
|
@ -693,7 +598,7 @@ class ReportsController extends Controller
|
|||
$csv = implode($rows, "\n");
|
||||
$response = Response::make($csv, 200);
|
||||
$response->header('Content-Type', 'text/csv');
|
||||
$response->header('Content-disposition', 'attachment;filename=report.csv');
|
||||
$response->header('Content-disposition', 'attachment;filename='.date('Y-m-d-His').'-custom-asset-report.csv');
|
||||
|
||||
return $response;
|
||||
} else {
|
||||
|
@ -701,6 +606,7 @@ class ReportsController extends Controller
|
|||
->with('error', trans('admin/reports/message.error'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getImprovementsReport
|
||||
|
@ -713,8 +619,8 @@ class ReportsController extends Controller
|
|||
{
|
||||
// Grab all the improvements
|
||||
$assetMaintenances = AssetMaintenance::with('asset', 'supplier', 'asset.company')
|
||||
->orderBy('created_at', 'DESC')
|
||||
->get();
|
||||
->orderBy('created_at', 'DESC')
|
||||
->get();
|
||||
|
||||
return View::make('reports/asset_maintenances', compact('assetMaintenances'));
|
||||
|
||||
|
@ -731,8 +637,8 @@ class ReportsController extends Controller
|
|||
{
|
||||
// Grab all the improvements
|
||||
$assetMaintenances = AssetMaintenance::with('asset', 'supplier')
|
||||
->orderBy('created_at', 'DESC')
|
||||
->get();
|
||||
->orderBy('created_at', 'DESC')
|
||||
->get();
|
||||
|
||||
$rows = [ ];
|
||||
|
||||
|
@ -760,7 +666,7 @@ class ReportsController extends Controller
|
|||
$row[] = e($assetMaintenance->completion_date);
|
||||
if (is_null($assetMaintenance->asset_maintenance_time)) {
|
||||
$improvementTime = intval(Carbon::now()
|
||||
->diffInDays(Carbon::parse($assetMaintenance->start_date)));
|
||||
->diffInDays(Carbon::parse($assetMaintenance->start_date)));
|
||||
} else {
|
||||
$improvementTime = intval($assetMaintenance->asset_maintenance_time);
|
||||
}
|
||||
|
@ -804,7 +710,7 @@ class ReportsController extends Controller
|
|||
|
||||
// Grab all the improvements
|
||||
$assetsForReport = Actionlog::whereIn('id', $this->getAssetsNotAcceptedYet())
|
||||
->get();
|
||||
->get();
|
||||
|
||||
$rows = [ ];
|
||||
|
||||
|
@ -851,10 +757,10 @@ class ReportsController extends Controller
|
|||
protected function getCheckedOutAssetsRequiringAcceptance($modelsInCategoriesThatRequireAcceptance)
|
||||
{
|
||||
$assets = Asset::deployed()
|
||||
->inModelList($modelsInCategoriesThatRequireAcceptance)
|
||||
->select('id')
|
||||
->get()
|
||||
->toArray();
|
||||
->inModelList($modelsInCategoriesThatRequireAcceptance)
|
||||
->select('id')
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
return array_pluck($assets, 'id');
|
||||
}
|
||||
|
@ -871,9 +777,9 @@ class ReportsController extends Controller
|
|||
{
|
||||
|
||||
return array_pluck(Model::inCategory($assetCategoriesRequiringAcceptance)
|
||||
->select('id')
|
||||
->get()
|
||||
->toArray(), 'id');
|
||||
->select('id')
|
||||
->get()
|
||||
->toArray(), 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -887,9 +793,9 @@ class ReportsController extends Controller
|
|||
{
|
||||
|
||||
return array_pluck(Category::requiresAcceptance()
|
||||
->select('id')
|
||||
->get()
|
||||
->toArray(), 'id');
|
||||
->select('id')
|
||||
->get()
|
||||
->toArray(), 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,91 +23,55 @@
|
|||
<div class="table-responsive">
|
||||
|
||||
<table
|
||||
name="assetReport"
|
||||
id="table"
|
||||
class="table table-striped"
|
||||
data-cookie="true"
|
||||
data-click-to-select="true"
|
||||
data-cookie-id-table="assetReportTable">
|
||||
name="assetsReport"
|
||||
{{-- data-row-style="rowStyle" --}}
|
||||
data-toolbar="#toolbar"
|
||||
class="table table-striped"
|
||||
id="table"
|
||||
data-url="{{route('api.hardware.list', array(''=>e(Input::get('status')),'order_number'=>e(Input::get('order_number')), 'status_id'=>e(Input::get('status_id')), 'report'=>'true'))}}"
|
||||
data-cookie="true"
|
||||
data-click-to-select="true"
|
||||
data-cookie-id-table="{{ e(Input::get('status')) }}assetTable-{{ config('version.hash_version') }}">
|
||||
<thead>
|
||||
<tr>
|
||||
@if (Input::get('status')!='Deleted')
|
||||
<th data-class="hidden-xs" data-switchable="false" data-searchable="false" data-sortable="false" data-field="checkbox"><div class="text-center"><input type="checkbox" id="checkAll" style="padding-left: 0px;"></div></th>
|
||||
@endif
|
||||
<th data-sortable="true" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
|
||||
<th data-field="companyName" data-searchable="true" data-sortable="true" data-switchable="true" data-visible="false">{{ trans('general.company') }}</th>
|
||||
<th data-sortable="true" data-field="name" data-visible="false">{{ trans('admin/hardware/form.name') }}</th>
|
||||
<th data-sortable="true" data-field="asset_tag">{{ trans('admin/hardware/table.asset_tag') }}</th>
|
||||
<th data-sortable="true" data-field="serial">{{ trans('admin/hardware/table.serial') }}</th>
|
||||
<th data-sortable="true" data-field="model">{{ trans('admin/hardware/form.model') }}</th>
|
||||
<th data-sortable="true" data-field="model_number" data-visible="false">{{ trans('admin/models/table.modelnumber') }}</th>
|
||||
<th data-sortable="true" data-field="status_label">{{ trans('admin/hardware/table.status') }}</th>
|
||||
<th data-sortable="true" data-field="assigned_to">{{ trans('admin/hardware/form.checkedout_to') }}</th>
|
||||
<th data-sortable="true" data-field="location" data-searchable="true">{{ trans('admin/hardware/table.location') }}</th>
|
||||
<th data-sortable="true" data-field="category" data-searchable="true">{{ trans('general.category') }}</th>
|
||||
<th data-sortable="true" data-field="manufacturer" data-searchable="true" data-visible="false">{{ trans('general.manufacturer') }}</th>
|
||||
<th data-sortable="true" data-field="purchase_cost" data-searchable="true" data-visible="false">{{ trans('admin/hardware/form.cost') }}</th>
|
||||
<th data-sortable="true" data-field="purchase_date" data-searchable="true" data-visible="false">{{ trans('admin/hardware/form.date') }}</th>
|
||||
<th data-sortable="false" data-field="eol" data-searchable="true">{{ trans('general.eol') }}</th>
|
||||
<th data-sortable="true" data-searchable="true" data-field="notes">{{ trans('general.notes') }}</th>
|
||||
<th data-sortable="true" data-searchable="true" data-field="order_number">{{ trans('admin/hardware/form.order') }}</th>
|
||||
<th data-sortable="true" data-searchable="true" data-field="last_checkout">{{ trans('admin/hardware/table.checkout_date') }}</th>
|
||||
<th data-sortable="true" data-field="expected_checkin" data-searchable="true">{{ trans('admin/hardware/form.expected_checkin') }}</th>
|
||||
@foreach(\App\Models\CustomField::all() AS $field)
|
||||
|
||||
<thead>
|
||||
<tr role="row">
|
||||
<th class="col-sm-1">{{ trans('admin/companies/table.title') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/hardware/table.asset_tag') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/hardware/form.manufacturer') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/hardware/form.model') }}</th>
|
||||
<th class="col-sm-1">{{ trans('general.model_no') }}</th>
|
||||
@if ($settings->display_asset_name)
|
||||
<th class="col-sm-1">{{ trans('general.name') }}</th>
|
||||
@endif
|
||||
<th class="col-sm-1">{{ trans('admin/hardware/table.serial') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/hardware/table.status') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/hardware/table.purchase_date') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/hardware/table.purchase_cost') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/hardware/form.order') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/hardware/form.supplier') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/hardware/table.checkoutto') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/hardware/table.location') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@foreach ($assets as $asset)
|
||||
<tr>
|
||||
<td>{{ is_null($asset->company) ? '' : $asset->company->name }}</td>
|
||||
<td>{{ $asset->asset_tag }}</td>
|
||||
<td>
|
||||
@if ($asset->model->manufacturer)
|
||||
{{ $asset->model->manufacturer->name }}
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $asset->model->name }}</td>
|
||||
<td>{{ $asset->model->modelno }}</td>
|
||||
@if ($settings->display_asset_name)
|
||||
<td>{{ $asset->name }}</td>
|
||||
@endif
|
||||
<td>{{ $asset->serial }}</td>
|
||||
<td>
|
||||
{{ ($asset->assigneduser) ? 'Deployed' : ((e($asset->assetstatus)) ? e($asset->assetstatus->name) : '') }}
|
||||
</td>
|
||||
<td>{{ $asset->purchase_date }}</td>
|
||||
<td class="align-right">{{ $settings->default_currency }}
|
||||
{{ \App\Helpers\Helper::formatCurrencyOutput($asset->purchase_cost) }}
|
||||
</td>
|
||||
<td>
|
||||
@if ($asset->order_number)
|
||||
{{ $asset->order_number }}
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if ($asset->supplier_id)
|
||||
<a href="{{ route('view/supplier', $asset->supplier_id) }}">
|
||||
{{ $asset->supplier->name }}
|
||||
</a>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if ($asset->assigneduser)
|
||||
@if ($asset->assigneduser->deleted_at!='')
|
||||
<del>{{ $asset->assigneduser->fullName() }}</del>
|
||||
@else
|
||||
<a href="{{ route('view/user', $asset->assigned_to) }}">
|
||||
{{ $asset->assigneduser->fullName() }}
|
||||
</a>
|
||||
@endif
|
||||
<th data-sortable="{{ ($field->field_encrypted=='1' ? 'false' : 'true') }}" data-visible="false" data-field="{{$field->db_column_name()}}">
|
||||
@if ($field->field_encrypted=='1')
|
||||
<i class="fa fa-lock"></i>
|
||||
@endif
|
||||
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if (($asset->assigneduser) && ($asset->assigneduser->userLoc))
|
||||
{{ $asset->assigneduser->userLoc->name }}
|
||||
@elseif ($asset->defaultLoc)
|
||||
{{ $asset->defaultLoc->name }}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
{{$field->name}}
|
||||
</th>
|
||||
|
||||
@endforeach
|
||||
<th data-sortable="true" data-field="created_at" data-searchable="true" data-visible="false">{{ trans('general.created_at') }}</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -122,6 +86,7 @@
|
|||
<script src="{{ asset('assets/js/extensions/export/bootstrap-table-export.js') }}"></script>
|
||||
<script src="{{ asset('assets/js/extensions/export/tableExport.js') }}"></script>
|
||||
<script src="{{ asset('assets/js/extensions/export/jquery.base64.js') }}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('#table').bootstrapTable({
|
||||
classes: 'table table-responsive table-no-bordered',
|
||||
|
@ -129,30 +94,39 @@
|
|||
iconsPrefix: 'fa',
|
||||
showRefresh: true,
|
||||
search: true,
|
||||
pageSize: {{ $settings->per_page }},
|
||||
pageSize: 100,
|
||||
pagination: true,
|
||||
sidePagination: 'client',
|
||||
sidePagination: 'server',
|
||||
sortable: true,
|
||||
showMultiSort: true,
|
||||
cookie: true,
|
||||
cookieExpire: '2y',
|
||||
mobileResponsive: true,
|
||||
showExport: true,
|
||||
showColumns: true,
|
||||
exportDataType: 'all',
|
||||
exportTypes: ['csv', 'txt','json', 'xml'],
|
||||
exportTypes: ['csv', 'excel', 'txt','json', 'xml'],
|
||||
maintainSelected: true,
|
||||
paginationFirstText: "{{ trans('general.first') }}",
|
||||
paginationLastText: "{{ trans('general.last') }}",
|
||||
paginationPreText: "{{ trans('general.previous') }}",
|
||||
paginationNextText: "{{ trans('general.next') }}",
|
||||
pageList: ['10','25','50','100','150','200'],
|
||||
pageList: ['10','25','50','100','150','200','500','1000'],
|
||||
exportOptions: {
|
||||
fileName: 'assets-export-' + (new Date()).toISOString().slice(0,10),
|
||||
},
|
||||
icons: {
|
||||
paginationSwitchDown: 'fa-caret-square-o-down',
|
||||
paginationSwitchUp: 'fa-caret-square-o-up',
|
||||
sort: 'fa fa-sort-amount-desc',
|
||||
plus: 'fa fa-plus',
|
||||
minus: 'fa fa-minus',
|
||||
columns: 'fa-columns',
|
||||
refresh: 'fa-refresh'
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
@stop
|
||||
|
||||
|
|
|
@ -34,6 +34,13 @@
|
|||
<div class="box-body">
|
||||
<div class="col-md-3">
|
||||
|
||||
<div class="checkbox col-md-12">
|
||||
<label>
|
||||
{{ Form::checkbox('company', '1') }}
|
||||
{{ trans('general.company') }}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="checkbox col-md-12">
|
||||
<label>
|
||||
{{ Form::checkbox('company_name', '1') }}
|
||||
|
|
Loading…
Reference in a new issue