Revize 74a7dbca
Přidáno uživatelem Michal Kliment před více než 9 roky(ů)
application/models/transfer.php | ||
---|---|---|
LIMIT ".intval($limit_from).", ".intval($limit_results)."
|
||
");
|
||
}
|
||
|
||
/**
|
||
* Function gets all money transfers of double-entry account.
|
||
* @param $account_id
|
||
* @param $limit_from
|
||
* @param $limit_results
|
||
* @param $order_by
|
||
* @param $order_by_direction
|
||
* @return Mysql_Result
|
||
*/
|
||
public function sum_transfers_to_id($account_id = null, $toid)
|
||
{
|
||
$account_id = intval($account_id);
|
||
|
||
// query
|
||
return $this->db->query("
|
||
SELECT
|
||
SUM(IF(t.destination_id = $account_id, t.amount, 0)) -
|
||
SUM(IF(t.origin_id = $account_id, t.amount, 0)) AS amount
|
||
FROM transfers t
|
||
WHERE t.id <= ?
|
||
", $toid, $toid)->current()->amount;
|
||
}
|
||
|
||
/**
|
||
* Function gets all money transfers of double-entry account.
|
||
... | ... | |
* @param $transfer_id
|
||
* @return Mysql_Result
|
||
*/
|
||
public function get_dependent_transfers($transfer_id)
|
||
public function get_dependent_transfers($transfer_id = NULL)
|
||
{
|
||
if ($transfer_id === NULL)
|
||
{
|
||
$transfer_id = $this->id;
|
||
}
|
||
|
||
return $this->db->query("
|
||
SELECT dt.*
|
||
FROM transfers t
|
Také k dispozici: Unified diff
Merge from SVN branch 1.2.