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


PHP format_currency函数代码示例

本文整理汇总了PHP中format_currency函数的典型用法代码示例。如果您正苦于以下问题:PHP format_currency函数的具体用法?PHP format_currency怎么用?PHP format_currency使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: price_for

function price_for($rt_shop_product, $config = array())
{
    $format_was = '<span class="price-before">%s<em>%s</em></span>';
    $format_now = '<span class="price-now">%s<em>%s</em></span>';
    $config['format_was'] = isset($config['format_was']) ? $config['format_was'] : $format_was;
    $config['format_now'] = isset($config['format_now']) ? $config['format_now'] : $format_now;
    $config['format_now_preffix_from'] = isset($config['format_now_preffix_from']) ? $config['format_now_preffix_from'] : __('From') . ' ';
    $config['format_now_preffix_only'] = isset($config['format_now_preffix_only']) ? $config['format_now_preffix_only'] : '';
    $config['format_now_preffix_now_only'] = isset($config['format_now_preffix_now_only']) ? $config['format_now_preffix_now_only'] : __('Now') . ' ';
    $config['format_now_preffix_now_from_only'] = isset($config['format_now_preffix_now_from_only']) ? $config['format_now_preffix_now_from_only'] : __('Now') . ' ';
    // This might need to be changes to "Now from"?
    $config['format_was_preffix'] = isset($config['format_was_preffix']) ? $config['format_was_preffix'] : __('Was') . ' ';
    $currency = sfConfig::get('app_rt_currency', 'USD');
    $price_min = $rt_shop_product->isOnPromotion() ? $rt_shop_product->getMinimumPrice() : $rt_shop_product->getMinRetailPrice();
    $price_max = max($rt_shop_product->getMaxRetailPrice(), $rt_shop_product->getMaxPromotionPrice());
    if (!$rt_shop_product->isOnPromotion()) {
        return sprintf($config['format_now'], $price_min != $price_max ? $config['format_now_preffix_from'] : $config['format_now_preffix_only'], format_currency($price_min, $currency));
    }
    $string = '';
    $retail_prices_match = $rt_shop_product->getMaxRetailPrice() == $rt_shop_product->getMinRetailPrice();
    $promo_prices_match = $rt_shop_product->getMaxPromotionPrice() == $rt_shop_product->getMinPromotionPrice();
    if ($retail_prices_match) {
        $string = sprintf($config['format_was'], $config['format_was_preffix'], format_currency($price_max, $currency));
    }
    $string .= ' ' . sprintf($config['format_now'], $promo_prices_match ? $config['format_now_preffix_now_only'] : $config['format_now_preffix_now_from_only'], format_currency($price_min, $currency));
    return $string;
}
开发者ID:pierswarmers,项目名称:rtShopPlugin,代码行数:27,代码来源:rtShopProductHelper.php

示例2: format_currency

 protected function format_currency($floatcurr, $curr = 'USD')
 {
     if (defined('STRICT_TYPES') && CAMEL_CASE == '1') {
         return (string) self::parameters(['floatcurr' => [DT::INT64, DT::UINT64, DT::FLOAT], 'curr' => DT::STRING])->call(__FUNCTION__)->with($floatcurr, $curr)->returning(DT::STRING);
     } else {
         return (string) format_currency($floatcurr, $curr);
     }
 }
开发者ID:tfont,项目名称:skyfire,代码行数:8,代码来源:math.class.php

示例3: modal_product_lookups_json

 /**
  * pZ: modal_product_lookups_json
  *
  */
 public function modal_product_lookups_json()
 {
     $this->load->model('mdl_products');
     $products = $this->mdl_products->get()->result();
     $data = array();
     foreach ($products as $product) {
         $data[] = array('ProductName' => $product->product_name, 'ProductFormatPrice' => format_currency($product->product_price), 'ProductPrice' => format_amount($product->product_price));
     }
     echo json_encode($data);
 }
开发者ID:lukasz-schab,项目名称:DeskdooInvoices,代码行数:14,代码来源:ajax.php

示例4: get_all_value

 public function get_all_value()
 {
     $value = array('gia_bon_dung' => $this->gia_bon_dung, 'gia_ong_dan_dau' => $this->gia_ong_dan_dau, 'gia_tu_bom' => $this->gia_tu_bom, 'gia_ong_khoi' => $this->gia_ong_khoi * $this->gen_number, 'gia_ong_nhung_non_che' => $this->gia_ong_nhung_non_che * $this->gen_number, 'gia_cap_dong_luc' => $this->gia_cap_dong_luc * $this->gen_number, 'gia_cap_te' => $this->gia_cap_te * $this->gen_number, 'gia_cap_dieu_khien' => $this->gia_cap_dieu_khien * $this->gen_number, 'gia_bao_ve_cap' => $this->gia_bao_ve_cap, 'gia_nhien_lieu_chay_nt' => $this->gia_nhien_lieu_chay_nt * $this->gen_number, 'gia_vat_tu_phu' => $this->gia_vat_tu_phu * $this->gen_number, 'gia_kiem_dinh' => $this->gia_kiem_dinh, 'gia_nhan_cong' => $this->gia_nhan_cong * $this->gen_number, 'gia_vc_duong_ngan' => $this->gia_vc_duong_ngan, 'gia_vc_duong_dai' => $this->gia_vc_duong_dai, 'gia_vc_thu_cong' => $this->gia_vc_thu_cong, 'gia_ats' => $this->gia_ats, 'gia_thoat_nhiet' => $this->gia_thoat_nhiet, 'gia_lam_gio' => $this->gia_lam_gio);
     $total_price = 0;
     foreach ($value as $price) {
         $total_price = $total_price + $price;
     }
     $parameters = array('kVA' => $this->kVA, 'phase' => $this->phase, 'gen_number' => $this->gen_number, 'total_money' => $total_price, 'total_price' => format_currency($total_price), 'gia_bon_dung_price' => format_currency($this->gia_bon_dung), 'gia_ong_dan_dau_price' => format_currency($this->gia_ong_dan_dau), 'gia_tu_bom_price' => format_currency($this->gia_tu_bom), 'gia_ong_khoi_price' => format_currency($this->gia_ong_khoi), 'gia_ong_nhung_non_che_price' => format_currency($this->gia_ong_nhung_non_che), 'gia_cap_dong_luc_price' => format_currency($this->gia_cap_dong_luc), 'gia_cap_te_price' => format_currency($this->gia_cap_te), 'gia_cap_dieu_khien_price' => format_currency($this->gia_cap_dieu_khien), 'gia_bao_ve_cap_price' => format_currency($this->gia_bao_ve_cap), 'gia_nhien_lieu_chay_nt_price' => format_currency($this->gia_nhien_lieu_chay_nt), 'gia_vat_tu_phu_price' => format_currency($this->gia_vat_tu_phu), 'gia_kd_cl_price' => format_currency($this->gia_kd_cl), 'gia_kd_tt3_price' => format_currency($this->gia_kd_tt3), 'gia_thu_tai_gia_price' => format_currency($this->gia_thu_tai_gia), 'gia_kiem_dinh_price' => format_currency($this->gia_kiem_dinh), 'gia_nhan_cong_price' => format_currency($this->gia_nhan_cong), 'gia_thao_ra_vo' => format_currency($this->gia_thao_ra_vo), 'gia_lap_may_price' => format_currency($this->gia_lap_may), 'gia_lap_dat_ats_price' => format_currency($this->gia_lap_dat_ats), 'gia_lap_tu_hoa_price' => format_currency($this->gia_lap_tu_hoa), 'gia_hd_sd_nt_price' => format_currency($this->gia_hd_sd_nt), 'gia_day_vao_vi_tri_dg_price' => format_currency($this->gia_day_vao_vi_tri_dg), 'gia_day_vao_vi_tri_pt_price' => format_currency($this->gia_day_vao_vi_tri_pt), 'distance' => $this->distance, 'error_distance' => $this->error_distance, 'gia_vc_duong_ngan_price' => format_currency($this->gia_vc_duong_ngan), 'gia_vc_duong_dai_price' => format_currency($this->gia_vc_duong_dai), 'gia_vc_thu_cong_price' => format_currency($this->gia_vc_thu_cong), 'gia_ats' => format_currency($this->gia_ats), 'gia_thoat_nhiet' => format_currency($this->gia_thoat_nhiet), 'gia_lam_gio' => format_currency($this->gia_lam_gio));
     //pr(array_merge($parameters, $value));exit;
     return json_encode(array_merge($parameters, $value));
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:11,代码来源:Setup.php

示例5: testFormatCurrency

 public function testFormatCurrency()
 {
     //        $this->markTestIncomplete('Test Incomplete.');
     //        $this->markTestSkipped('Test Skipped');
     //        $this->fail('Test fail');
     $this->assertEquals(format_currency(123.45), '123,45&nbsp;EURO', 'pos: 1');
     $this->assertEquals(format_currency(123), '123,00&nbsp;EURO', 'pos: 2');
     $this->assertEquals(format_currency(5678), '5&nbsp;678,00&nbsp;EURO', 'pos: 3');
     $this->assertEquals(format_currency(-123.1), '-123,10&nbsp;EURO', 'pos: 4');
     $this->assertEquals(format_currency(-5678.1), '-5&nbsp;678,10&nbsp;EURO', 'pos: 5');
 }
开发者ID:lukasz-schab,项目名称:DeskdooInvoices,代码行数:11,代码来源:NumberHelperTest.php

示例6: parse_template

function parse_template($object, $body)
{
    if (preg_match_all('/{{{([^{|}]*)}}}/', $body, $template_vars)) {
        foreach ($template_vars[1] as $var) {
            switch ($var) {
                case 'invoice_guest_url':
                    $replace = site_url('guest/view/invoice/' . $object->invoice_url_key);
                    break;
                case 'invoice_date_due':
                    $replace = date_from_mysql($object->invoice_date_due, TRUE);
                    break;
                case 'invoice_date_created':
                    $replace = date_from_mysql($object->invoice_date_created, TRUE);
                    break;
                case 'invoice_total':
                    $replace = format_currency($object->invoice_total);
                    break;
                case 'invoice_paid':
                    $replace = format_currency($object->invoice_paid);
                    break;
                case 'invoice_balance':
                    $replace = format_currency($object->invoice_balance);
                    break;
                case 'quote_total':
                    $replace = format_currency($object->quote_total);
                    break;
                case 'quote_date_created':
                    $replace = date_from_mysql($object->quote_date_created, TRUE);
                    break;
                case 'quote_date_expires':
                    $replace = date_from_mysql($object->quote_date_expires, TRUE);
                    break;
                case 'quote_guest_url':
                    $replace = site_url('guest/view/quote/' . $object->quote_url_key);
                    break;
                default:
                    $replace = $object->{$var};
            }
            $body = str_replace('{{{' . $var . '}}}', $replace, $body);
        }
    }
    return $body;
}
开发者ID:lukasz-schab,项目名称:DeskdooInvoices,代码行数:43,代码来源:template_helper.php

示例7: setup

 public function setup()
 {
     parent::setup();
     // Helpers
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('Number'));
     // Form format
     $this->getWidgetSchema()->setFormFormatterName(sfConfig::get('app_rt_public_form_formatter_name', 'RtList'));
     // Voucher amount selection
     $options = sfConfig::get('app_rt_shop_gift_voucher_amount', array(10, 20, 25, 30, 40, 50, 75, 100, 150, 200, 300));
     // Add currency definition to amount
     $amounts = array();
     $amounts[''] = '--';
     foreach ($options as $key => $item) {
         $amounts[$item] = format_currency($item, sfConfig::get('app_rt_currency', 'USD'));
     }
     // Widgets
     $this->widgetSchema['reduction_value'] = new sfWidgetFormSelect(array('choices' => $amounts));
     $this->widgetSchema['first_name'] = new sfWidgetFormInput(array(), array());
     $this->widgetSchema['last_name'] = new sfWidgetFormInput(array(), array());
     $this->widgetSchema['email_address'] = new sfWidgetFormInput(array(), array());
     $this->widgetSchema['message'] = new sfWidgetFormTextarea(array(), array());
     // Validators
     $this->setValidator('reduction_value', new sfValidatorChoice(array('choices' => array_keys($amounts), 'required' => true), array('required' => 'Please make a selection')));
     $this->setValidator('first_name', new sfValidatorString(array('required' => true), array('required' => 'Please provide a first name')));
     $this->setValidator('last_name', new sfValidatorString(array('required' => true), array('required' => 'Please provide a last name')));
     $this->setValidator('email_address', new sfValidatorEmail(array('required' => true), array('required' => 'Please provide a valid email address')));
     $this->setValidator('message', new sfValidatorString(array('required' => false, 'max_length' => 255), array('max_length' => 'Message is too long (%max_length% characters max.)')));
     // Add labels
     $this->widgetSchema->setLabel('reduction_value', "Gift Voucher Amount");
     $this->widgetSchema->setLabel('first_name', "Recipient First Name");
     $this->widgetSchema->setLabel('last_name', "Recipient Last Name");
     $this->widgetSchema->setLabel('email_address', "Recipient Email");
     // Help texts
     $this->widgetSchema->setHelp('first_name', 'Required');
     $this->widgetSchema->setHelp('last_name', 'Required');
     $this->widgetSchema->setHelp('email_address', 'Required - The voucher will be sent here');
     $this->widgetSchema->setNameFormat('rt_shop_voucher[%s]');
     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
 }
开发者ID:pierswarmers,项目名称:rtShopPlugin,代码行数:39,代码来源:rtShopVoucherPublicForm.class.php

示例8: send_notification

 function send_notification($gc_data)
 {
     $this->load->helper('formatting_helper');
     $row = $this->db->where('id', '1')->get('canned_messages')->row_array();
     // set replacement values for subject & body
     $row['subject'] = str_replace('{from}', $gc_data['from'], $row['subject']);
     $row['subject'] = str_replace('{site_name}', $this->config->item('company_name'), $row['subject']);
     $row['content'] = str_replace('{code}', $gc_data['code'], $row['content']);
     $row['content'] = str_replace('{amount}', format_currency($gc_data['beginning_amount']), $row['content']);
     $row['content'] = str_replace('{from}', $gc_data['from'], $row['content']);
     $row['content'] = str_replace('{personal_message}', nl2br($gc_data['personal_message']), $row['content']);
     $row['content'] = str_replace('{url}', $this->config->item('base_url'), $row['content']);
     $row['content'] = str_replace('{site_name}', $this->config->item('company_name'), $row['content']);
     $this->load->library('email');
     $config['mailtype'] = 'html';
     $this->email->initialize($config);
     $this->email->from($this->config->item('email'));
     $this->email->to($gc_data['to_email']);
     $this->email->subject($row['subject']);
     $this->email->message($row['content']);
     $this->email->send();
 }
