FreenetIS
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
Transfer_Model Class Reference
Inheritance diagram for Transfer_Model:
ORM

Public Member Functions

 __construct ($id=NULL)
 Contruct of app, shutdown action logs by default.
 get_all_transfers ($limit_from=0, $limit_results=20, $order_by= 'id', $order_by_direction= 'desc', $filter_sql= '', $filter_name_sql= '')
 Function gets all double-entry transfer.
 count_all_transfers ($filter_sql= '', $filter_name_sql= '')
 Function counts all transfers.
 get_transfers ($account_id=null, $limit_from=0, $limit_results=20, $order_by= 't.id', $order_by_direction= 'ASC', $filter_sql= '', $filter_array=NULL)
 Function gets all money transfers of double-entry account.
 count_transfers ($account_id=null, $filter_sql= '', $filter_array=NULL)
 Function gets all money transfers of double-entry account.
 get_transfer ($trans_id=null)
 Function gets information of specified transfer.
 get_dependent_transfers ($transfer_id)
 Function gets dependent transfers of transfer that is member fee payment.
 get_entrance_fee_transfers_of_account ($account_id)
 Gets "entrance fee" transfers of given account.
 get_last_entrance_fee_transfer_datetime_of_account ($account_id)
 Returns datetime of last entrance fee transfer of account.
 count_entrance_fee_transfers_of_account ($account_id)
 Count total amount of entrance fee transfers of account.
 get_device_fee_transfers_of_account_and_date ($ca, $date)
 Used for deduction of device repayments.
 sum_device_fee_transfers_of_account ($account_id)
 Sums transfers of device fees of account.
 get_all_monthly_amounts_of_incoming_member_payment ()
 Gets all monthly amounts of incoming member payment for stats.
 get_grouped_monthly_member_fees ()
 Gets amount of all member fees grouped by month for stats.
 find_last_transfer_datetime_by_type ($type)
 Gets datime of last transfer by type.
 get_last_transfer_datetime_of_account ($account_id)
 Get datetime of last transfer of account.

Static Public Member Functions

static insert_transfer ($origin_id, $destination_id, $previous_transfer_id, $member_id, $user_id, $type, $datetime, $creation_datetime, $text, $amount)
 Creates transfer.
static edit_transfer ($id, $text, $amount)
 Edits transfers safely with change of dependent account balance.
static delete_transfer ($id=null)
 Safely deletes transfer.
static insert_transfer_for_work_approve ($member_id, $amount)

Public Attributes

const DEDUCT_MEMBER_FEE = 1
 Special type of transfer: deduct member fee.
const DEDUCT_ENTRANCE_FEE = 2
 Special type of transfer: deduct entrance fee.
const DEDUCT_VOIP_UNNACCOUNTED_FEE = 3
 Special type of transfer: deduct voip_unnaccounted fee.
const DEDUCT_VOIP_ACCOUNTED_FEE = 4
 Special type of transfer: deduct voip_accounted fee.
const DEDUCT_DEVICE_FEE = 5
 Special type of transfer: deduct device fee.
const OUTER_TRANSFERS = 1
 Group of transfers: outer.
const INNER_TRANSFERS = 2
 Group of transfers: inner.
const INBOUND_AND_OUTBOUND = 1
 Inbound ans outbound type of transfers.
const INBOUND = 2
 Inbound type of transfers.
const OUTBOUND = 3
 Unbound type of transfers.

Protected Attributes

 $belongs_to
 $has_many = array('job_reports')

Constructor & Destructor Documentation

Transfer_Model::__construct (   $id = NULL)

Contruct of app, shutdown action logs by default.

Parameters
type$id

Member Function Documentation

Transfer_Model::count_all_transfers (   $filter_sql = '',
  $filter_name_sql = '' 
)

Function counts all transfers.

Used in day book.

Returns
integer
Transfer_Model::count_entrance_fee_transfers_of_account (   $account_id)

Count total amount of entrance fee transfers of account.

Author
Michal Kliment
Parameters
type$account_id
Returns
int
Transfer_Model::count_transfers (   $account_id = null,
  $filter_sql = '',
  $filter_array = NULL 
)

Function gets all money transfers of double-entry account.

Parameters
$account_id
$limit_from
$limit_results
$order_by
$order_by_direction
Returns
integer
static Transfer_Model::delete_transfer (   $id = null)
static

