Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 630

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

Opraveny preklady, pridana moznost splatek vstupnich prispevku.

Zobrazit rozdíly:

freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php
'antenna' => 'Anténa',
'applicant' => 'Čekatel na členství',
'application password' => 'Aplikační heslo',
'april' => 'Duben',
'april' => 'Duben',
'are you sure you want to deduct all entrance fees' => 'Jste si jistí, že chcete strhnout všechny vstupní příspěvky',
'are you sure you want to recount fees of this member' => 'Jste si jistí, že chcete přepočítat členské příspěvky tohoto člena',
'area' => 'Oblast',
......
'date vat' => 'Datum uskutečnění zdanitelného plnění',
'day' => 'Den',
'day book' => 'Účetní deník',
'debit payment rate' => 'Výše splátek',
'debtor' => 'Dlužník',
'debtor text' => 'Text pro dlužníka',
'debtors' => 'Dlužníci',
'december' => 'Prosinec',
'december' => 'Prosinec',
'decision counsil about adoption of member' => 'Rozhodnutí Rady o přijetí člena',
'decrease of members' => 'Úbytek členů',
'decrease of members' => 'Úbytek členů',
'deduct' => 'Strhnout',
'deduct entrance fee' => 'Strhnout vstupní příspěvek',
'deduction of member fee' => 'Stržení členského příspěvku',
......
'export to csv (windows-1250)' => 'Exportovat do CSV (windows-1250)',
'failed' => 'Selhání',
'fatal error' => 'Kritická chyba',
'february' => 'Únor',
'february' => 'Únor',
'fee' => 'Poplatek',
'fee has been successfully added' => 'Poplatek byl úspěšně uložen',
'fee has been successfully deleted' => 'Poplatek byl úspěšně smazán',
......
'fees have been successfully deducted' => 'Členské příspěvky byly úspěšně strženy.',
'fees have been successfully recounted' => 'Členské příspěvky byly úspěšně přepočítány.',
'fees have not been set!' => 'Členské příspěvky nebyly nastaveny!',
'fifth-degree certified engineers' => 'Certifikování technici pátého stupně',
'fifth-degree certified engineers' => 'Certifikování technici pátého stupně',
'file' => 'Soubor',
'file type' => 'Typ souboru',
'file with bank transfer listing' => 'Soubor s bankovním výpisem',
'fill in at least one from prices' => 'Vyplňte alespoň jednu z cen.',
'filter' => 'Filtrovat',
'finances' => 'Finance',
'first-degree certified engineers' => 'Certifikovaní technici prvního stupně',
'first-degree certified engineers' => 'Certifikovaní technici prvního stupně',
'first number can\'t be larger then second number' => 'První číslo nesmí být větší než druhé číslo',
'first or last day of month is not valid' => 'První nebo poslední den v měsíci není správně.',
'format' => 'Formát',
......
'forward dns' => 'Dopředné DNS',
'forward dns zone file was successfully generated' => 'Dopředný zónový soubor DNS byl úspěšně vygenerován',
'forward records' => 'Dopředné záznamy',
'fourth-degree certified engineers' => 'Certifikování technici čtvrtého stupně',
'fourth-degree certified engineers' => 'Certifikování technici čtvrtého stupně',
'frequence' => 'Frekvence',
'from/to' => 'Od/komu',
'from' => 'Od',
......
'generation of configuration files' => 'Generování konfiguračních souborů',
'gps' => 'GPS souřadnice',
'group' => 'Skupina',
'growth of members' => 'Růst členů',
'growth of members' => 'Růst členů',
'honorary member' => 'Čestný člen',
'hours' => 'Hodin',
'hours2' => 'Hodiny',
......
'change application password' => 'Změnit aplikační heslo',
'change password' => 'Změnit heslo',
'channel' => 'Kanál',
'i' => 'P',
'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',
'id of member' => 'ID člena',
......
'import results' => 'Výsledky importu',
'inactive' => 'Neaktivní',
'inbound' => 'Příchozí',
'increase of members' => 'Přírůstek členů',
'increase of members' => 'Přírůstek členů',
'indefinitely' => 'Na neurčito',
'information' => 'Informace',
'information about main user' => 'Informace o hlavním uživateli',
......
'item number' => 'Položka č.',
'item separator' => 'Oddělovač položek',
'item(s) have been successfully added' => 'položka(ek) bylo úspěšně přidáno',
'january' => 'Leden',
'june' => 'Červen',
'july' => 'Červenec',
'january' => 'Leden',
'june' => 'Červen',
'july' => 'Červenec',
'language' => 'Jazyk',
'last time login' => 'Poslední čas přihlášení',
'leaving date' => 'Datum vystoupení',
......
'main' => 'Hlavní',
'make backup' => 'Vytvořit zálohu',
'map' => 'Mapa',
'march' => 'Březen',
'may' => 'Květen',
'march' => 'Březen',
'may' => 'Květen',
'medium' => 'Médium',
'member' => 'Člen',
'member adopted on' => 'Člen přijat ke dni',
......
'monitor' => 'Sledovat',
'month' => 'Měsíc',
'month from' => 'Od měsíce (včetně)',
'monthly instalment of entrance' => 'Měsíční splátka vstupního',
'monthly member payment' => 'Měsíč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 member fee' => 'Měsíční členský příspěvek',
......
'my transfers' => 'Moje převody',
'my users' => 'Moji uživatelé',
'my works' => 'Moje práce',
'n' => 'U',
'name' => 'Jméno',
'name of the association' => 'Název sdružení',
'name of organization' => 'Název organizace',
......
'new password' => 'Nové heslo',
'new transfer' => 'Nový převod',
'new transfer from account' => 'Nový převod z účtu',
'nineth-degree certified engineers' => 'Certifikování technici devátého stupně',
'nineth-degree certified engineers' => 'Certifikování technici devátého stupně',
'no' => 'ne',
'nonactive' => 'Neaktivní',
'none' => 'žádný',
......
'non-statutory member' => 'Člen bez statusu',
'norm' => 'Norma',
'note' => 'Poznámka',
'november' => 'Listopad',
'november' => 'Listopad',
'number' => 'Číslo',
'numbers' => 'Čísla',
'number interval' => 'Rozsah čísel',
'number of months' => 'Počet měsíců',
'number of the hours' => 'počet hodin',
'october' => 'Říjen',
'o' => 'V',
'october' => 'Říjen',
'old password' => 'Staré heslo',
'operating account' => 'Provozní účet',
'optional' => 'nepovinné',
freenetis/trunk/kohana/application/models/account.php
AND origin_id = $account_id");
}
/**
* Gets information important to correctly deduct fees. Used for recounting
* member fees of one member (one account).
* @author Jiri Svitak
* @param $account_id
* @param $date
* @return unknown_type
*/
public function get_account_to_deduct($account_id, $date)
{
return self::$db->query("
......
public function get_accounts_to_deduct_entrance_fees()
{
return self::$db->query("
SELECT a.id,m.entrance_fee, m.entrance_date, t.id AS transfer_id, t.amount
SELECT a.id, m.entrance_fee, m.debt_payment_rate, m.entrance_date, t.id AS transfer_id, t.amount
FROM accounts a
JOIN members m ON a.member_id = m.id AND m.id <> 1
LEFT JOIN transfers t ON t.origin_id = a.id AND t.type = ".Transfer_Model::$deduct_entrance_fee."
......
}
/**
* Gets amount of deducted entrance fees of member's credit account.
* Used for deducting entrance fees with instalment.
* @author Jiri Svitak
* @param $account_id
* @return unknown_type
*/
public function get_amount_of_entrance_fees($account_id)
{
return self::$db->query("
SELECT IFNULL(SUM(t.amount), 0) AS amount
FROM transfers t
WHERE t.origin_id = $account_id AND t.type = ".Transfer_Model::$deduct_entrance_fee
)->current()->amount;
}
}
?>
freenetis/trunk/kohana/application/controllers/members.php
$form->group('')->label(url_lang::lang('texts.Account information'));
$form->input('entrance_fee')->label(url_lang::lang('texts.Entrance fee').':')->rules('valid_numeric')->value($entrance_fee);
$form->input('debt_payment_rate')->label(url_lang::lang('texts.Debit payment rate').':')->rules('valid_numeric');
$form->input('debt_payment_rate')->label(url_lang::lang('texts.Monthly instalment of entrance').':')->rules('valid_numeric')->value($entrance_fee);
$form->group('')->label(url_lang::lang('texts.Additional information'));
$form->input('qos_ceil')->label(url_lang::lang('texts.qos ceil').':')->rules('valid_numeric');
$form->input('qos_rate')->label(url_lang::lang('texts.qos rate').':')->rules('valid_numeric');
......
if ($this->acl_check_edit(get_class($this),'en_fee',$member_id))
$form->input('entrance_fee')->label(url_lang::lang('texts.Entrance fee').':')->rules('valid_numeric')->value($member_data->entrance_fee);
if ($this->acl_check_edit(get_class($this),'debit',$member_id))
$form->input('debt_payment_rate')->label(url_lang::lang('texts.Debit payment rate').':')->rules('valid_numeric')->value($member_data->debt_payment_rate);
$form->input('debt_payment_rate')->label(url_lang::lang('texts.Monthly instalment of entrance').':')->rules('valid_numeric')->value($member_data->debt_payment_rate);
// additional information
$form->group('')->label(url_lang::lang('texts.Additional information'));
freenetis/trunk/kohana/application/controllers/transfers.php
}
*/
/**
* Deducts fees of all members in one month. Instead of one transfer per year this function deducts
* one transfer per month. It is possible to recount member fees by deleting previous
* member fee transfers and creating new ones.
* @author Jiri Svitak
* @return unknown_type
*/
function deduct_fees()
{
// access rights
......
}
}
}
/*
echo '<table>';
foreach ($accounts as $account)
{
echo '<tr>';
foreach ($account as $item)
echo '<td>'.$item.'</td>';
echo '</tr>';
}
echo '</table>';
*/
if ($save_successful)
{
$this->session->set_flash('message', url_lang::lang('texts.Fees have been successfully deducted.'));
......
}
/**
* Function recounts wrong deducted fees of given member.
* Function recounts wrong deducted fees of given account of member.
* @author Jiri Svitak
* @return unknown_type
*/
......
$creation_datetime = date('Y-m-d H:i:s');
// deleting of old deduct transfer of member
$account_model->delete_deduct_transfers_of_account($account_id);
$save_successful = true;
$save_successful = true;
// iterates over months from entrance date of member to leaving date
while (true)
{
// getting boundary date - 15th day in the month
$date = date('Y-m-d', mktime(0, 0, 0, $emonth, 15, $eyear));
if ($date >= date('Y-m-d'))
break;
// getting member fee of iterated month
$fee_model = new Fee_Model();
$fee = $fee_model->get_by_date_type($date, 'regular member fee');
if ($fee->id)
$member_fee = $fee->fee;
else
throw new Kohana_User_Exception(url_lang::lang('texts.Fatal error'), url_lang::lang('texts.Fees have not been set!'));
if ($date == '2009-09-15')
{
$ha = 5;
}
// searches information about member account
$accounts = $account_model->get_account_to_deduct($account_id, $date);
/*
if (count($accounts) == 0)
{
$emonth++;
if ($emonth == 13)
{
$emonth = 1;
$eyear++;
}
if ($eyear == $lyear && $emonth >= $lmonth)
break;
continue;
}
else*/
{
$account = $accounts->current();
}
$account = $accounts->current();
// creating new deduct transfer
$transfer = new Transfer_Model();
$transfer->origin_id = $account->id;
$transfer->destination_id = $operating->id;
......
// then zero transfer is generated
else
{
// reason for zero transfer
// reason for zero transfer, first is member type without duty to pay fees
if ($account->correct_type != 1)
{
$translation = ORM::factory('translation')->
where(array('original_term' => $account->type_name, 'lang' => Config::item('locale.lang')))->find();
$transfer->text .= ' - '.url_lang::lang("texts.".$translation->translated_term);
}
// second reason may be member with interrupted membership
elseif ($account->miid != 0)
{
$transfer->text .= ' - '.url_lang::lang("texts.Membership interrupt");
}
// zero transfer generated
$transfer->amount = 0;
if (!$transfer->save())
$save_successful = false;
}
}
}
// finding next month
$emonth++;
if ($emonth == 13)
{
......
$eyear++;
}
}
if ($save_successful)
{
$this->session->set_flash('message', url_lang::lang('texts.Fees have been successfully recounted.'));
......
* @author Jiri Svitak
* @return unknown_type
*/
function deduct_entrance_fees($member_id = null)
function deduct_entrance_fees()
{
// access rights
if (!$this->acl_check_new('Accounts_Controller', 'transfers'))
......
$creation_datetime = date('Y-m-d H:i:s');
$infrastructure = ORM::factory('account')->where('account_attribute_id', Account_attribute_Model::$infrastructure)->find();
$account_model = new Account_Model();
// gets all credit accounts, tries to find also existing transfer
$credit_accounts = $account_model->get_accounts_to_deduct_entrance_fees();
// large amount of database inserts, transaction processing is necessary
$db = new Database();
......
$save_successful = true;
foreach($credit_accounts as $ca)
{
// if member's entrance fee is 0, then no transfer is generated
if ($ca->entrance_fee == 0)
continue;
//echo "entrance fee $ca->entrance_fee<br>";
// are there some deduct transfers?
if (empty($ca->transfer_id))
{
if ($ca->entrance_fee == 0)
continue;
$transfer = new Transfer_Model();
// no deduct entrance fee transfer means that nothing is already paid
$already_paid = 0;
}
else
{
if ($ca->entrance_fee == $ca->amount)
continue;
$transfer = new Transfer_Model($ca->transfer_id);
// some transfers already exist, then their total amount is calculated
$already_paid = $account_model->get_amount_of_entrance_fees($ca->id);
}
$transfer->origin_id = $ca->id;
$transfer->destination_id = $infrastructure->id;
$transfer->user_id = $this->session->get('user_id');
$transfer->type = Transfer_Model::$deduct_entrance_fee;
$transfer->datetime = $ca->entrance_date;
$transfer->creation_datetime = $creation_datetime;
$transfer->text = url_lang::lang('texts.Entrance fee');
$transfer->amount = $ca->entrance_fee;
if (!$transfer->save())
$save_successful = false;
//echo "already paid $already_paid<br>";
// is already whole entrance fee paid?
if ($already_paid >= $ca->entrance_fee)
continue;
// entrance fee is not wholy paid, calculate debt
$debt = $ca->entrance_fee - $already_paid;
// entrance date of current member
$entrance = date_parse($ca->entrance_date);
$eyear = $entrance['year'];
$emonth = $entrance['month'];
// getting boundary date - 15th day in the month
$date = date('Y-m-d', mktime(0, 0, 0, $emonth, 15, $eyear));
//$total = 0;
// while debt is greater than zero and date of instalment is lower than current date
while ($debt > 0 && $date < date('Y-m-d'))
{
// is debt still greater than one monthly instalment?
if ($debt > $ca->debt_payment_rate)
{
// one monthly instalment is deducted
$amount = $ca->debt_payment_rate;
// if debt pay rate is zero, then whole amount of debt is deducted
if ($amount <= 0)
$amount = $debt;
}
else
{
$amount = $debt;
}
// decrease amount of debt due to size of one instalment
$debt -= $amount;
// create new transfer
$transfer = new Transfer_Model();
$transfer->origin_id = $ca->id;
$transfer->destination_id = $infrastructure->id;
$transfer->user_id = $this->session->get('user_id');
$transfer->type = Transfer_Model::$deduct_entrance_fee;
$transfer->datetime = $date;
$transfer->creation_datetime = $creation_datetime;
$transfer->text = url_lang::lang('texts.Entrance fee');
$transfer->amount = $amount;
//echo "$date: $amount<br>";
//$total += $amount;
if (!$transfer->save())
$save_successful = false;
// iterate to next month
$emonth++;
if ($emonth == 13)
{
$emonth = 1;
$eyear++;
}
// getting boundary date - 15th day in the month
$date = date('Y-m-d', mktime(0, 0, 0, $emonth, 15, $eyear));
}
//echo "total $total<br>";
//die();
}
if ($save_successful)
{
freenetis/trunk/kohana/application/controllers/login.php
else
{
// Check the username and password
$user_model=new User_Model();
$user_model = new User_Model();
$user_id = $user_model->login_request($this->input->post('username'),$this->input->post('password'));
if ($user_id)
{
$user = ORM::factory('user')->where(array('id' => $user_id))->find();
freenetis/trunk/kohana/application/views/members_show.php
<td><?php echo number_format((float)$member_data->entrance_fee, 2, ',', ' ').' '.$this->setting->currency ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Debit payment rate') ?></th>
<th><?php echo url_lang::lang('texts.Monthly instalment of entrance') ?></th>
<td><?php echo number_format((float)$member_data->debt_payment_rate, 2, ',', ' ').' '.$this->setting->currency ?></td>
</tr>
<?php } ?>

Také k dispozici: Unified diff