Revize 242
Přidáno uživatelem Jiří Sviták před asi 15 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'remove' => 'Odebrat',
|
||
'save changes' => 'Uložit změny',
|
||
'save' => 'Uložit',
|
||
'section' => 'Sekce',
|
||
'send' => 'Odeslat',
|
||
'segment detail' => 'Detail segmentu',
|
||
'segment has been successfully saved' => 'Segment byl úspěšně uložen.',
|
freenetis/trunk/kohana/application/models/money_transfer.php | ||
---|---|---|
da.name AS destination,
|
||
CONCAT(dba.account_nr, "/", dba.bank_nr)
|
||
FROM money_transfers mt
|
||
JOIN accounts AS oa
|
||
ON oa.id = mt.origin_id
|
||
JOIN accounts AS da
|
||
ON da.id = mt.destination_id
|
||
LEFT JOIN money_transfer_bank_infos bi
|
||
ON mt.id = bi.transfer_id
|
||
JOIN accounts AS oa
|
||
ON oa.id = mt.origin_id
|
||
LEFT JOIN bank_accounts AS oba
|
||
ON oa.id = oba.account_id
|
||
JOIN accounts AS da
|
||
ON da.id = mt.destination_id
|
||
LEFT JOIN bank_accounts AS dba
|
||
ON da.id = dba.account_id
|
||
ORDER BY mt.id');
|
freenetis/trunk/kohana/application/models/account.php | ||
---|---|---|
<?php
|
||
class Account_Model extends ORM {
|
||
|
||
class Account_Model extends ORM
|
||
{
|
||
public function acc_type_exist($type, $owner_id = null, $acc_id = NULL)
|
||
{
|
||
if (isset($acc_id))
|
||
... | ... | |
else return (bool) self::$db->where('type', $type)->count_records('accounts');
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* Get balance of analytic account. Subtract all outbound transfers from all incoming transfers.
|
||
* @param $account_id
|
||
* @return unknown_type
|
||
*/
|
||
public function get_account_balance($account_id)
|
||
{
|
||
$outbound = self::$db->query('SELECT SUM(amount) AS total
|
||
FROM money_transfers mt
|
||
WHERE mt.origin_id = '.$account_id.'
|
||
GROUP BY amount
|
||
');
|
||
$out = 0;
|
||
foreach($outbound as $row)
|
||
{
|
||
$out = $row->total;
|
||
}
|
||
|
||
$inbound = self::$db->query('SELECT SUM(amount) AS total
|
||
FROM money_transfers mt
|
||
WHERE mt.destination_id = '.$account_id.'
|
||
GROUP BY amount
|
||
');
|
||
$in = 0;
|
||
foreach($inbound as $row)
|
||
{
|
||
$in = $row->total;
|
||
}
|
||
return $in - $out;//(float)$inbound->current()->total - (float)$outbound->current()->total;
|
||
}
|
||
}
|
||
|
||
?>
|
freenetis/trunk/kohana/application/controllers/members.php | ||
---|---|---|
|
||
$enum_type_model = new Enum_type_Model();
|
||
|
||
// get balance of member's analytic account
|
||
$model_accounts = new Account_Model();
|
||
$account = $model_accounts->where('member_id', $member_id)->find();
|
||
$account_balance = $account->get_account_balance($account->id);
|
||
|
||
$arr_contact_types = array();
|
||
foreach($contacts as $i => $contact) {
|
||
$arr_contact_types[$i] = $enum_type_model->get_value($contact->type);
|
||
... | ... | |
$view->header->menu = Controller::render_menu();
|
||
$view->content->users = $user_grid;
|
||
$view->content->mis = $mi_grid;
|
||
$view->content->account_balance = $account_balance;
|
||
|
||
// bank and projects accounts should be here
|
||
//$view->content->accs = $acc_grid;
|
freenetis/trunk/kohana/application/views/members_show.php | ||
---|---|---|
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Current credit') ?></th>
|
||
<td><?php echo number_format((float)$member_data->current_credit, 2, ',', ' ').' '.url_lang::lang('texts.CZK') ?></td>
|
||
<td><?php //echo number_format((float)$member_data->current_credit, 2, ',', ' ').' '.url_lang::lang('texts.CZK') ?>
|
||
<?php echo number_format((float) $account_balance, 2, ',', ' ').' '.url_lang::lang('texts.CZK') ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Entrance fee') ?></th>
|
Také k dispozici: Unified diff
Pridan vypocet zustatku na kreditnim uctu clena.