Safely deletes transfer.

Author
Jiri Svitak
Parameters
integer$id
Exceptions
Kohana_Databse_Exception
static Transfer_Model::edit_transfer (   $id,
  $text,
  $amount 
)
static

Edits transfers safely with change of dependent account balance.

Author
Jiri Svitak
Parameters
integer$id
string$text
double$amount
Exceptions
Kohana_Databse_Exception
Transfer_Model::find_last_transfer_datetime_by_type (   $type)

Gets datime of last transfer by type.

Author
Michal Kliment
Parameters
integer$type
Returns
string
Transfer_Model::get_all_monthly_amounts_of_incoming_member_payment ( )

Gets all monthly amounts of incoming member payment for stats.

Author
Michal Kliment
Returns
MySQL_Result object
Transfer_Model::get_all_transfers (   $limit_from = 0,
  $limit_results = 20,
  $order_by = 'id',
  $order_by_direction = 'desc',
  $filter_sql = '',
  $filter_name_sql = '' 
)

Function gets all double-entry transfer.

They are shown in day book.

Parameters
integer$limit_from
integer$limit_results
string$order_by
string$order_by_direction
array$filter_values
Returns
Mysql_Result
Transfer_Model::get_dependent_transfers (   $transfer_id)

Function gets dependent transfers of transfer that is member fee payment.

Parameters
$transfer_id
Returns
Mysql_Result
Transfer_Model::get_device_fee_transfers_of_account_and_date (   $ca,
  $date 
)

Used for deduction of device repayments.

Author
Jiri Svitak
Parameters
object$ca
string$date
Returns
Mysql_Result
Transfer_Model::get_entrance_fee_transfers_of_account (   $account_id)

Gets "entrance fee" transfers of given account.

Author
Jiri Svitak
Parameters
integer$account_id
Returns
Mysql_Result
Transfer_Model::get_grouped_monthly_member_fees ( )

Gets amount of all member fees grouped by month for stats.

Author
Ondřej Fibich
Returns
MySQL_Result object
Transfer_Model::get_last_entrance_fee_transfer_datetime_of_account (   $account_id)

Returns datetime of last entrance fee transfer of account.

Author
Michal Kliment
Parameters
type$account_id
Returns
null
Transfer_Model::get_last_transfer_datetime_of_account (   $account_id)

Get datetime of last transfer of account.

Author
Michal Kliment
Parameters
type$account_id
Returns
null
Transfer_Model::get_transfer (   $trans_id = null)

Function gets information of specified transfer.

Parameters
integer$trans_id
Returns
Mysql_Result
Transfer_Model::get_transfers (   $account_id = null,
  $limit_from = 0,
  $limit_results = 20,
  $order_by = 't.id',
  $order_by_direction = 'ASC',
  $filter_sql = '',
  $filter_array = NULL 
)

Function gets all money transfers of double-entry account.

Parameters
$account_id
$limit_from
$limit_results
$order_by
$order_by_direction
Returns
Mysql_Result
static Transfer_Model::insert_transfer (   $origin_id,
  $destination_id,
  $previous_transfer_id,
  $member_id,
  $user_id,
  $type,
  $datetime,
  $creation_datetime,
  $text,
  $amount 
)
static

Creates transfer.

Author
Jiri Svitak
Parameters
integer$origin_idorigin account id
integer$destination_iddestination account id
integer$previous_transfer_idprevious transfer id, useful for transfer groups
integer$member_idtransaction owner id
integer$user_idid of user who added transfer
integer$typetype of transfer, see Transfer_Model
string$datetimeaccounting datetime of transfer
string$creation_datetimedatetime of transfer creation
string$texttransfer text
double$amountamount of transfer
Returns
integer ID of created transfer
Exceptions
Kohana_Databse_Exceptionwhen failed transfer insert, origin or destination account update
Transfer_Model::sum_device_fee_transfers_of_account (   $account_id)

Sums transfers of device fees of account.

Author
Michal Kliment
Parameters
type$account_id
Returns
type

Member Data Documentation

Transfer_Model::$belongs_to
protected
Initial value:
array
(
'origin' => 'account',
'destination' => 'account',
'previous_transfer' => 'transfer',
'user', 'member'
)

The documentation for this class was generated from the following file: