Revize 319
Přidáno uživatelem Jiří Sviták před více než 15 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'back to account transfers' => 'Zpět na převody účtu',
|
||
'back to all subnets' => 'Zpět na seznam podsítí',
|
||
'back to bank accounts' => 'Zpět na bankovní účty',
|
||
'back to credit accounts' => 'Zpět na kreditní účty',
|
||
'back to day book' => 'Zpět na účetní deník',
|
||
'back to detail' => 'Zpět na detail',
|
||
'back to device parameters' => 'Zpět na parametry zařízení',
|
||
'back to devices list' => 'Zpět na seznam zařízení',
|
||
'back to devices list of this member' => 'Zpět na seznam zařízení tohoto člena',
|
||
'back to devices list of the member' => 'Zpět na seznam zařízení člena',
|
||
'back to interface parameters' => 'Zpět na parametry rozhraní',
|
||
'back to double-entry accounts' => 'Zpět na podvojné účty',
|
||
'back to interface parameters' => 'Zpět na parametry rozhraní',
|
||
'back to interfaces list' => 'Zpět na seznam rozhraní',
|
||
'back to ip addresses list' => 'Zpět na seznam IP adres',
|
||
'back to list of all devices' => 'Zpět na seznam všech zařízení',
|
||
... | ... | |
'date of issue' => 'Datum vystavení',
|
||
'date to' => 'Datum do',
|
||
'date vat' => 'Datum uskutečnění zdanitelného plnění',
|
||
'day book' => 'Účetní deník',
|
||
'debit payment rate' => 'Výše splátek',
|
||
'debtors' => 'Dlužníci',
|
||
'deduct' => 'Odečíst',
|
||
'deduction of membership fees' => 'Odečtení členských příspěvků',
|
||
'deduct' => 'Strhnout',
|
||
'deduction of membership fees' => 'Stržení členských příspěvků',
|
||
'delete this contact' => 'Smazat tento kontakt',
|
||
'delete_member' => 'Smazat tohoto člena',
|
||
'delete_user' => 'Smazat tohoto uživatele',
|
||
... | ... | |
'fee has been successfully updated' => 'Poplatek byl úspěšně aktualizován',
|
||
'fee or penalty comment' => 'Komentář k poplatku/pokutě',
|
||
'fees' => 'Poplatky',
|
||
'fees have been successfully deducted' => 'Členské příspěvky byly úspěšně odečteny.',
|
||
'fees have been successfully deducted' => 'Členské příspěvky byly úspěšně strženy.',
|
||
'file' => 'Soubor',
|
||
'file with bank transfer listing' => 'HTML soubor s výpisem z banky',
|
||
'filter' => 'Filtrovat',
|
||
... | ... | |
'gateway ip address' => 'IP adresa brány',
|
||
'gateway name' => 'Jméno brány',
|
||
'gps' => 'GPS souřadnice',
|
||
'group' => 'Skupina',
|
||
'honorary member' => 'Čestný člen',
|
||
'hours' => 'Hodiny',
|
||
'change' => 'Změnit',
|
||
... | ... | |
'origin account' => 'Zdrojový účet',
|
||
'original term' => 'Původní výraz',
|
||
'ospf area id' => 'OSPF area ID',
|
||
'other accounts' => 'Ostatní účty',
|
||
'outbound' => 'Odchozí',
|
||
'page title' => 'Titulek stránky',
|
||
'password successfully changed' => 'Heslo úspěšně změněno',
|
freenetis/trunk/kohana/application/models/device.php | ||
---|---|---|
|
||
public function get_all_devices($limit_from = 0, $limit_results = 50, $order_by = 'devices.id', $order_by_direction = 'ASC', $user_id = null, $filters = array())
|
||
{
|
||
//return self::$db->select(array('CONCAT(users.name,\' \',users.surname) as u_name', 'devices.*'))->from('devices')->join('users', 'users.id = devices.user_id')->get();
|
||
|
||
if (in_array($order_by,$this->arr_sql)) $order_by = $this->arr_sql[$order_by];
|
||
|
||
if (in_array($order_by, $this->arr_sql))
|
||
$order_by = $this->arr_sql[$order_by];
|
||
$where = '';
|
||
|
||
if(count($filters)>0)
|
||
if(count($filters) > 0)
|
||
$where .= 'WHERE ';
|
||
|
||
foreach($filters as $key => $value)
|
||
{
|
||
if($key!='submit')
|
||
... | ... | |
$where .= ($key!='device_type' AND $key!='member_id') ? $this->arr_sql[$key].' LIKE \'%'.$value.'%\' COLLATE utf8_general_ci' : $this->arr_sql[$key].' = '.$value;
|
||
}
|
||
}
|
||
|
||
|
||
if (isset($user_id))
|
||
{
|
||
if($where=='') $where .= 'WHERE d.user_id='.$user_id.'';
|
||
else $where .= ' AND d.user_id'.$user_id.'';
|
||
}
|
||
|
||
return self::$db->query('SELECT d.id,IFNULL(f.translated_term,e.value) as type,d.name, CONCAT(users.name, \' \', users.surname) AS u_name,
|
||
IFNULL(ifaces.iface_count,0) AS iface_count,
|
||
IFNULL(ports.port_count,0) AS port_count FROM devices d
|
||
JOIN users ON d.user_id = users.id
|
||
LEFT JOIN enum_types e on d.type = e.id
|
||
LEFT JOIN (SELECT * FROM translations WHERE lang = "'.Config::item('locale.lang').'") f on e.value = f.original_term
|
||
LEFT JOIN (SELECT COUNT(*) as iface_count,device_id FROM ifaces GROUP BY ifaces.device_id) ifaces ON d.id=ifaces.device_id
|
||
LEFT JOIN (SELECT COUNT(*) as port_count,device_id FROM ports GROUP BY ports.device_id) ports ON d.id=ports.device_id
|
||
'.$where.'
|
||
ORDER BY '.$order_by.' '.$order_by_direction.' LIMIT '.$limit_from.','.$limit_results);
|
||
return self::$db->query('SELECT
|
||
d.id, IFNULL(f.translated_term, e.value) as type, d.name,
|
||
CONCAT(u.name, \' \', u.surname) AS u_name,
|
||
i.mac, s.name AS segment_name, ip.ip_address
|
||
FROM devices d
|
||
JOIN users u ON d.user_id = u.id
|
||
LEFT JOIN enum_types e on d.type = e.id
|
||
LEFT JOIN (SELECT * FROM translations WHERE lang = "'.Config::item('locale.lang').'") f on e.value = f.original_term
|
||
LEFT JOIN ifaces i ON d.id = i.device_id
|
||
LEFT JOIN segments s ON s.id = i.segment_id
|
||
LEFT JOIN ip_addresses ip ON i.id = ip.iface_id
|
||
'.$where.'
|
||
ORDER BY '.$order_by.' '.$order_by_direction.'
|
||
LIMIT '.$limit_from.','.$limit_results
|
||
);
|
||
} // end of get_all_devices
|
||
|
||
/**
|
||
... | ... | |
*/
|
||
public function get_all_by_member($limit_from = 0, $limit_results = 50, $order_by = 'devices.id', $order_by_direction = 'ASC', $member_id = null)
|
||
{
|
||
if (isset($member_id)) $where = 'WHERE members.id='.$member_id.'';
|
||
else $where = '';
|
||
return self::$db->query(
|
||
'SELECT d.id,IFNULL(f.translated_term,e.value) as type, d.name, CONCAT(users.name, \' \', users.surname) AS u_name,
|
||
i.MAC AS mac, s.name AS segment_name, ip.IP_address AS ip_address
|
||
FROM devices AS d
|
||
JOIN users ON d.user_id = users.id
|
||
JOIN members ON users.member_id=members.id
|
||
if (isset($member_id))
|
||
$where = 'WHERE m.id='.$member_id.'';
|
||
else
|
||
$where = '';
|
||
return self::$db->query('SELECT
|
||
d.id, IFNULL(f.translated_term,e.value) as type, d.name,
|
||
CONCAT(u.name, \' \', u.surname) AS u_name,
|
||
i.mac, s.name AS segment_name, ip.ip_address
|
||
FROM devices d
|
||
JOIN users u ON d.user_id = u.id
|
||
JOIN members m ON u.member_id = m.id
|
||
LEFT JOIN enum_types e ON d.type = e.id
|
||
LEFT JOIN (SELECT * FROM translations WHERE lang = "'.Config::item('locale.lang').'") f ON e.value = f.original_term
|
||
LEFT JOIN ifaces i ON d.id = i.device_id
|
||
... | ... | |
'.$where.'
|
||
ORDER BY '.$order_by.' '.$order_by_direction.
|
||
' LIMIT '.$limit_from.','.$limit_results);
|
||
// old version of query, it returns device and it's parameters and count of interfaces and ports
|
||
/*
|
||
return self::$db->query(
|
||
'SELECT d.id,IFNULL(f.translated_term,e.value) as type,d.name, CONCAT(users.name, \' \', users.surname) AS u_name,
|
||
IFNULL(ifaces.iface_count,0) AS iface_count,
|
||
IFNULL(ports.port_count,0) AS port_count
|
||
FROM devices AS d
|
||
JOIN users ON d.user_id = users.id
|
||
JOIN members on users.member_id=members.id
|
||
LEFT JOIN enum_types e on d.type = e.id
|
||
LEFT JOIN (SELECT * FROM translations WHERE lang = "'.Config::item('locale.lang').'") f on e.value = f.original_term
|
||
LEFT JOIN (
|
||
SELECT COUNT(*) as iface_count,device_id FROM ifaces
|
||
GROUP BY ifaces.device_id
|
||
) AS ifaces ON d.id=ifaces.device_id
|
||
LEFT JOIN (
|
||
SELECT COUNT(*) as port_count,device_id FROM ports
|
||
GROUP BY ports.device_id
|
||
) AS ports ON d.id=ports.device_id
|
||
'.$where.'
|
||
ORDER BY '.$order_by.' '.$order_by_direction.
|
||
' LIMIT '.$limit_from.','.$limit_results);
|
||
*/
|
||
}
|
||
|
||
}
|
freenetis/trunk/kohana/application/models/account.php | ||
---|---|---|
<?php
|
||
class Account_Model extends ORM
|
||
{
|
||
// groups of double-entry accounts
|
||
public static $credit = 1;
|
||
public static $project = 2;
|
||
public static $other = 3;
|
||
|
||
//protected $has_one = array();
|
||
// protected $has_many = array('transfers');
|
||
protected $belongs_to = array('member');
|
||
... | ... | |
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets all double-entry accounts.
|
||
* It gets double-entry accounts of given group. Groups are all credit, all project and other accounts
|
||
* of association.
|
||
* @return unknown_type
|
||
*/
|
||
public function get_doubleentry_accounts()
|
||
public function get_accounts($limit_from = 0, $limit_results = 20, $order_by = 'id', $order_by_direction = 'asc', $filter_values = array())
|
||
{
|
||
return self::$db->query("SELECT a.id, a.name, a.comment, aa.name AS type
|
||
FROM accounts a
|
||
LEFT JOIN account_attributes aa ON aa.id = a.account_attribute_id
|
||
WHERE aa.id = ".Account_attribute_Model::$credit." AND aa.id < ".Account_attribute_Model::$bank_debts);
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets all credit accounts from database including member name and credit.
|
||
* @return unknown_type
|
||
*/
|
||
public function get_credit_accounts($limit_from = 0, $limit_results = 20, $order_by = 'id', $order_by_direction = 'asc')
|
||
{
|
||
if (count($filter_values) == 0)
|
||
$filter_values['group'] = self::$credit;
|
||
if ($filter_values['group'] == self::$project)
|
||
{
|
||
$account_attribute = Account_attribute_Model::$project;
|
||
}
|
||
else if ($filter_values['group'] == self::$other)
|
||
{
|
||
$account_attribute = Account_attribute_Model::$cash
|
||
.' OR a.account_attribute_id = '.Account_attribute_Model::$bank
|
||
.' OR a.account_attribute_id = '.Account_attribute_Model::$operating
|
||
.' OR a.account_attribute_id = '.Account_attribute_Model::$infrastructure
|
||
.' OR a.account_attribute_id = '.Account_attribute_Model::$purchasers
|
||
.' OR a.account_attribute_id = '.Account_attribute_Model::$suppliers
|
||
.' OR a.account_attribute_id = '.Account_attribute_Model::$bank_fees
|
||
.' OR a.account_attribute_id = '.Account_attribute_Model::$bank_interests
|
||
.' OR a.account_attribute_id = '.Account_attribute_Model::$member_fees;
|
||
}
|
||
else
|
||
{
|
||
$account_attribute = Account_attribute_Model::$credit;
|
||
}
|
||
return self::$db->query('SELECT a.id, a.name AS aname, a.comment, m.name AS mname, a.member_id,
|
||
q3.credit FROM
|
||
(SELECT id, member_id, (inbound - outbound) AS credit FROM
|
||
(SELECT q1.id, q1.member_id, IFNULL(SUM(amount), 0) AS inbound, outbound FROM
|
||
(SELECT a.id, member_id, IFNULL(SUM(amount), 0) AS outbound
|
||
FROM accounts a
|
||
LEFT JOIN account_attributes aa ON a.account_attribute_id = aa.id
|
||
LEFT JOIN transfers t ON a.id = t.origin_id
|
||
WHERE aa.id = '.Account_attribute_Model::$credit.'
|
||
WHERE a.account_attribute_id = '.$account_attribute.'
|
||
GROUP BY a.id) AS q1
|
||
LEFT JOIN transfers ON q1.id = transfers.destination_id GROUP BY q1.id) AS q2
|
||
) AS q3
|
||
LEFT JOIN members m ON q3.member_id = m.id
|
||
LEFT JOIN accounts a ON q3.id = a.id
|
||
WHERE a.account_attribute_id = '.$account_attribute.'
|
||
ORDER BY '.$order_by.' '.$order_by_direction.'
|
||
LIMIT '.$limit_from.','.$limit_results);
|
||
}
|
||
|
||
public function get_credit_account_names()
|
||
{
|
||
return self::$db->query('SELECT id, name
|
||
FROM accounts a
|
||
WHERE a.account_attribute_id = '.Account_attribute_Model::$credit
|
||
);
|
||
}
|
||
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets count of credit accounts.
|
||
* It gets count of double-entry accounts of given group.
|
||
* @return unknown_type
|
||
*/
|
||
public function get_credit_accounts_count()
|
||
public function get_accounts_count($filter_values = array())
|
||
{
|
||
if (count($filter_values) == 0)
|
||
$filter_values['group'] = self::$credit;
|
||
if ($filter_values['group'] == self::$project)
|
||
{
|
||
$account_attribute = Account_attribute_Model::$project;
|
||
}
|
||
else if ($filter_values['group'] == self::$other)
|
||
{
|
||
$account_attribute = Account_attribute_Model::$cash
|
||
.' OR a.account_attribute_id = '.Account_attribute_Model::$bank
|
||
.' OR a.account_attribute_id = '.Account_attribute_Model::$operating
|
||
.' OR a.account_attribute_id = '.Account_attribute_Model::$infrastructure
|
||
.' OR a.account_attribute_id = '.Account_attribute_Model::$purchasers
|
||
.' OR a.account_attribute_id = '.Account_attribute_Model::$suppliers
|
||
.' OR a.account_attribute_id = '.Account_attribute_Model::$bank_fees
|
||
.' OR a.account_attribute_id = '.Account_attribute_Model::$bank_interests
|
||
.' OR a.account_attribute_id = '.Account_attribute_Model::$member_fees;
|
||
}
|
||
else
|
||
{
|
||
$account_attribute = Account_attribute_Model::$credit;
|
||
}
|
||
$count = self::$db->query('SELECT COUNT(*) AS total
|
||
FROM accounts a
|
||
WHERE a.account_attribute_id = '.Account_attribute_Model::$credit
|
||
WHERE a.account_attribute_id = '.$account_attribute
|
||
);
|
||
return $count->current()->total;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets all project accounts from database including member name and credit.
|
||
* It gets ids and names of all credit accounts. Used for dropdown in assign_transfer method.
|
||
* @return unknown_type
|
||
*/
|
||
public function get_project_accounts($limit_from = 0, $limit_results = 20, $order_by = 'id', $order_by_direction = 'asc')
|
||
public function get_credit_account_names()
|
||
{
|
||
return self::$db->query('SELECT a.id, a.name AS aname, a.comment, m.name AS mname, a.member_id,
|
||
q3.credit FROM
|
||
(SELECT id, member_id, (inbound - outbound) AS credit FROM
|
||
(SELECT q1.id, q1.member_id, IFNULL(SUM(amount), 0) AS inbound, outbound FROM
|
||
(SELECT a.id, member_id, IFNULL(SUM(amount), 0) AS outbound
|
||
FROM accounts a
|
||
LEFT JOIN account_attributes aa ON a.account_attribute_id = aa.id
|
||
LEFT JOIN transfers t ON a.id = t.origin_id
|
||
WHERE aa.id = '.Account_attribute_Model::$project.'
|
||
GROUP BY a.id) AS q1
|
||
LEFT JOIN transfers ON q1.id = transfers.destination_id GROUP BY q1.id) AS q2
|
||
) AS q3
|
||
LEFT JOIN members m ON q3.member_id = m.id
|
||
LEFT JOIN accounts a ON q3.id = a.id
|
||
ORDER BY '.$order_by.' '.$order_by_direction.'
|
||
LIMIT '.$limit_from.','.$limit_results);
|
||
return self::$db->query('SELECT id, name
|
||
FROM accounts a
|
||
WHERE a.account_attribute_id = '.Account_attribute_Model::$credit
|
||
);
|
||
}
|
||
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets count of project accounts.
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* It gets id of operating account.
|
||
* It gets id of operating account. Used for assigning unidentified transfer.
|
||
* @return unknown_type
|
||
*/
|
||
public function get_operating_account()
|
freenetis/trunk/kohana/application/models/transfer.php | ||
---|---|---|
class Transfer_Model extends ORM
|
||
{
|
||
/**
|
||
* It gets all double-entry transfer. They are shown in day book.
|
||
* @param $limit_from
|
||
* @param $limit_results
|
||
* @param $order_by
|
||
* @param $order_by_direction
|
||
* @return unknown_type
|
||
*/
|
||
public function get_all_transfers($limit_from = 0, $limit_results = 20, $order_by = 'id', $order_by_direction = 'desc')
|
||
{
|
||
return self::$db->query("SELECT
|
||
t.id, oa.name AS origin, da.name AS destination,
|
||
t.text, t.amount, t.datetime
|
||
FROM transfers t
|
||
LEFT JOIN accounts oa ON oa.id = t.origin_id
|
||
LEFT JOIN accounts da ON da.id = t.destination_id
|
||
ORDER BY ".$order_by." ".$order_by_direction."
|
||
LIMIT ".$limit_from." , ".$limit_results
|
||
);
|
||
}
|
||
|
||
public function count_all_transfers()
|
||
{
|
||
return self::$db->count_records('transfers');
|
||
}
|
||
|
||
/**
|
||
* It gets all money transfers of double-entry account.
|
||
* @param $account_id
|
||
* @param $limit_from
|
||
... | ... | |
return (int) self::$db->orwhere(array('origin_id' => $account_id, 'destination_id' => $account_id))->count_records('transfers');
|
||
}
|
||
|
||
public function count_all_transfers()
|
||
{
|
||
return self::$db->count_records('transfers');
|
||
}
|
||
*/
|
||
|
||
// absolete function
|
||
/*
|
||
public function get_all_transfers()
|
||
{
|
||
return self::$db->query('SELECT t.id AS tid, t.datetime, t.text, t.amount,
|
||
bt.variable_symbol, bt.comment,
|
||
oa.name AS origin,
|
||
CONCAT(oba.account_nr, "/", oba.bank_nr),
|
||
da.name AS destination,
|
||
CONCAT(dba.account_nr, "/", dba.bank_nr)
|
||
FROM transfers t
|
||
JOIN accounts AS oa
|
||
ON oa.id = t.origin_id
|
||
JOIN accounts AS da
|
||
ON da.id = t.destination_id
|
||
LEFT JOIN bank_transfers bt
|
||
ON t.id = bt.transfer_id
|
||
LEFT JOIN bank_accounts AS oba
|
||
ON oa.id = oba.account_id
|
||
LEFT JOIN bank_accounts AS dba
|
||
ON da.id = dba.account_id
|
||
ORDER BY t.id');
|
||
}
|
||
*/
|
||
}
|
||
|
||
?>
|
freenetis/trunk/kohana/application/controllers/transfers.php | ||
---|---|---|
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It shows all items from transfers table.
|
||
* This function now seems useless.
|
||
* It shows all double-entry transfers. They are shown in day book.
|
||
* @param $limit_results
|
||
* @param $order_by
|
||
* @param $order_by_direction
|
||
* @return unknown_type
|
||
*/
|
||
function show_all($limit_results = 500, $order_by = 'id', $order_by_direction = 'ASC')
|
||
function show_all($limit_results = 500, $order_by = 'id', $order_by_direction = 'desc', $page_word = null, $page = 1)
|
||
{
|
||
// to do - correct access control
|
||
/*
|
||
... | ... | |
Controller::error(1);
|
||
*/
|
||
// get new selector
|
||
if (is_numeric($this->input->get('record_per_page'))) $limit_results = (int) $this->input->get('record_per_page');
|
||
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
||
// parameters control
|
||
$allowed_order_type = array('id');
|
||
if (!in_array(strtolower($order_by),$allowed_order_type)) $order_by = 'id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc') $order_by_direction = 'asc';
|
||
if (!in_array(strtolower($order_by),$allowed_order_type))
|
||
$order_by = 'id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
|
||
$order_by_direction = 'asc';
|
||
|
||
$model_transfer = new Transfer_Model();
|
||
$total_transfers = $model_transfer->count_all_transfers();
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_transfers)
|
||
$sql_offset = 0;
|
||
$alltransfers = $model_transfer->get_all_transfers();
|
||
$alltransfers = $model_transfer->get_all_transfers($sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
|
||
$headline = url_lang::lang('texts.Day book');
|
||
|
||
$grid = new Grid(url_lang::base().'transfers', url_lang::lang('texts.List of all transactions'), array(
|
||
'separator' => '',
|
||
$grid = new Grid(url_lang::base().'transfers', null, array(
|
||
//'separator' => '',
|
||
'use_paginator' => true,
|
||
'use_selector' => true,
|
||
'current' => $limit_results, //current selected 'records_per_page' value
|
||
'selector_increace' => 200, // increace
|
||
'selector_min' => 200, // minimum where selector start
|
||
'selector_increace' => 500, // increace
|
||
'selector_min' => 500, // minimum where selector start
|
||
'selector_max_multiplier' => 10,
|
||
'base_url' => Config::item('locale.lang').'/transfers/show_all/'.$limit_results.'/'.$order_by.'/'.$order_by_direction,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
... | ... | |
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results
|
||
));
|
||
// transfers fields
|
||
$grid->order_field('mtid')->label('ID');
|
||
$grid->order_field('timestamp')->label(url_lang::lang('texts.Timestamp'));
|
||
$grid->add_new_button(url_lang::base().'transfers/deduct_fees', url_lang::lang('texts.Deduction of membership fees'));
|
||
$grid->order_field('id')->label('ID');
|
||
$grid->order_field('origin')->label(url_lang::lang('texts.Origin account'));
|
||
$grid->order_field('destination')->label(url_lang::lang('texts.Destination account'));
|
||
$grid->order_field('datetime')->label(url_lang::lang('texts.Date and time'));
|
||
$grid->order_field('text')->label(url_lang::lang('texts.Text'));
|
||
$grid->order_field('amount')->label(url_lang::lang('texts.Amount'));
|
||
// transfers_bank_infos fields
|
||
$grid->order_field('variable_symbol')->label(url_lang::lang('texts.Var'));
|
||
$grid->order_field('comment')->label(url_lang::lang('texts.Comment'));
|
||
// accounts fields
|
||
$grid->order_field('origin')->label(url_lang::lang('texts.From'));
|
||
$grid->order_field('origin_type')->label(url_lang::lang('texts.Type'));
|
||
$grid->order_field('destination')->label(url_lang::lang('texts.To'));
|
||
$grid->order_field('destination_type')->label(url_lang::lang('texts.Type'));
|
||
//$grid->order_field('previous_transfer_id')->label('Previous transfer id');
|
||
$grid->datasource($alltransfers);
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = $grid;
|
||
$view->content = new View('transfers/show_all');
|
||
$view->content->headline = $headline;
|
||
$view->content->grid = $grid;
|
||
$view->content->message = $this->session->get_once('message');
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Transfers');
|
||
$view->header->title = $headline;
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It shows transactions of member's analytic account.
|
||
* It shows transactions of member's credit account.
|
||
* @param $account_id
|
||
* @return unknown_type
|
||
*/
|
||
... | ... | |
$total_transfers = $transfer_model->count_my_transfers($account->id);
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_transfers)
|
||
$sql_offset = 0;
|
||
$transfers = $transfer_model->get_transfers($account->id,$sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
$transfers = $transfer_model->get_transfers($account->id, $sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
|
||
$grid = new Grid(url_lang::base().'transfers', url_lang::lang('texts.Transfers of member').' '.$member->name, array(
|
||
//'separator' => '<br />-----------',
|
||
... | ... | |
* @param $account_id
|
||
* @return unknown_type
|
||
*/
|
||
function show_by_credit_account($account_id = NULL, $limit_results = 50, $order_by = 'id', $order_by_direction = 'asc', $page_word = null, $page = 1)
|
||
function show_by_account($account_id = NULL, $limit_results = 50, $order_by = 'id', $order_by_direction = 'asc', $page_word = null, $page = 1)
|
||
{
|
||
if (isset($account_id))
|
||
{
|
||
... | ... | |
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
||
// to do - correct allowed order type array
|
||
$allowed_order_type = array('mt.id', 'aname', 'amount', 'datetime', 'trans_type');
|
||
$allowed_order_type = array('id', 'aname', 'amount', 'datetime', 'trans_type');
|
||
if (!in_array(strtolower($order_by),$allowed_order_type))
|
||
$order_by = 'id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
|
||
... | ... | |
'selector_increace' => 50, // increace
|
||
'selector_min' => 50, // minimum where selector start
|
||
'selector_max_multiplier' => 10,
|
||
'base_url' => Config::item('locale.lang').'/transfers/show_by_credit_account/'.$account_id.'/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'base_url' => Config::item('locale.lang').'/transfers/show_by_account/'.$account_id.'/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_transfers, // use db count query here of course
|
||
'items_per_page' => $limit_results, // it may be handy to set defaults for stuff like this in config/pagination.php
|
||
... | ... | |
//if($this->acl_check_new(get_class($this),'transfers',$account_id))
|
||
// $grid->add_new_button(url_lang::base().'accounts/new_transfer/'.$account->id, url_lang::lang('texts.New transfer'));
|
||
// to do - access rights
|
||
$grid->add_new_button(url_lang::base().'accounts/credit_accounts', url_lang::lang('texts.Back to credit accounts'));
|
||
$grid->add_new_button(url_lang::base().'accounts/show_all', url_lang::lang('texts.Back to double-entry accounts'));
|
||
$grid->add_new_button(url_lang::base().'transfers/add/'.$account_id, url_lang::lang('texts.Send money to other account'));
|
||
$grid->order_field('id')->label('ID');
|
||
$grid->order_field('trans_type')->label(url_lang::lang('texts.Type'))->bool(array(url_lang::lang('texts.Arrival'),url_lang::lang('texts.Outbound')));
|
||
... | ... | |
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = new View('transfers/show_by_credit_account');
|
||
$view->content = new View('transfers/show_by_account');
|
||
$view->content->grid = $grid;
|
||
$view->content->message = $this->session->get_once('message');
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Transfers of credit account');
|
||
$view->header->title = url_lang::lang('texts.Transfers of double-entry account');
|
||
$view->render(TRUE);
|
||
}
|
||
else
|
||
... | ... | |
$view->render(TRUE);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Form for deducting membership fees.
|
||
* @return unknown_type
|
||
*/
|
||
function deduct_fees()
|
||
{
|
||
// to do - access rights
|
||
//if (!$this->acl_check_new(get_class($this),'members')) Controller::error(1);
|
||
|
||
// content of dropdowns
|
||
$year_from = date('Y') - 12;
|
||
for ($i = 1; $i <= 12; $i++)
|
||
{
|
||
// twelve months
|
||
$arr_months[$i] = $i;
|
||
// twelve years back including current year
|
||
$arr_years[$i] = $year_from + $i;
|
||
}
|
||
|
||
$form = new Forge(url_lang::base().'transfers/deduct_fees', '', 'POST', array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$form->dropdown('year')->label(url_lang::lang('texts.Year').':')->rules('required')->options($arr_years)->selected(12);
|
||
$form->dropdown('month')->label(url_lang::lang('texts.Month from').':')->rules('required')->options($arr_months)->selected(1);
|
||
$form->dropdown('months')->label(url_lang::lang('texts.Number of months').':')->rules('required')->options($arr_months)->selected(1);
|
||
$form->input('fee')->label(url_lang::lang('texts.Monthly membership fee').':')->rules('required|valid_numeric');
|
||
$form->input('text')->label(url_lang::lang('texts.Text').':');
|
||
$form->submit('submit')->value(url_lang::lang('texts.Deduct'));
|
||
special::required_forge_style($form, ' *', 'required');
|
||
|
||
if ($form->validate())
|
||
{
|
||
$form_data = $form->as_array();
|
||
foreach($form_data as $key => $value)
|
||
{
|
||
$form_data[$key] = htmlspecialchars($value);
|
||
}
|
||
$year = $arr_years[$form_data['year']];
|
||
$month = $form_data['month'];
|
||
$months = $form_data['months'];
|
||
$fee = $form_data['fee'];
|
||
$text = $form_data['text'];
|
||
// it is possible to deduct fees only in one year
|
||
if ($month + $months > 13)
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.It is possible to deduct fees only in one year.'));
|
||
url::redirect(url_lang::base().'transfers/deduct_fees');
|
||
}
|
||
// models
|
||
$mt = new Transfer_Model();
|
||
$member = new Member_Model();
|
||
$account_model = new Account_Model();
|
||
// it gets ids of all credit accounts
|
||
$credit_accounts = $account_model->select('id')
|
||
->where('account_attribute_id', Account_attribute_Model::$credit)->find_all();
|
||
// it gets id of operating account, the only destination account
|
||
$oa = $account_model->select('id')
|
||
->where('account_attribute_id', Account_attribute_Model::$operating)->find_all()->current();
|
||
// it supposes that everything will be ok, if a transfer couldn't be created, it sets to false
|
||
$save_successful = true;
|
||
// it goes through all credit accounts and it creates their outbound transfers to operating account
|
||
foreach($credit_accounts as $ca)
|
||
{
|
||
$mt->clear();
|
||
// for every account it gets entrance year and month of its owning member
|
||
$entrance = date_parse($member->get_entrance_date($ca->id));
|
||
$e_year = $entrance['year'];
|
||
$e_month = $entrance['month'];
|
||
// fee is deducted only if membership exists before upper date of deducting interval
|
||
if ($e_year <= $year && $e_month <= $month + $months - 1)
|
||
{
|
||
$mt->origin_id = $ca->id;
|
||
$mt->destination_id = $oa->id;
|
||
$mt->datetime = date('Y-m-d H:i:s');
|
||
$mt->text = $text;
|
||
// amount to deduct, it is checked if membership started before deducting interval
|
||
if ($e_month > $month && $e_year == $year)
|
||
$mt->amount = ($month + $months - $e_month) * $fee;
|
||
else
|
||
$mt->amount = $months * $fee;
|
||
if (!$mt->save())
|
||
$save_successful = false;
|
||
}
|
||
}
|
||
if ($save_successful)
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Fees have been successfully deducted.'));
|
||
url::redirect(url_lang::base().'transfers/show_all');
|
||
}
|
||
else
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Error - some fees have not been deducted.'));
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->header->title = url_lang::lang('texts.Deduction of membership fees');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->content = new View('transfers/deduct_fees');
|
||
$view->content->form = $form->html();
|
||
$view->content->message = $this->session->get_once('message');
|
||
$view->footer = new View('base/footer');
|
||
$view->render(TRUE);
|
||
}
|
||
}
|
||
|
||
}
|
||
?>
|
freenetis/trunk/kohana/application/controllers/accounts.php | ||
---|---|---|
* @param $order_by_direction
|
||
* @return unknown_type
|
||
*/
|
||
function credit_accounts($limit_results = 500, $order_by = 'id', $order_by_direction = 'asc', $page_word = null, $page = 1)
|
||
function show_all($limit_results = 500, $order_by = 'id', $order_by_direction = 'asc', $page_word = null, $page = 1)
|
||
{
|
||
// to do - correct access rights
|
||
//if(!$this->acl_check_view('Accounts_Controller','transfers',$member_id))
|
||
// Controller::Error(1);
|
||
|
||
$arr_groups[Account_Model::$credit] = url_lang::lang('texts.Credit accounts');
|
||
$arr_groups[Account_Model::$project] = url_lang::lang('texts.Project accounts');
|
||
$arr_groups[Account_Model::$other] = url_lang::lang('texts.Other accounts');
|
||
$filter=new Table_Form(url_lang::base()."accounts/show_all", "get", array(
|
||
new Table_Form_Item('text', 'name', 'Account name'),
|
||
"tr",
|
||
new Table_Form_Item('select', 'group', 'Group', $arr_groups),
|
||
"tr",
|
||
new Table_Form_Item('submit', 'submit', 'Filter')
|
||
)
|
||
);
|
||
$filter_values = $filter->values();
|
||
|
||
// gets grid settings
|
||
if (is_numeric($this->input->get('record_per_page')))
|
||
... | ... | |
$order_by = 'id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
|
||
$order_by_direction = 'asc';
|
||
|
||
|
||
$account_model = new Account_Model();
|
||
$total_accounts = $account_model->get_credit_accounts_count();
|
||
$total_accounts = $account_model->get_credit_accounts_count($filter_values);
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_accounts)
|
||
$sql_offset = 0;
|
||
$accounts = $account_model->get_credit_accounts($sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
$accounts = $account_model->get_accounts($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $filter_values);
|
||
|
||
// creates parameters of filter in url
|
||
$arr_gets = array();
|
||
foreach ($this->input->get() as $key=>$value)
|
||
$arr_gets[] = $key.'='.$value;
|
||
$query_string = '?'.implode('&',$arr_gets);
|
||
|
||
if (count($filter_values) == 0)
|
||
$filter_values['group'] = Account_Model::$credit;
|
||
$headline = $arr_groups[$filter_values['group']];
|
||
|
||
$grid = new Grid(url_lang::base().'accounts',
|
||
null, array(
|
||
... | ... | |
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results,
|
||
'query_string' => $query_string
|
||
));
|
||
// adding account, to do - access rights
|
||
//if ($this->acl_check_new(get_class($this), 'accounts', $member_id))
|
||
// $acc_grid->add_new_button(url_lang::base().'accounts/add_bank_account/'.$member_id, url_lang::lang('texts.Add new bank account'));
|
||
$grid->add_new_button(url_lang::base().'accounts/deduct_fees', url_lang::lang('texts.Deduction of membership fees'));
|
||
$grid->order_field('id')->label('ID');
|
||
$grid->order_field('aname')->label(url_lang::lang('texts.Account name'));
|
||
$grid->order_field('comment')->label(url_lang::lang('texts.Comment'));
|
||
$grid->order_field('mname')->label(url_lang::lang('texts.Member name'));
|
||
$grid->order_field('credit')->label(url_lang::lang('texts.Credit'));
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Transfers'))->url(url_lang::base().'transfers/show_by_credit_account')->action(url_lang::lang('texts.Show'));
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Transfers'))->url(url_lang::base().'transfers/show_by_account')->action(url_lang::lang('texts.Show'));
|
||
$grid->action_field('member_id')->label(url_lang::lang('texts.Member'))->url(url_lang::base().'members/show')->action(url_lang::lang('texts.Show'));
|
||
$grid->datasource($accounts);
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->header->title = url_lang::lang('texts.Credit accounts');
|
||
$view->header->title = $headline;
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->content = new View('accounts/credit');
|
||
$view->content = new View('accounts/show_all');
|
||
$view->content->headline = $headline;
|
||
$view->content->filter = $filter->view;
|
||
$view->content->grid = $grid;
|
||
$view->content->message = $this->session->get_once('message');
|
||
$view->footer = new View('base/footer');
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
/**
|
||
* Form for deducting membership fees.
|
||
* @return unknown_type
|
||
*/
|
||
function deduct_fees()
|
||
{
|
||
// to do - access rights
|
||
//if (!$this->acl_check_new(get_class($this),'members')) Controller::error(1);
|
||
|
||
// content of dropdowns
|
||
$year_from = date('Y') - 12;
|
||
for ($i = 1; $i <= 12; $i++)
|
||
{
|
||
// twelve months
|
||
$arr_months[$i] = $i;
|
||
// twelve years back including current year
|
||
$arr_years[$i] = $year_from + $i;
|
||
}
|
||
|
||
$form = new Forge(url_lang::base().'accounts/deduct_fees', '', 'POST', array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$form->dropdown('year')->label(url_lang::lang('texts.Year').':')->rules('required')->options($arr_years)->selected(12);
|
||
$form->dropdown('month')->label(url_lang::lang('texts.Month from').':')->rules('required')->options($arr_months)->selected(1);
|
||
$form->dropdown('months')->label(url_lang::lang('texts.Number of months').':')->rules('required')->options($arr_months)->selected(1);
|
||
$form->input('fee')->label(url_lang::lang('texts.Monthly membership fee').':')->rules('required|valid_numeric');
|
||
$form->input('text')->label(url_lang::lang('texts.Text').':');
|
||
$form->submit('submit')->value(url_lang::lang('texts.Deduct'));
|
||
special::required_forge_style($form, ' *', 'required');
|
||
|
||
if ($form->validate())
|
||
{
|
||
$form_data = $form->as_array();
|
||
foreach($form_data as $key => $value)
|
||
{
|
||
$form_data[$key] = htmlspecialchars($value);
|
||
}
|
||
$year = $arr_years[$form_data['year']];
|
||
$month = $form_data['month'];
|
||
$months = $form_data['months'];
|
||
$fee = $form_data['fee'];
|
||
$text = $form_data['text'];
|
||
|
||
// it is possible to deduct fees only in one year
|
||
if ($month + $months > 13)
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.It is possible to deduct fees only in one year.'));
|
||
url::redirect(url_lang::base().'accounts/deduct_fees');
|
||
}
|
||
|
||
// models
|
||
$mt = new Transfer_Model();
|
||
$member = new Member_Model();
|
||
$account_model = new Account_Model();
|
||
|
||
// it gets ids of all credit accounts
|
||
$credit_accounts = $account_model->select('id')
|
||
->where('account_attribute_id', Account_attribute_Model::$credit)->find_all();
|
||
// it gets id of operating account, the only destination account
|
||
$oa = $account_model->select('id')
|
||
->where('account_attribute_id', Account_attribute_Model::$operating)->find_all()->current();
|
||
|
||
// it supposes that everything will be ok, if a transfer couldn't be created, it sets to false
|
||
$save_successful = true;
|
||
|
||
// it goes through all credit accounts and it creates their outbound transfers to operating account
|
||
foreach($credit_accounts as $ca)
|
||
{
|
||
$mt->clear();
|
||
|
||
// for every account it gets entrance year and month of its owning member
|
||
$entrance = date_parse($member->get_entrance_date($ca->id));
|
||
$e_year = $entrance['year'];
|
||
$e_month = $entrance['month'];
|
||
|
||
// fee is deducted only if membership exists before upper date of deducting interval
|
||
if ($e_year <= $year && $e_month <= $month + $months - 1)
|
||
{
|
||
$mt->origin_id = $ca->id;
|
||
$mt->destination_id = $oa->id;
|
||
$mt->datetime = date('Y-m-d H:i:s');
|
||
$mt->text = $text;
|
||
// amount to deduct, it is checked if membership started before deducting interval
|
||
if ($e_month > $month)
|
||
$mt->amount = ($month + $months - $e_month) * $fee;
|
||
else
|
||
$mt->amount = $months * $fee;
|
||
if (!$mt->save())
|
||
$save_successful = false;
|
||
}
|
||
}
|
||
|
||
if ($save_successful)
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Fees have been successfully deducted.'));
|
||
url::redirect(url_lang::base().'accounts/credit_accounts');
|
||
}
|
||
else
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Error - some fees have not been deducted.'));
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->header->title = url_lang::lang('texts.Deduction of membership fees');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->content = new View('accounts/deduct_fees');
|
||
$view->content->form = $form->html();
|
||
$view->content->message = $this->session->get_once('message');
|
||
$view->footer = new View('base/footer');
|
||
$view->render(TRUE);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It shows project accounts.
|
||
* @param $limit_results
|
||
* @param $order_by
|
||
* @param $order_by_direction
|
||
* @return unknown_type
|
||
*/
|
||
function project_accounts($limit_results = 500, $order_by = 'id', $order_by_direction = 'asc', $page_word = null, $page = 1)
|
||
{
|
||
// to do - correct access rights
|
||
//if(!$this->acl_check_view('Accounts_Controller','transfers',$member_id))
|
||
// Controller::Error(1);
|
||
|
||
// gets grid settings
|
||
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
||
// to do - correct allowed order type array
|
||
$allowed_order_type = array('id', 'origin_id', 'destination_id', 'timestamp', 'amount', 'constant_symbol', 'specific_symbol', 'name', 'date_time', 'fee_transfer_id', 'trans_type', 'text');
|
||
if (!in_array(strtolower($order_by),$allowed_order_type))
|
||
$order_by = 'id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
|
||
$order_by_direction = 'asc';
|
||
|
||
$account_model = new Account_Model();
|
||
$total_accounts = $account_model->get_project_accounts_count();
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_accounts)
|
||
$sql_offset = 0;
|
||
$accounts = $account_model->get_project_accounts($sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
|
||
$grid = new Grid(url_lang::base().'accounts',
|
||
null, array(
|
||
'separator' => '<br /><br />',
|
||
'current' => $limit_results, // current selected 'records_per_page' value
|
||
'selector_increace' => 50, // increace
|
||
'selector_min' => 50, // minimum where selector start
|
||
'selector_max_multiplier' => 10,
|
||
'base_url' => Config::item('locale.lang').'/accounts/project_accounts/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_accounts, // use db count query here of course
|
||
'items_per_page' => $limit_results, // it may be handy to set defaults for stuff like this in config/pagination.php
|
||
'style' => 'classic',
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results,
|
||
));
|
||
// adding account, to do - access rights
|
||
//if ($this->acl_check_new(get_class($this), 'accounts', $member_id))
|
||
// $acc_grid->add_new_button(url_lang::base().'accounts/add_bank_account/'.$member_id, url_lang::lang('texts.Add new bank account'));
|
||
//$grid->add_new_button(url_lang::base().'accounts/add_project', url_lang::lang('texts.Add new project account'));
|
||
$grid->order_field('id')->label('ID');
|
||
$grid->order_field('aname')->label(url_lang::lang('texts.Account name'));
|
||
$grid->order_field('comment')->label(url_lang::lang('texts.Comment'));
|
||
$grid->order_field('mname')->label(url_lang::lang('texts.Member name'));
|
||
$grid->order_field('credit')->label(url_lang::lang('texts.Credit'));
|
||
//$grid->action_field('id')->label(url_lang::lang('texts.Transfers'))->url(url_lang::base().'transfers/show_by_credit_account')->action(url_lang::lang('texts.Show'));
|
||
$grid->action_field('member_id')->label(url_lang::lang('texts.Member'))->url(url_lang::base().'members/show')->action(url_lang::lang('texts.Show'));
|
||
$grid->datasource($accounts);
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->header->title = url_lang::lang('texts.Project accounts');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->content = new View('accounts/project');
|
||
$view->content->grid = $grid;
|
||
$view->content->message = $this->session->get_once('message');
|
||
$view->footer = new View('base/footer');
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
function trans_detail($transfer_id = NULL, $member_id = NULL)
|
||
{
|
||
if (isset($transfer_id) && isset($member_id))
|
freenetis/trunk/kohana/application/controllers/devices.php | ||
---|---|---|
}
|
||
|
||
/**
|
||
* Shows all devices.
|
||
* It shows all devices.
|
||
* @param $limit_results devices per page
|
||
* @param $order_by sorting column
|
||
* @param $order_by_direction sorting direction
|
||
... | ... | |
*/
|
||
function show_all($limit_results = 500, $order_by = 'id', $order_by_direction = 'ASC', $page_word = null, $page = 1)
|
||
{
|
||
|
||
$this->session->del('ssMember_id');
|
||
|
||
$device_model = new Device_Model;
|
||
|
||
if (!$this->acl_check_view(get_class($this),'devices')) Controller::error(1);
|
||
if (!$this->acl_check_view(get_class($this),'devices'))
|
||
Controller::error(1);
|
||
|
||
$member_id = NULL;
|
||
if (is_numeric($this->input->get('member_id'))) $member_id = $this->input->get('member_id');
|
||
|
||
if (is_numeric($this->input->get('member_id')))
|
||
$member_id = $this->input->get('member_id');
|
||
$member = new Member_Model($member_id);
|
||
if ($member->id)
|
||
$this->session->set('ssMember_id',$member_id);
|
||
|
||
if ($member->id) $this->session->set('ssMember_id',$member_id);
|
||
|
||
$enum_type_model = new Enum_type_Model();
|
||
$arr_types = $enum_type_model->get_values(Enum_type_model::id_type_of_device);
|
||
$arr_types[0] = '----- '.url_lang::lang('texts.select type').' -----';
|
||
... | ... | |
|
||
$filter_values = $filter->values();
|
||
|
||
if ($member->id) $filter_values["member_id"] = (int) $this->input->get('member_id');
|
||
if ($member->id)
|
||
$filter_values["member_id"] = (int) $this->input->get('member_id');
|
||
|
||
// get new selector
|
||
if (is_numeric($this->input->get('record_per_page'))) $limit_results = (int) $this->input->get('record_per_page');
|
||
|
||
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
||
|
||
$device_model = new Device_Model;
|
||
$total_devices = $device_model->count_all_devices($filter_values);
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_devices)
|
||
$sql_offset = 0;
|
||
... | ... | |
|
||
|
||
$arr_gets = array();
|
||
foreach ($this->input->get() as $key=>$value) $arr_gets[] = $key.'='.$value;
|
||
foreach ($this->input->get() as $key=>$value)
|
||
$arr_gets[] = $key.'='.$value;
|
||
$query_string = '?'.implode('&',$arr_gets);
|
||
|
||
$headline = ($member->id) ? url_lang::lang('texts.Devices list of member').' '.$member->name : url_lang::lang('texts.Devices list');
|
||
... | ... | |
$grid->order_field('name')->label(url_lang::lang('texts.name'));
|
||
$grid->order_field('type')->label(url_lang::lang('texts.type'));
|
||
$grid->order_field('u_name')->label(url_lang::lang('texts.user'));
|
||
$grid->order_field('iface_count')->label(url_lang::lang('texts.ifaces'))->class('center');
|
||
$grid->order_field('port_count')->label(url_lang::lang('texts.ports'))->class('center');
|
||
$grid->order_field('mac')->label(url_lang::lang('texts.MAC address'));
|
||
$grid->order_field('segment_name')->label(url_lang::lang('texts.Segment'));
|
||
$grid->order_field('ip_address')->label(url_lang::lang('texts.IP address'));
|
||
if ($this->acl_check_view(get_class($this),'devices'))
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'devices/show') ->action(url_lang::lang('texts.Show'))->class('center');
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Device')) ->url(url_lang::base().'devices/show') ->action(url_lang::lang('texts.Show'))->class('center');
|
||
if ($this->acl_check_edit(get_class($this),'devices'))
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'devices/edit') ->action(url_lang::lang('texts.Edit'))->class('center');
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Device')) ->url(url_lang::base().'devices/edit') ->action(url_lang::lang('texts.Edit'))->class('center');
|
||
//$grid->action_field('id')->label(url_lang::lang('texts.Delete')) ->url('delete') ->action(url_lang::lang('texts.Delete'))->class('center');
|
||
$grid->datasource( $query );
|
||
$this->template->content = $grid;
|
||
|
||
|
||
$view = new View('template');
|
||
|
||
$view->header = new View('base/header');
|
||
$view->header->title = url_lang::lang('texts.Devices list');
|
||
$view->header->menu = Controller::render_menu();
|
||
... | ... | |
$view->render(TRUE);
|
||
} // end of show_all function
|
||
|
||
|
||
/**
|
||
* Shows devices of logged member.
|
||
* It shows all devices owned by given member.
|
||
* @param $member_id
|
||
* @param $limit_results
|
||
* @param $order_by
|
||
* @param $order_by_direction
|
||
* @param $page_word
|
||
* @param $page
|
||
* @return unknown_type
|
||
*/
|
||
function show_my($limit_results = 500, $order_by = 'id', $order_by_direction = 'ASC', $page_word = null, $page = 1)
|
||
{
|
||
$user_id = $this->session->get('user_id');
|
||
$device_model = new Device_Model;
|
||
|
||
// get new selector
|
||
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
||
|
||
$total_devices = $device_model->count_last_query();
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_devices)
|
||
$sql_offset = 0;
|
||
$query = $device_model->get_all_devices($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $user_id);
|
||
|
||
$grid = new Grid(url_lang::base().'devices', null,array(
|
||
//'separator' => '<br />-----------',
|
||
//'use_paginator' => false,
|
||
//'use_selector' => false,
|
||
'current' => $limit_results, // current selected 'records_per_page' value
|
||
'selector_increace' => 500, // increace
|
||
'selector_min' => 500, // minimum where selector start
|
||
'selector_max_multiplier' => 10,
|
||
'base_url' => Config::item('locale.lang').'/devices/show_my/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_devices, // use db count query here of course
|
||
'items_per_page' => $limit_results, // it may be handy to set defaults for stuff like this in config/pagination.php
|
||
'style' => 'classic',
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results
|
||
));
|
||
|
||
$grid->add_new_button(url_lang::base().'devices/add', url_lang::lang('texts.Add new device'));
|
||
$grid->order_field('id')->label('ID')->class('center');
|
||
$grid->order_field('name')->label(url_lang::lang('texts.name'));
|
||
$grid->order_field('type')->label(url_lang::lang('texts.type'));
|
||
$grid->order_field('u_name')->label(url_lang::lang('texts.user'));
|
||
$grid->order_field('iface_count')->label(url_lang::lang('texts.ifaces'))->class('center');
|
||
$grid->order_field('port_count')->label(url_lang::lang('texts.ports'))->class('center');
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Show'))->url(url_lang::base().'devices/show')->action(url_lang::lang('texts.Show'))->class('center');
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Edit'))->url(url_lang::base().'devices/edit')->action(url_lang::lang('texts.Edit'))->class('center');
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Delete'))->url(url_lang::base().'devices/delete')->action(url_lang::lang('texts.Delete'))->class('center');
|
||
$grid->datasource( $query );
|
||
$this->template->content = $grid;
|
||
|
||
|
||
$view = new View('template');
|
||
|
||
$view->header = new View('base/header');
|
||
$view->header->title = url_lang::lang('texts.Devices list');
|
||
$view->header->menu = Controller::render_menu();
|
||
|
||
$view->content = new View('show_all');
|
||
$view->content->table = $this->template->content;
|
||
$view->content->headline = url_lang::lang('texts.Devices list');
|
||
|
||
$view->footer = new View('base/footer');
|
||
|
||
$view->render(TRUE);
|
||
} // end of show_my function
|
||
|
||
|
||
|
||
//----- show_by_member --------------------------------------------------------------
|
||
//=============================================================================
|
||
function show_by_member($member_id=NULL, $limit_results = 500, $order_by = 'id', $order_by_direction = 'asc', $page_word = null, $page = 1)
|
||
{
|
||
if (!isset($member_id))
|
||
... | ... | |
|
||
}
|
||
|
||
}
|
||
} // end of show_by_member
|
||
|
||
//----- end show_by_member ----------------------------------------------------------
|
||
//=============================================================================
|
||
|
||
|
||
//=============================================================================
|
||
//----- SHOW ------------------------------------------------------------------
|
||
//=============================================================================
|
freenetis/trunk/kohana/application/libraries/MY_Controller.php | ||
---|---|---|
|
||
if ($this->acl_check_2D('menu', 'accounts'))
|
||
$acc_menu .= '<li>'.html::anchor(url_lang::base().'bank_accounts/show_all', url_lang::lang('texts.Bank accounts')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'accounts/credit_accounts', url_lang::lang('texts.Credit accounts')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'accounts/project_accounts', url_lang::lang('texts.Project accounts')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'accounts/show_all', url_lang::lang('texts.Double-entry accounts')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'transfers/show_all', url_lang::lang('texts.Day book')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'accounts/cash_flow', url_lang::lang('texts.Cash flow')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'invoices', url_lang::lang('texts.Invoices')).'</li>';
|
||
<li>'.html::anchor(url_lang::base().'invoices', url_lang::lang('texts.Invoices')).'</li>';
|
||
|
||
if ($acc_menu != '') $myMenu .= '<li class="transfer"><h2>'.url_lang::lang('texts.Finances').'</h2>
|
||
<ul>
|
freenetis/trunk/kohana/application/views/accounts/credit.php | ||
---|---|---|
<h2>
|
||
<?php echo url_lang::lang('texts.Credit accounts')?>
|
||
</h2>
|
||
<?php echo $message ? '<div class="message">'.$message.'</div>' : '' ?>
|
||
|
||
<br />
|
||
<?php echo $grid ?>
|
freenetis/trunk/kohana/application/views/accounts/deduct_fees.php | ||
---|---|---|
<h2><?php echo url_lang::lang('texts.Deduction of membership fees'); ?></h2>
|
||
<?php echo $message ? '<div class="message">'.$message.'</div>' : '' ?>
|
||
<br />
|
||
<?php echo html::anchor(url_lang::base().'accounts/credit_accounts',url_lang::lang('texts.Back to credit accounts'))?>
|
||
<br />
|
||
<br />
|
||
<?php echo $form?>
|
freenetis/trunk/kohana/application/views/accounts/project.php | ||
---|---|---|
<h2>
|
||
<?php echo url_lang::lang('texts.Project accounts')?>
|
||
</h2>
|
||
<?php echo $message ? '<div class="message">'.$message.'</div>' : '' ?>
|
||
|
||
<br />
|
||
<?php echo $grid ?>
|
freenetis/trunk/kohana/application/views/accounts/show_all.php | ||
---|---|---|
<h2><?php echo $headline ?></h2>
|
||
<br />
|
||
<?php echo $message ? '<div class="message">'.$message.'</div>' : '' ?>
|
||
<?php echo $filter ?>
|
||
<br />
|
||
<?php echo $grid ?>
|
freenetis/trunk/kohana/application/views/transfers/show_by_credit_account.php | ||
---|---|---|
<h2><?php echo url_lang::lang('texts.Transfers of credit account'); ?></h2>
|
||
<?php echo $message ? '<div class="message">'.$message.'</div>' : '' ?>
|
||
<br />
|
||
<?php echo $grid; ?>
|
freenetis/trunk/kohana/application/views/transfers/deduct_fees.php | ||
---|---|---|
<h2><?php echo url_lang::lang('texts.Deduction of membership fees'); ?></h2>
|
||
<?php echo $message ? '<div class="message">'.$message.'</div>' : '' ?>
|
||
<br />
|
||
<?php echo html::anchor(url_lang::base().'transfers/show_all',url_lang::lang('texts.Back to day book'))?>
|
||
<br />
|
||
<br />
|
||
<?php echo $form?>
|
freenetis/trunk/kohana/application/views/transfers/show_by_account.php | ||
---|---|---|
<h2><?php echo url_lang::lang('texts.Transfers of double-entry account'); ?></h2>
|
||
<?php echo $message ? '<div class="message">'.$message.'</div>' : '' ?>
|
||
<br />
|
||
<?php echo $grid; ?>
|
freenetis/trunk/kohana/application/views/transfers/show_all.php | ||
---|---|---|
<h2><?php echo $headline ?></h2>
|
||
<?php echo $message ? '<div class="message">'.$message.'</div>' : '' ?>
|
||
<br />
|
||
<?php echo $grid ?>
|
Také k dispozici: Unified diff
Pridan ucetni denik. Predelan system zobrazovani uctu, nova polozka v menu podvojne ucty. Upravena chyba ve strhavani clenskych prispevku. Predelan vypis vsech zarizeni.