當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。