开发者ID:RetinaInc,项目名称:GoCart-example,代码行数:22,代码来源:gift_card_model.php

示例9: foreach

	<tbody>
		<?php 
foreach ($payments as $payment) {
    ?>
		<tr>
			<td><?php 
    echo date_from_mysql($payment->payment_date);
    ?>
</td>
			<td><?php 
    echo $payment->invoice_number;
    ?>
</td>
			<td><?php 
    echo format_currency($payment->payment_amount);
    ?>
</td>
			<td><?php 
    echo $payment->payment_method_name;
    ?>
</td>
			<td><?php 
    echo $payment->payment_note;
    ?>
</td>
			<td>
				<div class="options btn-group">
					<a class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#"><i class="icon-cog"></i> <?php 
    echo lang('options');
    ?>
开发者ID:rumahkecil,项目名称:fusioninvoice-1,代码行数:30,代码来源:partial_payment_table.php

示例10: round

                    <div><h1><?php 
        //echo $product->name;
        ?>
G50-<?php 
        echo round($generator['generator_kVA']) . $generator['engine']->code . $generator['alternator']->code;
        ?>
AB</h1></div>
					<div>
						Standby Power: <?php 
        echo round($generator['generator_kVA']);
        ?>
 kVA
					</div>
					<div>
						Price: <?php 
        echo format_currency($generator['price']);
        ?>
					</div>
					<div>
						Days: <?php 
        echo $generator['days'];
        ?>
					</div>
					<!--
					<div>
						Engine Power: <?php 
        echo $generator['engine']->standby;
        ?>
 kWm, <?php 
        echo round($generator['engine']->standby / 0.8);
        ?>
开发者ID:lekhang,项目名称:gonline,代码行数:31,代码来源:homepage.php

示例11: format_currency

                                                  <span class="prod-price"><b><?php 
            echo format_currency($b->saleprice);
            echo empty($b->unit) ? '' : '/' . $b->unit;
            ?>
</b></span>
                                                  <a href="<?php 
            echo site_url(implode('/', $base_url) . '/' . $b->slug);
            ?>
" class="btn btn-nxled btn-sm pull-right" style="margin-top:7px;text-transform:uppercase;"> Add To Cart </a>
                                              </div>
                                          <?php 
        } else {
            ?>
                                              <div class="prod-priceCont clearfix" style="text-align:right;">
                                                <span class="prod-price"><b><?php 
            echo format_currency($b->price);
            echo empty($b->unit) ? '' : '/' . $b->unit;
            ?>
</b></span>
                                                <a href="<?php 
            echo site_url(implode('/', $base_url) . '/' . $b->slug);
            ?>
" class="btn btn-nxled btn-sm pull-right" style="margin-top:7px;text-transform:uppercase;"> Add To Cart </a>
                                              </div>
                                          <?php 
        }
        ?>
                                        </div><!-- prod-desc -->


                                    </div>
