当前位置: 首页>>代码示例>>PHP>>正文


PHP Helper::formatCurrencyOutput方法代码示例

本文整理汇总了PHP中app\helpers\Helper::formatCurrencyOutput方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::formatCurrencyOutput方法的具体用法?PHP Helper::formatCurrencyOutput怎么用?PHP Helper::formatCurrencyOutput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\helpers\Helper的用法示例。


在下文中一共展示了Helper::formatCurrencyOutput方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDatatable


//.........这里部分代码省略.........
         default:
             $assets->NotArchived();
             break;
     }
     if ($request->has('status_id')) {
         $assets->where('status_id', '=', e($request->get('status_id')));
     }
     $allowed_columns = ['id', 'name', 'asset_tag', 'serial', 'model', 'model_number', 'last_checkout', 'category', 'manufacturer', 'notes', 'expected_checkin', 'order_number', 'companyName', 'location', 'image', 'status_label', 'assigned_to', 'created_at', 'purchase_date', 'purchase_cost'];
     $all_custom_fields = CustomField::all();
     //used as a 'cache' of custom fields throughout this page load
     foreach ($all_custom_fields as $field) {
         $allowed_columns[] = $field->db_column_name();
     }
     $order = $request->get('order') === 'asc' ? 'asc' : 'desc';
     $sort = in_array($request->get('sort'), $allowed_columns) ? $request->get('sort') : 'asset_tag';
     switch ($sort) {
         case 'model':
             $assets = $assets->OrderModels($order);
             break;
         case 'model_number':
             $assets = $assets->OrderModelNumber($order);
             break;
         case 'category':
             $assets = $assets->OrderCategory($order);
             break;
         case 'manufacturer':
             $assets = $assets->OrderManufacturer($order);
             break;
         case 'companyName':
             $assets = $assets->OrderCompany($order);
             break;
         case 'location':
             $assets = $assets->OrderLocation($order);
             break;
         case 'status_label':
             $assets = $assets->OrderStatus($order);
             break;
         case 'assigned_to':
             $assets = $assets->OrderAssigned($order);
             break;
         default:
             $assets = $assets->orderBy($sort, $order);
             break;
     }
     $assetCount = $assets->count();
     $assets = $assets->skip($offset)->take($limit)->get();
     $rows = array();
     foreach ($assets as $asset) {
         $inout = '';
         $actions = '<div style="white-space: nowrap;">';
         if ($asset->deleted_at == '') {
             if (Gate::allows('assets.create')) {
                 $actions .= '<a href="' . route('clone/hardware', $asset->id) . '" class="btn btn-info btn-sm" title="Clone asset" data-toggle="tooltip"><i class="fa fa-clone"></i></a> ';
             }
             if (Gate::allows('assets.edit')) {
                 $actions .= '<a href="' . route('update/hardware', $asset->id) . '" class="btn btn-warning btn-sm" title="Edit asset" data-toggle="tooltip"><i class="fa fa-pencil icon-white"></i></a> ';
             }
             if (Gate::allows('assets.delete')) {
                 $actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/hardware', $asset->id) . '" data-content="' . trans('admin/hardware/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($asset->asset_tag) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
             }
         } elseif ($asset->model->deleted_at == '') {
             $actions .= '<a href="' . route('restore/hardware', $asset->id) . '" title="Restore asset" data-toggle="tooltip" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
         }
         $actions .= '</div>';
         if ($asset->availableForCheckout()) {
             if (Gate::allows('assets.checkout')) {
                 $inout = '<a href="' . route('checkout/hardware', $asset->id) . '" class="btn btn-info btn-sm" title="Checkout this asset to a user" data-toggle="tooltip">' . trans('general.checkout') . '</a>';
             }
         } else {
             if (Gate::allows('assets.checkin')) {
                 $inout = '<a href="' . route('checkin/hardware', $asset->id) . '" class="btn btn-primary btn-sm" title="Checkin this asset" data-toggle="tooltip">' . trans('general.checkin') . '</a>';
             }
         }
         $purchase_cost = Helper::formatCurrencyOutput($asset->purchase_cost);
         $row = array('checkbox' => '<div class="text-center"><input type="checkbox" name="edit_asset[' . $asset->id . ']" class="one_required"></div>', 'id' => $asset->id, 'image' => $asset->image && $asset->image != '' ? '<img src="' . config('app.url') . '/uploads/assets/' . $asset->image . '" height=50 width=50>' : ($asset->model && $asset->model->image != '' ? '<img src="' . config('app.url') . '/uploads/models/' . $asset->model->image . '" height=40 width=50>' : ''), 'name' => '<a title="' . e($asset->name) . '" href="hardware/' . $asset->id . '/view">' . e($asset->name) . '</a>', 'asset_tag' => '<a title="' . e($asset->asset_tag) . '" href="hardware/' . $asset->id . '/view">' . e($asset->asset_tag) . '</a>', 'serial' => e($asset->serial), 'model' => $asset->model ? (string) link_to('/hardware/models/' . $asset->model->id . '/view', e($asset->model->name)) : 'No model', 'model_number' => $asset->model && $asset->model->modelno ? (string) $asset->model->modelno : '', 'status_label' => $asset->assigneduser ? 'Deployed' : (e($asset->assetstatus) ? e($asset->assetstatus->name) : ''), 'assigned_to' => $asset->assigneduser ? (string) link_to(config('app.url') . '/admin/users/' . $asset->assigned_to . '/view', e($asset->assigneduser->fullName())) : '', 'location' => $asset->assigneduser && $asset->assigneduser->userloc != '' ? (string) link_to('admin/settings/locations/' . $asset->assigneduser->userloc->id . '/view', e($asset->assigneduser->userloc->name)) : ($asset->defaultLoc != '' ? (string) link_to('admin/settings/locations/' . $asset->defaultLoc->id . '/edit', e($asset->defaultLoc->name)) : ''), 'category' => $asset->model && $asset->model->category ? (string) link_to('/admin/settings/categories/' . $asset->model->category->id . '/view', e($asset->model->category->name)) : '', 'manufacturer' => $asset->model && $asset->model->manufacturer ? (string) link_to('/admin/settings/manufacturers/' . $asset->model->manufacturer->id . '/view', e($asset->model->manufacturer->name)) : '', 'eol' => $asset->eol_date() ? $asset->eol_date() : '', 'purchase_cost' => $purchase_cost, 'purchase_date' => $asset->purchase_date ? $asset->purchase_date : '', 'notes' => e($asset->notes), 'order_number' => $asset->order_number != '' ? '<a href="' . config('app.url') . '/hardware?order_number=' . e($asset->order_number) . '">' . e($asset->order_number) . '</a>' : '', 'last_checkout' => $asset->last_checkout != '' ? e($asset->last_checkout) : '', 'expected_checkin' => $asset->expected_checkin != '' ? e($asset->expected_checkin) : '', 'created_at' => $asset->created_at != '' ? e($asset->created_at->format('F j, Y h:iA')) : '', 'change' => $inout ? $inout : '', 'actions' => $actions ? $actions : '', 'companyName' => is_null($asset->company) ? '' : e($asset->company->name));
         foreach ($all_custom_fields as $field) {
             $column_name = $field->db_column_name();
             if ($field->isFieldDecryptable($asset->{$column_name})) {
                 if (Gate::allows('admin')) {
                     if ($field->format == 'URL' && $asset->{$column_name} != '') {
                         $row[$column_name] = '<a href="' . Helper::gracefulDecrypt($field, $asset->{$column_name}) . '" target="_blank">' . Helper::gracefulDecrypt($field, $asset->{$column_name}) . '</a>';
                     } else {
                         $row[$column_name] = Helper::gracefulDecrypt($field, $asset->{$column_name});
                     }
                 } else {
                     $row[$field->db_column_name()] = strtoupper(trans('admin/custom_fields/general.encrypted'));
                 }
             } else {
                 if ($field->format == 'URL' && $asset->{$field->db_column_name()} != '') {
                     $row[$field->db_column_name()] = '<a href="' . $asset->{$field->db_column_name()} . '" target="_blank">' . $asset->{$field->db_column_name()} . '</a>';
                 } else {
                     $row[$field->db_column_name()] = e($asset->{$field->db_column_name()});
                 }
             }
         }
         $rows[] = $row;
     }
     $data = array('total' => $assetCount, 'rows' => $rows);
     return $data;
 }
