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


PHP commonModel::tidyMoney方法代码示例

本文整理汇总了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);
         }
     }
 }
开发者ID:leowh,项目名称:colla,代码行数:50,代码来源:model.php

示例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;
 }
开发者ID:leowh,项目名称:crm,代码行数:41,代码来源:model.php

示例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'>
开发者ID:leowh,项目名称:colla,代码行数:31,代码来源:browse.html.php


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