use SL::DB::AuthUser;
use SL::DB::Default;
use SL::DB::Employee;
+use SL::GenericTranslations;
use strict;
taxnumber = (SELECT accno FROM chart WHERE id= ? ),
chart_categories = ?
WHERE id = ?|;
- push(@values, $form->{id});
} else {
#ok
+ ($form->{id}) = selectfirst_array_query($form, $dbh, qq|SELECT nextval('id')|);
$query = qq|INSERT INTO tax (
taxkey,
taxdescription,
rate,
chart_id,
taxnumber,
- chart_categories
+ chart_categories,
+ id
)
- VALUES (?, ?, ?, ?, (SELECT accno FROM chart WHERE id = ?), ? )|;
+ VALUES (?, ?, ?, ?, (SELECT accno FROM chart WHERE id = ?), ?, ?)|;
}
+ push(@values, $form->{id});
do_query($form, $dbh, $query, @values);
+
+ foreach my $language_id (keys %{ $form->{translations} }) {
+ GenericTranslations->save('dbh' => $dbh,
+ 'translation_type' => 'SL::DB::Tax/taxdescription',
+ 'translation_id' => $form->{id},
+ 'language_id' => $language_id,
+ 'translation' => $form->{translations}->{$language_id});
+ }
$dbh->commit();
use strict;
use SL::DB::MetaSetup::Tax;
+use SL::DB::Helper::TranslatedAttributes;
__PACKAGE__->meta->initialize;
use SL::IO;
use SL::TransNumber;
use SL::DB::Default;
+use SL::DB::Tax;
use Data::Dumper;
use strict;
push(@{ $form->{TEMPLATE_ARRAYS}->{tax_nofmt} }, $taxamount );
push(@{ $form->{TEMPLATE_ARRAYS}->{taxrate} }, $form->format_amount($myconfig, $form->{"${item}_rate"} * 100));
push(@{ $form->{TEMPLATE_ARRAYS}->{taxrate_nofmt} }, $form->{"${item}_rate"} * 100);
- push(@{ $form->{TEMPLATE_ARRAYS}->{taxdescription} }, $form->{"${item}_description"} . q{ } . 100 * $form->{"${item}_rate"} . q{%});
push(@{ $form->{TEMPLATE_ARRAYS}->{taxnumber} }, $form->{"${item}_taxnumber"});
+
+ my $tax_obj = SL::DB::Manager::Tax->find_by(taxnumber => $form->{"${item}_taxnumber"});
+ my $description = $tax_obj->translated_attribute('taxdescription', $form->{language_id}, 0) if $tax_obj;
+ push(@{ $form->{TEMPLATE_ARRAYS}->{taxdescription} }, $description . q{ } . 100 * $form->{"${item}_rate"} . q{%});
}
for my $i (1 .. $form->{paidaccounts}) {
use SL::DB::Order;
use SL::DB::PeriodicInvoicesConfig;
use SL::DB::Status;
+use SL::DB::Tax;
use SL::DBUtils;
use SL::IC;
push(@{ $form->{TEMPLATE_ARRAYS}->{tax_nofmt} }, $taxamount);
push(@{ $form->{TEMPLATE_ARRAYS}->{taxrate} }, $form->format_amount($myconfig, $form->{"${item}_rate"} * 100));
push(@{ $form->{TEMPLATE_ARRAYS}->{taxrate_nofmt} }, $form->{"${item}_rate"} * 100);
- push(@{ $form->{TEMPLATE_ARRAYS}->{taxdescription} }, $form->{"${item}_description"} . q{ } . 100 * $form->{"${item}_rate"} . q{%});
push(@{ $form->{TEMPLATE_ARRAYS}->{taxnumber} }, $form->{"${item}_taxnumber"});
+
+ my $tax_obj = SL::DB::Manager::Tax->find_by(taxnumber => $form->{"${item}_taxnumber"});
+ my $description = $tax_obj->translated_attribute('taxdescription', $form->{language_id}, 0) if $tax_obj;
+ push(@{ $form->{TEMPLATE_ARRAYS}->{taxdescription} }, $description . q{ } . 100 * $form->{"${item}_rate"} . q{%});
}
$form->{nodiscount_subtotal} = $form->format_amount($myconfig, $form->{nodiscount_total}, 2);
use SL::Iconv;
use SL::TODO;
use SL::DB::Printer;
+use SL::DB::Tax;
+use SL::DB::Language;
use CGI;
require "bin/mozilla/common.pl";
my $parameters_ref = {
# ChartTypeIsAccount => $ChartTypeIsAccount,
+ LANGUAGES => SL::DB::Manager::Language->get_all_sorted,
};
# Ausgabe des Templates
$form->header();
my $parameters_ref = {
+ LANGUAGES => SL::DB::Manager::Language->get_all_sorted,
+ TAX => SL::DB::Manager::Tax->find_by(id => $form->{id}),
};
# Ausgabe des Templates
$form->error($locale->text('Tax Percent is a number between 0 and 100'));
}
+ my @translation_keys = grep { $_ =~ '^translation_\d+' } keys %$form;
+ $form->{translations} = { map { $_ =~ '^translation_(\d+)'; $1 => $form->{$_} } @translation_keys };
+
AM->save_tax(\%myconfig, \%$form);
$form->redirect($locale->text('Tax saved!'));
shiptodepartment_1 shiptodepartment_2 shiptoemail shiptocp_gender
message email subject cc bcc taxpart taxservice taxaccounts cursor_fokus),
@custom_hiddens,
- map { $_.'_rate', $_.'_description' } split / /, $form->{taxaccounts} ]; # deleted: discount
+ map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts} ]; # deleted: discount
%TMPL_VAR = (
%TMPL_VAR,
[%- USE T8 %]
[%- USE HTML %]
[%- USE L %]
+[%- USE LxERP %]
<form method="post" action="am.pl">
<input type="hidden" name="id" value="[% HTML.escape(id) %]">
<input type="hidden" name="type" value="tax">
<td><input name="taxdescription" size="60" value="[% HTML.escape(taxdescription) %]"></td>
</tr>
+ [%- FOREACH language = LANGUAGES %]
+ <tr>
+ <td>[%- HTML.escape(language.description) %] ([%- LxERP.t8('Translation') %])</td>
+ <td>
+ <input name="translation_[% language.id %]" value="[%- HTML.escape(TAX.translated_attribute('taxdescription', language, 1)) %]" size="60">
+ </td>
+ </tr>
+ [%- END %]
+
<tr>
<td>[% 'tax_percent' | $T8 %]</td>
<td>[% IF tax_already_used %]<p>[% HTML.escape(rate) %] %</p>