本文整理汇总了PHP中Utils::formatMoney方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::formatMoney方法的具体用法?PHP Utils::formatMoney怎么用?PHP Utils::formatMoney使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils
的用法示例。
在下文中一共展示了Utils::formatMoney方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDatatable
public function getDatatable()
{
$clients = $this->clientRepo->find(Input::get('sSearch'));
return Datatable::query($clients)->addColumn('checkbox', function ($model) {
return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
})->addColumn('name', function ($model) {
return link_to('clients/' . $model->public_id, $model->name);
})->addColumn('first_name', function ($model) {
return link_to('clients/' . $model->public_id, $model->first_name . ' ' . $model->last_name);
})->addColumn('email', function ($model) {
return link_to('clients/' . $model->public_id, $model->email);
})->addColumn('created_at', function ($model) {
return Utils::timestampToDateString(strtotime($model->created_at));
})->addColumn('last_login', function ($model) {
return Utils::timestampToDateString(strtotime($model->last_login));
})->addColumn('balance', function ($model) {
return Utils::formatMoney($model->balance, $model->currency_id);
})->addColumn('dropdown', function ($model) {
return '<div class="btn-group tr-action" style="visibility:hidden;">
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
' . trans('texts.select') . ' <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="' . URL::to('clients/' . $model->public_id . '/edit') . '">' . trans('texts.edit_client') . '</a></li>
<li class="divider"></li>
<li><a href="' . URL::to('invoices/create/' . $model->public_id) . '">' . trans('texts.new_invoice') . '</a></li>
<li><a href="' . URL::to('payments/create/' . $model->public_id) . '">' . trans('texts.new_payment') . '</a></li>
<li><a href="' . URL::to('credits/create/' . $model->public_id) . '">' . trans('texts.new_credit') . '</a></li>
<li class="divider"></li>
<li><a href="javascript:archiveEntity(' . $model->public_id . ')">' . trans('texts.archive_client') . '</a></li>
<li><a href="javascript:deleteEntity(' . $model->public_id . ')">' . trans('texts.delete_client') . '</a></li>
</ul>
</div>';
})->make();
}
示例2: getDatatable
public function getDatatable()
{
$products = $this->ProductRepo->find(Input::get('sSearch'));
return Datatable::query($products)->addColumn('checkbox', function ($model) {
return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
})->addColumn('product_key', function ($model) {
return link_to('products/' . $model->public_id, $model->product_key);
})->addColumn('notes', function ($model) {
return nl2br(Str::limit($model->notes, 50));
})->addColumn('cost', function ($model) {
return Utils::formatMoney($model->cost, 1);
})->addColumn('name', function ($model) {
return nl2br($model->category_name);
})->addColumn('dropdown', function ($model) {
return '<div class="btn-group tr-action" style="visibility:hidden;">
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
' . trans('texts.select') . ' <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="' . URL::to('products/' . $model->public_id) . '/edit">' . uctrans('texts.edit_product') . '</a></li>
<li class="divider"></li>
<li><a href="' . URL::to('products/' . $model->public_id) . '/archive">' . uctrans('texts.delete_product') . '</a></li>
</ul>
</div>';
})->make();
}
示例3: getDatatable
public function getDatatable($clientPublicId = null)
{
$credits = $this->creditRepo->find($clientPublicId, Input::get('sSearch'));
$table = Datatable::query($credits);
if (!$clientPublicId) {
$table->addColumn('checkbox', function ($model) {
return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
})->addColumn('client_name', function ($model) {
return link_to('clients/' . $model->client_public_id, Utils::getClientDisplayName($model));
});
}
return $table->addColumn('amount', function ($model) {
return Utils::formatMoney($model->amount, $model->currency_id);
})->addColumn('balance', function ($model) {
return Utils::formatMoney($model->balance, $model->currency_id);
})->addColumn('credit_date', function ($model) {
return Utils::fromSqlDate($model->credit_date);
})->addColumn('private_notes', function ($model) {
return $model->private_notes;
})->addColumn('dropdown', function ($model) {
return '<div class="btn-group tr-action" style="visibility:hidden;">
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
' . trans('texts.select') . ' <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="javascript:archiveEntity(' . $model->public_id . ')">' . trans('texts.archive_credit') . '</a></li>
<li><a href="javascript:deleteEntity(' . $model->public_id . ')">' . trans('texts.delete_credit') . '</a></li>
</ul>
</div>';
})->make();
}
示例4: getDatatable
public function getDatatable($clientPublicId)
{
$query = DB::table('activities')->join('clients', 'clients.id', '=', 'activities.client_id')->where('clients.public_id', '=', $clientPublicId)->where('activities.account_id', '=', Auth::user()->account_id)->select('activities.id', 'activities.message', 'activities.created_at', 'activities.balance', 'activities.adjustment');
return Datatable::query($query)->addColumn('id', function ($model) {
return Utils::timestampToDateTimeString(strtotime($model->created_at));
})->addColumn('message', function ($model) {
return Utils::decodeActivity($model->message);
})->addColumn('balance', function ($model) {
return Utils::formatMoney($model->balance, 1);
})->addColumn('adjustment', function ($model) {
return $model->adjustment != 0 ? Utils::formatMoney($model->adjustment, 1) : '';
})->make();
}
示例5: index
public function index()
{
// total_income, billed_clients, invoice_sent and active_clients
$select = DB::raw('COUNT(DISTINCT CASE WHEN invoices.id IS NOT NULL THEN clients.id ELSE null END) billed_clients,
SUM(CASE WHEN invoices.invoice_status_id >= ' . INVOICE_STATUS_SENT . ' THEN 1 ELSE 0 END) invoices_sent,
COUNT(DISTINCT clients.id) active_clients,
AVG(invoices.amount) as invoice_avg');
$metrics = DB::table('accounts')->select($select)->leftJoin('clients', 'accounts.id', '=', 'clients.account_id')->leftJoin('invoices', 'clients.id', '=', 'invoices.client_id')->where('accounts.id', '=', Auth::user()->account_id)->where('clients.is_deleted', '=', false)->groupBy('accounts.id')->first();
$select = DB::raw('SUM(clients.paid_to_date) as value');
$totalIncome = DB::table('accounts')->select($select)->leftJoin('clients', 'accounts.id', '=', 'clients.account_id')->where('accounts.id', '=', Auth::user()->account_id)->where('clients.is_deleted', '=', false)->groupBy('accounts.id')->first();
$activities = Activity::where('activities.account_id', '=', Auth::user()->account_id)->orderBy('created_at', 'desc')->take(6)->get();
$pastDue = Invoice::scope()->where('due_date', '<', date('Y-m-d'))->where('balance', '>', 0)->where('is_recurring', '=', false)->where('is_quote', '=', false)->where('is_deleted', '=', false)->orderBy('due_date', 'asc')->take(6)->get();
$upcoming = Invoice::scope()->where('due_date', '>=', date('Y-m-d'))->where('balance', '>', 0)->where('is_recurring', '=', false)->where('is_quote', '=', false)->where('is_deleted', '=', false)->orderBy('due_date', 'asc')->take(6)->get();
$data = ['totalIncome' => Utils::formatMoney($totalIncome ? $totalIncome->value : 0, Session::get(SESSION_CURRENCY)), 'billedClients' => $metrics ? $metrics->billed_clients : 0, 'invoicesSent' => $metrics ? $metrics->invoices_sent : 0, 'activeClients' => $metrics ? $metrics->active_clients : 0, 'invoiceAvg' => Utils::formatMoney($metrics ? $metrics->invoice_avg : 0, Session::get(SESSION_CURRENCY)), 'activities' => $activities, 'pastDue' => $pastDue, 'upcoming' => $upcoming];
return View::make('dashboard', $data);
}
示例6: getRecurringDatatable
public function getRecurringDatatable($clientPublicId = null)
{
$query = $this->invoiceRepo->getRecurringInvoices(Auth::user()->account_id, $clientPublicId, Input::get('sSearch'));
$table = Datatable::query($query);
if (!$clientPublicId) {
$table->addColumn('checkbox', function ($model) {
return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '" ' . Utils::getEntityRowClass($model) . '>';
});
}
$table->addColumn('frequency', function ($model) {
return link_to('invoices/' . $model->public_id, $model->frequency);
});
if (!$clientPublicId) {
$table->addColumn('client_name', function ($model) {
return link_to('clients/' . $model->client_public_id, Utils::getClientDisplayName($model));
});
}
return $table->addColumn('start_date', function ($model) {
return Utils::fromSqlDate($model->start_date);
})->addColumn('end_date', function ($model) {
return Utils::fromSqlDate($model->end_date);
})->addColumn('amount', function ($model) {
return Utils::formatMoney($model->amount, $model->currency_id);
})->addColumn('dropdown', function ($model) {
if ($model->is_deleted) {
return '<div style="height:38px"/>';
}
$str = '<div class="btn-group tr-action" style="visibility:hidden;">
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
' . trans('texts.select') . ' <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">';
if (!$model->deleted_at || $model->deleted_at == '0000-00-00') {
$str .= '<li><a href="' . URL::to('invoices/' . $model->public_id . '/edit') . '">' . trans('texts.edit_invoice') . '</a></li>
<li class="divider"></li>
<li><a href="javascript:archiveEntity(' . $model->public_id . ')">' . trans('texts.archive_invoice') . '</a></li>
<li><a href="javascript:deleteEntity(' . $model->public_id . ')">' . trans('texts.delete_invoice') . '</a></li>';
} else {
$str .= '<li><a href="javascript:restoreEntity(' . $model->public_id . ')">' . trans('texts.restore_invoice') . '</a></li>';
}
return $str . '</ul>
</div>';
})->make();
}
示例7: getDatatable
public function getDatatable()
{
$query = DB::table('products')->where('products.account_id', '=', Auth::user()->account_id)->where('products.deleted_at', '=', null)->select('products.public_id', 'products.product_key', 'products.notes', 'products.cost');
return Datatable::query($query)->addColumn('product_key', function ($model) {
return link_to('products/' . $model->public_id . '/edit', $model->product_key);
})->addColumn('notes', function ($model) {
return nl2br(Str::limit($model->notes, 100));
})->addColumn('cost', function ($model) {
return Utils::formatMoney($model->cost);
})->addColumn('dropdown', function ($model) {
return '<div class="btn-group tr-action" style="visibility:hidden;">
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
' . trans('texts.select') . ' <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="' . URL::to('products/' . $model->public_id) . '/edit">' . uctrans('texts.edit_product') . '</a></li>
<li class="divider"></li>
<li><a href="' . URL::to('products/' . $model->public_id) . '/archive">' . uctrans('texts.archive_product') . '</a></li>
</ul>
</div>';
})->orderColumns(['cost', 'product_key', 'cost'])->make();
}
示例8: getDatatable
public function getDatatable($clientPublicId = null)
{
$payments = $this->paymentRepo->find($clientPublicId, Input::get('sSearch'));
$table = Datatable::query($payments);
if (!$clientPublicId) {
$table->addColumn('checkbox', function ($model) {
return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
});
}
$table->addColumn('invoice_number', function ($model) {
return $model->invoice_public_id ? link_to('invoices/' . $model->invoice_public_id . '/edit', $model->invoice_number) : '';
});
if (!$clientPublicId) {
$table->addColumn('client_name', function ($model) {
return link_to('clients/' . $model->client_public_id, Utils::getClientDisplayName($model));
});
}
$table->addColumn('transaction_reference', function ($model) {
return $model->transaction_reference ? $model->transaction_reference : '<i>Manual entry</i>';
})->addColumn('payment_type', function ($model) {
return $model->payment_type ? $model->payment_type : ($model->account_gateway_id ? '<i>Online payment</i>' : '');
});
return $table->addColumn('amount', function ($model) {
return Utils::formatMoney($model->amount, $model->currency_id);
})->addColumn('payment_date', function ($model) {
return Utils::dateToString($model->payment_date);
})->addColumn('dropdown', function ($model) {
return '<div class="btn-group tr-action" style="visibility:hidden;">
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
' . trans('texts.select') . ' <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="javascript:archiveEntity(' . $model->public_id . ')">' . trans('texts.archive_payment') . '</a></li>
<li><a href="javascript:deleteEntity(' . $model->public_id . ')">' . trans('texts.delete_payment') . '</a></li>
</ul>
</div>';
})->make();
}
示例9: getAmount
public function getAmount()
{
return Utils::formatMoney($this->amount, $this->client->currency_id);
}
示例10: getClientDatatable
public function getClientDatatable()
{
$search = Input::get('sSearch');
$invitationKey = Session::get('invitation_key');
$invitation = Invitation::where('invitation_key', '=', $invitationKey)->with('contact.client')->first();
if (!$invitation) {
return [];
}
$invoice = $invitation->invoice;
if (!$invoice || $invoice->is_deleted) {
return [];
}
$payments = $this->paymentRepo->findForContact($invitation->contact->id, Input::get('sSearch'));
return Datatable::query($payments)->addColumn('invoice_number', function ($model) {
return $model->invitation_key ? link_to('/view/' . $model->invitation_key, $model->invoice_number) : $model->invoice_number;
})->addColumn('transaction_reference', function ($model) {
return $model->transaction_reference ? $model->transaction_reference : '<i>Manual entry</i>';
})->addColumn('payment_type', function ($model) {
return $model->payment_type ? $model->payment_type : ($model->account_gateway_id ? '<i>Online payment</i>' : '');
})->addColumn('amount', function ($model) {
return Utils::formatMoney($model->amount, $model->currency_id);
})->addColumn('payment_date', function ($model) {
return Utils::dateToString($model->payment_date);
})->make();
}
示例11: archiveCredit
public static function archiveCredit($credit)
{
if ($credit->is_deleted) {
return;
}
$activity = Activity::getBlank();
$activity->client_id = $credit->client_id;
$activity->credit_id = $credit->id;
$activity->activity_type_id = ACTIVITY_TYPE_ARCHIVE_CREDIT;
$activity->message = Utils::encodeActivity(Auth::user(), 'archived ' . Utils::formatMoney($credit->balance, $credit->client->currency_id) . ' credit');
$activity->balance = $credit->client->balance;
$activity->save();
}
示例12: getDatatable
public function getDatatable()
{
$clients = $this->clientRepo->find(Input::get('sSearch'));
if (Utils::isAdmin()) {
return Datatable::query($clients)->addColumn('checkbox', function ($model) {
return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
})->addColumn('public_id', function ($model) {
return $model->public_id;
})->addColumn('name', function ($model) {
return link_to('clients/' . $model->public_id, $model->name);
})->addColumn('first_name', function ($model) {
return $model->first_name . ' ' . $model->last_name;
})->addColumn('work_phone', function ($model) {
return $model->work_phone ? $model->work_phone : $model->phone;
})->addColumn('balance', function ($model) {
return Utils::formatMoney($model->balance, 1);
})->addColumn('paid_to_date', function ($model) {
return Utils::formatMoney($model->paid_to_date, 1);
})->addColumn('dropdown', function ($model) {
$str = '<div class="btn-group tr-action" style="visibility:hidden;">
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
' . trans('texts.select') . ' <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">';
if (!$model->deleted_at || $model->deleted_at == '0000-00-00') {
$str .= '<li><a href="' . URL::to('clients/' . $model->public_id . '/edit') . '">' . trans('texts.edit_client') . '</a></li>
<li class="divider"></li>
<li><a href="' . URL::to('invoices/create/' . $model->public_id) . '">' . trans('texts.new_invoice') . '</a></li>
<li><a href="' . URL::to('payments/create/' . $model->public_id) . '">' . trans('texts.new_payment') . '</a></li>
<li><a href="' . URL::to('credits/create/' . $model->public_id) . '">' . trans('texts.new_credit') . '</a></li>
<li class="divider"></li>
<li><a href="javascript:archiveEntity(' . $model->public_id . ')">' . trans('texts.archive_client') . '</a></li>';
} else {
$str .= '<li><a href="javascript:restoreEntity(' . $model->public_id . ')">' . trans('texts.restore_client') . '</a></li>';
}
$str .= '</ul></div>';
return $str;
})->make();
} else {
return Datatable::query($clients)->addColumn('checkbox', function ($model) {
return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
})->addColumn('public_id', function ($model) {
return $model->public_id;
})->addColumn('name', function ($model) {
return link_to('clients/' . $model->public_id, $model->name);
})->addColumn('first_name', function ($model) {
return link_to('clients/' . $model->public_id, $model->first_name . ' ' . $model->last_name);
})->addColumn('work_phone', function ($model) {
return $model->work_phone ? $model->work_phone : $model->phone;
})->addColumn('balance', function ($model) {
return Utils::formatMoney($model->balance, 1);
})->addColumn('paid_to_date', function ($model) {
return Utils::formatMoney($model->paid_to_date, 1);
})->addColumn('dropdown', function ($model) {
return '<div class="btn-group tr-action" style="visibility:hidden;">
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
' . trans('texts.select') . ' <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="' . URL::to('invoices/create/' . $model->public_id) . '">' . trans('texts.new_invoice') . '</a></li>
<li><a href="' . URL::to('payments/create/' . $model->public_id) . '">' . trans('texts.new_payment') . '</a></li>
<li><a href="' . URL::to('credits/create/' . $model->public_id) . '">' . trans('texts.new_credit') . '</a></li>
</ul>
</div>';
})->make();
}
}
示例13: restoreCredit
public static function restoreCredit($credit)
{
$activity = Activity::getBlank();
$activity->client_id = $credit->client_id;
$activity->credit_id = $credit->id;
$activity->activity_type_id = ACTIVITY_TYPE_RESTORE_CREDIT;
$activity->message = Utils::encodeActivity(Auth::user(), 'restored ' . Utils::formatMoney($credit->balance, $credit->client->currency_id) . ' credit');
$activity->balance = $credit->client->balance;
$activity->save();
}