Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 333

Přidáno uživatelem Jiří Sviták před asi 15 roky(ů)

Vypis podrobnych informaci pri nahledu na ucet. Upraveno posilani penez na jine ucty.

Zobrazit rozdíly:

freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php
'enum type has been successfully updated' => 'Výčet byl úspěšně aktualizován',
'enumerations' => 'Výčty',
'error' => 'Chyba',
'error - amount has to be positive' => 'Chyba - částka musí být kladná.',
'error - cant add new account' => 'Chyba - nelze vytvořit účet.',
'error - cant add new member' => 'Chyba - nelze vytvořit člena.',
'error - cant add new user' => 'Chyba - nelze vytvořit uživatele.',
......
'error - can\'t delete translation' => 'Chyba - nelze smazat překlad.',
'error - cant do the transfer' => 'Chyba - nelze provést transakci.',
'error - cant change password' => 'Chyba - nelze změnit heslo',
'error - cant send money, account is in debt' => 'Chyba - nelze poslat peníze, účet je v dluhu.',
'error - cant send money on the same account' => 'Chyba - nelze poslat peníze na stejný účet.',
'error - cant update account' => 'Chyba - nelze upravit účet.',
'error - cant update aditional contacts' => 'Chyba - nelze upravit další kontakty.',
'error - cant update member' => 'Chyba - nelze upravit člena.',
......
'error - cant update work' => 'Chyba - nelze upravit práci.',
'error - it is not possible to remove admin' => 'Chyba - nelze odebrat správce zařízení.',
'error - it is not possible to remove engineer' => 'Chyba - nelze odebrat technika zařízení.',
'error - not enough money on origin account' => 'Chyba - nedostatek peněz na zdrojovém účtě.',
'error - some fees have not been deducted' => 'Chyba - některé členské příspěvky nebyly strženy.',
'error: parameter ID is required!' => 'Chyba: parametr ID je povinný!',
'export members to xls file' => 'Exportovat členy do xls souboru',
......
'ospf area id' => 'OSPF area ID',
'other accounts' => 'Ostatní účty',
'outbound' => 'Odchozí',
'owner of account' => 'Vlastník účtu',
'page title' => 'Titulek stránky',
'password successfully changed' => 'Heslo úspěšně změněno',
'password' => 'Heslo',
......
'translation has been successfully updated' => 'Překlad byl úspěšně aktualizován.',
'translations' => 'Překlady',
'type of contact' => 'Typ kontaktu',
'type of double-entry account' => 'Typ podvojného účtu',
'type' => 'Typ',
'unconfirmed works' => 'Nepotvrzené práce',
'unidentified transfers' => 'Neidentifikované platby',
freenetis/trunk/kohana/application/models/membership_interrupt.php
* @param $membership_interrupt_id optional argument, is used for editing exclusion of editing membership interrupt
* @return <type>
*/
function check_overlaps($date_from = '0000-00-00', $date_to = '0000-00-00', $member_id = NULL, $membership_interrupt_id = NULL)
{
$edit_clause = ($membership_interrupt_id) ? " and id <> ".$membership_interrupt_id : "";
......
(`from` between '".$date_from."' and '".$date_to."' and
`to` between '".$date_from."' and '".$date_to."')) and member_id = ".$member_id.$edit_clause));
}
}
?>
freenetis/trunk/kohana/application/models/member.php
/**
* Function gets fee information of member. Member is specified by his credit account id.
* Fee information is needed for member fee deducting.
* @param $account_id
* @return unknown_type
*/
freenetis/trunk/kohana/application/models/account.php
}
/**
* Function gets some double-entry accounts. Used in dropdown to select destination account.
* @return unknown_type
*/
public function get_some_doubleentry_account_names($origin)
{
return self::$db->query("SELECT a.id, a.name
FROM accounts a
WHERE (a.account_attribute_id = ".Account_attribute_Model::$credit."
OR a.account_attribute_id = ".Account_attribute_Model::$operating."
OR a.account_attribute_id = ".Account_attribute_Model::$project.")
AND a.id <> ".$origin
);
}
/**
* @author Jiri Svitak
* It gets count of project accounts.
* @return unknown_type
......
->current()->id;
}
/**
* Function gets account information.
* @param $account_id
* @return unknown_type
*/
public function get_account($account_id = null)
{
return self::$db->query("SELECT a.id, a.name, m.name AS mname, aa.name AS type
FROM accounts a
LEFT JOIN members m ON m.id = a.member_id
LEFT JOIN account_attributes aa ON aa.id = a.account_attribute_id
WHERE a.id = $account_id"
)->current();
}
}
?>
freenetis/trunk/kohana/application/models/bank_transfer.php
*/
public function get_bank_transfers($ba_id = null, $limit_from = 0, $limit_results = 20, $order_by = 'id', $order_by_direction = 'DESC')
{
echo 'kukuc';
if ($order_by == 'amount')
$order_by = 'IF(bt.destination_id = '.$ba_id.', amount, amount*-1 )';
return self::$db->query("SELECT
freenetis/trunk/kohana/application/models/transfer.php
LEFT JOIN accounts a ON a.id = IF(t.origin_id = ".$account_id.", t.destination_id, t.origin_id)
WHERE t.origin_id = ".$account_id." OR t.destination_id = ".$account_id
)->count();
}
}
// purpose unknown
/*
freenetis/trunk/kohana/application/models/bank_account.php
* @param $account_id
* @return unknown_type
*/
public function get_bank_account_number($account_id)
public function get_bank_account($account_id)
{
$ba_nr = self::$db->query("SELECT CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number
return self::$db->query("SELECT id, account_nr, bank_nr, name, iban, swift
FROM bank_accounts ba
JOIN accounts a ON ba.account_nr = a.name");
return $ba_nr->current()->account_number;
WHERE ba.id = $account_id")->current();
}
/**
freenetis/trunk/kohana/application/controllers/transfers.php
<?php
class Transfers_Controller extends Controller {
protected $origin;
/**
* @author Jiri Svitak
* By default, it redirects user to his member's transfers.
......
$sql_offset = 0;
$transfers = $transfer_model->get_transfers($account_id, $sql_offset, (int)$limit_results, $order_by, $order_by_direction);
$account_model = new Account_Model();
$account = $account_model->get_account($account_id);
$headline = url_lang::lang('texts.Transfers of double-entry account');
$grid = new Grid(url_lang::base().'transfers', null, array(
//'separator' => '<br />-----------',
//'use_paginator' => false,
......
$view = new View('template');
$view->header = new View('base/header');
$view->content = new View('transfers/show_by_account');
$view->content->headline = $headline;
$view->content->account = $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 double-entry account');
$view->header->title = $headline;
$view->render(TRUE);
}
else
......
//if (!$this->gacl_class->acl_check('freenetis', 'new_own', 'all', $_SESSION['username'],get_class($this),'assign_transfers')) Controller::error(1);
$account_model = new Account_Model();
$accounts = $account_model->get_doubleentry_accounts();
$accounts = $account_model->get_some_doubleentry_account_names($origin_account);
foreach ($accounts as $account)
{
$arr_accounts[$account->id] = $account->name;
}
asort($arr_accounts);
$this->origin = $origin_account;
$form = new Forge(url_lang::base().'transfers/add/'.$origin_account, '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
$form->group('')->label(url_lang::lang('texts.Transfer'));
$form->dropdown('aname')->label(url_lang::lang('texts.Destination credit account').':')->options($arr_accounts)->rules('required');
$form->input('amount')->label(url_lang::lang('texts.Amount').':')->rules('required|valid_numeric');
$form->input('amount')->label(url_lang::lang('texts.Amount').':')->rules('required|valid_numeric')->callback(array($this, 'valid_amount'));
$form->input('text')->label(url_lang::lang('texts.Text'));
$form->submit('submit')->value(url_lang::lang('texts.Send'));
special::required_forge_style($form, ' *', 'required');
if ($form->validate())
{
if ($account_model->get_account_balance($origin_account) < 0)
{
$this->session->set_flash('message', url_lang::lang('texts.Error - cant send money, account is in debt.'));
url::redirect(url_lang::base().'transfers/show_by_credit_account/'.$origin_account);
}
$form_data = $form->as_array();
foreach($form_data as $key => $value)
{
$form_data[$key] = htmlspecialchars($value);
}
if ($origin_account == $form_data['aname'])
{
$this->session->set_flash('message', url_lang::lang('texts.Error - cant send money on the same account.'));
url::redirect(url_lang::base().'transfers/show_by_credit_account/'.$origin_account);
}
$mt = new Transfer_Model();
$mt->origin_id = $origin_account;
$mt->destination_id = $form_data['aname'];
......
if ($mt->save())
{
$this->session->set_flash('message', url_lang::lang('texts.Transfer has been successfully added.'));
url::redirect(url_lang::base().'transfers/show_by_credit_account/'.$origin_account);
url::redirect(url_lang::base().'transfers/show_by_account/'.$origin_account);
}
}
......
$view->render(TRUE);
}
}
/**
* Function validates amount of money to send from double-entry account.
* @param $input
* @return unknown_type
*/
function valid_amount($input)
{
$account_model = new Account_Model();
if ($account_model->get_account_balance($this->origin) < $input->value)
{
$input->add_error('required', url_lang::lang('texts.Error - not enough money on origin account.'));
}
if ($input->value <= 0)
{
$input->add_error('required', url_lang::lang('texts.Error - amount has to be positive.'));
}
}
}
?>
freenetis/trunk/kohana/application/controllers/bank_transfers.php
$transfers = $transfer_model->get_bank_transfers($bank_account_id, $sql_offset, (int)$limit_results, $order_by, $order_by_direction);
$account_model = new Bank_account_Model();
$bank_account_number = $account_model->get_bank_account_number($bank_account_id);
$headline = url_lang::lang('texts.Transfers of bank account').' '.$bank_account_number;
$ba = $account_model->get_bank_account($bank_account_id);
$headline = url_lang::lang('texts.Transfers of bank account');
$grid = new Grid(url_lang::base().'transfers', $headline, array(
$grid = new Grid(url_lang::base().'transfers', null, array(
//'separator' => '<br />-----------',
//'use_paginator' => false,
//'use_selector' => false,
......
$view = new View('template');
$view->header = new View('base/header');
$view->content = $grid;
$view->content = new View('bank_transfers/show_by_bank_account');
$view->content->headline = $headline;
$view->content->message = $this->session->get_once('message');
$view->content->ba = $ba;
$view->content->grid = $grid;
$view->footer = new View('base/footer');
$view->header->menu = Controller::render_menu();
$view->header->title = $headline;
freenetis/trunk/kohana/application/controllers/accounts.php
$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('mname')->label(url_lang::lang('texts.Member name'));
$grid->order_field('balance')->label(url_lang::lang('texts.Balance'));
$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'));
freenetis/trunk/kohana/application/views/transfers/show_by_account.php
<h2><?php echo url_lang::lang('texts.Transfers of double-entry account'); ?></h2>
<h2><?php echo $headline ?></h2>
<?php echo $message ? '<div class="message">'.$message.'</div>' : '' ?>
<br />
<table class="extended" style="float:left">
<tr>
<th>ID</th>
<td><?php echo $account->id ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Account name')?></th>
<td><?php echo $account->name ?></td>
</tr>
</table>
<table class="extended" style="float:left; margin-left:25px">
<tr>
<th><?php echo url_lang::lang('texts.Owner of account')?></th>
<td><?php echo $account->mname ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Type of double-entry account')?></th>
<td><?php echo $account->type ?></td>
</tr>
</table>
<br class="clear" />
<br />
<?php echo $grid; ?>
freenetis/trunk/kohana/application/views/bank_transfers/show_by_bank_account.php
<h2><?php echo $headline ?></h2>
<?php echo $message ? '<div class="message">'.$message.'</div>' : '' ?>
<br />
<table class="extended" style="float:left">
<tr>
<th>ID</th>
<td><?php echo $ba->id ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Account number')?></th>
<td><?php echo $ba->account_nr ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Bank number')?></th>
<td><?php echo $ba->bank_nr ?></td>
</tr>
</table>
<table class="extended" style="float:left; margin-left:25px">
<tr>
<th><?php echo url_lang::lang('texts.Account name')?></th>
<td><?php echo $ba->name ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.IBAN')?></th>
<td><?php echo $ba->iban ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.SWIFT')?></th>
<td><?php echo $ba->swift ?></td>
</tr>
</table>
<br class="clear" />
<br />
<?php echo $grid ?>

Také k dispozici: Unified diff