Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 325

Přidáno uživatelem Michal Kliment před asi 15 roky(ů)

Pridana moznost pridavani vice polozek faktur najednou...

Zobrazit rozdíly:

freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php
'fees have been successfully deducted' => 'Členské příspěvky byly úspěšně strženy.',
'file' => 'Soubor',
'file with bank transfer listing' => 'HTML soubor s výpisem z banky',
'fill in at least one from prices' => 'Vyplňte alespoň jednu z cen.',
'filter' => 'Filtrovat',
'finances' => 'Finance',
'former member' => 'Bývalý člen',
......
'iface' => 'Rozhraní',
'iface has not been selected' => 'Rozhraní nebylo vybráno.',
'ifaces' => 'Rozhraní',
'ignore' => 'Ignorovat',
'import new invoice' => 'Import nové faktury',
'in database can be only one infrastructure account' => 'V databázi může být pouze jeden účet infrastruktury.',
'in database can be only one master bank account' => 'V databázi může být pouze jeden hlavní bankovní účet',
......
'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.',
'item number' => 'Položka č.',
'item(s) have been successfully added' => 'položka(ek) bylo úspěšně přidáno',
'language' => 'Jazyk',
'leaving date' => 'Datum vystoupení',
'list of all invoices' => 'Seznam všech faktur',
......
'number of the hours' => 'počet hodin',
'old password' => 'staré heslo',
'operating account' => 'Provozní účet',
'optional' => 'nepovinné',
'or' => 'nebo',
'order number' => 'Číslo objednávky',
'origin account' => 'Zdrojový účet',
freenetis/trunk/kohana/application/controllers/invoice_items.php
// creates form
$this->form = new Forge(url_lang::base().'invoice_items/add/'.$invoice_id, '', 'POST', array('id' => 'article_form'));
$this->form = new Forge(url_lang::base().'invoice_items/add/'.$invoice_id.'/'.$item_count, '', 'POST', array('id' => 'article_form'));
$this->form->set_attr('class', 'form_class')->set_attr('method', 'post');
$this->form->group('')->label(url_lang::lang('texts.Basic information'));
$this->form->dropdown('invoice_id')->label(url_lang::lang('texts.Invoice number').':')->options($arr_invoices)->rules('required')->selected($invoice_id);
for ($i=0;$i<$item_count;$i++)
// creates first, only one required,
$this->form->group('')->label(url_lang::lang('texts.Item number').' 1');
$this->form->input('name_0')->label(url_lang::lang('texts.Name').':')->rules('required|length[3,40]');
$this->form->input('code_0')->label(url_lang::lang('texts.Code').':')->rules('required|length[3,40]');
$this->form->input('quantity_0')->label(url_lang::lang('texts.Quantity').':')->rules('required|length[1,40]|valid_numeric');
$this->form->input('author_fee_0')->label(url_lang::lang('texts.Author fee').':')->rules('length[1,40]|valid_numeric');
$this->form->input('contractual_increase_0')->label(url_lang::lang('texts.Contractual increase').':')->rules('length[1,40]|valid_numeric');
$this->form->radio('service_0')->label(url_lang::lang('texts.Service').':')->options(array('1'=>url_lang::lang('texts.Yes'),'0'=>url_lang::lang('texts.No')))->default(0);
$this->form->input('price_0')->label(url_lang::lang('texts.Price').':')->rules('length[1,40]|valid_numeric');
$this->form->input('price_vat_0')->label(url_lang::lang('texts.Price vat').':')->rules('length[1,40]|valid_numeric')->callback(array($this,'valid_prices'));
for ($i=1;$i<$item_count;$i++)
{
$this->form->group('')->label(url_lang::lang('texts.Item number').' '.($i+1));
$this->form->input('name['.$i.']')->label(url_lang::lang('texts.Name').':')->rules('required|length[3,40]');
$this->form->input('code['.$i.']')->label(url_lang::lang('texts.Code').':')->rules('required|length[3,40]');
$this->form->input('quantity['.$i.']')->label(url_lang::lang('texts.Quantity').':')->rules('required|length[1,40]|valid_numeric');
$this->form->input('author_fee['.$i.']')->label(url_lang::lang('texts.Author fee').':')->rules('length[1,40]|valid_numeric');
$this->form->input('contractual_increase['.$i.']')->label(url_lang::lang('texts.Contractual increase').':')->rules('length[1,40]|valid_numeric');
$this->form->radio('service['.$i.']')->label(url_lang::lang('texts.Service').':')->options(array('1'=>url_lang::lang('texts.Yes'),'0'=>url_lang::lang('texts.No')))->default(0);
$this->form->input('price['.$i.']')->label(url_lang::lang('texts.Price').':')->rules('required|length[3,40]|valid_numeric');
$this->form->input('price_vat['.$i.']')->label(url_lang::lang('texts.Price vat').':')->rules('required|length[3,40]|valid_numeric');
$this->form->group('')->label(url_lang::lang('texts.Item number').' '.($i+1).' - '.url_lang::lang('texts.optional'));
$this->form->checkbox('ignore_'.$i.'')->label(url_lang::lang('texts.Ignore'))->value('1')->checked(FALSE)->
onclick('ignore = document.getElementById(\'ignore_'.$i.'\').checked; document.getElementById(\'name_'.$i.'\').disabled = ignore; document.getElementById(\'code_'.$i.'\').disabled = ignore; document.getElementById(\'quantity_'.$i.'\').disabled = ignore; document.getElementById(\'author_fee_'.$i.'\').disabled = ignore; document.getElementById(\'contractual_increase_'.$i.'\').disabled = ignore; document.getElementById(\'price_'.$i.'\').disabled = ignore; document.getElementById(\'price_vat_'.$i.'\').disabled = ignore;');
$this->form->input('name_'.$i.'')->label(url_lang::lang('texts.Name').':')->rules('length[3,40]')->callback(array($this,'valid_name'))->onKeyUp('document.getElementById(\'ignore_'.$i.'\').checked = false;');
$this->form->input('code_'.$i.'')->label(url_lang::lang('texts.Code').':')->rules('length[3,40]')->callback(array($this,'valid_code'))->onKeyUp('document.getElementById(\'ignore_'.$i.'\').checked = false;');
$this->form->input('quantity_'.$i.'')->label(url_lang::lang('texts.Quantity').':')->rules('length[1,40]|valid_numeric')->callback(array($this,'valid_quantity'))->onKeyUp('document.getElementById(\'ignore_'.$i.'\').checked = false;');
$this->form->input('author_fee_'.$i.'')->label(url_lang::lang('texts.Author fee').':')->rules('length[1,40]|valid_numeric')->onKeyUp('document.getElementById(\'ignore_'.$i.'\').checked = false;');
$this->form->input('contractual_increase_'.$i.'')->label(url_lang::lang('texts.Contractual increase').':')->rules('length[1,40]|valid_numeric')->onKeyUp('document.getElementById(\'ignore_'.$i.'\').checked = false;');
$this->form->radio('service_'.$i.'')->label(url_lang::lang('texts.Service').':')->options(array('1'=>url_lang::lang('texts.Yes'),'0'=>url_lang::lang('texts.No')))->default(0)->onKeyUp('document.getElementById(\'ignore_'.$i.'\').checked = false;');
$this->form->input('price_'.$i.'')->label(url_lang::lang('texts.Price').':')->rules('length[1,40]|valid_numeric')->onKeyUp('document.getElementById(\'ignore_'.$i.'\').checked = false;');
$this->form->input('price_vat_'.$i.'')->label(url_lang::lang('texts.Price vat').':')->rules('length[1,40]|valid_numeric')->callback(array($this,'valid_prices'))->onKeyUp('document.getElementById(\'ignore_'.$i.'\').checked = false;');
}
$this->form->submit('submit')->value(url_lang::lang('texts.Add'));
......
if ($this->form->validate())
{
$form_data = $this->form->as_array();
$count_saved = 0;
// creates new Invoice
$invoice_item = new Invoice_item_Model();
for ($i=0;$i<$item_count;$i++)
{
if ((isset($form_data['ignore_'.$i]) && !$form_data['ignore_'.$i]) || !isset($form_data['ignore_'.$i]))
{
// creates new Invoice
$invoice_item = new Invoice_item_Model();
$invoice_item->invoice_id = $form_data['invoice_id'];
$invoice_item->name = $form_data['name_'.$i];
$invoice_item->code = $form_data['code_'.$i];
$invoice_item->quantity = (double) $form_data['quantity_'.$i];
$invoice_item->author_fee = (double) $form_data['author_fee_'.$i];
$invoice_item->contractual_increase = (double) $form_data['contractual_increase_'.$i];
$invoice_item->service = $form_data['service_'.$i];
$invoice_item->price = (double) $form_data['price_'.$i];
$invoice_item->price_vat = (double) $form_data['price_vat_'.$i];
/*$invoice_item->invoice_id = $form_data['invoice_id'];
$invoice_item->name = $form_data['name'];
$invoice_item->code = $form_data['code'];
$invoice_item->quantity = (double) $form_data['quantity'];
$invoice_item->author_fee = (double) $form_data['author_fee'];
$invoice_item->contractual_increase = (double) $form_data['contractual_increase'];
$invoice_item->service = $form_data['service'];
$invoice_item->price = (double) $form_data['price'];
$invoice_item->price_vat = (double) $form_data['price_vat'];*/
if (!$invoice_item->price || !$invoice_item->price_vat)
{
$invoice = new Invoice_Model($invoice_id);
$vat = ($invoice->vat/100)+1;
if (!$invoice_item->price_vat)
{
$invoice_item->price_vat = round($invoice_item->price * $vat,2);
}
else
{
$invoice_item->price = round($invoice_item->price_vat / $vat,2);
}
}
if ($invoice_item->save()) $count_saved++;
}
}
// succes
if ($invoice_item->save())
{
$this->session->set_flash('message', url_lang::lang('texts.Invoice item has been successfully added.'));
$this->session->set_flash('message', $count_saved.' '.url_lang::lang('texts.item(s) have been successfully added.'));
}
url::redirect(url_lang::base().'invoices/show/'.$invoice_id);
}
......
url::redirect(url_lang::base().'invoices/show/'.$invoice_id);
}
function valid_name ($input)
{
$method = $input->method;
$ignore_name = str_replace ('name_','ignore_',$input->name);
if (!$this->input->$method($ignore_name) && !$input->value)
{
$input->add_error('required', vsprintf(url_lang::lang('validation.required.'),utf8::strtolower(url_lang::lang('texts.name'))));
}
}
function valid_code ($input)
{
$method = $input->method;
$ignore_name = str_replace ('code_','ignore_',$input->name);
if (!$this->input->$method($ignore_name) && !$input->value)
{
$input->add_error('required', vsprintf(url_lang::lang('validation.required.'),utf8::strtolower(url_lang::lang('texts.code'))));
}
}
function valid_quantity ($input)
{
$method = $input->method;
$ignore_name = str_replace ('quantity_','ignore_',$input->name);
if (!$this->input->$method($ignore_name) && !$input->value)
{
$input->add_error('required', vsprintf(url_lang::lang('validation.required.'),utf8::strtolower(url_lang::lang('texts.quantity'))));
}
}
function valid_prices ($input)
{
$method = $input->method;
$ignore_name = str_replace ('price_vat_','ignore_',$input->name);
$price_name = str_replace ('price_vat_','price_',$input->name);
if (!$this->input->$method($ignore_name) && !$this->input->$method($price_name) && !$input->value)
{
$input->add_error('required', url_lang::lang('texts.Fill in at least one from prices.'));
}
}
}
?>
freenetis/trunk/kohana/application/upgrade_sql/upgrade_sql.php
}
$upgrade_sql[get_SVN_rev()] = array(
"UPDATE `enum_types` SET `value` = 'Sympathizing member' WHERE `enum_types`.`id` =4 LIMIT 1 ;",
"UPDATE `enum_types` SET `value` = 'Nonmember' WHERE `enum_types`.`id` =5 LIMIT 1 ;",
"UPDATE `enum_types` SET `value` = 'Fee-free regular member' WHERE `enum_types`.`id` =6 LIMIT 1 ;",
"INSERT INTO `translations` (
`id` ,
`original_term` ,
`translated_term` ,
`lang`
)
VALUES (
NULL , 'Fee-free regular member', 'Řádný člen osvobozený od členských příspěvků', 'cs'
);",
"INSERT INTO `translations` (
`id` ,
`original_term` ,
`translated_term` ,
`lang`
)
VALUES (
NULL , 'Sympathizing member', 'Sympatizující člen', 'cs'
);",
"DELETE FROM `enum_types` WHERE `enum_types`.`id` = 15 LIMIT 1",
"DELETE FROM `enum_types` WHERE `enum_types`.`id` = 16 LIMIT 1"
"ALTER TABLE `invoices` CHANGE `vat` `vat` DOUBLE NOT NULL "
);
?>
freenetis/trunk/kohana/application/upgrade_sql/upgrade_sql_324.php
<?php
$upgrade_sql[324] = array(
"UPDATE `enum_types` SET `value` = 'Sympathizing member' WHERE `enum_types`.`id` =4 LIMIT 1 ;",
"UPDATE `enum_types` SET `value` = 'Nonmember' WHERE `enum_types`.`id` =5 LIMIT 1 ;",
"UPDATE `enum_types` SET `value` = 'Fee-free regular member' WHERE `enum_types`.`id` =6 LIMIT 1 ;",
"INSERT INTO `translations` (
`id` ,
`original_term` ,
`translated_term` ,
`lang`
)
VALUES (
NULL , 'Fee-free regular member', 'Řádný člen osvobozený od členských příspěvků', 'cs'
);",
"INSERT INTO `translations` (
`id` ,
`original_term` ,
`translated_term` ,
`lang`
)
VALUES (
NULL , 'Sympathizing member', 'Sympatizující člen', 'cs'
);",
"DELETE FROM `enum_types` WHERE `enum_types`.`id` = 15 LIMIT 1",
"DELETE FROM `enum_types` WHERE `enum_types`.`id` = 16 LIMIT 1"
);
?>

Také k dispozici: Unified diff