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


PHP Change::convert方法代码示例

本文整理汇总了PHP中Change::convert方法的典型用法代码示例。如果您正苦于以下问题:PHP Change::convert方法的具体用法?PHP Change::convert怎么用?PHP Change::convert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Change的用法示例。


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

示例1: roi_with_timeline

 public static function roi_with_timeline($isin, $username, $month_from, $month_to)
 {
     $conn = Db::get_connection();
     $stock = new Stock();
     if (!$stock->find_by_id($isin)) {
         return;
     }
     $portfolio_stock_factory = new PortfolioStock();
     $portfolio_stocks = $portfolio_stock_factory->find_all(array('where_clause' => "`isin` = '{$conn->escape($isin)}' " . "AND `utente` = '{$conn->escape($username)}'"));
     if (count($portfolio_stocks) == 0) {
         return;
     }
     $portfolio_stock = $portfolio_stocks[0];
     $quantita = self::quantita_history($isin, $username, $month_from);
     switch ($stock->tipo) {
         case 'obbligazione':
             $investito = $portfolio_stock->prezzo * $portfolio_stock->quantita / 100;
             break;
         default:
             $investito = $portfolio_stock->prezzo * $portfolio_stock->quantita;
     }
     $investito = Change::convert($investito, $stock->divisa);
     $roi = PianificatoreHelper::roi_with_timeline($isin, $quantita, $month_from, $month_to, $investito);
     foreach ($roi->payments as $payment) {
         $payment->portfolio_stock = $portfolio_stock;
     }
     // print_r($roi);
     return $roi;
 }
开发者ID:emeraldion,项目名称:creso,代码行数:29,代码来源:portfolio_helper.php

示例2: importo_eur

 public function importo_eur()
 {
     if (!isset($this->importo_eur)) {
         $this->importo_eur = Change::convert($this->importo, $this->stock->divisa, date('Y-m-d', $this->timestamp));
     }
     return $this->importo_eur;
 }
开发者ID:emeraldion,项目名称:creso,代码行数:7,代码来源:payment.php

示例3: index

 /**
  *  Action methods
  */
 public function index()
 {
     switch ($_REQUEST['evento']) {
         case 'cedola':
             $events = $this->get_cedole();
             break;
         case 'dividendo':
             $events = $this->get_dividendi();
             break;
         case 'rimborso':
             $events = $this->get_rimborsi();
             break;
         default:
             if (isset($_REQUEST['isin']) && isset($_REQUEST['use_helper'])) {
                 $this->roi = PortfolioHelper::roi_with_timeline($_REQUEST['isin'], $_COOKIE['username'], $_REQUEST['month-from'], $_REQUEST['month-to']);
                 $events = $this->roi->payments;
                 $this->investito = $this->roi->investito;
                 $this->totale = $this->roi->totale;
                 $this->plusminus = $this->roi->plusminus;
             } else {
                 $events = array_merge($this->get_cedole(), $this->get_rimborsi(), $this->get_dividendi());
                 $this->investito = 0;
                 $this->plusminus = 0;
                 foreach ($events as $event) {
                     $investito = $event->portfolio_stock->prezzo * $event->quantita / 100;
                     $investito = Change::convert($investito, $event->stock->divisa);
                     if ($event->tipo == 'rimborso') {
                         $this->investito += $investito;
                     }
                     $plusminus = $event->importo_eur() - $investito;
                     $this->plusminus += $plusminus;
                 }
             }
     }
     $this->payments($events);
     $this->render(array('action' => 'payments'));
 }
开发者ID:emeraldion,项目名称:creso,代码行数:40,代码来源:pagamenti_controller.php

示例4: printf

?>
  </td>
  <td class="cell10r">
    <?php 
printf("%.2f %s", $rimborso->importo, $rimborso->stock->divisa);
?>
  </td>
  <td class="cell10r">
    <?php 
printf("%.2f EUR", $rimborso->importo_eur());
?>
  </td>
  <td class="cell10r">
    <?php 
$investito = $rimborso->portfolio_stock->prezzo * $rimborso->portfolio_stock->quantita / 100;
$investito = Change::convert($investito, $rimborso->stock->divisa);
$this->investito += $investito;
printf("%.2f EUR", $investito);
?>
  </td>
  <td class="cell10r-lh">
    <?php 
$plusminus = $rimborso->importo_eur() - $investito;
$this->plusminus += $plusminus;
print apple('%.2f EUR', $plusminus);
?>
  </td>
  <td class="cell10-rh">
    (<?php 
$plusminus_pct = $plusminus / $investito * 100;
print apple('%.2f%%', $plusminus_pct);
开发者ID:emeraldion,项目名称:creso,代码行数:31,代码来源:_rimborso.php

示例5: printf

}
$investito = Change::convert($investito, $stock->stock->divisa);
$this->investito += $investito;
printf('%.2f', $investito);
?>
</td>
	<td class="cell10" align="right"><?php 
switch ($stock->stock->tipo) {
    case 'obbligazione':
        $attuale = $stock->quote->quotazione * $stock->quantita / 100;
        break;
    default:
        $attuale = $stock->quote->quotazione * $stock->quantita;
        break;
}
$attuale = Change::convert($attuale, $stock->stock->divisa);
$this->attuale += $attuale;
printf('%.2f', $attuale);
?>
</td>
	<td class="cell10r-lh">
		<?php 
