Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e90048c8

Von Bernd Bleßmann vor etwa 11 Jahren hinzugefügt

  • ID e90048c8180f32f52f3f12ee52eb7269c4b27fcf
  • Vorgänger 073b5829
  • Nachfolger 9ed4151c

Steuernamen übersetztbar gemacht.

Unterschiede anzeigen:

SL/AM.pm
45 45
use SL::DB::AuthUser;
46 46
use SL::DB::Default;
47 47
use SL::DB::Employee;
48
use SL::GenericTranslations;
48 49

  
49 50
use strict;
50 51

  
......
1652 1653
                  taxnumber      = (SELECT accno FROM chart WHERE id= ? ),
1653 1654
                  chart_categories = ?
1654 1655
                WHERE id = ?|;
1655
    push(@values, $form->{id});
1656 1656

  
1657 1657
  } else {
1658 1658
    #ok
1659
    ($form->{id}) = selectfirst_array_query($form, $dbh, qq|SELECT nextval('id')|);
1659 1660
    $query = qq|INSERT INTO tax (
1660 1661
                  taxkey,
1661 1662
                  taxdescription,
1662 1663
                  rate,
1663 1664
                  chart_id,
1664 1665
                  taxnumber,
1665
                  chart_categories
1666
                  chart_categories,
1667
                  id
1666 1668
                )
1667
                VALUES (?, ?, ?, ?, (SELECT accno FROM chart WHERE id = ?), ? )|;
1669
                VALUES (?, ?, ?, ?, (SELECT accno FROM chart WHERE id = ?), ?, ?)|;
1668 1670
  }
1671
  push(@values, $form->{id});
1669 1672
  do_query($form, $dbh, $query, @values);
1673
  
1674
  foreach my $language_id (keys %{ $form->{translations} }) {
1675
    GenericTranslations->save('dbh'              => $dbh,
1676
                              'translation_type' => 'SL::DB::Tax/taxdescription',
1677
                              'translation_id'   => $form->{id},
1678
                              'language_id'      => $language_id,
1679
                              'translation'      => $form->{translations}->{$language_id});
1680
  }
1670 1681

  
1671 1682
  $dbh->commit();
1672 1683

  
SL/DB/Tax.pm
3 3
use strict;
4 4

  
5 5
use SL::DB::MetaSetup::Tax;
6
use SL::DB::Helper::TranslatedAttributes;
6 7

  
7 8
__PACKAGE__->meta->initialize;
8 9

  
SL/IS.pm
49 49
use SL::IO;
50 50
use SL::TransNumber;
51 51
use SL::DB::Default;
52
use SL::DB::Tax;
52 53
use Data::Dumper;
53 54

  
54 55
use strict;
......
386 387
    push(@{ $form->{TEMPLATE_ARRAYS}->{tax_nofmt} },      $taxamount );
387 388
    push(@{ $form->{TEMPLATE_ARRAYS}->{taxrate} },        $form->format_amount($myconfig, $form->{"${item}_rate"} * 100));
388 389
    push(@{ $form->{TEMPLATE_ARRAYS}->{taxrate_nofmt} },  $form->{"${item}_rate"} * 100);
389
    push(@{ $form->{TEMPLATE_ARRAYS}->{taxdescription} }, $form->{"${item}_description"} . q{ } . 100 * $form->{"${item}_rate"} . q{%});
390 390
    push(@{ $form->{TEMPLATE_ARRAYS}->{taxnumber} },      $form->{"${item}_taxnumber"});
391

  
392
    my $tax_obj     = SL::DB::Manager::Tax->find_by(taxnumber => $form->{"${item}_taxnumber"});
393
    my $description = $tax_obj->translated_attribute('taxdescription',  $form->{language_id}, 0) if $tax_obj;
394
    push(@{ $form->{TEMPLATE_ARRAYS}->{taxdescription} }, $description . q{ } . 100 * $form->{"${item}_rate"} . q{%});
391 395
  }