开发者ID:stijni,项目名称:snipe-it,代码行数:101,代码来源:AssetsController.php

示例2: exportAssetMaintenancesReport

 /**
  * exportImprovementsReport
  *
  * @return \Illuminate\Http\Response
  * @author  Vincent Sposato <vincent.sposato@gmail.com>
  * @version v1.0
  */
 public function exportAssetMaintenancesReport()
 {
     // Grab all the improvements
     $assetMaintenances = AssetMaintenance::with('asset', 'supplier')->orderBy('created_at', 'DESC')->get();
     $rows = [];
     $header = [trans('admin/asset_maintenances/table.asset_name'), trans('admin/asset_maintenances/table.supplier_name'), trans('admin/asset_maintenances/form.asset_maintenance_type'), trans('admin/asset_maintenances/form.title'), trans('admin/asset_maintenances/form.start_date'), trans('admin/asset_maintenances/form.completion_date'), trans('admin/asset_maintenances/form.asset_maintenance_time'), trans('admin/asset_maintenances/form.cost')];
     $header = array_map('trim', $header);
     $rows[] = implode($header, ',');
     foreach ($assetMaintenances as $assetMaintenance) {
         $row = [];
         $row[] = str_replace(',', '', e($assetMaintenance->asset->name));
         $row[] = str_replace(',', '', e($assetMaintenance->supplier->name));
         $row[] = e($assetMaintenance->improvement_type);
         $row[] = e($assetMaintenance->title);
         $row[] = e($assetMaintenance->start_date);
         $row[] = e($assetMaintenance->completion_date);
         if (is_null($assetMaintenance->asset_maintenance_time)) {
             $improvementTime = intval(Carbon::now()->diffInDays(Carbon::parse($assetMaintenance->start_date)));
         } else {
             $improvementTime = intval($assetMaintenance->asset_maintenance_time);
         }
         $row[] = $improvementTime;
         $row[] = trans('general.currency') . Helper::formatCurrencyOutput($assetMaintenance->cost);
         $rows[] = implode($row, ',');
     }
     // spit out a csv
     $csv = implode($rows, "\n");
     $response = Response::make($csv, 200);
     $response->header('Content-Type', 'text/csv');
     $response->header('Content-disposition', 'attachment;filename=report.csv');
     return $response;
 }