$plusminus = $attuale - $investito;
print apple('%.2f', $plusminus);
?>
	</td>
	<td class="cell10-rh">
		(<?php 
$plusminus_pct = $plusminus / $investito * 100;
print apple('%.2f%%', $plusminus_pct);
?>
开发者ID:emeraldion,项目名称:creso,代码行数:31,代码来源:_stock.php

示例6: span

				<td align="right" width="100%"><?php 
    echo $transaction->negot_id;
    ?>
</td>
				<td>&nbsp;</td>
				<td align="right"><a href="<?php 
    echo $this->url_to(array('action' => 'negot', 'id' => $transaction->negot_id));
    ?>
"><img src="/img/circled_arrow.png" alt="Negoziazione" /></a></td>
			</tr>
		</table>
<?php 
}
?>
</td>
	<td class="cell10" align="right"><?php 
$importo = Change::convert($transaction->quantita * $transaction->prezzo, $transaction->stock->divisa);
$importo *= $transaction->azione == 'acquisto' ? -1 : 1;
$importo /= $transaction->stock->tipo == 'obbligazione' ? 100 : 1;
$comm = abs($importo) * $this->preference->comm_percent;
if (strtotime($transaction->data) >= strtotime("2007-08-01")) {
    $comm = $comm > $this->preference->comm_percent_min ? $comm : $this->preference->comm_percent_min;
}
$importo -= $comm;
$importo -= $this->preference->comm_fissa;
$this->bilancio += $importo;
print span(sprintf('%.2f', $importo), array('style' => 'color: ' . ($transaction->azione == 'acquisto' ? 'red' : 'green')));
?>
</td>
</tr>
开发者ID:emeraldion,项目名称:creso,代码行数:30,代码来源:_transaction.php

示例7: printf

    <?php 
printf("%.2f %s", $payment->importo, $payment->stock->divisa);
?>
  </td>
  <td class="cell10r">
    <?php 
printf("%.2f EUR", $payment->importo_eur());
?>
  </td>
  <td class="cell10r">
    <?php 
if (isset($_REQUEST['use_helper'])) {
    $investito = $this->roi->investito;
} else {
    $investito = $payment->portfolio_stock->prezzo * $payment->quantita / 100;
    $investito = Change::convert($investito, $payment->stock->divisa);
    // if ($payment->tipo == 'rimborso')
    // {
    //   $this->investito += $investito;
    // }
}
if ($payment->tipo == 'rimborso') {
    printf("%.2f EUR", $investito);
}
?>
  </td>
  <td class="cell10r-lh">
    <?php 
if ($payment->tipo == 'rimborso') {
    $plusminus = $payment->importo_eur() - $investito;
    // if (!isset($_REQUEST['use_helper']))
开发者ID:emeraldion,项目名称:creso,代码行数:31,代码来源:_payment.php

示例8: PortfolioStock

</b></td>
		<td class="cell10">&mdash;</td>
		<td class="cell10">&mdash;%</td>
	</tr>

	<tr class="row0">
		<td class="cell10"><div class="vstrut17"></div></td>
		<td class="cell10">Prossima cedola</td>
		<td class="cell10"><b><?php 
print $bond->next_coupon_date();
?>
</b></td>
		<td class="cell10"><?php 
$portfolio = new PortfolioStock();
$ports = $portfolio->find_all(array('where_clause' => "`isin` = '{$this->stock->isin}'"));
if (count($ports) > 0) {
    $port = $ports[0];
    $revenue = $bond->revenue($port->quantita);
    printf('%.2f %s', $revenue, $this->stock->divisa);
    if ($this->stock->divisa != 'EUR') {
        printf(' (%.2f EUR)', Change::convert($revenue, $this->stock->divisa));
    }
}
?>
</td>
		<td class="cell10"><b><?php 
print $bond->rate();
?>
</b></td>
	</tr>
开发者ID:emeraldion,项目名称:creso,代码行数:30,代码来源:_bond_revenues.php

示例9: get_roi

 private function get_roi()
 {
     if (!isset($_REQUEST['base'])) {
         $_REQUEST['base'] = 1000;
     }
     if (!isset($_REQUEST['month-to'])) {
         $_REQUEST['month-to'] = date('Y-m-d', mktime(0, 0, 0, date('m') + self::DEFAULT_ROI_HORIZON_MONTHS, 0, date('Y')));
     }
     $this->roi = array();
     // $this->stocks = array();
     // This to ensure we get latest quote from today
     $today = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')));
     $last_month = date('Y-m-d', mktime(0, 0, 0, date('m') - 1, date('d'), date('Y')));
     // print_r($_REQUEST['isin']);
     foreach ($this->isins as $isin) {
         $quote = QuoteHelper::latest_for_range($isin, $last_month, $today);
         // print_r($quote);
         $stock = new Stock();
         if (!$stock->find_by_id($isin)) {
             continue;
         }
         // $this->stocks[$isin] = $stock;
         $investito = Change::convert($quote->quotazione * $_REQUEST['base'] / 100, $stock->divisa);
         $this->roi[$isin] = PianificatoreHelper::roi_with_timeline($isin, $_REQUEST['base'], $today, $_REQUEST['month-to'], $investito);
         unset($this->roi[$isin]->payments);
         $this->roi[$isin]->stock = $stock;
     }
     // print_r($this->roi);
     uasort($this->roi, $this->get_sorter());
 }
开发者ID:emeraldion,项目名称:creso,代码行数:30,代码来源:pianificatore_controller.php


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