392 396

  
393 397
  for my $i (1 .. $form->{paidaccounts}) {
SL/OE.pm
43 43
use SL::DB::Order;
44 44
use SL::DB::PeriodicInvoicesConfig;
45 45
use SL::DB::Status;
46
use SL::DB::Tax;
46 47
use SL::DBUtils;
47 48
use SL::IC;
48 49

  
......
1284 1285
    push(@{ $form->{TEMPLATE_ARRAYS}->{tax_nofmt} },      $taxamount);
1285 1286
    push(@{ $form->{TEMPLATE_ARRAYS}->{taxrate} },        $form->format_amount($myconfig, $form->{"${item}_rate"} * 100));
1286 1287
    push(@{ $form->{TEMPLATE_ARRAYS}->{taxrate_nofmt} },  $form->{"${item}_rate"} * 100);
1287
    push(@{ $form->{TEMPLATE_ARRAYS}->{taxdescription} }, $form->{"${item}_description"} . q{ } . 100 * $form->{"${item}_rate"} . q{%});
1288 1288
    push(@{ $form->{TEMPLATE_ARRAYS}->{taxnumber} },      $form->{"${item}_taxnumber"});
1289

  
1290
    my $tax_obj     = SL::DB::Manager::Tax->find_by(taxnumber => $form->{"${item}_taxnumber"});
1291
    my $description = $tax_obj->translated_attribute('taxdescription',  $form->{language_id}, 0) if $tax_obj;
1292
    push(@{ $form->{TEMPLATE_ARRAYS}->{taxdescription} }, $description . q{ } . 100 * $form->{"${item}_rate"} . q{%});
1289 1293
  }
1290 1294

  
1291 1295
  $form->{nodiscount_subtotal} = $form->format_amount($myconfig, $form->{nodiscount_total}, 2);
bin/mozilla/am.pl
43 43
use SL::Iconv;
44 44
use SL::TODO;
45 45
use SL::DB::Printer;
46
use SL::DB::Tax;
47
use SL::DB::Language;
46 48
use CGI;
47 49

  
48 50
require "bin/mozilla/common.pl";
......
1415 1417

  
1416 1418
  my $parameters_ref = {
1417 1419
#    ChartTypeIsAccount         => $ChartTypeIsAccount,
1420
    LANGUAGES => SL::DB::Manager::Language->get_all_sorted,
1418 1421
  };
1419 1422

  
1420 1423
  # Ausgabe des Templates
......
1450 1453
  $form->header();
1451 1454

  
1452 1455
  my $parameters_ref = {
1456
    LANGUAGES => SL::DB::Manager::Language->get_all_sorted,
1457
    TAX       => SL::DB::Manager::Tax->find_by(id => $form->{id}),
1453 1458
  };
1454 1459

  
1455 1460
  # Ausgabe des Templates
......
1528 1533
    $form->error($locale->text('Tax Percent is a number between 0 and 100'));
1529 1534
  }
1530 1535

  
1536
  my @translation_keys  =  grep { $_ =~ '^translation_\d+' } keys %$form;
1537
  $form->{translations} = { map { $_ =~ '^translation_(\d+)'; $1 => $form->{$_} } @translation_keys };
1538

  
1531 1539
  AM->save_tax(\%myconfig, \%$form);
1532 1540
  $form->redirect($locale->text('Tax saved!'));
1533 1541

  
bin/mozilla/oe.pl
442 442
        shiptodepartment_1 shiptodepartment_2 shiptoemail shiptocp_gender
443 443
        message email subject cc bcc taxpart taxservice taxaccounts cursor_fokus),
444 444
        @custom_hiddens,
445
        map { $_.'_rate', $_.'_description' } split / /, $form->{taxaccounts} ];  # deleted: discount
445
        map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts} ];  # deleted: discount
446 446

  
447 447
  %TMPL_VAR = (
448 448
     %TMPL_VAR,
templates/webpages/am/edit_tax.html
1 1
[%- USE T8 %]
2 2
[%- USE HTML %]
3 3
[%- USE L %]
4
[%- USE LxERP %]
4 5
 <form method="post" action="am.pl">
5 6
  <input type="hidden" name="id" value="[% HTML.escape(id) %]">
6 7
  <input type="hidden" name="type" value="tax">
......
21 22
    <td><input name="taxdescription" size="60" value="[% HTML.escape(taxdescription) %]"></td>
22 23
   </tr>
23 24

  
25
   [%- FOREACH language = LANGUAGES %]
26
    <tr>
27
     <td>[%- HTML.escape(language.description) %] ([%- LxERP.t8('Translation') %])</td>
28
     <td>
29
      <input name="translation_[% language.id %]" value="[%- HTML.escape(TAX.translated_attribute('taxdescription', language, 1)) %]" size="60">
30
     </td>
31
    </tr>
32
   [%- END %]
33

  
24 34
   <tr>
25 35
    <td>[% 'tax_percent' | $T8 %]</td>
26 36
    <td>[% IF tax_already_used %]<p>[% HTML.escape(rate) %] %</p>

Auch abrufbar als: Unified diff