Revize 317
Přidáno uživatelem Jiří Sviták před asi 15 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'enum type has been successfully deleted' => 'Výčet byl úspěšně smazán',
|
||
'enum type has been successfully updated' => 'Výčet byl úspěšně aktualizován',
|
||
'enumerations' => 'Výčty',
|
||
'error - cant add new account' => 'Chyba - nelze vytvořit účet.',
|
||
'error' => 'Chyba',
|
||
'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 - cant add new work' => 'Chyba - nelze přidat novou práci.',
|
||
... | ... | |
'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 - 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ý!',
|
||
'error' => 'Chyba',
|
||
'export members to xls file' => 'Exportovat členy do xls souboru',
|
||
'fee' => 'Poplatek',
|
||
'fee has been successfully added' => 'Poplatek byl úspěšně uložen',
|
||
... | ... | |
'ip addresses list' => 'Seznam IP adres',
|
||
'ip addresses list of member' => 'Seznam IP adres člena',
|
||
'ip addresses' => 'IP adresy',
|
||
'it is possible to deduct fees only in one year' => 'Členské příspěvky je možné strhávat jen v rámci jednoho roku.',
|
||
'language' => 'Jazyk',
|
||
'list of all invoices' => 'Seznam všech faktur',
|
||
'list of all members' => 'Seznam všech členů',
|
||
... | ... | |
'message' => 'Zpráva',
|
||
'middle name' => 'Prostřední jméno',
|
||
'minimal duration of interrupt is one month' => 'Minimální délka přerušení je jeden měsíc',
|
||
'month from' => 'Od měsíce (včetně)',
|
||
'monthly member payment' => 'Měsiční členské příspěvky',
|
||
'monthly member payment have to be a number' => 'Měsíční členské příspěvky musí být číslo',
|
||
'monthly membership fee' => 'Měsíční členský příspěvek',
|
||
... | ... | |
'work successfully updated' => 'Práce úspěšně uložena',
|
||
'write email' => 'Napsat e-mail',
|
||
'wrong password' => 'Špatné heslo',
|
||
'year' => 'Rok',
|
||
'yes' => 'ano',
|
||
'you have been successfully logged out' => 'Byl jste úspěšně odhlášen.',
|
||
'zip code' => 'PSČ'
|
freenetis/trunk/kohana/application/models/member.php | ||
---|---|---|
*/
|
||
$query=self::$db->query($q);
|
||
return $query->current();
|
||
|
||
}
|
||
|
||
|
||
public function get_entrance_date($account_id)
|
||
{
|
||
return self::$db->query('SELECT entrance_date
|
||
FROM members m
|
||
LEFT JOIN accounts a ON a.member_id = m.id
|
||
WHERE a.id = '.$account_id
|
||
)->current()->entrance_date;
|
||
}
|
||
|
||
}
|
||
|
||
?>
|
freenetis/trunk/kohana/application/controllers/accounts.php | ||
---|---|---|
{
|
||
// 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->date('month')->label(url_lang::lang('texts.Month').':')->years(date('Y')-10, date('Y'))->rules('required');
|
||
//$form->input('months')->label(url_lang::lang('texts.Number of months').':')->rules('required|valid_numeric');
|
||
$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'));
|
||
... | ... | |
{
|
||
$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();
|
||
|
||
$entrance = $member->query('SELECT entrance_date
|
||
FROM members m
|
||
LEFT JOIN accounts a ON a.member_id = m.id
|
||
WHERE a.id = '.$ca->id)->current()->entrance_date;
|
||
|
||
$mt->origin_id = $ca->id;
|
||
$mt->destination_id = $oa->id;
|
||
$mt->datetime = date('Y-m-d H:i:s');
|
||
$mt->text = $form_data['text'];
|
||
$mt->amount = $amount;
|
||
if (!$mt->save())
|
||
$save_successful = false;
|
||
|
||
// 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)
|
||
... | ... | |
}
|
||
else
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Error - cant deduct fees.'));
|
||
$this->session->set_flash('message', url_lang::lang('texts.Error - some fees have not been deducted.'));
|
||
}
|
||
}
|
||
else
|
||
... | ... | |
$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);
|
||
}
|
||
... | ... | |
// 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->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'));
|
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 />
|
Také k dispozici: Unified diff
Pridana kontrola vstupniho datumu clena pri strhavani clenskych prispevku.