本文整理汇总了PHP中commonModel::tidyMoney方法的典型用法代码示例。如果您正苦于以下问题:PHP commonModel::tidyMoney方法的具体用法?PHP commonModel::tidyMoney怎么用?PHP commonModel::tidyMoney使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类commonModel
的用法示例。
在下文中一共展示了commonModel::tidyMoney方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: countMoney
/**
* Count money.
*
* @param array $trades
* @access public
* @return array
*/
public function countMoney($trades, $mode)
{
$totalMoney = array();
$currencyList = $this->loadModel('common', 'sys')->getCurrencyList();
foreach ($currencyList as $key => $currency) {
$totalMoney[$key]['in'] = 0;
$totalMoney[$key]['out'] = 0;
foreach ($trades as $trade) {
if ($trade->currency != $key) {
continue;
}
if ($trade->type == 'in' or $trade->type == 'out') {
$totalMoney[$key][$trade->type] += $trade->money;
}
}
}
foreach ($totalMoney as $currency => $money) {
if ($money['in'] == 0 and $money['out'] == 0) {
continue;
}
$tidyMoneyIn = "<span title='" . $money['in'] . "'>" . commonModel::tidyMoney($money['in']) . '</span>';
$tidyMoneyOut = "<span title='" . $money['out'] . "'>" . commonModel::tidyMoney($money['out']) . '</span>';
if ($mode == 'in') {
printf($this->lang->trade->totalIn, $currencyList[$currency], $tidyMoneyIn);
}
if ($mode == 'out') {
printf($this->lang->trade->totalOut, $currencyList[$currency], $tidyMoneyOut);
}
if ($mode == 'all' or $mode == 'bysearch') {
$profitsMoney = $money['in'] - $money['out'];
if ($profitsMoney > 0) {
$profits = "<span title='{$profitsMoney}'>" . $this->lang->trade->profit . commonModel::tidyMoney($profitsMoney) . '</span>';
}
if ($profitsMoney < 0) {
$profits = "<span title='" . -$profitsMoney . "'>" . $this->lang->trade->loss . commonModel::tidyMoney(-$profitsMoney) . '</span>';
}
if ($profitsMoney == 0) {
$profits = $this->lang->trade->balance;
}
printf($this->lang->trade->totalAmount, $currencyList[$currency], $tidyMoneyIn, $tidyMoneyOut, $profits);
}
}
}
示例2: countAmount
/**
* Count amount.
*
* @param array $purchases
* @access public
* @return array
*/
public function countAmount($purchases)
{
$totalAmount = array();
$currencyList = $this->loadModel('common', 'sys')->getCurrencyList();
$currencySign = $this->common->getCurrencySign();
$totalReturn = $this->dao->select('*')->from(TABLE_PLAN)->fetchGroup('contract');
foreach ($purchases as $purchase) {
if ($purchase->status == 'canceled') {
continue;
}
foreach ($currencyList as $key => $currency) {
if ($purchase->currency == $key) {
if (!isset($totalAmount['purchase'][$key])) {
$totalAmount['purchase'][$key] = 0;
}
if (!isset($totalAmount['return'][$key])) {
$totalAmount['return'][$key] = 0;
}
$totalAmount['purchase'][$key] += $purchase->amount;
if (isset($totalReturn[$purchase->id])) {
foreach ($totalReturn[$purchase->id] as $return) {
$totalAmount['return'][$key] += $return->amount;
}
}
}
}
}
foreach ($totalAmount as $type => $currencyAmount) {
foreach ($currencyAmount as $currency => $amount) {
$totalAmount[$type][$currency] = "<span title='{$amount}'>" . $currencySign[$currency] . commonModel::tidyMoney($amount) . "</span>";
}
}
return $totalAmount;
}
示例3: foreach
<?php
foreach ($balances as $currency => $balanceList) {
?>
<?php
$sum = 0;
?>
<?php
foreach ($balanceList as $balance) {
$sum += $balance->money;
}
?>
<div class='pull-right'><strong class='text-danger' title='<?php
echo $sum;
?>
'><?php
echo $currencyList[$currency] . $lang->colon . commonModel::tidyMoney($sum);
?>
</strong></div>
<?php
}
?>
<?php
}
?>
</div>
<div class='panel-body'>
<div class="cards">
<?php
foreach ($depositors as $depositor) {
?>
<div class='col-md-4 col-sm-6'>