开发者ID:devarj,项目名称:design,代码行数:31,代码来源:category.php

示例12: __

        echo __('isLate');
        ?>
</label>
				<br/>
				<?php 
        echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . ($cir_hist->isLate($now) ? __('Yes') . " (" . $cir_hist->getLateDays($now) . " " . __('days') . ")" : __('No'));
        ?>
			</td>
			<td >
				<label><?php 
        echo __('Fine');
        ?>
</label>
				<br/>
				<?php 
        echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rp. " . format_currency($cir_hist->getFineAmount($now));
        echo input_hidden_tag('fine', $cir_hist->getFineAmount($now));
        ?>
			</td>
		</tr>
		<tr>
			<td >
				<label><?php 
        echo __('ColCondition');
        ?>
</label>
				<br/>
				<?php 
        echo object_select_tag($item, 'getColConditionId', array('related_class' => 'ColCondition', 'control_name' => 'col_condition_id'));
        ?>
			</td>
开发者ID:taryono,项目名称:school,代码行数:31,代码来源:orderSuccess.php

示例13: format_currency

    echo format_currency($quote_tax_rate->quote_tax_rate_amount);
    ?>
                                    </td>
                                </tr>
                            <?php 
}
?>

                            <tr class="amount-total border-top-n">
                                <td class="text-right color-d">
                                    <b><?php 
echo lang('total');
?>
:</b>
                                </td>
                                <td class="text-right color-d">
                                    <b><?php 
echo format_currency($quote->quote_total);
?>
</b>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            
        </div>
	</body>
</html>
开发者ID:quantumsized,项目名称:InvoicePlane,代码行数:30,代码来源:green.php

示例14: lang

echo lang('total');
?>
</td>
                <td class="amount"><b><?php 
echo format_currency($invoice->invoice_total);
?>
</b></td>
            </tr>
            <tr>
                <td><?php 
echo lang('paid');
?>
</td>
                <td class="amount"><b><?php 
echo format_currency($invoice->invoice_paid);
?>
</b></td>
            </tr>
            <tr>
                <td><b><?php 
echo lang('balance');
?>
</b></td>
                <td class="amount"><b><?php 
echo format_currency($invoice->invoice_balance);
?>
</b></td>
            </tr>
        </table>
    </div>
</div>
开发者ID:quantumsized,项目名称:InvoicePlane,代码行数:31,代码来源:partial_item_table.php

示例15: format_currency

">
                <p class="marginTop15">
                    <?php 
    echo $gen['result']['alternator_manufacturer'];
    ?>
<br>
                    <?php 
    echo $gen['result']['alt']->name;
    ?>
                </p>
            </div>
            <div class="resultado5 <?php 
    echo $line2;
    ?>
"><p class="marginTop20"><?php 
    echo format_currency($gen['result']['generators']['price']);
    ?>
</p></div>
            <div class="resultado6 <?php 
    echo $line2;
    ?>
">
                <p class="marginTop20"><?php 
    echo $gen['result']['generators']['days'];
    ?>
</p>
            </div>
            <div class="resultado7 <?php 
    echo $line2;
    ?>
">
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:31,代码来源:gen_compare.php


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