开发者ID:stijni,项目名称:snipe-it,代码行数:39,代码来源:ReportsController.php

示例3: getDatatable

 /**
  * Generates a JSON response to populate the licence index datatables.
  *
  * @author [A. Gianotto] [<snipe@snipe.net>]
  * @see LicensesController::getIndex() method that provides the view
  * @since [v1.0]
  * @return String JSON
  */
 public function getDatatable()
 {
     $licenses = Company::scopeCompanyables(License::with('company'));
     if (Input::has('search')) {
         $licenses = $licenses->TextSearch(Input::get('search'));
     }
     $allowed_columns = ['id', 'name', 'purchase_cost', 'expiration_date', 'purchase_order', 'order_number', 'notes', 'purchase_date', 'serial'];
     $order = Input::get('order') === 'asc' ? 'asc' : 'desc';
     $sort = in_array(Input::get('sort'), $allowed_columns) ? e(Input::get('sort')) : 'created_at';
     $licenses = $licenses->orderBy($sort, $order);
     $licenseCount = $licenses->count();
     $licenses = $licenses->skip(Input::get('offset'))->take(Input::get('limit'))->get();
     $rows = array();
     foreach ($licenses as $license) {
         $actions = '<span style="white-space: nowrap;">';
         if (Gate::allows('licenses.checkout')) {
             $actions .= '<a href="' . route('freecheckout/license', $license->id) . '" class="btn btn-primary btn-sm' . ($license->remaincount() > 0 ? '' : ' disabled') . '" style="margin-right:5px;">' . trans('general.checkout') . '</a> ';
         }
         if (Gate::allows('licenses.create')) {
             $actions .= '<a href="' . route('clone/license', $license->id) . '" class="btn btn-info btn-sm" style="margin-right:5px;" title="Clone asset"><i class="fa fa-files-o"></i></a>';
         }
         if (Gate::allows('licenses.edit')) {
             $actions .= '<a href="' . route('update/license', $license->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
         }
         if (Gate::allows('licenses.delete')) {
             $actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/license', $license->id) . '" data-content="' . trans('admin/licenses/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($license->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
         }
         $actions .= '</span>';
         $rows[] = array('id' => $license->id, 'name' => (string) link_to('/admin/licenses/' . $license->id . '/view', $license->name), 'serial' => (string) link_to('/admin/licenses/' . $license->id . '/view', mb_strimwidth($license->serial, 0, 50, "...")), 'totalSeats' => $license->totalSeatsByLicenseID(), 'remaining' => $license->remaincount(), 'license_name' => e($license->license_name), 'license_email' => e($license->license_email), 'purchase_date' => $license->purchase_date ? $license->purchase_date : '', 'expiration_date' => $license->expiration_date ? $license->expiration_date : '', 'purchase_cost' => Helper::formatCurrencyOutput($license->purchase_cost), 'purchase_order' => $license->purchase_order ? e($license->purchase_order) : '', 'order_number' => $license->order_number ? e($license->order_number) : '', 'notes' => $license->notes ? e($license->notes) : '', 'actions' => $actions, 'companyName' => is_null($license->company) ? '' : e($license->company->name), 'manufacturer' => $license->manufacturer ? (string) link_to('/admin/settings/manufacturers/' . $license->manufacturer_id . '/view', $license->manufacturer->name) : '');
     }
     $data = array('total' => $licenseCount, 'rows' => $rows);
     return $data;
 }
开发者ID:stijni,项目名称:snipe-it,代码行数:41,代码来源:LicensesController.php

示例4: getDatatable

 /**
  * Generates the JSON response for accessories listing view.
  *
  * For debugging, see at /api/accessories/list
  *
  * @author [A. Gianotto] [<snipe@snipe.net>]
  * @since [v3.0]
  * @return string JSON
  **/
 public function getDatatable()
 {
     $components = Company::scopeCompanyables(Component::select('components.*')->whereNull('components.deleted_at')->with('company', 'location', 'category'));
     if (Input::has('search')) {
         $components = $components->TextSearch(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 = ['id', 'name', 'min_amt', 'order_number', 'purchase_date', 'purchase_cost', 'companyName', 'category', 'total_qty'];
     $order = Input::get('order') === 'asc' ? 'asc' : 'desc';
     $sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
     switch ($sort) {
         case 'category':
             $components = $components->OrderCategory($order);
             break;
         case 'location':
             $components = $components->OrderLocation($order);
             break;
         case 'companyName':
             $components = $components->OrderCompany($order);
             break;
         default:
             $components = $components->orderBy($sort, $order);
             break;
     }
     $consumCount = $components->count();
     $components = $components->skip($offset)->take($limit)->get();
     $rows = array();
     foreach ($components as $component) {
         $actions = '<nobr>';
         if (Gate::allows('components.checkout')) {
             $actions .= '<a href="' . route('checkout/component', $component->id) . '" style="margin-right:5px;" class="btn btn-info btn-sm ' . ($component->numRemaining() > 0 ? '' : ' disabled') . '" ' . ($component->numRemaining() > 0 ? '' : ' disabled') . '>' . trans('general.checkout') . '</a>';
         }
         if (Gate::allows('components.edit')) {
             $actions .= '<a href="' . route('update/component', $component->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
         }
         if (Gate::allows('components.delete')) {
             $actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/component', $component->id) . '" data-content="' . trans('admin/components/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($component->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
         }
         $actions .= '</nobr>';
         $company = $component->company;
         $rows[] = array('checkbox' => '<div class="text-center"><input type="checkbox" name="component[' . $component->id . ']" class="one_required"></div>', 'id' => $component->id, 'name' => (string) link_to('admin/components/' . $component->id . '/view', e($component->name)), 'location' => $component->location ? e($component->location->name) : '', 'total_qty' => e($component->total_qty), 'min_amt' => e($component->min_amt), 'category' => $component->category ? e($component->category->name) : 'Missing category', 'order_number' => e($component->order_number), 'purchase_date' => e($component->purchase_date), 'purchase_cost' => Helper::formatCurrencyOutput($component->purchase_cost), 'numRemaining' => $component->numRemaining(), 'actions' => $actions, 'companyName' => is_null($company) ? '' : e($company->name));
     }
     $data = array('total' => $consumCount, 'rows' => $rows);
     return $data;
 }
开发者ID:stijni,项目名称:snipe-it,代码行数:63,代码来源:ComponentsController.php

示例5: getDatatable

 /**
  * Generates the JSON response for accessories listing view.
  *
  * Example:
  * {
  *  "actions": "(links to available actions)",
  *  "category": "(link to category)",
  *  "companyName": "My Company",
  *  "location":  "My Location",
  *  "min_amt": 2,
  *  "name":  "(link to accessory),
  *  "numRemaining": 6,
  *  "order_number": null,
  *  "purchase_cost": "0.00",
  *  "purchase_date": null,
  *  "qty": 7
  *  },
  *
  * The names of the fields in the returns JSON correspond directly to the the
  * names of the fields in the bootstrap-tables in the view.
  *
  * For debugging, see at /api/accessories/list
  *
  * @author [A. Gianotto] [<snipe@snipe.net>]
  * @param  int  $accessoryId
  * @return string JSON containing accessories and their associated atrributes.
  **/
 public function getDatatable(Request $request)
 {
     $accessories = Company::scopeCompanyables(Accessory::select('accessories.*')->with('category', 'company'))->whereNull('accessories.deleted_at');
     if (Input::has('search')) {
         $accessories = $accessories->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 = ['name', 'min_amt', 'order_number', 'purchase_date', 'purchase_cost', 'companyName', 'category'];
     $order = Input::get('order') === 'asc' ? 'asc' : 'desc';
     $sort = in_array(Input::get('sort'), $allowed_columns) ? e(Input::get('sort')) : 'created_at';
     switch ($sort) {
         case 'category':
             $accessories = $accessories->OrderCategory($order);
             break;
         case 'companyName':
             $accessories = $accessories->OrderCompany($order);
             break;
         default:
             $accessories = $accessories->orderBy($sort, $order);
             break;
     }
     $accessCount = $accessories->count();
     $accessories = $accessories->skip($offset)->take($limit)->get();
     $rows = array();
     foreach ($accessories as $accessory) {
         $actions = '<nobr>';
         if (Gate::allows('accessories.checkout')) {
             $actions .= '<a href="' . route('checkout/accessory', $accessory->id) . '" style="margin-right:5px;" class="btn btn-info btn-sm" ' . ($accessory->numRemaining() > 0 ? '' : ' disabled') . '>' . trans('general.checkout') . '</a>';
         }
         if (Gate::allows('accessories.edit')) {
             $actions .= '<a href="' . route('update/accessory', $accessory->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
         }
         if (Gate::allows('accessories.delete')) {
             $actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/accessory', $accessory->id) . '" data-content="' . trans('admin/accessories/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($accessory->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
         }
         $actions .= '</nobr>';
         $company = $accessory->company;
         $rows[] = array('name' => '<a href="' . url('admin/accessories/' . $accessory->id) . '/view">' . $accessory->name . '</a>', 'category' => $accessory->category ? (string) link_to('admin/settings/categories/' . $accessory->category->id . '/view', $accessory->category->name) : '', 'qty' => e($accessory->qty), 'order_number' => e($accessory->order_number), 'min_amt' => e($accessory->min_amt), 'location' => $accessory->location ? e($accessory->location->name) : '', 'purchase_date' => e($accessory->purchase_date), 'purchase_cost' => Helper::formatCurrencyOutput($accessory->purchase_cost), 'numRemaining' => $accessory->numRemaining(), 'actions' => $actions, 'companyName' => is_null($company) ? '' : e($company->name), 'manufacturer' => $accessory->manufacturer ? (string) link_to('/admin/settings/manufacturers/' . $accessory->manufacturer_id . '/view', $accessory->manufacturer->name) : '');
     }
     $data = array('total' => $accessCount, 'rows' => $rows);
     return $data;
 }
开发者ID:stijni,项目名称:snipe-it,代码行数:78,代码来源:AccessoriesController.php


注:本文中的app\helpers\Helper::formatCurrencyOutput方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。