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


PHP Transaction::find_all方法代码示例

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


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

示例1: quantita_history

 public static function quantita_history($isin, $username, $month_from)
 {
     $conn = Db::get_connection();
     $transaction_factory = new Transaction();
     $transactions = $transaction_factory->find_all(array('where_clause' => "`utente` = '{$conn->escape($username)}' " . "AND `isin` = '{$conn->escape($isin)}' " . "AND `data` >= '{$conn->escape($month_from)}' ", 'order_by' => '`data` DESC'));
     // print_r($transactions);
     $portfolio_stock_factory = new PortfolioStock();
     $portfolio_stock = $portfolio_stock_factory->find_all(array('where_clause' => "`utente` = '{$conn->escape($username)}' " . "AND `isin` = '{$conn->escape($isin)}' "))[0];
     // print_r($portfolio_stock);
     $quantita_history = array();
     $quantita_history[date('Y-m-d')] = $q = $portfolio_stock->quantita;
     $i = 0;
     do {
         if ($transactions[$i]->azione == 'acquisto') {
             $q -= $transactions[$i]->quantita;
         } else {
             $q += $transactions[$i]->quantita;
         }
         $quantita_history[$transactions[$i]->data] = $q;
         $i++;
     } while ($transactions[$i]->data > $_REQUEST['month-from']);
     // print_r($quantita_history);
     Db::close_connection($conn);
     return $quantita_history;
 }
开发者ID:emeraldion,项目名称:creso,代码行数:25,代码来源:portfolio_helper.php

示例2: Transaction

 function by_date()
 {
     $conn = $this->get_connection();
     $this->totale = 0;
     $this->bilancio = 0;
     $transaction_factory = new Transaction();
     $this->transactions = $transaction_factory->find_all(array('where_clause' => "`utente` = '{$conn->escape($_COOKIE['username'])}' " . "AND `data` = '{$conn->escape($_GET['id'])}' ", 'order_by' => sprintf('`%s` %s', $this->get_sort('data'), $this->get_dir(TRUE)), 'limit' => $this->get_limit()));
     foreach ($this->transactions as $transaction) {
         $transaction->stock = new Stock();
         $transaction->stock->find_by_id($transaction->isin);
     }
     $this->render(array('action' => 'index'));
 }
开发者ID:emeraldion,项目名称:creso,代码行数:13,代码来源:transazioni_controller.php

示例3: backfill_with_historical_data

 private function backfill_with_historical_data($portfolio_stock)
 {
     $conn = $this->get_connection();
     $transaction_factory = new Transaction();
     $transactions = $transaction_factory->find_all(array('where_clause' => "`utente` = '{$conn->escape($_COOKIE['username'])}' " . "AND `isin` = '{$conn->escape($portfolio_stock->isin)}' " . "AND `data` >= '{$conn->escape($_REQUEST['month-from'])}' ", 'order_by' => '`data` DESC'));
     $quantita_history = array();
     $quantita_history[date('Y-m-d')] = $q = $portfolio_stock->quantita;
     $i = 0;
     do {
         if ($transactions[$i]->azione == 'acquisto') {
             $q -= $transactions[$i]->quantita;
         } else {
             $q += $transactions[$i]->quantita;
         }
         $quantita_history[$transactions[$i]->data] = $q;
         $i++;
     } while ($transactions[$i]->data > $_REQUEST['month-from']);
     return $quantita_history;
 }
开发者ID:emeraldion,项目名称:creso,代码行数:19,代码来源:pagamenti_controller.php

示例4: get_stock_deltas

 private function get_stock_deltas($date)
 {
     $conn = $this->get_connection();
     $transaction_factory = new Transaction();
     $transactions = $transaction_factory->find_all(array('where_clause' => "`data` >= '{$conn->escape($date)}'" . "AND `utente` = '{$conn->escape($_COOKIE['username'])}'", 'limit' => 9999999));
     // print_r($transactions);
     $deltas = array();
     foreach ($transactions as $transaction) {
         $sign = $transaction->azione == 'acquisto' ? -1 : +1;
         $current = isset($deltas[$transaction->isin]) ? $deltas[$transaction->isin] : 0;
         $deltas[$transaction->isin] = $current + $sign * $transaction->quantita;
     }
     // print_r($deltas);
     foreach ($deltas as $isin => $value) {
         if ($value == 0) {
             unset($deltas[$isin]);
         }
     }
     // print_r($deltas);
     return $deltas;
 }
开发者ID:emeraldion,项目名称:creso,代码行数:21,代码来源:portfolio_controller.php


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