Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 452

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

Rozsireno zobrazovani informaci o podvojnem uctu, opravena chyba s ucetnim datumem u prirazovani plateb.

Zobrazit rozdíly:

freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php
'account has been deleted' => 'Účet byl smazán',
'account has been successfully added' => 'Účet byl úspěšně přidán.',
'account has been successfully updated' => 'Účet byl úspěšně upraven.',
'account id' => 'ID účtu',
'account information' => 'Informace o účtu',
'account name' => 'Název účtu',
'account number' => 'Číslo účtu',
freenetis/trunk/kohana/application/models/member.php
'users.id', 'member_id',
'users.name', 'middle_name', 'surname',
'pre_title', 'post_title',
'login', 'email', 'users.type', 'phone', 'birthday', 'leaving_date','users.application_password')
'login', 'email', 'users.type', 'phone', 'birthday', 'leaving_date','users.application_password','users.comment as ucomment')
)->from('members')
->join('enum_types', 'members.type=enum_types.id', NULL, "LEFT")
->join('users', 'users.member_id = members.id', NULL, "LEFT")
freenetis/trunk/kohana/application/models/account.php
//protected $has_one = array();
// protected $has_many = array('transfers');
protected $belongs_to = array('member');
protected $belongs_to = array('member', 'account_attribute');
//protected $belongs_to_many = array();
protected $has_and_belongs_to_many = array('bank_accounts');
......
return $account;
}
/**
* 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.member_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();
}
/**
* Function gets credit accounts of regular members.
* @return unknown_type
freenetis/trunk/kohana/application/models/account_attribute.php
<?php
class Account_attribute_Model extends ORM
{
protected $has_one = array('account');
/**
* definition of double entry accounts numbers used in various Freenetis controllers and models.
* These numbers are also valid values of the account_attribute primary key!
freenetis/trunk/kohana/application/controllers/members.php
$model_contacts = new Contact_Model();
$contacts = $model_contacts->find_all_by_user_id($member_data->id);
$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);
// get balance of member's credit account, association doesn't have credit account
if ($member_id != 1)
{
$model_accounts = new Account_Model();
$account = $model_accounts->
where(array('member_id' => $member_id,
'account_attribute_id' => Account_attribute_Model::$credit))->find();
}
$arr_contact_types = array();
foreach($contacts as $i => $contact)
{
......
$view = new View('main');
$view->title = url_lang::lang('texts.Display member');
$view->content = new View('members/show');
if ($member_id != 1)
$view->content->account = $account;
$view->content->users = $user_grid;
$view->content->voip = $voip_grid;
$view->content->mis = $mi_grid;
$view->content->account_balance = $account_balance;
foreach($member_data as $key=>$val)
{
// IE dont render TD border if content is NULL, so we must put nbsp into empty fields.
freenetis/trunk/kohana/application/controllers/ifaces.php
$grid->action_field('id')->label(url_lang::lang('texts.Interface'))->url(url_lang::base().'ifaces/edit')->action(url_lang::lang('texts.Edit'))->class('center');
if ($this->acl_check_delete('Devices_Controller','iface'))
$grid->action_field('id')->label(url_lang::lang('texts.Interface'))->url(url_lang::base().'ifaces/delete') ->action(url_lang::lang('texts.Delete'))->class('center')->script('onclick="return potvrd(\''.url_lang::lang('texts.Do you want to delete this interface').'\');"');
$grid->datasource( $query );
$view = new View('template');
$view->header = new View('base/header');
$view->header->title = url_lang::lang('texts.Interfaces list');
$view->header->menu = Controller::render_menu();
$grid->datasource( $query );
$headline = url_lang::lang('texts.Interfaces list');
$view = new View('main');
$view->title = $headline;
$view->content = new View('show_all');
$view->content->table = $grid;
$view->content->headline = url_lang::lang('texts.Interfaces list');
$view->footer = new View('base/footer');
$view->content->headline = $headline;
$view->render(TRUE);
} // end of show_all
......
if ($this->acl_check_delete('Devices_Controller', 'vlan_iface'))
$grid_VLAN_ifaces->action_field('id')->label(url_lang::lang('texts.VLAN interface'))->url(url_lang::base().'vlan_ifaces/delete') ->action(url_lang::lang('texts.Delete'))->class('center')->script('onclick="return potvrd(\''.url_lang::lang('texts.Do you want to delete this vlan interface').'\');"');
$grid_VLAN_ifaces->datasource( $query );
$view = new View('template');
$view->header = new View('base/header');
$view->header->title = url_lang::lang('texts.Interface detail').' - '.$iface->name;
$view->header->menu = Controller::render_menu();
$headline = url_lang::lang('texts.Interface detail').' - '.$iface->name;
$view = new View('main');
$view->title = $headline;
$view->content = new View('ifaces/show');
$view->content->iface = $iface;
$view->content->wireless = $wireless;
$view->content->headline = url_lang::lang('texts.Interface detail').' - '.$iface->name;
$view->content->headline = $headline;
$view->content->table_ip_addresses = $grid_ip_addresses;
$view->content->table_VLAN_ifaces = $grid_VLAN_ifaces;
$view->footer = new View('base/footer');
$view->render(TRUE);
} // end of show
......
$link_back = html::anchor(url_lang::base().'devices/show/'.$device_id, url_lang::lang('texts.Back to device parameters'));
else
$link_back = html::anchor(url_lang::base().'ifaces/show_all/', url_lang::lang('texts.Back to interfaces list'));
$view = new View('template');
$view->header = new View('base/header');
$view->header->title = url_lang::lang('texts.Add new interface');
$view->header->menu = Controller::render_menu();
$view->content = new View('form');
$view->content->form = $form->html();
$view->content->link_back = $link_back;
$view->content->headline = url_lang::lang('texts.Add new interface');
$view->footer = new View('base/footer');
$headline = url_lang::lang('texts.Add new interface');
$view = new View('main');
$view->title = $headline;
$view->content = new View('form');
$view->content->form = $form->html();
$view->content->link_back = $link_back;
$view->content->headline = $headline;
$view->render(TRUE);
} // end of add
......
$form = new Forge(url_lang::base()."ifaces/edit/".$iface_id, '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
$form->group('')->label(url_lang::lang('texts.Basic data'));
$form->input('name')->label(url_lang::lang('texts.name').':')->rules('required|length[3,250]')->value($iface->name);
$form->input('name')->label(url_lang::lang('texts.name').':')->rules('required|length[2,250]')->value($iface->name);
if ($ssDevice_id)
{
$device = new Device_Model($ssDevice_id);
......
$link_back = html::anchor(url_lang::base().'ifaces/show/'.$iface->id, url_lang::lang('texts.Back to interface parameters'));
else
$link_back = html::anchor(url_lang::base().'ifaces/show_all/', url_lang::lang('texts.Back to interfaces list'));
$view = new View('template');
$view->header = new View('base/header');
$view->header->title = url_lang::lang('texts.Edit interface').' - '.$iface->name;
$view->header->menu = Controller::render_menu();
$view->content = new View('form');
$view->content->form = $form->html();
$view->content->link_back = $link_back;
$view->content->headline = url_lang::lang('texts.Edit interface').' - '.$iface->name;
$view->footer = new View('base/footer');
$headline = url_lang::lang('texts.Edit interface').' - '.$iface->name;
$view = new View('main');
$view->title = $headline;
$view->content = new View('form');
$view->content->form = $form->html();
$view->content->link_back = $link_back;
$view->content->headline = $headline;
$view->render(TRUE);
} // end of edit
freenetis/trunk/kohana/application/controllers/transfers.php
/**
* @author Jiri Svitak
* It shows transactions of member's credit account.
* @param $account_id
* @return unknown_type
*/
function show_by_member($member_id = NULL, $limit_results = 500, $order_by = 'id', $order_by_direction = 'desc', $page_word = null, $page = 1)
{
if(!$this->acl_check_view('Accounts_Controller', 'transfers', $member_id))
Controller::error(ACCESS);
if (!isset($member_id))
Controller::warning(PARAMETER);
if ($member_id == 1)
Controller::error(RECORD, url_lang::lang('texts.Association has not got credit account.'));
$this->session->set('ssMember_id',$member_id);
$this->session->del('ssAccount_id');
// gets grid settings
if (is_numeric($this->input->get('record_per_page')))
$limit_results = (int) $this->input->get('record_per_page');
// allowed order type array
$allowed_order_type = array('id', 'trans_type', 'datetime', 'name', 'amount', 'text');
if (!in_array(strtolower($order_by),$allowed_order_type))
$order_by = 'datetime';
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
$order_by_direction = 'desc';
$member = new Member_Model($member_id);
//$this->profiler = new Profiler();
//echo $this->profiler->render(true);
//die();
$account_model = new Account_Model();
$account = $account_model->find_by_member_id($member_id);
$balance = $account_model->get_account_balance($account->id);
$inbound = $account_model->get_total_inbound_amount($account->id);
$outbound = $account_model->get_total_outbound_amount($account->id);
$transfer_model = new Transfer_Model();
$total_transfers = $transfer_model->count_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);
$headline = url_lang::lang('texts.Transfers of member').' '.$member->name;
$grid = new Grid(url_lang::base().'transfers', 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').'/transfers/show_by_member/'.$member_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
'style' => 'classic',
'order_by' => $order_by,
'order_by_direction' => $order_by_direction,
'limit_results' => $limit_results,
'variables' => $member_id.'/',
'url_array_ofset' => 1
));
if ($this->acl_check_view('Members_Controller', 'members', $member_id))
$grid->add_new_button(url_lang::base().'members/show/'.$member_id, url_lang::lang('texts.Back to the member'));
if ($this->acl_check_new('Accounts_Controller', 'transfers', $member_id))
$grid->add_new_button(url_lang::base().'transfers/add/'.$account->id, url_lang::lang('texts.Send money to other account'));
if ($this->acl_check_edit('Accounts_Controller', 'transfers', $member_id))
$grid->add_new_button(url_lang::base().'transfers/add_member_fee_payment_by_cash/'.$member_id, url_lang::lang('texts.Add member fee payment by cash'));
$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'));
$grid->order_field('name')->label(url_lang::lang('texts.Counteraccount'));
$grid->order_field('amount')->label(url_lang::lang('texts.Amount'));
$grid->order_field('text')->label(url_lang::lang('texts.Text'));
if ($this->acl_check_view('Accounts_Controller', 'transfers', $member_id))
$grid->action_field('id')->label(url_lang::lang('texts.Transfer'))->url(url_lang::base().'transfers/show')->action(url_lang::lang('texts.Show'));
if ($this->acl_check_edit('Accounts_Controller','transfers',$member_id))
$grid->action_field('id')->label(url_lang::lang('texts.Transfer'))->url(url_lang::base().'transfers/edit')->action(url_lang::lang('texts.Edit'));
$grid->datasource($transfers);
$view = new View('main');
$view->title = $headline;
$view->content = new View('transfers/show_by_member');
$view->content->headline = $headline;
$view->content->account = $account;
$view->content->balance = $balance;
$view->content->inbound = $inbound;
$view->content->outbound = $outbound;
$view->content->grid = $grid;
$view->render(TRUE);
} // end of show_by_member function
/**
* @author Jiri Svitak
* It shows transfers of credit account.
* @param $account_id
* @return unknown_type
......
$this->session->del('ssMember_id');
$this->session->set('ssAccount_id', $account_id);
if (!isset($account_id))
Controller::warning(PARAMETER);
Controller::warning(PARAMETER);
$account = new Account_Model($account_id);
if ($account->id == 0)
Controller::error(RECORD);
// gets grid settings
if (is_numeric($this->input->get('record_per_page')))
$limit_results = (int) $this->input->get('record_per_page');
......
$order_by = 'datetime';
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
$order_by_direction = 'desc';
// transfers on account
$transfer_model = new Transfer_Model();
$total_transfers = $transfer_model->count_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);
$account_model = new Account_Model();
$account = $account_model->get_account($account_id);
$member = new Member_Model($account->member_id);
$balance = $account_model->get_account_balance($account_id);
$inbound = $account_model->get_total_inbound_amount($account_id);
$outbound = $account_model->get_total_outbound_amount($account_id);
// headline
$headline = url_lang::lang('texts.Transfers of double-entry account');
// grid of transfers
$grid = new Grid(url_lang::base().'transfers', null, array(
//'separator' => '<br />-----------',
//'use_paginator' => false,
......
'url_array_ofset' => 1
));
if ($this->acl_check_view('Accounts_Controller', 'accounts'))
$grid->add_new_button(url_lang::base().'accounts/show_all?name=&group='.$this->session->get('account_group').'&submit=Filter', url_lang::lang('texts.Back to double-entry accounts'));
$grid->add_new_button(url_lang::base().'members/show/'.$account->member_id, url_lang::lang('texts.Back to the member'));
if ($this->acl_check_new('Accounts_Controller', 'transfers'))
$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');
......
$view->content = new View('transfers/show_by_account');
$view->content->headline = $headline;
$view->content->account = $account;
$view->content->mname = $member->name;
$view->content->balance = $balance;
$view->content->inbound = $inbound;
$view->content->outbound = $outbound;
$view->content->balance = $account->get_account_balance($account_id);
$view->content->inbound = $account->get_total_inbound_amount($account_id);
$view->content->outbound = $account->get_total_outbound_amount($account_id);
$view->content->grid = $grid;
$view->content->message = $this->session->get_once('message');
$view->render(TRUE);
freenetis/trunk/kohana/application/controllers/bank_transfers.php
$t->origin_id = $bt->destination_id;
$t->destination_id = $form_data['name'];
$t->previous_transfer_id = $bt->id;
$t->datetime = $time_now;
$t->datetime = $bt->datetime;
$t->creation_datetime = $time_now;
$t->text = $form_data['text'];
$t->amount = $amount;
$new_save = $t->save();
// assign also all subsequent transfers to the selected member
$next_ts=ORM::factory('transfer')->find_all_by_previous_transfer_id($trans_id);
foreach ($next_ts as $transfer) {
$next_ts = ORM::factory('transfer')->find_all_by_previous_transfer_id($trans_id);
foreach ($next_ts as $transfer)
{
$transfer->member_id=$member_id;
$transfer->save();
}
......
$pen->origin_id = $form_data['name'];
$pen->destination_id = $operating->id;
$pen->previous_transfer_id = $bt->id;
$pen->datetime = $time_now;
$pen->datetime = $bt->datetime;
$pen->creation_datetime = $time_now;
$pen->text = $form_data['penalty_text'];
$pen->amount = $form_data['penalty'];
freenetis/trunk/kohana/application/views/members/show.php
$links = array();
if ($this->acl_check_edit('Members_Controller', 'members', $member_data->member_id))
$links[] = html::anchor(url_lang::base().'members/edit/'.$member_data->member_id,url_lang::lang('texts.Edit member'));
if ($this->acl_check_view('Accounts_Controller', 'transfers', $member_data->member_id) && $member_data->member_id <> 1)
$links[] = html::anchor(url_lang::base().'transfers/show_by_member/'.$member_data->member_id,url_lang::lang('texts.Show his transfers'));
if ($this->acl_check_view('Accounts_Controller', 'transfers', $member_data->member_id) && $member_data->member_id != 1)
$links[] = html::anchor(url_lang::base().'transfers/show_by_account/'.$account->id, url_lang::lang('texts.Show his transfers'));
if ($this->acl_check_edit('Accounts_Controller', 'transfers', $member_data->member_id) && $member_data->member_id != 1)
$links[] = html::anchor(url_lang::base().'transfers/add_member_fee_payment_by_cash/'.$member_data->member_id, url_lang::lang('texts.Add member fee payment by cash'));
//$links[] = html::anchor(url_lang::base().'redirect/ip_info/', url_lang::lang('texts.My IP address'));
//$links[] = html::anchor(url_lang::base().'redirect/add_to_debtor_list/'.$member_data->member_id, url_lang::lang('texts.Redirect as debtor'));
if ($member_data->member_id != 1 && $member_data->entrance_fee_left != 0 && $this->acl_check_edit('Members_Controller', 'en_fee_left', $member_data->member_id))
......
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Current credit') ?></th>
<td><?php echo number_format((float) $account_balance, 2, ',', ' ').' '.$this->setting->currency ?></td>
<td><?php echo number_format((float) $account->get_account_balance($account->id), 2, ',', ' ').' '.$this->setting->currency ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Entrance fee') ?></th>
......
<td><?php echo $member_data->qos_rate ?></td>
</tr>
<?php } ?>
<?php if ($this->acl_check_view('Members_Controller', 'comment', $member_data->member_id)) { ?>
<tr>
<th><?php echo url_lang::lang('texts.Comment') ?></th>
<td style="padding:0px"><textarea rows="3" cols="100" readonly="readonly" style="border:0px"><?php echo $member_data->comment ?></textarea></td>
</tr>
<?php } ?>
</table>
<br class="clear" /><br />
......
?>
<br />
<br />
<table class="extended">
<table class="extended" style="float:left; width:360px;">
<tr>
<th colspan="2"><?php echo url_lang::lang('texts.Basic information') ?></th>
</tr>
......
<th><?php echo url_lang::lang('texts.Birthday') ?></th>
<td><?php echo $member_data->birthday ?></td>
</tr>
<?php if ($this->acl_check_view('Users_Controller', 'comment', $member_data->member_id)) { ?>
<tr>
<th><?php echo url_lang::lang('texts.Comment') ?></th>
<td style="padding:0px"><textarea rows="3" cols="100" readonly="readonly" style="border:0px"><?php echo $member_data->ucomment ?></textarea></td>
</tr>
<?php } ?>
</table>
<table class="extended" cellspacing="0" style="float:left; margin-left:10px; width:360px;">
<tr>
<th colspan="2"><?php echo url_lang::lang('texts.Contact information') ?></th>
</tr>
<tr>
<th>
<table class="picturebox">
<tr>
......
?>
</td>
</tr>
</table>
</th>
<td><?php echo $member_data->email ?></td>
</tr>
</table>
</th>
<td><?php echo $member_data->email ?></td>
</tr>
<tr>
<th>
......
</tr>
<?php } ?>
</table>
<br class = "clear" />
<br />
<h3><?php echo url_lang::lang('texts.Users')?></h3>
freenetis/trunk/kohana/application/views/transfers/show_by_member.php
<h2><?php echo $headline ?></h2>
<?php echo ($message = $this->session->get('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>
<tr>
<th><?php echo url_lang::lang('texts.Owner of account')?></th>
<td><?php echo html::anchor(url_lang::base().'members/show/'.$account->member_id, $account->member->name) ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Type of double-entry account')?></th>
<td><?php echo $account->type ?></td>
</tr>
</table>
<table class="extended" style="float:left; margin-left:10px">
<tr>
<th><?php echo url_lang::lang('texts.Balance')?></th>
<td><?php echo number_format((float)$balance, 2, ',', ' ').' '.$this->setting->currency ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Total inbound')?></th>
<td><?php echo number_format((float)$inbound, 2, ',', ' ').' '.$this->setting->currency ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Total outbound')?></th>
<td><?php echo number_format((float)$outbound, 2, ',', ' ').' '.$this->setting->currency ?></td>
</tr>
</table>
<br class="clear" />
<br />
<br />
<?php echo $grid ?>
freenetis/trunk/kohana/application/views/transfers/show_by_account.php
<br />
<table class="extended" style="float:left">
<tr>
<th>ID</th>
<th><?php echo url_lang::lang('texts.Account ID')?></th>
<td><?php echo $account->id ?></td>
</tr>
<tr>
......
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Owner of account')?></th>
<td><?php echo html::anchor(url_lang::base().'members/show/'.$account->member_id, $mname) ?></td>
<td><?php echo html::anchor(url_lang::base().'members/show/'.$account->member_id, $account->member->name) ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Type of double-entry account')?></th>
<td><?php echo $account->type ?></td>
<td><?php echo $account->account_attribute->name ?></td>
</tr>
<?php if ($account->account_attribute_id == Account_attribute_Model::$credit) { ?>
<tr>
<th><?php echo url_lang::lang('texts.Variable symbol')?></th>
<td><?php echo $account->member->variable_symbol ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Entrance date')?></th>
<td><?php echo $account->member->entrance_date ?></td>
</tr>
<?php } ?>
</table>
<table class="extended" style="float:left; margin-left:10px">
<tr>

Také k dispozici: Unified diff