本文整理汇总了PHP中format_money函数的典型用法代码示例。如果您正苦于以下问题:PHP format_money函数的具体用法?PHP format_money怎么用?PHP format_money使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_money函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDiscountAmount
/**
* Get the amount incurred after a discount
*
* @param bool $format
*
* @return mixed
*/
public function getDiscountAmount($format = true)
{
if ($format) {
return format_money($this->discount->product($this));
}
return $this->discount->product($this)->getAmount();
}
示例2: quotes_render_summarybox
function quotes_render_summarybox($id)
{
log_debug("inc_quotes", "quotes_render_summarybox({$id})");
// fetch quote information
$sql_obj = new sql_query();
$sql_obj->string = "SELECT code_quote, amount_total, date_validtill, date_sent, sentmethod FROM account_quotes WHERE id='{$id}' LIMIT 1";
$sql_obj->execute();
if ($sql_obj->num_rows()) {
$sql_obj->fetch_array();
if ($sql_obj->data[0]["amount_total"] == 0) {
print "<table width=\"100%\" class=\"table_highlight_important\">";
print "<tr>";
print "<td>";
print "<b>Quote " . $sql_obj->data[0]["code_quote"] . " has no items on it</b>";
print "<p>This quote needs to have some items added to it using the links in the nav menu above.</p>";
print "</td>";
print "</tr>";
print "</table>";
} else {
if (time_date_to_timestamp($sql_obj->data[0]["date_validtill"]) <= time()) {
print "<table width=\"100%\" class=\"table_highlight_important\">";
print "<tr>";
print "<td>";
print "<p><b>Quote " . $sql_obj->data[0]["code_quote"] . " has now expired and is no longer valid.</b></p>";
print "</td>";
print "</tr>";
print "</table>";
} else {
print "<table width=\"100%\" class=\"table_highlight_important\">";
print "<tr>";
print "<td>";
print "<b>Quote " . $sql_obj->data[0]["code_quote"] . " is currently valid.</b>";
print "<table cellpadding=\"4\">";
print "<tr>";
print "<td>Quote Total:</td>";
print "<td>" . format_money($sql_obj->data[0]["amount_total"]) . "</td>";
print "</tr>";
print "<tr>";
print "<td>Valid Until:</td>";
print "<td>" . $sql_obj->data[0]["date_validtill"] . "</td>";
print "</tr>";
print "<tr>";
print "<td>Date Sent:</td>";
if ($sql_obj->data[0]["sentmethod"] == "") {
print "<td><i>Has not been sent to customer</i></td>";
} else {
print "<td>" . $sql_obj->data[0]["date_sent"] . " (" . $sql_obj->data[0]["sentmethod"] . ")</td>";
}
print "</tr>";
print "</tr></table>";
print "</td>";
print "</tr>";
print "</table>";
}
}
print "<br>";
}
}
示例3: getDataTable
/**
* @return mixed
*/
public function getDataTable()
{
$products = $this->products->with(['category', 'subcategory', 'brand', 'reviews'])->select('*');
return Datatables::of($products)->addColumn('edit', function ($product) {
return link_to(route('backend.products.edit', ['id' => $product->id]), 'Edit', ['data-target-model' => $product->id, 'class' => 'btn btn-xs btn-primary']);
})->editColumn('price', function ($product) {
return format_money($product->price);
})->make(true);
}
示例4: service_render_summarybox
function service_render_summarybox($id_service)
{
log_debug("inc_service", "service_render_summarybox({$id_service})");
$sql_obj = new sql_query();
$sql_obj->string = "SELECT name_service,\n\t\t\t\t\t\tactive,\n\t\t\t\t\t\tservice_types.name as type_name,\n\t\t\t\t\t\tservice_groups.group_name as group_name,\n\t\t\t\t\t\tprice,\n\t\t\t\t\t\tdiscount\n\t\t\t\t\tFROM services\n\t\t\t\t\tLEFT JOIN service_types ON service_types.id = services.typeid\n\t\t\t\t\tLEFT JOIN service_groups ON service_groups.id = services.id_service_group\n\t\t\t\t\tWHERE services.id='{$id_service}' LIMIT 1";
$sql_obj->execute();
if ($sql_obj->num_rows()) {
$sql_obj->fetch_array();
if ($sql_obj->data[0]["active"]) {
// service is enabled
print "<table width=\"100%\" class=\"table_highlight_open\">";
print "<tr>";
print "<td>";
print "<b>Service " . $sql_obj->data[0]["name_service"] . " is enabled.</b>";
print "<table cellpadding=\"4\">";
print "<tr>";
print "<td>Service Type:</td>";
print "<td>" . $sql_obj->data[0]["type_name"] . "</td>";
print "</tr>";
print "<tr>";
print "<td>Service Group:</td>";
print "<td>" . $sql_obj->data[0]["group_name"] . "</td>";
print "</tr>";
if ($sql_obj->data[0]["discount"]) {
// work out the price after discount
$discount_calc = $sql_obj->data[0]["discount"] / 100;
$discount_calc = $sql_obj->data[0]["price"] * $discount_calc;
print "<tr>";
print "<td>Base Plan Price:</td>";
print "<td>" . format_money($sql_obj->data[0]["price"] - $discount_calc) . " (discount of " . format_money($discount_calc) . " included)</td>";
print "</tr>";
} else {
print "<tr>";
print "<td>Base Plan Price:</td>";
print "<td>" . format_money($sql_obj->data[0]["price"]) . "</td>";
print "</tr>";
}
print "</table>";
print "</td>";
print "</tr>";
print "</table>";
} else {
// service is not yet enabled
print "<table width=\"100%\" class=\"table_highlight_important\">";
print "<tr>";
print "<td>";
print "<b>Service " . $sql_obj->data[0]["name_service"] . " is inactive.</b>";
print "<p>This service is currently unconfigured, you need to setup the service plan before it will be activated.</p>";
print "</td>";
print "</tr>";
print "</table>";
}
print "<br>";
}
}
示例5: popoverReceiptPreview
public function popoverReceiptPreview($receipt_id)
{
$r = Receipt::where('id', $receipt_id)->first();
$data['transaction'] = Receipt::buildReceipt($receipt_id);
$data['created_date'] = ng_date_format($r->created_at);
$data['created_time'] = ng_time_format($r->created_at);
$data['sales_person'] = istr::title(User::where('id', $r->user_id)->first()->name);
$data['total_amount_due'] = format_money($r->receipt_worth);
$data['total_amount_tendered'] = format_money($r->amount_tendered);
$data['change'] = format_money($r->change);
$s = Salelog::where('receipt_id', $receipt_id)->get()->toArray();
//$s = Salelog::where('receipt_id', $receipt_id)->get();
$data['items'] = $s;
//tt($data['items']->discount);
//$data['items']->unitprice = $data['items']->unitprice - (($data['items']->unitprice / 100) * (($data['items']->discount > 0) ? $data['items']->discount : 1 ));
//tt($data['items']);
return View::make('admin.quick_receipt_preview', $data);
}
示例6: printValue
function printValue($val, $h, $css)
{
$align = '';
// Maybe formalise 'time_length' filter, but check SQL pre-filter also
if ($h['filter_special'] == 'time_length') {
// $val = format_time_interval_prefs($val);
$val = format_time_interval($val, true, '%.2f');
if (!$val) {
$val = 0;
}
} elseif ($h['description'] == 'time_input_length') {
$val = format_time_interval($val, true, '%.2f');
if (!$val) {
$val = 0;
}
}
switch ($h['filter']) {
case 'date':
// we leave the date in 0000-000-00 00:00:00 format
break;
case 'currency':
if ($val) {
$val = format_money($val);
} else {
$val = 0;
}
break;
case 'number':
$align = 'align="right"';
if (!$val) {
$val = 0;
}
break;
}
if (is_numeric($val)) {
echo $val . ", ";
} else {
// escape " character (csv)
$val = str_replace('"', '""', $val);
echo '"' . $val . '" , ';
}
}
示例7: printValue
function printValue($val, $h, $css)
{
$align = '';
// Maybe formalise 'time_length' filter, but check SQL pre-filter also
if ($h['filter_special'] == 'time_length') {
// $val = format_time_interval_prefs($val);
$val = format_time_interval($val, true, '%.2f');
if (!$val) {
$val = 0;
}
} elseif ($h['description'] == 'time_input_length') {
$val = format_time_interval($val, true, '%.2f');
if (!$val) {
$val = 0;
}
}
switch ($h['filter']) {
case 'date':
if ($val) {
$val = format_date($val, 'short');
}
break;
case 'currency':
if ($val) {
$val = format_money($val);
} else {
$val = 0;
}
break;
case 'number':
$align = 'align="right"';
if (!$val) {
$val = 0;
}
break;
}
echo '<td ' . $align . ' ' . $css . '>' . $val . "</td>\n";
}
示例8: foreach
<table cellspacing=0 cellpadding=5 id="currency_table">
<tr><th align=left>Currency</th><th align=right>Amount</th></tr>
<?php
foreach ($currencies as $code => $currency) {
$amount = currency_value($reserve, $code);
if (!ereg("[1-9]", $amount)) {
continue;
}
?>
<tr>
<td align=left><?php
echo $currency["name"];
?>
</td>
<td align=right><?php
echo format_money($amount . $code, $code);
?>
</td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
<hr size="1" />
<h2>Add Funds</h2>
<p>
Money in your reserve can be used to sponsor projects.
示例9: site_url
" target="_blank"> <?php
echo $student->child_key;
?>
</a>
</td>
<td >
<a href="<?php
echo site_url("child/view/{$student->student_id}");
?>
" target="_blank"> <?php
echo get_display_name($student->name, $student->alias);
?>
</a>
</td>
<td ><?php
echo format_money($student->invoice_amount - $student->invoice_balance, $current_currency);
?>
</td>
<td >
<a href="<?php
echo site_url("payment/summary_of_account/{$student->student_id}");
?>
" getLink="<?php
echo site_url("payment/summary_of_account/{$student->student_id}");
?>
" class="backable_link da-button gray">Summary</a>
<a href="<?php
echo site_url("payment/create_receipt/{$student->student_id}");
?>
" getLink="<?php
echo site_url("payment/create_receipt/{$student->student_id}");
示例10: format_money
<td id="sub_total" style="width:35%"><?php
echo format_money(isset($sub_total) ? $sub_total : 0, $current_currency);
?>
</td>
</tr>
<tr>
<td style="width:65%; font-weidht:bold;">TAX</td>
<td style="width:35%"><?php
echo format_money(isset($sub_total) ? $sub_total * $invoice->tax / 100 : '0', $current_currency);
?>
</td>
</tr>
<tr>
<td style="width:65%; font-weidht:bold;">Total</td>
<td style="width:35%"><?php
echo format_money(isset($sub_total) ? $sub_total * $invoice->tax / 100 + $sub_total : '0', $current_currency);
?>
</td>
</tr>
</table>
</div>
<div style="clear:both;"></div>
</div>
<div class="da-form-row">
<?php
echo $invoice_settings['invoice_footer'];
?>
</div>
</div>
示例11: execute
//.........这里部分代码省略.........
Define transaction form structure
*/
// unless there has been error data returned, fetch all the transactions
// from the DB, and work out the number of rows
if (!isset($_SESSION["error"]["form"][$this->obj_form->formname])) {
$sql_trans_obj = new sql_query();
$sql_trans_obj->string = "SELECT date_trans, amount_debit, amount_credit, chartid, source, memo FROM `account_trans` WHERE type='gl' AND customid='" . $this->id . "'";
$sql_trans_obj->execute();
if ($sql_trans_obj->num_rows()) {
$sql_trans_obj->fetch_array();
$this->num_trans = $sql_trans_obj->data_num_rows + 1;
}
} else {
$this->num_trans = @security_script_input('/^[0-9]*$/', $_SESSION["error"]["num_trans"]) + 1;
}
// ensure there are always 2 rows at least, additional rows are added if required (ie viewing
// an existing transaction) or on the fly when needed by javascript UI.
if ($this->num_trans < 2) {
$this->num_trans = 2;
}
// transaction rows
for ($i = 0; $i < $this->num_trans; $i++) {
// account
$structure = form_helper_prepare_dropdownfromdb("trans_" . $i . "_account", "SELECT id, code_chart as label, description as label1 FROM account_charts WHERE chart_type!='1' ORDER BY code_chart");
$structure["options"]["width"] = "200";
$this->obj_form->add_input($structure);
// debit field
$structure = NULL;
$structure["fieldname"] = "trans_" . $i . "_debit";
$structure["type"] = "input";
$structure["options"]["width"] = "80";
$this->obj_form->add_input($structure);
// credit field
$structure = NULL;
$structure["fieldname"] = "trans_" . $i . "_credit";
$structure["type"] = "input";
$structure["options"]["width"] = "80";
$this->obj_form->add_input($structure);
// source
$structure = NULL;
$structure["fieldname"] = "trans_" . $i . "_source";
$structure["type"] = "input";
$structure["options"]["width"] = "100";
$this->obj_form->add_input($structure);
// description
$structure = NULL;
$structure["fieldname"] = "trans_" . $i . "_description";
$structure["type"] = "textarea";
$this->obj_form->add_input($structure);
// if we have data from a sql query, load it in
if ($sql_trans_obj->data_num_rows) {
if (isset($sql_trans_obj->data[$i]["chartid"])) {
$this->obj_form->structure["trans_" . $i . "_debit"]["defaultvalue"] = $sql_trans_obj->data[$i]["amount_debit"];
$this->obj_form->structure["trans_" . $i . "_credit"]["defaultvalue"] = $sql_trans_obj->data[$i]["amount_credit"];
$this->obj_form->structure["trans_" . $i . "_account"]["defaultvalue"] = $sql_trans_obj->data[$i]["chartid"];
$this->obj_form->structure["trans_" . $i . "_source"]["defaultvalue"] = $sql_trans_obj->data[$i]["source"];
$this->obj_form->structure["trans_" . $i . "_description"]["defaultvalue"] = $sql_trans_obj->data[$i]["memo"];
}
}
}
// total fields
$structure = NULL;
$structure["fieldname"] = "total_debit";
$structure["type"] = "hidden";
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "total_credit";
$structure["type"] = "hidden";
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "money_format";
$structure["type"] = "hidden";
$structure["defaultvalue"] = format_money(0);
$this->obj_form->add_input($structure);
// hidden
$structure = NULL;
$structure["fieldname"] = "id_transaction";
$structure["type"] = "hidden";
$structure["defaultvalue"] = $this->id;
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "num_trans";
$structure["type"] = "hidden";
$structure["defaultvalue"] = "{$this->num_trans}";
$this->obj_form->add_input($structure);
// submit section
$structure = NULL;
$structure["fieldname"] = "submit";
$structure["type"] = "submit";
$structure["defaultvalue"] = "Save Changes";
$this->obj_form->add_input($structure);
// fetch the general form data
$this->obj_form->sql_query = "SELECT * FROM `account_gl` WHERE id='" . $this->id . "' LIMIT 1";
$this->obj_form->load_data();
// calculate totals
for ($i = 0; $i < $this->num_trans; $i++) {
@($this->obj_form->structure["total_debit"]["defaultvalue"] += $this->obj_form->structure["trans_" . $i . "_debit"]["defaultvalue"]);
@($this->obj_form->structure["total_credit"]["defaultvalue"] += $this->obj_form->structure["trans_" . $i . "_credit"]["defaultvalue"]);
}
}
示例12: saveEdit
public function saveEdit()
{
$all = Input::all();
$id = $all['id'];
unset($all['id']);
//Lets update the table
Bankentry::find($id)->update($all);
//Lets fetch the updated data and return it through ajax
//$update = Bankentry::where('id', $id)->get()->toArray();
$all['id'] = $id;
if (isset($all['deposit_date'])) {
$all['deposit_date'] = custom_date_format('M j, Y', $all['deposit_date']);
}
if (isset($all['amount'])) {
$all['amount'] = format_money($all['amount']);
}
$data['status'] = 'success';
$data['message'] = $all;
return Response::json($data);
}
示例13: format_money
</div>
<div class="col-xs-8">
<a class="goods-list-content" href="<?php
echo $goodsDetailUrl;
?>
?goodsId=<?php
echo $goods["id"];
?>
"><span class="name"><?php
echo $goods["name"];
?>
</span></a>
<div class="row row1">
<div class="col-xs-6 left1">
<span class="money"> ¥<?php
echo format_money($goods['purchasing_price']);
?>
</span>
</div>
<div class="col-xs-6 right1">
<img alt="140x140" width="20px" height="20px" src="<?php
echo $goods["source"]["icon_url"];
?>
" alt="" class="img-circle">
<?php
echo $goods["logistics_mode"]["name"];
?>
</div>
</div>
<?php
if ($customerType == "1") {
示例14: render_pdf
function render_pdf()
{
// start the PDF object
$template_pdf = new template_engine_latex();
// load template
$template_pdf->prepare_load_template("templates/latex/report_balancesheet.tex");
/*
Fill in template fields
*/
// company logo
$template_pdf->prepare_add_file("company_logo", "png", "COMPANY_LOGO", 0);
// mode
$template_pdf->prepare_add_field("mode", $this->mode);
// dates
$template_pdf->prepare_add_field("date_end", time_format_humandate($this->date_end));
$template_pdf->prepare_add_field("date_created", time_format_humandate());
// totals
$template_pdf->prepare_add_field("amount_total_current_earnings", $this->data_totals["current_earnings"]);
$template_pdf->prepare_add_field("amount_total_assets", $this->data_totals["assets"]);
$template_pdf->prepare_add_field("amount_total_liabilities", $this->data_totals["liabilities"]);
$template_pdf->prepare_add_field("amount_total_equity", $this->data_totals["equity"]);
$template_pdf->prepare_add_field("amount_total_liabilities_and_equity", $this->data_totals["liabilities_and_equity"]);
// asset data
$structure_main = NULL;
foreach ($this->data_assets as $itemdata) {
$structure = array();
$structure["name_chart"] = $itemdata["code_chart"] . " -- " . $itemdata["description"];
$structure["amount"] = format_money($itemdata["amount"]);
$structure_main[] = $structure;
}
$template_pdf->prepare_add_array("table_assets", $structure_main);
// liabilities data
$structure_main = NULL;
foreach ($this->data_liabilities as $itemdata) {
$structure = array();
$structure["name_chart"] = $itemdata["code_chart"] . " -- " . $itemdata["description"];
$structure["amount"] = format_money($itemdata["amount"]);
$structure_main[] = $structure;
}
$template_pdf->prepare_add_array("table_liabilities", $structure_main);
// equity data
$structure_main = NULL;
foreach ($this->data_equity as $itemdata) {
$structure = array();
$structure["name_chart"] = $itemdata["code_chart"] . " -- " . $itemdata["description"];
$structure["amount"] = format_money($itemdata["amount"]);
$structure_main[] = $structure;
}
$template_pdf->prepare_add_array("table_equity", $structure_main);
/*
Output PDF
*/
// perform string escaping for latex
$template_pdf->prepare_escape_fields();
// fill template
$template_pdf->prepare_filltemplate();
// generate PDF output
$template_pdf->generate_pdf();
// display PDF
print $template_pdf->output;
// foreach ($template_pdf->processed as $line)
// {
// print $line;
// }
}
示例15: format_dollars
function format_dollars($str)
{
return format_money($str, false);
}