Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 500

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

V rucnim pridavani bankovnich prevodu pridano pridavani poplatku, faktur, uroku a vkladu. Oprava chyby v presmerovani, u lidi bez certifikatu v prohlizeci se nezobrazoval styl. V ucetnim deniku lze filtrovat vypis bez vnitrnich prevodu.

Zobrazit rozdíly:

freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php
'add new bank account' => 'Přidat nový bankovní účet',
'add new bank account of association' => 'Přidat nový bankovní účet sdružení',
'add new bank transfer' => 'Přidat novou bankovní platbu',
'add new bank transfer without counteraccount' => 'Přidat novou bankovní platbu bez protiúčtu',
'add new contact' => 'Přidat nový kontakt',
'add new credit account' => 'Přidat nový kreditní účet',
'add new device' => 'Přidat nové zařízení',
......
'bank fees' => 'Bankovní poplatky',
'bank fees nr' => 'Počet bankovních poplatků',
'bank info' => 'Údaje platby',
'bank interest' => 'Bankovní úrok',
'bank interests' => 'Bankovní úroky',
'bank templates of csv files' => 'Bankovní šablony pro CSV soubory',
'bank transfer' => 'Bankovní převod',
......
'delete' => 'Smazat',
'delete wireless setting' => 'Smazat bezdrátové nastavení',
'dependent transfer' => 'Závislý převod',
'deposit' => 'Vklad',
'description' => 'Popis',
'destination account' => 'Cílový účet',
'destination bank account' => 'Cílový bankovní účet',
......
'channel' => 'Kanál',
'i accept this message and i want to cancel this redirection' => 'Beru na vědomí tuto zprávu a chci zrušit toto přesměrování',
'id' => 'ID',
'identified payment' => 'Identifikovaná platba',
'if you were redirected, wait and redirection will stop in one minute' => 'Pokud jste byli přesměrováni, počkejte a přesměrování do jedné minuty skončí.',
'ignore' => 'Ignorovat',
'import dhcp export from mikrotik' => 'Import exportu DHCP z Mikrotiku',
......
'interval of interruption collides with another interruption of this member' => 'Interval přerušení koliduje s jiným přerušením tohoto člena',
'invalid ip address' => 'Chybná IP adresa',
'invalid network address' => 'Neplatná adresa sítě !',
'invoice' => 'Faktura',
'invoice has been successfully added' => 'Faktura byla úspěšně přidána.',
'invoice has been successfully deleted' => 'Faktura byla úspěšně smazána.',
'invoice has been successfully updated' => 'Faktura byla úspěšně aktualizována.',
......
'post title' => 'Tituly za jménem',
'pppoe' => 'pppoe',
'pre title' => 'Tituly před jménem',
'previous transfer' => 'Předchozí převod',
'price' => 'Cena',
'price vat' => 'Cena s DPH',
'primary user of member cannot be deleted' => 'Primárního uživatele člena nelze smazat.',
freenetis/trunk/kohana/application/models/transfer.php
if ($key == 'amount')
$where .= "t.amount LIKE '%".$value."%' COLLATE utf8_general_ci";
}
/*
if ($key == 'group')
{
if ($value == self::$without_inner)
......
$where = 'WHERE ';
else
$where .= ' AND ';
$where .= "ABS(oa.account_attribute_id - da.account_attribute_id) > 99 ";
$where .= "oa.account_attribute_id <> da.account_attribute_id";
}
}
*/
}
return self::$db->query("SELECT
t.id,
......
if ($key == 'amount')
$where .= "t.amount LIKE '%".$value."%' COLLATE utf8_general_ci";
}
/*
if ($key == 'group')
{
if ($value == self::$without_inner)
......
$where = 'WHERE ';
else
$where .= ' AND ';
$where .= "ABS(oa.account_attribute_id - da.account_attribute_id) > 99 ";
$where .= "oa.account_attribute_id <> da.account_attribute_id";
}
}
*/
}
return self::$db->query("SELECT COUNT(*) AS total
FROM transfers t
freenetis/trunk/kohana/application/controllers/transfers.php
new Table_Form_Item('text', 'amount', 'Amount'),
"tr",
new Table_Form_Item('text', 'text', 'Text'),
//new Table_Form_Item('select', 'group', 'Group', $arr_groups),
//"tr",
new Table_Form_Item('select', 'group', 'Group', $arr_groups),
"tr",
"td", new Table_Form_Item('submit', 'submit', 'Filter')
)
);
freenetis/trunk/kohana/application/controllers/redirect.php
$subnet_model = new Subnet_Model();
$subnet = $subnet_model->get_subnet_of_ip_address(server::remote_addr());
// remote ip address belongs to some subnet
if (count($subnet) > 0)
if ($subnet !== false)
{
//$subnet = $arr_subnets[0];
$subnet_name = $subnet->name;
freenetis/trunk/kohana/application/controllers/bank_transfers.php
{
// static types of bank transfers
public static $member_fee = 1;
public static $invoice = 2;
// static types of bank fees
public static $bank_fee = 1;
public static $bank_interest = 2;
public static $deposit = 3;
function index()
{
url::redirect(url_lang::base().'bank_transfers/show_by_bank_account/1');
......
$grid->add_new_button(url_lang::base().'bank_accounts/show_all', url_lang::lang('texts.Back to bank accounts'));
if ($ba->member_id == 1 && $this->acl_check_new('Accounts_Controller', 'bank_transfers'))
{
$grid->add_new_button(url_lang::base().'bank_transfers/add/'.$bank_account_id, url_lang::lang('texts.Add new bank transfer'));
$grid->add_new_button(url_lang::base().'bank_transfers/add_fee/'.$bank_account_id, url_lang::lang('texts.Add new bank transfer without counteraccount'));
}
$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')));
$grid->order_field('datetime')->label(url_lang::lang('texts.Date and time'));
......
$baa = new Bank_account_Model($baa_id);
if ($baa->id == 0 || $baa->member_id != 1)
Controller::error(RECORD);
// destination bank account
// destination bank account
/*
$ba_model = new Bank_account_Model();
$bas = $ba_model->get_destination_bank_accounts($baa_id);
foreach ($bas as $ba)
......
$arr_bas[$ba->id] = $name;
}
asort($arr_bas, SORT_LOCALE_STRING);
*/
// bank transfer type
$arr_bt_types[self::$member_fee] = url_lang::lang('texts.Member fee');
$arr_bt_types[self::$invoice] = url_lang::lang('texts.Invoice');
// form
$form = new Forge(url_lang::base().'bank_transfers/add/'.$baa_id, '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
// counteraccount
$form->group('')->label(url_lang::lang('texts.Counteraccount'));
$form->input('counteraccount')->label(url_lang::lang('texts.Counteraccount').':')->rules('required');
$form->input('counteraccount_bc')->label(url_lang::lang('texts.Bank code').':')->rules('required');
$form->input('counteraccount_name')->label(url_lang::lang('texts.Account name').':');
// transfer
$form->group('')->label(url_lang::lang('texts.Transfer'));
$form->dropdown('type')->label(url_lang::lang('texts.Bank transfer type').':')->options($arr_bt_types);
......
$form->input('text')->label(url_lang::lang('texts.Text'))->rules('required');
// bank transfer
$form->group('')->label(url_lang::lang('texts.Bank transfer'));
$form->dropdown('counteraccount')->label(url_lang::lang('texts.Counteraccount').':')->options($arr_bas)->rules('required');
$form->input('variable_symbol')->label(url_lang::lang('texts.Variable symbol').':');
$form->input('constant_symbol')->label(url_lang::lang('texts.Constant symbol').':');
$form->input('specific_symbol')->label(url_lang::lang('texts.Specific symbol').':');
......
$form->group('')->label(url_lang::lang('texts.Bank transfer fee'));
$form->input('bank_transfer_fee')->label(url_lang::lang('texts.Amount').':')->value(0);
$form->input('fee_text')->label(url_lang::lang('texts.Text').':')->value(url_lang::lang('texts.Bank transfer fee'));
// comment is needless
//$form->input('comment')->label(url_lang::lang('texts.Comment').':');
// submit
$form->submit('submit')->value(url_lang::lang('texts.Add'));
special::required_forge_style($form, ' *', 'required');
......
}
// preparation
$time_now = date('Y-m-d H:i:s', time());
$operating = ORM::factory('account')->where('account_attribute_id', Account_attribute_Model::$operating)->find();
switch ($form_data['type'])
$operating = ORM::factory('account')->
where('account_attribute_id', Account_attribute_Model::$operating)->find();
$member_fees = ORM::factory('account')->
where('account_attribute_id', Account_attribute_Model::$member_fees)->find();
$suppliers = ORM::factory('account')->
where('account_attribute_id', Account_attribute_Model::$suppliers)->find();
// counter-account
$counter_ba = ORM::factory('bank_account')->
where(array('account_nr' => $form_data['counteraccount'],
'bank_nr' => $form_data['counteraccount_bc']))->find();
if (!$counter_ba)
{
case self::$member_fee:
// origin bank account
$origin_ba = new Bank_account_Model($form_data['counteraccount']);
// origin account
$origin_account = ORM::factory('account')->
where('account_attribute_id', Account_attribute_Model::$member_fees)->find();
// destination bank account
$destination_ba = new Bank_account_Model($baa_id);
// destination account
$destination_account = $destination_ba->get_related_account_by_attribute_id(
Account_attribute_Model::$bank);
// destination bank fees account
$destination_bank_fees = $destination_ba->get_related_account_by_attribute_id(
Account_attribute_Model::$bank_fees);
// origin bank fees account
$origin_bank_fees = $destination_account;
break;
$counter_ba = new Bank_account_Model();
$counter_ba->name = $form_data['counteraccount_name'];
$counter_ba->account_nr = $form_data['counteraccount'];
$counter_ba->bank_nr = $form_data['bank_nr'];
$counter_ba->save();
}
// this bank account
$account = $baa->get_related_account_by_attribute_id(
Account_attribute_Model::$bank);
$bank_fees = $baa->get_related_account_by_attribute_id(
Account_attribute_Model::$bank_fees);
// double-entry transfer
$transfer = new Transfer_Model();
$transfer->origin_id = $origin_account->id;
$transfer->destination_id = $destination_account->id;
if ($form_data['type'] == self::$member_fee)
{
$transfer->origin_id = $member_fees->id;
$transfer->destination_id = $account->id;
}
elseif ($form_data['type'] == self::$invoice)
{
$transfer->origin_id = $account->id;
$transfer->destination_id = $suppliers->id;
}
$transfer->user_id = $this->session->get('user_id');
$transfer->datetime = date('Y-m-d', $form_data['datetime']);
$transfer->creation_datetime = $time_now;
......
// bank transfer
$bt = new Bank_transfer_Model();
$bt->transfer_id = $transfer->id;
$bt->origin_id = $origin_ba->id;
$bt->destination_id = $destination_ba->id;
if ($form_data['type'] == self::$member_fee)
{
$bt->origin_id = $counter_ba->id;
$bt->destination_id = $baa->id;
}
elseif ($form_data['type'] == self::$invoice)
{
$bt->origin_id = $baa_id;
$bt->destination_id = $counter_ba->id;
}
$bt->constant_symbol = $form_data['constant_symbol'];
$bt->variable_symbol = $form_data['variable_symbol'];
$bt->specific_symbol = $form_data['specific_symbol'];
$bank_transfer_saved = $bt->save();
// if bank transfer fee has been set, then it is generated
// bank transfer fee
$bank_transfer_fee_saved = true;
if ($form_data['bank_transfer_fee'] > 0)
{
// bank transfer fee
{
// bank transfer fee - double-entry part
$btf = new Transfer_Model();
$btf->origin_id = $origin_bank_fees->id;
$btf->destination_id = $destination_bank_fees->id;
$btf->origin_id = $account->id;
$btf->destination_id = $bank_fees->id;
$btf->previous_transfer_id = $transfer->id;
$btf->user_id = $this->session->get('user_id');
$btf->datetime = date('Y-m-d', $form_data['datetime']);
$btf->creation_datetime = $time_now;
$btf->text = $form_data['fee_text'];
$btf->amount = $form_data['bank_transfer_fee'];
$bank_transfer_fee_saved = $btf->save();
}
// if type of bank transfer is member fee, then it is identified
$btf_saved = $btf->save();
// bank transfer fee - bank part
$btf2 = new Bank_transfer_Model();
$btf2->transfer_id = $btf->id;
$btf2->origin_account = $baa->id;
$btf2->destination_account = null;
$btf2_saved = $bt->save();
$bank_transfer_fee_saved = $btf_saved && $btf2_saved;
}
// identifying member fee
$identified_transfer_saved = true;
$transfer_fee_saved = true;
if ($form_data['type'] == self::$member_fee)
{
// searching member
$member = ORM::factory('member')->where('variable_symbol', $form_data['variable_symbol'])->find();
if ($member->id)
{
......
'account_attribute_id' => Account_attribute_Model::$credit))->find();
// identified transfer
$it = new Transfer_Model();
$it->origin_id = $destination_account->id;
$it->origin_id = $account->id;
$it->destination_id = $ca->id;
$it->previous_transfer_id = $transfer->id;
$it->user_id = $this->session->get('user_id');
$it->datetime = date('Y-m-d', $form_data['datetime']);
$it->creation_datetime = $time_now;
......
$tf = new Transfer_Model();
$tf->origin_id = $ca->id;
$tf->destination_id = $operating->id;
$tf->previous_transfer_id = $transfer->id;
$tf->user_id = $this->session->get('user_id');
$tf->datetime = date('Y-m-d', $form_data['datetime']);
$tf->creation_datetime = $time_now;
......
}
}
}
// everything successful - setting message and redirection
if ($transfer_saved && $bank_transfer_saved && $bank_transfer_fee_saved && $identified_transfer_saved && $transfer_fee_saved)
{
......
$view->content->form = $form->html();
$view->render(TRUE);
}
function add_fee($baa_id = null)
{
// access rights
if (!$this->acl_check_new('Accounts_Controller', 'bank_transfers'))
Controller::error(ACCESS);
if (!isset($baa_id))
Controller::warning(PARAMETER);
// origin bank account
$baa = new Bank_account_Model($baa_id);
if ($baa->id == 0 || $baa->member_id != 1)
Controller::error(RECORD);
// bank transfer type
$types[self::$bank_fee] = url_lang::lang('texts.Bank fee');
$types[self::$bank_interest] = url_lang::lang('texts.Bank interest');
$types[self::$deposit] = url_lang::lang('texts.Deposit');
// form
$form = new Forge(url_lang::base().'bank_transfers/add_fee/'.$baa_id, '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
// bank transfer fee
$form->group('')->label(url_lang::lang('texts.Bank transfer fee'));
$form->dropdown('type')->label(url_lang::lang('texts.Type'))->options($types);
$form->date('datetime')->label(url_lang::lang('texts.Date and time').':')->years(date('Y')-20, date('Y'))->rules('required');
$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').':')->rules('required');
// submit
$form->submit('submit')->value(url_lang::lang('texts.Add'));
special::required_forge_style($form, ' *', 'required');
// validation
if ($form->validate())
{
$form_data = $form->as_array();
foreach($form_data as $key => $value)
{
$form_data[$key] = htmlspecialchars($value);
}
// preparation
$time_now = date('Y-m-d H:i:s', time());
$account = $baa->get_related_account_by_attribute_id(
Account_attribute_Model::$bank);
$bank_fees = $baa->get_related_account_by_attribute_id(
Account_attribute_Model::$bank_fees);
$bank_interests = $baa->get_related_account_by_attribute_id(
Account_attribute_Model::$bank_interests);
$cash = ORM::factory('account')->
where('account_attribute_id', Account_attribute_Model::$cash)->find();
// transfer
$transfer = new Transfer_Model();
$transfer_saved = true;
if ($form_data['type'] == self::$bank_fee)
{
$transfer->origin_id = $account->id;
$transfer->destination_id = $bank_fees->id;
}
elseif ($form_data['type'] == self::$bank_interest)
{
$transfer->origin_id = $bank_interests->id;
$transfer->destination_id = $account->id;
}
elseif ($form_data['type'] == self::$deposit)
{
$transfer->origin_id = $cash->id;
$transfer->destination_id = $account->id;
}
$transfer->user_id = $this->session->get('user_id');
$transfer->datetime = date('Y-m-d', $form_data['datetime']);
$transfer->creation_datetime = $time_now;
$transfer->text = $form_data['text'];
$transfer->amount = $form_data['amount'];
$transfer_saved = $transfer->save();
// bank transfer
$bt = new Bank_transfer_Model();
$bt_saved = true;
if ($form_data['type'] == self::$bank_fee)
{
$bt->origin_id = $baa->id;
$bt->destination_id = null;
}
elseif ($form_data['type'] == self::$bank_interest || $form_data['type'] == self::$deposit)
{
$bt->origin_id = null;
$bt->destination_id = $baa->id;
}
$bt->transfer_id = $transfer->id;
$bank_transfer_saved = $bt->save();
if ($transfer_saved && $bank_transfer_saved)
{
$this->session->set_flash('message', url_lang::lang('texts.Bank transfer has been successfully added'));
url::redirect(url_lang::base().'bank_transfers/show_by_bank_account/'.$baa_id);
}
}
$headline = url_lang::lang('texts.Add new bank transfer without counteraccount');
$view = new View('main');
$view->title = $headline;
$view->content = new View('form');
$view->content->headline = $headline;
$view->content->link_back = html::anchor(url_lang::base().'bank_transfers/show_by_bank_account/'.$baa_id, url_lang::lang('texts.Back to bank account'));
$view->content->form = $form->html();
$view->render(TRUE);
}
/**
* Function validates amount.
* @param $input
* @return unknown_type
*/
function valid_amount($input)
{
if ($input->value <= 0)
......
}
}
/**
* Function validates variable symbol.
* @param $input
* @return unknown_type
*/
function valid_var_sym($input)
{
if ($this->input->post('name') == 0)
......
$input->add_error('required', url_lang::lang('texts.Variable symbol has not been found in the database.'));
}
}
}
}
}
?>
freenetis/trunk/kohana/application/views/transfers/show.php
</tr>
<?php if (isset($transfer->previous_transfer_id)) { ?>
<tr>
<th><?php echo url_lang::lang('texts.Identified payment') ?></th>
<th><?php echo url_lang::lang('texts.Previous transfer') ?></th>
<td><?php echo html::anchor(url_lang::base().'transfers/show/'.$transfer->previous_transfer_id, $transfer->previous_transfer_id) ?></td>
</tr>
<?php } ?>
freenetis/trunk/kohana/application/views/redirect.php
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $title ?> | <?php echo $this->setting->title ?></title>
<?php echo html::stylesheet('media/css/style.css', 'screen') ?>
<?php echo html::stylesheet('media/css/tables.css', 'screen') ?>
<?php echo str_replace('https', 'http', html::stylesheet('media/css/style.css', 'screen')) ?>
<style type="text/css">
#content-padd h2 {text-align: center; margin: 10px 0px;}
#content-padd h3 {margin: 10px 0px;}

Také k dispozici: Unified diff